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
1902.07599
1
1902
2019-02-20T15:34:06
Fast, Small, and Simple Document Listing on Repetitive Text Collections
[ "cs.DS", "cs.IR", "cs.IT", "cs.IT" ]
Document listing on string collections is the task of finding all documents where a pattern appears. It is regarded as the most fundamental document retrieval problem, and is useful in various applications. Many of the fastest-growing string collections are composed of very similar documents, such as versioned code and document collections, genome repositories, etc. Plain pattern-matching indexes designed for repetitive text collections achieve orders-of-magnitude reductions in space. Instead, there are not many analogous indexes for document retrieval. In this paper we present a simple document listing index for repetitive string collections of total length $n$ that lists the $ndoc$ distinct documents where a pattern of length $m$ appears in time $\mathcal{O}(m+ndoc \cdot \log n)$. We exploit the repetitiveness of the document array (i.e., the suffix array coarsened to document identifiers) to grammar-compress it while precomputing the answers to nonterminals, and store them in grammar-compressed form as well. Our experimental results show that our index sharply outperforms existing alternatives in the space/time tradeoff map.
cs.DS
cs
Fast, Small, and Simple Document Listing on Repetitive Text Collections∗ Dustin Cobas and Gonzalo Navarro CeBiB -- Center for Biotechnology and Bioengineering, Department of Computer Science, University of Chile, Chile. [email protected],[email protected] Abstract Document listing on string collections is the task of finding all documents where a pattern ap- pears. It is regarded as the most fundamental document retrieval problem, and is useful in various applications. Many of the fastest-growing string collections are composed of very similar documents, such as versioned code and document collections, genome repositories, etc. Plain pattern-matching indexes designed for repetitive text collections achieve orders-of-magnitude re- ductions in space. In this paper we present a simple document listing index for repetitive string collections of total length n that lists the ndoc distinct documents where a pattern of length m appears in time O(m + ndoc · lg n). We exploit the repetitiveness of the document array (i.e., the suffix array coarsened to document identifiers) to grammar-compress it while precomputing the answers to nonterminals, and store them in grammar-compressed form as well. Our experimental results show that our index sharply outperforms existing alternatives in the space/time tradeoff map. Instead, there are not many analogous indexes for document retrieval. 1998 ACM Subject Classification E.1 Data Structures; E.4 Coding and Information Theory; H.3 Information Storage and Retrieval Keywords and phrases Document retrieval; Succinct data structures; Grammar compression; Repetitive text collections Digital Object Identifier 10.4230/LIPIcs... 1 Introduction Document retrieval is a family of problems aimed at retrieving documents from a set that are relevant to a query pattern. In a rather general setting, both documents and patterns are arbitrary strings. This encompasses the well-known application of natural language and Web searching, but also many others of interest in bioinformatics, software development, and multimedia retrieval, to name a few [22]. The most fundamental document retrieval problem, on top of which more sophisticated ones are built, is document listing. This problem aims at simply returning the list of documents where the pattern appears. An obvious solution to document listing resorts to pattern matching: find all the occ positions where the pattern appears, and then return the ndoc different documents where those positions lie. This solution requires time Ω(occ) and the output is of size O(ndoc), so the approach is very inefficient if ndoc (cid:28) occ (i.e., if the pattern appears many times in the same documents). A better solution, which however applies only in natural language settings, resorts to inverted indexes [1]. These restrict the possible patterns to sequences of words and store the list of the documents where each word appears, thereby solving document listing via intersections of the lists of the pattern words. ∗ Funded with basal funds FB0001 and by Fondecyt Grant 1-170048, Conicyt, Chile. © Dustin Cobas, Gonzalo Navarro; licensed under Creative Commons License CC-BY Leibniz International Proceedings in Informatics Schloss Dagstuhl -- Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany 9 1 0 2 b e F 0 2 ] S D . s c [ 1 v 9 9 5 7 0 . 2 0 9 1 : v i X r a XX:2 Fast, Small, and Simple Document Listing on Repetitive Text Collections Muthunkishnan [20] designed the first linear-space and optimal-time index for general string collections. Given a collection of total length n, he builds an index of O(n) words that lists the ndoc documents where a pattern of length m appears in time O(m + ndoc). While linear space is deemed as sufficiently small in classic scenarios, the solution is impractical for very large text collections unless one resorts to disk, which is orders of magnitude slower. Sadakane [26] showed how to reduce the space of Muthukrishnan's index to that of the statistically-compressed text plus O(n) bits, while raising the time complexity to only O(m + ndoc · lg n) if the appropriate underlying pattern-matching index is used [2]. The sharp growth of text collections is a concern in many recent applications, outperform- ing Moore's Law in some cases [27]. Fortunately, many of the fastest-growing text collections are highly repetitive: each document can be obtained from a few large blocks of other doc- uments. These collections arise in different areas, such as repositories of genomes of the same species (which differ from each other by a small percentage only) like the 100K-genome project1, software repositories that store all the versions of the code arranged in a tree or acyclic graph like GitHub2, versioned document repositories where each document has a timeline of versions like Wikipedia3, etc. On such text collections, statistical compression is ineffective [14] and even O(n) bits of extra space can be unaffordable. Repetitiveness is the key to tackle the fast growth of these collections: their amount of new material grows much slower than their size. For example, version control systems compress those collections by storing the list of edits with respect to some reference document that is stored in plain form, and reconstruct it by applying the edits to the reference version. Much more challenging, however, is to index those collections in small space so as to support fast pattern matching or document retrieval tasks. To date, there exist several pattern matching indexes for repetitive text collections (see a couple of studies [21, 10] and references therein). However, there are not many document retrieval indexes for repetitive text collections [5, 8, 23]. Most of these indexes [26, 8] rely on a pattern-matching index needs Ω(n) bits in order to offer O(lg n) time per retrieved document. In this paper we introduce new simple and efficient document listing indexes aimed at highly repetitive text collections. Like various preceding indexes, we achieve O(m+ndoc·lg n) search time, yet our indexes are way faster and/or smaller than previous ones on various repetitive datasets, because they escape from the space/time tradeoff of the pattern-matching index. Our main idea is as follows: we use the document array DA[1..n] [20], which projects the entries of the suffix array [19] to the document where each position belongs. Document listing boils down to listing the distinct integers in a range DA[sp..ep], where sp and ep are found in time O(m). Array DA must be grammar-compressible since the differential suffix array is known to be so on repetitive texts [11, 10]. We then build a balanced binary context- free grammar that generates (only) DA. This allows us retrieve any individual cell of DA in time O(lg n) and any range DA[sp..ep] in time O(ep − sp + lg n). We can then implement existing indexes [26, 8] within much less space and without affecting their time complexities. Further, we propose a new simple index based on the grammar-compressed array DA. Our compression guarantees that any range DA[sp..ep] is covered by O(lg n) nonterminals. For each nonterminal of the grammar, we store the list of the distinct documents appearing in it. The set of all the lists is grammar-compressed as well, as done in previous work [5, 8]. We then merge the lists of the O(lg n) nonterminals that cover DA[sp..ep], in time O(ndoc · lg n). 1 https://www.genomicsengland.co.uk/about-genomics-england/the-100000-genomes-project 2 https://github.com/search?q=is:public 3 https://en.wikipedia.org/wiki/Wikipedia:Size_of_Wikipedia Dustin Cobas and Gonzalo Navarro XX:3 2 Preliminaries A document T is a sequence of symbols over an alphabet Σ = [1..σ], terminated by a special symbol $ that is lexicographically smaller than any symbol of Σ. A collection D is a set of d documents D = {T1, . . . , Td}. D is commonly represented as the concatenation of all its documents, T = T1T2 . . . Td, of length T = n. A pattern P is a string over the same alphabet Σ with length P = m. It occurs occ times in T , and appears in ndoc documents. Text indexes. The suffix tree [28] of a string T is a compressed digital tree storing all the suffixes T [i..n], for all 1 ≤ i ≤ n. The suffix tree node reached by following the symbols of a pattern P is called the locus of P and is the ancestor of all the occ leaves corresponding to the positions of P in T . The suffix tree uses O(n lg n) bits and lists all the occurrences of P in time O(m + occ). The suffix array [19] SA[1..n] of a string T [1..n] is a permutation of the starting positions of all the suffixes of T in lexicographic order, T [SA[i], n] < T [SA[i + 1], n] for all 1 ≤ i < n. SA can be binary searched to obtain the range SA[sp..ep] of all the suffixes prefixed by P (note occ = ep − sp + 1). Thus the occurrences of P can be listed in time O(m lg n + occ). The suffix array takes n lg n bits. Compressed suffix arrays (CSAs) [24] are space-efficient representations of the suffix array. They find the interval [sp..ep] corresponding to P[1..m] in time tsearch(m), and access any cell SA[i] in time tlookup(n). Their size in bits, CSA, is usually bounded by O(n lg σ). Grammar compression. Grammar compression of a string S[1..n] replaces it by a context- free grammar (CFG) G that uniquely generates S. This CFG G may require less space than the original sequence S, especially when S is repetitive. Finding the smallest CFG G∗ generating the input S is NP-hard [16], but various O(lg(n/G∗))-approximations exist. In particular, we are interested in approximations that are binary (i.e., the maximum arity of the parse tree is 2) and balanced (i.e., any substring is covered by O(lg n) maximal nodes of the parse tree) [25, 3, 13]. 3 Related Work Muthukrishnan [20] proposed the first optimal-time linear-space solution to the document listing problem. He defines the document array DA[1..n] of T , where DA[i] stores the identifier of the document to which T [SA[i]] belongs. The document listing problem is then translated into computing the ndoc distinct identifiers in the interval DA[sp..ep] corresponding to the pattern P. He uses a suffix tree to find sp and ep in time O(m), and then an algorithm that finds the ndoc distinct numbers in the range in time O(ndoc). Sadakane [26] adapts the method of Muthukrishnan to use much less space. He replaces the suffix tree by a CSA, and mimics the algorithm to find the distinct numbers in DA[sp..ep] using only O(n) bits of space. Within CSA+O(n) bits, he performs document listing in time O(tsearch(m) +ndoc·tlookup(n)). Using a particular CSA [2] the space is n lg σ+o(n lg σ)+O(n) bits and the time is O(m + ndoc · lg n). There are many other classical and compact indexes for document listing. We refer the reader to a survey [22] and focus on those aimed at repetitive text collections. Gagie et al. [8] proposed a technique adapting Sadakane's solution to highly repetitive collections. They show that the technique to find the distinct elements of DA[sp..ep] can be applied almost verbatim on an array they call interleaved longest-common-prefix array (ILCP). On repetitive collections, this array can be decomposed into a small number ρ of equal values, XX:4 Fast, Small, and Simple Document Listing on Repetitive Text Collections which allows them represent it in little space. The ILCP index requires CSA+O((ρ+d) lg n) bits of space and solves document listing in time O(tsearch(m) +ndoc · tlookup(n)). Gagie et al. [8] proposed another radically different approach, called Precomputed Docu- ment Lists (PDL). The idea is to store the list of the documents where (the corresponding substring of) each suffix tree node appears. Then the search consists of finding the locus of P and returning its list. To reduce space, however, only some sampled nodes store their lists, and so document listing requires merging the lists of the maximal sampled nodes descending from the locus node. To further save space, the lists are grammar-compressed, which is effective when the collection D is repetitive. To bound the query time, the deepest sampled nodes cover at most b leaves, and a factor β restricts the work done per document to be merged in the unions of the lists. The index then requires CSA + O((n/b) lg n) bits, and the document listing time is O(tsearch(m) +ndoc · β · h + b · tlookup(n)), where h is the height of the suffix tree. A problem in all the revisited CSA-based solutions are the extra Θ((n lg n)/ tlookup(n)) bits that must be included in CSA in order to get Θ(tlookup(n)) time per document. This space does not decrease with repetitiveness, forcing all these indexes to use Ω(n) bits to obtain time O(tsearch(m) +ndoc · lg n), for example. Claude and Munro [5] propose the first index for document listing based on grammar compression, which escapes from the problem above. They extend a grammar-based pattern- matching index [6] by storing the list of the documents where each nonterminal appears. Those lists are grammar-compressed as well. The index searches for the minimal nonterminals that contain P and merges their lists. While it does not offer relevant space or query time guarantees, the index performs well in practice. Navarro [23] extends this index in order to obtain space guarantees and O(m2 + m lg2 n) time, but the scheme is difficult to implement. 4 Our Document Listing Index Like most of the previous work, we solve the document listing problem by computing the ndoc distinct documents in the interval DA[sp..ep] corresponding to the pattern P, found with a CSA in time O(tsearch(m)). Instead of also using the CSA to compute the values of DA (and thus facing the problem of using Θ((n lg n)/ tlookup(n)) bits to compute a cell in time Θ(tlookup(n)), as it happens in previous work [26, 8]), we store the array DA directly, yet in grammar-compressed form. This is promising because the suffix array of repetitive collections is known to have large areas SA[i..i + '] that appear shifted by 1 elsewhere, SA[j..j + '], that is, SA[i + k] = SA[j + k] + 1 for all 0 ≤ k ≤ ' [18, 10]. Except for the d entries of SA that point to the ends of the documents, it also holds that DA[i + k] = DA[j + k]. Grammar compression is then expected to exploit those large repeated areas in DA. To answer the queries efficiently, we use an idea similar to the one introduced in PDL [8] and the Grammar-index [5]: precomputing and storing the answers of document listing queries, and grammar-compressing those lists as well. An important difference with them is that PDL stores lists for suffix tree nodes and the Grammar-index stores lists for nonterminals of the grammar of T . Our index, instead, stores lists for the nonterminals of the grammar of DA. This is much simpler because we do not store a suffix tree topology (like PDL) nor a complex grammar-based pattern-matching index (like the Grammar-index): we simply find the interval DA[sp..ep] using the CSA, fetch the nonterminals covering it, and merge their lists. By using a binary balanced grammar on DA, we ensure that any document is obtained in the merging only O(lg n) times, which leads to our worst-case bound of O(ndoc · lg n). PDL and the Grammar-index cannot offer such a logarithmic-time guarantee. Dustin Cobas and Gonzalo Navarro XX:5 4.1 Structure The first component of our index is a CSA suitable for repetitive collections, of which we are only interested in the functionality of finding the interval SA[sp..ep] corresponding to a pattern P[1..m]. For example, we can use the Run-Length CSA (RLCSA) variant of Gagie et al. [10], which offers times tsearch(m) = O(m lg lgw σ) within O(r lg n) bits, or tsearch(m) = O(m) within O(r lg(n/r) lg n) bits, where r is the number of equal-letter runs in the Burrows-Wheeler Transform of T . This also upper-bounds the number of areas SA[i..i+'] into which SA can be divided such that each area appears elsewhere shifted by 1 [17]. The second component is the grammar G that generates DA[1..n], which must be bin- ary and balanced. Such grammars can be built so as to ensure that their total size is O(r lg(n/r) lg n) bits [9], which is of the same order of the first component. The third component are the lists Dv of the distinct documents that appear in the expansion of each nonterminal v of G. These lists are stored in ascending order to merge them easily. To reduce their size, the set of sequences D1, . . . , Dg are grammar-compressed as a whole in a new grammar G0, ensuring that no nonterminal of G0 expands beyond a list Dv. Each list Dv can then be obtained in optimal time, O(Dv), from a nonterminal of G0. 4.2 Document listing Given a pattern P[1..m], we use the CSA to find the range [sp..ep] where the occurrences of P lie in the suffix array, in time O(tsearch(m)). We then find the maximal nodes of the parse tree of DA that cover DA[sp..ep]. Finally, we decompress the lists of the nonterminals corresponding to those maximal nodes, and compute their union. Since G is binary and balanced, there are O(lg n) maximal nonterminals that cover DA[sp..ep] in the parse tree. By storing the length to which each nonterminal of G expands, we can easily find those O(lg n) maximal nonterminals in time O(lg n), by (virtually) descending in the parse tree from the initial symbol of G towards the area DA[sp..ep]. To merge the O(lg n) lists of documents in ascending order, we use an atomic heap [7] (see practical considerations in the next section). This data structure performs insert and extractmin operations in constant amortized time, when storing O(lg2 n) elements. We then insert the heads of the O(lg n) lists in the atomic heap, extract the minimum, and insert the next element of its list. If we extract the same document many times, we report only one copy. We then expand and merge the lists Dv1, . . . , Dvk in time O(Dv1 + ··· + Dvk). Since each distinct document we report may appear in the O(lg n) lists, our document listing solution takes time O(tsearch(m) +ndoc · lg n). By using the RLCSA that occupies O(r lg(n/r) lg n) bits, the total time is O(m + ndoc · lg n). 4.3 Plugging-in other indexes Our grammar-compressed DA, without the lists Dv, can be used to replace the CSA compon- ent that requires Θ((n lg n)/ tlookup(n)) bits to compute a cell in time Θ(tlookup(n)). These indexes actually access cells SA[i] in order to obtain DA[i]. Our grammar-compressed DA offers O(lg n) access time within O(r lg(n/r) lg n) bits of space. Therefore, we can implement Sadakane's solution [26], as well as ILCP and PDL [8] all answering in time O(m + ndoc · lg n), and replacing the O((n lg n)/ tlookup(n)) part of their CSA space by O(r lg(n/r) lg n) bits (which also accounts for the RLCSA variant that finds [sp..ep] in time O(m). We can also implement the brute-force solution in time O(m + occ + lg n) and O(r lg(n/r) lg n) bits by extracting the whole DA[sp..ep]. XX:6 Fast, Small, and Simple Document Listing on Repetitive Text Collections 5 Practical Considerations 5.1 Compressed suffix array We use a practical RLCSA [18, called RLFM+ in there] that uses (r lg σ+2r lg(n/r))(1+o(1)) bits of space and offers search time tsearch(m) in O(m lg r) ⊆ O(m lg n). Since we do not need to compute cells of SA with this structure, we do not need to spend the O((n lg n)/ tlookup(n)) bits, and as a result the contribution of the RLCSA to the total space is negligible. 5.2 Grammar compressor We choose Re-Pair [15] to obtain both G and G0, since it performs very well in practice. Re- Pair repeatedly replaces the most frequent pair of adjacent symbols with a new nonterminal, until every pair is unique. Upon ties in frequency, we give priority to the pairs whose symbols have been generated earlier, which in practice yielded rather balanced grammars in all the cases we have tried. Re-Pair yields a binary grammar, but the top-level is a sequence of terminals and nonterminals. We then complete the grammar by artificially adding a parse tree on top of the final sequence left by Re-Pair. To minimize the height of the resulting grammar, we merge first the pairs of nonterminals with shorter parse trees. Ai is the ith nonterminal of the grammar, it holds that Ai → AG[2i]AG[2i+1]. We store the g grammar rules as an array G taking 2g lg(g + d) bits of space, so that if When building G0, we concatenate all the lists Dv and separate them with unique numbers larger than d, to ensure that Re-Pair will not produce nonterminals that cross from one list to another. After running Re-Pair, we remove the separators but do not complete the grammars, as all we need is to decompress any Dv in optimal time. We represent all the reduced sets D0 v as a sequence D0, marking the beginning of each set in a bitvector B. The beginning of D0 v is found with operation select(B, v), which finds the vth 1 in B. This operation can be implemented in constant time using o(B) further bits [4]. 5.3 Sampling The largest component of our index is the set of compressed lists D0 v. To reduce this space, we will store those lists only for some sampled nonterminals v of G. The list of a nonsampled nonterminal v is then obtained by merging those of the highest sampled descendants of v in the parse tree, which yields a space/time tradeoff. We use a strategy similar to PDL [8], based on parameters b and β. We define a sampled tree by sampling some nodes from the parse tree. First, no leaf v of the sampled tree can have an expansion larger than b, so that we spend time O(b lg b) to obtain its sorted list directly from G. To this aim, we sample all the nonterminals v of G with parent w such that Dv ≤ b < Dw. Those are the leaves of the sampled tree, which form a partition of DA. Second, for any nonsampled node v with Dv > b, we must be able to build Dv by merging other precomputed lists of total length ≤ βDv. This implies that generating Dv costs O(β lg n) times more than having D0 v stored and just decompressing it. with parent w and children u1, ..., uk is removed ifPk We first assume that the sampled tree contains all the ancestors of the sampled leaves and then proceed bottom-up in the sampled tree, removing some nodes from it. Any node v i=1 Dui ≤ β · Dv. In this case, the At query time, if a node v of interest is not sampled, we collect all the lists of its highest sampled descendants. Therefore, on a parse tree of height h we may end up merging many nodes ui become children of w in the sampled tree. Dustin Cobas and Gonzalo Navarro XX:7 Collection Page Revision Influenza Docs (D) 60 190 280 8834 31 208 65 565 100 000 227 356 Size RLCSA (bps) (n) 110 0.18 0.11 641 0.13 1037 0.18 110 640 0.11 0.13 1035 0.32 137 321 0.26 Occs Doc occs Occs/doc ( occ (occ) ndoc ) 781 242.75 444.79 2601 429.04 2889 2.09 776 2592 2.43 2.42 2876 6.02 532 739 1 248 428 6.17 Table 1 Statistics for document collections (small, medium, and large variants): Collection name; Size in megabytes; RLCSA bits per symbol (bps); Docs, number of documents; Doc size, average document length; number of Patterns; Occs, average number of occurrences; Doc occs, average number of document occurrences; Occs/doc, average ratio of occurrences to document occurrences. (n/D) 1 919 382 3 534 921 3 883 145 13 005 21 490 16 552 1436 1480 (ndoc) 3 6 7 371 1065 1188 88 525 202 437 Doc size Patterns 7658 14 286 20 536 7658 14 284 20 536 269 269 more than the original O(h) lists D1, . . . , Dk, but have the guarantee that the merged lists add up to size at most β · (D1 + ··· + Dk). To merge the lists we use a classical binary heap instead of an atomic heap, so the cost per merged element is O(lg n). We may then spend k · b lg b = O(hb lg b) time in extracting and sorting the lists Dv of size below b. The other lists Dv may lead to merging βDv elements. The total cost over the k = O(h) lists is then O(hb lg b + β(D1 + ··· + Dk) lg n) ⊆ O(hb lg b + ndoc · βh lg n). In terms of complexity, if we choose for example b = O(lg n/ lg lg n), β = O(1), and the grammar is balanced, h = O(lg n), then the total cost of merging is O(ndoc · lg2 n). Experiments and Results 6 We evaluate different variants of our indexes and compare them with the state of the art. We use the experimental framework proposed by Gagie et al. [8]. 6.1 Document collections To test various kinds of repetitiveness scenarios, we performed several experiments with real and synthetic datasets. We used the same document collections tested by Gagie et al. [8], available at https://jltsiren.kapsi.fi/rlcsa. Table 1 summarizes some statistics on the collections and the patterns used in the queries. Real collections. Page and Revision are collections formed by all the revisions of some selected pages from the Wikipedia in Finnish language. In Page, there is a document for each selected article, that also includes all of its revisions. In the case of Revision, each page revision becomes a separate document. Influenza is another repetitive collection composed of sequences of the H. influenzae virus genomes. Synthetic collections. We also used two types of synthetic collections to explore the effect of collection repetitiveness on document listing performance in more detail. Concat and Version are similar to Page and Revision, respectively. We use 10 and 100 base documents of length 1000 each, extracted at random from the English file of Pizza&Chili (http://pizzachili.dcc.uchile.cl). Besides, we include variants of each base document, generated using different mutation probabilities (0.001, 0.003, 0.01, and 0.03). A mutation XX:8 Fast, Small, and Simple Document Listing on Repetitive Text Collections is a replacement by a different random symbol. In collection Version, each variant becomes a separate document. In Concat, all variants of the same base document are concatenated into a single document. Queries. The query patterns for Page and Revision datasets are Finnish words of length ≥ 5 that occur in the collections. For Influenza, the queries are substrings of length 4 extracted from the dataset. In the case of Concat and Version, the patterns are terms selected from an MSN query log. See Gagie et al. [8] for a more detailed description. 6.2 Compared indexes Grammar-Compressed Document Array (GCDA). This is our main proposal. We use the balanced variant of the Re-Pair compressor implemented by Navarro4. To sample the parse tree, we test several parameter configurations for the block size b and factor β. Brute force (Brute). This family of algorithms is the most basic and simple solution to the document listing problem. They use a CSA to retrieve all the document identifiers in DA[sp..ep], sort them, and report each of them once. Brute-L uses the CSA to extract the values DA[i]. Brute-D, instead, uses an explicit document array DA. Finally, Brute-C is our variant using the grammar-compressed DA. From the grammar tree of height h and storing the length of the expansion of each nonterminal, we extract the range DA[sp..ep] in time O(h + ep − sp). Sadakane (Sada). Sada-L is the original index proposed by Sadakane [26]. Sada-D speeds up the query time by explicitly storing DA. Sada-C stores DA in grammar-compressed form, where each individual cell DA[i] is extracted in time O(h). Interleaved Longest Common Prefix (ILCP). ILCP-L is an implementation of the ILCP index proposed by Gagie et al. [8] using a run-length encoded ILCP array. ILCP-D is a variant that uses the document array instead of the CSA functionality. ILCP-C uses, instead, our grammar-compressed DA, which accesses any cell in time O(h). Precomputed Document Lists (PDL). PDL-BC and PDL-RP are implementations of the PDL algorithm proposed by Gagie et al. [8]. The first one uses a Web graph compressor [12] on the set of lists, whereas PDL-RP uses Re-Pair compression. Both variants use block size b = 256 and factor β = 16, as recommended by their authors. Grammar-based (Grammar). This is an implementation of the index by Claude and Munro [5]. It uses Re-Pair on the collection T and on the set of lists. This index is the only tested solution that does not use a CSA. We implemented GCDA on C++, using several succinct data structures from the SDSL library5. We used existing C++ implementations of the indexes Brute, Sada, ILCP and PDL, which were tested by Gagie et al. [8]6, and modified the versions -C by using DA in grammar-compressed instead of in plain form. 4 https://www.dcc.uchile.cl/gnavarro/software/repair.tgz 5 https://github.com/simongog/sdsl-lite 6 https://jltsiren.kapsi.fi/software/doclist.tgz Dustin Cobas and Gonzalo Navarro XX:9 Figure 1 GCDA on small real collections with different configurations. The x axis shows the total size of the index in bits per symbol. The y axis shows the average time per query in microseconds. Beware that the plots do not start at zero. All tested indexes except Grammar use a suffix array to compute the interval [sp..ep] corresponding to pattern P. We used a RLCSA implementation7 that is optimized for highly repetitive text collections. To compute entries SA[i], the RLCSA uses a suffix array sampling, which requires significant space as explained. Our index does not use this operation, but it is required for the indexes Brute-L, Sada-L, ILCP-L, and both variants of PDL. We use 32 as the value for this sample rate, as it gave good results in previous tests [8]. The exception is Brute-L, which uses a RLCSA optimized to extract whole ranges SA[sp..ep] [10].8 The column RLCSA of Table 1 gives the space used by the RLCSA without suffix array samples. Our machine has two Intel(R) Xeon(R) CPU E5-2407 processors running at 2.40 GHz and 250 GiB of RAM. The operating system was Debian with Linux kernel 4.9.0-8-amd64. All indexes were compiled using g++ version 6.3.0 with flags -O3 -DNDEBUG. 6.3 Tuning our main index Figure 1 shows the tradeoff between time and space of GCDA on small real collections. We tested GCDA with 4 different sizes of block b: 128, 256, 512, and 1024. For each block size, we used 3 different factors β (4, 8, and 16), which are represented with increasing color darkness in the plots. The configuration b = 512 and β = 4 shows to be a good general-purpose choice of parameter values, and we stick to it from now on. The lower-right plot of Figure 2 shows the space required by the main components of our index. As the number of documents in the collection grows and their size decreases, the weight of the grammar-compressed DA, and even more, of the grammar-compressed lists of documents, becomes dominant. Note also that Influenza is the least repetitive collection. 6.4 Comparison on real collections Figure 2 shows the tradeoff between time and space for all tested indexes on the real collections. Our main index, GCDA, and the -C variants of the other indexes we adapted, are clearly dominant in a large portion of the space/time map. Most of the previous indexes are way slower, way larger, or both, than ours. The best previous tradeoffs, PDL-BC and PDL-RP [8], are much closer, but still they are almost always slower and larger than GCDA. 7 https://jltsiren.kapsi.fi/rlcsa 8 https://github.com/nicolaprezza/r-index XX:10 Fast, Small, and Simple Document Listing on Repetitive Text Collections Figure 2 Document listing indexes on real repetitive collections. The x axis shows the total size of the index in bits per symbol. The y axis shows the average time per query. Combinations with excessively high time are omitted in some plots. The lower-right plot shows the size of the main components of GCDA on the small collections; the y axis shows the size in megabytes. For all versions of Page, where there are few large documents and our grammars compress very well, GCDA requires only 0.48 -- 0.56 bits per symbol (bps) and answers queries in less than 16 microseconds. The index using the least space is Grammar, which requires 0.21 -- 0.35 bps. Grammar is way out of the plot, however, because it requires 1.2 -- 3.4 milliseconds to solve the queries, that is, 205 -- 235 times slower than GCDA.9 The next smallest index is our variant Brute-C, which uses 0.35 -- 0.55 bps and is generally smaller than GCDA, but slower by a factor of 2.6 -- 6.7. Brute-L, occupying 0.38 -- 0.60 bps, is also smaller in some cases, but much slower (180 -- 1080 microseconds, out of the plot). GCDA sharply outperforms all the other indexes in space, and also in time (only Sada-D is 6% faster in the small collection, yet using 18 times more space). The closest competitors, PDL-BC and PDL-RP, are 4.4 -- 5.0 times larger and 2.8 -- 5.0 times slower than GCDA. In the case of Revision, where there are more and smaller documents, GCDA uses 0.73 -- 0.88 bps and answers queries in less than 150 microseconds. Again Grammar uses the least space, 0.26 -- 0.42 bps, but once again at the price of being 8 -- 30 times slower than GCDA. The case of Brute-L is analogous: 0.38 -- 0.60 bps but over 8 times slower than GCDA. Instead, 9 As in previous work [8], Grammar was not built on the largest dataset of Page. Dustin Cobas and Gonzalo Navarro XX:11 Figure 3 Document listing on synthetic collections. The x axis shows the total size of the index in bits per symbol. The y axis shows the average time per query in microseconds. Combinations with excessively high time are omitted in some plots. our variant Brute-C is a relevant competitor, using 0.45 -- 0.76 bps and being less than 60% slower than GCDA. The other relevant index is our variant ILCP-C, using almost the same space and time of GCDA. The group GCDA/Brute-C/ILCP-C forms a clear sweetpoint in this collection. The closest competitors, again PDL-BC and PDL-RP, are 3.1 -- 3.8 times larger and 1.2 -- 1.9 times slower than GCDA. Influenza, with many small documents, is the worst case for the indexes. GCDA uses 4.46 -- 4.67 bps and answers queries within 115 milliseconds. Many indexes are smaller than GCDA, but only our variants form a relevant space/time tradeoff: ILCP-C uses 2.88 -- 3.37 bps, Brute-C uses 2.42 -- 2.86 bps, and Sada-C uses 4.96 -- 5.40 bps. All the -C variants obtain competitive times, and ILCP-C even dominates GCDA (it answers queries within 65 milliseconds, taking less than 60% of the time of GCDA). The other indexes outperforming GCDA in time are -D variants, which are at least 3.7 times larger than GCDA and 5.2 times larger than ILCP-C. 6.5 Comparison on synthetic collections Figure 3 compares the indexes on synthetic collections. These allow us study how the indexes evolve as the repetitiveness decreases, in a scenario of few large documents (Concat) and many smaller documents (Version). We combine in a single plot the results for different mutation rates of a given collection and number of base documents. The plots show the increasing mutation rates using variations of the same color, from lighter to darker. All the -L variants and Grammar are omitted because they were significantly slower. XX:12 Fast, Small, and Simple Document Listing on Repetitive Text Collections On collection Concat, GCDA essentially outperforms all the other indexes. In the case of the version composed by 10 base documents, our index obtains the best space/time tradeoff by a wide margin. Only Brute-C is smaller than GCDA, but 8 -- 9 times slower. On the other hand, various indexes are slightly faster than GCDA, but much larger (from Sada-D, which is up to 30% faster but 7 times larger, to Sada-C, which is 15% faster but at least 4 times larger). With the other variant of Concat (100 base documents), our index offers the best space and time for all mutation rates. Only PDL-RP is 6% faster in its best case, but 2.2 times larger. Further, GCDA retains its space/time performance as repetitiveness decreases, whereas the competing indexes worsen fast in one or both aspects. On Version, composed by 10 000 documents of length 1000, GCDA is also a dominant solution, retaining its time performance as repetitiveness decreases and outperforming all the -D variants in space up to a mutation rate of 1%. Other competing indexes are our variants Brute-C and ILCP-C (the only one dominating GCDA in some cases), as well as PDL-BC and PDL-RP in the case of 100 base documents. The strange behavior of the PDL indexes in both collections with 10 base documents is briefly discussed in the original article [8]. Conclusions 7 We have presented simple and efficient indexes for document listing on repetitive string collections. They find the ndoc documents where a pattern of length m appears in a collection of size n in time O(m + ndoc · lg n). The indexes uses grammar-compression of the document array, and perform better as the collection is more repetitive. Our experimental results show that our main index, GCDA, outperforms the best previous solutions by a fair margin in time and/or space on various repetitive collections. From the previous indexes, only PDL [8] gets close, but it is almost always dominated by GCDA in both space and time. GCDA performs well in space for mutation rates up to 1%, whereas its query time is mostly insensitive to the repetitiveness. Other previous solutions (especially ILCP [8] and brute force) that we adapted to run on our grammar-compressed document array also display unprecedented performance on repetitive texts, competing with GCDA. For the final version of this paper, we plan to combine the PDL indexes with a grammar- compressed document array as well, which we omitted for lack of time. A line of future work is to further reduce the space of GCDA and our index variants that use the grammar-compressed document array, by using a more clever encoding of the grammars that may nearly halve their space at a modest increase in time [11]. Another line is to extend the index to support top-k document retrieval, that is, find the k documents where P appears most often. For example, following previous ideas [8], we can store the list of documents where each nonterminal appears in decreasing order of frequency, and use algorithms developed for inverted indexes [1] on the O(lg n) lists involved in a query. The frequency of the candidates can be efficiently counted on repetitive collections [8]. Dustin Cobas and Gonzalo Navarro XX:13 References 1 R. Baeza-Yates and B. Ribeiro-Neto. Modern Information Retrieval. Addison-Wesley, 2nd edition, 2011. 2 D. Belazzougui and G. Navarro. Alphabet-independent compressed text indexing. ACM Transactions on Algorithms, 10(4):article 23, 2014. 3 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. 4 D. R. Clark. Compact PAT Trees. PhD thesis, University of Waterloo, Canada, 1996. 5 In Proc. 20th F. Claude and J. I. Munro. Document listing on versioned documents. Symposium on String Processing and Information Retrieval (SPIRE), LNCS 8214, pages 72 -- 83, 2013. F. Claude and G. Navarro. Self-indexed grammar-based compression. Fundamenta Inform- aticae, 111(3):313 -- 337, 2010. 6 7 M. L. Fredman and D. E. Willard. Trans-dichotomous algorithms for minimum spanning trees and shortest paths. Journal of Computer and System Sciences, 48(3):533 -- 551, 1994. 8 T. Gagie, A. Hartikainen, K. Karhu, J. Kärkkäinen, G. Navarro, S. J. Puglisi, and J. Sirén. Document retrieval on repetitive collections. Information Retrieval, 20:253 -- 291, 2017. 9 T. Gagie, G. Navarro, and N. Prezza. Fully-functional suffix trees and optimal text search- ing in BWT-runs bounded space. CoRR, abs/1809.02792, 2018. 10 T. Gagie, G. Navarro, and N. Prezza. Optimal-time text indexing in BWT-runs bounded In Proc. 29th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), space. pages 1459 -- 1477, 2018. 11 R. González, G. Navarro, and H. Ferrada. Locally compressed suffix arrays. ACM Journal of Experimental Algorithmics, 19(1):article 1, 2014. 12 C. Hernández and G. Navarro. Compressed representations for web and social graphs. Knowledge and Information Systems, 40(2):279 -- 313, 2014. 13 A. Jez. A really simple approximation of smallest grammar. Theoretical Computer Science, 14 15 16 616:141 -- 150, 2016. S. Kreft and G. Navarro. On compressing and indexing repetitive sequences. Theoretical Computer Science, 483:115 -- 133, 2013. J. Larsson and A. Moffat. Off-line dictionary-based compression. Proceedings of the IEEE, 88(11):1722 -- 1732, 2000. E. Lehman and A. Shelat. Approximation algorithms for grammar-based compression. In Proc. 13th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 205 -- 212, 2002. 17 V. Mäkinen and G. Navarro. Succinct suffix arrays based on run-length encoding. Nordic Journal of Computing, 12(1):40 -- 66, 2005. 18 V. Mäkinen, G. Navarro, J. Sirén, and N. Välimäki. Storage and retrieval of highly repet- itive sequence collections. Journal of Computational Biology, 17(3):281 -- 308, 2010. 19 U. Manber and G. Myers. Suffix arrays: a new method for on-line string searches. SIAM Journal on Computing, 22(5):935 -- 948, 1993. S. Muthukrishnan. Efficient algorithms for document retrieval problems. Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 657 -- 666, 2002. In Proc. 13th 20 21 G. Navarro. Indexing highly repetitive collections. In Proc. 23rd International Workshop on Combinatorial Algorithms (IWOCA), LNCS 7643, pages 274 -- 279, 2012. 22 G. Navarro. Spaces, trees and colors: The algorithmic landscape of document retrieval on sequences. ACM Computing Surveys, 46(4):article 52, 2014. XX:14 Fast, Small, and Simple Document Listing on Repetitive Text Collections 23 G. Navarro. Document listing on repetitive collections with guaranteed performance. In Proc. 28th Annual Symposium on Combinatorial Pattern Matching (CPM), LIPIcs 78, page article 4, 2017. 24 G. Navarro and V. Mäkinen. Compressed full-text indexes. ACM Computing Surveys, 39(1):article 2, 2007. 25 W. Rytter. Application of Lempel-Ziv factorization to the approximation of grammar-based compression. Theoretical Computer Science, 302(1-3):211 -- 222, 2003. 26 K. Sadakane. Succinct data structures for flexible text retrieval systems. Journal of Discrete 27 28 Algorithms, 5:12 -- 22, 2007. Z. D. Sthephens, S. Y. Lee, F. Faghri, R. H. Campbell, Z. Chenxiang, M. J. Efron, R. Iyer, S. Sinha, and G. E. Robinson. Big data: Astronomical or genomical? PLoS Biology, 17(7):e1002195, 2015. P. Weiner. Linear pattern matching algorithm. In Proc. 14th Annual IEEE Symposium on Switching and Automata Theory, pages 1 -- 11, 1973.
1712.02977
1
1712
2017-12-08T08:29:16
Periortree: An Extention of R-Tree for Periodic Boundary Conditions
[ "cs.DS" ]
Searching spatial data is an important operation for scientific simulations which are performed mostly with periodic boundary conditions. An R-Tree is a well known tree data structure used to contain spatial objects and it is capable of answering to spatial searching queries in an efficient way. In this paper, a novel method to construct an R-Tree considering periodic boundary conditions is presented. Unlike existing methods, the proposed method works without any kind of extra objects or queries. Moreover, because this method reduces the volume of bounding box for each node under the periodic boundary conditions, it is expected to increase the overall efficiency. While the extension of an R-Tree is presented in this work, this method is not only applicable to an R-Tree but also to other data structures that use axis-aligned bounding boxes with periodic boundary conditions. The implementation is available on GitHub.
cs.DS
cs
Periortree: An Extention of R-Tree for Periodic Boundary Conditions Toru Niina 1 1. Department of Biophysics, Graduate School of Science, Kyoto University, Kyoto 606-8502, Japan * [email protected] Abstract 7 1 0 2 c e D 8 ] S D . s c [ 1 v 7 7 9 2 0 . 2 1 7 1 : v i X r a Searching spatial data is an important operation for scientific simulations which are performed mostly with periodic boundary conditions. An R-Tree is a well known tree data structure used to contain spatial objects and it is capable of answering to spatial searching queries in an efficient way. In this paper, a novel method to construct an R-Tree considering periodic boundary conditions is presented. Unlike existing methods, the proposed method works without any kind of extra objects or queries. Moreover, because this method reduces the volume of bounding box for each node under the periodic boundary conditions, it is expected to increase the overall efficiency. While the extension of an R-Tree is presented in this work, this method is not only applicable to an R-Tree but also to other data structures that use axis-aligned bounding boxes with periodic boundary conditions. The implementation is available on GitHub. Introduction Computational simulations are essential tools for scientific research, such as studying behaviors of complex biochem- ical models [1]. To perform such large scale simulations, both huge amount of computational resources and efficient simulation softwares are required. In most cases, searching for objects that satisfy some geometrical conditions is one of the most time-consuming operation in a simulation. Generally, an efficient algo- rithm that search objects drastically accelerates not only the whole simulation processes, but also the data analysis of simulation results. Therefore, a method that efficiently processes spatial search accelerates the whole process of simulation in scientific research. An R-Tree is a widely used data structure representing bounding volume hierarchies (BVH) by using an axis- aligned bounding box (AABB) for all its entries [2]. It is capable of containing both sizeless and finite sized objects such as points, segments, rectangles, spheres, etc. In order to improve the efficiency, many variants of the R-Tree algorithm have been proposed [3–6]. In order to use an R-Tree with periodic boundary con- ditions (PBCs), currently, there exists two methods in the literature (Figure 1) [6]. The first method is described in Figure 1A. It enables an R-Tree to contain and search objects considering PBCs by storing the periodic images surrounding of the primary unit cell. However, compared to the standard R-Tree, the memory consumption is in- creased 3D times (where D reprecents a dimension of a system). On the contrary, the other method (Figure 1B) does not store any periodic image, but it replicates the query based on the PBCs by transposing it periodically when the query sticks out of the boundary. Although it works fine with points, it has a limitation when working with finite-sized objects because if the query is inside of the boundary and the objects extend beyond the unit cell, some of them are overlooked (Figure 1C). One ad-hoc so- lution to overcome this limitation is changing the criteria for replicating a query based on the size of elements that are contained. However, this may increase the frequency in which queries are copied and decrease the efficiency. Here a novel method to construct and use an R-Tree with PBCs is proposed. The main idea is to consider the PBCs when either entries are inserted or objects are searched. By expanding an AABB and detecting intersec- tion between AABBs under PBCs, an R-Tree overcomes the limitation of containing finite-sized object under PBCs (Figure 1D). Intersection and inclusion detection can be implemented by introducing periodic transposition in the existing algorithms with the appropriate representation of an AABB. Comparing to the other methods, this method does not require to copy objects or queries. Moreover, using the information of the PBCs, it has more chance to reduce the volume of AABBs of each node. Since the spatial searching of an R-Tree is strongly affected by the volme of each node, this feature might increase the efficiency. The codes that are used in this paper are available on GitHub (http://github.com/ToruNiina/periortree). 1 to restrict positions to be inside of the unit cell and to find the minimum distance between objects acoording to the PBCs. In this paper, these algorithms are called as RestrictPosition and RestrictVector, respectively. Representation of AABBs. There are three common representations for AABBs (Figure 2) [7]. The first one is by the minimum and maximum coordinate values in each dimension. The second one is by the minimum point and the diameter from the corner point. The third one is by the center point and a half of its diameter. Here, these are called as min-max, min-widths, and center-radius representation, respectively. Since the proposed method uses the center point of an AABB, the natural choice is to use center-radius repre- sentation even though the center point can be calculated by using the other representation. Figure 2: (A) Three popular representations of an AABB. The first one is min-max, the second one is min-widths, and the third one is center-radius representation. (B) Three representations in a system with PBCs. The AABBs are colored in the same way as A. Expanding AABBs under PBCs. Expanding an AABB in order to contain a new object is one of the most important operations in an R-Tree algorithm. Be- cause the total area covered by the AABB of each node affects the efficiency of spatial searching, it is needed to find a way to make it as small as possible. The algorithm to expand an AABB needed to contain object AABB under PBCs is shown in Algorithm 1. In this case, the size of an AABB that contains two rect- angles is determined by their radius and the minimum distance between their center points. In this paper, this is accomplished by using RestrictVector. On the other hand, when the contents are points, it is enough to find 2 Figure 1: Methods to consider PBCs with R-Tree. (A) By copying the unit cell, the standard R-Tree can manage objects that are associated with periodic images. (B) By copying query, R-Tree can find objects that are beyond boundary. (C) With the method described in B, finite sized objects are overlooked when queries that is inside of the boundary are not copied. (D) The method pro- posed in this paper. Forming AABBs according to the periodicity, R-Tree can organize objects under periodic boundary conditions. Methods Here some operations to modify and handle rectangles under PBCs are introduced. To construct a tree structure, Guttman's original quadratic algorithm is employed [2] without any modification except for expansion of an AABB and intersection detection. The fact that this method is independent from the core algorithm to con- struct an R-Tree means that it can be applied to most of the R-Tree variants and to other spatial indexing methods that are based on BVH and AABBs. Since the rectangles used in an R-Tree are axis-aligned, operation in each dimension are independent from each other. It means that it is sufficient to show an operation for one dimension. It should be noted that AABBs only intersect if they overlap in all the axes. Representation of PBCs. Here, only cuboids are con- sidered as the unit cell of the PBCs. It is assumed that all the coordinates of the objects are restricted to be inside of the unit cell. There are well-known algorithm ABCDAmaxminminwidthcenterradiusB Algorithm 1 expand AABB to contain another AABB Algorithm 3 Check if two AABB intersect each other R1 ← rectangle R2 ← rectangle that might intersect to R1 B ← boundary function IntersectsAABB(R1, R2, B) dc ← R1.center − R2.center dc ← RestrictVector(dc, B) return abs(dc) ≤ (R1.radius + R2.radius) end function Algorithm 4 Check if an AABB is inside of another AABB R1 ← rectangle R2 ← rectangle that might be inside of R1 B ← boundary function IsAABBInsideOfAABB(R1, R2, B) dc ← R1.center − R2.center dc ← RestrictVector(dc, B) return abs(dc) ≤ (R1.radius − R2.radius) end function Algorithm 5 Check if a point is inside of an AABB R ← rectangle P ← point that might be inside of R B ← boundary function IsPointInsideOfAABB(R, P, B) dc ← R.center − P dc ← RestrictVector(dc, B) return abs(dc) ≤ R.radius end function Results R1 ← AABB to be expanded R2 ← rectangle to be contained B ← boundary function ExpandAABB(R1, R2, B) dc ← R2.center − R1.center dc ← RestrictVector(dc, B) l1 ← R1.center − R1.radius u1 ← R1.center + R1.radius l2 ← (R1.center + dc) − R2.radius u2 ← (R1.center + dc) + R2.radius L ← min(l1, l2) U ← max(u1, u2) C ← (L + U )/2 HW ← (U − L)/2 C ← RestrictPosition(C, B) return {C, HW} end function Algorithm 2 expand AABB to contain a point R ← AABB to be expanded P ← point to be contained B ← boundary function ExpandAABB(R, P, B) dc ← P − R.center dc ← RestrictVector(dc, B) l ← R.center − R.radius u ← R.center + R.radius L ← min(l, P ) U ← max(u, P ) C ← (L + U )/2 HW ← (U − L)/2 C ← RestrictPosition(C, B) return {C, HW} end function the minimum distance between the center of an AABB and the point(Algorithm 2). Finding an object under PBCs. To find an object in an R-Tree, it is needed to check if two AABBs inter- sect each other. This can be determined by calculating the minimum distance between the centers of the rect- angles(Algorithm 3). The inclusion can be detected in the same way (Algorithm 4). For points, the intersection and inclusion means almost same thing because points have no size. Here, the algorithm that checks if a point is inside of an AABB is shown in Algorithm 5. Figure 3A shows the expansion of an AABB to contain objects by using proposed method and Figure 3B shows that of existing method. There, the objects are colored in black, and the AABB is colored in red. It should be noted that, because it sticks out of the boundaries, the periodic images of the AABB are shown separately. Comparing Figure 3A and B, it is shown that the proposed method successfully finds least expansion under PBCs. Because the objects are distributed throughout the system, if the AABB was expanded independently from the PBCs, the AABB would wrap most of the area of the system(Figure 3B). In Figure 3C the results of a query are shown. It successfully finds objects that are located beyond the boundaries(indicted by arrows). As in Figure 3A, the periodic images of the query are shown separately. 3 References [1] Kouichi Takahashi, Kazunari Kaizu, Bin Hu, and Masaru Tomita. A multi-algorithm, multi-timescale method for cell simulation. Bioinformatics, 20(4):538– 546, 2004. [2] Antonin Guttman. R-Trees: A Dynamic Index Struc- ture for Spatial Searching. Proceedings of the 1984 ACM SIGMOD international conference on Manage- ment of data - SIGMOD '84, pages 47–57, 1984. [3] Diane Greene. An implementation and performance analysis of spatial data access methods. The Fifth International Conference on Data Engineering, (4871), 1989. [4] Beckmann, Norbert and Kriegel, Hans-Peter and Schneider, Ralf and Seeger, Bernhard. The r*-tree: An efficient and robust access method for points and rectangles. 19(2):322–331, 1990. [5] Scott T Leuteneggert and Mario A Lopezt. STR : A Simple and Efficient Algorithm for R-Tree Packing. pages 497–506, 1997. [6] Ryuya Mitsuhashi, Hideyuki Kawashima, Takahiro Nishimichi, and Osamu Tatebe. Three-Dimensional Spatial Join Count Exploiting CPU Optimized STR R-Tree. IEEE International Conference on Big Data, pages 2938–2947, 2016. [7] Christer Ericson. Real-Time Collision Detection. Mor- gan Kaufmann Publishers, 2004. Figure 3: (A) Expansion of the AABB(red) by proposed method. It can be seen that the AABB is expanded beyond the boundary. (B) Expansion of the AABB by existing method. The AABB wraps almost all the area of the system because the AABB is expanded independently from PBCs. (C) The result of querying objects that intersect with the yellow rectangle. The objects contained in the R-Tree are shown as small square boxes and the ones intersecting the query box are colored in red. Conclusion In this paper, a novel method for applying PBCs to R- Trees was presented. This method considers PBCs while inserting new objects and finding objects. Therefore, no extra objects or queries are needed to consider PBCs. Moreover, allowing AABBs to extend beyond the bound- ary, it has more chance to reduce the volume of AABBs based on the PBCs. As described before, since this method modifies only the algorithms to expand an AABB and to detect intersection between AABBs, it is essentially applicable to other R- Tree variants and to any spatial indexing method that works with AABBs. Because the application of spatial indexing generally in- crease the performance of spatiotemporal simulations, the proposed method might be useful for scientific simulations under PBCs. 4 ABC
1312.4802
1
1312
2013-12-17T14:36:36
A Statistical Peek into Average Case Complexity
[ "cs.DS", "stat.AP" ]
The present paper gives a statistical adventure towards exploring the average case complexity behavior of computer algorithms. Rather than following the traditional count based analytical (pen and paper) approach, we instead talk in terms of the weight based analysis that permits mixing of distinct operations into a conceptual bound called the statistical bound and its empirical estimate, the so called "empirical O". Based on careful analysis of the results obtained, we have introduced two new conjectures in the domain of algorithmic analysis. The analytical way of average case analysis falls flat when it comes to a data model for which the expectation does not exist (e.g. Cauchy distribution for continuous input data and certain discrete distribution inputs as those studied in the paper). The empirical side of our approach, with a thrust in computer experiments and applied statistics in its paradigm, lends a helping hand by complimenting and supplementing its theoretical counterpart. Computer science is or at least has aspects of an experimental science as well, and hence hopefully, our statistical findings will be equally recognized among theoretical scientists as well.
cs.DS
cs
A Statistical Peek into Average Case Comp lexity NIRAJ KUMAR SINGH, Birla Institute of Technology Mesra SOUBHIK CHAKRABORTY, Birla Inst itute of Technology Mesra DHEERESH KUMAR MALLICK, Birla Inst itute of Technology Mesra The present paper gives a statist ical adventure towards exploring the average case comp lexity behav ior of computer algorithms. Rather than following the tradit ional count based analytical (pen and paper) approach, we instead talk in terms of the weight based analysis that permits mixing of d ist inct operations into a conceptual bound called the statistical bound and its emp ir ical est imate, the so called "emp irical O". Based on careful analysis of the results obtained, we have introduced two new conjectures in the domain of algorithmic analysis. The analyt ical way of average case analysis falls flat when it comes to a data model for which the expectation does not exist (e.g. Cauchy distr ibution for continuous input data and certain discrete distribut ion inputs as those stud ied in the paper). The empirical side of our approach, with a thrust in computer experiments and applied statistics in its parad igm, lends a he lping hand by complimenting and supplementing its theoretical counterpart. Computer science is or at least has aspects of an experimental sc ience as well, and hence hopefully, our stat istical findings will be equally recognized among theoretical sc ientists as well. Key Words: Average case analysis, mathemat ical bound, statistical bound, big-oh, empir ical-O, pseudo linear complexity , tie-density 1. INTRODUCTION Traditionally the analysis of an algorithm’s efficiency is done through its mathematical analysis. Although these techniques can be applied successfully to many simple algorithms, the power of mathematics, even when enhanced with more advanced techniques, is far from limitless [1][2][3]. Robustness of the analytical approach itself can be challenged on the ground that even some seemingly simple algorithms have proved to be very difficult to analyze with mathematical precision and certainty [4]. This is especially true for average case analysis. Average case complexity analysis is an important idea as it explains how certain algorithms with bad worst case complexity perform better on the average. The principal alternative to the conventional mathematical analysis of an algorithm’s efficiency is its empirical analysis [4]. Recently there has been an upswing in interest in experimental work in theoretical computer science community because of growing recognition that theoretical results cannot tell the full story about real-world algorithmic performance [5]. Empirical researchers have serious objection to applying mathematical bounds in average case complexity analysis [6] [7] [8]. Indeed, it was the lack of scientific rigor in early experimental work that led Knuth and other researchers in the 1960’s to emphasize worst- and- average case analysis and the more general conclusions they could provide, especially with respect to asymptotic behavior [5]. Empirical analysis is capable of finding patterns inside a pattern exhibited by its theoretical counterpart. Its result in turn may reinvigorate the theoretical establishments by complimenting and supplementing the already known theoretical findings. Here, through this paper we suggest for an alternative tool, the so called ‘statistical bound’ and its empirical estimate (empirical-O) [6] [7]. The performance guarantee is perhaps the biggest strength of the mathematical worst case bound. Such a guarantee can even be ensured with empirical-O (denoted as Oemp) by verifying the complexity robustness across the commonly used and standard data distributions inputs. The statistical approach is well equipped with tools and techniques which, if used scientifically, can provide a reliable and valid measure for an algorithm’s complexity. See [9] [10] for interesting discussions on the statistical analysis of experiments in a rigorous fashion. For more on statistical bounds and empirical-O see the Appendix. Average case inputs typically correspond to randomly obtained samples. Such random sequences may constitute certain well known data patterns or sometimes may even result in unconventional models. We in practice are not very much concerned with best case analysis as it often paints a very optimistic picture. In this paper we confine ourselves to average case analysis only as we find it practically more exciting than the others. Our statistical adventure explores the average case behavior of the well known standard quick sort algorithm [11] as a case study. We find it a suitable one as it exhibits a significant performance gap between its theoretical average and worst case behaviors. Our analysis introduces a phrase “pseudo linear complexity” which we obtain against the theoretical O(nlog2n) complexity for our candidate algorithm. We also talk about the rejection of the average case robustness claim for quick sort algorithm made by the theoretical scientists. 2. AVERAGE CASE ANALYSIS USING STATISTICAL BOUND ESTIMATE OR ‘EMPIRICAL-O’ The average case analysis was done by directly working on program run time to estimate the weight based statistical bound over a finite range by running computer experiments [12] [13]. This estimate is called empirical-O. Here time of an operation is taken as its weight. Weighing allows collective consideration of all operations, trivial or non-trivial, into a conceptual bound. We call such a bound a statistical bound opposed to the traditional count based mathematical bounds which is operation specific. Since the estimate is obtained by supplying numerical values to the weights obtained by running computer experiments, the credibility of this bound estimate depends on the design and analysis of computer experiment in which time is the response. The interested reader is suggested to see [6] [14] to get more insight into statistical bounds and empirical-O. Average complexity is traditionally (by a count based analysis using pen and paper) found by applying mathematical expectation to the dominant operation. If the dominant operation is wrongly chosen (this is likely in a complex code or even in a simple code in which a dominant operation comes fewer times as compared to a less dominant operation which comes more; as for example, in Amir Schoor’s n-by-n matrix multiplication algorithm n2 comparisons dominate over multiplications indicating an empirical O(n2) complexity as the statistical bound estimate while Schoor applied mathematical expectation on multiplication and obtained quite a different result, namely, an average O(d1d2n3) complexity, where d1 and d2 are the fraction of non-zero elements of the pre and post factor matrices [6][7]. Second, the robustness can also be challenged as the probability distribution over which expectation is taken may not be realistic over the problem domain. This section includes the empirical results obtained for average case analysis of quick sort algorithm. The samples are generated randomly, using random number generating function, to characterize discrete uniform distribution models with K as its parameter. Our sample sizes lie in between 5*105 and 5*106. The discrete uniform distribution depends on the parameter K [1 …….K], which is the key to decide the range of sample obtained. Most of the mean time entries (in seconds) are averaged over 500 trial readings. These trial counts however, should be varied depending on the extent of “noise” present at a particular ‘n’ value. As a rule of thumb, greater the “noise” at each point of ‘n’, more should be the numbers of observations. System specification: All the computer experiments were carried out using PENTIUM 1600 MHz processor and 512 MB RAM. Statistical models/results are obtained using Minitab-15 statistical package. The standard quick sort is implemented using C language by the authors themselves. It should be understood that although program run time is system dependent, we are interested in identifying patterns in the run time rather than run time itself. It may be emphasized here that statistics is the science of identifying and studying patterns in numerical data related to some problem under study. 2.1 Average case analysis over discrete uniform inputs (case study-1) In our first case study we observed the mean times for specific sized input data over the entire range for different K values. The observed data is recorded in table 1. 50 n↓ K→ 500000 12.688 1000000 50.703 1500000 114.156 2000000 203.546 2500000 317.562 3000000 457.797 *** 3500000 *** 4000000 4500000 *** 5000000 *** A careful look at table 1 reveals that for smaller ‘K’ values we get quadratic complexity models. Our point is further strengthened when we go through the statistical data of tables 2(A-H). So we can safely write Yavg(n)=Oemp(n2), at least for K≤10000. It must be kept in mind that the associated constant term in this inequality is not a generic one, rather a constant dependent on the range of input size. However, if the system invariance property of Oemp is ensured then this value may be treated as a constant across the systems provided the range of input size is kept fixed. Table 1. Observed mean t imes in second(s) 20000 10000 5000 25000 500 0.24652 0.23976 0.26416 0.33104 1.407 0.47392 0.45504 0.57828 0.80956 5.219 0.78744 0.75248 1.02256 1.56372 11.531 2.57132 1.61632 1.18136 1.11132 20.359 1.65008 1.5251 2.33948 3.8498 31.657 2.17812 2.0016 3.1814 5.3688 45.437 2.76612 2.5157 4.1607 7.156 61.719 5.2672 80.484 9.187 3.4406 3.1045 101.875 11.43233 6.5229 4.17188 3.7674 4.4328 7.890333 4.9515 126.078 13.93267 50000 0.24512 0.42136 0.66752 0.96184 1.3012 1.6703 2.0859 2.5217 3.0236 3.5342 500000 5000000 0.24276 0.22824 0.42512 0.42568 0.66304 0.66576 0.97436 0.96308 1.30492 1.29804 1.68316 1.66928 2.09012 2.08508 2.53112 2.53236 3.0282 3.01748 3.54188 3.5453 Table 2(A ) Regression Analysis: y versus n, nlgn, n^2 for [k=500] The regression equat ion is y = - 0.541 + 0.000013 n - 0.000001 nlgn + 0.000000 n^2 Predictor Coef SE Coef T P Constant -0.5407 0.3653 -1.48 0.189 n 0.00001267 0.00000570 2.22 0.068 nlgn -0.00000061 0.00000027 -2.23 0.067 n^2 0.00000000 0.00000000 62.14 0.000 S = 0.0876502 R-Sq = 100.0% R -Sq(adj) = 100.0% Analysis of Variance Source DF SS MS F P Regression 3 16607.5 5535.8 720573.28 0.000 Residual Error 6 0.0 0.0 Total 9 16607.6 Source DF Seq SS n 1 15770.1 nlgn 1 807.8 n^2 1 29.7 Table 2(B ). Regression Analysis: y versus n, nlgn for [k=500] Regression Analysis: y versus n, nlgn The regression equat ion is y = 19.9 - 0.000335 n + 0.000016 nlgn Predictor Coef SE Coef T P Constant 19.927 3.712 5.37 0.001 n -0.00033492 0.00002628 -12.74 0.000 nlgn 0.00001598 0.00000116 13.80 0.000 S = 2.06007 R-Sq = 99.8% R-Sq(adj) = 99.8% Analysis of Variance Source DF SS MS F P Regression 2 16577.9 8288.9 1953.16 0.000 Residual Error 7 29.7 4.2 Total 9 16607.6 Source DF Seq SS n 1 15770.1 nlgn 1 807.8 Table 2(C ). Regression Analysis: y versus n, nlgn, n^2 for [k=5000] Regression Analysis: y versus n, nlgn, n^2 for [k=5000] The regression equat ion is y = 0.242 - 0.000003 n + 0.000000 nlgn + 0.000000 n^2 Predictor Coef SE Coef T P Constant 0.24156 0.03749 6.44 0.001 n -0.00000281 0.00000059 -4.80 0.003 nlgn 0.00000015 0.00000003 5.24 0.002 n^2 0.00000000 0.00000000 53.27 0.000 S = 0.00899539 R-Sq = 100.0% R-Sq(adj) = 100.0% Analysis of Variance Source DF SS MS F P Regression 3 198.024 66.008 815749.05 0.000 Residual Error 6 0.000 0.000 Total 9 198.024 Source DF Seq SS n 1 189.642 nlgn 1 8.153 n^2 1 0.230 Table 2(D) . Regression Analysis: y versus n, nlgn, n^2 for [k=10000] The regression equat ion is y = 0.0982 - 0.000000 n + 0.000000 nlgn + 0.000000 n^2 Predictor Coef SE Coef T P Constant 0.09823 0.02367 4.15 0.006 n -0.00000019 0.00000037 -0.51 0.625 nlgn 0.00000002 0.00000002 1.18 0.284 n^2 0.00000000 0.00000000 47.33 0.000 S = 0.00567979 R-Sq = 100.0% R-Sq(adj) = 100.0% Analysis of Variance Source DF SS MS F P Regression 3 61.649 20.550 636996.80 0.000 Residual Error 6 0.000 0.000 Total 9 61.649 Source DF Seq SS n 1 59.348 nlgn 1 2.228 n^2 1 0.072 Table 2(E ). Regression Analysis: y versus n, nlgn, n^2 for [k=20000] Regression Analysis: y versus n, nlgn, n^2 for [k=20000] The regression equat ion is y = 0.160 - 0.000002 n + 0.000000 nlgn + 0.000000 n^2 Predictor Coef SE Coef T P Constant 0.16047 0.02249 7.13 0.000 n -0.00000150 0.00000035 -4.27 0.005 nlgn 0.00000009 0.00000002 5.11 0.002 n^2 0.00000000 0.00000000 21.61 0.000 S = 0.00539657 R-Sq = 100.0% R-Sq(adj) = 100.0% Analysis of Variance Source DF SS MS F P Regression 3 23.4474 7.8158 268372.19 0.000 Residual Error 6 0.0002 0.0000 Total 9 23.4476 Source DF Seq SS n 1 22.8198 nlgn 1 0.6140 n^2 1 0.0136 Table 2(F). Regression Analysis: y versus n, nlgn, n^2 for [k=25000] The regression equat ion is y = 0.129 - 0.000001 n + 0.000000 nlgn + 0.000000 n^2 Predictor Coef SE Coef T P Constant 0.12939 0.04199 3.08 0.022 n -0.00000103 0.00000066 -1.57 0.168 nlgn 0.00000006 0.00000003 2.03 0.089 n^2 0.00000000 0.00000000 9.98 0.000 S = 0.0100740 R-Sq = 100.0% R -Sq(adj) = 100.0% Analysis of Variance Source DF SS MS F P Regression 3 18.5835 6.1945 61038.16 0.000 Residual Error 6 0.0006 0.0001 Total 9 18.5841 Source DF Seq SS n 1 18.1414 nlgn 1 0.4320 n^2 1 0.0101 Table 2(G) . Regression Analysis: y versus n, nlgn, n^2 for [k=50000] The regression equat ion is y = 0.178 - 0.000002 n + 0.000000 nlgn + 0.000000 n^2 Predictor Coef SE Coef T P Constant 0.17829 0.02566 6.95 0.000 n -0.00000161 0.00000040 -4.03 0.007 nlgn 0.00000009 0.00000002 4.75 0.003 n^2 0.00000000 0.00000000 9.05 0.000 S = 0.00615659 R-Sq = 100.0% R-Sq(adj) = 100.0% Analysis of Variance Source DF SS MS F P Regression 3 11.4303 3.8101 100521.12 0.000 Residual Error 6 0.0002 0.0000 Total 9 11.4306 Source DF Seq SS n 1 11.2128 nlgn 1 0.2144 n^2 1 0.0031 Table 2(H). Regression Analysis: y versu s n, nlgn for [k=50000] The regression equat ion is y = 0.388 - 0.000005 n + 0.000000 nlgn Predictor Coef SE Coef T P Constant 0.38768 0.03931 9.86 0.000 n -0.00000517 0.00000028 -18.57 0.000 nlgn 0.00000026 0.00000001 21.22 0.000 S = 0.0218164 R-Sq = 100.0% R -Sq(adj) = 100.0% Analysis of Variance Source DF SS MS F P Regression 2 11.4272 5.7136 12004.53 0.000 Residual Error 7 0.0033 0.0005 Total 9 11.4306 Source DF Seq SS n 1 11.2128 nlgn 1 0.2144 “Even if you find a low r2 value in an analysis, make sure to go back and look at the regression coefficients and their t values. You may find that, despite the low r2 value, one or more of the regression coefficients is still strong and relatively well known. In the same manner, a high r2 value doesn’t necessarily mean that the model that you have fitted to the data is the right model. That is, even when r2 is very large, the fitted model may not accurately predict the response. It’s the job of lack of fit or goodness of fit tests to decide if a model is a good fit to the data [15]”. Justification for preferring quadratic model over nlog2n for K=500: Statistical data in tables 2(A, B) justify the choice of quadratic model over nlog2n. The standard error is reduced from 2.06007 to 0.0876502 when we go for quadratic model. Although a very slight improvement in r2 data is observed, the F value (720573.28) for quadratic model is much higher than the corresponding value (1953.16) for nlog2n curve. Justification for preferring nlog2n model over quadratic one for K=50000: As we move from smaller to higher k values there is a significant gradual decrement in t statistic of n2 term which is obvious from statistics given in tables 2(A-G). Ultimately for the specified K value the t statistic of nlog2n approaches close to that of n2 term in the model. For a given range of input size (in our case it is 5*105 to 5*106) an increment in K beyond a threshold (indeed a range) ensures its best performance for random inputs: i.e. Yavg(n) = O(nlog2n). So it is the K value of sample which decides on the average case behavior of algorithms (quick sort in particular). This information is important as its prior knowledge may influence the choice for a particular algorithm in advance. Our study refutes the robustness claim made for nlog2n average case behavior of quick sort. See reference [16] for an interesting discussion on the robustness of average complexity measure. 2.2 Average case analysis over discrete uniform inputs (case study-2) The frequency of occurrence of a particular element ei belonging to a sample is its tie density td(ei). As we are dealing with uniform distribution samples only, to enhance the readability, we simply drop the bracketed term and hence td corresponds to the tie density of each element in the sample. For an interesting discussion on the effect of tied elements on the algorithmic performance the reader is referred to [17]. Statistical results and its analysis 2.2.1 In this section our study is focused around analyzing algorithmic performance when it is subjected to uniform distribution data coupled with constant probability of tied elements. The observed mean time is recorded in table 3. The corresponding statistical analysis result is presented in tables 4(A-B). This result clearly suggests an Oemp(n) complexity across the various tie density values. The resulting residual plots for response are given in figures 1&2. 100000 *** *** n↓ td→ 500000 1000000 Table 3. Observed mean times in seconds 10000 1000 100 10 1 0.24276 0.24512 0.33104 1.407 12.688 25.219 2.7594 0.5734 0.4283 0.4316 0.6732 1500000 0.964 2000000 1.2999 2500000 1.6767 3000000 2.0829 3500000 2.5391 4000000 4500000 3.0219 5000000 3.54188 0.664 0.9672 1.2952 1.6703 2.0859 2.5343 3.0186 3.5453 0.8561 1.1828 1.5062 1.7781 2.0844 2.5391 3.0187 3.5342 4.1281 37.828 5.5125 50.375 6.9016 63 8.2842 76.016 9.7 88.219 11.10433 100.828 12.51567 113.468 13.93267 126.078 *** *** *** *** *** *** *** *** Table 4(A ). Regression Analysis: t versus n, nlog2n for td=1 The regression equat ion is t = 0.390 - 0.000005 n + 0.000000 nlogn Predictor Coef SE Coef T P Constant 0.38954 0.04154 9.38 0.000 n -0.00000517 0.00000029 -17.57 0.000 nlogn 0.00000026 0.00000001 20.08 0.000 S = 0.0230505 R-Sq = 100.0% R -Sq(adj) = 100.0% PRESS = 0.0164288 R -Sq(pred) = 99.86% Analysis of Variance Source DF SS MS F P Regression 2 11.4483 5.7241 10773.36 0.000 Residual Error 7 0.0037 0.0005 Total 9 11.4520 Source DF Seq SS n 1 11.2341 nlogn 1 0.2142 Obs n t Fit SE Fit Residual St Resid 1 500000 0.24276 0.26984 0.01955 -0.02708 -2.22R 2 1000000 0.43160 0.41036 0.01181 0.02124 1.07 3 1500000 0.67320 0.64910 0.01037 0.02410 1.17 4 2000000 0.96400 0.95163 0.01085 0.01237 0.61 5 2500000 1.29990 1.30158 0.01092 -0.00168 -0.08 6 3000000 1.67670 1.68933 0.01025 -0.01263 -0.61 7 3500000 2.08290 2.10852 0.00942 -0.02562 -1.22 8 4000000 2.53910 2.55461 0.00969 -0.01551 -0.74 9 4500000 3.02190 3.02423 0.01225 -0.00233 -0.12 10 5000000 3.54188 3.51474 0.01702 0.02714 1.75 R denotes an observat ion with a large standard ized residual. Table 4(B ). Regression Analysis: t versus n, nlog2n for td=1000 Regression Analysis: t versus n, nlogn [td=1000] The regression equat ion is t = 0.106 + 0.000002 n + 0.000000 nlogn Predictor Coef SE Coef T P Constant 0.105638 0.008300 12.73 0.000 n 0.00000169 0.00000006 28.82 0.000 nlogn 0.00000005 0.00000000 18.59 0.000 S = 0.00460600 R-Sq = 100.0% R-Sq(adj) = 100.0% PRESS = 0.000254515 R-Sq(pred) = 100.00% Analysis of Variance Source DF SS MS F P Regression 2 160.103 80.051 3773304.32 0.000 Residual Error 7 0.000 0.000 Total 9 160.103 Source DF Seq SS n 1 160.096 nlogn 1 0.007 Obs n t Fit SE Fit Residual St Resid 1 500000 1.4070 1.4082 0.0039 -0.0012 -0.51 2 1000000 2.7594 2.7590 0.0024 0.0004 0.10 3 1500000 4.1281 4.1279 0.0021 0.0002 0.04 4 2000000 5.5125 5.5087 0.0022 0.0038 0.94 5 2500000 6.9016 6.8982 0.0022 0.0034 0.84 6 3000000 8.2842 8.2947 0.0020 -0.0105 -2.54R 7 3500000 9.7000 9.6970 0.0019 0.0030 0.71 8 4000000 11.1043 11.1043 0.0019 0.0000 0.01 9 4500000 12.5157 12.5160 0.0024 -0.0003 -0.07 10 5000000 13.9327 13.9315 0.0034 0.0012 0.38 R denotes an observat ion with a large standard ized residual. Res idual Plots for y No rmal Pro bab ilit y Plo t Versus Fit s 99 90 50 10 t n e c r e P 1 -0.050 -0.025 0.025 0.050 0.000 Residua l Hist ogram l a u d i s e R 0.030 0.015 0.000 -0.015 -0.030 0.030 0.015 0.000 -0.015 l a u d i s e R 0 1 2 Fitted Value 3 4 Versus Ord er y c n e u q e r F 2.0 1.5 1.0 0.5 0.0 - 0.03 -0.02 0.02 5 4 6 7 0.01 -0.01 0.00 Residua l O bser vation Or der Fig.1. Residual plot corresponding to td=1 0.03 -0.030 1 2 3 8 9 10 99 90 50 10 1 6.0 4.5 3.0 1.5 0.0 t n e c r e P y c n e u q e r F Residual Plots for y No rmal Prob ab ilit y Plo t Versu s Fit s 0.005 0.000 -0.005 -0.010 l a u d i s e R -0.010 -0.005 0.000 Residual 0.005 0.010 0 Hist ogram 5 10 Fitted Value Versu s Ord er 15 l a u d i s e R 0.005 0.000 -0.005 -0.010 -0.0100 -0.0075 -0.0050 1 2 3 0.0025 0.0050 0.0000 -0.0025 Residual Fig.2. Residual plot corresponding to td=1000 4 5 6 7 Obser vation O rder 8 9 10 With a value of 28.82 the t statistic is significantly higher for linear term against the value of 18.59 for nlog2n term in the later model. Opposed to this the t value for nlog2n term (20.08) is higher than that of linear term (-17.57) in the earlier model. This observation led us to conclude that beyond a threshold value of tie density we expect linear patterns rather than nlog2n. Pseudo linear complexity model: Analyzing algorithmic complexity through the study of growth patterns is an important idea, but things could be different when it comes to practice. Unlike theoretical analysis an empirical analysis is essentially done over a feasible finite range. Hence, while going for empirical analysis, one should not always rely completely on the growth pattern as even the individual time values can have their own share (sometimes even major) to contribute in deciding the final complexity of the program in question. A careful observation of table 3 would further clear this point. The CPU times are more or less comparable when we look into the columns (table 3) for td=1, 10, and 100. However, as we moved further for higher td values, the timing differences with respect to the CPU times measured against the unit td value became prominent. The tables 1 & 3 are related by the fact that a column in table 3 would correspond to a rightward diagonal in Table 1 (if all the relevant entries were present). Each point on an average complexity curve, obtained for some higher td (say 1000 as in fig. 3) value, gives an upper bound to the corresponding point (sample size) present in some quadratic curve (in fig. 3 these curves correspond to k=5000 and 10000) obtained as complexity model for essentially similar input categories. Here we must remember that the tie density cannot be an arbitrary number as it can always be limited by the sample size N. Although, the actual timings are compared among the models obtained from possibly different data patterns they all belong to the very same family of inputs (average case inputs). Hence, although following linear patterns we call such a model as a “pseudo linear complexity model”. . c e s n i ) T ( e m i t n a e m 16 14 12 10 8 6 4 2 0 Plot of N vs. T K=5000 K=10000 TD=1000 5 10 15 20 25 30 35 40 45 50 input size in lacs (N) Fig. 3. Relative curves demonstrating pseudo linear comp lexity model . At this point we are in a position to claim that: “The uniform distribution data with similar (at least theoretically) density of tied elements is guaranteed to yield Oemp(n) growth rate”. In context of theoretical analysis this result is quite unexpected as even the best case theoretical count happens to be Ω(nlog2n) and not a linear one. Based on our analysis result we put our points in the form of the following two conjectures. Conjecture 1: Over uniform distribution data with similar density of tied elements, a theoretical O(nlog2n) complexity approaches towards an empirical Oemp(n) complexity for average case inputs having sufficiently large td values. Conjecture 2: As the sample tie density td goes beyond a certain threshold value tdt, (i.e. for all td > tdt ) even the seemingly linear complexity model, as claimed in conjecture 1, is found to be quadratic in practice, provided the sample range remains the same. And hence, we call such a linear model as “a pseudo linear complexity model”. Although, the presence of other reasons cannot be ruled out, our failure in identifying the dominant operation(s), and that too correctly, present inside the code is among the reasons for the observed behavior. Theoretical justification: It is well known that runtime of quick sort depends on the number of distinct elements [18], which in this paper, is reflected in the parameter ‘k’. If td is the tie density, then n=k*td. With fixed td, in a feasible finite range setup the value of ‘k’ will increase linearly with n. The similar argument is equally applicable for fixed ‘k’ value (see fig. 4 A & B). Also for fixed sample sizes the response is maximum when td=n (td cannot exceed n), which is the case when all elements are same valued. The response is minimum when td=1, (i.e. n=k) when all elements are distinct (at least theoretically). linear plot of N vs. K (fixed td) linear plot of N vs. td (fixed K) → d t input (N) in lacs → input (N) in lacs → Fig. 4 (A). Linear p lot of N vs. K Fig. 4(B). Linear plot of N vs. td decreasing curve of K vs. mean time (t): N is fixed increasing curve of td vs. mean time (t): N is fixed → k → . c e s n i ) t ( e m i t n a e m → . c e s n i ) t ( e m i t n a e m K → Fig. 5 (A). plot of k vs. mean time (t) td → Fig. 5(B). plot of td vs. mean time (t) The expected behavior of a random sample is O(nlog2n) complexity whereas, for a fixed sample size the run time of quick sort is a decreasing function over parameter ‘k’ (see fig. 5 A & B). This observation affects the runtime of the samples decreasing the overall runtime from nlog2n complexity to a linear one. Following this discussion it seems that the empirical analysis has the potential to cross the barrier, which otherwise is not attainable through its theoretical counterpart. 2.2.2. Quick sort for unusual data model: Analyzing the algorithmic behavior, for average case performance, through analytical approach has its own inherent limitations as mentioned in the Introduction section of this paper. Further these techniques fall flat when the algorithm is analyzed for some unusual data set for which theoretical expectation does not exists. In such a situation the empirical analysis is the only choice. ∑ ((cid:2998)(cid:3038)(cid:2880)(cid:2869) xkpk) = ∑ (−1)^(cid:1863)/(cid:1863) = - [1- 1/2 + 1/3 – 1/4 + …..] = loge2 and ∑ ((cid:2998)(cid:3038)(cid:2880)(cid:2869) xkpk) = ∑ 1/(cid:1863) (cid:2998)(cid:3038)(cid:2880)(cid:2869) Let us consider the random variable X which takes the discrete values xk = (-1)k2k/k, (cid:2998)(cid:3038)(cid:2880)(cid:2869) (k=1, 2, 3……..), with probabilities pk = 2-k. Here we get FX(x) = P(X ≤x) = ∑ (cid:1842)((cid:1850) = (cid:1876)) (cid:3045)(cid:3051)(cid:2880)(cid:3051)(cid:2868) which is a divergent series. Hence in this case expectation does not exist. Using the inverse cdf technique we have: , FX(x) ~ U[0, 1] This unusual data model is simulated over various sample ranges whose regression analysis result is given in table (5) and fig. (6). We have used the quadratic model as a test of linear/log2n goodness of fit. The test is performed by fitting a quadratic model to the data: y = b0 + b1x + b2x2, where the regression coefficients b0, b1, and b2 are estimates of the respective parameters. From the regression and ANOVA tables it is evident that the r2 is much higher, the standard error (S) is smaller. The result of coefficient for the various terms are not informative but more importantly, their t values are. The t value for quadratic term is statistically much significant than the other terms, which is an evidence of quadratic nature of the algorithmic behavior for the said data model. This result again refutes the robustness claim of average case behavior of quick sort algorithm. Table 5. Regression Analysis: t versus n, nlog2n, n2 Regression Analysis: T versus N, NlogN, N^2 The regression equat ion is T = 0.010 + 0.000034 N - 0.000002 NlogN + 0.000000 N^2 Predictor Coef SE Coef T P Constant 0.0100 0.1024 0.10 0.925 N 0.00003449 0.00003115 1.11 0.311 NlogN -0.00000212 0.00000190 -1.11 0.308 N^2 0.00000000 0.00000000 34.79 0.000 S = 0.0245745 R-Sq = 100.0% R -Sq(adj) = 100.0% Analysis of Variance Source DF SS MS F P Regression 3 412.47 137.49 227666.93 0.000 Residual Error 6 0.00 0.00 Total 9 412.47 Source DF Seq SS N 1 391.67 NlogN 1 20.07 N^2 1 0.73 Obs N T Fit SE Fit Residual St Resid 1 20000 0.3057 0.2990 0.0234 0.0066 0.90 2 40000 0.9044 0.9130 0.0149 -0.0086 -0.44 3 60000 1.8937 1.9049 0.0149 -0.0112 -0.57 4 80000 3.2939 3.2858 0.0128 0.0081 0.39 5 100000 5.0515 5.0611 0.0117 -0.0096 -0.44 6 120000 7.2734 7.2338 0.0125 0.0396 1.87 7 140000 9.8092 9.8062 0.0133 0.0030 0.15 8 160000 12.7451 12.7796 0.0127 -0.0345 -1.64 9 180000 16.1437 16.1552 0.0131 -0.0115 -0.55 10 200000 19.9518 19.9338 0.0213 0.0180 1.48 Re s idual P lots for T No rmal Pro b ab ilit y P lo t Versu s Fit s 99 90 50 10 t n e c r e P 0.04 0.02 0.00 - 0.02 - 0.04 0.04 0.02 0.00 - 0.02 l a u d i s e R l a u d i s e R 0 5 10 F itted V a lue 15 20 Versu s Ord er 1 - 0.050 - 0.025 0.000 Res idua l 0.025 0.050 H ist o g ram y c n e u q e r F 4 3 2 1 0 -0 .0 3 -0 .0 2 -0 .0 1 - 0.04 1 2 3 0. 04 0 .0 2 0 .0 3 6 4 5 7 0 .0 1 0. 00 Res idua l O bser va tion O r de r Fig.6. Residual plot for an unusual data model 8 9 10 3. CONCLUSIONS We conclude this paper with the following remarks: This research paper carefully explores the average case behavior of our candidate algorithm using the unconventional statistical bound and its empirical estimate, the so called ‘empirical-O’. The statistical bound has surely much more to offer, as is obvious from our adventure, than its theoretical counterpart. This untraditional and unconventional bound (which actually is an estimate [6]) has the potential to compliment as well as supplement the findings of much practiced mathematical bound. The statistical analysis performed over empirical data for discrete uniform distribution inputs resulted in several practically interesting patterns. To our surprise we found some complexity data following a very clear linear pattern suggesting an empirical linear model, i.e., Yavg = Oemp(n). But interestingly, the proper examination of individual response values put a serious objection on the validity of this proposed complexity model for all practical purposes. These phenomena resulted in conjectures 1 & 2 as given in the main text of this paper. As the last adventure of our tour, we examined the behavior for a non-standard data model for which expectation does not exists theoretically. Based on our statistical analysis result, we have refuted the robustness claim of average case behavior of quick sort algorithm. The general techniques for simulating the continuous and discrete as well as uniform and non uniform random variables can be found in [19]. For a comprehensive literature on sorting, see references [1] [20]. For sorting with emphasis on the input distribution, [21] may be consulted. The concept of mixing operations, as is done inherently by experimental approach, of different types is not completely a new idea. In the words of Horowitz et. al. “Given the minimum utility of determining the exact number of additions, subtractions, and so on, that are needed to solve a problem instance with characteristics given by n, we might as well lump all the operations together (provided that the time required by each is relatively independent of the instance characteristics) and obtain a count for the total number of operations” [22]. What is new with our approach is that: instead of count we prefer to work with weights and think of a conceptual bound based on these weights, which relatively is a more scientific approach as it is well known that different operations might take different amount of actual CPU times. The role of weighted count becomes more prominent when the operations in consideration differ drastically with respect to the actual consumed time. The credibility of the statistical bound estimate depends on the design and analysis of our computer experiment in which the response variable is program run time [6]. Our prime objective behind this paper is to convince its reader about the existence of weight based statistical bound. We strongly recommend use of empirical-O for arbitrary algorithms having significant performance gap, as in the present case, between their theoretical average and worst case bounds. The use of empirical-O is also recommended for algorithms in which identifying the key operation itself is a non trivial task. Conceding to the fact that the field of count based theoretical analysis is quite saturated now, hopefully the community of theoretical computer scientists would find our approach a systematic and scientific one, and hence would appreciate our statistical findings. APPENDIX Definition: Statistical bound (non-probabilistic) If wij is the weight of (a computing) operation of type i in the jth repetition (generally time is taken as a weight) and y is a “stochastic realization” (which may not be stochastic [6]) of the deterministic T=  1. wij where we count one for each operation repetition irrespective of the type, the statistical bound of the algorithm is the asymptotic least upper bound of y expressed as a function of n where n is the input parameter characterizing the algorithm’s input size. If interpreter is used, the measured time will involve both the translation time and the execution time but the translation time being independent of the input will not affect the order of complexity. The deterministic model in that case is T=  1. wij + translation time. For parallel computing, summation should be replaced by maximum. Empirical O (written as O with a subscript emp) is an empirical estimate of the statistical bound over a finite range, obtained by supplying numerical values to the weights, which emerge from computer experiments [6]. Empirical O can also be used to estimate a mathematical bound when theoretical analysis is tedious, with the acknowledgement that in this case the estimate should be count based and operation specific. REFERENCES [1] R. Sedgewick, and P. Flajolate. 1996. An Introduction to the Analysis of Algorithms. Add ison-Wesley, Reading, MA [2] Graham, R.L ., Knuth, D .E., and Patashnik, O. 1994. Concrete Mathemat ics: A Foundation for Computer Science, 2nd ed. Addison-Wesley, Reading, MA [3] D. H. Green, and D. E. Knuth. 1982. Mathematics for Analysis of Algorithms, 2nd ed. Birkhauser, Boston [4] A. Levitin. 2009. Introduction to the esign & Analysis of Algorithms. 2nd ed., Pearson Education [5]Dav id S. Johnson. Nov 2001. A Theoretician’s Guide to the Experimental Analysis of Algorithms. http://www.researchatt.com/~dsj/ [6] Soubhik Chakraborty and Suman Kumar Sourabh. 2010. A Computer Experiment Oriented Approach to Algorithmic Comp lexity. Lambert Academic Publishing [7] Suman Kumar Sourabh and Soubhik Chakraborty. 2007. On Why Algorithmic Time Comp lexity Measure Can be System Invariant Rather than System Independent. Applied Mathematics and Computat ion, Vo l. 190, Issue 1, 195-204 [8] Soubhik Chakraborty. 2010. Review of the Book Methods in Algorithmic Analysis by V. Dobrushkin. Chapman and Hall, Published in Computing Reviews, June 11, 2010 [9] Coffin. 2000. Stat ist ical analysis of computat ional tests of algorithms and heurist ics. Informs J. on Computing [10] C. Cotta, and P. Moscato. 2003. A Mixed Evolutionary -Statist ical Analysis of an Algorithm’s Complexity. Applied Mathematics Letters, 16, 41-47 [11] C. A. R. Hoare. 1962. Quicksort. Computer Journal, 5(1), 10-15 [12] Jerome Sacks et al. 1989. Design and Analysis of Experiments. Stat istical Science, Vol. 4, No. 4, 409- 423 [13] K . T. Fang, R. Li, and A. Sudjianto. 2006. Design and Modeling of Computer Experiments. Chapman and Hall [14] N iraj Kumar S ingh and Soubhik Chakraborty. 2011. Part ition Sort and its Emp irical Analysis. In Proceedings of the Internat ional Conference on Computat ional Intelligence and Informat ion Technology (CIIT 2011) . CCIS 250, 340-346. © Springer-Verlag Heidelberg 2011 [15] Paul Mathews. 2010. Design of Experiments with MINITAB. New Age Internat iona l Publishers, First Ind ian Sub-Continent Ed ition, 294 [16] Soubhik Chakraborty and Suman Kumar Sourabh. 2007. How Robust are Average Complexity Measures? A Stat ist ical Case Study. Applied Mathemat ics and Computation, 189, 1787-1797 [17] Soubhik Chakraborty, Suman Kumar Sourabh, M. Bose, and Kumar Sushant. 2007. Replacement Sort Revisited: “The Gold Standard Unearthed!”. App lied Mathematics and Computation, 189, 384-394 [18] R. Sedgewick. June 1977. Quicksort with Equal Keys. Sicomp 6(2), 240-267 [19] S. Ross. 2001. A First Course in Probability , 6th Edit ion. Pearson Education [20] Donald E. Knuth. 2000. The Art of Computer Programming , Vol. 3: Sorting and Searching . Addison Wesely, Pearson Educat ion Reprint [21] H. Mahmoud. 2000. Sorting : A D istribut ion Theory. John Wiley and Sons [22] E llis Horowitz, S. Sahni, and S. Rajasekaran. 2013(Reprint) . Fundamentals of Computer Algorithms. 2nd ed., University Press
1707.00106
5
1707
2018-11-13T03:08:51
Simultaneous Consecutive Ones Submatrix and Editing Problems : Classical Complexity \& Fixed-Parameter Tractable Results
[ "cs.DS" ]
A binary matrix $M$ has the consecutive ones property ($C1P$) for rows (resp. columns) if there is a permutation of its columns (resp. rows) that arranges the ones consecutively in all the rows (resp. columns). If $M$ has the $C1P$ for rows and columns, then $M$ is said to have the simultaneous consecutive ones property ($SC1P$). In this article, we consider the classical complexity and fixed-parameter tractability of $(a)$ Simultaneous Consecutive Ones Submatrix ($SC1S$) and $(b)$ Simultaneous Consecutive Ones Editing ($SC1E$) [Oswald et al., Theoretical Comp. Sci. 410(21-23):1986-1992, \hyperref[references]{2009}] problems. We show that the decision versions of $SC1S$ and $SC1E$ problems are NP-complete. We consider the parameterized versions of $SC1S$ and $SC1E$ problems with $d$, being the solution size, as the parameter. Given a binary matrix $M$ and a positive integer $d$, $d$-$SC1S$-$R$, $d$-$SC1S$-$C$, and $d$-$SC1S$-$RC$ problems decide whether there exists a set of rows, columns, and rows as well as columns, respectively, of size at most $d$, whose deletion results in a matrix with the $SC1P$. The $d$-$SC1P$-$0E$, $d$-$SC1P$-$1E$, and $d$-$SC1P$-$01E$ problems decide whether there exists a set of $0$-entries, $1$-entries, and $0$-entries as well as $1$-entries, respectively, of size at most $d$, whose flipping results in a matrix with the \vspace{0.095 in} $SC1P$.
cs.DS
cs
Simultaneous Consecutive Ones Submatrix and Editing Problems : Classical Complexity & Fixed-Parameter Tractable Results Rani M. R, R. Subashini, Mohith Jagalmohanan Department of Computer Science & Engineering. National Institute of Technology, Calicut {rani_p150067cs, suba}@nitc.ac.in 8 1 0 2 v o N 3 1 ] S D . s c [ 5 v 6 0 1 0 0 . 7 0 7 1 : v i X r a Abstract A binary matrix M has the consecutive ones property (C1P) for rows (resp. columns) if there is a permutation of its columns (resp. rows) that arranges the ones consecutively in all the rows (resp. columns). If M has the C1P for rows and the C1P for columns, then M is said to have the simultaneous consecutive ones property (SC1P). Binary matrices having the SC1P plays an important role in theoretical as well as practical applications. In this article, we consider the classical complexity and fixed-parameter tractability of (a) Simultaneous Consecutive Ones Submatrix (SC1S) and (b) Simultaneous Consecutive Ones Editing (SC1E) [Oswald et al., Theoretical Comp. Sci. 410(21-23):1986-1992, 2009] problems. SC1S problems focus on deleting a minimum number of rows, columns, and rows as well as columns to establish the SC1P, whereas SC1E problems deal with flipping a minimum number of 0-entries, 1-entries, and 0-entries as well as 1-entries to obtain the SC1P. We show that the decision versions of SC1S and SC1E problems are NP-complete. We consider the parameterized versions of SC1S and SC1E problems with d, being the solution size, as the parameter. Given a binary matrix M and a positive integer d, d- SC1S-R, d-SC1S-C, and d-SC1S-RC problems decide whether there exists a set of rows, columns, and rows as well as columns, respectively, of size at most d, whose deletion re- sults in a matrix with the SC1P. The d-SC1P-0E, d-SC1P-1E, and d-SC1P-01E problems decide whether there exists a set of 0-entries, 1-entries, and 0-entries as well as 1-entries, respectively, of size at most d, whose flipping results in a matrix with the SC1P. 1 Our main results include: 1. The decision versions of SC1S and SC1E problems are NP-complete. 2. Using bounded search tree technique, certain reductions and related results from the literature [Cao et al., Algorithmica 75(1):118-137, 2016, and Kaplan et al., SIAM Journal on Computing 28(5):1906-1922, 1999], we show that d-SC1S-R, d- SC1S-C, d-SC1S-RC and d-SC1P-0E are fixed-parameter tractable on binary ma- trices with run-times O∗(8d), O∗(8d), O∗(2O(dlogd)) and O∗(18d) respectively. We also give improved FPT algorithms for SC1S and SC1E problems on certain restricted binary matrices. Keywords: Simultaneous Consecutive Ones Property, Consecutive Ones Property, Fixed-Parameter Tractable, Parameterized Complexity 1. Introduction Binary matrices having the simultaneous consecutive ones property are fundamen- tal in recognizing biconvex graphs [1], recognizing proper interval graphs [2], identifying block structure of matrices in applications arising from integer linear programming [3] and finding clusters of ones from metabolic networks [4]. A binary matrix has the con- secutive ones property (C1P) for rows (resp. columns) [5], if there is a permutation of its columns (resp. rows) that arranges the ones consecutively in all the rows (resp. columns). A binary matrix has the simultaneous consecutive ones property (SC1P) [6], if we can permute the rows and columns in such a way that the ones in every column and in every row occur consecutively. That is, a binary matrix has the SC1P if it satisfies the C1P for both rows and columns. Matrices with the C1P and the SC1P are related to interval graphs and proper interval graphs respectively. There exist several linear- time and polynomial-time algorithms for testing the C1P for columns (see, for example [7, 8, 9, 10, 11, 12]). These algorithms can also be used for testing the C1P for rows. The column permutation (if one exists) to obtain the C1P for rows will not affect the C1P of the columns (if one exists) and vice versa. Thus, testing the SC1P can also be done in linear time. Preprint submitted to Elsevier November 14, 2018 SC1P being a non-trivial property, we aim to establish the SC1P in a given binary matrix through deletion of row(s)/column(s) and flipping of 0s/1s. We consider the Simultaneous Consecutive Ones Submatrix (SC1S) and Simultaneous Consecutive Ones Editing (SC1E) [6] problems to establish the SC1P, if the given binary matrix do not have the SC1P. SC1S problems focus on deleting a minimum number of rows, columns, and rows as well as columns to establish the SC1P whereas SC1E problems deal with flipping a minimum number of 0-entries, 1-entries, and 0-entries as well as 1-entries to obtain the SC1P. We pose the following optimization problems: Sc1s-Row Deletion, Sc1s-Column Dele- tion and Sc1s-Row-Column Deletion in the SC1S category, and, Sc1p-0-Flipping, Sc1p-1-Flipping and Sc1p-01-Flipping in the SC1E category. Given a binary ma- trix M, the Sc1s-Row/Column/Row-Column Deletion finds a minimum number of rows/columns/rows as well as columns, whose deletion results in a matrix satisfying the SC1P. On the other hand, the Sc1p-0/1/01-Flipping finds a minimum number of 0-entries/1-entries/any entries, to be flipped to satisfy the SC1P. We show that the decision versions of the above defined problems are NP-complete. We refer to the pa- rameterized versions of the above problems, parameterized by d as d-SC1S-R/C/RC and d-SC1P-0E/1E/01E respectively, with d being the number of rows/columns/rows as well as columns that can be deleted, and the number of 0-entries/1-entries/any entries that can be flipped respectively. Parameterized Complexity: Fixed-parameter tractability is one of the ways to deal with NP-hard problems. In parameterized complexity, the running time of an algorithm is measured not only in terms of the input size, but also in terms of a parameter. A parameter is an integer associated with an instance of a problem. It is a measure of some property of the input instance. A problem is fixed-parameter tractable (FPT) with re- spect to a parameter d, if there exists an algorithm that solves the problem in f(d).nO(1) time, where f is a computable function depending only on d, and n is the size of the input instance. The time complexity of such algorithms can be expressed as O∗(f(d)), by hiding the polynomial terms in n. We recommend the interested reader to [13] for a more comprehensive overview of the topic. 3 Problem Definition: A matrix can be considered as a set of rows (columns) together with an order on this set [14]. Here, in this paper, the term matrix always refer to a binary matrix. For a given matrix M, mij refers to the entry corresponding to ith row and jth column of M. Matrix having at most x ones in each column and at most y ones in each row is denoted as (x, y)-matrix. A (2,∗)-matrix can contain at most two ones per column and there is no bound on the number of ones per row. A (∗, 2)-matrix has no restriction on the number of ones per column and have at most two ones per row. Given an m × n matrix M, let R(M) = {r1, r2, . . . , rm} and C(M) = {c1, c2, . . . , cn} denote the sets of rows and columns of M, respectively. Here, ri and cj denote the binary vectors corresponding to row ri and column cj of M, respectively. For a subset (cid:48) (cid:48) (cid:48) and R(M)\R (cid:48) denote the submatrix induced on R ] and M\R R (cid:48) ⊆ C(M) of columns, the submatrix induced on C respectively. Similarly, for a subset C (cid:48) (cid:48) respectively. Let A(M) = {ij mij = 1} and C(M)\C and B(M) = {ij mij = 0} be the set of indices of all 1-entries and 0-entries respectively in M. We present the formal definitions of the problems d-SC1S-R, d-SC1S-C, d-SC1S- RC, d-SC1P-0E and d-SC1P-01E as follows. ⊆ R(M) of rows, M[R (cid:48) are denoted by M[C ] and M\C (cid:48) (cid:48) Simultaneous Consecutive Ones Submatrix (SC1S) Problems (cid:48) Instance: < M, d >- An m × n matrix M and an integer d (cid:62) 0. Parameter: d. d-SC1S-R: Does there exist a set R the SC1P? d-SC1S-C: Does there exist a set C the SC1P? d-SC1S-RC: Does there exist sets R such that ((M\R ⊆ C(M), with C ⊆ R(M), with R ⊆ R(M), and C ) satisfies the SC1P? )\C (cid:48) (cid:48) (cid:48) (cid:48) (cid:48) (cid:54) d such that M\R (cid:48) (cid:54) d such that M\C (cid:48) satisfies (cid:48) satisfies (cid:48) ⊆ C(M), with R (cid:48) + C (cid:48) (cid:54) d 4 Simultaneous Consecutive Ones Editing (SC1E) Problems Instance: < M, d >- An m × n matrix M and an integer d (cid:62) 0. Parameter: d. d-SC1P-1E [6]: Does there exist a set A resultant matrix obtained by flipping the entries of A d-SC1P-0E: Does there exist a set B matrix obtained by flipping the entries of B d-SC1P-01E: Does there exist a set I ⊆ A(M) ∪ B(M), with I (cid:54) d such that the resultant matrix obtained by flipping the entries of I in M satisfies the SC1P? (cid:54) d such that the resultant (cid:48) in M satisfies the SC1P? (cid:48) in M satisfies the SC1P? ⊆ A(M), with A (cid:48) ⊆ B(M), with B (cid:48) (cid:48) (cid:48) (cid:54) d such that the Complexity Status: Oswald and Reinelt [6] posed the decision version of the Sc1p-1- Flipping problem as k-augmented simultaneous consecutive ones property and showed that it is NP-complete even for (∗, 2)-matrices. To the best of our knowledge, the param- eterized problems posed under SC1S and SC1E category are not explicitly mentioned in the literature. Also, the classical complexity and parameterized complexity of SC1S and SC1E problems are not known prior to this work. Our Results: We investigate the classical complexity and fixed-parameter tractability of SC1S and SC1E problems (defined above). We prove the NP-completeness of the decision versions of SC1S and SC1E problems except for the Sc1p-1-Flipping problem. Using bounded search tree technique, few reduction rules and related results from the literature [15, 16], we present fixed-parameter tractable algorithms for d-SC1S-R, d- SC1S-C, d-SC1S-RC and d-SC1P-0E problems on general matrices (where there is no restriction on the number of ones in rows and columns) with run-times O∗(8d), O∗(8d), O∗(2O(dlogd)) and O∗(18d) respectively. For (2, 2)-matrices, we observe that SC1S and SC1E problems are solvable in polynomial- time. We also give improved FPT algorithms for SC1S and SC1E problems on certain restricted matrices. We summarize our FPT results in the following table. 5 (2,∗)-matrix O∗(4d/3d) O∗(7d) irrelevant O∗(6d) irrelevant (∗, 2)-matrix O∗(3d/4d) O∗(7d) irrelevant O∗(6d) irrelevant Problem d-SC1S-R/C d-SC1S-RC d-SC1P-0E d-SC1P-1E d-SC1P-01E Here, we observe that while defining d-SC1P-0E and d-SC1P-01E problems on (2,∗)/(∗, 2)- matrix, flipping of 0-entries, may change the input matrix to one which is not a (2,∗)/(∗, 2)- matrix. We also observe that on (2,∗)-matrices and (∗, 2)-matrices, SC1S and SC1E prob- lems, except Sc1p-0-Flipping and Sc1p-01-Flipping, admit constant factor polynomial- time approximation algorithms. (∗,∗)-matrix O∗(8d) O∗(2O(dlogd)) O∗(18d) ? ? Motivation : In Bioinformatics [4], to discover functionally meaningful patterns from a vast amount of gene expression data, one needs to construct the metabolic network of genes using knowledge about their interaction behavior. A metabolic network is made up of all chemical reactions that involve metabolites, and a metabolite is the intermediate end product of metabolism. To obtain functional gene expression patterns from this metabolic network, an adjacency matrix of metabolites is created, and clusters of ones are located in the adjacency matrix. One way to find the clusters of ones is to transform the adjacency matrix into a matrix having the SC1P by flipping 0's to 1's. This practi- cally motivated problem is posed as an instance of the d-SC1P-0E problem as follows: Finding Clusters of Ones Instance: < M, d >, where M is an adjacency matrix of metabolites and d (cid:62) 0. Parameter: d. Question: Does there exist a set of 0-entries of size at most d in M, whose flipping results in a matrix with the SC1P? The fixed-parameter tractability of d-SC1P-0E problem shows that finding clusters of ones from metabolic networks is also FPT. Another theoretically motivated problem in the area of Graph theory is Biconvex Deletion. An immediate consequence of the fixed-parameter tractability of d-SC1S-RC problem is that Biconvex Deletion prob- 6 lem is FPT. In addition, the fixed-parameter tractability of d-SC1P-0E problem shows that Biconvex Completion problem is also FPT. Several practically relevant prob- lems (scheduling, matching, etc [17, 18]) are polynomial-time solvable on biconvex graphs. Problems on Biconvex Graphs Instance: < G, d >, where G=(V1, V2, E) is a bipartite graph with V1 = n, V2 = m and d (cid:62) 0. Parameter: d. Biconvex Deletion: Does there exist a set D ⊆ V1 ∪ V2, with D (cid:54) d such that G[(V1 ∪ V2)\D] is a biconvex graph ? ⊆ E, with E(cid:48) (cid:54) d such that Biconvex Edge Deletion: Does there exist a set E(cid:48) G=(V1, V2, E\E(cid:48)) is a biconvex graph ? ⊆ (V1 × V2)\E, with E(cid:48) (cid:54) d such Biconvex Completion: Does there exist a set E(cid:48) that G=(V1, V2, E ∪ E(cid:48)) is a biconvex graph ? In addition, the FPT algorithm for d-SC1S-R on (2,∗)-matrices shows that Proper Interval Vertex Deletion (Section 2.1) problem on triangle-free graphs is FPT (us- ing Lemma 8) with a run-time of O∗(4d), where d denotes the number of allowed vertex deletions. The FPT algorithm for d-SC1P-1E on (2,∗)-matrices shows that Biconvex Edge Deletion problem is fixed-parameter tractable on certain bipartite graphs, in which the degree of all vertices in one partition is at most two. Techniques Used: Our results rely on the following forbidden submatrix character- ization of the SC1P (see Figure 1) by Tucker [1]. Theorem 1. ([1, Theorem 11]) A matrix M has the SC1P if and only if no submatrix of M, or of the transpose of M, is a member of the configuration (see Section 2.2) of MIk (k (cid:62) 1), M21, M22, M31, M32 and M33. That is, a matrix M has the SC1P if and only if no submatrix of M is a member of the configuration of MIk (k (cid:62) 1), M21, M22, M31, M32, M33 or their transposes. We refer to the set of all forbidden submatrices of the SC1P as FSC1P. FSC1P = {MIk, M21, M22, M31, M32, M33, MT 22, MT 7 }, where k (cid:62) 1. 21, MT 31, MT 32, MT 33 , MT Ik  1 0 0 . 0 1  0 0 0 . 1 1 1 0 1 1 0 1 . . . . . 0 . 0 1 . . . . . . . . 0 . . 0 1 0 . MIk, k (cid:62) 1 (k + 2 rows and k + 2 columns)  1 1 0 1 0 1  0 1 0 0 0 1 M31  0 0 0 1    0 0 1 1 1 0 0 1 1 1 1 1 0 1 1 0 M21 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 0 M32   1 0 0 0 1 1 1 0 1 1 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 M22 1 0 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0 1 1 1 0 0 0 1 0 M33  0 0 0 0 1  Figure 1: A subset of the forbidden submatrices for the SC1P [1]. For a given matrix M, while solving SC1S and SC1E problems, a recursive branching algorithm first destroys all fixed size forbidden submatrices from FSC1P. For d-SC1S- R/C/RC and d-SC1P-0E problems, the number of branches for this step will be at most 6/6/11 and 18 respectively. If the resultant matrix still does not have the SC1P, then the only forbidden submatrices that can remain in M are of type MIk and MT , where k (cid:62) 1. Ik In d-SC1S-R/C and d-SC1S-RC problems, we reduce the resultant matrix at each leaf node of the bounded search tree to an instance of d-COS-R (Section 2.2) and Chordal Vertex Deletion (Section 2.1) problems respectively. Then, we apply algorithms of d-COS-R (Theorem 12) and Chordal Vertex Deletion (Theorem 2) problems to the reduced instances of d-SC1S-R/C and d-SC1S-RC problems respectively. Finally, the 8 output of d-SC1S-R/C and d-SC1S-RC problems on M, relies on the output of d-COS-R and Chordal-Vertex-Deletion algorithms respectively on the reduced instances. For d-SC1P-0E problem, we prove in Section 3.3 that, the presence of a large MIk /MT (where k > d) is enough to say that we are dealing with a No instance, but this is not the case, for d-SC1S-R/C/RC and d-SC1P-1E/01E problems. Using a result on the number of 4-cycle decompositions of an even n-cycle where n (cid:62) 6, from [16], we show in Section (where k (cid:54) d) in d-SC1P-0E is 3.3 that, the number of ways to destroy an MIk /MT equal to the number of ternary trees with k-1 internal nodes, which is crucial for our FPT algorithm. We prove in Section 3.3.2 that, the number of ternary trees with k-1 internal nodes can be improved from 8k−1 to 6.75k−1, using Stirlings approximation (Lemma 3). Ik Ik Organization of the paper: In Section 2, we provide necessary preliminaries and observations. Section 3.1 presents polynomial-time algorithms for SC1S and SC1E prob- lems on (2, 2)-matrices. The classical complexity and fixed-parameter tractability of SC1S and SC1E problems are described in Sections 3.2 and 3.3 respectively. Last section draws conclusions and gives an insight to further work. 2. Preliminaries In this section, we present definitions and notations related to binary matrix and graphs associated with binary matrix. We recall the definition of a few graph classes that are related to the SC1P. For the sake of completeness, we also define some commonly known matrices that are used to represent graphs. We also state a few results that are used in proving the NP-completeness and fixed-parameter tractability of the problems posed in Section 1. 2.1. Graphs A graph G is defined as a tuple G = (V, E), where V = {v1, v2, . . . , vn} is a finite set of vertices and E = {e1, e2, . . . , em} is a finite set of edges. Throughout this paper, we consider V = n and E = m respectively. All graphs discussed in this paper shall always be undirected and simple. We refer the reader to [19] for the standard definitions and notations related to graphs. A sequence of distinct vertices (u1, u2, . . . , un) with 9 ui adjacent to ui+1 for each 1 (cid:54) i < n is called a u1-un path. A Hamiltonian path is a path that visits every vertex exactly once. A cycle is a graph consisting of a path (u1, u2, . . . un) and the additional edge {un, u1}. The length of a path (cycle) is the number of edges present in it. A cycle (path) on n vertices is denoted as Cn (Pn). Two vertices u, w in V are connected, if there exists a path between u and w in G. A graph G = (V, E) is a connected graph, if there exists a path between every pair of vertices in ⊆ E. The subgraph V. A graph G ) with V of G induced by V ⊆ V and (cid:48) }. A graph G = (V, E) is called a triangle-free (C3- E free) graph, if it does not contain C3 as an induced subgraph. A connected component of G is a maximal connected subgraph of G. Deletion of a vertex v ∈ V means, deleting v and all edges incident on v. (cid:48), denoted as G[V (cid:48) (cid:48) and w ∈ V = {{v, w} ∈ E v ∈ V ) is a subgraph of G, if V ⊆ V and E (cid:48), E = (V (cid:48) ], is the graph G (cid:48) (cid:48) = (V (cid:48) (cid:48), E (cid:48) (cid:48) (cid:48) (cid:48) A chord in a cycle is an edge that is not part of the cycle but connects two non- consecutive vertices in the cycle. A hole or chordless cycle is a cycle of length at least four, where no chords exist. In other words, a chordless cycle C is a cycle (u1, u2, . . . un) with n (cid:62) 4, and the additional constraint that there exists no edges of the form (ui, uj), where j (cid:54)= i± 1 and 2 (cid:54) i, j (cid:54) n − 1. A graph is chordal if it contains no hole. That is, in a chordal graph, every cycle of length at least four contains a chord. A chord (u, v) is an odd chord in an even-chordless cycle C, if the number of edges in the paths connecting u and v is odd. For an even-chordless cycle C, a 4-cycle decomposition is a minimal set O, of odd chords in C, such that C ∪ O does not have induced even chordless cycles of length at least six. We need the following lemma for our algorithms described in Section 3.1. Lemma 1. ([20, Theorem 2]) In a graph G = (V, E), a chordless cycle can be detected in O(n + m)-time, where n and m are the number of vertices and edges in G respectively. 200 Given a graph G = (V, E), and a non-negative integer k, Chordal Vertex Deletion problem decides whether there exists a set of vertices of size at most k in V, whose deletion results in a chordal graph. We used the following theorem for our FPT algorithm described in Section 3.2.3. Theorem 2. ([15, Theorem 1.1]) Chordal Vertex Deletion problem is fixed-parameter 10 tractable with a run-time of O∗(2klogk), where k is the number of allowed vertex dele- tions. Here, we define certain graph classes that are related to the SC1P. Definition 1. A graph is an interval graph if for every vertex, an interval on the real line can be assigned, such that two vertices share an edge, iff their corresponding intervals intersect. A graph is a proper interval graph, if it is an interval graph that has an intersection model, in which no interval properly contains another. Given a graph G = (V, E), and a non-negative integer k, Proper Interval Vertex Deletion [21] problem decides whether there exists a set of vertices of size at most k in V, whose deletion results in a proper interval graph. Definition 2. A graph G = (V, E) is bipartite if V can be partitioned into two disjoint vertex sets V1 and V2 such that every edge in E has one endpoint in V1 and the other endpoint in V2. A bipartite graph is denoted as G = (V1, V2, E), where V1 and V2 are the two partitions of V. Definition 3. A bipartite graph is chordal bipartite if each cycle of length at least six has a chord. We observe that a bipartite graph H, which is an even chordless cycle of length 2n, where n (cid:62) 3 can be converted to a chordal bipartite graph by adding n-2 edges. This observation is also mentioned in a different form in ([16, Lemma 4.2]). The number of ways to achieve this is given in the following lemma. Lemma 2. ([16, Lemma 4.3]) Given a bipartite graph H = (V1, V2, E), which is an even chordless cycle of length 2n (where n (cid:62) 3), the number of ways to make H a chordal bipartite graph by adding n-2 edges is equal to the number of ternary trees with n-1 internal nodes and is no greater than 8n−1. We used the following lemma to get a tighter upper bound of 6.75n−1 for the number of ways to make H a chordal bipartite graph. Lemma 3. [22] limn→∞ n! = √2πn( tion). n e 11 n (This is well known as Stirlings approxima- ) The following lemma gives the number of ternary trees with n internal nodes. Lemma 4. ([23], p.349) The number of ternary trees with n internal nodes is equal to (3n+1 n ) 3n+1 = (3n n ) 2n+1. Definition 4. A bipartite graph G = (V1, V2, E) is biconvex if the vertices of both V1 and V2 can be ordered, such that for every vertex v in V1 ∪ V2, the neighbors of v occur consecutively in the ordering. Given a bipartite graph G = (V1, V2, E), and a non-negative integer k, Biconvex Dele- tion problem decides whether there exists a set of vertices of size at most k in V1 ∪ V2, whose deletion results in a biconvex graph. Biconvex Deletion problem can be shown to be NP-complete, using the results given by Yannakakis [24, 25]. Definition 5. A bipartite graph G = (V1, V2, E) is called a chain graph [26] if there exists an ordering π of the vertices in V1, π : {1, 2, . . . , V1} → V1 such that N(π(1)) ⊆ N(π(2)) ⊆ . . . ⊆ N(π(V1)), where N(π(i)) denotes the set of neighbours of π(i) in G. Given a bipartite graph G = (V1, V2, E), and a non-negative integer k, k-Chain Com- pletion problem decides whether there exists a set of k non-edges in G, whose addition transforms G into a chain graph. Yannakakis [27] showed that k-Chain Completion problem is NP-complete. He also developed finite forbidden induced subgraph charac- terization for chain graphs. Accordingly, a bipartite graph G = (V1, V2, E) is a chain graph iff it does not contain 2K2 as an induced subgraph, where K2 is a complete graph on two vertices. Given a bipartite graph, k-Chain Editing problem decides whether there exists a set of k edge additions and deletions, which transforms G into a chain [28] have shown that k-Chain Editing problem belongs to the graph. Drange et al. class NP-complete. 2.2. Matrices Given an m×n matrix M, the n×m matrix M M and is denoted by MT. Two matrices M and M of the rows or/and columns of M submatrix that is isomorphic to M (cid:48) with m (cid:48) ji = mij is called the transpose of (cid:48) are isomorphic if M is a permutation (cid:48), if M contains a (cid:48). We say, a matrix M contains M (cid:48). The configuration of an m× n matrix M is defined 12 to be the set of all m× n matrices which can be obtained from M by row or/and column permutations. Here, we define some commonly known matrices that are used to represent graphs. Definition 6. The half adjacency matrix [14] of a bipartite graph G = (V1, V2 E) with V1 = {u1, . . . , un1 } and V2 = {v1, . . . , vn2 } is an n1 × n2 matrix MG with mij = 1 iff {ui, vj} ∈ E, where 1 (cid:54) i (cid:54) n1 and 1 (cid:54) j (cid:54) n2. Every matrix M can be viewed as the half adjacency matrix of a bipartite graph. The corresponding bipartite graph of M is referred to as the representing graph of M, denoted by GM. The representing graph GM [14] of a matrix Mm×n is obtained as follows: Definition 7. For a matrix Mm×n, GM contains a vertex corresponding to every row and every column of M, and there is an edge between two vertices corresponding to ith row and jth column of M iff the corresponding entry mij = 1, where 1 (cid:54) i (cid:54) m and 1 (cid:54) j (cid:54) n. Characterizations of biconvex and chain graphs relating their half adjacency matrices are mentioned in Lemma 5 and 6. Lemma 5. [1] A bipartite graph is biconvex iff its half adjacency matrix has the SC1P. Lemma 6. [27] A bipartite graph G = (V1, V2, E) is a chain graph iff its half adjacency matrix MG does not contain 1 0  as a submatrix. 0 1 We remark here that, the half-adjacency matrix of a chain graph satisfies the SC1P, however the converse is not true. A graph G can also be represented using edge-vertex incidence matrix, denoted by M(G), and is defined as follows. Definition 8. For a graph G = (V, E), the rows and columns of M(G) correspond to edges and vertices of G respectively. The entries mij of M(G) are defined as follows: mij = 1, if edge ei is incident on vertex vj, and mij = 0 otherwise, where 1 (cid:54) i (cid:54) m and 1 (cid:54) j (cid:54) n. Following Lemma shows that G is a path if M(G) has the C1P for rows. 13 Lemma 7. ([14, Theorem 2.2]) If G is a connected graph and the edge-vertex incidence matrix M(G) of G has the C1P for rows, then G is a path. A graph G can also be represented using maximal-clique matrix (vertex-clique incidence matrix), and is defined as follows. Definition 9. Let V = {v1, v2, . . . , vn} and C = {c1, c2, . . . , cm} be the set of vertices and the set of maximal cliques, respectively, in G. The maximal-clique matrix of G is an n × m matrix M, whose rows and columns represent the vertices and maximal cliques, respectively, in G, and an entry mij = 1 if vi belongs to cj, and mij = 0 otherwise, where 1 (cid:54) i (cid:54) n and 1 (cid:54) j (cid:54) m. A characterization of proper interval graph relating its maximal-clique matrix is men- tioned in Lemma 8. Lemma 8. [14] A graph is a proper interval graph iff its maximal-clique matrix has the SC1P. Next, we state few results that are used in proving the correctness of our FPT algorithms described in Sections 3.2.2-3.3.2. For ease of reference, we refer to the fixed-size forbidden matrices in the forbidden sub- matrix characterization of SC1P (Theorem 1) as X. i.e 31, MT X = {M21, M22, M31, M32, M33, MT 32, MT 33 21, MT 22, MT }. Lemma 9 and Lemma 10 state the run-time to find a forbidden matrix of X and MIk /MT respectively in M. Ik Lemma 9. Let M be a matrix of size m × n. Then, a minimum size submatrix in M that is isomorphic to one of the forbidden matrices of X can be found in O(m6n)-time. The above Lemma is obtained from ([14, Proposition 3.2]), by considering the max- imum possible size of the forbidden matrix in X as 6 × 5 (shown in Figure 1). By considering the maximum number of ones in each row of M as n in ([14, Proposition 3.4]), leads to the following Lemma. Lemma 10. Let M be a matrix of size m× n. Then, a minimum size submatrix of type MIk or MT (k (cid:62) 1) in M can be found in O(n3m3)-time. Ik 14 Following result shows that the representing graph GMIk /GMT Ik (Definition 7) of MIk /MT Ik (where k (cid:62) 1) is a chordless cycle. Lemma 11. ([14, Observation 3.1]) The representing graph of MIk /MT is a chordless cycle of length 2k + 4. Ik , i.e., (GMIk /GMT Ik ), It is clear from Lemma 11, that the representing graph of both MIk and its transpose are same, which simplifies the task of searching for MIk /MT Ik . Few of our results are based on the forbidden submatrix characterization of the C1P for rows and is given below. Theorem 3. ([1, Theorem 9]) A binary matrix M has the C1P for rows if and only if no submatrix of M is a member of the configuration of MIk, MIIk, MIIIk, MIV and MV, where k (cid:62) 1. Given a binary matrix M and a non-negative integer d, d-COS-R (resp. d-COS-C) problem decides whether there exists a set of rows (resp. columns), of size at most d in M, whose deletion results in a matrix with the C1P for rows. We used the following lemma to obtain an FPT algorithm for d-SC1S-R/C problems. Lemma 12. ([29, Theorem 7]) d-COS-R problem is fixed-parameter tractable with a run-time of O∗(10d), where d denotes the number of allowed row deletions. Using the recent improved FPT algorithm for Interval Deletion problem [30], it turns out that d-COS-R problem has an improved run-time of O∗(8d). 3. Our Results Even though the number of forbidden submatrices to establish the SC1P is less than the number of forbidden submatrices for the C1P, the problems posed in this paper, to obtain the SC1P also turn out to be NP-complete. Firstly, we present polynomial- time algorithms for SC1S and SC1E problems on (2, 2)-matrices. For a given matrix M, while solving SC1S problems, we delete an entire row/column of every forbidden submatrix present in M; hence destroying any forbidden submatrix from FSC1P (defined in Section 1) in M does not introduce new forbidden submatrices from FSC1P in M, which 15 were not originally present in M. The same observation, however, is not applicable for SC1E problems. The reason is that flipping an entry (0/1) may introduce new forbidden submatrices from FSC1P which were not originally present in M. This motivated us to consider the two categories of problems for establishing the SC1P in a given matrix separately. The classical complexity as well as the parameterized complexity of SC1S and SC1E problems are described in detail in Sections 3.2 and 3.3 respectively. 3.1. Easily solvable instances of SC1S and SC1E problems The problems SC1S and SC1E defined in Section 1 are solvable in polynomial-time on (2, 2)-matrices. A (2, 2)-matrix can contain only forbidden matrices MIk and MT (where k (cid:62) 1) of unbounded size, because all other forbidden matrices of FSC1P contain either a row or column with more than two ones. Since a matrix can be viewed as the half adjacency matrix of a bipartite graph, the d-SC1S-R, d-SC1S-C, d-SC1S-RC, d-SC1P-0E, d-SC1P-1E, and d-SC1P-01E problems can be formulated as graph modification problems (Here, modification means deletion of vertex/edge or addition of edge). Ik Given a (2, 2)-matrix M, consider the representing graph GM (Definition 7), of M. Since each column and row of M contains at most two ones, the degree of each vertex in GM is at most two. So the connected components of GM are disjoint chordless cycles or paths. It follows from Lemma 11 that, to destroy MIk and MT , it is sufficient to destroy chordless cycles of length greater than four in GM. Ik Theorem 4. On (2, 2)-matrices, d-SC1S-R is polynomial-time solvable. Proof. For each chordless cycle C of length greater than four in GM, consider the sub- matrix M(cid:48) induced by the vertices of C. To destroy C, delete a vertex v in C, that corresponds to a row r in M(cid:48). Decrement the parameter d by one and delete r from M. The input is an Yes-instance, if the total number of rows removed from M is at most d, otherwise it is a No-instance. The representing graph GM of M can be constructed in polynomial time. Since the degree of each vertex in GM is at most two, every pair of chordless cycles in GM will be disjoint. We also know that GM contains only finite number of vertices. The above two facts imply that GM contains only finite number of cycles. Using Lemma 1, each chordless 16 cycle can be detected in O(m + n)-time. Therefore for (2, 2)-matrices, d-SC1S-R can be solved in O(d(m + n))-time. Algorithms for solving d-SC1S-C, d-SC1S-RC, d-SC1P-0E, d-SC1P-1E and d-SC1P- 01E problems on (2, 2)-matrices are similar to the algorithm for solving d-SC1S-R (The- orem 4), except that they differ only in the way the chordless cycles are destroyed. Therefore the run-time of all these problems on (2, 2)-matrices is O(d(m + n)). Let C be a chordless cycle of length greater than four in GM. In the following corollaries, we describe how the chordless cycles are destroyed in each of the problems. Corollary 1. For (2, 2)-matrices, d-SC1S-C problem is polynomial-time solvable. Proof. In d-SC1S-C problem, deletion of a column in M corresponds to a vertex deletion in the representing graph GM. For each chordless cycle C in GM, consider the submatrix M(cid:48) induced by the vertices of C. To destroy C, delete a vertex v in C, that corresponds to a column in M(cid:48). Corollary 2. For (2, 2)-matrices, d-SC1S-RC problem is polynomial-time solvable. Proof. In d-SC1S-RC problem, deletion of a row as well as column in M corresponds to a vertex deletion in the representing graph GM. For each chordless cycle C in GM, consider the submatrix M(cid:48) induced by the vertices of C. To destroy C, delete a vertex v in C, that corresponds to a row or column in M(cid:48). Corollary 3. For (2, 2)-matrices, d-SC1P-0E problem is polynomial-time solvable. Proof. In d-SC1P-0E problem, flipping a 0-entry in M corresponds to an edge addition in the representing graph GM. For each chordless cycle C of length, say k, in GM, consider the submatrix M(cid:48) induced by the vertices of C. From Lemma 2, to make C a chordal 2 -2 edges. Hence, check whether the parameter d (cid:62) k 2 -2 bipartite graph, we have to add k or not. If so, decrement d by k 2 -2 and flip the 0-entries corresponding to the newly added edges in M. The input is an Yes-instance if the total number of 0-entries flipped in M (edges added in GM) is at most d, otherwise it is a No-instance. Corollary 4. For (2, 2)-matrices, d-SC1P-1E problem is polynomial-time solvable. 17 400 Proof. In d-SC1P-1E problem, flipping a 1-entry in M corresponds to an edge deletion in the representing graph GM. To destroy C, delete an edge, say e in C. Decrement the parameter d by one and flip the corresponding 1-entry in M. The input is an Yes- instance if the total number of 1-entries flipped in M (edges deleted in GM) is at most d, otherwise it is a No-instance. Corollary 5. For (2, 2)-matrices, d-SC1P-01E problem is polynomial-time solvable. Proof. In d-SC1P-01E problem, the allowed operations are edge additions and edge dele- tions. In a chordless cycle C of length 2k +4, the number of edges to be added to destroy C is k where k (cid:62) 1, but deletion of any edge in C destroys C. Hence, we always delete an edge from each of the chordless cycles in GM for destroying it. This proof is same as the proof of Corollary 4. 3.2. Establishing SC1P by Deletion of Rows/Columns This section considers the classical complexity and fixed-parameter tractability of SC1S problems by row, column and row as well as column deletion. We refer to the decision versions of the optimization problems Sc1s-Row Deletion, Sc1s-Column Deletion and Sc1s-Row-Column Deletion defined in Section 1 as k-SC1S-R, k- SC1S-C, and k-SC1S-RC respectively, where k denotes the number of allowed deletions. First, we show that these problems are NP-complete. Then, we give FPT algorithms for these problems on general matrices. For each of these problems, we also give improved FPT algorithms on certain restricted matrices. 3.2.1. NP-Completeness The following theorem proves the NP-completeness of k-SC1S-R problem using Hamiltonian- Path as a candidate problem. Theorem 5. Given an m × n matrix M, deciding if there exists a set R rows such that R (cid:48) have the SC1P is NP-complete. (cid:54) k and M\R (cid:48) (cid:48) ⊆ R(M), of Proof. We first show that k-SC1S-R ∈ NP. Given a matrix M and an integer k, the certificate chosen is a set of rows R ⊆ R(M). The verification algorithm affirms that (cid:54) k, and then it checks whether deletion of these k rows from M yields a matrix R (cid:48) (cid:48) 18 with the SC1P. This certificate can be verified in polynomial-time. We prove that k-SC1S-R problem is NP-hard by showing that Hamiltonian-Path (cid:54) P k-SC1S-R. Let G = (V, E) be a graph with V = n and E = m, and M(G)m×n be the edge-vertex incidence matrix (see Definition 8) obtained from G. Without loss of generality, assume that G is connected and let k be m-n+1. We show that G has a Hamiltonian path if and only if there exists a set of rows of size k in M(G) whose deletion results in a matrix M (G), that satisfy the SC1P. (cid:48) Assume that G contains a Hamiltonian path. In M(G), delete the rows that corre- spond to edges which are not part of the Hamiltonian path in G. Since Hamiltonian path contains n-1 edges, the number of rows remaining in M(G) will be n-1 which is equal to m-k and hence the number of rows deleted will be k. Now, order the columns and rows of M(G) with respect to the sequence of vertices and edges, respectively in the Hamiltonian path. Clearly, the resulting matrix has the SC1P. (cid:48) (cid:48) (cid:48) To prove the other direction, let M (cid:48) (cid:48). Since M (cid:48) (G) as an edge-vertex incidence matrix of G from M(G) and assume that M m-k, which is equal to n-1. Let G (G) has the SC1P. Now, the number of rows in M (cid:48) be the subgraph obtained from M (G) be the matrix obtained by deleting k rows (G) is (G), by considering (G) has the SC1P; it has the M (cid:48) (G) has n-1 rows. We claim that the subgraph G C1P for rows. Also, note that M (cid:48) must contain a cycle is connected. Otherwise one of the connected components of G (cid:48) is which contradicts the fact that M a path (see Lemma 7) of length n-1, which clearly indicates that G has a Hamiltonian path. The column permutation needed to convert M (G) into a matrix that has the C1P for rows gives the relative order of vertices of G's Hamiltonian path. This proves the NP-completeness of k-SC1S-R. (G) has the C1P for rows. This implies that G (cid:48) (cid:48) (cid:48) (cid:48) Corollary 6. The problem k-SC1S-C is NP-complete. Proof. The NP-completeness of k-SC1S-C can be proved similar to Theorem 5 (NP- completeness of k-SC1S-R) by considering M as the vertex-edge incidence matrix and k as the number of columns to be deleted. Since the edge-vertex incidence matrix (resp. vertex-edge incidence matrix) is a (∗, 2)- matrix (resp. (2,∗)-matrix), in fact, the following stronger result holds: 19 Corollary 7. k-SC1S-R (resp. k-SC1S-C) problem is NP-complete even for (∗, 2)- matrices (resp. (2,∗)-matrices). To prove the NP-completeness of the k-SC1S-RC problem, we use the Biconvex Dele- tion problem (Definition 4) as a candidate problem. The following theorem proves the NP-completeness of k-SC1S-RC. Theorem 6. The k-SC1S-RC problem is NP-complete. Proof. It is easy to show that k-SC1S-RC ∈ NP. We prove that k-SC1S-RC problem is NP-hard by showing that Biconvex Deletion problem (cid:54) P k-SC1S-RC. Let G = (V1, V2, E) be a bipartite graph and M be a half adjacency matrix (see Definition 7) of G. Using Lemma 5, it can be shown that G has a set of vertices, V (cid:48) 2 ⊆ V2, with 2 (cid:54) k, whose deletion results in a biconvex graph if and only if there exists a set V (cid:48) 1 + V (cid:48) ⊆ C(M), with R(cid:48) + C(cid:48) (cid:54) k in M whose deletion of rows R(cid:48) results in a matrix M(cid:48), that satisfy the SC1P. Therefore k-SC1S-RC is NP-complete. ⊆ R(M) and columns C(cid:48) 1 ⊆ V1 and V (cid:48) 3.2.2. An FPT algorithm for d-SC1S-R/d-SC1S-C problem Here, we present an FPT algorithm d-SC1S-Row-Deletion (Algorithm 1), for d-SC1S-R problem on general matrices. Given a binary matrix M and a non-negative integer d, Algorithm 1 first destroys the fixed size forbidden submatrices from X in M, using a simple search tree based branching algorithm. If M contains a forbidden matrix from X (see Section 2.2), then the algorithm recursively branches into at most six subcases, since the largest forbidden matrix of X has six rows. In each subcase, delete one of the rows of the forbidden submatrix of X found in M and decrement the parameter d by one. This process is continued in each subcase until its d value becomes zero or until it does not contain any matrix from X as its submatrix. If any of the leaf instances satisfy the SC1P, then algorithm returns Yes, indicating that input is an Yes instance. Otherwise, for each valid leaf instance (leaf instances with di > 0), say (cid:104)Mi, di(cid:105) (where 1 (cid:54) i (cid:54) 6d) of the above depth bounded search tree, if Mi still does not have the SC1P, then destroy (where k (cid:62) 1) in Mi, using the algorithm for d-COS-R (see Lemma 12) MIk and MT on Mi. The following claim holds true for any leaf instance (cid:104)Mi, di(cid:105), where 1 (cid:54) i (cid:54) 6d. Claim 1. Let M be a matrix that does not contain any fixed size forbidden matrices from Ik 20 Algorithm 1 Algorithm d-SC1S-Row-Deletion(M, d) Input: An instance (cid:104)Mm×n, d(cid:105), where M is a binary matrix and d (cid:62) 0. (cid:48) ⊆ R(M), with R (cid:48) (cid:54) d, such that M\R(cid:48) Output = Yes, No, if there exists a set R has the SC1P. otherwise  1: if M has the SC1P and d (cid:62) 0 then return Yes. 2: if d < 0 then return No. Branching Step: 3: if M contains a forbidden submatrix M(cid:48) from X, Branch into at most 6 instances Ii = (cid:104)Mi, di(cid:105) where i ∈ {1, 2, . . . , 6} Mi = M\ri, where ri ∈ R(M(cid:48)) // Decrement parameter by 1. Update di = d − 1 For some i ∈ {1, 2, . . . , 6}, if d-SC1S-Row-Deletion(Mi, di) return Yes, then return Yes, else if all instances return No, then return No. if M contains either MIk or MT , Ik D = d-COS-R(M, d) (Using Lemma 12) if D > 0 4: else 5: 6: 7: 8: 9: 10: 11: 12: 13: end if else return Yes return No end if end if X, then d-COS-R(M, d) would destroy only forbidden matrices of the form MIk and MT in M, where k (cid:62) 1. Ik Proof. Let FC1PR, FC1PC, and FSC1P represent the set of forbidden submatrices of C1P for rows, C1P for columns and SC1P respectively. Let FC1PR= X1 ∪ {MIk Then, FC1PC= XT1 ∪ {MT Now, FSC1P = X1 ∪ XT1 ∪ {MIk, MT Ik } Ik }, where X1 = {MIIk, MIIIk, MIV, MV } (see Theorem 3) }, where XT1 = {MT IIk , MT IIIk , MT IV, MT V } From Lemma 11, it is clear that searching for both MIk and its transpose is equivalent to searching for MIk alone. This implies, FSC1P = X1 ∪ XT1 ∪ {MIk }, where k (cid:62) 1 21 Now, one of the matrices from X occurs as a submatrix of every matrix in X1 ∪ XT1 . Since M being a matrix not containing any matrices from X, M will not have any matrix from X1 ∪ XT1 as a submatrix. Hence, employing d-COS-R on M would destroy only forbidden submatrices of the form MIk in M. If any of the valid leaf instances (cid:104)Mi, di(cid:105) (where 1 (cid:54) i (cid:54) 6d) return Yes after employing d-COS-R algorithm, then Algorithm 1 returns Yes indicating that M is an Yes instance, otherwise it returns No. Theorem 7. d-SC1S-R is fixed-parameter tractable on general matrices with a run-time of O∗(8d). Proof. Algorithm 1 employs a search tree, in which each node in the tree has at most six subproblems. Let us assume that out of the d row-deletions that are allowed, d1 are used for destroying the finite size forbidden matrices, and d2 are used to destroy the remaining non-finite forbidden matrices. Therefore, the tree has at most 6d1 leaves. A (cid:48) of M, that is isomorphic to one of the forbidden matrices in X can be submatrix M found in O(m6n)-time (using Lemma 9). Therefore, the time taken to destroy the finite size forbidden matrices is O∗(6d1). For each leaf instance, destroying all MIk and MT (where k (cid:62) 1) using d-COS-R subroutine (Lemma 12) takes O∗(8d)-time. Therefore, the time taken to destroy the non-finite size forbidden matrices is O∗(8d2). So, the total run-time of the algorithm would be O∗(6d1.8d2)=O∗(8d). Ik Since d-SC1S-C on M is equivalent to d-SC1S-R on MT, we obtain the following corollary. Corollary 8. d-SC1S-C is fixed-parameter tractable on general matrices with a run-time of O∗(8d). 3.2.3. An FPT algorithm for d-SC1S-RC problem Here, we present an FPT algorithm d-SC1S-RC-Deletion (Algorithm 2), for the prob- lem d-SC1S-RC on general matrices. Algorithm 2 consists of two stages. Given a binary matrix M and a non-negative integer d, stage 1 of Algorithm 2 destroys all forbidden submatrices from X in M using a simple search tree algorithm. If M contains a forbidden matrix from X, then Algorithm 2 branches into at most 11 subcases, since the number of rows and columns in the largest forbidden matrix of X is 11. In each subcase, delete 22 Algorithm 2 Algorithm d-SC1S-RC-Deletion(M, d) Input: An instance (cid:104)Mm×n, d(cid:105), where M is a binary matrix and d (cid:62) 0. ⊆ C(M), with R Yes, (cid:48) (cid:48) ⊆ R(M) and C ) has the SC1P (cid:48) Output =  if there exists a set R such that ((M\R otherwise )\C (cid:48) No, (cid:48) + C (cid:48) (cid:54) d, 1: if M has the SC1P and d (cid:62) 0 then return Yes. 2: if d < 0 then return No. Branching Step: 3: if M contains a forbidden submatrix M(cid:48) from X then, Branch into at most 11 instances Ii = (cid:104)Mi, di(cid:105) where i ∈ {1, 2, . . . , 11} Mi = M\mi, where mi ∈ R(M(cid:48)) or mi ∈ C(M(cid:48)) Update di = d − 1 // Decrement parameter by 1. For some i ∈ {1, 2, . . . , 11}, if d-SC1S-RC-Deletion(Mi, di) return Yes, then return Yes, else if all instances return No, then return No. if Stage-2(GM, d) returns Yes then, // Presented in Algorithm 3 4: else 5: 6: 7: 8: 9: 10: end if else end if return Yes return No. one of the rows or columns of the forbidden submatrix found in M and decrement the parameter d by one. This process is continued in each subcase until its d value becomes zero or until it does not contain any matrix from X as its submatrix. If any of the leaf instances satisfy the SC1P, then this algorithm returns Yes. Otherwise, to each valid leaf instance (cid:104)Mi, di(cid:105) (leaf instance with di > 0), where 1 (cid:54) i (cid:54) 11d, we apply stage 2 of , where k (cid:62) 1. Stage 2 of Algorithm 2 considers the Algorithm 2 to destroy MIk and MT representing graph GMi, of each valid leaf instance Mi, where 1 (cid:54) i (cid:54) 11d. The following observation holds true for the representing graph GMi of each valid leaf instance Mi. Ik Observation 1. Let M be a matrix that does not contain any forbidden matrix in X. Then, the representing graph GM, of M contains none of the graphs GM21 , GMT21 GM31 , GMT31 shown in Figure 2 as its induced subgraph. , GM32 , GMT32 , GM33 , GMT33 ,GM22 , GMT22 , 23 Figure 2: Representing graph of (a) M21 (MT21) (b) M22 (MT22) (c) M31 (MT31) (d) M32 (MT32) (e) M33 (MT33). Ik It is easy to see that deleting a row or column in Mi is equivalent to deleting a vertex , where k (cid:62) 1 in Mi is equivalent to destroying even in GMi and, destroying MIk and MT chordless cycles of length greater than or equal to six in GMi (Using Lemma 11). This instance is same as that of Chordal Vertex Deletion instance (Section 2) except the fact that 4-cycles need to be preserved and the remaining chordless cycles are of length greater than or equal to six. Thus in stage 2 (Algorithm 3), after preserving 4-cycles in GMi, we use chordal vertex deletion algorithm (Theorem 2) to destroy all chordless cycles of length greater than or equal to six. We apply the following reduction rules to GMi before performing chordal vertex deletion algoirthm on GMi. Reduction Rules In order to avoid the destruction of 4-cycles in GMi by chordal vertex deletion algorithm, we apply the following reduction rules. Rule 1: (Killing shorter chordless cycles): If graph GMi contains a chordless cycle of length six, eight or ten, then branch in to at most ten subproblems, deleting in each branch one of the vertices of the chordless cycle found. Recursively apply Rule 1 to GMi, until all chordless cycles of length six, eight and ten are destroyed from it. 24 (a)GM21/GMT21(b)GM22/GMT22(c)GM31/GMT31(d)GM32/GMT32(e)GM33/GMT33 Algorithm 3 Algorithm STAGE-2 (GM, d) Input: An instance (cid:104)GM, d(cid:105), where GM = (V1, V2, E) is a bipartite graph with V1 = m, V2 = n, such that GM does not contain any of the graphs shown in Figure 2 as its induced subgraph, and d (cid:62) 0. Output = Yes, No, if there exists a set V is chordal bipartite. otherwise (cid:48) ⊆ V1 ∪ V2, with V (cid:48) (cid:54) d, such that GM\V (cid:48)  1: if GM is chordal bipartite then return Yes. 2: if d < 0 then return No. 3: if GM contains a chordless cycle C(cid:48) of length six, eight or ten then, // Rule 1 Branch into at most 10 instances Ii = (cid:104)GMi, di(cid:105) where i ∈ {1, 2, . . . , 10} GMi = GM\vi, where vi is a vertex in C(cid:48) Update di = d − 1 // Decrement parameter by 1 For some i ∈ {1, 2, . . . , 10}, if STAGE-2 (GMi, di) returns Yes, then return Yes, else if all instances return No, then return No. if there exists a 4-cycle C(cid:48) in GM then, G(cid:48) M ← graph obtained from GM after reducing C(cid:48) using Rule 2 if STAGE-2(G(cid:48) M,d) returns Yes, then return Yes, otherwise return No end if Apply Rule 3 to GM. // Degree(cid:54)1 rule if CHORDAL_VERT EX_DELET ION(GM,d) returns Yes, then 4: else 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: end if return Yes return No else end if Rule 2: (4-cycle preserving rule): If graph GMi contains a 4-cycle, say (x1, y1,x2, y2) as an induced subgraph, modify GMi as follows: Introduce two new vertices and label them as x1x2 and y1y2. Make all edges incident on (x1 or x2) /(y1 or y2) to incident on x1x2/y1y2 and add an edge between x1x2 and y1y2. Delete the vertices x1, x2, y1 and y2 from GMi. This is explained in Figure 3. Each time after applying Rule 2, call Rule 1. The main purpose of calling Rule 1 after preserving every 4-cycle is to avoid the longer chordless cycle C (chordless cycle having length greater than or equal to twelve) getting totally disappeared from GMi, when C 25 intersects with many 4-cycles. Recursively apply Rule 2 to GMi, until GMi contains no 4-cycles. Rule 3: (Degree(cid:54)1 rule): Delete all vertices having degree less than or equal to one in GMi. Rule 3 is safe, since vertices having degree less than or equal to one do not contribute to chordless cycles of length greater than four. Figure 3: Illustration of preserving a 4-cycle in GMi Next, we prove that the process of preserving 4-cycles in GMi do not introduce already destroyed forbidden matrices from X in Mi. Claim 2. Let GMi be the representing graph of a valid leaf instance (cid:104)Mi, di(cid:105), obtained after Stage 1 of Algorithm 2 and, let G(cid:48) be the graph obtained from GMi, after applying Rules 1, 2 and 3. Then, G(cid:48) ,GM22 , GMT22 , GM31 , GMT31 as shown in Figure 2 as an induced subgraph. as shown in Fig- Proof. The graphs GM21 , GMT21 ure 2(a), (b), (d) and (e) contain chordless cycles of length 4. Since 4-cycle preserving rule reduces all chordless cycles of length exactly four from GMi, the resultant graph G(cid:48) , GM33 , GMT33 will not contain any of the graphs GM21 , GMT21 26 contains none of the graphs GM21 , GMT21 , GM33 , GMT33 ,GM22 , GMT22 , GM32 , GMT32 , GM32 , GMT32 ,GM22 , GMT22 , GM32 , GMT32 , GM33 , GMT33 Mi Mi Mi x1x1y1x2y2e2e1e3e4e5e6e7x1x2y1y2e3e7e6e5e4e2e1(a)4-cycleinGMi(shownindottedlines)(b)Afterreducing4-cycleinGMi Figure 4: Illustration of different cases when G(cid:48) Mi has an induced subgraph isomorphic to GM31 /GMT31 Mi Mi as an induced subgraph. Next, we prove that G(cid:48) will not contain any of the graphs shown in Figure 2(c) as its induced subgraph. For a contradiction, assume GM31 , GMT31 that G(cid:48) contains an induced subgraph H(cid:48), isomorphic to the graph GM31 or GMT31 . Then, at least one edge, say (x1x2, y1y2) in H(cid:48) is obtained by reducing a 4-cycle in GMi. Figure 4 shows two such cases. The same observation also holds for other edges in H(cid:48). In each case, it turns out that the original graph GMi contains the graph GM31 or GMT31 as its induced subgraph, which is a contradiction (From Observation 1). Next, we prove that preserving 4-cycles in GMi using Rule 2 preserves all existing chord- less cycles of length greater than or equal to 12 and do not introduce new chordless cycles in GMi. Claim 3. Let GMi be the representing graph of a valid leaf instance (cid:104)Mi, di(cid:105), obtained after Stage 1 of Algorithm 2 and, let C = (x1, y1, . . . , xn, yn) be a chordless cycle of length 2n, where n (cid:62) 6 in GMi. Let C4 = (x1, y1, x2, y2) be a chordless cycle of length 27 (a)Hx1x2y1y2y3ifeitherx1orx2isincidentony3(b)y3(c)ifbothx1andx2areincidentony3.y3x1x2y1y2y3x1x2x3(d)H(e)ifeitherx1orx2isincidentony3ifbothx1andx2areincidentony3.y3x1x2(f)y3y1y2x3y1y2x3 Figure 5: (a) C contains exactly one vertex from C4 (b) C contains exactly two vertices from C4 (c) C contains exactly three vertices from C4 exactly four in GMi. Then, reducing C4 using Rule 2 in GMi preserves C and do not introduce new chordless cycles. It only reduces the length of C by 0, 2, . . . , 2n − 10. Proof. Firstly, we show that preserving 4-cycles in GMi, preserves an existing chordless cycle C of length 2n, where n (cid:62) 6. Case (a) : C includes exactly one of the vertices of C4, say x1 as shown in Figure 5(a). After reducing C4, y3 and y4 will be incident on the newly created vertex x1x2. In this case, the length of C is reduced by zero. Case (b) : C includes exactly two vertices from C4, say x1 and y1 as shown in Figure 5(b). After reducing C4, y3 and x3 will be incident on the newly created vertices x1x2 and y1y2 respectively. In this case, the length of C is reduced by zero. Case (c) : C includes exactly three vertices from C4, say x1, y1 and x2 as shown in Figure 5(c). After reducing C4, y3 and y4 will be incident on the newly created vertex x1x2. In this case, the length of C is reduced by two. Next, we show that reducing C4 using Rule 2 do not create a new chordless cycle of length greater than or equal to 12 in GMi. For a contradiction, assume that C(cid:48) be a chordless cycle of length greater than or equal to 12 in G(cid:48) , that is formed as a result of reducing C4 using Rule 2. Then, at least one edge in C(cid:48) is obtained by reducing C4. Mi 28 600 x1x2y1y2C4Cy3y4(a)x1y1x2y2x3y3(b)x1y1x2y2(c)C4C4CCy3y4 Figure 6: Illustration of different cases when x1, y1, x2 and y2 of C4 are incident on x(cid:48) and y(cid:48) in GMi Let (x1x2, y1y2) be that edge and without loss of generality assume that x1x2 and y1y2 are incident on y(cid:48) and x(cid:48) respectively in C(cid:48) as shown in Figure 6(a). Then, there should be an induced path of length greater than or equal to 9 from y(cid:48) to x(cid:48). Figure 6(b), (c), (d), and (e) shows the different cases, when x1, y1, x2 and y2 are incident on x(cid:48) and y(cid:48) in C(cid:48). In each case, it is easy to see that the induced path from y(cid:48) to x(cid:48) along with an edge in C4 forms a chordless cycle of length greater than or equal to 12 in the original graph GMi. This implies that C(cid:48) is not a newly created cycle in G(cid:48) . Mi Lemma 13. Rule 2 is safe. 29 x1y1x2y2x0y0(b)ifx1(x2)isincidentony0y1y2x1x2x0y0(a)C0C0andy1(y2)isincidentonx0(c)ifbothx1andx2areincidentony0andy1(y2)isincidentonx0x1y1x2y2x0y0x1y2x2y1x0y0x1y2x2y1x0y0(d)ifbothy1andy2areincidentonx0andx1isincidentony0(e)ifbothy1andy2areincidentonx0andx1andx2areincidentony0C4C4C4C4 Proof. Proof follows from Claim 2 and Claim 3. . Mi Next, we show that solving d-SC1S-RC on Mi is equivalent to solving chordal vertex deletion problem on G(cid:48) Lemma 14. Let (cid:104)Mi, di(cid:105), where 1 (cid:54) i (cid:54) 11d be a valid leaf instance obtained after Stage 1 of Algorithm 2 and, let GMi be the representing graph of Mi. Let G(cid:48) be the graph obtained from GMi, after applying Rules 1, 2 and 3. Then, solving d-SC1S-RC on Mi is equivalent to solving Chordal Vertex Deletion problem on G(cid:48) , and Mi has a di size solution for d-SC1S-RC if and only if G(cid:48) has a di size solution for Chordal Vertex Deletion problem. Mi Mi Mi Ik Proof. The only forbidden matrices that can survive in Mi are MIk and MT (where k (cid:62) 1), which corresponds to even chordless cycles of length greater than or equal to six in GMi. Since Rule 2 reduces each chordless cycle of length exactly four in GMi to an edge in G(cid:48) do not contain odd chordless cycles. Therefore, solving Chordal Vertex Deletion problem (where k (cid:62) 4) in Mi, and Mi has on G(cid:48) is equivalent to destroying all MIk and MT a di size solution for d-SC1S-RC if and only if G(cid:48) has a di size solution for chordal vertex deletion algorithm. will not have any four length chordless cycles. Also, G(cid:48) , G(cid:48) Mi Mi Mi Mi Ik Mi Theorem 8. d-SC1S-RC is fixed-parameter tractable on general matrices with a run- time of O∗(2dlogd). Proof. Stage 1 of Algorithm 2 employs a search tree, where each node has at most 11 subproblems. Therefore, the tree has at most 11d leaves after Stage 1. A submatrix (cid:48) of M, that is isomorphic to one of the forbidden matrices in X can be found in M O(max(m6n, n3m3))-time (using Lemma 9 and Lemma 10). The initial branching step takes at most O(11d.max(m6n, n3m3))-time. Chordal Vertex Deletion algorithm called in each of the leaf instances runs in O∗(2dlogd)-time (Theorem 2). Therefore, the total time complexity of Algorithm 2 is O∗(2dlogd). The following corollary on Biconvex Deletion problem is a direct consequence of Theorem 8. 30  y3 0 1 0 1 y2 0 1 1 0  y1 1 1 0 0 (a) x1 x2 x3 x4  y1 1 0 0 y2 1 1 1 y3 0 1 0  y4 0 0 1 x1 x2 x3 (b) (c) (d) Figure 7: (a) Forbidden submatrix MT matrix M31 and (d) GM31 , the representing graph of M31. 31 (b) GMT31 , the representing graph of MT 31 (c) Forbidden sub- Corollary 9. Biconvex Deletion problem is fixed-parameter tractable on bipartite graphs with a run-time of O∗(2dlogd), where d denotes the number of allowed vertex deletions. 3.2.4. Improved FPT algorithms for SC1S problems on restricted matrices In this section, we present FPT algorithms for the problems d-SC1S-R, d-SC1S- C and d-SC1S-RC on (2,∗)-matrices and (∗, 2)-matrices. Our algorithm makes use of the forbidden submatrix characterization for the SC1P by Tucker (see Theorem 1). A similar technique is used in ([14, Chapter 4]) to prove the fixed-parameter tractability of d-COS-R problem on (2,∗)-matrices. We extend those results to SC1S and SC1E problems. Given an input matrix M, our algorithm consists of two stages. Stage 1 first preprocess the input matrix to remove identical rows and columns and then destroys all fixed-size forbidden submatrices from X in M. Stage 2 focuses on destroying infinite-size forbidden submatrices in M. Preprocessing on the input matrix M is done by assigning weights to each row, column and entry and deleting all but one occurrence of identical rows and columns. For a matrix M, the weight of a row (resp. column) is equal to the number of times that row (resp. column) appears in M. The weight of an entry is equal to the product of the weight of its row and column. Assigning weights to rows and columns ensures that preprocessing doesn't change the original matrix while deleting identical rows and columns. The resultant matrix thus obtained will have no identical rows and columns, 31 x1y1x2y2x3y3x4y3x2y2x1y1x3y4 Figure 8: Possible chordless cycles of length four in a (2,∗)-matrix and (∗, 2)-matrix . and it is also possible for a matrix to have more than one row/column with equal weight. If M is a (2,∗)/(∗, 2)-matrix, then the only forbidden matrix from X (Section 2.2) that can be appear in M is MT 31 /M31, because all other matrices in X contain a colum- n/row with more than two ones. We use a recursive branching algorithm, which is a search tree that checks for forbidden matrices of type MT 31 /M31 in M and then branches recursively into three/four subcases, depending upon the problem under consideration. If the resultant matrix obtained after satge 1 does not have the SC1P, then stage 2 of our algorithm focuses on destroying the forbidden matrices of type MIk and MT (where k (cid:62) 1) efficiently. Ik In stage 2 of our algorithm, branching strategy cannot be applied to destroy MIk and (where k (cid:62) 1), because their sizes are unbounded. We use the result of Theorem 9 MT Ik cleverly, to get rid of MIk and MT Lemma 15. If M is a (2,∗)-matrix or a (∗, 2)-matrix, that does not have identical columns and identical rows, then there are no chordless cycles of length four in the representing graph GM, of M. in stage 2. Ik Proof. The possible chordless cycles of length four in the representing graph of a (2,∗) and (∗, 2)-matrices are shown in Figure 8. Here, we can note that the vertices b and d cannot have degree greater than two, because we are considering only (2,∗)-matrices and (∗, 2)-matrices. In Figure 8 (i), (ii) and (iii), we can see that the vertices b and d are connected to the same vertices. That means the rows (or columns) corresponding to vertices b and d in M are identical, which is a contradiction. Theorem 9. Let M be a (2,∗)-matrix or (∗, 2)-matrix that does not have identical columns and identical rows. If M does not have the SC1P and does not contain ma- 32 abcdabcdabcd(i)(ii)(iii) Figure 9: Minimal possibilities for the representing graph GM, of a (2,∗)-matrix or (∗, 2)-matrix to have two chordless cycles of length six that share at least one vertex. The edges shown in dotted lines are the edges of the the forbidden subgraphs GM31 or GMT31 . trices in X as submatrices, then the matrices of type MIk and MT are contained in M are pairwise disjoint, i.e. they have no common column or row. Ik (where k (cid:62) 1), that Ik Proof. Consider the representing graph GM of a given m×n matrix M. From Lemma 15, it is clear that there are no chordless cycles of length 4 in GM, since M is a (2,∗)/(∗, 2)- matrix with no identical rows and columns,. For a contradiction, assume that M contains (where k (cid:62) 1), that share at least one common a pair of matrices of type MIk and/or MT column or row. This implies that, there are two induced cycles of length at least six in GM, that have at least one vertex in common corresponding to a column or row of M (Lemma 11). Figure 9 (a) and (b) shows the minimal possibilities for GM to have two chordless cycles of length six that share at least one vertex. Each of these graphs have either a GM31 or GMT31 (See Figure 7 and 9) as an induced subgraph. This means that, M 31, which is a contradiction, to the fact that all forbidden matrices contains an M31 or MT in X have been removed from M. The same can be proved by induction on chordless cycles of length eight, ten, twelve,. . . ,2(min(m, n)). Therefore our assumption that two chordless cycles in M share at least one vertex is wrong. Therefore, matrices of type MIk and MT (where k (cid:62) 1) that are contained in M are pairwise disjoint. Ik An FPT Algorithm for d-SC1S-R : In Algorithm 4, we present an FPT algorithm d-SC1S-row-deletion-restricted-matrices for solving d-SC1S-R problem on (2,∗)-matrices. Given a matrix M and a parameter d (maximum number of rows that can be deleted), Algorithm 4 first preprocess (Section 33 v1v2v3v4v5v6v7v8v9v10v11v1v2v3v4v5v6v7v8v9(a)(b)share one vertexshare three vertices 3.2.4) the input matrix, and then search and destroy every submatrix of M that contains 31, then the algorithm branches into at most four subcases an MT 31. If M contains an MT (depending on the rows of MT 31 found in M). Each branch corresponds to deleting a row of the forbidden matrix MT 31 found in M. In each of the subcases, when a row is deleted, the parameter d is decremented by the weight (Section 3.2.4) of that row. As long as d > 0, the above steps are repeated for each subcase until all the forbidden matrices of type MT 31 are destroyed. The number of leaf instances is at most O(4d). For each of the leaf instances Mi, if the resulting matrix still does not have the SC1P, then the only possible forbidden matrices that can remain in Mi are of type MIk and MT (where k (cid:62) 1). If they appear in Mi, by Theorem 9 they are pairwise disjoint. Pairwise disjoint MIk and MT in Mi, can be destroyed by deleting a row with minimum weight (by breaking ties arbitrarily) from each of them. On deletion of a row, the parameter d is decremented by the weight of that row. If the sum of the weights of all the deleted rows is less than or equal to d then, the algorithm returns Yes indicating that input is an Yes instance. Otherwise, the algorithm returns No. The correctness of the branching step can be explained in the following Lemma. Ik Ik Lemma 16. Let M be a (2,∗)-matrix that does not have the SC1P. Suppose M contains one of the forbidden matrices from X. Let M[{r1, . . . , r4}] be a submatrix that contains a forbidden matrix from X, where {r1, . . . , r4} ⊆ R(M). Then, any solution of d-SC1S-R includes at least one of the rows r1, . . . , r4. Proof. Assume that there exists a solution for d-SC1S-R, say S that contains none of the rows r1, r2, . . . , r4. Let M = M\S be the matrix with the SC1P. This implies that M[{r1, r2, . . . , r4}] in M (cid:48) satisfies the SC1P, which is a contradiction. (cid:48) Algorithm 4 can be used to solve d-SC1S-R problem on (∗, 2)-matrices also, by search- ing for an M31 instead of MT 31 in M (in line 6 of Algorithm 4), and considering the number of branches as three (since the only forbidden matrix in X that can occur in a (∗, 2)-matrix is M31 and it has three rows). Theorem 10. d-SC1S-R is fixed-parameter tractable on (2,∗)/(∗, 2)-matrices with a run-time of O∗(4d)/O∗(3d), where d denotes the number of rows that can be deleted. 34 Algorithm 4 Algorithm d-SC1S-row-deletion-restricted-matrices(M, d) Input: An instance (cid:104)Mm×n, d(cid:105) where M is a (2,∗)-binary matrix and d (cid:62) 0 (cid:48) ⊆ R(M), with R (cid:48) (cid:54) d, such that M\R(cid:48) Yes, No, if there exists a set R has the SC1P. otherwise  Output = Stage 1: 1: Apply preprocessing steps as discussed in Section 3.2.4 on M. 2: if M has the SC1P and d (cid:62) 0 then, return Yes. 3: if d < 0 then, return No. Branching Step: 4: if there exists a submatrix M (cid:48) in M that is isomorphic to MT 31 then, Branch into at most four instances Ii = (cid:104)Mi, di(cid:105) where i ∈ {1, 2, 3, 4} Set Mi ← M \ {ri} Update di ← d-wt(ri) (cid:48). // wt(ri) denotes the weight of row ri. For some i ∈ {1, 2, 3, 4}, if d-SC1S-row-deletion-restricted-matrices(Mi, di) returns Yes, then return Yes, else if all instances return No, then return No. // ri denotes the ith row of M 5: end if Stage 2: Delete a row r in N having minimum weight from M. Decrement the parameter d by the weight of the deleted row r. 6: while there exists a submatrix N in M that is isomorphic to an MIk or MT 7: 8: 9: end while 10: if M does not contain MIk or MT Ik Ik and d (cid:62) 0 then return Yes, otherwise return No and d > 0 do, Proof. Algorithm 4 employs a search tree, where each node in the search tree has at most four/three subproblems, and therefore the tree has at most 4d/3d leaves. The size (cid:48) of M, that is isomorphic to MT of the search tree is O(4d)/O(3d). A submatrix M 31 and M31 can be found in O(m4n)-time and O(m3n)-time(using Lemma 9) respectively. Therefore, for an input matrix M, the time required for destroying an MT 31 /M31 (stage 1) is O(4dm4n)/O(3dm3n). The time required for finding a submatrix of type MIk and , (where k (cid:62) 1) in M is O(m3n3) and O(m3) (using Lemma 10) on (2,∗)-matrices MT Ik and (∗, 2)-matrices respectively. For each of the leaf instance Mi, line 6 of Algorithm 4 is executed at most di times and di (cid:54) d. Therefore the time complexity of destroying MIk and MT in M (stage 2) is O(4dm3n3d)/O(3dm3d). The total time complexity of Ik 35 Algorithm 4 is O(4d(m4n + d.m3n3))/O(3d(m3n + d.m3)) on (2,∗)/(∗, 2)-matrices. The following corollary on Proper Interval Vertex Deletion problem (Section 2.1) is a direct consequence of Theorem 10. Corollary 10. Proper Interval Vertex Deletion problem is fixed-parameter tractable on triangle-free graphs with a run-time of O∗(4d), where d denotes the number of allowed vertex deletions. Corollary 11. The optimization version of d-SC1S-R problem (Sc1s-Row Deletion) on a (2,∗)/(∗, 2)-matrix can be approximated in polynomial-time with a factor of four/three. Proof. In Stage 1 of Algorithm 4, instead of branching on each of the rows of a forbidden 31/M31 found in M, delete all rows of each of the forbidden submatrix submatrix MT 31/M31 found in M. From Algorithm 4, it is clear that Stage 2 solves the problem MT exactly. This results in a 4-factor/3-factor approximation algorithm. An FPT Algorithm for d-SC1S-C: A related problem of deleting at most d number of columns to get the SC1P (d-SC1S-C problem) can also be solved using Algorithm 4 (consider the columns instead of rows in lines 4, 7 and 8) in O∗(3d)-time for (2,∗)-matrix (O∗(4d)-time for (∗, 2)-matrix) and the approximation factor for the optimization version of d-SC1S-C problem (Sc1s-Column Deletion) is three (four). An FPT Algorithm for d-SC1S-RC: d-SC1S-RC problem can also be solved using Algorithm 4 (consider the rows as well as columns instead of rows in lines 4, 7 and 8) in O∗(7d)-time on (2,∗)/(∗, 2)-matrices. The approximation factor for the optimization version of d-SC1S-RC problem (Sc1s-Row- Column Deletion) is seven. 3.3. Establishing SC1P by Flipping Entries This section considers SC1E problems by flipping 0/1 and 01-entries. We refer to the decision versions of the optimization problems SC1P-0-Flipping and SC1P-01-Flipping defined in Section 1 as k-SC1P-0E and k-SC1P-01E respectively, where k denotes the 36 number of allowed flippings. First, we show that these problems are NP-complete. Then, we give an FPT algorithm for d-SC1P-0E problem on general matrices. Finally, we present an FPT algorithm for d-SC1P-1E problem on certain restricted matrices. 3.3.1. NP-completeness The following theorem proves the NP-completeness of k-SC1P-0E problem using k- Chain Completion problem (Definition 5) on bipartite graphs as a candidate problem. Theorem 11. The k-SC1P-0E problem is NP-complete. Proof. We first show that k-SC1P-0E ∈ NP. Given a matrix M and an integer k, the cer- tificate is a set A(cid:48) of indices corresponding to 0-entries in M. The verification algorithm affirms that A(cid:48) (cid:54) k, and then it checks whether flipping these 0-entries in M yields a matrix with the SC1P. This verification can be done in polynomial time.  = Jm,n MG We prove that k-SC1P-0E problem is NP-hard by showing that k-Chain Com- pletion (cid:54) P k-SC1P-0E. The half-adjacency matrix of any chain graph can be ob- served to satisfy the SC1P, however the converse is not true. Given a bipartite graph G = (V1, V2, E) with V1 = m and V2 = n, we create a 2m × 2n binary matrix MGnew as follows. MGnew = of G, Jm,n is an m × n matrix with all entries as one and 0m,n is an m × n matrix with all entries as zero. It can be noted that adding an edge in G corresponds to flipping a 0-entry in B. We show that G can be converted to a chain graph G(cid:48) by adding at most k edges if and only if there are at most k number of 0-flippings in MGnew, such that the resultant matrix MG(cid:48) , where MG is the half adjacency matrix A B 0m,n Jm,n D C new satisfies the SC1P. 0 1 0 1 Suppose G(cid:48) is a chain graph, then  cannot occur exclusively in B (from Lemma  cannot  and 1 1 0 0 0 1 0 0 1 0 0 0 6). By construction of MGnew, it can be observed that occur as submatrices in MG(cid:48) new. From Figure 1, it is clear that one of the configura- tions of these two matrices occur as a submatrix in all the forbidden submatrices of the SC1P, except MI1. Hence MI1 is the only forbidden submatrix of the SC1P that could new contains MI1, then it would further imply that appear in MG(cid:48) new. However, if MG(cid:48) 800 37 1  as a submatrix, 0 1 B(cid:48)(matrix obtained after flipping the 0-entries of B) contains which contradicts the assumption that G(cid:48) is a chain graph. Therefore, if k edges can be added to G to make it a chain graph, then k 0-entries can be flipped in MGnew to make it satisfy the SC1P. 0 Conversely, suppose that k=k1+k2 0-flippings are performed on MGnew to make it satisfy the SC1P, where k1 and k2 refer to the number of 0-flippings performed in B and D respectively. Let us assume that the corresponding bipartite graph G(cid:48), obtained after the flipping of zeroes in B is not a chain graph. Since G(cid:48) is not a chain graph, it contains 2K2 as an induced subgraph, which further means that B(cid:48) contains  as a submatrix. 1 0 1 0  Jm,mn MG 0mn,mn Jmn,n , The construction of MGnew implies that MG(cid:48) the remaining 3 quadrants of MG(cid:48) chain graph. Therefore, k-SC1P-0E is NP-complete. new has MI1 as a submatrix (considering new), which leads to a contradiction. Hence G(cid:48) is a The following corollary on Biconvex Completion problem is a direct consequence of the above theorem. Corollary 12. Given a bipartite graph G = (V1, V2, E) and a non-negative integer k, the problem of deciding whether there exists a set E(cid:48) ⊆ (V1 × V2)\E, of size at most k, such that G = (V1, V2, E ∪ E(cid:48)) is a biconvex graph is NP-complete. The following theorem proves the NP-completeness of the k-SC1P-01E problem using the k-Chain Editing problem (Definition 5) on bipartite graphs as a candidate problem. Theorem 12. The k-SC1P-01E problem is NP-complete. Proof. We first show that k-SC1P-01E ∈ NP. Given a matrix M and an integer k, the certificate is a set A(cid:48) of indices corresponding to 0/1-entries in M. The verification algorithm affirms that A(cid:48) (cid:54) k, and then it checks whether flipping these 0/1-entries in M yields a matrix with the SC1P. This verification can be done in polynomial time. We prove that k-SC1P-01E is NP-hard by showing that k-Chain Editing (cid:54) P k-SC1P- 01E. The NP-hardness of k-SC1P-01E can be proved similar to the NP-hardness of k- SC1P-0E (Theorem 11) by considering MGnew as follows: MGnew = 38 where G = (P, Q, E) is a bipartite graph, with P=m and Q=n and MG being the half adjacency matrix of G. It can be noted that adding/removing an edge in G corresponds to flipping a 0/1-entry in B. We claim that G can be converted to a chain graph G(cid:48) by adding/deleting at most k edges if and only if there are at most k number of 0/1-flippings in MGnew, such that the resultant matrix MG(cid:48) new satisfies the SC1P (This can be proved similar to Theorem 11). The following corollary on Biconvex Editing problem is a direct consequence of the above theorem. Corollary 13. Given a bipartite graph G = (V1, V2, E) and a non-negative integer k, the problem of deciding whether there exists a set of at most k edge modifications (edge additions/deletions) in G, that results in a biconvex graph is NP-complete. 3.3.2. An FPT algorithm for d-SC1P-0E problem Ik In this section, we present an FPT algorithm d-SC1P-0-Flipping (Algorithm 5), for d-SC1P-0E problem on general matrices. Given a binary matrix M and a non-negative integer d, Algorithm 5 destroys forbidden submatrices from FSC1P in M, using a simple search tree based branching algorithm. The algorithm recursively branches, if M contains (where k (cid:62) 1). a forbidden matrix from X (see Section 2.2) as well as MIk or MT If M contains a forbidden matrix from X, then the algorithm branches into at most eighteen subcases, since the largest forbidden matrix of X has eighteen 0-entries. In each subcase, flip one of the 0-entry of the forbidden submatrix found in M and decrement the parameter d by one. Otherwise, if M contains a forbidden submatrix of type MIk or , then the algorithm finds a minimum size forbidden matrix M(cid:48), of type MIk or MT MT Ik in M. If the value of k is greater than d, then the algorithm returns No (using Corollary 14), otherwise the algorithm branches into at most O(7d)-subcases (using Lemma 17). In each subcase, flip k 0-entries of the forbidden submatrix M(cid:48) found in M, and decrement the parameter d by k. This process is continued in each subcase, until its d value becomes zero or until it satisfies the SC1P. Algorithm 5 returns Yes if any of the subcases returns Yes, otherwise it returns No. Ik Flipping a 0-entry in M is equivalent to adding an edge in the representing graph GM in M, it is of M. From this fact and Lemma 11, it follows that to destroy MIk and MT Ik 39 sufficient to destroy chordless cycles of length greater than four in GM (i.e make GM a chordal bipartite graph (Section 2) by addition of edges). The number of zero flippings required to destroy an MIk or MT , where (k (cid:62) 1) is given in Corollary 14. Ik Corollary 14. The minimum number of 0-flippings required to destroy an MIk or MT where (k (cid:62) 1) is k. Ik , Proof. It follows from Lemma 2 and Lemma 11. Algorithm 5 Algorithm d-SC1P-0-Flipping(M, d) Input: An instance (cid:104)Mm×n, d(cid:105), where M is a binary matrix and d (cid:62) 0. Output = Yes, No, (cid:48) ⊆ B(M), of indices with B if there exists a set B matrix obtained by flipping the entries of B otherwise  (cid:48) (cid:54) d, such that the resultant (cid:48) satisfy the SC1P. 1: if M has the SC1P and d (cid:62) 0 then return Yes. 2: if d < 0 then return No. Branching Step: 3: if M contains a forbidden submatrix M(cid:48) from X then, 4: Branch into at most 18 instances Ii = (cid:104)Mi, di(cid:105) where i ∈ {1, 2, . . . , 18} Set Mi ← M with ith 0-entry of M Update di ← d − 1 (cid:48) flipped (where 0-entries of M(cid:48) are labelled // Decrement parameter by 1. in row-major order). For some i ∈ {1, 2, . . . , 18}, if d-SC1P-0-Flipping(Mi, di) returns Yes, then return Yes, else if all instances return No, then return No. 5: if M contains either MIk or MT 6: 7: 8: 9: Find a minimum size MIk or MT if k > d, return No. else Ik Ik then, in M, (say M(cid:48)) Branch into at most O(7k) (number of ways to destroy M(cid:48)) instances Set Mi ← M with k appropriate 0-entries of M(cid:48) flipped. Update di ← d − k Ii = (cid:104)Mi, di(cid:105) where i ∈ {1, 2, . . . , 7k}. // Decrement parameter by k. 10: 11: 12: 13: end if end if For some i ∈ {1, 2, . . . , O(7k)}, if d-SC1P-0-Flipping(Mi, di) returns Yes, then return Yes, else if all instances return No, then return No. Observation 2. The number of 0-entries in an MIk or MT Ik , where (k (cid:62) 1) is O(k2). 40 The above observation leads to a O∗(d2d) algorithm for d-SC1P-0E. But, using the result of the following lemma, we get a O∗(18d) algorithm for d-SC1P-0E. Lemma 17. Given a bipartite graph H = (V1, V2, E), which is an even chordless cycle of length 2n (where n (cid:62) 3), the number of ways to make H a chordal bipartite graph by adding n-2 edges is at most 6.75n−1. Proof. Number of ways to make H a chordal bipartite graph = Number of ternary trees with n-1 internal nodes (using Lemma 2). Number of ternary trees with n internal nodes = (3n)! (cid:0)3n+1 (cid:1) n 3n + 1 (2n + 1)(2n)!n! n = n (using Lemma 3). (cid:1) (cid:0)3n 2n + 1 = (cid:112)2π(3n)( (cid:112)2π(n)( × √3 × 33n √4πn × 22n × (2n + 1) 33n 22n 2n e 3n e ) ∼ O( n e 2n 3n ) n ) ) = 33n ) = O(6.75n) n e ) (cid:112)2π(2n)( (cid:1) limn→∞ n! = √2πn( limn→∞ (cid:0)3n (cid:1) (cid:0)3n 2n + 1 = n n 2n + 1 = O( √n × 22n × (2n + 1) × (2n + 1) Therefore, number of ternary trees with n internal nodes = O(6.75n). Hence, the number of ways to make H a chordal bipartite graph is same as the number of ternary trees with n-1 internal nodes and is O(6.75n−1). Lemma 18. In Algorithm 5, destroying MIk /MT Ik takes O∗(6.75d)-time. Proof. Let φ(k) represent the number of 4-cycle decompositions (Section 2.1) of a 2(k+2)- , where k (cid:62) 1. Using Lemma 4, cycle, or rather the representing graph of an M1k or MT1k (3k+3 k+1 ) 2k+3 . Let there be chordless cycles of sizes 2(i1 +2), 2(i2 +2), . . . , 2(im +2) (in φ(k) = the non-decreasing order of size) in the representing graph of the input matrix, and let d be the number of allowed edge additions. Since in is equal to the number of edges to be be added to the nth smallest cycle in the representing graph of the input matrix, we n=1 in (cid:54) d. Then, the number of leaves associated with the removal of MIk /MT get in the search tree is given by: (cid:80) Ik m 41 (cid:81) (cid:81) T (k) = φ(i1) × φ(i2) × φ(i3), . . . φ(ik) = , where (cid:54) (cid:0)3.in (cid:1) m n=1 φ(in) (2in+3)(in+1) m n=1 3in+1 = m n=1 φ(in) n=1 in (cid:54) d. m (cid:81) (cid:80) in ) e )d = O( = O( 2πd( d √2π(3d)( 3d e )3d √ √2π(2d)( 2d e )2d. 33d√ d.22d ) = O( 33d Hence, destroying all MIk /MT Theorem 13. d-SC1P-0E problem on a matrix Mm×n, can be solved in O∗(18d)-time, where d denotes the number of 0-entries that can be flipped. Consequently, it is FPT. (where k (cid:62) 1), in M takes O∗(6.75d)-time. 22d ) = O(6.75d). (Using Lemma 3). Ik Proof. Each node in the search tree of Algorithm 5 has at most 18 or O(7k) subproblems, depending on whether we are destroying the fixed size forbidden matrices or MIk /MT (cid:48) of M, that is isomorphic to one of the forbidden matrices respectively. A submatrix M in X, and MIk /MT can be found in O(m6n)-time (using Lemma 9) and O(m3n3)-time (using Lemma 10) respectively. From Lemma 18, it follows that destroying all MIk /MT in M takes O∗(6.75d)-time, whereas destroying all the forbidden matrices from X takes O∗(18d)-time. Therefore, the total time complexity of Algorithm 5 is O∗(18d) . Ik Ik Ik The idea used in Algorithm 5, does not work for SC1S and other SC1E problems defined in Section 1. In d-SC1P-0E problem, the presence of a large MIk (or a large chordless cycle), where k > d is enough to say that we are dealing with a No instance (Using Corollary 14). But for d-SC1S-R\C\RC and d-SC1P-1E\01E problems, a chordless cycle (of any length) can be destroyed by deleting an arbitrary vertex and an arbitrary edge respectively. This idea plays a crucial role in the context of flipping zeroes, but not flipping ones, and deleting rows/columns in the input matrix. The following corollary on Biconvex Completion problem (Section 1) is a direct consequence of Theorem 13. Corollary 15. Biconvex Completion problem is fixed-parameter tractable on bipartite graphs with a run-time of O∗(18d), where d denotes the number of allowed edge additions. 3.3.3. An FPT algorithm for d-SC1P-1E problem on restricted matrices The d-SC1P-1E problem on (2,∗)/(∗, 2)-matrices can also be solved using Algorithm 4, with a modification in the branching step as follows. Here, we branch on the number 42 of 1-entries of the forbidden submatrix MT 31 /M31 found in M. In each branch, we flip the corresponding 1-entry and the parameter d is decremented by the weight of that 31 /M31 is 6 (for both (2,∗) 1-entry (Definition 3.2.4). The number of 1-entries in an MT and (∗, 2)-matrix), which leads to a branching factor of at most 6. After the branching (where step, the remaining pairwise disjoint forbidden submatrices of type MIk and MT k (cid:62) 1) in M can be destroyed in polynomial time by flipping a minimum weight 1-entry respectively. Therefore, the total time complexity is O∗(6d), which in MIk and MT leads to the following theorem. Theorem 14. d-SC1P-1E on a (2,∗)/(∗, 2)-matrix Mm×n can be solved in O∗(6d)-time where d denotes the number of allowed 1-flippings. The optimization version of d-SC1P- 1E problem (Sc1p-1-Flipping) can be approximated in polynomial-time with a factor of six. Ik Ik The following corollary on Biconvex Edge Deletion problem (Section 1) is a direct consequence of Theorem 14. Corollary 16. Biconvex Edge Deletion problem is fixed-parameter tractable on certain bipartite graphs, in which the degree of all vertices in one partition is at most two, with a run-time of O∗(6d), where d denotes the number of allowed edge deletions. 4. Conclusion In this work, first we showed that the decision versions of SC1S and SC1E problems are NP-complete. Then, we proved that d-SC1S-R/C/RC and d-SC1P-0E problems are fixed-parameter tractable on general matrices. We also showed that d-SC1P-1E problem is fixed-parameter tractable on certain restricted matrices. Improved FPT algorithms for d-SC1S-R/C/RC problems on (2,∗) and (∗, 2) matrices are also presented here. We also observed that the fixed-parameter tractability of d-SC1S-R problem on (2,∗)-matrices implies that Proper Interval Vertex Deletion problem is FPT on triangle-free graphs with a run-time of O∗(4d). From our results, it turns out that Biconvex Ver- tex Deletion and Biconvex Completion problems are fixed-parameter tractable. We also observed that Biconvex Edge Deletion problem is fixed-parameter tractable on certain restricted bipartite graphs. We conjecture that d-SC1P-1E and d-SC1P-01E 43 problems are also fixed-parameter tractable on general matrices. However, the idea used for solving d-SC1P-0E cannot be extended to solve d-SC1P-1E and d-SC1P-01E problems. In d-SC1P-1E and d-SC1P-01E problems, a chordless cycle of any length can be destroyed by removing a single edge, which leads to an unbounded number of branches. An inter- esting direction for future work would be to investigate the parameterized complexity of d-SC1P-1E/01E problems on general matrices. References [1] A. Tucker, A structure theorem for the consecutive 1's property, Journal of Combinatorial Theory, Series B 12 (2) (1972) 153 -- 162. doi:10.1016/0095-8956(72)90019-6. [2] P. C. Fishburn, Interval orders and interval graphs, Discrete Mathematics 55 (2) (1985) 135 -- 149. URL http://www.sciencedirect.com/science/article/pii/0012365X85900421 [3] M. Oswald, Weighted consecutive ones problems, Ph.D. thesis (2003). URL http://archiv.ub.uni-heidelberg.de/volltextserver/3588/1/diss.pdf [4] R. König, G. Schramm, M. Oswald, H. Seitz, S. Sager, M. Zapatka, G. Reinelt, R. Eils, Discover- ing functional gene expression patterns in the metabolic network of escherichia coli with wavelets transforms, BMC bioinformatics 7 (1) (2006) 119. doi:10.1186/1471-2105-7-119. [5] D. Fulkerson, O. Gross, Incidence matrices and interval graphs, Pacific journal of mathematics 15 (3) (1965) 835 -- 855. doi:10.2140/pjm.1965.15.835. [6] M. Oswald, G. Reinelt, The simultaneous consecutive ones problem, Theoretical Computer Science 410 (21-23) (2009) 1986 -- 1992. doi:10.1016/j.tcs.2008.12.039. [7] K. S. Booth, G. S. Lueker, Testing for the consecutive ones property, interval graphs, and graph planarity using pq-tree algorithms, Journal of Computer and System Sciences 13 (3) (1976) 335 -- 379. doi:10.1016/S0022-0000(76)80045-1. [8] W.-L. Hsu, A simple test for the consecutive ones property, Journal of Algorithms 43 (1) (2002) 1 -- 16. doi:10.1006/jagm.2001.1205. [9] W.-L. Hsu, R. M. McConnell, Pc trees and circular-ones arrangements, Theoretical computer science 296 (1) (2003) 99 -- 116. doi:10.1016/S0304-3975(02)00435-8. [10] R. M. McConnell, A certifying algorithm for the consecutive-ones property, in: Proceedings of the fifteenth annual ACM-SIAM symposium on Discrete algorithms, Society for Industrial and Applied Mathematics, 2004, pp. 768 -- 777. URL http://dl.acm.org/citation.cfm?id=982792.982909 [11] J. Meidanis, O. Porto, G. P. Telles, On the consecutive ones property, Discrete Applied Mathematics 88 (1-3) (1998) 325 -- 354. doi:10.1016/S0166-218X(98)00078-X. [12] M. Raffinot, Consecutive ones property testing: cut or swap, in: Conference on Computability in Europe, Springer, 2011, pp. 239 -- 249. doi:10.1007/978-3-642-21875-0_25. 44 [13] R. G. Downey, M. R. Fellows, Fundamentals of parameterized complexity, Vol. 4, Springer, 2013. doi:10.1007/978-1-4471-5559-1. [14] M. Dom, Recognition, Generation, and Application of Binary Matrices with the Consecutive Ones Property, Cuvillier, 2009. URL http://fpt.akt.tu-berlin.de/publications/theses/dom08.pdf [15] Y. Cao, D. Marx, Chordal editing is fixed-parameter tractable, Algorithmica 75 (1) (2016) 118 -- 137. URL https://link.springer.com/article/10.1007/s00453-015-0014-x [16] H. Kaplan, R. Shamir, R. E. Tarjan, Tractability of parameterized completion problems on chordal, strongly chordal, and proper interval graphs, SIAM Journal on Computing 28 (5) (1999) 1906 -- 1922. doi:10.1137/S0097539796303044. [17] W. Lipski, F. P. Preparata, Efficient algorithms for finding maximum matchings in convex bipartite graphs and related problems, Acta Informatica 15 (4) (1981) 329 -- 346. doi:10.1007/BF00264533. [18] S.-L. Peng, Y.-C. Yang, On the treewidth and pathwidth of biconvex bipartite graphs, in: Inter- national Conference on Theory and Applications of Models of Computation, Springer, 2007, pp. 244 -- 255. doi:10.1007/978-3-540-72504-6_22. [19] D. B. West, Introduction to graph theory, Vol. 2, Prentice hall Upper Saddle River, 2009. 1000 URL https://ia801204.us.archive.org/35/items/igt_west/igt_west_text.pdf [20] T. Uno, H. Satoh, An efficient algorithm for enumerating chordless cycles and chordless paths, in: International Conference on Discovery Science, Springer, 2014, pp. 313 -- 324. URL http://arxiv.org/abs/1404.7610 [21] P. VanâĂŹt Hof, Y. Villanger, Proper interval vertex deletion, Algorithmica 65 (4) (2013) 845 -- 867. doi:10.1007/s00453-012-9661-3. [22] J. Stirling, Methodus differentialis, sive tractatus de summation et interpolation serierum infinitar- ium, london, The Differential Method: A Treatise of the Summation and Interpolation of Infinite Series (trans: Holliday, J.)[1749](1730). URL https://archive.org/details/bub_gb_J6dqTJWSAcMC/page/n3 [23] R. L. Graham, D. E. Knuth, O. Patashnik, S. Liu, Concrete mathematics: a foundation for computer science, Computers in Physics 3 (5) (1989) 106 -- 107. URL https://aip.scitation.org/doi/pdf/10.1063/1.4822863 [24] M. Yannakakis, Node-and edge-deletion np-complete problems, in: Proceedings of the tenth annual ACM symposium on Theory of computing, ACM, 1978, pp. 253 -- 264. URL http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.319.8796&rep=rep1&type= pdf [25] M. Yannakakis, Node-deletion problems on bipartite graphs, SIAM Journal on Computing 10 (2) (1981) 310 -- 327. doi:https://doi.org/10.1137/0210022. [26] A. Natanzon, R. Shamir, R. Sharan, Complexity classification of some edge modification problems, Discrete Applied Mathematics 113 (1) (2001) 109 -- 128. URL http://www.cs.tau.ac.il/~roded/articles/mod.pdf [27] M. Yannakakis, Computing the minimum fill-in is np-complete, SIAM Journal on Algebraic Discrete 45 Methods 2 (1) (1981) 77 -- 79. URL https://doi.org/10.1137/0602010 [28] P. G. Drange, M. S. Dregi, D. Lokshtanov, B. D. Sullivan, On the threshold of intractability, in: Algorithms-ESA 2015, Springer, 2015, pp. 411 -- 423. URL http://www.ii.uib.no/~daniello/papers/thresholdEdit.pdf [29] N. Narayanaswamy, R. Subashini, Obtaining matrices with the consecutive ones property by row deletions, Algorithmica 71 (3) (2015) 758 -- 773. doi:10.1007/s00453-014-9925-1. [30] Y. Cao, Linear recognition of almost interval graphs, in: Proceedings of the twenty-seventh annual ACM-SIAM symposium on Discrete algorithms, SIAM, 2016, pp. 1096 -- 1115. URL https://dl.acm.org/citation.cfm?id=2884512 46
1708.07586
2
1708
2018-02-16T17:26:34
Fast Locality-Sensitive Hashing Frameworks for Approximate Near Neighbor Search
[ "cs.DS" ]
The Indyk-Motwani Locality-Sensitive Hashing (LSH) framework (STOC 1998) is a general technique for constructing a data structure to answer approximate near neighbor queries by using a distribution $\mathcal{H}$ over locality-sensitive hash functions that partition space. For a collection of $n$ points, after preprocessing, the query time is dominated by $O(n^{\rho} \log n)$ evaluations of hash functions from $\mathcal{H}$ and $O(n^{\rho})$ hash table lookups and distance computations where $\rho \in (0,1)$ is determined by the locality-sensitivity properties of $\mathcal{H}$. It follows from a recent result by Dahlgaard et al. (FOCS 2017) that the number of locality-sensitive hash functions can be reduced to $O(\log^2 n)$, leaving the query time to be dominated by $O(n^{\rho})$ distance computations and $O(n^{\rho} \log n)$ additional word-RAM operations. We state this result as a general framework and provide a simpler analysis showing that the number of lookups and distance computations closely match the Indyk-Motwani framework, making it a viable replacement in practice. Using ideas from another locality-sensitive hashing framework by Andoni and Indyk (SODA 2006) we are able to reduce the number of additional word-RAM operations to $O(n^\rho)$.
cs.DS
cs
Fast Locality-Sensitive Hashing Frameworks for Approximate Near Neighbor Search∗ Tobias Christiani1 1 IT University of Copenhagen [email protected] Abstract The Indyk-Motwani Locality-Sensitive Hashing (LSH) framework (STOC 1998) is a general tech- nique for constructing a data structure to answer approximate near neighbor queries by using a distribution H over locality-sensitive hash functions that partition space. For a collection of n points, after preprocessing, the query time is dominated by O(nρ log n) evaluations of hash functions from H and O(nρ) hash table lookups and distance computations where ρ ∈ (0, 1) is determined by the locality-sensitivity properties of H. It follows from a recent result by Dahlgaard et al. (FOCS 2017) that the number of locality-sensitive hash functions can be re- duced to O(log2 n), leaving the query time to be dominated by O(nρ) distance computations and O(nρ log n) additional word-RAM operations. We state this result as a general framework and provide a simpler analysis showing that the number of lookups and distance computations closely match the Indyk-Motwani framework, making it a viable replacement in practice. Using ideas from another locality-sensitive hashing framework by Andoni and Indyk (SODA 2006) we are able to reduce the number of additional word-RAM operations to O(nρ). 1998 ACM Subject Classification E.1 Data Structures, H.3.3 Information Search and Retrieval Keywords and phrases locality-sensitive hashing, approximate near neighbors, similarity search Digital Object Identifier 10.4230/OASIcs... Introduction 1 The approximate near neighbor problem is the problem of preprocessing a collection P of n points in a space (X, dist) into a data structure such that, for parameters r1 < r2 and given a query point q ∈ X, if there exists a point x ∈ P with dist(q, x) ≤ r1, then the data structure is guaranteed to return a point x0 ∈ P such that dist(q, x0) < r2. Indyk and Motwani [24] introduced a general framework for constructing solutions to the approximate near neighbor problem using a technique known as locality-sensitive hashing (LSH). The framework takes a distribution over hash functions H with the property that near points are more likely to collide under a random h ∼ H. During preprocessing a number of locality-sensitive hash functions are sampled from H and used to hash the points of P into buckets. The query algorithm evaluates the same hash functions on the query point and looks into the associated buckets to find an approximate near neighbor. The locality-sensitive hashing framework of Indyk and Motwani has had a large impact in both theory and practice (see surveys [3] and [33] for an introduction), and many of the best known solutions to the approximate near neighbor problem in high-dimensional spaces, such as Euclidean space [2], the unit sphere under inner product similarity [4], and sets under ∗ The research leading to these results has received funding from the European Research Council under the European Union's 7th Framework Programme (FP7/2007-2013) / ERC grant agreement no. 614331. © Tobias Christiani; licensed under Creative Commons License CC-BY Open Access Series in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany 8 1 0 2 b e F 6 1 ] S D . s c [ 2 v 6 8 5 7 0 . 8 0 7 1 : v i X r a XX:2 Fast Locality-Sensitive Hashing Frameworks for Approximate Near Neighbor Search Jaccard similarity [7] come in the form of families of locality-sensitive hash functions that can be plugged into the Indyk-Motwani LSH framework. (cid:73) Definition 1 (Locality-sensitive hashing [24]). Let (X, dist) be a distance space and let H be a distribution over functions h: X → R. We say that H is (r1, r2, p1, p2)-sensitive if for x, y ∈ X and h ∼ H we have that: If dist(x, y) ≤ r1 then Pr[h(x) = h(y)] ≥ p1. If dist(x, y) ≥ r2 then Pr[h(x) = h(y)] ≤ p2. The Indyk-Motwani framework takes a (r1, r2, p1, p2)-sensitive family H and constructs a data structure that solves the approximate near neighbor problem for parameters r1 < r2 with some positive constant probability of success. We will refer to this randomized approximate version of the near neighbor problem as the (r1, r2)-near neighbor problem, where we require queries to succeed with probability at least 1/2 (see Definition 7). To simplify the exposition we will assume throughout the introduction, unless otherwise stated, that 0 < p1 < p2 < 1 are constant, that a hash function h ∈ H can be stored in n/ log n words of space, and for ρ = log(1/p1)/ log(1/p2) ∈ (0, 1) that a point x ∈ X can be stored in O(nρ) words of space. The assumption of a constant gap between p1 and p2 allows us to avoid performing distance computations by instead using the 1-bit sketching scheme of Li and König [26] together with the family H to approximate distances (see Section 4.1 for details). In the remaining part of the paper we will state our results without any such assumptions to ensure, for example, that our results hold in the important case where p1, p2 may depend on n or the dimensionality of the space [2, 4]. (cid:73) Theorem 2 (Indyk-Motwani [24, 22], simplified). Let H be (r1, r2, p1, p2)-sensitive and let ρ = log(1/p1) log(1/p2), then there exists a solution to the (r1, r2)-near neighbor problem using O(n1+ρ) words of space and with query time dominated by O(nρ log n) evaluations of functions from H. The query time of the Indyk-Motwani framework is dominated by the number of evaluations of locality-sensitive hash functions. To make matters worse, almost all of the best known and most widely used locality-sensitive families have an evalution time that is at least linear in the dimensionality of the underlying space [7, 11, 16, 2, 4]. Significant effort has been devoted to the problem of reducing the evaluation complexity of locality-sensitive hash families [32, 18, 15, 4, 25, 29, 30, 14], while the question of how many independent locality- sensitive hash functions are actually needed to solve the (r1, r2)-near neighbor problem has received relatively little attention [1, 14]. This paper aims to bring attention to, strengthen, generalize, and simplify results that reduce the number of locality-sensitive hash functions used to solve the (r1, r2)-near neighbor problem. In particular, we will extract a general framework from a technique introduced by Dahlgaard et al. [14] in the context of set similarity search under Jaccard similarity, showing that the number of locality-sensitive hash functions can be reduced to O(log2 n) in general. We further show how to reduce the word-RAM complexity of the general framework from O(nρ log n) to O(nρ) by combining techniques from Dahlgaard et al. and Andoni and Indyk [1]. Reducing the number of locality-sensitive hash functions allows us to spend time O(nρ/ log2 n) per hash function evaluation without increasing the overall complexity of the query algorithm - something which is particularly useful in Euclidean space where the best known LSH upper bounds offer a tradeoff between the ρ-value that can be achieved and the evaluation complexity of the locality-sensitive hash function [2, 4, 25]. T. Christiani XX:3 1.1 Related work Indyk-Motwani. The Indyk-Motwani framework uses L = O(nρ) independent partitions of space, each formed by overlaying k = O(log n) random partitions induced by k random hash functions from a locality-sensitive family H. The parameter k is chosen such that a random partition has the property that a pair of points x, y ∈ X with dist(x, y) ≤ r1 has probability n−ρ of ending up in the same part of the partition, while a pair of points with dist(x, y) ≥ r2 has probability n−1 of colliding. By randomly sampling L = O(nρ) such partitions we are able to guarantee that a pair of near points will collide with constant probability in at least one of them. Applying these L partitions to our collection of data points P and storing the result of each partition of P in a hash table we obtain a data structure that solves the (r1, r2)-near neighbor problem as outlined in Theorem 2 above. Section 3 and 3.1 contains a more complete description of LSH-based frameworks and the Indyk-Motwani framework. Andoni-Indyk. As previously mentioned, many locality-sensitive hash functions happen to have a super-constant evaluation time. This motivated Andoni and Indyk to introduce a replacement to the Indyk-Motwani framework in a paper on substring near neighbor search [1]. The key idea is to re-use hash functions from a small collection of size m (cid:28) L by (cid:1) hash functions. This technique is also known as tensoring forming all combinations of(cid:0)m t √ ρ log n log log n)) = no(1) as stated in Theorem 3. and has seen some use in the work on alternative solutions to the approximate near neighbor problem, in particular the work on locality-sensitive filtering [17, 6, 12]. By applying the tensoring technique the Andoni-Indyk framework reduces the number of hash functions to O(exp( (cid:73) Theorem 3 (Andoni-Indyk [1], simplified). Let H be (r1, r2, p1, p2)-sensitive and let ρ = log(1/p1) log(1/p2), then there exists a solution to the (r1, r2)-near neighbor problem using O(n1+ρ) √ words of space and with query time dominated by O(exp( ρ log n log log n)) evaluations of functions from H and O(nρ) other word-RAM operations. The paper by Andoni and Indyk did not state this result explicitly as a theorem in the same form as the Indyk-Motwani framework; the analysis made some implicit restrictive assumptions on p1, p2 and ignored integer constraints. Perhaps for these reasons the result does not appear to have received much attention, although it has seen some limited use in practice [31]. In Section 3.2 we present a slightly different version of the Andoni-Indyk framework together with an analysis that satisfies integer constraints, providing a more accurate assessment of the performance of the framework in the general, unrestricted case. Dahlgaard-Knudsen-Throup. The paper by Dahlgaard et al. [14] introduced a different technique for constructing the L hash functions/partitions from a smaller collection of m hash functions from H. Instead of forming all combinations of subsets of size t as the Andoni-Indyk framework they instead sample k hash functions from the collection to form each of the L partitions. The paper focused on a particular application to set similarity search under Jaccard similarity, and stated the result in terms of a solution to this problem. In Section 3.3 we provide a simplified and tighter analysis to yield a general framework: (cid:73) Theorem 4 (Dahlgaard-Knudsen-Thorup [14], simplified). Let H be (r1, r2, p1, p2)-sensitive and let ρ = log(1/p1) log(1/p2), then there exists a solution to the (r1, r2)-near neighbor problem using O(n1+ρ) words of space and with query time dominated by O(log2 n) evaluations of functions from H and O(nρ log n) other word-RAM operations. XX:4 Fast Locality-Sensitive Hashing Frameworks for Approximate Near Neighbor Search Figure 1 The exact number of locality-sensitive hash functions from a (r1, r2, 0.5, p2)-sensitive family used by different frameworks to solve the (r1, r2)-near neighbor problem on a collection of 230 points according to the analysis in this paper. The analysis of [14] indicates that the Dahlgaard-Knudsen-Thorup framework, when compared to the Indyk-Motwani framework, would use at least 50 times as many partitions (and a corresponding increase in the number of hash table lookups and distance computations) to solve the (r1, r2)-near neighbor problem with success probability at least 1/2. Using elementary tools, the analysis in this paper shows that we only have to use twice as many partitions as the Indyk-Motwani framework to obtain the same guarantee of success. Number of hash functions in practice. To provide some idea of what the number of hash functions H used by the different frameworks would be in practice, Figure 1 shows the value of log2 H that is obtained by actual implementations of the Indyk-Motwani (IM), Andoni- Indyk (AI), and Dahlgaard-Knudsen-Thorup (DKT) frameworks according to the analysis in Section 3 for p1 = 1/2 and every value of 0 < p2 < 1/2 for a solution to the (r1, r2)-near neighbor problem on a collection of n = 230 points. Figure 1 reveals that the number of hash functions used by the Indyk-Motwani framework exceeds 230, the size of the collection of points P, as p2 approaches p1. In addition, locality-sensitive hash functions used in practice such as Charikar's SimHash [11] and p-stable LSH [16] have evaluation time O(d) for points in Rd. These two factors might help explain why a linear scan over sketches of the entire collection of points is a popular approach to solve the approximate near neighbor problem in practice [34, 20]. The Andoni-Indyk framework reduces the number of hash functions by several orders of magnitude, and the Dahlgaard-Knudsen-Thorup framework presents another improvement of several orders of magnitude. Since the word-RAM complexity of the DKT framework matches the the number of hash functions used by the IM framework, the gap between the solid line (DKT) and the dotted line (IM) gives some indication of the time we can spend on evaluating a single hash function in the DKT framework without suffering a noticeable increase in the query time. 1020300.000.250.500.751.00p2p1log2HIMAIDKT T. Christiani XX:5 √ L × √ √ 1.2 Contribution Improved word-RAM complexity. In addition to our work on the Andoni-Indyk and Dahlgaard-Knudsen-Thorup frameworks as mentioned above, we show how the word-RAM complexity of the DKT framework can be reduced by a logarithmic factor. The solution is a simple combination of the DKT sampling technique and the AI tensoring technique: First we use the DKT sampling technique twice to construct two collections of L partitions. Then we use the AI tensoring technique to form L = L pairs of partitions from the two collections. Below we state our main Theorem 5 in its general form where we make no implicit assumptions about H (p1 and p2 are not assumed to be constant and can depend on for example n) or about the complexity of storing a point or a hash function, or computing the distance between pairs of points in the space (X, dist). (cid:73) Theorem 5. Let H be (r1, r2, p1, p2)-sensitive and let ρ = log(1/p1)/ log(1/p2), then there exists a solution to the (r1, r2)-near neighbor with the following properties: 1/p2(n)/p1) evaluations of functions from H, The query complexity is dominated by O(log2 O(nρ) distance computations, and O(nρ/p1) other word-RAM operations. The solution uses O(n1+ρ/p1) words of space in addition to the space required to store the data and O(log2 Under the same simplifying assumptions used in the statements of Theorem 2, 3, and 4, our main Theorem 5 can be stated as Theorem 4 with the word-RAM complexity reduced by a logarithmic factor to O(nρ). This improvement in the word-RAM complexity comes at the cost of a (rather small) constant factor increase in the number of hash functions, lookups, and distance computations compared to the DKT framework. By varying the size m of the collection of hash functions from H and performing independent repetitions we can obtain a tradeoff between the number of hash functions and the number of lookups. In Section 5 we remark on some possible improvements in the case where p2 is large. 1/p2(n)/p1) functions from H. Distance sketching using LSH. Finally, we combine Theorem 5 with the 1-bit sketching scheme of Li and König [26] where we use the locality-sensitive hash family to create sketches that allow us to leverage word-level parallelism and avoid direct distance computations. This sketching technique is well known and has been used before in combination with LSH-based approximate similarity search [13], but we believe there is some value in the simplicity of the analysis and in a clear statement of the combination of the two results as given in Theorem 6, for example in the important case where 0 < p2 < p1 < 1 are constant. (cid:73) Theorem 6. Let H be (r1, r2, p1, p2)-sensitive and let ρ = log(1/p1)/ log(1/p2), then there exists a solution to the (r1, r2)-near neighbor with the following properties: The complexity of the query operation is dominated by O(log2(n)/(p1 − p2)2) evaluations of hash functions from H and O(nρ/(p1 − p2)2) other word-RAM operations. The solution uses O(n1+ρ/p1 + n/(p1 − p2)2) words of space in addition to the space required to store the data and O(log2(n)/(p1 − p2)2) hash functions from H. Preliminaries 2 Problem and dynamization. We begin by defining the version of the approximate near neighbor problem that the frameworks presented in this paper will be solving: (cid:73) Definition 7. Let P ⊆ X be a collection of P = n points in a distance space (X, dist). A solution to the (r1, r2)-near neighbor problem is a data structure that supports the following XX:6 Fast Locality-Sensitive Hashing Frameworks for Approximate Near Neighbor Search query operation: Given a query point q ∈ X, if there exists a point x ∈ P with dist(q, x) ≤ r1, then, with probability at least 1/2, return a point x0 ∈ P such that dist(q, x0) < r2. We aim for solutions with a failure probability that is upper bounded by 1/2. The standard trick of using η independent repetitions of the data structure allows us to reduce the probability of failure to 1/2η. For the sake of simplicity we restrict our attention to static solutions, meaning that we do not concern ourselves with the complexity of updates to the underlying set P, although it is simple to modify the static solutions presented in this paper to dynamic solutions where the update complexity essentially matches the query complexity [28, 22] LSH powering. The Indyk-Motwani framework and the Andoni-Indyk framework will make use of the following standard powering technique described in the introduction as "overlaying partitions". Let k ≥ 1 be an integer and let H denote a locality-sensitive family of hash functions as in Definition 1. We will use the notation Hk to denote the distribution over functions h0 : X → Rk where h0(x) = (h1(x), . . . , hk(x)) (1) and h1, . . . , hk are sampled independently at random from H. It is easy to see that Hk is (r1, r2, pk1, pk2)-sensitive. To deal with some special cases we define H0 to be the family consisting of a single constant function. Model of computation. We will work in the standard word-RAM model of computation [21] with a word length of Θ(log n) bits where n denotes the size of the collection P to be searched in the (r1, r2)-near neighbor problem. During the preprocessing stage of our solutions we will assume access to a source of randomness that allows us to sample independently from a family H and to seed pairwise independent hash functions [9, 10]. The latter can easily be accomplished by augmenting the model with an instruction that generates a uniformly random word in constant time and using that to seed the tables of a Zobrist hash function [35]. Frameworks 3 Overview. We will describe frameworks that take as input a (r1, r2, p1, p2)-sensitive family H and a collection P of n points and constructs a data structure that solves the (r1, r2)-near neighbor problem. The frameworks described in this paper all use the same high-level technique of constructing L hash functions g1, . . . , gL that are used to partition space such that a pair of points x, y with dist(x, y) ≤ r1 will end up in the same part of one of the L partitions with probability at least 1/2. That is, for x, y with dist(x, y) ≤ r1 we have that Pr[∃l ∈ [L]: gl(x) = gl(y)] ≥ 1/2 where [L] is used to denote the set {1, 2, . . . , L}. At the same time we ensure that the expected number of collisions between pairs of points x, y with dist(x, y) ≥ r2 is at most one in each partition. Preprocessing and queries. During the preprocessing phase, for each of the L hash functions g1, . . . , gL we compute the partition of the collection of points P induced by gl and store it in a hash table in the form of key-value pairs (z,{x ∈ P gl(x) = z}). To reduce space usage we store only a single copy of the collection P and store references to P in our L hash tables. To guarantee lookups in constant time we can use the perfect hashing scheme by Fredman et al. [19] to construct our hash tables. We will assume that hash values z = gl(x) fit into O(1) T. Christiani XX:7 words. If this is not the case we can use universal hashing [8] to operate on fingerprints of the hash values. We perform a query for a point q as follows: for l = 1, . . . , L we compute gl(q), retrieve the set of points {x ∈ P gl(x) = gl(q)}, and compute the distance between q and each point in the set. If we encounter a point x0 with dist(q, x0) < r2 then we return x0 and terminate. If after querying the L sets no such point is encountered we return a special symbol ∅ and terminate. We will proceed by describing and analyzing the solutions to the (r1, r2)-near neighbor problem for different approaches to sampling, storing, and computing the L hash functions g1, . . . , gL, resulting in the different frameworks as mentioned in the introduction. 3.1 Indyk-Motwani To solve the (r1, r2)-near neighbor problem using the Indyk-Motwani framework we sample L hash functions g1, . . . , gL independently at random from the family Hk where we set k = dlog(n)/ log(1/p2)e and L = d(ln 2)/pk1e. Correctness of the data structure follows from the observation that the probability that a pair of points x, y with dist(x, y) ≤ r1 does not collide under a randomly sampled gl ∼ Hk is at most 1 − pk1. We can therefore upper bound the probability that a near pair of points does not collide under any of the hash functions by (1 − pk1)L ≤ exp(−pk1L) ≤ 1/2 using a standard bound stated as Lemma 13 in Appendix A. In the worst case, the query operation computes L hash functions from Hk corresponding to Lk hash functions from H. For a query point q the expected number of points x0 ∈ P with dist(q, x0) ≥ r2 that collide with q under a randomly sampled gl ∼ Hk is at most npk2 ≤ np = 1. It follows from linearity of expectation that the total expected number of distance computations during a query is at most L. The result is summarized in Theorem 8 from which the simplified Theorem 2 follows. (cid:73) Theorem 8 (Indyk-Motwani [24, 22]). Given a (r1, r2, p1, p2)-sensitive family H we can construct a data structure that solves the (r1, r2)-near neighbor problem such that for k = dlog(n)/ log(1/p2)e and L = d(ln 2)/pk1e the data structure has the following properties: The query operation uses at most Lk evaluations of hash functions from H, expected L distance computations, and O(Lk) other word-RAM operations. The data structure uses O(nL) words of space in addition to the space required to store the data and Lk hash functions from H. log(n)/ log(1/p2) 2 Theorem 8 gives a bound on the expected number of distance computations while the simplified version stated in Theorem 2 uses Markov's inequality and independent repetitions to remove the expectation from the bound by treating an excessive number of distance computations as a failure. 3.2 Andoni-Indyk In 2006 Andoni and Indyk, as part of a paper on the substring near neighbor problem, introduced an improvement to the Indyk-Motwani framework that reduces the number of locality-sensitive hash functions [1]. Their improvement comes from the use of a technique that we will refer to as tensoring: setting the hash functions g1, . . . , gL to be all t-tuples from a collection of m functions sampled from Hk/t where m (cid:28) L. The analysis in [1] shows that by setting m = nρ/t and repeating the entire scheme t! times, the total number of hash functions can be reduced to O(exp( log log n. This analysis ignores integer constraints on t, k, and m, and implicitly place restrictions on p1 and ρ log n log log n)) when setting t = q ρ log n √ XX:8 Fast Locality-Sensitive Hashing Frameworks for Approximate Near Neighbor Search p2 in relation to n (e.g. 0 < p2 < p1 < 1 are constant). We will introduce a slightly different scheme that takes into account integer constraints and analyze it without restrictions on the properties of H. Assume that we are given a (r1, r2, p1, p2)-sensitive family H. Let η, t, k1, k2, m1, m2 be non-negative integer parameters. Each of the L hash functions g1, . . . , gL will be formed by concatenating one hash function from each of t collections of m1 hash functions from Hk1 and concatenating a last hash function from a collection of m2 hash functions from Hk2. We take all mt1m2 hash functions of the above form and repeat η times for a total of L = ηmt1m2 hash functions constructed from a total of H = η(m1k1t + m2k2) hash functions from H. In Appendix B we set parameters, leaving t variable, and provide an analysis of this scheme, showing that L matches the Indyk-Motwani framework bound of O(1/pk1) up to a constant where k = dlog(n)/ log(1/p2)e as in Theorem 8. Setting t. It remains to show how to set t to obtain a good bound on the number of hash functions H. Note that in practice we can simply set t = arg mint H by trying t = 1, . . . , k. If we ignore integer constraints and place certain restrictions of H as in the original tensoring scheme by Andoni and Indyk we want to set t to minimize the expression ttnρ/t. This minimum is obtained when setting t such that t2 log t = ρ log n. We therefore cannot do much better than setting t =pρ log(n)/ log log n which gives the bound H = O(exp(pρ log(n) log log n)) as shown in [1]. To allow for easy comparison with the Indyk-Motwani framework without placing restrictions on H we set t = d√ (cid:73) Theorem 9. Given a (r1, r2, p1, p2)-sensitive family H we can construct a data structure that solves the (r1, r2)-near neighbor problem such that for k = dlog(n)/ log(1/p2)e, H = √ √ k/p1) k( The query operation uses O(H) evaluations of functions from H, O(L) distance computa- tions, and O(L + H) other word-RAM operations. The data structure uses O(nL) words of space in addition to the space required to store the data and O(H) hash functions from H. k, and L = d1/pk1e the data structure has the following properties: ke, resulting in Theorem 9. Thus, compared to the Indyk-Motwani framework we have gone from using O(k(1/p1)k) locality-sensitive hash functions to O(k( k) locality-sensitive hash functions. Figure 1 shows the actual number of hash functions of the revised version of the Andoni-Indyk scheme as analyzed in Appendix B when t is set to minimize H. k/p1) √ √ 3.3 Dahlgaard-Knudsen-Thorup In a recent paper Dahlgaard et al. [14] introduce a different technique for reducing the number of locality-sensitive hash functions. The idea is to construct each hash value gl(x) by sampling and concatenating k hash values from a collection of km pre-computed hash functions from H. Dahlgaard et al. applied this technique to provide a fast solution the the approximate near neighbor problem for sets under Jaccard similarity. In this paper we use the same technique to derive a general framework solution that works with every family of locality-sensitive hash functions, reducing the number of locality-sensitive hash functions compard to the Indyk-Motwani and Andoni-Indyk frameworks. Let [n] denote the set of integers {1, 2, . . . , n}. For i ∈ [k] and j ∈ [m] let hi,j ∼ H denote a hash function in our collection. To sample from the collection we use k pairwise independent hash functions [10] of the form fi : [L] → [m] and set gl(x) = (h1,f1(l)(x), . . . , hk,fk(l)(x)). T. Christiani XX:9 points x and y let Zl = 1{gl(x) = gl(y)} so that Z =PL To show correctness of this scheme we will use make use of an elementary one-sided version of Chebyshev's inequality stating that for a random variable Z with mean µ > 0 and variance σ2 < ∞ we have that Pr[Z ≤ 0] ≤ σ2/(µ2 + σ2). For completeness we have included the proof of this inequality in Lemma 15 in Appendix A. We will apply this inequality to lower bound the probability that there are no collisions between close pairs of points. For two l=1 Zl denotes the sum of collisions under the L hash functions. To apply the inequality we need to derive an expression for the expectation and the variance of the random variable Z. Let p = Prh∼H[h(x) = h(y)] then by linearity of expectation we have that µ = E[Z] = Lpk. To bound σ2 = E[Z2]− µ2 we proceed i=1Yl,i for Yl,i = 1{hi,fi(l)(x) = hi,fi(l)(x)} by bounding E[Z2] where we note that Zl = Πk and make use of the independence between Yl,i and Yl0,i0 for i 6= i0. E[Z2] = X ≤ L2E(cid:2)Πk l,l0∈[L] l6=l0 LX (cid:3) + µ E[ZlZl0] + E[Zl] l=1 = (L2 − L)E[ZlZl0] + µ i=1Yl,iYl0,i = L2 (E[Yl,iYl0,i])k + µ. We have that E[Yl,iYl0,i] = Pr[fi(l) = fi(l0)]p + Pr[fi(l) 6= fi(l0)]p2 = (1/m)p + (1 − 1/m)p2 which follows from the pairwise independence of fi. Let ε > 0 and set m = d 1−p1 ln(1+ε)e then for p ≥ p1 we have that (E[Yl,iYl0,i])k ≤ (1+ ε)p2k. This allows us to bound the variance of Z by σ2 ≤ εµ2 + µ resulting in the following lower bound on the probability of collision between similar points. (cid:73) Lemma 10. For ε > 0 let m ≥ d 1−p1 dist(x, y) ≤ r1 we have that ln(1+ε)e, then for every pair of points x, y with p1 p1 k k Pr[∃l ∈ [L]: gl(x) = gl(y)] ≥ 1 + εµ 1 + (1 + ε)µ . (2) By setting ε = 1/4 and L = d(2 ln(2))/pk1e we obtain an upper bound on the failure probability of 1/2. Setting the size of each of the k collections of pre-computed hash values to m = d5k/p1e is sufficient to yield the following solution to the (r1, r2)-near neighbor problem where provide exact bounds on the number of lookups L and hash functions H: (cid:73) Theorem 11 (Dahlgaard-Knudsen-Thorup [14]). Given a (r1, r2, p1, p2)-sensitive family H we can construct a data structure that solves the (r1, r2)-near neighbor problem such that for k = dlog(n)/ log(1/p2)e, H = kd5k/p1e, and L = d(2 ln(2))/pk1e the data structure has the following properties: The query operation uses at most H evaluations of hash functions from H, expected L distance computations, and O(Lk) other word-RAM operations. The data structure uses O(nL) words of space in addition to the space required to store the data and H hash functions from H. Compared to the Indyk-Motwani framework we have reduced the number of locality-sensitive hash functions H from O(k(1/p1)k) to O(k2/p1) at the cost of using twice as many lookups. To reduce the number of lookups further we can decrease ε and perform several independent repetitions. This comes at the cost of an increase in the number of hash functions H. XX:10 Fast Locality-Sensitive Hashing Frameworks for Approximate Near Neighbor Search 4 Reducing the word-RAM complexity One drawback of the DKT framework is that each hash value gl(x) still takes O(k) word- RAM operations to compute, even after the underlying locality-sensitive hash functions are known. This results in a bound on the total number of additional word-RAM operations of O(Lk). We show how to combine the DKT universal hashing technique with the AI tensoring technique to ensure that the running time is dominated by O(L) distance computations and O(H) hash function evaluations. The idea is to use the DKT scheme to construct two collections of respectively L1 and L2 hash functions, and then to use the AI tensoring approach to form g1, . . . , gL as the L = L1 × L2 combinations of functions from the two collections. The number of lookups can be reduced by applying tensoring several times in independent repetitions, but for the sake of simplicity we use a single repetition. For the usual setting of k = dlog(n)/ log(1/p2)e let k1 = dk/2e and k2 = bk/2c. Set L1 = d6(1/p1)k1e and L2 = d6(1/p1)k2e. According to Lemma 10 if we set ε = 1/6 the success probability of each collection is at least 3/4 and by a union bound the probability that either collection fails to contain a colliding hash function is at most 1/2. This concludes the proof of our main Theorem 5. 4.1 Sketching The theorems of the previous section made no assumptions on the word-RAM complexity of distance computations and instead stated the number of distance computations as part of the query complexity. We can use a (r1, r2, p1, p2)-sensitive family H to create sketches that allows us to efficiently approximate the distance between pairs of points, provided that the gap between p1 and p2 is sufficiently large. In this section we will re-state the results of Theorem 5 when applying the family H to create sketches using the 1-bit sketching scheme of Li and König [26]. Let b be a positive integer denoting the length of the sketches in bits. The advantage of this scheme is that we can use word level parallelism to evaluate a sketch of b bits in time O(b/ log n) in our word-RAM model with word length Θ(log n). For i = 1, . . . , b let hi : X → R denote a randomly sampled locality-sensitive hash function from H and let fi : R → {0, 1} denote a randomly sampled universal hash function. We let s(x) ∈ {0, 1}b denote the sketch of a point x ∈ X where we set the ith bit of the sketch s(x)i = fi(h(x)). For two points x, y ∈ X the probability that they agree on the ith bit is 1 if the points collide under hi and 1/2 otherwise. Pr[s(x)i = s(y)i] = Pr[hi(x) = hi(y)]+(1−Pr[hi(x) = hi(y)])/2 = (1+Pr[hi(x) = hi(y)])/2. We will apply these sketches during our query procedure instead of direct distance compu- tations when searching through the points in the L buckets, comparing them to our query point q. Let λ ∈ (0, 1) be a parameter that will determine whether we report a point or not. For sketches of length b we will return a point x if ks(q) − s(x)k1 > λb. An application of Hoeffiding's inequality gives us the following properties of the sketch: (cid:73) Lemma 12. Let H be a (r1, r2, p1, p2)-sensitive family and let λ = (1 + p2)/2 + (p1 − p2)/4, then for sketches of length b ≥ 1 and for every pair points x, y ∈ X: If dist(x, y) ≤ r1 then Pr[ks(x) − s(y)k1 ≤ λb] ≤ eb(p1−p2)2/8. If dist(x, y) ≥ r2 then Pr[ks(x) − s(y)k1 > λb] ≤ eb(p1−p2)2/8. If we replace the exact distance computations with sketches we want to avoid two events: Failing to report a point with dist(q, x) ≤ r1 and reporting a point x with dist(q, x) ≥ r2. T. Christiani XX:11 Figure 2 The number of locality-sensitive hash functions from a (r1, r2, 0.9, p2)-sensitive family used by different frameworks to solve the (r1, r2)-near neighbor problem on a collection of 230 points. By setting b = O(ln(n)/(p1 − p2)2) and applying a union bound over the n events that the sketch fails for a point in our collection P we obtain Theorem 6. The number of hash functions in corner cases 5 When the collision probabilities of the (r1, r2, p1, p2)-sensitive family H are close to one we get the behavior displayed in Figure 2 where we have set p1 = 0.9. Here it may be possible to reduce the number of hash functions by applying the DKT framework to the family Hτ for some positive integer τ. That is, instead of applying the DKT technique directly to H we first apply the powering trick to produce the family Hτ. The number of locality-sensitive hash functions from H used by the DKT framework is given by H = O((log(n)/ log(1/p2))2/p1). If we instead use the family Hτ the expression becomes H = O(τ(log(n)/ log(1/pτ2))2/pτ1) = O((log(n)/ log(1/p2))2/τ pτ1). Ignoring integer constraints, the value of τ that maximizes τ pτ1, thereby minimizing H, is given by τ = 1/ ln(1/p1). Discretizing, the resulting number of hash functions when setting τ = d1/ ln(1/p1)e is given by H = O(ρ(log n)2/(p1 log(1/p2))). For constant ρ and large p2 this reduces the number of hash functions by a factor 1/ log(1/p2). The behavior for small values of p1 is displayed in Figure 3 where we have set p1 = 0.1. 6 Conclusion and open problems We have shown that there exists a simple and general framework for solving the (r1, r2)- near neighbor problem using only few locality-sensitive hash functions and with a reduced word-RAM complexity matching the number of lookups. The analysis in this paper indicates that the performance of the Dahlgaard-Knudsen-Thorup framework is highly competitive compared to the Indyk-Motwani framework in practice, especially when locality-sensitive hash functions are expensive to evaluate, as is often the case. An obvious open problem is the question of whether the number of locality-sensitive hash functions can be reduced even below O(k2/p1). Another possible direction for future research 1020300.000.250.500.751.00p2p1log2HIMAIDKT XX:12 Fast Locality-Sensitive Hashing Frameworks for Approximate Near Neighbor Search Figure 3 The number of locality-sensitive hash functions from a (r1, r2, 0.1, p2)-sensitive family used by different frameworks to solve the (r1, r2)-near neighbor problem on a collection of 230 points. would be to obtain similar framework results in the context of solutions to the (r1, r2)-near neighbor problem that allow for space-time tradeoffs [5, 12]. Acknowledgements. I want to thank Rasmus Pagh commenting on an earlier version of this manuscript and for making me aware of the application of the tensoring technique in [31] that led me to the Andoni-Indyk framework [1]. Inequalities A We make use of the following standard inequalities for the exponential function. See [27, Chapter 3.6.2] for more details. (cid:73) Lemma 13. Let n, t ∈ R such that n ≥ 1 and t ≤ n then e−t(1−t2/n) ≤ (1−t/n)n ≤ e−t. (cid:73) Lemma 14. For t ≥ 0 we have that e−t ≤ 1 − t + t2/2. We make use of a one-sided version of Chebyshev's inequality to show correctness of the Dahlgaard-Knudsen-Thorup LSH framework. (cid:73) Lemma 15 (Cantelli's inequality). Let Z be a random variable with E[Z] = µ > 0 and Var[Z] = σ2 < ∞ then Pr[Z ≤ 0] ≤ σ2/(µ2 + σ2). Proof. For every s ∈ R we have that Pr[Z ≤ 0] = Pr[−(Z − µ) + s ≥ µ + s] ≤ Pr[(−(Z − µ) + s)2 ≥ (µ + s)2]. Next we apply Markov's inequality Pr[(−(Z − µ) + s)2 ≥ (µ + s)2] ≤ E[(−(Z − µ) + s)2]/(µ + s)2 = (σ2 + s2)/(µ + s)2 Set s = σ2/µ and use that σ2 = sµ to simplify (σ2 + s2)/(µ + s)2 = (sµ + s2)/(µ + s)2 = σ2/(µ2 + σ2). 10152025300.000.250.500.751.00p2p1log2HIMAIDKT T. Christiani XX:13 (cid:74) To analyze the 1-bit sketching scheme by Li and König we make use of Hoeffding's inequality: (cid:73) Lemma 16 (Hoeffding [23, Theorem 1]). Let X1, X2, . . . , Xn be independent random variables satisfying 0 ≤ Xi ≤ 1 for i ∈ [n]. Define ¯X = (X1 + X2 + ··· + Xn)/n and µ = E[ ¯X], then: - For 0 < ε < 1 − µ we have that Pr[ ¯X − µ ≥ ε] ≤ e−2nε2. - For 0 < ε < µ we have that Pr[ ¯X − µ ≤ −ε] ≤ e−2nε2. Analysis of the Andoni-Indyk framework B Let ϕ denote the probability that a pair of points x, y with dist(x, y) ≤ r1 collide in a single repetition of the scheme. A collision occurs if and only if there there exists at least one hash function in each of the underlying t + 1 collections where the points collide. It follows that ϕ = (1 − (1 − pk1 1 )m1)t(1 − (1 − pk2 1 )m 2 ). To guarantee a collision with probability at least 1/2 it suffices to set η = dln(2)/ϕe. We will proceed by analyzing this scheme where we let t ≥ 1 be variable and set parameters as followers: k = dlog(n)/ log(1/p2)e k1 = bk/tc k2 = k − tk1 1 e m1 = d1/tpk1 m2 = d1/pk2 1 e η = dln(2)/ϕe. To upper bound L we begin by lower bounding ϕ. The second part of ϕ can be lower bounded 1 )m2) ≥ 1 − 1/e. To lower bound (1 − (1 − pk1 using Lemma 13 to yield (1 − (1 − pk2 1 )m1)t we first note that in the case where pk1 1 > 1/t we have m1 = 1 and the expression can be lower 1 m1)t ≥ (pk1 bounded by pk1t 1 m1)t/2e. The same lower bound holds in the case there 1 ≤ 1/t and t ≥ 2 we make use of Lemma 13 and 14 to derive the t = 1. In the case where pk1 lower bound. 1 = (pk1 1 − (1 − pk1 1 1 )m1 ≥ 1 − e−pk1m1 ≥ 1 − (1 − pk1 ≥ pk1 ≥ pk1 1 m1(1 − 1/t))t ≥ (pk1 1 m1(1 − pk1 1 m1(1 − 1/t). 1 m1 + (pk1 1 (1/tpk1 1 m1)2/2) 1 + 1)/2) Using the bound (pk1 1 m1)t/2e we have that ϕ ≥ (pk1 1 m1)t/4e ≥ (1/t)t/4e. We can then bound the number of lookups and the expected number of distance computations L = ηmt 1m2 ≤ (4e/(pk1 1 m1)t + 1)mt 1(1/pk2 1 + 1) ≤ 16e(1/pk 1). XX:14 Fast Locality-Sensitive Hashing Frameworks for Approximate Near Neighbor Search Note that this matches the upper bound of the Indyk-Motwani LSH framework up to a constant factor. To bound the number of hash functions from H we use that k1 ≤ k/t ≤ k and k2 < t. ! . + t − 1 pt−1 1 k tpk/t 1 H = η(m1k1t + m2k2) ≤ 8ett References 1 A. Andoni and P. Indyk. Efficient algorithms for substring near neighbor problem. In Proc. SODA '06, pages 1203–1212, 2006. 2 A. Andoni and P. Indyk. Near-optimal hashing algorithms for approximate nearest neighbor in high dimensions. In Proc. FOCS '06, pages 459–468, 2006. 3 A. Andoni and P. Indyk. Near-optimal hashing algorithms for approximate nearest neighbor in high dimensions. Commun. ACM, 51(1):117–122, 2008. 4 A. Andoni, P. Indyk, T. Laarhoven, I. Razenshteyn, and L. Schmidt. Practical and optimal lsh for angular distance. In Proc. NIPS '15, pages 1225–1233, 2015. 5 A. Andoni, T. Laarhoven, I. P. Razenshteyn, and E. Waingarten. Optimal hashing-based In Proc. SODA '17, pages 47–66, time-space trade-offs for approximate near neighbors. 2017. 6 A. Becker, L. Ducas, N. Gama, and T. Laarhoven. New directions in nearest neighbor searching with applications to lattice sieving. In Proc. SODA '16, pages 10–24, 2016. 7 Andrei Z. Broder, Moses Charikar, Alan M. Frieze, and Michael Mitzenmacher. Min-wise independent permutations. J. Comput. Syst. Sci., 60(3):630–659, 2000. J. L. Carter and M. N. Wegman. Universal classes of hash functions. In Proc. STOC '77, pages 106–112, 1977. J. L. Carter and M. N. Wegman. Universal classes of hash functions. J. Comput. Syst. Sci., 18(2):143–154, 1979. J. L. Carter and M. N. Wegman. New hash functions and their use in authentication and set equality. J. Comput. System Sci., 22(3):265–279, 1981. 8 9 10 11 M. Charikar. Similarity estimation techniques from rounding algorithms. In Proc. STOC '02, pages 380–388, 2002. 12 T. Christiani. A framework for similarity search with space-time tradeoffs using locality- sensitive filtering. In Proc. SODA '17, pages 31–46, 2017. 14 13 T. Christiani, R. Pagh, and J. Sivertsen. Scalable and robust set similarity join. CoRR, abs/1707.06814, 2017. S. Dahlgaard, M. B. T. Knudsen, and M. Thorup. Fast similarity sketching. CoRR, abs/1704.04370, 2017. URL: http://arxiv.org/abs/1704.04370. 15 A. Dasgupta, R. Kumar, and T. Sarlós. Fast locality-sensitive hashing. In Proc. SIGKDD '11, pages 1073–1081, 2011. 16 M. Datar, N. Immorlica, P. Indyk, and V. S. Mirrokni. Locality-sensitive hashing scheme based on p-stable distributions. In Proc. SOCG '04, pages 253–262, 2004. 17 M. Dubiner. Bucketing coding and information theory for the statistical high-dimensional nearest-neighbor problem. IEEE Trans. Information Theory, 56(8):4166–4179, 2010. 18 K. Eshghi and S. Rajaram. Locality sensitive hash functions based on concomitant rank order statistics. In Proc. KDD '08, pages 221–229, 2008. 19 M. L. Fredman, J. Komlós, and E. Szemerédi. Storing a sparse table with 0(1) worst case access time. J. ACM, 31(3):538–544, 1984. 20 Y. Gong, S. Kumar, V. Verma, and S. Lazebnik. Angular quantization-based binary codes for fast similarity search. In NIPS, pages 1205–1213, 2012. T. Christiani XX:15 22 24 26 21 T. Hagerup. Sorting and searching on the word RAM. In Proc. STACS '98, pages 366–398, 1998. S. Har-Peled, P. Indyk, and R. Motwani. Approximate nearest neighbor: Towards removing the curse of dimensionality. Theory of computing, 8(1):321–350, 2012. 23 W. Hoeffding. Probability inequalities for sums of bounded random variables. Jour. Am. Stat. Assoc., 58(301):13–30, 1963. P. Indyk and R. Motwani. Approximate nearest neighbors: towards removing the curse of dimensionality. In Proc. STOC '98, pages 604–613, 1998. 25 C. Kennedy and R. Ward. Fast cross-polytope locality-sensitive hashing. In Proc. ITCS '17, pages 53:1–53:16, 2017. P. Li and A. C. König. Theory and applications of b-bit minwise hashing. Communications of the ACM, 54(8):101–109, 2011. 27 Dragoslav S Mitrinović. Analytic inequalities. Springer-Verlag, Berlin, New York, 1970. 28 M. H. Overmars and J. van Leeuwen. Worst-case optimal insertion and deletion methods for decomposable searching problems. Information Processing Letters, 12(4):168–173, 1981. 29 A. Shrivastava. Simple and efficient weighted minwise hashing. In NIPS, pages 1498–1506, 2016. 30 A. Shrivastava. Optimal densification for fast and accurate minwise hashing. In ICML, volume 70 of Proceedings of Machine Learning Research, pages 3154–3163. PMLR, 2017. 31 N. Sundaram, A. Turmukhametova, N. Satish, T. Mostak, P. Indyk, S. Madden, and P. Dubey. Streaming similarity search over one billion tweets using parallel locality-sensitive hashing. PVLDB, 6(14):1930–1941, 2013. 32 K. Terasawa and Y. Tanaka. Spherical LSH for approximate nearest neighbor search on unit hypersphere. In Proc. WADS '07, pages 27–38, 2007. J. Wang, H. T. Shen, J. Song, and J. Ji. Hashing for similarity search: A survey. CoRR, abs/1408.2927, 2014. URL: http://arxiv.org/abs/1408.2927. 34 Y. Weiss, A. Torralba, and R. Fergus. Spectral hashing. In NIPS, pages 1753–1760. Curran 33 35 Albert L Zobrist. A new hashing method with application for game playing. ICCA journal, Associates, Inc., 2008. 13(2):69–73, 1970.
1801.00776
4
1801
2018-12-01T23:06:06
Sorting Real Numbers in $O(n\sqrt{\log n})$ Time and Linear Space
[ "cs.DS" ]
We present an $O(n\sqrt{\log n})$ time and linear space algorithm for sorting real numbers. This breaks the long time illusion that real numbers have to be sorted by comparison sorting and take $\Omega (n\log n)$ time to be sorted.
cs.DS
cs
Sort Real Numbers in O(n√log n) Time and Linear Space Yijie Han School of Computing and Engineering University of Missouri at Kansas City Kansas City, Missouri 64110 [email protected] Abstract We present an O(n√log n) time and linear space algorithm for sorting real numbers. This breaks the long time illusion that real numbers have to be sorted by comparison sorting and take Ω(n log n) time to be sorted. Keywords: Analysis of algorithms, sorting, comparison sorting, integer sorting, sort real numbers. 1 Introduction Sorting is a fundamental problem in computer science and is used almost everywhere in programming. Currently sorting can be classified as comparison sorting and integer sorting. It is well known that comparison sorting has θ(n log n) time [4] (logarithms in this paper have base 2). Integer sorting, on the other hand, is currently known to have time O(n log log n) and linear space [7, 8]. This bound is for conservative integer sorting [12], i.e. the word size is log(m + n) bits if we are to sort n integers in {0, 1, ..., m}. Nonconservative integer sorting, where word size can be larger than Ω(log(m + n)) bits, can sort integers faster. Kirkpatrick and Reisch [12] show that when word size is O(m + n) bits integers can be sorted in linear time. We have shown [10, 11] that when word size is O(log n log(m + n)) bits integers can be sorted in linear time. It has been a long time illusion that real numbers cannot be sorted by integer sorting and they have to be sorted by comparison sorting. All papers known to us before this paper cite sorting real numbers with Ω(n log n) time complexity. In particular many problems in computational geometry has upper or lower bounds of O(n log n) time because of the lower bounds of Ω(n log n) time of sorting n points on plane or in space. In 2011 we submitted a proposal titled "Integer sorting and integer related computation" to NSF and in this proposal we wrote "Now is probably the right time to investigate the relation between integer based algorithms and real-value based algorithms and to study if it is possible to convert a real-value based algorithm to an integer based algorithm and if it is possible how to design an algorithm to convert it. At the best possible situation we expect 1 that such conversion will not bring time loss and thus linear time algorithm for conversion is sought. Such research will bring many surprising results. For example, lower bounds for many problem are derived based on the lower bounds for comparison sorting. Thus if real- value based sorting can be converted to integer based sorting then these lower bounds derived before cannot hold." [5]. In 2012 we submitted a proposal titled "Serial and Parallel Sorting Algorithms with Applications" to NSF and in this proposal in addition we wrote "Note that real values need not necessarily to be sorted by comparison sorting. The Ω(n log n) lower bound for sorting is for comparison based sorting. It may be possible that real values can be sorted by non-comparison based sorting methods." [6]. These are the earliest records we can trace for the formation of our thoughts of sorting real numbers using a non-comparison based sorting algorithm. In this paper we show that for sorting purpose, real numbers can be converted to integers in O(n√log n) time and thereafter be sorted with a conservative integer sorting algorithm in O(n log log n) time [7, 8] or with a nonconservative integer sorting algorithm in O(n) time [10, 11, 12]. This result is fundamental as it breaks the illusion that real numbers have to be sorted by comparison sorting. This result will also enable many problems depending on sorting real numbers to be reformulated or their complexity reevaluated. Besides, problems such as hashing for real numbers, storing real numbers, comparison for real numbers, etc., needs to be studied or restudied. We use an extended RAM [1] model for our computation. The model of computation we used here is the same model used in computational geometry. As in many cases of algorithms in computational geometry where assumptions are made that a variable can hold a real value, our model of computation also assumes this. Addition, subtraction, multiplication, division, indexing and shift take constant time. The shift operation in our algorithm is always has the form of 1 ← i and therefore can be replaced by the power operation of 2i. We also assume that the floor ⌊ ⌋ and ceiling ⌈ ⌉ for a real value can be computed in constant time, these comes from the cast operation (which is the floor operation) that cast a real value to an integer. These assumptions are assumed in the computational geometry. We assume that a variable v holding a real value has arbitrary precision. We assume that each variable v can hold an integer of finite and arbitrary number of bits. All these assumptions are natural and assumed in computational geometry. We may assume that for a nonnegative integer m, exp(m) = min{2i2i ≥ m} can be computed in constant time. This is can be achieved as in floating point normalization and then taking the exponent, i.e. to normalize 1/m and then taking the exponent. This assumption is for convenience only and not a must in our algorithm. We will call this 2 assumption the normalization assumption. We will show how our algorithm will work with and without normalization assumption. 2 Converting Real Numbers to Integers for the Sorting Purpose We assume that input real numbers are all positive as we can add a number to every one of them to make them positive. We then scale them such that every number has value in (0, 1) as this can be done by divide each number by a large number. These operations do not affect the relative order of the numbers. For two real numbers 1 > m1 > m2 > 0, we need to have an integer L(m1, m2) such that ⌊m1L(m1, m2)⌋ 6= ⌊m2L(m1, m2)⌋. With the normalization assumption we will let L(m1, m2) = 2exp(⌊1/m1 − m2⌋). Without the normalization assumption we will let L(m1, m2) = 2⌊1/m1−m2⌋. We had attemptted to use L(m1, m2) = ⌈1/m1 − m2⌉ but it did not work out, as for two integers A > A′ > 0 (A and A′ are obtained as ⌈1/a − b⌉) we may have that ⌊Am1⌋ = ⌊Am2⌋ and ⌊A′m1⌋ 6= ⌊A′m2⌋. Let integer f = 2i be a factor (similar to L(m1, m2)). For m distinct integers and an integer a in them represents the approximation of a real value r(a) such that a = ⌊r(a)f⌋. We place these m integers in an array I of size 2i with integer a placed in ⌊r(a)f⌋. Since 1 > r(a) > 0 and therefore 0 ≤ ⌊r(a)f⌋ < 2i. Then for a real number r1 we can check whether ⌊r1f⌋ is occupied by one of these m integers. If ⌊r1f⌋ is vacant then we can use integer a1 = ⌊r1f⌋ to represent r1 = r(a1) and now we have m + 1 distinct integers. This can proceed until we find that ⌊r1f⌋ is occupied. When ⌊r1f⌋ is occupied by integer a then we compare r1 and r(a) and if they are equal then we can take r1 out of our sorting algorithm. Thus we assume that they are not equal. We can then get f1 = L(r1, r(a)). This means ⌊r1f1⌋ 6= ⌊r(a)f1⌋. If we then represent r1 by ⌊r1f1⌋ and represent r(a) by ⌊r(a)f1⌋ then we can distinguish between r1 and r(a) for the sorting purpose. The problem is that now f1 > f . Thus to test out next real number r2 we have to test out both ⌊r2f⌋ and ⌊r2f1⌋. We say that we are testing at two different levels, level f and level f1. As we proceed, the number of levels will increase and we have to maintain the complexity for testing to within o(n log n) time. The two levels we have to test now are denoted by level f and level f1. If there are l levels we need to test we will have these l levels sorted and maintained in a stack S. Table I will splits into l tables with one table Il′ maintained for the integers at level 3 Figure 1: Real numbers are inserted according to Algorithm Insert. Circled position has no number inserted. Dotted position has integer and/or real number inserted. Real numbers are inserted at leaves. l′. If for two real numbers r1 and r2 we have that ⌊r1l′⌋ = ⌊r2l′⌋ then we keep only one copy of them in Il′. Thus for l levels there are l tables. For example, if we maintain levels 0, 25, 210, 250, 2100, 2300, then there are 6 tables and S[0] = 0, S[1] = 25, S[2] = 210, S[3] = 250, S[4] = 2100, S[5] = 2300. We use variable top to store the index of the topmost element in S. At any moment the real numbers we have examined are inserted into Il tables and they form a tree T as shown in Fig. 1. Note that, for a real number r, if l1 < l2 are two of the levels we maintain in T . Then if Il2[⌊rl2⌋] is not vacant (occupied) then Il1[⌊rl1⌋] must be not vacant (occupied). We call this the transitivity property. Note that in the first version of our algorithm presented here the transitivity proper is not kept throughout our algorithm, but we will assume that it is kept. If the transitivity property is ketp then in Fig. 1. every circled position as well as every dotted position will have an integer inserted. We will show later how to modify our algorithm so that the transitivity property is virtually kept. If we use virtual transitivity then in Fig. 1. only dotted positions have integer and/or real numbers inserted and circled positions have no integers inserted. To satisfy the virtual transitivity, for every node a (an internal node or a leaf, i.e. a dotted node in Fig. 1.), the following condition must be satisfied: Let i(a) be the index of the level where a lies in T , i.e., a is at level S[i(a)]. Let l(a) be any real number at a leaf of a in T . for(levelindex = 0; levelindex <= ⌊log top⌋; levelindex ++) { 4 if(i(a) mod 2levelindex == 0 && i(a) mod 2levelindex+1 ! = 0) { i(a) = i(a) − 2levelindex; ⌊l(a)S[i(a)]⌋ must be a node in T ; } } For two positive real numbers 0 < r1, r2 < 1, we will say r1 and r2 match at level l if ⌊r1l⌋ = ⌊r2l⌋. Let LS(r1, r2) = max{ll ∈ S (i.e. there is an i ≤ top such that l = S[i]) and r1 and r2 match at level l }. Let LmaxS(r) = max{LS(r, a)a is a previous input real number (i.e. a has already been inserted into Il tables) }. The real number a that achieves LmaxS(r) is denoted by match(r), i.e. LmaxS(r) = LS(r, match(r)). For the next real number r′ we will search on S as follows: Alorithm Match(r′) Input: r′ is the next input real number to be inserted into Il tables. Output: r0 and L. r0 is match(r′) and L = LS(r0, r′). Let S[top] be the topmost element in S. levelindex = 0; for(i = ⌊log top⌋; i >= 0; i −−) //⌊log top⌋ is computed in O(log top) time. { if(levelindex + 2i <= top && ⌊r′S[leveindex + 2i]⌋ is a node in T (i.e. IS[levelindex+2i][⌊r′S[levelindex + 2i]⌋] is occupied.)) { levelindex = levelindex + 2i; } i = i − 1; } L = S[levelindex], r0 is a real number matched r′ at level S[levelindex]; Thus in O(log top) time we will either find a vacant position at the smallest level S[levelindex+ 1] for r′ (i.e. IS[levelindex+1][⌊r′S[levelindex + 1]⌋] is vacant; or we will find that r′ matches a real number at S[top] and in this case we need add a new level onto S. We will insert r′ into Il tables as follows: 5 Algorithm Insert(r0, r′) Input: r′ is the next input real number to be inserted into Il tables. r0 is match(r′). Let S[top] be the topmost element in S. if(LS(r0, r′) == S[top]) push L(r0, r′) onto S; Insert r0 and r′ at level S[S−1[LS(r0, r′)] + 1] in T ; levelindex = S−1[LS(r0, r′)] + 1; for(i = 0; i <= ⌊log top⌋; i ++) { if(levelindex mod 2i == 0 && levelindex mod 2i+1 ! = 0) { Insert r0 and r′ into IS[levelindex−2i] if it is not inserted there before (could be there before because r0 was in the Il tables), that is: insert ⌊r′S[levelindex− 2i]⌋ into table IS[levelindex−2i] if it was not there. //At most one integer is inserted. levelindex = levelindex − 2i; } } if(⌊r0LS(r0, r′)⌋ is not in T ) //Make the virtual transitivity structure for the internal node ⌊r0LS(r0, r′)⌋ { Insert ⌊r0LS(r0, r′)⌋ into T ; levelindex = S−1[LS(r0, r′)]; for(i = 0; i <= ⌊log top⌋; i ++) { if(levelindex mod 2i == 0 && levelindex mod 2i+1 ! = 0) { Insert r0 into IS[levelindex−2i] if it is not inserted there before (could be there before because r0 was in the Il tables), that is: insert ⌊r0S[levelindex−2i]⌋ into table IS[levelindex−2i] if it was not there. levelindex = levelindex − 2i; } } } The description of our algorithm so far will allow us to convert real numbers to integers for sorting purpose. However, the number of levels stored in S and T could go to O(n) and 6 thus it will take O(n log n) time to convert n real numbers to integers. What we will do is to merger multiple levels into one level and therefore eliminate many levels in S. To merge levels S[l], S[l + 1], ..., S[top] (we only merge the topmost levels in S to one level) into level L = S[top], we will, for any non-vacant position in Il′[a] for l′ = S[l], S[l + 1], ..., S[top], place r(a) in IS[top]. We then pop off S[top], S[top − 1], ..., S[l] off stack S and then push L onto stack S. The value of top is now equal to l. Tables IS[l], IS[l+1], ..., IS[top−1] will be deleted. This takes time O((Ptop i=l ni)), where ni is the number of occupied positions in IS[i]. We will insert the n input real numbers r0, r1, ..., rn−1 (scaled to within (0, 1)) one after another into the I tables. Let e = 2√log n. After we inserted r0, r1, ..., re−1 we will merge all levels (call these levels level l0,0, l0,1, ..., l0,e−1) created to the largest level (call it level l1,0). After re, re+1, ..., r2e−1 are inserted we will merger all levels larger than l1,0 (call these levels l0,e, l0,e+1, ..., l0,2e−1) to the current largest level l1,1. Note that some of re, re+1, ..., r2e−1 may have been inserted into level l1,0 and not inserted into tables in larger levels and therefore they will not be merged to level l1,1. After we inserted r2e, r2e+1, ..., r3e−1 we will merge all levels larger than l1,1 to the current largest level l1,2. Thus after we inserted re2−e, re2−e+1, ..., re2−1 we will have at most e levels l1,0, l1,1..., l1,e−1. At this moment we merge all levels to the largest level and call it level l2,0. We repeat this loop and thus after we inserted r2e2−1 we can get another level l2,1. After we inserted re3−1 we can have e levels l2,0, l2,1, ..., l2,e−1 and we will merge all these levels to the largest level and call it level l3,0, and so on. The procedure is: Algorithm Merge for(i(log n/ log e)−1 = 0; i(log n/ log e)−1 < e; i(log n/ log e)−1 ++) { for(i(log n/ log e)−2 = 0; i(log n/ log e)−2 < e; i(log n/ log e)−2 ++) { ... ... ... ... for(i2 = 0; i2 < e; i2 ++) { for(i1 = 0; i1 < e; i1 ++) { for(i0 = 0; i0 < e; i0 ++) { 7 ekik)+i0 into I tables. Insert r(P(log n/ log e)−1 k=1 k=1 k=1 ..., k=1 ekik)+e−1 ekik)+1, } Merge levels l0,(P(log n/ log e)−1 l0,(P(log n/ log e)−1 l0,(P(log n/ log e)−1 into level l1,(P(log n/ log e)−1 } Merge levels l1,(P(log n/ log e)−1 l1,(P(log n/ log e)−1 l1,(P(log n/ log e)−1 into level l2,(P(log n/ log e)−1 ek−1ik)+1, ek−1ik)+e−1 ..., k=2 k=2 k=2 k=2 k=3 ek−2ik)+i2 ; ekik), ek−1ik)+i1 ; ek−1ik), } ... ... ... ... k=(log n/ log e)−2 ek−(log n/ log e)+3ik), k=(log n/ log e)−2 ek−(log n/ log e)+3ik)+1, ..., Merge levels l(log n/ log e)−3,(P(log n/ log e)−1 l(log n/ log e)−3,(P(log n/ log e)−1 l(log n/ log e)−3,(P(log n/ log e)−1 into level l(log n/ log e)−2,(P(log n/ log e)−1 k=(log n/ log e)−2 ek−(log n/ log e)+3ik)+e−1 } Merge levels l(log n/ log e)−2,(P(log n/ log e)−1 l(log n/ log e)−2,(P(log n/ log e)−1 l(log n/ log e)−2,(P(log n/ log e)−1 into level l(log n/ log e)−1,i(log n/ log e)−1; k=(log n/ log e)−1 ..., k=(log n/ log e)−1 ek−(log n/ log e)+2ik)+1, ek−(log n/ log e)+2ik)+e−1 k=(log n/ log e)−1 ek−(log n/ log e)+2ik), k=(log n/ log e)−1 ek−(log n/ log e)+2ik)+i(log n/ log e)−2 ; } Merge levels l(log n/ log e)−1,0, l(log n/ log e)−1,1, ..., l(log n/ log e)−1,e−1 into one level llog n/ log e,0; The loop indexed by i0 takes O(n log top) time. After we inserted rie−1 for i = 1, 2, ..., we will merge levels l0,(i−1)e, l0,(i−1)e+1, ..., l0,ie−1. Assume (we made an assumption here) that it takes constant time to merge each real number in I0,(i−1)e+j, 0 ≤ j < e, to level l0,ie−1. Thus the time for the loop indexed by i1 excluding the time for the loop indexed by i0 is 8 O(n). After we inserted rie2−1 for i = 1, 2, ..., we will merge levels l1,(i−1)e, l1,(i−1)e+1, ..., l1,ie−1 which takes O(e2) time (by our assumption). Thus the time for the loop indexed by i2 excluding the time for the loops indexed by i1 and i0 is O(n). In general, after we inserted riej−1 for i = 1, 2, ... and j = 1, 2, ..., we will merge levels lj−1,(i−1)e, lj−1,(i−1)e+1, ..., rj−1,ie−1 in time O(ej) (by our assumption). Thus the time for the loop indexed by ij excluding the time for the loops indexed by i0, i1, i2, ..., ij−1 is O(n). The last line of the algorithm that is outside all loops takes time O(n) (by our assumption). There are (log n/ log e) = √log n loops. The overall time for the algorithm is O(n log n/ log e+ n log top) (by our assumption). Because there are log n/ log e loops and each outstanding loop has at most e levels, thus at any time the number of levels maintained in S is O(e log n/ log e) and thus log top = O(log e + log log n − log log e) = O(√log n). After we inserted all real numbers we will merge all levels in T to the largest level. 3 Keep the Virtual Transitivity Property and Make Our Algorithm Run in O(n√log n) Time The virtual transitivity is kept by Algorithm Insert. Fig. 1. shows the structure of the tree T when virtual transitivity is kept (with circled positions have no integers inserted). As if a real number is inserted at a leaf node f in T , at most log top ancestors of f will exist in T by Algorithm Insert. This structure allows us to insert the next real number into T in O(log top) time. Note that if we never merge the topmost levels into the topmost level, our algorithm Match and Insert will work in O(log top) time. But if we do not merge levels, top will go to O(n). This will make our algorithm to run in O(n log n) time. The problem that merging levels brings is shown in this example. Suppose r0 and r1 matched at level S[2i] for some integer i and they do not match at level S[2i + 1], if next we merge levels S[2i − 1], S[2i], ...S[top] into one level S[2i − 1] (it value is now equal to S[top]), then we need to insert r0 and r1 into tables at levels S[2i−1], S[2i−1 + 2i−2], S[2i−1 + 2i−2 + 2i−3], ..., S[2i−1 + 2i−2 + 2i−3 + ... + 1]. That is to say, in order to merge levels for two numbers r0 and r1 we need possibly spend O(√log n) time instead of constant time when 2O(√log n) levels are maintained. Also suppose r0 and r1 match at level S[2i+2i−1+2i−2+...+2] and does not match at level S[2i + 2i−1 + 2i−2 + ... + 2 + 1] and if we merge levels S[2i + 1], S[2i + 2], ..., S[top] into one level 9 S[2i+1] (thus the value of S[2i+1] will become S[top]) then the insertions of r0 and r1 in tables at levels S[2i + 2i−1], S[2i + 2i−1 + 2i−2], ..., S[2i + 2i−1 + 2i−2... + 2], S[2i + 2i−1 + 2i−2... + 2 + 1] need to be removed. This will also entail O(√log n) time instead of constant time when 2O(√log n) levels are maintained. The O(n√log n) time complexity for Algorithm Merge requires that the operations in the above two paragraphs take constant time. To overcome this problem we will maintain that each internal node of T has at least √log n real numbers at its leaves. For the next input real number r′, we first find r0 = match(r′) (if r0 is not unique we pick anyone of them) and L = LmaxS(r′). If ⌊r0L⌋ is an internal node in T , then we insert r′ at level S[S−1[L] + 1]. Let (S−1[L] + 1)%2i = 0 and (S−1[L] + 1)%2i+1 ! = 0, where % is the integer modulo operation. Then the parent of ⌊r′S[S−1[L] + 1]⌋ in T is ⌊r′S[S−1[L] + 1 − 2i]⌋. If b = ⌊r0L⌋ is a leaf in T then if the set A of real numbers at b (i.e. the real numbers r's such that ⌊rL⌋ = ⌊r0L⌋) satisfying A < 2√log n − 3, then r′ will be added to the set A be a leaf. If A = 2√log n − 3 then we will first add r′ to A and thus A = 2√log n − 2. Then the median m1 of A (m1 has rank √log n − 1 in A) is found. Let M be the multiset of real numbers at b. r′ will not look for matches at levels larger than L. Thus b keeps to of real numbers in A that are equal to m1 (It is a multiset because previously when we add a real number r to A we did not look for real numbers in A that are equal to r.) We get B = (A − M) ∪ {m1}. Then m2 which is the smallest real number in B that is larger than m1 is found. If LS(m1, m2) == S[top] then we will do top = top + 1; S[top] = L(m1, m2). Then we will do: Algorithm Branch(m1, m2, l, B) // S[l] = L m1 and m2 are the two real numbers mentioned above at leaf node ⌊m1S[l]⌋. B = (A − M) ∪ {m1} as mentioned above. levelindex = 0; index = 0; for(i = √log n; i >= 0; i −−) { if(levelindex + 2i <= S−1[LS(m1, m2)] + 1) //LS(m1, m2) is computed in O(√log n) time. { C[index] = levelindex + 2i; index ++; levelindex = levelindex + 2i; 10 } } index −−; foreach(a ∈ B) { M(a) = ⌊aL(m1, m2)⌋; } (SortedI[0..B−1], SortedR[0..B−1])=sort(M(.), B(.)); //Sort real numbers in B by their M(.) values. This is integer sorting and takes linear time [10]. f irst = 0; last = B − 1; index1 = 0; count = A; f laglastindex = f alse; while(SortedR[f irst] < m1 SortedR[last] > m1) //Branch out and make sure that internal node of T has at least √log n real numbers at its leaves. { Add ⌊m1S[C[index1]]⌋ into T if it is not alreay there. while(SortedR[f irst] < m1 && ⌊SortedR[f irst]S[C[index1]]⌋ ! = ⌊m1S[C[index1]]⌋) { count −−; Add ⌊SortedR[f irst]S[C[index1]]⌋ into T if it is not already there. if(count < √log n && f laglastindex == f alse) f laglastindex = true; f irst ++; } while(SortedR[last] > m1 && ⌊SortedR[last]S[C[index1]]⌋ ! = ⌊m1S[C[index1]]⌋) { count −−; Add ⌊SortedR[last]S[C[index1]]⌋ into T if it is not already there. if(count < √log n && f laglastindex == f alse) f laglastindex = true; last −−; } if(f laglastindex == f alse) index1 ++;; } 11 real numbers at f . After running Algorithm Branch, each leaf node in T will have less than Algorithm Branch is used to branch out from a leaf node f when there are 2√log n − 2 2√log n − 2 real numbers and each internal node will have at least √log n real numbers at its leaves. Note that Algorithm Branch converts a leaf node having 2√log n− 2 real numbers to leaf nodes with less than √log n real numbers. Thus Algorithm Branch takes linear time, i.e. O(n) if we do not merging levels. Because each internal node of T has at least √log n real numbers at its leaves and therefore the two problems with merging levels we posted at the beginning of this Section can be readily solved in linear time as we have to make changes to no more than O(√log n) internal nodes in T and S in the operations associated with the two problems we posted. Because each internal node in T has at least √log n real numbers at its leaves and thus the time for adjusting the O(√log n) internal nodes in T is made to be linear time. As we explained in the Section 2 that the overall time for merging levels is O(n√log n). Because there are 2O(√log n) levels in T (or that many elements in S) and therefore for the next real number r to find match(r) takes O(√log n) time. to 2√log n− 3 real numbers. The real numbers within each leaf node of T needs to be sorted Note that after we merged all levels to the largest level each leaf node of T can have up to determine the largest level to which to merge all levels into (i.e. all real numbers can be converted to different integers at this level). This can be done with comparison sorting in O(n log log n) time. Theorem 1: For sorting purpose n real numbers can be converted to n integers in O(n√log n) time. Corollary: n real numbers can be sorted in O(n√log n) time. Proof: First convert these real numbers to integers in O(n√log n) time, then sort these integers with a conservative integer sorting algorithm in O(n log log n) time [7, 8] or with a nonconservative integer sorting algorithm in O(n) time [10, 11, 12]. 4 Sorting in Linear Space The algorithm we presented in previous section uses nonlinear space. To make our algorithm to run in linear space we use the results in [2, 3, 13] to make our algorithm run in linear space: 1. Patra¸scu and Thorup's result [13]. This result allow insertion and membership lookup in an ordered set of n integers to be performed in O(log n/ log w) time and linear space, where 12 w is the word length (i.e. the number of bits in an integer). This says that search and insert an integer into an ordered list of integers can be done in constant time and linear space if w = n1+ǫ. Thus if we enforce that the bits we extracted from a real number is greater than nǫ, i.e. if exp(a) < n then we let b = n and if exp(a) > n then we let b = exp(a) then we can run our algorithm in linear space. The problem of this approach is that this result [13] requires that the floating point number normalization be done in constant time. That is it needs the exp() function to be computed in constant time. Thus if we use [13] then we cannot avoid the exp() operation. Theorem 2: If each real number can use at least w > n1+ǫ bits and floating point normal- ization can be done in constant time then our algorithm can sort real numbers in O(n√log n) time and linear space. Proof: In each level in our algorithm we used indexing and nonlinear space to find whether any integer in this level is equal to the integer to be inserted. Now we can use [13] to do this in linear space and constant time provided w > n1+ǫ and floating point normalization can be done in constant time. 2. Andersson's result [2]. This result allows insertion and membership lookup in an ordered set of n integers to be performed in O(log n/ log w + log log n) time and linear space. This result does not require the exp() operation to be done in constant time. Thus if we enforce that w > nǫ then the insertion and membership lookup can be done in O(log log n) time and linear space and therefore our algorithm can run in O(n√log n log log n) time and linear space. 1. and 2. require that w > nǫ and this can be viewed as a weakness of these methods. The usage of [2] in our algorithm is the same as in Theorem 2 except we do not need the assumption that floating point number need to be normalized in constant time. Theorem 3: If each real number can use at least w > n1+ǫ bits then our algorithm can sort real numbers in O(n√log n log log n) time. 3. Andersson and Thorup's result [3]. This result allows insertion and membership lookup in an ordered set of n integers to be performed in O(qlog n/ log log n) time and linear space. This result does not require the exp() operation to be performed in constant time and it does not require that w > nǫ. This result will make our algorithm run in O(n log n/√log log n) time and linear space. The usage of [3] in our algorithm is the same as in Theorem 2 except we do not need 13 the assumption that w > n1+ǫ and floating point number can be normalized in constant time. Theorem 4: Real numbers can be sorted in O(n log n/√log log n) time and linear space. Note that when we apply 2. or 3. here we can use conservative integer sorting (using word of O(log(m + n) bits to sort n integers in {0, 1, ..., m}) with time O(n log log n) and linear space [7] to replace the nonconservative integer sorting we used before in our algorithm as we can tolerate the factor of log log n in our algorithm when we apply 2. or 3.. 5 Conclusions Although we showed that real numbers need not be sorted by comparison sorting, our real number sorting algorithm is not as fast as our algorithm for integer sorting. But we opened the door for the study of sorting real numbers with a non-comparison based sorting algorithm. Further research may speed up the algorithm for sorting real numbers and/or results in new paradigms, approaches, methods of treating real numbers. References [1] A. V. Aho, J. E. Hopcroft, J. D. Ullman. The Design and Analysis of Computer Algorithms, Addison-Wesley, Reading, MA, 1974. [2] A. Andersson. Faster deterministic sorting and searching in linear space. Proc. 1996 IEEE Int. Conf. on Foundations of Computer Science (FOCS'1996), 135-141. [3] A. Andersson, M. Thorup. Tight(er) worest-case bounds on dynamic searching and priority queues. Proc. 2000 ACM Syposium on Theory of Computing STOC'2000, 335-342. [4] T.H. Corman, C.E. Leiserson, R.L. Rivest, C. Stein. Introduction to Algorithms. Third Edition, The MIT Press. 2009. [5] Y. Han. Integer sorting and integer related computation. Proposal submitted to NSF in 2011. [6] Y. Han. Serial and Parallel Sorting Algorithms with Applications. Proposal submitted to NSF in 2012. 14 [7] Y. Han. Deterministic sorting in O(n log log n) time and linear space. Journal of Algorithms, 50, 96-105(2004). [8] Y. Han. A linear time algorithm for ordered partition. Proc. 2015 [9] Y. Han, H. Koganti. Searching in a sorted linked list. International Frontiers in Algorithmics Workshop (FAW'15), LNCS 9130, 89- 103(2015). [10] Y. Han, X. Shen. Conservative algorithms for parallel and sequential integer sorting. Proc. 1995 International Computing and Combinatorics Conference, Lecture Notes in Computer Science 959, 324-333(August, 1995). [11] Y. Han, X. Shen. Parallel integer sorting is more efficient than parallel comparison sorting on exclusive write PRAMs. Proc. 1999 Tenth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA'99), Baltimore, Maryland, 419-428(January 1999). Also in SIAM J. Comput. 31, 6, 1852-1878(2002). [12] D. Kirkpatrick and S. Reisch. Upper bounds for sorting integers on random access machines. Theoretical Computer Science 28, pp. 263-276(1984). [13] M. Patra¸scu, M. Thorup. Dynamic integer sets with optimal rank, select, and pre- decessor search. Proc. 2014 IEEE Symp. on Foundations of Computer Science, 166- 175(2014). 15
1104.2275
5
1104
2016-05-14T20:49:11
Approximate Tree Decompositions of Planar Graphs in Linear Time
[ "cs.DS" ]
Many algorithms have been developed for NP-hard problems on graphs with small treewidth $k$. For example, all problems that are expressable in linear extended monadic second order can be solved in linear time on graphs of bounded treewidth. It turns out that the bottleneck of many algorithms for NP-hard problems is the computation of a tree decomposition of width $O(k)$. In particular, by the bidimensional theory, there are many linear extended monadic second order problems that can be solved on $n$-vertex planar graphs with treewidth $k$ in a time linear in $n$ and subexponential in $k$ if a tree decomposition of width $O(k)$ can be found in such a time. We present the first algorithm that, on $n$-vertex planar graphs with treewidth $k$, finds a tree decomposition of width $O(k)$ in such a time. In more detail, our algorithm has a running time of $O(n k^2 \log k)$. We show the result as a special case of a result concerning so-called weighted treewidth of weighted graphs.
cs.DS
cs
Approximate Tree Decompositions of Planar Graphs in Linear Time Frank Kammer∗ and Torsten Tholey∗ Institut fur Informatik, Universitat Augsburg, Germany Abstract Many algorithms have been developed for NP-hard problems on graphs with small treewidth k. For example, all problems that are expressible in linear extended monadic second order can be solved in linear time on graphs of bounded treewidth. It turns out that the bottleneck of many algorithms for NP-hard problems is the computation of a tree decomposi- tion of width O(k). In particular, by the bidimensional theory, there are many linear extended monadic second order problems that can be solved on n-vertex planar graphs with treewidth k in a time linear in n and subexponential in k if a tree decomposition of width O(k) can be found in such a time. We present the first algorithm that, on n-vertex planar graphs with treewidth k, finds a tree decomposition of width O(k) in such a time. In more detail, our algorithm has a running time of O(nk2 log k). We show the result as a special case of a result concerning so-called weighted treewidth of weighted graphs. Keywords: (weighted) treewidth, branchwidth, rank-width, planar graph, linear time, bidimensionality. ACM classification: F.2.2; G.2.2 1 Introduction The treewidth, extensively studied by Robertson and Seymour [22], is one of the basic parameters in graph theory. Intuitively, the treewidth measures the similarity of a graph to a tree by means of a so-called tree decomposition. A tree decomposition of width r-defined precisely in the beginning of Section 2- is a decomposition of a graph G into small subgraphs part of a so-called bag such that each bag contains at most r + 1 vertices and such that the bags are connected by a tree-like structure. The treewidth tw(G) of a graph G is the smallest r for which G has a tree decomposition of width r. Often, NP-hard problems are solved on graphs G with small treewidth by the following two steps: First, compute a tree decomposition for G of width r ∈ IN ∗E-mail address: {kammer,tholey}@informatik.uni-augsburg.de 1 and second, solve the problem by using this tree decomposition. Unfortunately, there is a trade-off between the running times of these two steps depending on our choice of r. Very often the first step is the bottleneck. For example, Arnborg, Lagergren and Seese [3] showed that, for all problems expressible in so-called linear extended monadic second order (linear EMSO), the second step runs on n-vertex graphs in a time linear in n. Demaine, Fomin, Hajiaghayi, and Thilikos [8] have shown that, for many so-called bidimensional problems that are also linear EMSO problems, one can find a solution of a size ℓ in a given n-vertex graph-if one exists-in a time linear in n and subexponential in ℓ as follows: First, try to find a tree decomposition for G of width r = c√ℓ for some constant c > 0. One can choose c such that, if the algorithm fails, then there is no solution of size at most ℓ. Otherwise, in a second step, use the tree decomposition obtained to solve the problem by well known algorithms in O(ncr) = O(ncc√ℓ) time for some constant c. Thus, it is very important to support the first step also in such a time. This, even for planar graphs, was not possible by previously known algorithms. Recent results. In the following overview over related results, n denotes the number of vertices and k the treewidth of the graph under consideration. Tree decomposition and treewidth were introduced by Robertson and Seymour [22], which also presented the first algorithm for the computation of the treewidth and a tree decomposition with a running time polynomial in n and exponential in k [23]. There are numerous papers with improved running times, as, e.g., [2, 7, 19, 25]. Here we focus on algorithms with running times either being polynomial in both k and n, or being subquadratic in n. Bodlaender [6] has shown that a tree decomposition can be found in a time linear in n and expo- nential in k. However, the running time of Bodlaender's algorithm is practically infeasible already for very small k. The algorithm achieving the so far small- est approximation ratio of the treewidth among the algorithms with a running time polynomial in n and k is the algorithm of Feige, Hajiaghayi, and Lee [10]. It constructs a tree decomposition of width O(k√log k) thereby improving the bound O(k log k) of Amir [1]. In particular, no algorithms with constant ap- proximation ratios are known that are polynomial in the number of vertices and in the treewidth. One of the so far most efficient practical algorithms with con- stant approximation ratio was presented by Reed in 1992 [21]. His algorithm computes a tree decomposition of width 3k + 2 in O(f (k) · n log n) time for some exponential function f . More precisely, this width is obtained after slight modifications as observed by Bodlaender [5]. Better algorithms are known for the special case of planar graphs. Seymour and Thomas [26] showed that the so-called branchwidth bw(G) and a so-called branch decomposition of width bw(G) for a planar graph G can be computed in O(n2) and O(n4) time, respectively. A minimum branch decomposition of a graph G can be used directly-like a tree decomposition-to support efficient algorithms. For each graph G, its branchwidth bw(G) is closely related to its treewidth tw(G); in detail, bw(G) ≤ tw(G) + 1 ≤ max(3/2 bw(G), 2) [24]. Gu and Tamaki [12] improved the running time to O(n3) for constructing a branch decomposition and thus for finding a tree decomposition of width O(tw(G)). They also showed that one can compute a tree decomposition of width (1.5 + c)tw(G) for a planar graph G in O(n(c+1)/c log n) time for each c ≥ 1 [13]. Recently, Gu and Xu [14] presented an algorithm to compute a constant factor 2 approximation of the treewidth in time O(n log4 n log k). It is open whether deciding tw(G) ≤ k is NP-complete or polynomial time solvable for planar graphs G. Our results. In this paper, a weighted graph (G, c) is a graph G = (V, E) with a weight function c : V → IN (IN = {1, 2, 3, . . .}). Moreover, cmax always denotes the maximum weight over all vertices. In contrast to our conference version [17], we now consider the problem of finding a tree decomposition on weighted planar graphs. Roughly speaking, the weighted treewidth of a weighted graph is defined analogously as the (unweighted) treewidth, but instead of count- ing the vertices of a bag, we sum up the weight of the vertices in the bag. All results shown in this paper for weighted graphs and weighted treewidth can be applied to unweighted graphs and unweighted treewidth by setting c(v) = 1 for all vertices v of G. In Section 6, we compute tree decompositions for ℓ- outerplanar graphs with an algorithm different to Bodlaender's algorithm [4], but we obtain the same time bound and the same treewidth. Our algorithm reduces ℓ-outerplanar graphs to weighted ℓ-outerplanar graphs, where the un- weighted version is 1-outerplanar. Another application of weighted treewidth is that it allows us to triangulate graphs with only a little increase in the weighted treewidth, which improves our approximation ratio by about a factor of 4. Interestingly, the generalization from unweighted to weighted graphs is pos- sible without increasing the asymptotic running time. Moreover, we slightly modify our algorithm in such a way that we can afterwards bound the number of so-called (S, ϕ)-components, which improves the running time by a factor k compared to the running time shown in our conference version. Given a weighted planar graph (G, c) with n vertices and weighted tree- width k, our algorithm computes a tree decomposition for G in time O(n · k2cmax log k) such that the vertices in each bag have a total weight of O(k). This means that, for unweighted graphs with n vertices and treewidth k, we obtain a tree decomposition of width O(k) in O(n · k2 log k) time, which is a better running time than that of Gu and Xu [14] for all n-vertex planar graphs of treewidth k = O(log n). We do not focus on graphs with a larger treewidth since for such graphs it is not clear whether the second step mentioned for solving NP-hard problems can be solved efficiently. Our result can be used to find a solution of size ℓ ∈ IN for many bidimensional graph problems on planar graphs that are expressible in linear EMSO in a time linear in n and subexponential in ℓ. Such problems are, e.g., Minimum Dominating Set, Minimum Maximal Matching, and Minimum Vertex Cover, which all are NP-hard on planar graphs. In contrast to general graphs, on planar graphs many graph parameters as branchwidth and rank-width differ only by a constant factor from the tree- width [24, 11, 20]. Thus, our algorithm also computes a constant factor ap- proximation for these parameters on n-vertex planar graphs in a time linear in n. 2 Main Ideas Before we can describe our ideas, we precisely define tree decompositions and (weighted) treewidth. 3 Definition 2.1 (tree decomposition, bag, width, weight of a bag). A tree de- composition for an unweighted graph G = (V, E) or for a weighted graph G = (V, E) with a weight function c : V → IN is a pair (T, B), where T = (W, F ) is a tree and B is a function that maps each node w of T to a subset of V -called the bag of w-such that 1. each vertex of G is contained in a bag and each edge of G is a subset of a bag, 2. for each vertex v ∈ V , the nodes whose bags contain v induce a subtree of T . In addition, the unweighted width of (T, B)-or short, the width of (T, B)-is maxw∈W{B(w) − 1} and the weighted width is maxw∈W{c(B(w)) − 1} with c(B(w)) = Pv∈B(w) c(v). The term c(B(w)) is also called the weight of the bag of w. The (weighted) treewidth tw(G) of a graph G is the smallest k for which G has a tree decomposition of (weighted) width k. For simplification, on weighted graphs the word treewidth means weighted treewidth. However, in this section and in Section 7 summarizing our main results we often refer explicitly to weighted or unweighted treewidth. We next describe our ideas for the construction of a tree decomposition of small unweighted treewidth and subsequently generalize it to weighted tree- width. In the case of unweighted plane graphs it is very useful to model vertices as points in a landscape where we assign a height to each vertex v. For the time being, the height can be assumed to be the length of a shortest path from v to a vertex incident to the outer face for some given planar embedding ϕ where the length of a path is the number of its vertices-a more precise definition is given in the next paragraph. In particular, this is of interest for a graph G if we can bound the height of all vertices of G by O(tw(G)) since, as part of our computation of a tree decomposition, we split G in some kind similar to cutting a round cake into slices. More exactly, we use paths starting in a vertex v∗ of largest height and following vertices with decreasing height until reaching a vertex adjacent to the outer face. Technically, we realize the splitting by putting the vertices of such a path into one bag. However, we find such a tree decomposition of width k only if the height of v∗ is at most k + 1 since, otherwise, the vertices of such a path can not be all part of one bag. In the case of weighted plane graphs we have the problem that a large weight of a vertex increases the weight of a bag so much that we have to reduce the number of additional vertices that can be put together with this vertex in one bag of a tree decomposition. To translate the weight of a vertex into our landscape model, we consider a vertex not to be a single point with a single height in the landscape, but as a cliff leading from a lower height to an upper height. Thus, instead of a single height we assign a height interval to each vertex whose length can be considered as the length of the cliff and is the weight of the vertex minus one. A weighted planar graph (G, c) with an embedding ϕ is called a weighted plane graph (G, ϕ, c), which we now consider. We now precisely define the height interval of each vertex v. It is referred to as hϕ(v) = [h−ϕ (v), h+ ϕ (v)]. This means that one end of the cliff assigned to vertex v has height h−ϕ (v) and the other end has height h+ ϕ (v) the upper height of v. If i ∈ hϕ(v) for some i ∈ IN , we also say v is a vertex of ϕ (v). We also call h−ϕ (v) the lower height of v and h+ 4 height i. The set of all vertices incident to the outer face is called the coast (of the plane graph). To define the lower and upper heights of the vertices, we initially define a function η with η(v) = c(v) for all vertices v. We now use the concept of a so-called peeling consisting of a sequence of peeling steps. A peeling step decrements η(v) by one for all vertices v that are part of the coast and subsequently removes all vertices with η(v) = 0. Let us number the peeling steps by 1, 2, 3, . . .. After the removal of all vertices, we set hϕ(v) = [i−c(v)+1, i] for all vertices v that are removed in the ith peeling step (i ∈ IN ). The height interval of a vertex consists exactly of the numbers of the peeling steps the vertex is incident to the outer face including the peeling step that removed the vertex. For an example see also Fig. 1. A weighted graph G is called weighted ℓ-outerplanar if there is an embedding ϕ of G such that all vertices have upper height at most ℓ. In this case, ϕ is also called weighted ℓ-outerplanar. We also want to remark that, if we assign weight one to all vertices, the def- initions of weighted treewidth and of weighted ℓ-outerplanar graphs correspond to usual unweighted treewidth and to usual unweighted ℓ-outerplanar graphs, respectively. Observe that each vertex of lower height q ≥ 2 is incident to a face with a vertex of upper height q − 1 and that the upper height of a vertex v is the total weight of a shortest weighted path from v to the coast. For technical reasons and to simplify our definitions, our observations and our lemmas, in the rest of the paper we usually consider only almost triangulated graphs, i.e., plane graphs in which the boundary of each inner face consists of exactly three vertices and edges. As a consequence, each vertex of lower height q ≥ 2 is adjacent to a vertex of upper height q − 1. If a weighted plane graph (H, ψ, c) of treewidth k − 1 and maximal vertex weight cmax is not almost triangulated, we can multiply each weight of a vertex by x ∈ IN to obtain a weighted plane graph (H′, ψ, xc) of treewidth xk − 1. Afterwards, it can be triangulated by simply adding a new [1,3] 3 1 [4,4] 2 [3,4] 1 [1,1] 2 [1,2] [1,4] 4 [1,2] 2 [3,5] 3 [3,4] 2 [5,5] 1 6 [1,6] [1,1] 1 1 [2,2] [2,3] 2 [3,4] 2 2 [1,2] 1 [2,2] [1,1] 1 [1,3] 3 1 [1,1] Figure 1: A weighted plane graph G with its vertices labeled by their weights and the resulting height intervals written beside the vertices. Arrows indicate a neighbor with smallest upper height. The thick edges define so-called perfect crest separators defined in Section 3. In our example where G is assumed to be a cake, the perfect crest separators are the paths used to cut the cake into slices. 5 vertex of weight 1 into each inner face and by connecting this vertex by edges with all vertices on the boundary of that inner face. Let (H′′, ψ′′, c′′) be the graph obtained. Theorem 2 in [18] shows that a tree decomposition (T ′, B′) for H′ can be turned into a tree decomposition for H′′ by adding at most 3k − 2 of the new vertices into each bag of (T, B). Thus, we have a tree decomposition for H′′ where the weight of every bag is bounded by xk + 3k − 2. For some α, β ∈ IN , assume that we can compute a tree decomposition (T ′′, B′′) for H′′ of width α · tw(H′′) + βc′max − 1 where c′max is the maximal weight of a vertex in H′′. Then the size of the bags of (T ′′, B′′) is bounded by α(xk + 3k − 2) + βc′max. Removing the new vertices from (T ′′, B′′), we get a tree decomposition for H′. If we finally take this tree decomposition as a tree decomposition for H, which has the vertices of smaller weight, the weight of every bag is bounded by ⌊(α(xk + 3k − 2) + βxcmax)/x⌋ = ⌊αk + α(3k − 2)/x + βcmax⌋. This means that we can compute a tree decomposition for H of width (α + ǫ)k + βcmax + O(1) if we choose x large enough. To describe our ideas, we need some more definitions. For a subgraph G′ of a weighted plane graph (G, ϕ, c), we use ϕG′ to denote the embedding of G restricted to the vertices and edges of G′. For a graph G = (V, E) and a vertex set V ′ ⊆ V , we let G[V ′] be the subgraph of G induced by the vertices of V ′; and we define G − V ′ to be the graph G[V \ V ′]. If a graph G is a subgraph of another graph G′, we write G ⊆ G′. Through the whole paper, path and cycles are simple, i.e., no vertex and no edge appears more than once in it. For a graph G = (V, E), we also say that a vertex set S ⊆ V disconnects two vertex sets A, B ⊆ V weakly if no connected component of G − S contains vertices of both A and B. S disconnects A and B strongly if additionally S ∩ (A ∪ B) = ∅ holds. If a vertex set S strongly disconnects two non-empty vertex sets, we say that S is a separator (for these vertex sets). A special kind of separators being of great significance for our paper is defined in the following definition. Definition 2.2 (coast separator). A set Y that strongly disconnects a vertex set U from the coast is called a coast separator (for U ). As a consequence of the definition above, the vertices of a coast separator are disjoint from the coast. Finally, we define the weighted size of a separator and the weighted length of a path or cycle as the sum over the weights of its vertices. As observed by Bodlaender [4], one can easily construct a tree decomposition of width 3ℓ − 1 for an ℓ-outerplanar unweighted graph G = (V, E) in O(ℓV ) time. In Section 6, we show that his algorithm can be extended to weighted ℓ-outerplanar graphs. One idea to find a tree decomposition of weighted width O(k) for an ω(k)-weighted-outerplanar graph of weighted treewidth k is to search for a coast separator Y of weighted size O(k) that disconnects the vertices of large lower height strongly from the coast by applying Theorem 2.5 below. For proving the theorem we use the following two well-known observations, which follow from the definition of a tree decomposition. Observation 2.3. Let (T, B) be a tree decomposition for a weighted graph (G, c), and let W and F be the set of nodes and arcs, respectively, of T . Take {w′, w′′} ∈ F . For each pair of subtrees (W1, F1) and (W2, F2) part of dif- ferent trees in the forest (W, F \ {w′, w′′}), B(w′) ∩ B(w′′) weakly disconnects Sw∈W1 B(w) and Sw∈W2 B(w). 6 Observation 2.4. Let (T, B) and (G, c) be defined as in Obs. 2.3, and let V ′ be a subset of the vertices of G such that G[V ′] is connected. Then the nodes of T whose bags contain at least one vertex of V ′ induce a connected subtree of T . Theorem 2.5. Let (G, ϕ, c) be a weighted plane graph of weighted treewidth k ∈ IN . Moreover, let V1 and V2 be connected sets of vertices of G such that (minv∈V2 h−ϕ (v)) − (maxv∈V1 h+ ϕ (v)) ≥ k + 1. Then, there exists a set Y of weighted size at most k that strongly disconnects V1 and V2. Proof. We exclude the case k = 1 since it is well known that graphs of tree- width 1 are forests, i.e., h−ϕ (v) = 1 holds for all vertices v. The same is true for graphs of weighted treewidth 1. Consequently, no sets V1 and V2 with the properties described in the theorem exist in the case of forests. Let (T, B) be a tree decomposition of width k with a smallest number of bags containing both at least one vertex of V1 and at least one vertex of V2. If there is no such bag, then for each i ∈ {1, 2}, the nodes of T whose bags contain at least one vertex of Vi induce a subtree of T (Obs. 2.4), and we thus can find two closest nodes w1 and w2 in T with V1 ∩ B(w1) 6= ∅ 6= V2 ∩ B(w2). For the node w′ adjacent to w2 on the w1-w2-connecting path in T , the set B(w′) ∩ B(w2) is a separator of weighted size at most k for V1 and V2 (Obs. 2.3). Hence, let us assume that there is at least one node w in T with its bag containing both a vertex v1 ∈ V1 and a vertex v2 ∈ V2. Since the weight of B(w) is at most k + 1, for at least one number i with h+ ϕ (v1) < i < h−ϕ (v2), there is no vertex in B(w) that has a height interval containing i. In other words, no vertex in B(w) is a vertex of height i. Since V2 is connected and minv∈V2 h−ϕ (v)) > i, there is a connected set Z that consists exclusively of vertices of height i with Z disconnecting V2 from all vertices u with hϕ(u)+ < i, i.e., in particular from V1. In fact, Z can be chosen as the set of vertices of the coast of the connected component that contains V2 after i− 1 peeling steps and is therefore connected. Thus, the nodes of T , whose bags contain at least one vertex of Z, induce a subtree T ′ of T (Obs. 2.4). Therefore, it is possible to root T such that w is a child of the root and such that the subtree Tw of T rooted in w does not contain any node of T ′. We then replace Tw by two copies T1 and T2 of Tw and similarly the edge between the root r of T and the root of Tw by two edges connecting r with the root of T1 and T2, respectively. For each node w′ in Tw with copies w′1 and w′2 in T1 and T2, respectively, we define the bag B(w′1) to consist of those vertices of the bag B(w′) that are also contained in the connected component of G[V \ Z] containing V2, and B(w′2) should contain the remaining vertices of B(w′). Since there are no edges between the vertices of the connected component of G[V \ Z] containing V2 and the vertices of other connected components of G[V \ Z] and since the bags of Tw contain no vertex of Z, for each edge, both of its endpoints still appear in at least one bag after the replacement described above. To sum up, the replacement leads to a tree decomposition of width k with a lower number of bags containing both a vertex of V1 and of V2. Contradiction. (cid:3) Assume that we are given a connected weighted plane graph (G, ϕ, c) with G = (V, E) and weighted treewidth k ∈ IN that contains exactly one so-called crest. Definition 2.6 (crest, upper/lower height). For a weighted plane graph, a max- imal connected set H of vertices of the same upper height is a crest if no vertex 7 of H is connected to a vertex of larger upper height. The (upper) height of a crest is the upper height of its vertices, and the lower height is the minimal lower height among the lower heights of its vertices. W.l.o.g., V > 1. Thus, every vertex is incident to an edge, which implies that cmax ≤ k, i.e., c(v) ≤ k for all vertices v since each vertex must be contained with another vertex of weight at least 1 in a common bag of total weight at most c(v) + 1. We can try to construct a tree decomposition for G as follows: We will construct a series of weighted subgraphs (G′, c′) of (G, c), where the weight function c′ should be implicitly defined by the restriction of c to the vertices of the subgraph. Initialize G′1 = (V ′1 , E′1) with G. For i = 1, 2, . . ., as long as G′i has only one crest and has vertices of lower height at least 2k + 1 (which are connected since G′i has only one crest) apply Theorem 2.5 to obtain a separator Yi of weighted size at most k separating the vertices of lower height at least 2k + 1 from all vertices of upper height at most k. This means that we separate the vertices of large lower height from all vertices of the coast since a vertex v of the coast can have an upper height of at most c(v) ≤ k. Thus, Yi is a coast separator. Then, define G′i+1 = (V ′i+1, E′i+1) as the subgraph of G′i induced by the vertices of Yi and of the connected component of G′i\ Yi that contains the crest of G′i. Moreover, let Gi = G′i[Yi ∪ (V ′i \ V ′i+1)]. If the recursion stops with a weighted O(k)-outerplanar graph G′j (j ∈ IN ), we set Gj = G′j and construct a tree decomposition for G as follows: First, compute a tree decomposition (Ti, Bi) of weighted width O(k) for each Gi (i ∈ {1, . . . , j}). This is possible since Gi is weighted O(k)-outerplanar. Second, set Y0 = Yj = ∅. Then, for all i ∈ {1, . . . , j}, add the vertices of Yi ∪ Yi−1 to all bags of (Ti, Bi). Finally, for all i ∈ {1, . . . , j − 1}, connect an arbitrary node of Ti with an arbitrary node of Ti+1. This leads to a tree decomposition for G of weighted width O(k). If we are given a weighted plane graph (G, ϕ, c) with weighted treewidth k ∈ IN that has more than one crest of lower height at least 2k + 1, (or if this is true for one of the subgraphs G′i defined above) we cannot apply Theorem 2.5 to find one coast separator separating simultaneously all vertices of lower height at least 2k+1 from the coast since these vertices may not be connected. For cutting off the vertices of large height, one might use several coast separators; one for each connected component induced by the vertices of lower height at least 2k+1. However, if we insert the vertices of all coast separators into every bag of a tree decomposition for the graph with the vertices of small lower height, this may increase the width of the tree decomposition by more than a constant factor since there may be more than a constant number of coast separators. This is the reason why, for some suitable linear function f : IN → IN and some constant q ∈ IN , we search for further separators called perfect crest separators that are disjoint from the crests and that partition our graph G (or G′i) into smaller subgraphs-called components-such that, for each component C containing a non-empty set V ′ of vertices of lower height at least f (k), there is a set YC of vertices with the following properties: (P1) YC is a coast separator for V ′ of weighted size O(k). (P2) YC is contained in C. (P3) YC is disjoint to the set of vertices with lower height ≤ q. 8 The main idea is that-in some kind similar to the construction above- we want to construct a tree decomposition separately for each component and afterwards to combine these tree decompositions to a tree decomposition of the whole graph. The properties above should guarantee that, for each tree decomposition computed for a component, we have to add the vertices of at most one coast separator into the bags of that tree decomposition. We next try to guarantee (P1)-(P3). ϕ (v) = h−ϕ (u) − 1. By making the components so small that each component has at most one maximal connected set of vertices of height at least f (k), we can easily find a set of coast separators satisfying (P1) by using Theorem 2.5. We next try to find some constraints for the perfect crest separators such that we can also guarantee (P2). Recall that we assume that our graph is almost triangulated. Thus, the vertices of a coast separator of minimal weighted size induce a unique cycle. Suppose for a moment that it is possible to choose each perfect crest separator as the vertices of a path with the property that, for each pair of consecutive vertices u and v with u before v, the upper height of v is one smaller than the lower height of u, i.e., h+ In Section 3, we call such a path a down path if it also has some additional properties. For a down path P , there is no path that connects two vertices u and v of P with a strictly shorter weighted length than the subpath of P from u to v. Consequently, whenever we search for a coast separator of smallest weighted size for a connected set V ′ in a component C, there is no need to consider any coast separator with a subpath Q consisting of vertices that are strongly disconnected from the vertices of C by the vertex set of P . Note that it is still possible that vertices of a coast separator belong to a perfect crest separator. To guarantee that (P2) holds, in a more precise definition of the components, we let the vertices and edges of a perfect crest separator belong to two components on 'both sides' of the perfect crest separator. Then we can observe that, if we choose the perfect crest separators as down paths not containing any vertex of any crest, each maximal connected set of vertices of lower height at least f (k) in a component C has a coast separator YC that is completely contained in C. Unfortunately, the vertex set of one down path can not be a separator. For two down paths P1 and P2 that start in two adjacent vertices, we use P1 ◦ P2 to denote the concatenation of the reverse path of P1, a path P ′, and the path P2, where P ′ is the path induced by the edge connecting the first vertices of P1 and P2. The idea is to define a perfect crest separator as the vertex set of such a concatenation P1 ◦ P2. For more information on crest separators, see Section 3. With our new definition of a perfect crest separator we cannot avoid in general that a coast separator YC for the crest of a component C crosses a perfect crest separator and uses vertices outside C. Thus (P2) may be violated. To handle this problem we define a minimal coast separator for a connected set S in a graph G to be a coast separator Y for S that has minimal weighted size such that among all such coast separators the subgraph of G induced by the vertices of Y and the vertices of the connected component of G \ Y containing S has a minimal number of inner faces. Whenever a minimal coast separator for a connected set S in a component C crosses a perfect crest separator, the part of the minimal coast separator outside C forms a so-called pseudo shortcut. Further details on pseudo shortcuts and their computations are described in Section 4. Lemma 5.2 shows that, if a pseudo shortcut P is part of a minimal coast separator YC for a connected set of vertices in a 9 component C and if it passes through another component C′, YC also separates all vertices of lower height at least 2k + 1 in C′ from the coast. Then, we merge C and C′ to one super component C∗. After a similar merging for each pseudo shortcut passing through another component, both properties (P1) and (P2) hold. For guaranteeing property (P3), vertices of height ≤ c and, in particular, the vertices of the coast play a special role for several definitions, e.g., for the pseudo shortcuts or the so-called lowpoints of a perfect crest separator. Given a perfect crest separator X = P1 ◦ P2, the idea is to find tree decom- positions (T1, B1) and (T2, B2) for the two components of G on 'either sides' of X such that Ti, for each i ∈ {1, 2}, has a node wi with Bi(wi) containing all vertices of P1 and P2. By inserting an additional edge {w1, w2} we then obtain a tree decomposition for the whole graph. However, in general we are given a set X of perfect crest separators that splits our graph into components for which (P1)-(P3) holds. If we want to construct a tree decomposition for a component, we usually have to guarantee that, for each perfect crest separator X ∈ X , there is a bag containing all vertices of X. Since we can use the techniques described above to cut off the vertices of large height from each component, it remains to find such a tree decomposition for the remaining O(k)-weighted-outerplanar subgraph of the component. Because of the simple structure of our perfect crest separators we can indeed find such a tree decomposition by extending Bodlaen- der's algorithm [4] for O(k)-outerplanar graphs. For more details see Section 6. Finally, we can iteratively connect the tree decompositions constructed for the several components in the same way as it is described in case of only one perfect crest separator. For an example, see also Fig. 2 and 3-the concepts of 'top vertex' and 'ridge' are defined in the next section. Our algorithm to compute a tree decomposition is presented in Section 7. X2 Y2 crest C0 Y0 X3 ridge crest separator top vertex X4 X1 Y1 coast separator C6 coast Y3 X5 Y6 Y4 X6 Y5 C1, C2, C3, C4, C5 Figure 2: A weighted plane graph (G, ϕ, c) decomposed by a set S = {X1, . . . , X6} of perfect crest separators into several components C0, . . . , C6. In addition, each component Ci has a coast separator Yi for all crests in Ci. 10 b b b b b b b b b b b b b b b Y2 C2 X2 X1 X2 C1 X1 Y1 Y5 X3 C3 X4 C5 X6 Y0 X3 C0 Y6 Y3 C6 X5 X4 X6 X5 C4 Y4 Figure 3: A sketch of a tree decomposition for the graph G of Fig 2. In detail, each colored component Ci of Fig 2 has its own tree decomposition (Ti, Bi) for the vertices of small height in Ci with the bags of (Ti, Bi) being colored with the same color than the component Ci. We implicitly assume that Yi is part of all bags of (Ti, Bi). A tree decomposition for the vertices of large height in Ci is constructed recursively and contains a bag-marked with Yi-containing all vertices of Yi and being connected to one bag of (Ti, Bi). For connecting the tree decompositions of different components, there is an edge connecting a node w′ of (Ti, Bi) with a node w′′ of (Tj, Bj) if and only if Ci and Cj share a certain edge (on their boundary) that later is defined more precisely. In this case, the bags w′ and w′′ contain the vertices of the perfect crest separators disconnecting Ci and Cj-and are marked by the name of this crest separator. 3 Decomposition into Mountains In the next three sections we let (G, ϕ, c) be a weighted, almost triangulated, and biconnected graph with vertex set V and edge set E. If a weighted graph is not biconnected one can easily construct a tree decomposition for the whole graph by combining tree decompositions for each biconnected subgraph. Moreover, let n be the number of vertices of G and take ℓ as the smallest number such that ϕ is weighted ℓ-outerplanar. Recall that, for each vertex v, hϕ(v) = [h−ϕ (v), h+ ϕ (v)] is the height interval of v with h−ϕ (v) and h+ ϕ (v) being called the lower and upper height of v. Recall also that a crest is a maximal connected set H of vertices of the same upper height such that no vertex in H is connected to a vertex of larger upper height. A weighted plane graph with exactly one crest is called a mountain. In this section we show a splitting of (G, ϕ, c) into several mountains. Since 'certain' crests are not of interest, we also show that, given a set of crests, a splitting of (G, ϕ, c) into several so-called components is possible such that each component contains one crest part of the set. As indicated in Section 2 our splitting process makes use of so-called perfect crest separators and down paths. Since it is not so easy to compute perfect crest separators, we start to define and to consider crest separators more general and later describe how to find perfect crest separators as a subset of the crest separators. First of all, we have to define down paths precisely. Let us assume 11 w.l.o.g. that the vertices of all graphs considered in this paper are numbered with pairwise different integers called the vertex number. For each vertex u with a lower height q ≥ 2, we define the down vertex of u to be the neighbor of u that among all neighbors of u with upper height q − 1 has the smallest vertex number. We denote the down vertex of u by u ↓. The down edge of u is the edge {u, u↓}. The down path (of a vertex v) is a path that (starts in v,) consists completely of down edges, and ends in a vertex of the coast. In particular, a vertex v of lower height 1 is a down path that only consists of itself. Note that every vertex has a down path. Definition 3.1 (crest separator, top edge, exterior/interior lowpoint). A crest separator in a weighted, almost triangulated, and biconnected graph is a tuple X = (P1, P2) with P1 being a down path starting in some vertex u and P2 being a down path starting in a neighbor v 6= u↓ of u with h+ ϕ (u), where in the case h+ ϕ (u) the vertex number of v is smaller than that of u. The edge {u, v} is called top edge of X. The first vertex v on P1 that also is part of P2, if it exists, is called the lowpoint of X. If v belongs to the coast, we call v an exterior lowpoint, otherwise an interior lowpoint. ϕ (v) ≤ h+ ϕ (v) = h+ In the remainder of this paper, we let S(G, ϕ, c) be the set of all crest sepa- rators in (G, ϕ, c). Note that, for a crest separator X = (P1, P2), the vertex set of P1 ◦ P2 usually defines a separator. This explains the name crest separator, but formally a crest separator is a tuple of paths. Note also that a top edge is never a down edge and uniquely defines a crest separator. Moreover, the top edges of two different crest separators are always different. Since an n-vertex planar graph has at most O(n) edges, which can possibly be a top edge, and since, in a weighted ℓ-outerplanar graph, each crest separator consists of at most 2ℓ vertices, the next lemma holds. Lemma 3.2. The set S(G, ϕ, c) can be constructed in O(ℓn) time. Since crest separators are in the main focus of our paper, we use some additional terminology: Let X = (P1, P2) be a crest separator. Then, the top vertices of X consist of the first vertex of P1 and the first vertex of P2. A top vertex of X is called highest if its upper height is at least as large as the upper height of the other top vertex of X. We write v ∈ X and say that v is a vertex of X to denote the fact that v is a vertex of P1 or P2. The border edges of X are the edges of P1 ◦ P2. The height of X is the maximum upper height over all its vertices, which is the upper height of the first vertex of P1. The weighted length of X is the weighted length of P1 ◦ P2. The essential boundary of X is the subgraph of G induced by all border edges of X that appear on exactly one of the two paths P1 and P2. In particular, if X has a lowpoint, the vertices of the essential boundary consists exactly of the vertices appearing before the lowpoint on P1 or P2 and of the lowpoint itself. If X has no lowpoint, the essential boundary is the subgraph of G induced by the edges of P1 ◦ P2. Definition 3.3 (crest separator path). For two vertices s1 and s2 being part of the essential boundary of a crest separator X, the (long and short) crest- separator path from s1 to s2 is the longest and shortest path, respectively, from s1 to s2 that consists only of border edges of X and that does not contain the lowpoint of X as an inner vertex. 12 Note that, if neither s1 nor s2 is the lowpoint of X, the longest and the shortest crest-separator path of X are the same. If s1 and s2 are vertices of P1 ◦ P2, but not both are part of the essential boundary of X, the crest-separator path from s1 to s2 is the shortest path from s1 to s2 consisting completely of edges of P1 ◦ P2. We say that two paths P ′ and P ′′ cross, if after merging the endpoints of the common edges of P ′ and P ′′, there is a vertex v with incident edges e1 of P ′, e2 of P ′′, e3 of P ′, e4 of P ′′ appearing clockwise in this order around v. The vertices that are merged into v are called the crossing vertices of P ′ and P ′′. Moreover, we also say that P and P ′ cross if adding a new endpoint v′ to the outer face as well as an edge e from v′ to one endpoint of either P or P ′ with lower height 1 together with an appropriate planar embedding of e in ϕ makes the resulting paths cross with respect to the definition of the previous sentence. A crest separator X = (P1, P2) and a path P cross if P1 ◦ P2 and P cross. Each set S of crest separators splits G into several subgraphs. More precisely, for a set S ⊆ S(G, ϕ, c), let us define two inner faces F and F ′ of (G, ϕ, c) to be (S, ϕ)-connected if there is a list (F1, . . . , Fj ) (j ∈ IN ) of inner faces of (G, ϕ, c) with F1 = F and Fj = F ′ such that, for each i ∈ {1, . . . , j − 1}, the faces Fi and Fi+1 share a common edge not being a border edge of a crest separator in S. A set F of inner faces of (G, ϕ, c) is (S, ϕ)-connected if each pair of faces in F is (S, ϕ)-connected. Hence, a graph is split by crest separators into the following kind of subgraphs. Definition 3.4 ((S, ϕ)-component). Let S ⊆ S(G, ϕ, c). For a maximal non- empty (S, ϕ)-connected set F of inner faces of (G, ϕ, c), the subgraph of G con- sisting of the set of vertices and edges that are part of the boundary of at least one face F ∈ F is called an (S, ϕ)-component. By the fact that an (S, ϕ)-component consists of the vertices on the boundary of an (S, ϕ)-connected set of faces, we can observe. Observation 3.5. The (S, ϕ)-components of a biconnected graph are bicon- nected. For a single crest separator X in (G, ϕ, c), the set {X} splits (G, ϕ, c) into exactly two ({X}, ϕ)-components, which, for an easier notation, are also called (X, ϕ)-components. For the (X, ϕ)-components D and D, we say that D is op- posite to D. We say that X goes weakly between two vertex sets U1 and U2 if we can number the two (X, ϕ)-components with C1 = (V1, E1) and C2 = (V2, E2) such that U1 ⊆ V1 and U2 ⊆ V2. If additionally U1 ∪ U2 does not contain any vertex of X, we say that X goes strongly between the sets. We also say that X goes strongly (or weakly) between two subgraphs if X goes strongly (or weakly) between their corresponding vertex sets. We want to remark that these defini- tions focus on the disconnection of faces instead of vertex sets. Nevertheless, if a crest separator X weakly (strongly) goes between two non-empty vertex sets A and B, then the set of vertices of X weakly (strongly) disconnects A and B. Recall that our goal is to find a subset of the set of all crest separators large enough to separate all crests from each other. As a first step to restrict the set of crest separators, we define a special kind of path, a so-called ridge, at the end of this paragraph. The only crest separators that we need are those that start at an inner vertex of a ridge. Moreover, we define the ridge in such a way 13 that each inner vertex of the ridge defines a crest separator. We start with the definition of a height-vector of a path P . This is a vector (n1, . . . , nℓ) where ni (i ∈ {1, . . . , ℓ}) is the number of vertices of P whose upper height is i. We say that a height vector (n1, ..., nℓ) is smaller than a height vector (n′1, ..., n′ℓ) if it is smaller with respect to the lexicographical order. For vertices s and t, a ridge R between s and t is a path connecting s and t with a smallest height-vector among all paths connecting s and t. A vertex of R with smallest upper height h is called a deepest vertex of R, and h is called the depth of R. Lemma 3.6. For every inner vertex u of a ridge R, there is a neighbor v of u of at most the same upper height such that the down path P1 of u and the down path P2 of v define a crest separator X = (P1, P2) or X = (P2, P1) that crosses R. Proof. Consider the down path P1 of u. Let ¯u be the vertex of P1 that belongs to the coast. If ¯u 6= u, P1 has an edge {u′, ¯u} that is not part of R. Otherwise, extend P1 by an edge {¯u, u∗} to a new virtual vertex u∗ in the outer face. P1 can be extended by an edge {u, v′} such that the resulting path P ′1 crosses the ridge. Intuitively speaking, v′ is a neighbor of u 'on the other side of the ridge' than P1 or the virtual vertex u∗. Note that there must be indeed at least one vertex v′ on the other side of the ridge since, otherwise, u must be a vertex of the coast, the down path of u has only u as vertex, and u is incident on both sides to the outer face, which is a contradiction to the biconnectivity of G. Let L be the cyclic list of neighbors of u in clockwise order, and let r1 and r2 be the two vertices of L that belong to R. We split L \ {r1, r2} into two sublists L1 and L2 where Li (i ∈ {1, 2}) starts with the successor of ri and ends with the predecessor of r3−i. Note that, for all vertices v′′ of the list Lj containing v′, the concatenation of v′′ and P1 crosses R. If such a vertex v′′ ϕ (u), then we can take v = v′′ and the lemma holds. Let exists with h+ us assume that no such vertex v′′ exists. Let R′ be the path obtained from R where u is replaced by the vertices in Lj. Then R′ has a smaller height-vector than R since R′ has one vertex less of height h+ ϕ (u) whereas the number of vertices with a smaller upper height does not change; a contradiction to the fact that R is a ridge. (cid:3) ϕ (v′′) ≤ h+ Definition 3.7 (mountain structure). Let H be a set of crests of (G, ϕ, c). A mountain structure for (G, ϕ, c) and H is a tuple (G, ϕ, c,H,S) with S ⊆ S(G, ϕ, c) such that, for each pair of different crests H1 and H2 in H and for each ridge R in (G, ϕ, c) with one endpoint in H1 and the other in H2, the following property holds: (a) There is a crest separator X ∈ S with one of its highest top vertices being a vertex of R such that X strongly goes between H1 and H2 and such that X has smallest weighted length among all such crest separators in S(G, ϕ, c). The next lemma shows that the simple structure of a crest separator as a tuple of two down paths suffices to separate each pair of crests of the graph; in particular, property (a) can be easily satisfied for each set H of crests by setting S = S(G, ϕ, c). Lemma 3.8. Let R be an ridge between two vertices s and t in (G, ϕ, c). Choose v as a deepest inner vertex of R. If the depth of R is smaller than the upper height of both s and t, there is a crest separator in S(G, ϕ, c) that 14 • goes strongly between {s} and {t}, and • contains v as a highest top vertex. Proof. By Lemma 3.6, there is a crest separator X = (P1, P2) with top vertex v that crosses R. Since v is a deepest vertex of R and since P1 and P2 are down paths whose highest vertices have upper height ≤ h+ ϕ (v), R and X can cross only once. Note that this also implies that X neither contains s nor t. Thus, X goes strongly, between s and t. (cid:3) As a consequence of the last lemma, the tuple (G, ϕ, c,H,S(G, ϕ, c)) is a mountain structure for (G, ϕ, c) and H. It appears that some crest separators of a mountain structure may be useless since they split one crest into several crests or they cut of parts of our original graph not containing any crests. Hence, we define the following. Definition 3.9 (good mountain structure). A mountain structure (G, ϕ, c,H,S) is good if, in addition to property (a), also the properties below hold: (b) No crest separator in S contains a vertex of a crest in H. (c) Each (S, ϕ)-component contains vertices of a crest in H. Let (G, ϕ, c,H,S) be a mountain structure. Note that the properties (a) and (c) imply that each (S, ϕ)-component contains the vertices of exactly one crest in H, and property (b) guarantees that the crest is completely contained in one (S, ϕ)-component. For each ridge R of a pair of crests H1 and H2 in H, the set S of crest separators contains a crest separator that strongly goes between H1 and H2. We next want to show that a good mountain structure exists and can be computed efficiently. For that we make use of a special graph. Definition 3.10 (mountain connection tree). The mountain connection tree T of a mountain structure (G, ϕ, c,H,S) is a graph defined as follows: Each node of T is identified with an (S, ϕ)-component of G, and two nodes w1 and w2 of T are connected if and only if they-or more precisely the (S, ϕ)-components with which they are identified-have a common top edge of a crest separator in S. Recall that the border edges of a crest separator X = (P1, P2) consist of one top edge e of X and further down edges, and that a down edge cannot be a top edge of any crest separator. Since the edges of X are the only edges that are part of both (X, ϕ)-components, the top edge e is the only top edge of a crest separator that is contained in both (X, ϕ)-components. Moreover, since two down paths can not cross by definition, for each crest separator X ∈ S of a good mountain structure, we can partition the set of all (S, ϕ)-components into a set C1 of (S, ϕ)-components completely contained in one (X, ϕ)-component and the set C2 of (S, ϕ)-components contained in the other (X, ϕ)-component. Then, X is the only crest separator with a top edge belonging to (S, ϕ)-components in C1 as well as in C2. Consequently, T is indeed a tree. Lemma 3.11. The mountain connection tree of a mountain structure is a tree. The fact that the top edge of a crest separator X is the only top edge belonging to both (X, ϕ)-components shows also the correctness of the next lemma. 15 Lemma 3.12. Let C1 and C2 be two (S, ϕ)-components that are neighbors in the mountain connection tree of a mountain structure (G, ϕ, c,H,S). Then there is exactly one crest separator in S going weakly between C1 and C2, which is also the only crest separator with a top edge belonging to both C1 and C2. Since each of the O(n) crest separators consists of at most O(ℓ) edges, we can determine in O(ℓn) time all (S, ϕ)-components and afterwards construct the mountain connection tree by a simple breadth-first search on the dual graph of (G, ϕ, c). Lemma 3.13. Given a mountain structure (G, ϕ, c,H,S) for a set S of crest separators, its mountain connection tree can be determined in O(ℓn) time. We also can construct a good mountain structure. Lemma 3.14. Given (G, ϕ, c) and H, a good mountain structure (G, ϕ, c,H,S) can be constructed in O(ℓn) time. Proof. For a simpler notation, in this proof we call a crest separator of a set S of crest separators to be a heaviest crest separator of S if it has a largest weighted length among all crest separators in S. We first construct the set S′ = S(G, ϕ, c) of all crest separators in O(ℓn) time (Lemma 3.2). Lemma 3.8 guarantees that, for each pair of crests in H and each ridge R with endpoints in both crests, there is a crest separator X in S(G, ϕ, c) strongly going between the two crests with a highest top vertex of X being a deepest vertex of R. This in particular means that all vertices of X have an upper height smaller than or equal to the depth of the ridge, which is strictly smaller than the upper height of the two crests and of all crests through which R passes, i.e., no vertex of X is part of a crest in G. Hence, in O(ℓn) time, we can remove all crest separators from S′ that contain a vertex of a crest and property (a) of a good mountain structure is maintained. Afterwards property (b) holds. Let S′′ be the resulting set of crest separators. For guaranteeing property (c), we have to remove further crest separators from S′′. We start with constructing the mountain connection tree T of (G, ϕ, c,H,S′′) in O(ℓn) time (Lemma 3.13). We root T at an arbitrary node of T . In a sophisticated bottom-up traversal of T we dynamically update S′′ by removing superfluous crest separators in O(ℓn) time. For a better understand- ing, before we present a detailed description of the algorithm, we roughly sketch some ideas. Our algorithms marks some nodes as finished in such a way that the following invariant (I) always holds: If a node C of T is marked as finished, the (S′′, ϕ)-component C contains exactly one crest in H. The idea of the al- gorithm is to process a so far unfinished node that has only children already marked as finished and that, among all such nodes, has the largest depth in T . When processing a node w, we possibly remove a crest separator X from the current set S′′ of crest separators with the top edge of X belonging to the two (S′′, ϕ)-components identified with w and a neighbor w′ of w in T . If so, by the replacement of S′′ by S′′ \ {X}, we merge the nodes w and w′ in T to a new node w∗. Additionally, we mark w∗ as finished only if w′ is a child of w since in this case we already know that w′ is already marked as finished, i.e., w′ contains a crest in H that is now part of w∗. We now describe our algorithm in detail. We start with some preprocessing steps. In O(n) time, we determine and store with each node w of T a value 16 Crest(w) ∈ {0, 1} that is set to 1 if and only if the (S′′, ϕ)-component identified with w contains a vertex that is part of a crest in H. In O(ℓn) time, we addi- tionally store for each crest separator in S′′ its weighted length, mark each node as unfinished, and store with each non-leaf w of T in a variable MaxCrestSep(w) a heaviest crest separator of the set of all crest separators going weakly between the (S′′, ϕ)-component identified with w and an (S′′, ϕ)-component identified with a child of w. For each leaf w of T , we define MaxCrestSep(w) = nil. As a last step of our preprocessing phase, which also runs in O(n) time, for each node w of T , we initialize a value MaxCrestSep∗(w) with nil. MaxCrestSep∗(w) is defined analogously to MaxCrestSep(w) if we restrict the crest separators to be considered only to those crest separators that go weakly between two (S′′, ϕ)- components identified with w and with a finished child of w. We will see that it suffices to know the correct values of MaxCrestSep(w) and MaxCrestSep∗(w) only for the unfinished nodes and therefore we do not update these values for finished nodes. We next describe the processing of a node w during the traversal of T in detail. Keep in mind that S′′ is always equal to the current set of remaining crest separators, which is updated dynamically. First we exclude the case, where w has a parent w with an unfinished child w, and where MaxCrestSep( w) is equal to the crest separator going weakly between the (S′′, ϕ)-components identified with w and w. More precisely, in this case we delay the processing of w and continue with the processing of w. Second, we test whether the (S′′, ϕ)-component C identified with w contains a vertex belonging to a crest in H, which is exactly the case if Crest(w) = 1. In this case, we mark w as finished. If there is a parent w of w with X being the crest separator going weakly between the two (S′′, ϕ)-components identified with w and to w, we replace MaxCrestSep∗( w) by a heaviest crest separator in {X, MaxCrestSep∗( w)}. Let us next consider the case where Crest(w) = 0. We then remove a heaviest crest separator X of the set of all crest separators going weakly between the (S′′, ϕ)-component identified with w and an (S′′, ϕ)-component identified with a neighbor of w, i.e., either with (Case i) a child w of w or (Case ii) the parent w of w. X can be taken as either MaxCrestSep(w) or the crest separator going weakly between the two (S′′, ϕ)-components identified with w and w. Case i: We remove X from S′′ and mark the node w∗ obtained from merging w and w as finished and set Crest(w∗) = 1. Note that this is correct since w is already marked as finished and therefore Crest( w) = 1. In addition, if the parent w of w exists, we replace MaxCrestSep∗( w) by the heaviest crest separator contained in {X′, MaxCrestSep∗( w)} where X′ is the crest separator in S′′ going strongly between the (S′′, ϕ)-components identified with w and w. Case ii: We mark the node w∗ obtained from merging the unfinished nodes w and w as unfinished, set Crest(w∗) = Crest( w), and define the value MaxCrestSep∗(w∗) as the heaviest crest separator in {MaxCrestSep∗(w), MaxCrestSep∗( w)} or nil if this set contains no crest separator. If w beside w has another unfinished child, we define MaxCrestSep(w∗) as the heav- iest crest separator in {MaxCrestSep(w), MaxCrestSep( w)}. Note that MaxCrestSep( w) 6= X since otherwise the processing of w would have been If w has no other unfinished child, we take MaxCrestSep(w∗) delayed. 17 as the heaviest crest separator that is contained in {MaxCrestSep(w), MaxCrestSep∗( w)} or nil if no crest separator is in this set. Note that MaxCrestSep∗( w) 6= X since w is unfinished before its processing. We can conclude by induction that our algorithm correctly updates Crest(w) for all nodes w as well as MaxCrestSep(w) and MaxCrestSep∗(w) for all unfinished nodes w. If the processing of a node in T is delayed, the processing of the next node considered is not delayed. Hence the running time is dominated by the non-delayed processing steps. If the processing of a node is not delayed either two (S′′, ϕ)-components are merged or a node w in T is marked as finished. Hence the algorithm stops after O(n) processing steps, i.e., in O(n) time, with all nodes of T being marked as finished. Note that, if during the processing of a so far unfinished node w, we remove a crest separator X weakly going between the (S′′, ϕ)-components identified with w and a neighbor of w, we know that w itself contains no crest in H. Hence, if X goes strongly between two crests in H, then there is another crest separator going strongly between these two crests that also goes strongly between two (S′′, ϕ)-components identified with w and one of its neighbors. This together with the fact that we have chosen X as heaviest crest separator guarantees that property (a) is maintained during our processing. Since no crest separators are added into S′′, property (b) also holds. The fact that the algorithm marks a node as finished only if its identified (S′′, ϕ)-component contains the vertices of a crest in H implies that the invariant (I) holds before and after each processing of a node w. At the end of the algorithm invariant (I) guarantees that property (c) holds. To sum up, (G, ϕ, c,H,S′′) defines a good mountain structure at the end of the algorithm. (cid:3) 4 Connection between Coast Separators and Pseudo Shortcuts As in the last section, H is a set of crests in a weighted, almost triangulated, and biconnected graph (G, ϕ, c). Let (G, ϕ, c,H,S) be a good mountain structure. As part of our algorithm, for each (S, ϕ)-component, we want to compute a coast separator that strongly disconnects its crest in H from the coast and that is of weighted size q·tw(G) for some constant q. In more detail, we are interested in minimal coast separators as already mentioned in Section 2 and in Section 5 we choose H as a special set of crests that allow us to compute such coast separators. For a cycle Q in (G, ϕ, c), we say that Q encloses a vertex u, a vertex set U , and a subgraph H of G, if the set of the vertices of the cycle weakly disconnects the coast from {u}, U , and the vertex set of H, respectively. A crest separator X encloses a vertex u, a vertex set U , and a subgraph H of G if it has a lowpoint and the cycle induced by the edges of the essential boundary of X encloses {u}, U , and the vertex set of H, respectively. The inner graph of a cycle Q or a coast separator Q is the plane graph induced by the vertices that are weakly disconnected by Q from the coast. Recall that a coast separator for a set U is minimal for U if it has minimal weighted size among all coast separators for U and if among all such separators its inner graph has a minimal number of faces. 18 Observation 4.1. The vertex set of a minimal coast separator for a connected set of vertices H in a weighted, almost triangulated graph induces a cycle. Unfortunately, for a crest H ∈ H in an (S, ϕ)-component C, there might be no minimal coast separator Y for H of weighted size O(tw(G)) in G that is completely contained in C. In this case, there is a crest separator X ∈ S such that the cycle induced by Y contains a subpath P with the following properties: P starts and ends with vertices of X and, additionally, P is contained in the (X, ϕ)-component not containing C. Then, since P can not be replaced by a crest-separator path of X of at most the same length, P must be a pseudo shortcut as defined next. (For property (1) of the following definition, see the remark immediately after the definition.) inner graph). Let X = Definition 4.2 (pseudo shortcut, composed cycle, (P1, P2) be a crest separator in (G, ϕ, c) with an (X, ϕ)-component D. Let X CP be a crest-separator path of X connecting vertices s1 and s2 part of the essential boundary of X. Then, a path P from s1 to s2 in D is called an (s1-s2-connecting) (D-)pseudo shortcut (of X CP) if the following three conditions hold: (1) if X encloses the (X, ϕ)-component opposite to D, then X has an exterior lowpoint, i.e, a lowpoint belonging to the coast. (2) P has a strictly shorter weighted length than X CP. (3) P does not contain any vertex of the coast. We call the cycle consisting of the edges of P and of X CP the composed cycle of (X CP, P ). Moreover, a path P is a pseudo shortcut of a crest separator X if it is a pseudo shortcut for some crest-separator path of X. The inner graph of a pseudo shortcut P of a crest-separator path X CP is the inner graph of the composed cycle of (X CP, P ). Roughly speaking, for a crest separator X with an interior lowpoint, we are only interested in pseudo shortcuts that are enclosed by X. These can be used for the construction of a coast separator for a crest H ∈ H in the (X, ϕ)- component D not enclosed by X. For the crests in H enclosed by X, we can use the essential boundary of X as a coast separator. This is the reason why we distinguish between exterior and interior lowpoints, and why we restrict our definition of pseudo shortcuts by Condition 1. In return, we so can avoid complicated special cases in the use of pseudo shortcuts. Note that, for two vertices s1 and s2 with neither s1 nor s2 being equal to the lowpoint of a crest separator X, there is only one crest-separator path connecting s1 and s2, and we compare the weighted length of a weighted path P connecting s1 and s2 with the unique weighted length of the crest-separator path connecting s1 and s2. Moreover, we restrict the endpoints of a pseudo shortcut P to be part of the essential boundary since, otherwise, one of P1 and P2 must contain both endpoints. Then P cannot have a shorter length than the subpath of P1 or P2 connecting the two endpoints as shown by part (a) of the next lemma. Lemma 4.3. For each crest separator X = (P1, P2) the following holds: 19 (a) For each i ∈ {1, 2}, no path with endpoints v1 and v2 in Pi can have a shorter weighted length than the shortest v1-v2-connecting crest-separator path. (b) Let R be a ridge connecting two vertices of different crests H1 and H2 in H. If the weighted length of X is not larger than the weighted length of a crest separator of shortest weighted length separating H1 and H2, R and a pseudo shortcut P of a crest-separator path X CP of X cannot cross. Proof. To show part (a), we use the fact that every path from v1 to v2 has weighted length of at least max(h+ ϕ (v2) − h−ϕ (v1)) + 1 whereas the crest-separator path with endpoints v1 and v2 has exactly that length. Thus, (a) holds. ϕ (v1) − h−ϕ (v2), h+ To show part (b), let X be a crest separator with shortest weighted length among all crest separators separating H1 and H2. See Fig. 4. Note that X must cross R. Assume for a contradiction that (b) does not hold, i.e., R and a pseudo shortcut P of X CP cross. Choose u among all crossing vertices of R and P with minimal upper height. With s1 and s2 being the endpoints of P , let Q be the path obtained from P1 ◦ P2 by replacing X CP by P . Note that Q has a smaller weighted length than X since P is a pseudo shortcut of X CP . Let P ∗1 be the down path of u, and choose P ∗2 as a down path starting in a neighbor of u such that X∗ = (P ∗1 , P ∗2 ) or X∗ = (P ∗2 , P ∗1 ) is a crest separator that crosses R and that, among all possible choices, has shortest weighted length. X∗ exists by Lemma 3.6. The weighted length of P ∗1 plus the weighted length of P ∗2 can not be larger than the weighted length of Q since Q consists of a subpath Q′ from a vertex of the coast to u and another subpath Q′′ back to the coast. More precisely, assume that P ∗1 and Q′ leave R on the same side, whereas P ∗2 and Q′′ leave R on the other side. Let u′ be the first vertex of Q′′. Note that u′ is not the down vertex of u. If {u, u′} is the top edge of a crest separator crossing R, then by definition of X∗ as a crest separator with smallest weighted length among all possible choices, P ∗2 must start in a vertex with lower or equal upper height than that of u′. Otherwise, i.e., if u is the down vertex of u′ or if u′ belongs to R and the down path of u′ leaves R on the same side than the down path of u, u′ has upper height at least h+ ϕ (u), whereas the upper height of the first vertex of P ∗2 is at most h+ ϕ (u) by Lemma 3.6 and the fact X∗ that was chosen as a crest separator with smallest weighted length among all possible choices. Q b s1 R u b top vertex P b s2 X X X∗ Figure 4: The crest separators X, X, X∗, the ridge R, the pseudo shortcut P , and the path Q as described in the proof of Lemma 4.3(b). 20 b b So far we can conclude that X∗ has weighted length smaller than or equal to the weighted length of Q. As long as X∗ and R cross more than once, there is another common vertex u of R and X∗ with h+ ϕ (u) and we redefine X∗ as a crest separator crossing R with u being a top vertex of X∗. Finally, X∗ and R cross only once, and thus X∗ strongly disconnects H1 and H2. Since our iteration of choosing X∗ only shrinks the weighted length of X∗, X∗ has weighted length smaller than or equal to the weighted length of Q, which is strictly smaller than the weighted length of X. Since the weighted length of X is smaller than or equal to the weighted length of X, the weighted length of X∗ is strictly smaller than the weighted length of X. Contradiction. (cid:3) ϕ (u) < h+ For the rest of this section, let (G, ϕ, c,H,S) be a good mountain structure of (G, ϕ, c). The endpoints of a pseudo shortcut for a crest separator X ∈ S are- intuitively speaking-the vertices between which a coast separator can leave one (X, ϕ)-component and later reenter the (X, ϕ)-component. We describe this intuition more precisely in Lemma 4.5. Let X be a crest separator, and let D be an (X, ϕ)-component. A subpath P ′′ of a path P ′ in G is called to be a (D, X)-subpath of P ′ if it is a path contained in D, that starts either with a lowpoint of X or an edge not being part of the essential boundary of X and that also ends either with a lowpoint of X or an edge not being part of the essential boundary of X. P ′′ is called maximal if no other (D, X)-subpath of P ′ contains P ′′ as a proper subpath. Definition 4.4 (strict pseudo shortcut). A D-pseudo shortcut P of a crest- separator path X CP of a crest separator X ∈ S is called strict if it has shortest weighted length among all D-pseudo shortcuts of X CP and if among those the composed cycle (X CP, P ) encloses a minimum number of faces. Intuitively, the next lemma shows that in some cases, the part of a coast separator behind a crest separator is a strict pseudo shortcut and that an anal- ogous result holds for parts of a strict pseudo shortcut behind a crest separator. For the next lemma, see also the examples in Fig. 5. Lemma 4.5. Let D and D∗ be the (X, ϕ)-components for a crest separator X ∈ S such that D∗ is not enclosed by X or X has an exterior lowpoint. Moreover, let P either be (a) the part contained in D of a minimal coast separator Y for a crest H ∈ H in D∗ or D C D∗ C∗ s1 top vertex D′ P u′ u′′ X′ s2 X D′ P ⇒ D C D∗ C∗ s1 top vertex D′ P D C D∗ C∗ s1 top vertex u′ u′′ X′ s2 X u′ u′′ X′ D′ P D C top vertex D∗ C∗ s1 s2 u′ u′′ X′ X s2 b ⇒ X Figure 5: The replacement of a pseudo shortcut P crossing X′ more than once. 21 b b b b b b b b b b b b b b b b b b b b b b b (b) a strict D-pseudo shortcut of a crest-separator path X CP of X. Then, for all crest separators X′ = (P ′1, P ′2) ∈ S with an (X′, ϕ)-component D′ ⊆ D, possibly X′ = X, P has at most one maximal (D′, X′)-subpath. If P has such a path P ∗, P ∗ is a strict D′-pseudo shortcut of the crest-separator path (X′)CP of X′ such that (X′)CP has the same endpoints as P ∗ and is contained in the inner graph I of • the cycle induced by the vertex set of Y (Case (a)) or • the composed cycle Q of (X CP, P ) (Case (b)). Proof. Roughly speaking, we first want to show that, for all j ∈ {1, 2}, there is at most one crossing between P and P ′j. In fact, we want to show something more with respect to two concerns. 1. If P starts in a common vertex of X and X′, we also want to consider this entering of D′ as a crossing vertex. Therefore, we let P be a path obtained from P by adding two edges of D∗ not being border edges of X at the beginning and the ending of P . 2. We consider one of possible several crossings of P and P ′j and we mark all crossing vertices that belong to exactly this crossing. More precisely, we choose the crossing whose crossing vertices are the last crossing vertices on P ′j. Note, that the marked vertices induce a subpath of P ′j. In the next paragraph, we show that no other vertex of P can appear before the marked vertices on P ′j . This implicitly shows that, for each j′ ∈ {1, 2}, there can be at most one crossing between P and P ′j and, more important, that there can be only at most one maximal (D′, X′)-subpath. Let v be the last marked vertex on P ′j . Since the coast is not part of I, all vertices after v on P ′j are not part of I. Hence, if P ′j contains vertices of P before the marked vertices, then the subpath of P ′j between the last such ver- tex u′ and the first marked vertex u′′ is contained in I and can be replaced by the crest-separator path of X′ between u′ and u′′ (see Fig. 5 for two possible examples). This replacement does not increase the weighted length of P /of Y (Lemma 4.3(a)), but reduces the number of inner faces of I; which is a contra- diction to the definition of P being a strict pseudo shortcut or being part of a minimal coast separator. Thus, our assumption that there are vertices of P before the marked vertices on P ′j is wrong. We next conclude that, if there is a maximal (D′, X′)-subpath P ′, since it is the only one and since P is a strict pseudo shortcut or part of a minimal coast separator, P ′ must have a shorter weighted length than the crest-separator path of X′ that is part of I and between the endpoints of P ′. Note also that, if X′ has an interior lowpoint, it cannot enclose the (X′, ϕ)-component opposite to D′ since, otherwise, X must also have an interior lowpoint and must enclose D∗. Hence P ′ is a pseudo-shortcut of (X′)CP. Since P is a strict pseudo shortcut or part of a minimal coast separator, P ′ as the only maximal (D′, X′)-subpath must be strict. (cid:3) In the following we want to compute pseudo shortcuts for the different crest separators by a bottom-up traversal in the mountain connection tree T 22 of (G, ϕ, c,H,S). Therefore, let us assume that T is rooted at some arbitrary node. Let X be a crest separator going weakly between an (S, ϕ)-component C and its parent in T , and let D be the (X, ϕ)-component D containing C. The idea to construct a D-pseudo shortcut of X can be described as follows: A D-pseudo shortcut first follows a path in C and possibly, after reaching a vertex v of C that is part of a crest separator X′ ∈ S weakly going between C and a child C′ of C in T , it follows a (precomputed) D′-pseudo shortcut of X′ for the (X′, ϕ)-component D′ containing C′, then it follows again a path in C and, after possibly containing further pseudo shortcuts, it returns to C and never leaves C anymore. Indeed, if a D-pseudo shortcut of X, immediately after reaching a vertex v of C that is part of a crest separator X′ with the properties described above, contains an edge outside the (X′, ϕ)-component containing C, then we show that P contains a D′-pseudo shortcut P ′ for the (X′, ϕ)-component D′ containing C′. However, since X may not completely contained in C, a D- pseudo shortcut of X may not start in a vertex of C. This is the reason why, for subsets S′,S′′ ⊆ S(G, ϕ, c) with S′ ⊆ S′′ (an example for S′ 6= S′′ can be found in Lemma 4.7) and for an (S′, ϕ)-component C, we define the extended component ext(C,S′′) as the plane graph obtained from C by adding the border edges of all crest separators X ∈ S′′ with a top edge in C. This should mean of course that the endpoints of the border edges are also added as vertices to C. As embedding of ext(C,S′′), we always take ϕext(C,S ′′). The next three lemmas prove some properties of extended components that allows us to guarantee the existence of pseudo shortcuts with nice properties in Lemma 4.10 from which we show in Lemma 4.12 that they can be constructed efficiently. Lemma 4.6. Let C be an (S, ϕ)-component and let e be an edge with exactly one endpoint v in ext(C,S). Then, v is part of a crest separator in S with a top edge in C. Proof. By the definition of ext(C,S) the lemma holds if v is not contained in C. It remains to consider the case that v is in C. The definition of an (S, ϕ)- component implies that v is a vertex of a crest separator in S. We define the boundary of C to be the graph that consists of the vertices and edges of C that are incident to a face f of ϕC such that f is not a face of ϕ. (Roughly speaking, f is the union of several faces of ϕ.) Let u be a vertex of largest upper height such that there is a down path from u to v that is contained in the boundary of C. Since G is biconnected, Obs. 3.5 implies that C is biconnected. Thus, u is incident to two edges {u, v1} and {u, v2} on the boundary of C. Assume for a moment that both edges are down edges. Since each vertex is connected by down edges to at most one vertex of smaller upper height and since down edges only connect vertices of different upper heights, either v1 or v2 must have larger upper height than u. This is a contradiction to our choice of u. Consequently, one of {u, v1} and {u, v2} is a top edge in C that belongs to a crest separator X ∈ S with a top edge in C. Since the down path from u contains v, it follows that X contains v. (cid:3) For the next two lemmas, let D and D be the two (X, ϕ)-components of a crest separator X in S(G, ϕ, c), and let S be a set of crest separators with {X} ⊆ S ⊆ S(G, ϕ, c). 23 Lemma 4.7. The extended component ext(D,S) consists only of the vertices and edges of D, the border edges of X, and their endpoints. Proof. Each vertex v ∈ ext(D,S) either belongs to D or is an endpoint of a border edge of a crest separator with a top edge {v′, v′′} in D, i.e., v is reachable by a down path from vertex v′ or v′′. A down path P starting in a vertex of D can leave D only after reaching a vertex x ∈ X. But after reaching x, P must follow the down path of x and therefore all edges after x on P must be border edges of X. (cid:3) Lemma 4.8. If e is an edge with exactly one endpoint v in ext(D,S), then v is part of X. Proof. Note that there are no direct edges from a vertex v ∈ D to a vertex v ∈ D with neither v nor v being part of X. Hence, v must be part of X by Lemma 4.7. (cid:3) As mentioned above, we want to precompute pseudo shortcuts for the crest separators in S since we later want to use them to construct coast separators. This only works if the pseudo shortcuts have some nice properties (in some kind similar to the properties of strict pseudo shortcuts, but the strict pseudo shortcuts have the problem that they cannot be computed efficiently). There- fore, let us consider a crest separator X0 and an (X0, ϕ)-component D of X0. Moreover, let us root the mountain connection tree T of (G, ϕ, c,H,S) such that for the (S, ϕ)-components C and C0 containing the top edge of X0, the (S, ϕ)-component C0 not being contained in D is the parent of the other (S, ϕ)- component C. Moreover, let C1, . . . , Cj be the children of C in T and, for i ∈ {1, . . . , j}, Xi be the crest separator with a top edge in C and Ci. Finally, let Di (i ∈ {1, . . . , j}) be the (Xi, ϕ)-component that contains Ci. Using these definitions we define a new kind of pseudo shortcuts. Definition 4.9 (nice pseudo shortcut). An s1-s2-connecting D-pseudo short- cut P of X0 is called nice if it has shortest weighted length among all s1-s2- connecting D-pseudo shortcuts of X0 and if it consists exclusively of subpaths in ext(C,S) and, for each i ∈ {1, . . . , j}, of at most one nice Di-pseudo shortcut Pi for some crest-separator path X CP of Xi that is part of the inner graph of the composed cycle of (X CP , P ). i 0 The following lemma guarantees the existence of nice pseudo shortcuts. Lemma 4.10. If there exists an s1-s2-connecting D∗-pseudo shortcut for the (X∗, ϕ)-component D∗ of a crest separator X∗ ∈ S, then there is also such a pseudo shortcut that is nice. Proof. First, observe that with an s1-s2-connecting D∗-pseudo shortcut of X∗, there is also a strict s1-s2-connecting D∗-pseudo shortcut of X∗. We next show that, for each crest separator X0 and each (X0, ϕ)-component D of X0, each strict D-pseudo shortcut P is nice. This is shown by induction over the number of crest separators X ∈ S for which there is a crossing of X and P . Let us define C, C1, . . . , Cj , X0, X1, . . . , Xj, and D, D1, . . . , Dj as strictly before Definition 4.9. If there are no crossings between P and crest separators X 6= X0 in S, P is just a pseudo shortcut of shortest weighted length connecting the endpoints of P and is contained in ext(C,S). Then P is clearly nice. Otherwise, 24 let us consider the first edge e of P not contained in ext(C,S). Hence, one endpoint v′ of e must be part of a crest separator Xi with i ∈ {1, . . . , j}-here we use Lemma 4.6 and the fact that X0, X1, . . . , Xj are the only crest separators with a top edge in C; i 6= 0 since e is in D-and the other endpoint is contained in the (Xi, ϕ)-component opposite to Di. Thus, there must be a vertex v′′ after v′ on P that is contained in ext(C,S). W.l.o.g., let v′′ be the first such vertex. Because of Lemma 4.8, v′′ must be also part of Xi. Since P is a strict D-pseudo shortcut of X0, by Lemma 4.5, it has at most one maximal Di-subpath Pi from v′ to v′′, and it must be a strict pseudo shortcut of the crest-separator path X CP of Xi with endpoints v′ and v′′ such that X CP is contained in the composed cycle (X CP , P ). Since the number of crest separators for which there is a crossing of the crest separator and Pi is smaller than the corresponding number for the whole path P , we can conclude that the subpath from v′ to v′′ is nice. If there are further parts of P not contained in ext(C,S), they can similarly shown to be the only and nice pseudo shortcut for one of the other crest separators in {X1, . . . , Xj} \ {Xi}. Together with the fact that P as a strict pseudo shortcut is a D-pseudo shortcut of shortest weighted length between its endpoints, we can conclude that P is nice. (cid:3) 0 i i For an (X, ϕ)-component D of a crest separator X ∈ S, let us define a d- bounded D-pseudo shortcut set for X to be a set consisting of an s1-s2-connecting nice D-pseudo shortcut P of weighted length at most d for each pair s1 and s2 of vertices of X for which such an s1-s2-connecting D-pseudo shortcut exists. The main aim of Lemma 4.12 is to efficiently construct a d-bounded M-shortcut set. Definition 4.11 (d-bounded M-shortcut set). For a mountain structure M = (G, ϕ, c,H,S), a d-bounded M-shortcut set is a set consisting of the union of a d-bounded D-pseudo shortcut set for each crest separator X and each (X, ϕ)- component D. The pseudo shortcuts in such a d-bounded M-shortcut set are later used for the construction of coast separators. However, in order to avoid an "over- lapping" of coast separators, we will remove some of the constructed pseudo shortcuts. For making such a removal more efficient, we have to store some additional informations and to introduce some further definitions. An (S, ϕ)-component C is called the root component of a D-pseudo shortcut P of a crest separator X ∈ S if C is the one of the two (S, ϕ)-components containing a top edge of X that is contained in D. A set P of pseudo shortcuts of crest separators in S is consistent w.r.t. S if, for each pseudo shortcut P contained in P the following holds: If P has a subpath P ′ such that (1) P ′ is a pseudo shortcut of a crest separator X′ ∈ S and (2) the vertex sets of P ′ and X are weakly disconnected by the vertex set of X′, then P ′ is also contained in P. Intuitively speaking, condition (2) guarantees that P ′ is not a pseudo shortcut on the wrong side of X′. If S is clear from the context, we call P simply consistent. The consistence graph of a consistent set P of pseudo shortcuts is a directed graph whose node set consists of the pseudo shortcuts P ∈ P and whose edge set has an edge from a pseudo shortcut P ∈ P to a pseudo shortcut P ′ ∈ P of a crest separator X′ 6= X if and only if (1) P ′ is a subpath of P and (2) the root component of P ′ is a neighbor of the root component of P in the mountain connection tree. 25 For the next lemma keep in mind that G is weighted ℓ-outerplanar; in par- ticular, all crest separators have weighted length at most 2ℓ. Lemma 4.12. Let d ≤ ℓ and M = (G, ϕ, c,H,S). Then a consistent d-bounded M-shortcut set P and the consistence graph of P can be constructed in O(Hℓ3+ V ℓ)-time. Within the same time one can determine the root component of each pseudo shortcut in P. Proof. We already know that we can compute the mountain connection tree T of (G, ϕ, c,H,S) in O(V ℓ) time (Lemma 3.13). We then root T and compute the pseudo shortcut sets in a bottom-up traversal of T followed by a top-down traversal. Roughly speaking, the bottom-up traversal computes the pseudo shortcut sets for the (X, ϕ)-components below crest separators X whereas the top-down traversal computes the pseudo shortcut sets for the (X, ϕ)-components above crest separators X. More precisely, let us assume that in the bottom-up traversal of the mountain connection tree, we want to compute a D-pseudo shortcut set for a crest-separator X0 such that D consists of the union of (S, ϕ)- components of a complete subtree of the mountain connection tree. Let us define C, C0, C1, . . . , Cj, X0, . . . , Xj, and D, D1, . . . , Dj in the same way as as strictly before Definition 4.9. Then we can assume that we have already computed a Di-pseudo shortcut set named L(Di) for Xi for all i ∈ {1, . . . , j}. If X0 has an interior lowpoint and does not enclose C, by definition of the pseudo shortcuts, there are no D-pseudo shortcuts of X0, i.e., the D-pseudo shortcut set L(D) for X0 is empty. Otherwise, we determine the set by using a single-source shortest path algorithm for each vertex s of X0 as source vertex on the vertex-and-edge-weighted graph C′ described in the next paragraph. In contrast to the rest of the paper, in this proof we consider also graphs with both, vertex and edge weights. We define the weighted length of a path in a graph with vertex and edge weights as the total sum of the weights of the vertices and edges of the path. In addition, the distance of two vertices in a graph (with or without edge weights) is the minimal weighted length of a path connecting the vertices. Note that the classical Dijkstra-algorithm [9] can be easily modified to compute the distances from a source vertex to all other vertices in a graph with vertex and edges weights in time linear to the size of the given graph plus the maximal number of different considered distances during the computation. In the same time, the algorithm can additionally compute a so-called shortest-path tree that, given a vertex t, allows us to find a path of shortest weighted length connecting the source vertex and t in a time linear to the number of vertices of the path. The graph C′ is obtained from ext(C,S) by deleting all vertices of the coast and, for each i ∈ {1, . . . , j} and each nice pseudo shortcut P in L(Di), inserting an edge eP connecting the endpoints of P . We say that eP represents P . The weight of a vertex is equal to its weight in G. Whereas the weight of each edge of ext(C,S) is zero, the weighted length for an edge representing a pseudo shortcut is equal to the weighted length of the pseudo shortcut plus ǫ minus the weights of its endpoints, where ǫ = 1/(2ℓ) is a small penalty that makes a shortest weighted path with many pseudo shortcuts a little bit more expensive than a shortest weighted path with fewer pseudo shortcuts. We subtract the weight of its endpoints since they are already taken into account as weights of the endpoints. Note that, for each D-pseudo shortcut P of X0, the integer parts of the distances of the two endpoints of P in C′ and in D are the same 26 (Lemma 4.10) since P is of length ≤ (2ℓ − 1) so that the sum of the fractional parts is of size ≤ (2ℓ − 1)ǫ < 1. Hence, after running the modified Dijkstra-algorithm O(ℓ) times, we know the distance in D of each pair of vertices s and t of X0. Thus, we can test if their distance is shorter than the weighted length of a crest-separator path of X0 from s to t and if the integer part of their distance is at most d. If both is true, there is a pseudo shortcut connecting s and t of length at most d. Then, using the shortest path tree we compute such a pseudo shortcut P ∗ from a path of shortest weighted length in C′ by replacing each edge eP = {x, y} representing a pseudo shortcut P by P itself. Thereby we also add an edge (P ∗, P ) into the consistence graph of P. Finally, we add P ∗ to the pseudo shortcut set L(D) and store C as the root component of P ∗. Before analyzing the running time, let us define mC ′ to be the number of edges in C′ and nC to be the number of vertices in C. Since all pseudo shortcuts have a weighted length less than 2ℓ-they are shorter than the weighted length of their crest separators-we can terminate every single-source shortest path computation after the computation of all vertices for which the distance to the source vertex is smaller than 2ℓ. Since there are (2ℓ)2 possible distances values to consider, namely 0, ǫ, . . . , (2ℓ − 1)ǫ, 1, 1 + ǫ, . . . , 2ℓ − 1 + (2ℓ − 1)ǫ, and since there are at most ℓ2 edges introduced for the pseudo shortcuts of each crest separator in S, each of the O(ℓ) single source-shortest paths problems on C′ can be solved in O(mC ′ + ℓ2) = O(nC + (j + 1)ℓ2) where j is the degree degT (w) for the node w in T identified with C. Note that the number of nodes in T is O(H). Therefore, the whole bottom-up traversal runs in O(Hℓ3 +V ℓ) time. Afterwards in a top-down traversal, we consider each node C of T with its crest separators X0, . . . , Xj defined as before. Let D′ be the (X0, ϕ)-component not containing C, which is opposite to D, and let D′i (i ∈ {1, . . . , j}) be the (Xi, ϕ)-component containing C, which is opposite to Di. For each such crest separator Xi ∈ {X1, . . . , Xj}, we can compute a D′i-pseudo shortcut set as fol- lows. We first determine q ∈ {1, . . . , j} such that Xq is a crest separator with the largest weighted length among all crest separators in {X ∈ {X1, . . . , Xj} (X has no lowpoint) or (X has an exterior lowpoint) or (X encloses C)}. Intuitively, Xq is the crest separator of largest weighted length among the crest separators in {X1, . . . , Xj} for which we need to compute pseudo shortcuts. Then, we compute the pseudo shortcut set L(D′q) for Xq analogously as described in the bottom-up traversal. A similar computation for the remaining crest separators Xi ∈ {X1, . . . , Xj}/{Xq} would be correct, however, we have to proceed differently to guarantee the running time of the lemma. Let C′ be the graph obtained from ext(C,S) by deleting all vertices of the coast and adding edges eP for all pseudo shortcuts P in L(D′) ∪ Si∈{1,...,j}\{q} L(Di) such that eP connects the endpoints of P , where L(D′) is the empty set if C is the root of the mountain connection tree. Note that a non-empty pseudo shortcut set L(D′) was computed in the previous step of the top-down traversal whereas all remaining pseudo shortcut sets were already computed during the bottom-up traversal. Assign a weight to each such edge eP that is equal to the weighted length of P plus ǫ minus the weights of its endpoints, where ǫ = 1/(2ℓ). All other edges of C′ have weight 0 and the vertices v of C′ have weight c(v); thus, equal to their weights in G. In C′, determine the distance d(x, y) of x and y for all vertices x ∈ Xq and y of C′. 27 After the computation of these distances we can determine the D′i-pseudo shortcut set in a reduced subgraph Gi for each i ∈ {1, . . . , j} \ {q}. For its definition, let us consider the ({Xi, Xq}, ϕ)-component C∗i that contains the top edges of Xi and Xq. If we remove all vertices of the coast from the plane graph ext(C∗i ,S), the resulting graph is divided into two sides by two ridges connecting the crest H ∈ H contained in C with the crests Hi ∈ H and Hq ∈ H of Ci and Cq, respectively. Vertices of the ridge belong to both sides. More formally, a side is the graph induced by a maximal set of vertices in ext(C∗i ,S) that do not belong to the coast and that are not weakly separated by the vertices part of the two ridges. For an illustration, see Fig. 6. Gi contains the vertices and the edges of Xi and Xq except the vertices belonging to the coast. In addition, Gi has edges between each vertex x on Xq and each vertex y of Xi with x and y being part of the same side of ext(C∗i ,S). We assign to each such edge {x, y} a weight dGi (x, y) = d(x, y)−c(x)−c(y). Recall that Dq is the (Xq, ϕ)-component opposite to D′q. Finally for each pair of vertices x and y of Xq, Gi has an edge {x, y} with weighted length dGi(x, y) = dXq (x, y)− c(x)− c(y), where dXq (x, y) is either ǫ plus the weighted length of a Dq-pseudo shortcut of Xq, if it exists, or otherwise, the weighted length of the crest-separator path of Xq from x to y. For each pair of vertices s1 and s2 on the essential boundary of Xi belonging to different sides of C′, we then determine a path P of shortest weighted length from s1 to s2 in Gi and test whether its weighted length is shorter than the weighted length of the crest-separator path of Xi from s1 to s2 and if the integer part of their distance is at most d. If both is true, we replace each edge {x, y} of P of weighted length dGi(x, y) by a path in D′i with length dGi (x, y) and endpoints x and y. Finally, we add the so modified path P ∗ to the pseudo shortcut set L(D′i) for Xi and store C as root component of P ∗. Moreover, analogously to the bottom-up traversal, if some subpaths of P ∗ result from replacing an edge eP ′ representing a pseudo shortcut P ′ by the pseudo shortcut P ′ itself, we add an edge (P ∗, P ′) into the consistence graph. We next show the correctness of those steps of the top-down traversal that are different from those of the bottom-up traversal. As mentioned above the concatenation R of the ridges between H and Hi and between H and Hq divides C∗i into two sides. If there is a D′i-pseudo shortcut P connecting s1 with s2, this path must lead from the side containing s1 to the other side containing s2. It cannot cross R by Lemma 4.3(b). Hence the only possibility for a pseudo shortcut to change sides is to use a pseudo shortcut of Xq, but not several times because of Lemma 4.3(a). To sum up, P consists of the concatenation of • a path from s1 to a vertex v1 of Xq such that the path is completely X0 b H R s1 s2 Xi C X j R v 2 v 1 X q X 1 Figure 6: Computing a pseudo shortcut for Xi. 28 b b b b contained in the same side as s1, • a pseudo shortcut from v1 to a vertex v2 of Xq that is on the other side • a path from v2 to s2 being completely contained in the same side as s2. Therefore, the construction of Gi implies that, for each D′i-pseudo shortcut P for Xi connecting a vertex s1 and a vertex s2, there is a path from s1 to s2 of the same length as P in Gi. Note also that the distance of two vertices in Gi is never smaller than the distance of that vertices in D′i since each path in Gi can be replaced by a path in D′i with the same endpoints and the same length. Thus, it is correct to use the graph Gi for our computation of a pseudo shortcut set L(D′i) for Xi. Concerning the running time, note that the distances for the edges {x, y} of C′ or of Gi with x and y being endpoints of a pseudo shortcut are already computed during the bottom-up traversal or in a previous step of the top- down traversal (as already mentioned). Recall that j = degT (w). All other distances needed for the construction of all graphs G1, . . . , j can be computed by O(ℓ) single-source shortest paths computations in C′, one for each vertex of Xq as source vertex. If once again, mC ′ and nC are the number of edges of C′ and vertices of C, respectively, each of the O(ℓ) single-source shortest path computations runs in O(mC ′ + ℓ2) = O(nC + (j + 1)ℓ2) time. Each subgraph Gi consists of O(ℓ2) edges, and we have to consider only 4ℓ2 distances values. Thus, the O(ℓ) single-source shortest path computations on all graphs G1, . . . , Gj run in total time O(j · ℓ(ℓ2 + 4ℓ2)) = O(j · ℓ3). Consequently, the whole top-down traversal can be done in O(Hℓ3 + V ℓ) time. (cid:3) 5 Computing Coast Separators In this section we want to show how one can construct a set of pairwise non- crossing coast separators such that the inner graphs of the coast separators contain all crests of 'large' height. For this purpose, we use coast separators of three different types and for each such type we present at least one central technical lemma that helps us to guarantee the disjointness of the constructed coast separators. Recall that cmax is the maximum weight over all vertices. Take k ∈ IN . Let (G+, ϕ+, c+) be a weighted, almost triangulated, and biconnected plane graph with treewidth k′ ≤ k, where ϕ+ is a (2k + 2cmax)- weighted-outerplanar embedding. Moreover, let (G, ϕ, c) be the weighted, al- most triangulated, and biconnected plane graph obtained from (G+, ϕ+, c+) as follows: each maximal connected set of vertices whose height interval contains a value of size at least k + 2cmax is merged to one vertex with a weight equal to k + 2cmax + 1 minus the smallest lower height among the merged vertices. This means that each merged vertex has a lower height equal to the smallest lower height among the vertices in G+ merged to this vertex and upper height k + 2cmax. Let H be the set of those merged vertices that are obtained from merging a set of vertices that contains a vertex of of G+ with upper height 2k + 2cmax. Note that H is a set of different crests in (G, ϕ, c). In the following, assume that we are given the integer k and, beside the graph (G, ϕ, c) and the crest set H, a set S of crest separators such that (G, ϕ, c,H,S) is a good mountain structure as well as the mountain connection tree T of this good mountain structure. 29 Enclosing crest separators. The first type of coast separators that we use is a cycle induced by the essential boundary of a crest separator with an interior lowpoint. The following lemma describes an important property for these kind of coast separators: Lemma 5.1. An (S, ϕ)-component C can not be enclosed by more than one crest separator with a top edge in C. Proof. Assume that there are two crest separators X1 and X2 enclosing C that have a top edge in C. Let Ii (i ∈ {1, 2}) be the inner graph of the essential boundary of Xi. If X1 encloses C, then the top edge e2 of X2 is part of I1, but not part of the essential boundary of X1. By definition of the down paths the essential boundary of X2 cannot cross the essential boundary of X1. Thus, I2 is a subgraph of I1. Moreover, since the top edge e1 of X1 can not be an edge of X2, edge e1 can not be part of I2. Then X2 can not enclose C since C contains e1. (cid:3) Composed cycles. The next two lemmas describe important properties of pseudo shortcuts and composed cycles. A composed cycle is the second type of coast separators that we use. Lemma 5.2. Let P be a D-pseudo shortcut for a crest-separator path X CP of a crest separator X ∈ S with an (X, ϕ)-component D. For the (S, ϕ)-component C containing the top edge of X and being contained in D, the composed cycle of (X CP, P ) encloses the crest in H contained in C. Proof. We define C′ to be the (S, ϕ)-component different from C containing the top edge of X. H and H′ should denote the crests in H contained in C and C′, respectively. Let R be a ridge between H and H′. Since P and R cannot cross (Lemma 4.3(b)), the composed cycle of (X CP, P ) encloses H. (cid:3) Lemma 5.3. Let C0, C1, . . . , Cr consecutive nodes of a path in the mountain decomposition tree of (G, ϕ, c,H,S), and, for i ∈ {1, . . . , r}, let Xi be the crest separator with a top edge in Ci−1 and Ci (compare Fig. 7). Moreover, let D1 be the (X1, ϕ)-component containing C1, and let D′r be the (Xr, ϕ)-component con- taining Cr−1. Then, for a nice D1-pseudo shortcut P1 of X1 that is completely contained in D′r and for a nice D′r-pseudo shortcut Pr of Xr that is completely C0 C1 Ci Cr P1 X1 Xi P2 Xr Figure 7: The (S, ϕ)-components and crest separators described in Lemma 5.3. 30 contained in D1, there exists an i ∈ {2, . . . , r−1} such that P1 is completely con- tained in the (Xi, ϕ)-component containing C1 and Pr is completely contained in the (Xi, ϕ)-component containing Cr−1. Proof. For i ∈ {2, . . . , r − 1}, let Di be the (Xi, ϕ)-component containing Ci, and let D′i be the (Xi, ϕ)-component containing Ci−1. Assume that the lemma does not hold, i.e., for at least one i ∈ {1, . . . , r − 1}, P1 must have a maximal (Di, Xi)-subpath P ∗1 and Pr a maximal (D′i+1, Xi+1)-subpath P ∗r . Let us assume w.l.o.g. that we have chosen i as large as possible. Since P1 and Pr are nice, P ∗1 and P ∗r also define nice pseudo shortcuts and together with the crest separator paths between their endpoints enclose H (Lemma 5.2). Hence, P1 together with the crest separator path between its endpoints also encloses H and, since we have chosen i as large as possible, P1 is completely contained in D′i+1 whereas P ∗r together with the crest separator path between its endpoints encloses H (Lemma 5.2) and is completely contained in D1 (see also Fig. 8). Hence P1 and P ∗r intersect. As illustrated in Fig. 8. one can interchange subpaths of P1 with subpaths of P ∗r of the same length such that afterwards the inner graphs of the new composed cycles do not intersect anymore except in some common vertices of the old paths P1 and P ∗r and such that the new composed cycles do not enclose the crest H anymore. In the case of the modified version of P ∗r , this is a contradiction to Lemma 5.2. (cid:3) P1 P ∗r H P ′1 P ′r H ⇒ X1 Xi+1 X1 Xi+1 Figure 8: The interchange of a subpath of P1 with a subpath of P ∗r . Let M = (G, ϕ, c,H,S). For a d-bounded M-shortcut set P, let us define a valid d-bounded M-shortcut set to be a subset P′ of P such that, for each (S, ϕ)-component C, for which there is at least one crest separator X ∈ S with a top edge in C that has a D-pseudo shortcut in P for the (X, ϕ)-component D containing C, P′ contains at least one D′-pseudo shortcut for a crest separator X′ ∈ S with a top edge in C where D′ is the (X′, ϕ)-component containing C. Roughly speaking, each (S, ϕ)-component C with a d-bounded pseudo shortcut has a d-bounded pseudo shortcut in P′. If "at least one" in the above definition is replaced by "exactly one", the valid d-bounded M-shortcut set is also called non-overlapping. We next show that such a shortcut set can be computed efficiently. Lemma 5.4. Given a consistent d-bounded M-shortcut set, the consistence graph of P as well as, for each pseudo shortcut P ∈ P, its root component, a consistent non-overlapping d-bounded M-shortcut set can be constructed in O(Hk2) time. Proof. Let us call a vertex of a directed graph to be a source if it has no incoming edge. If F is the consistence graph of P, we repeatedly apply the following step. 31 b b Take a not-yet-considered source P of F , and let C be the root component of P . If there is another pseudo shortcut with root component C, then remove P from P and F . The existence of P ′ guarantees that the new set P is still valid. Since we only remove sources of F , the new set is also consistent. Thus, apart from the running time, we only have to show that, after having applied the above removal step as long as possible, we obtain a non-overlapping set of pseudo shortcuts. Therefore, let us assume that after the removal steps there is still one (S, ϕ)-component C for which there are two different crest separators X′1 and X′2 with top edges in C such that, for the (X′1, ϕ)-component D′1 and the (X′2, ϕ)-component D′2 containing C, there exist a D′1-pseudo shortcut P ′1 of X′1 and a D′2-pseudo shortcut P ′2 of X′2 in P. Then neither P ′1 nor P ′2 can be a source of F since, otherwise, the removal step could be applied once more. Hence, let P1 and P2 be sources of F for which there are paths from P1 to P ′1 and from P2 to P ′2 in F . In particular, this means that P ′1 is a subpath of P1 and P ′2 a subpath of P2 in G. Let X1 and X2 be the crest separators such that P1 and P2 are pseudo shortcuts of X1 and X2, respectively. Since the removal step was applied as long as possible, for the root component of P1 and equivalently for that of P2, there is exactly one crest separator X with a pseudo shortcut in the (X, ϕ)-component containing the root component of P1, namely X = X1 and equivalently-concerning the root component of P2-we have X = X2. Hence Pi (i = 1, 2) is completely contained in the (X3−i, ϕ)-component that contains C. Since Pi with its subpath P ′i encloses the crest in C (Lemma 5.2), there is no crest separator disconnecting P1 and P2; a contradiction to Lemma 5.3. Note that no source has to be considered a second time; if a source can not be removed because of a missing second pseudo-shortcut in an (S, ϕ)-component, then this is the case until the end of the algorithm. Consequently, the running time is linear in the number of pseudo shortcuts if, for each source of F , we can decide whether it has to be removed in constant time. For that we store initially with each (S, ϕ)-component C the number nC of pseudo shortcuts with root component C. If such a pseudo shortcut is a source in F and removed by the algorithm, we decrease nC by one. The update caused by a removal of a pseudo shortcut then can be done in constant time. The decision whether a pseudo shortcut P has to be removed reduces to the question whether nC is greater than one for the root component C of P . This is correct because of the following: If there is another pseudo shortcut P ′ that allows us to remove P , then a subpath of P ′ is a pseudo shortcut with root component C, i.e., nC is indeed greater than one. The initialization of all numbers stored with the components can be done in O(P) time. So the whole running time is bounded by O(P) = O(Hk2). (cid:3) Minimal coast separators. The third type of coast separators that we use are minimal coast separators. Such coast separators are used in a special kind of (S, ϕ)-components defined now. An (S, ϕ)-component C is called pseudo shortcut free if (1) C is not enclosed by a crest separator in S with a top edge in C and an interior lowpoint and (2) for all crest separators X ∈ S with a top edge in C and the (X, ϕ)-component D containing C, there is no D-pseudo shortcut of weighted length ≤ k − 1 for X. 32 Moreover, let us define a crest separator to be pseudo shortcut free if it has neither a pseudo shortcut of weighted length ≤ k − 1 nor an interior lowpoint. Intuitively speaking, a pseudo shortcut is of interest if it is possibly part of a coast separator of weighted size at most k. This is the reason why we only consider pseudo shortcuts of weighted length ≤ k − 1. As the next lemma shows, pseudo shortcut free components are separated by pseudo shortcut free crest separators. Lemma 5.5. Let H′, H′′ ∈ H be crests of different pseudo shortcut free (S, ϕ)- components. Let S′ ⊆ S be the set of pseudo shortcut free crest separators. Then there is a crest separator in S′ strongly going between the crests. In particular, a minimal coast separator for H′ of weighted size ≤ k can only enclose those crests in H that are part of the (S′, ϕ)-component that contains H′. let C0, . . . , Cr be the (S, ϕ)-components on Proof. As illustrated in Fig. 9, the path in the mountain connection tree T of (G, ϕ, c,H,S) from the (S, ϕ)- component C0 containing H′ to the (S, ϕ)-component Cr containing H′′. For i ∈ {1, . . . , r}, let Xi ∈ S be the crest separator with a top edge part of both Ci−1 and Ci. First note that no crest separator X ∈ {X1, . . . , Xr} can have an interior lowpoint. Otherwise, such a crest separator would enclose either C0 or Cr. This would imply that either X1 encloses C0 and has an interior lowpoint or Xr encloses Cr and has an interior lowpoint. This contradicts our choice of C0 and Cr as pseudo shortcut free (S, ϕ)-components. For i ∈ {1, . . . , r}, let Di be the (Xi, ϕ)-component that contains Cr. Take Xi as the first crest separator in X1, . . . , Xr with no Di-pseudo shortcut of weighted length ≤ k − 1. Xi exists since Xr has no Dr-pseudo shortcut of weighted length ≤ k − 1. Then Xi also has no pseudo shortcut for the (Xi, ϕ)- component opposite to Di. This follows either from the fact that C0 is pseudo shortcut free if i = 1 and from Lemma 5.3 otherwise. Hence Xi is pseudo C0 C1 C2 Ci-1 Cr X1 X2 Xi−1 Xi Xr Figure 9: A path P in the mountain connection tree T of the mountain struc- ture (G, ϕ, c,H,S) with the crest separators X1, . . . , Xr between the (S, ϕ)- components corresponding to the nodes of P . If in the figure a curve represent- ing a pseudo shortcut P together with its crest-separator path X CP encloses a node representing an (S, ϕ)-component C, this should mean that at least some vertices of C are enclosed by the composed cycle of (X CP , P ). 33 shortcut free. Finally note that a minimal coast separator of weighted size ≤ k for H′ can only enclose those crests in H that are part of the (S′, ϕ)-component that contains H′, since, otherwise, it must cross a crest separator X in S′ and X then has a pseudo shortcut of weighted length ≤ k − 1 by Lemma 4.5. (cid:3) We next show that minimal coast separators can be computed efficiently. Lemma 5.6. There is an algorithm that computes a minimal coast separator Y for a given crest H in a weighted, almost triangulated graph (G, ϕ, c) in O(nw(Y )) time where n is the number of vertices of G and w(Y ) is the total weight of the vertices in Y . Proof. In an unweighted graph G′ = (V ′, E′), by network flow theory, one can construct a separator Y ′ of minimal size for two connected sets S and T as follows: Construct a graph G+ = (V +, E+) obtained from the following steps and sketched in Fig.10. First, merge the vertices of S and T to two single vertices s and t, respectively. Second, replace each undirected edge {u, v} by two directed edges, one leading from u to v and the other from v to u. Third, split each original vertex v of G′ into an invertex vi and an outvertex vo such that each directed edge originally ending in v afterwards ends in vi and each directed edge originally starting in v afterwards starts in vo, and add an edge from vi to vo. Afterwards, compute a maximal set P of edge-disjoint paths from so to ti in G+. Let E(P) be the set of the edges that are used by the paths in P. Then construct the so-called residual graph GR = (V R, ER) of G+ defined as the graph obtained from G+ by replacing each edge e ∈ E(P) by an edge in reverse direction. Define U + to be the set that consists, for each path P ∈ P, of the last vertex of P that is reachable from so in GR. Note that U + must be a set of invertices because of the following Fact 1-consider also Fig. 11: the only incoming edge of an outvertex vo in GR belonging to a path P ∈ P is a reverse edge of P that starts in an invertex appearing after vo on P . By network flow theory it is well known that the set U obtained from U + by replacing each t ti to s si so Figure 10: Vertex-disjoint path from s to t in the left graph can be found by finding edge-disjoint path from so to ti in the right graph. The squared vertices represent outvertices. 34 vertex in U + by its original vertex is a separator of minimal size in G′. Indeed, every separator must contain at least one original vertex for every path in P and it is easy to see that after the removal of the vertices in U + from G+, there is no path from so to ti in G+ anymore, and that this implies that G′ has no path from a vertex in S to a vertex in T after the removal of the vertices in U . For each separator W of minimal size for the two connected sets S and T , let us define CC(W ) as the set of vertices that are in the same connected component as the vertices of S in G′[V \ W ]. We now show that U is an S- minimal separator, i.e., CC(U ) ⊆ CC(W ) for all separators W of minimal size for S and T . Hence, assume for a contradiction that this does not hold for such a separator W . Let W + be the vertex set obtained from W after replacing each vertex w ∈ W by the invertex wi. Note that W + must contain exactly one vertex on each path of P since P = W. By our choice of W , there must be at least one path P ′ ∈ P for which the invertex ui of U + on P ′ appears after the invertex wi in W + on P ′. Let P be a path in GR from so to ui, and let P be the subpath of P ending in the first vertex v1 of P that appears on a path in P after a vertex of W +. (Possibly, v1 = ui.) See also Fig. 11. Note that v1 must be an invertex (Fact 1). Let us now consider the last vertex v2 on P appearing before v1 on one of the paths in P. (Possibly, v2 = so.) Vertex v2 must be an outvertex because of a reason similar to Fact 1. Let P1 and P2 be the paths of P containing v1 and v2, respectively. Since the only incoming edge of v2 in GR is a reverse edge of P2, v2 must appear strictly before the only vertex of W + on P2. Consequently, the subpath of P2 from so to v2 and the subpath of P1 from v1 to ti are paths in G+ that do not contain any vertices of W +. The same is true for the subpath of P from v2 to v1 since the inner vertices of this subpath are not part of any path in P. Hence, there is a path from so to ti in G+ not containing any vertex of W +. By replacing the in- and outvertices of these paths by the original vertices, wi ui so v1 ti v2 Figure 11: A part of the residual graph GR. Each straight line between two vertices of the figure represents a reverse edge of a path in P. The squared ver- tices represent outvertices. The light or dark colored vertices are the vertices of U + and W +, respectively. The bold curves together with the bold reverse edges define the path P , where the dashed curves and edges represent the subpath P of P . 35 we obtain a path from a vertex in S to a vertex in T in G′ not containing any vertex of W . This is a contradiction to our choice of W as a separator and means that U is indeed S-minimal. If we are given a weighted, almost triangulated graph (G, ϕ, c) with G = (V, E), we can generalize the approach above to find a minimal coast separator for a set H: First, replace each vertex v of G by c(v) copies. For each edge {u, v} of G, add an edge between each copy of u with each copy of v. Let G′ = (V ′, E′) be the unweighted graph obtained. Define S to be the vertex set consisting of the copies of the vertices of H, and let T be the vertex set consisting of the copies of the vertices of the coast. Then construct a separator Y ′ strongly disconnecting S and T as above. Let Y be the set of vertices of G whose copies are all in Y ′. Then Y is an H-minimal separator. By the fact that G is almost triangulated, Y is a minimal coast separator for H in G. For an efficient implementation, there is no need to replace (G, ϕ, c) by an unweighted graph. Instead, we use classical network flow techniques to construct a maximum number of paths connecting a vertex of H and a vertex of H′ such that each vertex v /∈ H ∪ H′ is part of at most c(v) paths and then read of a separator from these paths in a similar way as described above. Since we can construct each path in O(n) time, and since we have to construct O(w(Y )) paths, we can compute a minimal coast separator in O(nw(Y )) time. (cid:3) Algorithm. Recall that (G+, ϕ+, c+) is (2k + 2cmax)-weighted-outerplanar. We next present an algorithm to construct a set Y of coast separators of size O(k) for H in (G, ϕ, c). As we will see, these sets also define coast separators for the crests of height 2k + 2cmax in (G+, ϕ+, c+). By Observation 5.7 and Lemma 5.12, we will conclude that each crest in H is enclosed by exactly one coast separator in Y. In Lemma 5.9, we show that the (S, ϕ)-components of the crests enclosed by a coast separator in Y induce a connected subtree of T . Step 1: Run the algorithm from Lemma 4.12 to compute a consistent (k − 1)- bounded M-shortcut set P for M = (G, ϕ, c,H,S), the consistence graph of P and for each pseudo shortcut in P its root component. This subsequently allows us to determine the set S′ of all pseudo shortcut free crest separators in S as well as all (S′, ϕ)-components. For each crest H ∈ H contained in a pseudo shortcut free (S, ϕ)-component contained in an (S′, ϕ)-component C, compute a minimal coast separator YC as follows: Compute first the plane graph (C′, ψ) obtained from the plane graph (C, ϕC ) as follows. For each subsequence of vertices v0, v1, . . . , vq appearing clockwise on the coast of ϕC where only the vertices v0 and vq belong to the coast of ϕ, add an extra vertex v∗ into the outer face of (C, ϕC ) and insert edges from v∗ to each of the vertices v0, . . . , vq so that the outer face of ψ consists of the newly inserted vertices together with the vertices of C that belong to the coast of ϕ. More precisely, in the special case where the coast of ϕC contains no vertex of the coast of ϕ, add a cycle consisting of three new vertices v∗1 , v∗2, v∗3 of weight 1 into the outer face of ϕC and afterwards connect these new vertices to vertices of the coast of ϕC until the graph obtained is almost triangulated. Then, use the algorithm of Lemma 5.6 to construct a minimal coast separator YC for H in (C′, ψ). The existence of YC is shown in Lemma 5.8. After having found 36 YC , determine the inner graph of Y and all crests in H that are part of the inner graph. Add YC to the initial empty set Y. Step 2: Use Lemma 5.4 to construct a non-overlapping consistent (k − 1)- bounded M-shortcut set Z ⊆ P. Initialize E′ as an empty set of directed edges. For each crest H ∈ H that is not enclosed by a coast separator constructed (possibly for some crest H′ 6= H) in Step 1, take C as the (S, ϕ)-component containing H and test whether there is a crest separator X ∈ S with a top edge in C that has an interior lowpoint and encloses C. A: If so, let XC be this crest separator and YC be the cycle induced by edges of the essential boundary of XC . B: Otherwise, define XC to be the crest separator with a top edge in C that has a nice pseudo shortcut P in Z. XC exists since C is not pseudo shortcut free and is unique because Z is non-overlapping. Take X CP C as the crest-separator path of XC such that P is a pseudo shortcut for X CP C and define YC as the composed cycle of (X CP C , P ). Let C∗ be the (S, ϕ)-component that contains the top edge of XC , but is different to C. Finally add a directed edge (C, C∗) to E′ if the following conditions are all satisfied. Condition 1: C∗ has a crest H ∈ H that is not enclosed by a coast separator constructed in Step 1. Condition 2: Either C∗ is not enclosed by XC or XC has not an interior lowpoint. Condition 3: Z does not contain a D∗-pseudo shortcut for XC where D∗ is the (XC, ϕ)-component containing C∗. Intuitively, an edge (C, C∗) indicates the possibility that the coast separator constructed for the crest in C∗ also encloses the crest in C (compare also Lemma 5.11). Step 3: Let F be a graph consisting of that vertices of the mountain connection tree that represent (S, ϕ)-components that have a crest part of H such that the crest is not enclosed by the coast separators constructed in Step 1. The edges of F are the edge set E′ constructed in Step 2. This is a directed forest of intrees since we assigned at most one parent to each (S, ϕ)-component since the unweighted version of the edges are part of a tree, namely the mountain connection tree, and since because of the Conditions 2 and 3, for each pair C1 and C2 of (S, ϕ)-components, there exists at most one of the edges (C1, C2) and (C2, C1). See also Fig. 12 and 13. Then, for each tree T of F run the following substeps: Let H ∈ H be the crest contained in the (S, ϕ)-component C being the root of T . Put YC into Y, determine the inner graph of YC and all crests in H that are part of the inner graph, and remove all nodes from T that are (S, ϕ)-components containing those crests. Then recursively proceed in the same way for each remaining intree being a subgraph of T . Step 4: Return the set Y. 37 Figure 12: A mountain connection tree T of the mountain structure (G, ϕ, c,H,S) and the crest separators in S; the latter denoted by straight lines crossing the edges of the tree. Thick straight lines denote crest separators that are pseudo shortcut free. Squared vertices represent pseudo shortcut free components. The curves denote coast separators constructed for the crests in H that are in the pseudo shortcut free (S, ϕ)-components. If such a curve in the figure encloses some nodes representing an (S, ϕ)-component C, this should mean that the corresponding coast separator encloses the crest in H contained in C. The non-white round vertices are the nodes of the forest F . T ∗ : C1 R C6 C2 C5 C8 C3 C4 C9 C7 C0 CA CB Figure 13: A bold straight line represents a crest separator and a curve together with a straight line represents a cycle: either a composed cycle or an induced cycle (by the edges of the essential boundary of a crest separator). If such a cycle encloses a node being an (S, ϕ)-component C, this should mean that the cycle encloses at least the crest in H that is contained in C. Running the algorithm from above, the cycles YR, YC2, YC3, YC5, YC7 , YCA, and YCB corresponding to the curves starting in the (S, ϕ)-components R, C2, C3, C5, C7, CA, and CB, respectively, are added to Y in Step 3. Afterwards, each node of T is enclosed by a cycle in Y. 38 Analysis of the Algorithm. We now prove properties of the coast sepa- rators constructed by the algorithm above. Observation 5.7. Each crest in H is enclosed by a coast separator of Y. Lemma 5.8. For all crests H ∈ H that are considered in Step 1, there exists a minimal coast separator in the plane graph (C′, ψ) constructed for H. Proof. Let C be the (S′, ϕ)-component that contains H. Since the vertices of the coast have upper height at most cmax and since H has lower height at least k + cmax + 1, by Theorem 2.5, there is a coast separator for H in G of weighted length at most k. Thus, there is also such a coast separator Y that is minimal. Since no crest separator X ∈ S′ encloses C, the (X, ϕ)-component D containing C contains at least one vertex of the coast of G. Hence Y and D are not vertex disjoint. Moreover, by Lemma 4.5, Y can not cross X. Since this holds for all choices of X in S′, Y is completely contained in C. However, Y may contain vertices of the boundary of C (for some appropriate definition of the boundary), which is the reason for running the algorithm of Lemma 5.6 on the plane graph (C′, ψ). (cid:3) Lemma 5.9. For a coast separator Y ∈ Y, let C be the (S, ϕ)-components with the crests in H that are enclosed by Y . Then, C induces a connected subtree of the mountain connection tree of (G, ϕ, c,H,S). Proof. The lemma clearly holds if Y is the essential boundary of a crest separator with an interior lowpoint. So from now on, we only consider the remaining kinds of coast separators. Let Y be a minimum coast separator constructed for a crest H in Step 1. By Lemma 4.5, whenever Y crosses a crest separator X, the part P ′ of Y contained in the (X, ϕ)-component not containing H is a pseudo shortcut for a crest-separator path of X contained in the inner graph of Y . Analogously, let P be a nice pseudo shortcut taken for the construction of a composed cycle Y as a coast separator for a crest H′ in Step 2. Since P is nice, whenever P crosses a crest separator X, the part P ′ of Y contained in the (X, ϕ)-component not containing H′ is a pseudo shortcut. The lemma now follows from Lemma 5.2 and the fact that each coast sepa- rator enclosing two crests in H contained in different (S, ϕ)-components C1 and C2 must cross all crest separators separating two consecutive (S, ϕ)-components on the path from C1 to C2 in the mountain connection tree. (cid:3) We next want to show that no crest H ∈ H is enclosed by more than one coast separator in Y. We start with two auxiliary lemmas. Lemma 5.10. Let C∗ be an (S, ϕ)-component with a crest H∗ ∈ H. If YC ∗ is added to Y in Step 3 and if YC ∗ encloses a crest H′ ∈ H in an (S, ϕ)-component C′, then H′ is neither part of a pseudo shortcut free (S, ϕ)-component nor en- closed by a coast separator constructed for a crest in Step 1. Proof. The fact that YC ∗ encloses H′ implies that H′ can not be part of a pseudo shortcut free (S, ϕ)-component. Assume now that a coast separator YC constructed for a crest H ∈ H in a pseudo shortcut free component C encloses H′ and assume w.l.o.g. that H′ is chosen as a crest enclosed by YC ∗ with this property such that the distance between the (S, ϕ)-components C′ and C∗ is 39 as small as possible. Then, H∗ 6= H′ since, otherwise, YC ∗ would not be added to Y in Step 3. Moreover, YC ∗ can not be the essential boundary of a crest separator with an interior lowpoint. Otherwise, for the subtree T ′ of T with root C∗ that contains C′, all its (S, ϕ)-components are enclosed by a crest separator with an interior lowpoint. Since YC enclosing H′ but not H∗ implies that C is in T ′, we then obtain a contradiction to the fact that C is pseudo shortcut free. Thus, YC ∗ is a cycle consisting of some nice pseudo shortcut P ′ with its crest-separator path. See Fig. 14. Let X be the crest separator with a top edge in C disconnecting H and H′, and let D be the (X, ϕ)-component containing C′. YC as a minimal coast separator has a D-pseudo shortcut P of X for a crest-separator path of X contained in the inner graph of YC as a subpath (Lemma 4.5). Moreover, let X′ be the crest separator with a top edge in C′ disconnecting H∗ and H′, and let D′ be the (X′, ϕ)-component containing C′. Note that X′ 6= X since we have chosen H′ in such a way that C′ and C∗ have minimal distance. Since P ′ is nice, a subpath P ′′ of P ′ is a D-pseudo shortcut for X′ for a crest-separator path of X′ contained in the inner graph of YC ∗ . The existence of P and P ′′ is a contradiction to Lemma 5.3. For that also note that P does not cross X′ since H′ was chosen such that the distance between C′ and C∗ is as small as possible, and P ′′ does not cross X since C is pseudo shortcut free. (cid:3) Lemma 5.11. Let C and C∗ be two (S, ϕ)-components whose crests in H are not enclosed by a coast separator constructed in Step 1. If the coast separator YC ∗ for the crest H∗ ∈ H in C∗ encloses the crest H ∈ H in C, then the directed forest F constructed by our algorithm has a directed path from C to C∗. Proof. Assume that YC ∗ encloses H. Let C0 = C, C1, . . . , Cr = C∗ be the path in the mountain connection tree connecting C and C∗. For i ∈ {1, . . . , r}, let Xi ∈ S be the crest separator with a top edge part of both Ci−1 and Ci. The situation is sketched in Fig. 9, but this time, ignore the shown pseudo shortcuts. Then, the crest Hi ∈ H in Ci (i = {0, . . . , r}) is enclosed by YC ∗ (Lemma 5.9), but are neither part of a pseudo shortcut free (S, ϕ)-component nor enclosed by a coast separator constructed in Step 1 (Lemma 5.10). Thus, Condition 1 in Step 2 holds for all edges (Ci, Ci+1) (i = {0, . . . , r − 1}). Let D be the (S, ϕ)- component of XC ∗ containing C∗, where XC ∗ is the crest separator defined for C∗ in Step 2. We first consider the case where YC ∗ is defined in Step 2.A, i.e., YC ∗ is the essential boundary of the crest separator XC ∗. Then, Xi+1 (i ∈ {0, . . . , r − 1}) has an interior lowpoint and encloses Ci, but not Ci+1 (Condition 2 holds). Moreover, the D∗-pseudo shortcut set for Xi+1 is empty by the definition of C∗ H∗ P ′ C′ H′ P ′′ X′ P C H YC X Figure 14: Coast separators constructed in Step 1 and in Step 2 enclosing a crest H′. 40 b b b pseudo shortcuts, where D∗ is the (Xi+1, ϕ)-component containing Ci+1 (Con- dition 3 holds). As a consequence, our algorithm adds edges (Ci, Ci+1) to F for all i = {0, . . . , r − 1}. Next, we consider the case where YC ∗ is defined in Step 2.B, i.e., YC ∗ is the cycle consisting of some nice D-pseudo shortcut P ′ with its crest-separator path of a crest separator Xr+1 with a top edge in Cr. Note also that either Ci (i = {1, . . . , r}) is not enclosed by Xi or Xi has no interior lowpoint (Condition 2 holds) since, otherwise, C∗ would be also enclosed by Xi and Xr and hence defined in Step 2.A. For each crest separator Xi+1 (i = {1, . . . , r}), a subpath P of P ′ is a D′-pseudo shortcut where D′ is the (Xi+1, ϕ)-component containing Ci. Since P ′ is a pseudo shortcut in Z and since Z is consistent, the subpath of P ′ starting and ending on Xi+1 is a pseudo shortcut in Z. Since Z is also non-overlapping, Xi+1 is the only crest separator with a top edge in Ci that has pseudo shortcuts, i.e., Condition 3 is satisfied for the edge (Ci−1, Ci), i.e., our algorithm adds edges (Ci, Ci+1) to F for all i = {0, . . . , r − 1}. Lemma 5.12. No crest H ∈ H is enclosed by more than one coast separator in Y. Proof. A coast separator constructed in Step 1 can not enclose a crest in H that is also enclosed by another coast separator added to Y in Step 1 (Lemma 5.5) or in Step 3 (Lemma 5.10). By Lemma 5.11, a crest in H can not be enclosed by two coast separators in Y that are constructed for (S, ϕ)-components part of two different trees of F . By our choice of directing the edges of E′ in Step 2, each coast separator YC for a crest H ∈ H contained in an (S, ϕ)-component C of a tree T of F can only enclose (S, ϕ)-components below C in T . By Lemma 5.9 the (S, ϕ)-components of T with the crests in H that are enclosed by YC induce a connected subtree of T . Therefore, two coast separators constructed in Step 2 for the same tree T and added to Y in Step 3 cannot enclose the same crest. (cid:3) (cid:3) Finally, we analyze the running time. Take G = (V, E). Recall that G is O(k)-weighted outerplanar and that (G, ϕ, c,H,S) is a good mountain structure for (G, ϕ, c). Lemma 5.13. The algorithm for computing the set Y runs in O(Hk3 + V k) time. Proof. By Lemma 4.12, we can construct a consistent (k − 1)-bounded M- shortcut set in O(Hk3 + V k) time. Clearly within the same time, for each (X, ϕ)-component D, we can decide whether the D-pseudo shortcut set is empty and whether the essential boundary of X can be used as a coast separator, i.e., whether X has an interior lowpoint. Hence, again within in the same time we can determine the subset S′ of all pseudo shortcut free crest separators in S, all pseudo shortcut free (S, ϕ)-components as well as all (S′, ϕ)-components. A minimal coast separator for a crest H ∈ H of a pseudo shortcut free (S, ϕ)- component contained in an (S′, ϕ)-component C can be computed in O(n′k) time (Lemma 5.6) where n′ is the number of vertices of C. In the same time, we can determine the inner graph of YC , all crests in H that are part of the inner graph, and the set of (S, ϕ)-components containing them. Therefore the running time of Step 1 is bounded by O(Hk3 + V k). 41 To test whether an (X, ϕ)-component has an interior lowpoint can be done in O(k) time for each of the O(V ) crest separators. Since the set Z can be constructed in O(Hk2) time and since F consists of O(V ) nodes, it is easy to run Step 2 in O(V k + Hk2) time. The construction of the inner graphs of all coast separators YC added to Y in Step 3 as well as the removal of all (S, ϕ)-components C with crests in H that are part of such an inner graph can be done by a depth-first search in the inner graph of YC and the running time can be bounded by the number of edges of the (S, ϕ)-components removed. Since each removal of crest separator removes a disjoint set of (S, ϕ)-components (Lemma 5.12), the running time of Step 3 is bounded by O(V k). (cid:3) Note that the coast separators constructed in Step 1 have weighted size at most k, whereas the coast separators taken in Step 3 can have a weighted size of at most 3k + 4cmax − 5 since the down paths of each crest separator X ∈ S can have a weighted length of at most k + 2cmax − 1, since a pseudo shortcut does not start and end with a vertex of the coast (which reduces the length of a subpath of a down path that can be part of a coast separator by 1), and since the pseudo shortcuts that we use have weighted length ≤ k − 1. Let n be the number of vertices of G+. Since each crest H ∈ H of G is obtained from a merge of at least ⌈k/cmax⌉ vertices in G+, and since k ≥ cmax if n ≥ 2, we have H ≤ n · cmax/k if n ≥ 2. For each H ∈ H, let us choose one crest of height 2k + 2cmax in (G+, ϕ+, c+) that is merged into H. Define H+ as the set of chosen crests. Note that with (G, ϕ, c,H,S) being a good mountain structure (G+, ϕ+, c+,H+,S) must also be a good mountain structure. Then, the next corollary summarizes the results of the current section, where the function m simply maps each coast separator Y to the (S, ϕ)-components whose crests are enclosed by Y . Corollary 5.14. Assume that we are given the integer k, the (2k + 2cmax)- weighted-outerplanar graph (G+, ϕ+, c+), and the set H+ of crests of height 2k + 2cmax as defined before. Then, in O(nk2cmax) time, one can construct a good mountain structure M = (G+, ϕ+, c+,H+,S), the mountain connection tree T for M, a set Y of coast separators in G+, for each Y ∈ Y, the inner graph I of Y and the corresponding embedding ϕI such that the properties below hold. (i) For each crest H of height 2k + 2cmax in G+-with H not necessarily being contained in H+-there is exactly one coast separator Y ∈ Y for H of weighted size at most 3k + 4cmax − 5. (ii) For each pair of crests of height 2k + 2cmax in G+, the crests are either part of the inner graph of one Y ∈ Y or there is a crest separator X ∈ S strongly going between the crests. (iii) There is a function m mapping each Y ∈ Y to a non-empty set of (S, ϕ+)- components such that – the elements of m(Y ) considered as nodes of T induce a connected subgraph of T , – the subgraph of G+ obtained from the union of all (S, ϕ+)-components in m(Y ) contains the inner graph IY of Y as a subgraph, 42 – the set m(Y ) does not have any (S, ϕ+)-component as an element that is also an element in m(Y ′) for a coast separator Y ′ ∈ Y with Y ′ 6= Y . 6 A Tree Decompositions for the Components We first describe an algorithm for constructing a tree decomposition of width 3ℓ − 1 for a weighted almost triangulated ℓ-outerplanar graph. Then we modify the algorithm such that, given a weighted graph (G, ϕ, c), S ⊆ S(G, ϕ, c), and an (S, ϕ)-component C, it constructs a tree decomposition for ext(C,S) of width at most 3ℓ− 1 with the following property: For each crest separator X ∈ S with a top edge in C, there is a bag containing all vertices of X. It is easier to construct such a tree decomposition if the following neighbor- hood property holds. (N) For each vertex v, there is at most one vertex u with u↓= v. Starting with an almost triangulated weighted ℓ-outerplanar graph ( G, ϕ, c) as an intermediate goal, we want to transform it in such a way into an ℓ- outerplanar weighted plane graph (G, ϕ, c) with the neighborhood property (N) that a tree decomposition for G can be easily obtained from a tree decomposition for G. The idea is to compute G as a reverse minor of G, i.e., G can be obtained from G by iteratively merging adjacent vertices and/or by removing vertices. In order to guarantee property (N), we start our transformation by splitting each vertex v into a path as it is sketched in Fig. 15. More precisely, iterate over the vertices v with non-increasing lower height. We consider only the more interesting case where h−ϕ (v) ≥ 2. Let u = v↓. Let {v, u},{v, u1}, . . . ,{v, ud} be the edges incident to v in the clockwise order in which they appear around v. Then v is replaced by a series of vertices v1, . . . , vd with v1 being incident to u1 and v2, whereas vd is incident to vd−1 and ud, and for i ∈ {2, . . . , d − 1}, vi is incident to vi−1, vi+1, and ui. We finally connect all vertices v1, . . . , vd to u by an edge. The vertices v1, . . . , vd are then called the copies of v. We finally define the weight of the copies of a vertex v as the weight of v. Let (G, ϕ, c) be the weighted plane graph obtained. Thus, the copies of v have the same height interval as v itself, and G is weighted ℓ-outerplanar. Note that strictly speaking no down vertices and down edges are defined in G since down vertices v1 v2 v3 v4 v5 v ⇒ u u Figure 15: The replacement of a vertex v. Let u = v↓. The vertices v1, . . . , v5 are the copies of v. 43 where only defined for almost triangulated graphs. Thus, if we refer to a down edge {ui, vj} in G for vertices ui and vj being copies of vertices u and v in G, we mean that {u, v} is a down edge in the original graph. By our construction every vertex ui in G being a copy of a vertex u in the original graph is then incident to at most one down edge with another endpoint of larger height-so that property (N) holds-and exactly one down edge with another endpoint of lower height. The endpoint of the latter edge is then defined to be the down vertex ui↓ of ui, which then is also a copy of u↓. Moreover, the down path of ui, defined similarly as for almost triangulated graphs, then consists of copies of the vertices of the down path from u. However, different copies ui and uj in G of the same vertex u in G have vertex-disjoint down paths in G. We next want to bound the number of edges of G with respect to the number of edges of G. Note that, for each edge incident to a vertex v, but not being the down edge of v, the splitting of v introduces a new copy vi of v and up to two additional edges into G connecting vi to the down vertex of vi and to a previous copy vi−1 of vi, respectively. One of them namely, the down edge of vi will recursively cause further splittings along the down path of vi so that altogether one edge of the original graph will introduce up to 2ℓ new edges. Consequently, if n is the number of vertices of the original graph, G has O(ℓn) vertices and edges. Lemma 6.1. For each given almost triangulated weighted ℓ-outerplanar graph ( G, ϕ, c) with n vertices, a weighted ℓ-outerplanar graph (G, ϕ, c) can be found in O(nℓ) time such that 1. G is a reverse minor of G, 2. G satisfies the neighborhood property, 3. for each each edge {u, v}, there is an edge connecting a copy ui of u and a copy vi of v in G, and 4. the down paths of ui and vi in G can be obtained from the down paths of u and v, respectively, in G by replacing the vertices of the down paths in G by copies of its vertices in G. We now describe an algorithm to compute a tree decomposition for the weighted ℓ-outerplanar graph (G, ϕ, c) constructed above. Let n be the number of vertices of G and V be the vertex set of G. W.l.o.g., G is biconnected; other- wise, one can compute a tree decomposition for each biconnected component in- dependently and finally connect them. Take S = V \{u↓ u ∈ V and h−ϕ (u) ≥ 2} as illustrated in Fig. 16. As a first step of our computation, we merge each down path starting at a vertex v of S to one vertex v∗ and define the weight of v∗ as h+ ϕ (v). Let (G+, ϕ+, c+) be the graph obtained. Note that h+ ϕ+(v∗), and G+ is weighted ℓ-outerplanar. Since all vertices of (G+, ϕ+, c+) are incident to the outer face, the unweighted version (G−, ϕ−) of (G+, ϕ+, c+) is outerplanar and we find a tree decomposition (T, B) for G− of width 2 as shown by Bodlaen- der [4], i.e., in each bag we have at most 3 vertices. Since each vertex in G+ has a weight of at most ℓ, (T, B) is a tree decomposition for (G+, ϕ+, c+) with bags of size 3ℓ; in other words, (T, B) as a tree decomposition for (G+, ϕ+, c+) ϕ (v) = h+ 44 1 2 3 4 6 7 10 15 8 5 11 16 13 18 21 22 23 12 20 9 14 17 25 19 24 26 Figure 16: A plane unweighted graph with the neighborhood property. Down edges are drawn bold. Vertices in the set S are numbered. has a width of at most 3ℓ − 1. By replacing each vertex v∗ by the down path of v, we obtain a tree decomposition for (G, ϕ, c) of width 3ℓ − 1 in O(nℓ) time. As we show in the following, the algorithm from above can be slightly mod- ified to prove the next lemma. Lemma 6.2. Let (G, ϕ, c) be an almost triangulated weighted ℓ-outerplanar biconnected graph, and let M = (G, ϕ, c,H,S) be a good mountain structure of (G, ϕ, c). Take C as an (S, ϕ)-component, and C′ = ext(C,S). Then one can construct a tree decomposition (T, B) of width 3ℓ − 1 for C′ that, for each crest separator X ∈ S with a top edge in C, has a bag containing all vertices of X. Moreover, given C′ as well as the height intervals [h−ϕ (v), h+ ϕ (v)] for each vertex v in C′, the construction can be done in O(n′ℓ2) time, where n′ is the number of vertices in C′. Proof. For the time being, let us assume that no crest separator with a top edge in C′ has a lowpoint. At the end of our proof we show how to handle crest separators with a lowpoint. The heights of the vertices in C′ with respect to ψ = ϕC ′ may differ from the heights of these vertices with respect to ϕ. In order to avoid this, we insert additional edges into C′. More precisely, for each crest separator X = (P1, P2) with a top edge in C, height r ∈ IN , and vertices u1, . . . , up of P1 and v1, . . . , vq of P2 in the order of their appearance on these paths, and for i ∈ {1, . . . , r}, define u(i) as the vertex in {u1, . . . , up} whose height interval contains i. Analogously, we define v(i) for all i ≤ h+ ϕ (v). We extend C′ by inserting vertices m(1), m(2), . . . , m(h+ ϕ (v)) into the (X, ϕ)- component not containing C as well as edges {u(i), m(i)} and {m(i), v(i)} for all i with 1 ≤ i ≤ h+ ϕ (v)− 1, as well as edges between m(h+ ϕ (v) + 1), . . . u(r). By applying the changes above to all crest separators, this results in a weighted plane graph ( C, ϕ, c) such that h ϕ(v) = hϕ(v) holds for all vertices v of C′. We next transform ( C, ϕ, c) into a graph ( C, ϕ, c) with the neighbor hood property (N) by applying Lemma 6.1 and construct a tree decomposition of width 3ℓ − 1 ϕ (v) and edges {m(i), m(i + 1)} for all i with 1 ≤ i ≤ h+ ϕ (v)) and each vertex of u(h+ 45 for this new graph as it is described after Lemma 6.1. Let us now analyze what happens to a crest separator X = (P1, P2). By Lemma 6.1, the top edge of X is replaced by an edge in ( C, ϕ, c) connecting copies of the original endpoints. Moreover, the down paths of these endpoint copies consist of copies of the vertices of P1 and P2. After merging each down path in ( C, ϕ, c) to one vertex-let G′ be the graph obtained-there is an edge connecting the two vertices that are introduced for P1 and P2. Thus, the tree decomposition for G′ has a bag containing the two vertices. As a consequence, we obtain a tree decomposition for C that contains a bag with copies of all vertices of P1 and P2. Since C is a reverse minor of C, we obtain a tree de- composition for C from a tree decomposition for C of at most the same width in a standard way by replacing split vertices and edges by the original vertices and edges in C thereby replacing the copies of the vertices of P1 and P2 by the original vertices of P1 and P2. After removing the vertices m(i) outside C′, we obtain a tree decomposition of width at most 3ℓ − 1 for C′ that, for each crest separator X ∈ S, has a bag containing all vertices of X. We next show how to exclude crest separators with lowpoints by modifying the given graphs. For simplicity, our modifications described below do not result in an almost triangulated graph; however the graph can be easily transformed into an almost triangulated graph by adding into each inner face with more than three edges on its boundary edges incident to one vertex of smallest upper height on the boundary, which does not change any height interval. Let us first consider a crest separator X ∈ S with a top edge in C that encloses C. Note that in this case every crest separator with a top edge in C contains the lowpoint v of X. Let i = h+ ϕ (v). Then we remove all vertices u with h+ ϕ (u) ≤ i from G, from C, and from the crest separators contained in S, and additionally we remove from S all crest separators that afterwards have at most one vertex (since, by definition, a single vertex is not a crest separator anymore). For all vertices u with h−ϕ (u) ≤ i + 1 < h+ ϕ (u) − i. For the remaining vertices u, we define c′(u) = c(u). We so obtain a new good mountain structure (G′, ϕ′, c′,S′) from (G, ϕ, c,S), where ϕ′ is a weighted (ℓ−i)-outerplanar embedding. More precisely, if the graph G′ after removing all vertices of upper height at most i is not biconnected, we take a good mountain structure for each biconnected component. Note that, for each crest separator X′ = (P ′1, P ′2) of S with a top edge in C, the subpaths P ∗1 and P ∗2 of P ′1 and P ′2, respectively, ending immediately before v are contained in the same biconnected component. To see this, we distinguish between two cases. If we have h−ϕ (u) = h−ϕ (v) = i + 1 for both top vertices u and v of X′, P ∗1 and P ∗2 consist only of these two vertices. Since these vertices are connected by an edge, they must be part of the same biconnected component. Otherwise we must have h−ϕ (u) > i + 1 for at least one top vertex u of X′. Hence we can conclude that there is a cycle of vertices with their height intervals containing i+1 that encloses u and all vertices of P ∗1 and P ∗2 of lower height at least i + 2 and that contains the vertices of P ∗1 and P ∗2 with lower height i + 1. The inner graph of this cycle is biconnected and since it contains the cycle itself it must contain all vertices of P ∗1 and P ∗2 . Therefore, we separately construct a tree decomposition for each biconnected component of G′ and then connect the tree decompositions of each biconnected component. After the modifications-in particular, the removal of v-no crest separator in S′ encloses the new (S′, ϕ′)-component C∗ obtained from C (Lemma 5.1). The idea is then to use the construction as described for ϕ (u), we define c′(u) = h+ 46 crest separators with no lowpoints to construct a tree decomposition of width 3(ℓ − i) − 1 for each biconnected component such that, for each crest separator X′ ∈ S with a top edge in C∗, it has a bag containing all vertices u of X′ with h+ ϕ (u) > i. Since C is enclosed by X, the remaining vertices of X′ are all part of the down path of v in (G, ϕ, c). We can simply add the vertices of the down path of v into all bags of the tree decomposition to obtain the desired tree decomposition for C′ of width 3ℓ − 1. Crest separators with a lowpoint that does not enclose C can be handled in the same way as crest separators without any lowpoint except that we do need to define vertices u(i), v(i), m(i) for all i smaller or equal than the upper height h of the lowpoint and that we insert an edge between the lowpoint and m(h + 1). Concerning the running time, it is dominated by the construction of a tree decomposition for C. This construction takes O(nℓ) time, where n is the number of vertices of C. Since the replacement of C by C may increase the number of vertices by a factor of O(ℓ), the whole running time is O(n′ℓ2). (cid:3) 7 The Main Algorithm In this section we describe our main algorithm. As mentioned in Section 2, we assume that we are given an almost triangulated weighted graph (G, ϕ, c) with weighted treewidth k. In the case that no embedding ϕ is given, we can compute an arbitrary planar embedding in linear time [15]. Recall that cmax denotes the maximum weight over all vertices. Let ℓ = 2k + 2cmax. Our algorithm starts with cutting off all maximal connected subsets of vertices of whose height interval contains a value of size at least ℓ by coast separators of size O(k). More precisely, to find such coast separators, in a first substep we merge each maximal connected set M of vertices of whose height interval contains a value of size at least ℓ to one vertex vM and define c(vM ) to be ℓ + 1 minus the smallest lower height of a vertex in M . This means that the lower height of vM is the smallest lower height of a vertex in M and its upper height is ℓ. Therefore the weighted graph (G′, ϕ′, c) obtained is weighted ℓ-outerplanar. Given a vertex of the coast, this can be done in a time linear in the number of vertices with a lower height of at most ℓ. G′ is an almost triangulated, biconnected graph since this is true for G. We then can use Corollary 5.14 to construct, for the subset H of the vertices of height ℓ in G′, a good mountain structure (G′, ϕ′, c,H,S) as well as to find a set of coast separators Y and a function m that maps the coast separators to (S, ϕ′)-components such that the following properties of the lemma hold. • Each crest of upper height exactly ℓ is enclosed by a coast separator Y ∈ Y of weighted size at most 3k + 4cmax − 5. • For each pair of crests of height ℓ, the crests are either part of the inner graph of one Y ∈ Y or there is a crest separator X ∈ S strongly going between the crests. • The (S, ϕ′)-components in m(Y ) induce a connected subgraph of the mountain connection tree. • The inner graph of a coast separator Y ∈ Y is a subgraph of the graph obtained from the union of the (S, ϕ′)-components in m(Y ). 47 • For each (S, ϕ′)-component C, there is at most one Y ∈ Y with C ∈ m(Y ). Since G′ is weighted ℓ-outerplanar, we can apply Lemma 6.2 to each (S, ϕ′)- component C to compute a tree decomposition (TC , BC) of width at most 3ℓ − 1 for ext(C,S) such that, for each crest separator X ∈ S with a top edge in C, (TC , BC) has a node whose bag contains all vertices of X. This node is then connected to a node whose bag also contains all vertices of X and that is constructed for ext(C′,S) with C′ being the other (S, ϕ′)-component C′ containing the top edge of X. Since the set of common vertices of ext(C,S) and ext(C′,S) is a subset of the vertices of X, after also connecting nodes for all other crest separators in S, we obtain a tree decomposition (T ∗, B∗) for G′. Let us next remove from S all crest separators whose top edge is contained in two (S, ϕ′)-components belonging to the same set m(Y ) for some Y ∈ Y. Afterwards, for the new set S′ of crest separators, each cycle Y ∈ Y is contained in one (S′, ϕ′)-component.1 For each (S′, ϕ′)-component C′, let us call the flat component of C′ to be the subgraph of ext(C′,S′) obtained by removing the vertices of the inner graph of the cycle Y ∈ Y with Y contained in C′ if such a cycle Y exists. Otherwise, we define the flat component to be ext(C′,S′), which then contains no vertex of upper height larger than ℓ. From the bags in (T ∗, B∗), we then remove all vertices that do not belong to a flat component. Afterwards, for each cycle Y ∈ Y disconnecting the crests of an (S′, ϕ′)-component C′ from the coast, we put the vertices of Y into all bags of the tree decompositions (TC , BC) constructed as part of (T ∗, B∗) for the (extended components of the) (S, ϕ′)-components C contained in C′. This allows us to connect one of these bags with a bag of a tree decomposition for the inner graph of Y . Indeed, for each Y ∈ Y, we recursively construct a tree decomposition (TY , BY ) for the inner graph GY of Y with the vertices of Y being the coast of GY . Into all bags of (TY , BY ) that are not constructed in further recursive calls, we also put the vertices of Y . At the end of the recursions, we obtain a tree decomposition for the whole graph. Note that each bag is of weighted size O(k). More precisely, let us consider a recursive call that constructs a tree decomposition (TY , BY ) for a cycle Y constructed in a previous step. Then the tree decomposition for the flat component considered in the current recursive call puts vertices with a total weight at most 3ℓ into each bag. However, we also have to insert the vertices of Y and possibly the vertices of a cycle constructed in the current recursive call into the bags. Since each of these cycles consists of vertices with a total weight at most 3k + 4cmax − 5, each bag of the final tree decomposition of G has weight at most 3ℓ + 6k + 8cmax − 10 ≤ 12k + 14cmax − 10. Recall that cmax ≤ k. As mentioned in Section 2, it is possible to replace a non-triangulated weighted graph H of weighted treewidth k by an almost triangulated weighted supergraph G of H and to run our algorithm from above on G such that we can obtain a tree decomposition for H of width (12 + ǫ)k + 14cmax + O(1). Concerning the running time, it is easy to see that each recursive call is dominated by the computation of the cycles being used as coast separators. This means that each recursive call runs in O(nk2cmax) time, where n is the number of vertices of the subgraph G′ of G considered in this call. Some vertices part of one recursive call are cut off from the current graph and then are also considered in a further recursive call. However, since the coast separators contain no vertex 1We now have found a set of crest separators and coast separators that guarantee (P1) - (P3) from page 8. The set S ′ is exactly the set of perfect crest separators. 48 of the coast, the coast is not part of any recursive call. Therefore, each vertex is considered in O(k) recursive calls, and our algorithm finds a tree decomposition for G of width O(k) in O(V k3cmax) time. If we do not know k in advance, we can use a binary search to determine a tree decomposition for G of width O(k) in O(V k3cmax log k) time. Theorem 7.1. For a weighted planar graph (G, c) with n vertices and weighted treewidth k and any constant ǫ > 0, a tree decomposition for G of weighted width (12 + ǫ)k + 14cmax + O(1) can be constructed in O(nk3cmax log k) time, where cmax denotes the maximum weight of a vertex of G. Corollary 7.2. For a planar graph G with n vertices and treewidth k and any constant ǫ > 0, a tree decomposition for G of width (12 + ǫ)k + O(1) can be constructed in O(nk3 log k) time. For a more efficient algorithm, we replace ℓ by 3k +2cmax. When considering a weighted ℓ-outerplanar graph (G, ϕ) in one recursive call of the algorithm, we remove all vertices of upper height at most k, reduce the weight of each vertex v with upper height at least k + 1 and lower height smaller than k + 1 by k, and search for a coast separator in the resulting weighted (2k + 2cmax)-outerplanar graph as in our original algorithm. Since now the lower and upper heights of each vertex considered in two consecutive recursive steps differ by at least k, every vertex is now considered in at most O(1) recursive calls. However, we now have to construct a tree decomposition for a weighted (3k + 2cmax)-outerplanar flat component in each recursive call. Thus, we now construct a tree decomposition with a weight of size at most 3ℓ + 6k + 8cmax − 10 = 15k + 14cmax − 10 per bag if G is almost triangulated, and (15 + ǫ)k + 14cmax + O(1) per bag otherwise. Theorem 7.3. For a weighted planar graph (G, c) with n vertices and weighted treewidth k and any constant ǫ > 0, a tree decomposition for G of weighted width (15 + ǫ)k + 14cmax + O(1) can be constructed in O(nk2cmax log k) time, where cmax denotes the maximum weight of a vertex of G. Corollary 7.4. For a planar graph G with n vertices and treewidth k and any constant ǫ > 0, a tree decomposition for G of width (15 + ǫ)k + O(1) can be constructed in O(nk2 log k) time. It is also interesting to compute a grid minor if a graph has no tree decom- position of size O(k). We can do so, for an unweighted planar graph G′, if we abstain from multiplying the weights of the vertices of G′ by a factor x during the transformation of G′ into an almost triangulated graph G by inserting a vertex into each face and connecting it to all vertices on the boundary. Kloks et al. [18, Theorem 2] showed that the treewidth of G can be bounded by k = 4k′+1 where k′ is the treewidth of G′. If, afterwards, the algorithm fails to construct a tree decomposition for the graph G without the weight changes of unweighted treewidth k, then this can only happen when we search for a separator with Theorem 2.5. In this case, we have k internally-vertex-disjoint paths P that all start and end at two vertices whose heights differ by more than k, i.e., each of these paths "crosses" k − 1 cycles. If we cut the cycles between a consecutive pair of paths of P and remove the endpoints of the paths, we get a k × (k − 1) minor in the almost triangulated version of G. If we remove every second path of P and every second cycle, then we can replace the remaining paths and cycles 49 such that no new vertex added into a face is used and the paths (the cycles) are pairwise vertex-disjoint. Thus, G has a grid of size ⌊k/2⌋ × ⌊(k − 1)/2⌋ as minor. Theorem 7.5. Given a planar graph G with n vertices and k ∈ IN , there is an algorithm that constructs either a tree decomposition for G of width O(k) or a Θ(k) × Θ(k) grid as a minor of G in O(nk2) time. We finally want to remark that it was not the purpose of this paper to show the smallest possible approximation ratio. Indeed, it is not necessary to turn a given graph into an almost triangulated graph and to compute subsequently a tree decomposition for the almost triangulated graph. With more sophisticated techniques, Kammer [16] presented an algorithm that can compute a tree decomposition of width 9tw(G) + 9 for an unweighted planar graph G in O(nk4 log k) time. 8 Conclusion We have shown that a tree decomposition for a planar graph with its width approximating the treewidth by a constant factor can be found in a time linear in the number of vertices of the given graph. Since a tree decomposition for a planar graph with n vertices and treewidth k can be of size Θ(nk), an interesting open question is if the running time of Corollary 7.4 can be improved to O(nk). To obtain a better approximation ratio, Kammer [16] has shown how to adapt our algorithm from triangulated planar graphs to general planar graphs. This makes the algorithm much more complicated. Another more promising approach would be to find a linear-time triangulation of a planar (weighted) graph without increasing the treewidth of the graph. We also want to mention that it is a still an open problem whether the treewidth on planar graphs can be found in polynomial time or whether the problem is NP-hard. References [1] Eyal Amir. Approximation algorithms for treewidth. Algorithmica, 56(4):448–479, 2010. [2] S. Arnborg, D. G. Corneil, and A. Proskurowski. Complexity of finding embeddings in a k-tree. SIAM J. Alg. Disc. Meth., 8(2):277–284, 1987. [3] Stefan Arnborg, Jens Lagergren, and Detlef Seese. Easy problems for tree- decomposable graphs. J. Algorithms, 12(2):308–340, 1991. [4] H. L. Bodlaender. A partial k-arboretum of graphs with bounded treewidth. Theoret. Comput. Sci., 209(1–2):1–45, 1998. [5] Hans L. Bodlaender. A tourist guide through treewidth. Acta Cybern., 11(1-2):1–21, 1993. [6] Hans L. Bodlaender. A linear-time algorithm for finding tree- decompositions of small treewidth. SIAM J. Comput., 25:1305–1317, 1996. 50 [7] Hans L. Bodlaender and Ton Kloks. Better algorithms for the pathwidth and treewidth of graphs. In Proc. 18th International Colloquium on Au- tomata, Languages and Programming (ICALP 1991), volume 510 of LNCS, pages 544–555. Springer, 1991. [8] Erik D. Demaine, Fedor V. Fomin, Mohammad Taghi Hajiaghayi, and Dim- itrios M. Thilikos. Subexponential parameterized algorithms on bounded- genus graphs and H -minor-free graphs. J. ACM, 52(6):866–893, 2005. [9] E. W. Dijkstra. A note on two problems in connexion with graphs. Nu- merische Mathematik, 1(1):269–271, 1959. [10] Uriel Feige, MohammadTaghi Hajiaghayi, and James R. Lee. Improved approximation algorithms for minimum weight vertex separators. SIAM J. Comput., 38(2):629–657, 2008. [11] Fedor V. Fomin, Sang-il Oum, and Dimitrios M. Thilikos. Rank-width and tree-width of H-minor-free graphs. Eur. J. Comb., 31(7):1617–1628, 2010. [12] Qian-Ping Gu and Hisao Tamaki. Optimal branch-decomposition of planar graphs in O(n3) time. ACM Transactions on Algorithms, 4(3), 2008. [13] Qian-Ping Gu and Hisao Tamaki. Constant-factor approximations of branch-decomposition and largest grid minor of planar graphs in O(n1+ǫ) time. Theor. Comput. Sci., 412(32):4100–4109, 2011. [14] Qian-Ping Gu and Gengchun Xu. Near-linear time constant-factor approxi- mation algorithm for branch-decomposition of planar graphs. In Proc. 40th International Workshop on Graph-Theoretic Concepts in Computer Science (WG 2014), volume 8747 of LNCS, pages 238–249. Springer, 2014. [15] John E. Hopcroft and Robert Endre Tarjan. Efficient planarity testing. J. ACM, 21(4):549–568, 1974. [16] Frank Kammer. Treelike and Chordal Graphs: Algorithms and Generaliza- tions. PhD thesis, University of Augsburg, 2010. [17] Frank Kammer and Torsten Tholey. Approximate tree decompositions of planar graphs in linear time. In Proc. 23th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2012), pages 683–698. SIAM, 2012. [18] Ton Kloks, Chuan-Min Lee, and Jiping Liu. New algorithms for k-face cover, k-feedback vertex set, and k-disjoint cycles on plane and planar graphs. In Proc. 28th International Workshop on Graph-Theoretic Concepts in Computer Science (WG 2002), volume 2573 of LNCS, pages 282–295. Springer, 2002. [19] Jens Lagergren and Stefan Arnborg. Finding minimal forbidden minors using a finite congruence. In Proc. 18th International Colloquium on Au- tomata, Languages and Programming (ICALP 1991), volume 510 of LNCS, pages 532–543. Springer, 1991. [20] Sang-il Oum. Rank-width is less than or equal to branch-width. J. Graph Theory, 57(3):239–244, 2008. 51 [21] Bruce A. Reed. Finding approximate separators and computing tree width quickly. In Proc. 24th Annual ACM Symposium on Theory of Computing (STOC 1992), pages 221–228. ACM, 1992. [22] Neil Robertson and Paul D. Seymour. Graph minors. III. planar tree-width. J. Comb. Theory, Ser. B, 36(1):49–64, 1984. [23] Neil Robertson and Paul D. Seymour. Graph minors. II. algorithmic aspects of tree-width. J. Algorithms, 7(3):309–322, 1986. [24] Neil Robertson and Paul D. Seymour. Graph minors. X. Obstructions to tree-decomposition. J. Comb. Theory, Ser. B, 52(2):153–190, 1991. [25] Neil Robertson and Paul D. Seymour. Graph minors. XIII. The disjoint paths problem. J. Comb. Theory, Ser. B, 63(1):65–110, 1995. [26] Paul D. Seymour and Robin Thomas. Call routing and the ratcatcher. Combinatorica, 14(2):217–241, 1994. 52
1705.00382
2
1705
2018-06-04T13:29:35
Common greedy wiring and rewiring heuristics do not guarantee maximum assortative graphs of given degree
[ "cs.DS" ]
We examine two greedy heuristics - wiring and rewiring - for constructing maximum assortative graphs over all simple connected graphs with a target degree sequence. Counterexamples show that natural greedy rewiring heuristics do not necessarily return a maximum assortative graph, even though it is known that the meta-graph of all simple connected graphs with given degree is connected under rewiring. Counterexamples show an elegant greedy graph wiring heuristic from the literature may fail to achieve the target degree sequence or may fail to wire a maximally assortative graph.
cs.DS
cs
Common greedy wiring and rewiring heuristics do not guarantee maximum assortative graphs of given degree Jonathan Stokes, Steven Weber Department of Electrical and Computer Engineering Drexel University, Philadelphia, PA, USA Abstract We examine two greedy heuristics - wiring and rewiring - for constructing maximum assortative graphs over all simple connected graphs with a target de- gree sequence. Counterexamples show that natural greedy rewiring heuristics do not necessarily return a maximum assortative graph, even though it is known that the meta-graph of all simple connected graphs with given degree is con- nected under rewiring. Counterexamples show an elegant greedy graph wiring heuristic from the literature may fail to achieve the target degree sequence or may fail to wire a maximally assortative graph. Keywords: Assortativity, graph wiring, graph rewiring, graph algorithms 1. Introduction 1.1. Motivation The assortativity of a graph (Newman [1]) is the correlation of the degrees of the endpoints of a randomly selected edge. High degree vertices tend to be connected to high (low) degree vertices in positively (negatively) assortative graphs. One (of many) practical implications of assortativity is in graph search, e.g., searching a (often large order) graph for (one or all) vertices of maximum (or at least large) degree [2]: the work presented in [3, 4] has studied the performance impact of assortativity on search heuristics such as sampling and random walks. Finding such vertices in large graphs has diverse applications, including viral marketing in social networks and network robustness analysis [5, 6], among numerous others. The motivation for this paper is the problem of identifying a collection of graphs, all from the class of graphs with a given degree sequence, with the assortativity of the graphs in the collection varying from the minimum to the (cid:63)This work was supported by the National Science Foundation, Grant #IIS-1250786. Preprint submitted to Information Processing Letters June 5, 2018 maximum possible within that class. The performance impact of the assortativ- ity on the search heuristic may be studied by running the heuristic on all graphs in the collection. Given this objective, the first step is to identify graphs with extremal assortativity within the class. This paper examines two greedy heuris- tics for finding maximum assortative graphs within a class: graph rewiring and wiring. 1.2. Related Work There is an extensive literature on extremization of assortativity over differ- ent graph classes; this section briefly covers the most pertinent points of this literature, focusing on the distinctions between the work presented in this paper and the prior work. Assortativity. Newman [1] introduced (graph) assortativity which is denoted α ∈ [−1, +1]. Van Meighem [7] showed perfect assortativity (α = 1) is only possible in regular graphs, while any complete bipartite graph Km,n (m (cid:54)= n) is perfectly disassortative (α = −1). There is a large literature on network degree correlations and assortativity (e.g., [8]), and on graphs with extremal assortativity within a class (e.g., [9]). Joint Degree Matrix (JDM). The generation of random graphs with a par- ticular JDM (also called a 2K-series) has been the subject of a number of recent papers. Stanton [10] and Orsini [8] have proposed random edge rewiring as a method of sampling graphs with a given JDM, while Gjorka [11] has introduced a random wiring method for constructing these graphs. However, there is no means known to us by which JDMs may be efficiently enumerated, and there- fore there is no easy means to maximize assortativity, which is a statistic of the JDM, short of enumerating all (in our case, simple and connected) graphs with a given degree sequence. Rewiring. The meta-graph for a degree sequence, with a vertex for each con- nected simple graph with that degree sequence and an edge connecting graphs related by rewiring a pair of edges, was studied by Taylor [12]; in particular, he showed this meta-graph to be connected (Thm. 3.3) extending an earlier result by Rysler for simple graphs [13]. This fact is used in §2. Following Rysler's work, rewiring heuristics for sampling graphs with a par- ticular degree sequence (e.g., [14], [15], [8]) have been introduced. Rewiring heuristics have also been proposed by Newman [16], Xuli-Burnet [17], Van Meighem [7], and Winterbach [18] along others for changing a graph's assor- tativity. The first three of these algorithms, being purely stochastic, cannot ef- ficiently maximize assortativity. Winterbach's algorithm uses a guided rewiring technique to maximize assortativity. However, this technique does not maintain graph connectivity, as its rewirings are a subset of those explored by rewiring heuristic A (see §2.1), and therefore Winterbach's algorithm does not necessarily maximize assortativity. Wiring. Li and Alderson [19] introduced a greedy wiring heuristic for con- structing a graph with maximum assortativity over the set of simple connected graphs with a target degree sequence. Kincaid [9] argues wiring a minimally 2 or maximally assortative connected simple graph is NP-hard and proposes a heuristic which is shown numerically to perform near optimally in minimizing graph assortativity. Winterbach [18], Zhou [20], and Meghanathan [21] have also proposed methods unconstrained by graph connectivity of wiring maximally as- sortative graphs. This paper examines Li's heuristic further in §3. Graph enumeration and generation. The results in this paper where achieved using geng, a tool in the nauty package created by McKay [22], to generate all simple connected graphs of a given order. 1.3. Notation Let a ≡ b denote equal by definition. Let [n]+ denote {1, . . . , n} for n ∈ N. A graph of order n is denoted G = (V,E), with vertices V = [n]+ and edges E; size is denoted by m = E. A directed edge between vertices i and j is denoted (ij), and an undirected edge is denoted ij or {ij}.1 Let di denote the degree of vertex i, d = (di, i ∈ V) denote a degree sequence, and dG = (di, i ∈ V) the degree sequence for graph G. Additionally, let Uni(V) denote the uniform distribution over vertex set V, Var(dw) be the variance of the degree of a randomly selected vertex w ∼ Uni(V), and Corr(du, dv) be the correlation between the degrees of random vertices u and v. order n ∈ N is denoted W (n). Let D (n) ≡(cid:83) The collection of distinct unlabeled undirected simple connected graphs of G∈W (n) dG be the collection of degree sequences found in graph collection W (n), and let W (n) d ≡ {G ∈ W (n)dG = d} be the graphs in W (n) with degree sequence d, henceforth referred to as the degree class d. It follows that (W (n) d , d ∈ D (n)) is the partition of W (n) by the degree sequence d. The S-metric and assortativity, for G = (V,E) ∈ W (n), are defined below. didj. (1) (cid:80) This implies for {uv} ∼ Uni(E) an edge selected uniformly at random E[dudv] = ij∈E didj. It follows that the assortativity [1] is, for w ∼ Uni(V) a vertex 1E selected uniformly at random, α(G) ≡ Corr(du, dv) = s(G)/E − E[dw]2 Var(dw) . (2) It is evident that maximizing the S-metric is equivalent to maximizing as- sortativity over a degree class: W (n) d,opt ≡ argmax G∈W (n) d (s(G)) = argmax G∈W (n) d (α(G)) . (3) 1Except in §3 where Alg. 1's undirected pedges are listed as an ordered pair. 3 Definition 1. The S-metric [19] is, s(G) ≡ (cid:88) ij∈E Here, W (n) d . If there is a unique such graph it is denoted G(n) d,opt denotes those graphs achieving maximum assortativity over d,opt. W (n) 1.4. Contributions and outline The rest of the paper is organized as follows. §2 studies several greedy rewiring heuristics, each with the goal of identifying a graph of maximum as- sortativity over the degree class. Counterexamples are presented showing each of the rewiring heuristics may fail to identify such a graph. §3 examines the greedy wiring heuristic of Li and Alderson [19] designed to identify a graph of maximum assortativity over the degree class. We present a counterexample showing the heuristic may fail to produce a graph in the degree class, and also present a counterexample showing that the heuristic may produce a graph in the class that is not maximally assortative. Both §2 and §3 present tabulations of the number of counterexamples of the various types for graphs of order up to n = 9. §4 contains concluding remarks. 2. Rewiring For a degree class W (n) and an initial graph G0 ∈ W (n) d d , a rewiring heuristic produces a sequence of graphs (G0, . . . , GT ), each graph in W (n) d , where Gt+1 is obtained from Gt by selecting two edges (connecting four distinct vertices) from Gt, say (ij, kl), and forming Gt+1 with (ij, kl) replaced by either (ik, jl) or (il, jk). Any rewiring is invalid if the resulting graph is either disconnected or has multiple edges, i.e., not in W (n) d . 2.1. Greedy rewiring heuristics A stochastic rewiring heuristic involves selecting the two edges (ij, kl) at random. While simple to implement, stochastic rewiring has no guarantee on efficiency. This observation lead to the focus of this paper, greedy rewiring heuristics. Fix G ∈ W (n) and four distinct vertices {i, j, k, l}, such that G has edges (ij, kl). Rewire edges (ij, kl) to produce either graph G(cid:48) = G(ik, jl) or G(cid:48) = G(il, jk); the arguments denote the two new edges replacing edges (ij, kl). Rewiring induces a change in the S-metric: (cid:26) (didk + djdl) − (didj + dkdl), G(cid:48) = G(ik, jl) d ∆G,G(cid:48) ≡ s(G(cid:48))−s(G) = (didl + djdk) − (didj + dkdl), G(cid:48) = G(il, jk) (4) Given edges (ij, kl), ∆G,G(cid:48) in (4) is the scalar difference of the S-metric of G and one of the two possible rewirings, G(ik, jl) or G(il, jk), producing distinct G(cid:48). The greedy rewiring heuristics we introduce below explore both rewirings. Three greedy rewiring heuristics are developed using ∆G,G(cid:48); each yields a (defined below), where d,G of graphs in a meta-graph on W (n) d neighborhood N (H) each G(cid:48) ∈ N (H) d,G is achieved by a heuristic H approved single rewiring of G. 4 • A: Improve (or maintain) s(G): N (A) obtainable by a single rewiring of G such that ∆G,G(cid:48) ≥ 0. d,G holds all simple connected graphs G(cid:48) • B: Maximize ∆: N (B) d,G holds all simple connected graphs G(cid:48) obtainable by a single rewiring of G such that ∆G,G(cid:48) is maximum over all G(cid:48). • C: Improve and maximize: N (C) d,G holds all simple connected graphs G(cid:48) obtain- able by a single rewiring of G such that ∆G,G(cid:48) ≥ 0 and ∆G,G(cid:48) is maximum over all G(cid:48). 2.2. Meta-graphs for a degree class Meta-graphs are graphs with vertices corresponding to the (simple and con- nected) non-isomorphic graphs in a degree class W (n) d , for a given degree se- quence d ∈ D (n). Taylor [12] defined the undirected meta-graph G(n) d , Ed), where edges are added between all pairs of graphs related by edge rewiring, i.e., {G, G(cid:48)} ∈ Ed iff G(cid:48) = G(ik, jl) or G(cid:48) = G(il, jk) for some pair of edges (ij, kl). Taylor proved (Thm. 3.3) that G(n) is connected. Thus, any graph in W (n) is obtainable, starting from any other graph in W (n) d , through a sequence of rewirings, where each graph in the sequence is simple and connected. Note G(n) may have self-loops as rewiring G may yield G(cid:48) isomorphic to G. d = (W (n) d d d label each graph G ∈ W (n) Rewiring heuristics A, B, and C each correspond to directed meta-graphs. d with its assortativity α(G) (alternately, First, s(G)). Next, for each heuristic H ∈ {A, B, C}, form the directed meta-graph G(n) d,H ≡ (W (n) d,G}. That is, each rewiring heuristic is represented by retaining (and orienting) the subset of edges in Taylor's meta-graph G(n) d , Ed,H ), where Ed,H ≡ {(G, G(cid:48)) ∈ EdG(cid:48) ∈ N (H) that satisfy the heuristic. d Figure 1: From top left to bottom right the graphs corresponding to vertices 1, 2, 3, 4, 5, 6, and 7 in G(7) d , see Fig. 3. 5 12345671123456721234567312345674123456751234567612345677 Figure 2: From left to right: i) initial graph G0,B, node 5 in G(7) ´d node 3 in G(7) ´d , see Fig. 3. ii) target graph G(7) ´d,opt , Figure 3: The meta-graphs above are, from top left to bottom right: i) G(7) G(7) d,B, iv) G(7) number to the right of each vertex id is the assortativity of the corresponding graph. d,C with d = (5, 5, 5, 4, 4, 3, 2), v) G(7) , vi) G(7) ´d,B d,A, iii) with ´d = (4, 4, 3, 3, 2, 1, 1). The d , ii) G(7) ´d 2.3. Rewiring heuristic counterexamples One might hope that (one or more of) the rewiring heuristics would provide a guarantee that, for any initial graph G0 ∈ W (n) d , there exists a directed path, following the heuristic, from G0 to one or more graphs in W (n) d,opt. Unfortunately, all three heuristics can fail to achieve this goal, as shown by the counterexamples below. A counterexample for heuristic H ∈ {A, B, C} identifies a (n, d, G0) triple, with n ∈ N, d ∈ D (n), and G0 ∈ W (n) d , such that there is no path from G0 to any graph in W (n) d,opt in the directed meta-graph G(n) d,H . Note that these heuristics do not specify a particular rewiring, i.e., each in general, a collection of possible neighborhood graphs heuristic identifies, N (H) G , where each graph in the neighborhood is consistent with the heuristic. Thus, a counterexample for the heuristic has the property that the heuristic H 6 1234567512345673Gd,opt1: -0.18072: -0.26513: -0.26514: -0.01205: -0.34946: -0.51817: -0.0964G0,AG(7)d^Gd,opt1: -0.18072: -0.26513: -0.26514: -0.01205: -0.34946: -0.51817: -0.0964G0,AG(7)d,A^G0,BGd,opt1: -0.18072: -0.26513: -0.26514: -0.01205: -0.34946: -0.51817: -0.0964G(7)d,B^G0,CGd,opt1: -0.18072: -0.26513: -0.26514: -0.01205:-0.34946: -0.51817: -0.0964G(7)d,C^1: -0.68752: -0.46253: -0.01254: -0.35005: -0.12506: -0.23757: -0.34508: -0.4625G0,BGd,optG(7)d^1: -0.68752: -0.46253: -0.01254: -0.35005: -0.12506: -0.23757: -0.34508: -0.4625G0,BGd,optG(7)d,B^ would fail to achieve the target set for any possible choice of G(cid:48) ∈ N (H) each G "reachable" from G0. G , for Counterexample 1. Fix order n = 7, degree sequence d = (5, 5, 5, 4, 4, 3, 2), and initial graph G0,A ∈ V (7) (graph 7 in Fig. 1). The (unique) graph with d maximum assortativity, G(7) d and directed meta-graph under heuristic A, G(7) d,A are graph 1 and 2 in Fig. 3. There is no path from G0,A to G(7) d,C (graph 4 in Fig. 3). Thus, (n, d, G0,A) is a counterexample for heuristics A and C. d,opt, is graph 4 in Fig. 1. The meta-graph G(7) d,A, and hence no path in G(7) d,opt in G(7) This counterexample asserts that graph G0,A has locally (i.e., over graphs adjacent to G0,A in G(7) d ) maximum assortativity. To see that G0,A is locally maximal, Table 1 lists possible pairs of edges from G0,A which if rewired as G(cid:48) = G0,A(ik, jl) or G(cid:48) = G0,A(il, jk) maintain graph simplicity and connectivity: ∆G0,A,G(cid:48) < 0 for each possible G(cid:48). d,A) maximal but not globally (i.e., over W (7) (ij, kl) (43, 57) (42, 57) (41, 57) (47, 53) (47, 52) (47, 51) (47, 63) (47, 62) (47, 61) (57, 63) (57, 62) (57, 61) (ik, jl) ∆G0,A,G(cid:48) (45, 37) (45, 27) (45, 17) (45, 73) (45, 72) (45, 71) (46, 73) (46, 72) (46, 71) (56, 73) (56, 72) (56, 71) −2 −2 −2 −2 −2 −2 −1 −1 −1 −1 −1 −1 (il, jk) ∆G0,A,G(cid:48) (47, 35) (47, 25) (47, 15) (43, 75) (42, 75) (41, 75) (43, 67) (42, 76) (41, 76) (53, 67) (52, 76) (51, 76) * * * * * * * * * * * * for G(cid:48) = Table 1: Rewirings of edge pairs (ij, kl) (left) of G0,A, along with ∆G0,A,G(cid:48) G0,A(ik, jl) (middle) or G(cid:48) = G0,A(il, jk) (right). Bold entries maximize ∆G0,A,G(cid:48) , * in- dicates rewirings which violate graph simplicity or connectivity. Counterexample 2. Fix order n = 7, degree sequence ´d = (4, 4, 3, 3, 2, 1, 1), and initial graph G0,B ∈ W (7) (graph 1 in Fig. 2). The (unique) graph with ´d , is graph 2 in Fig. 2. The meta-graph G(7) maximum assortativity, G(7) ´d directed meta-graph under heuristic B, G(7) , are graph 5 and 6 in Fig. 3. There ´d,B is no path from G0,B to G(7) . Thus, (n, ´d, G0,B) is a counterexample for heuristic B. in G(7) ´d,B ´d,opt ´d,opt and This counterexample asserts that graph G0,B has locally maximal but not globally maximum assortativity. This can be seen by enumerating all possible pairs of edges from G0,B which if rewired maintain graph simplicity and con- nectivity, and showing the (unique) optimal choice to maximize ∆G,G(cid:48) produces a new graph G(cid:48) isomorphic to G0,B; this enumeration is omitted due to space 7 constraints. The isomorphism between G0,B and G(cid:48) produces the self-loop in G(7) ´d,B at the vertex corresponding to G0,B. corresponding to the ith vertex in meta-graph G(n) Counterexamples C.E. 1 and C.E. 2 were found via exhaustive search. We enumerated the class of non-isomorphic simple connected graphs of n vertices and degree sequence d, W (n) d , using the tool geng [22]. Letting Gi denote the ith graph in W (n) d,H , under greedy rewiring heuristic H, we enumerate all non-isomorphic edge rewirings of Gi. For each rewiring G(cid:48) i of Gi that satisfies heuristic H we check for isomorphism of i with Gk ∈ W (n) G(cid:48) d . If G(cid:48) i is isomorphic with Gk, we add directed edge (i, k) to meta-graph G(n) d , we check that a path exists from each vertex in G(n) d,opt. Using this procedure we generated Table 2, which counts the number of counterexamples for each of the greedy rewiring heuristics. d,H . Upon completing this procedure for all G ∈ W (n) d,H to a vertex in W (n) d overall W (n) 112 853 11, 117 261, 080 n 6 7 8 9 D (n) #G 0 2 13 149 68 236 863 3, 137 heuristic A heuristic B heuristic C #d #G #d #G #d 0 2 12 80 0 2 20 1100 0 1 15 1045 0 2 12 80 0 1 8 67 Table 2: Rewiring heuristic counterexample counts: The number of distinct graphs W (n) and degree sequences D (n), followed by the number of distinct graphs (#G) and degree sequences (#d) that are counterexamples for heuristics A, B, C, for n ∈ {6, 7, 8, 9}. 3. Wiring If a degree sequence d satisfies the Erdos Gallai theorem there exists one or more simple connected graphs with that degree sequence, i.e., W (n) (cid:54)= ∅ [23]. Given such a d, a wiring heuristic produces a sequence of graphs ( G0, . . . , GT ), with G0 the empty graph, such that Gt+1 is formed from Gt by adding one edge, subject to the constraint that no vertex j ∈ V is ever assigned a degree exceeding its target dj. It is typical to consider each vertex j in graph Gt as having dj "stubs" of which some number dj hold edges, and the remainder, δj ≡ dj − dj, are available for wiring. The goal of the wiring heuristics is to obtain a graph of maximum assortativity, i.e., GT ∈ W (n) d,opt given d. d 3.1. Greedy wiring heuristic Li and Alderson [19] developed the elegant greedy wiring heuristic in Alg. 1 which, given a degree sequence d is intended to produce a graph G that is i) feasible, i.e., that is in W (n) d,opt. Although d , and ii) optimal, i.e., in W (n) 8 the heuristic performs well on most inputs, the following section will present counterexamples demonstrating neither property is guaranteed for all d. Each potential edge, hereafter a "pedge", is denoted by the ordered pair (ij) with i < j. The basic idea is to select from set of all pedges O those with the largest endpoint degree product, M (Line 4), after removing from O and M pedges in M without available (unwired) stubs F (Line 6). If pedges remain then further ties are broken by first (then second) selecting the pedge (ij) with the most unwired stubs δi (δj). Vertices [n]+ are partitioned into R,Q, where R (Q) holds any vertex with one or more (no) edges. If the pedge (ij) has i ∈ R and j ∈ Q then the edge is added and vertex j moves from Q to R (Line 11). Else R holds both i and j and we must check the "tree condition", (dB (cid:54)= (2B − δR)), and "disconnected cluster condition", (δR (cid:54)= 2), in Line 14. The "tree condition" is required since at any point in wiring the graph, k∈R δk free stubs in R requires δR acyclic graphs and at least 2Q − δR free stubs in Q. As δR decreases, the number of free stubs in Q required to connect the vertices in Q to the free stubs k∈Q δk, if an edge is added between vertices i and j in R which results in dQ < 2Q − δR then there are not enough free stubs in Q to connect all the vertices in Q to those in R, entailing that G is disconnected. The "disconnected cluster condition" is required since wiring an edge between the only two free stubs in R entails G is disconnected, as no additional vertices in Q can be attached to those in R (see [19]). Regardless of whether or not the conditions in Line 14 are satisfied, the pedge (ij) being considered for wiring is removed from the set O in Line 16. connecting the vertices in Q to the δR :=(cid:80) in R increases. Letting δQ := (cid:80) Algorithm 1 Greedy wiring heuristic (adapted from [19]) 1: require: d = (d1, . . . , dn) with d1 ≥ · · · ≥ dn 2: R := {1}, Q := {2, . . . , n}, E := {}, G := (R, E), O := {(ij) : 1 ≤ i < j ≤ n} 3: while O (cid:54)= ∅ do 4: M := argmax(ij)∈O(didj ) 5: F := {(ij) ∈ M : δiδj = 0} 6: O := O\F , M := M\F if M (cid:54)= ∅ then 7: 8: M(cid:48) := argmax(ij)∈M δi Select (ij) ∈ argmax(ij)∈M(cid:48) δj 9: if i ∈ R and j ∈ Q then 10: E := E ∪ {ij}, R := R ∪ {j}, Q := Q\{j} 11: else 12: 13: if (dQ (cid:54)= (2Q − δR)) ∧ (δR (cid:54)= 2) then 14: E := E ∪ {ij} 15: O := O\{(ij)} 16: 17: return G k∈Q dk, δR :=(cid:80) dQ :=(cid:80) k∈R δk Alg. 1 is underspecified in Line 9, i.e., there may be multiple edges after sorting O by didj, δi, and δj, and no guidance is provided in [19] for selecting a pedge in such a case. To compensate for this, the implementation of Alg. 1 in this paper selects all possible pedge choices, via a breadth first search, returning 9 d,opt. all possible graphs G that may result from a valid pedge selection in Line 9. A degree sequence d is considered to be a counterexample for i) feasibility if none of the returned graphs are in W (n) d , and ii) optimality if at least one returned graph is in W (n) d , yet none are in W (n) 3.2. Wiring heuristic counterexamples Counterexample 3. Fix n = 6 and d = (5, 4, 4, 4, 4, 3) (which satisfies the Erdos Gallai theorem). The graph G returned by Alg. 1 does not have the target degree sequence, i.e., d G (cid:54)= d, and thus G is not feasible, i.e., G (cid:54)∈ W (6) d . Proof. Table 3 gives the sequence of wirings satisfying (ij) ∈ argmax(ij)∈O(didj), illustrated in Fig. 4. The first four edges added, namely (12), . . . , (15), have iden- tical priority as didj, δi, and δj are equal for each. These four may be added in any order without affecting the resulting graph. The next edges added will be (23), (24), (25), (34), (35), (45). Finally, (16) will be added, leaving the only two free stubs in the graph on vertex 6, which can only be wired via a self-loop, thereby violating the requirement that G be simple. (ij) (12) (13) (14) (15) (23) (24) (25) (34) (35) (45) (16) didj 20 20 20 20 16 16 16 16 16 16 15 δi 5 5 5 5 3 3 3 3 3 3 1 δj 4 4 4 4 3 3 3 3 3 3 3 Table 3: Subset of edge wirings for C.E. 3. The first set of rows correspond to wirings which are optimal at wiring step 1. The second set of rows are optimal wirings at wiring step 5. The final row is the only legal at wiring at step 11. Figure 4: Snapshots of the graph wiring in C.E. 3 for n = 6 and d = (5, 4, 4, 4, 4, 3) where the edges are added in alphabetical order: From left to right i) G4, ii) G10, iii) G11. Counterexample 4. Fix n = 8 and d = (6, 4, 4, 4, 4, 3, 2, 1) (which satisfies the Erdos Gallai theorem). The graph G returned by Alg. 1 is feasible, but its assortativity is not maximum and thus G is not optimal, i.e., G (cid:54)∈ W (8) d,opt. 10 123456123456abcdefghij123456abcdefghijk Proof. The proof is similar to C.E. 3. The partially wired graphs at steps 5, 11, 12, and 14 are shown in Fig. 5. The returned graph G = G14 achieves the target degree sequence d, however its assortativity is not optimal. Namely, α( G14) = −0.04886 while α(G(8) d,opt is graph 5 in Fig. 5. d,opt) = −0.00326, where G(8) Figure 5: Snapshots of the graph wiring in C.E. 4 for n = 8 and d = (6, 4, 4, 4, 4, 3, 2, 1) where the edges are added in alphabetical order: From top left to bottom right i) G5, ii) G11, iii) G12, iv) G14, and v) the maximally assortative graph G(8) d,opt. To find counterexamples C.E. 3 and C.E. 4 we enumerate all degree sequences of order n which satisfy the Erdos Gallai theorem. Given a degree sequence d of n vertices, we use Alg. 1 to wire target degree sequence d. Given the breadth first search, Alg. 1 returns a set of graphs G. If d G (cid:54)= d for all G ∈ G, we count d as a feasibility counter example. Otherwise, we check if there exists any G ∈ G (obeying d G = d) for which α( G) = α(G(n) d,opt). If not, we count d as an optimality counterexample. We use this procedure to generate the counts of feasibility and optimality counterexamples in Table 4. D (n) 19 68 236 863 3, 137 n 5 6 7 8 9 feasibility 0 2 16 91 443 optimality 0 0 0 4 36 Table 4: Wiring heuristic counterexample counts: The number of degree sequences D (n), the number of degree sequences for which the returned graph is not feasible, and (if feasible) is not optimal, for n ∈ {5, 6, 7, 8, 9}. 11 12345678abcde12345678abcdeghilkj12345678abcdeghilkjf12345678abcdeghilkjfmn12345678 4. Conclusion The main point of this paper is to demonstrate the failure of natural greedy heuristics, for both graph rewiring and wiring, to produce connected simple graphs with maximum assortativity over an arbitrary target degree class. Many open questions remain, such as how the relative prevalence of the various classes of counterexamples scale with n. One possible direction for future work is to seek to characterize common structural properties of the degree sequences d ∈ D (n) comprising the four types of counterexamples given above. References [1] M. E. J. Newman, Assortative mixing in networks, Physics Review Letters 89 (20) (2002) 208701. doi:10.1140/epjb/e2010-00219-x. [2] K. Avrachenkov, N. Litvak, L. O. P. Yandex, E. Suyargulova, Quick de- tection of high-degree entities in large directed networks, in: Proceedings of the IEEE International Conference on Data Mining (ICDM), Shenzhen, China, 2014, pp. 20–29. doi:10.1109/ICDM.2014.95. [3] J. Stokes, S. Weber, On random walks and random sampling to find max degree nodes in assortative Erdos R´enyi graphs, in: Proceedings of the IEEE Global Communications Conference (GLOBECOM), Washington, D.C., 2016. doi:10.1109/GLOCOM.2016.7842044. [4] J. Stokes, S. Weber, The self-avoiding walk-jump (SAWJ) algorithm for finding maximum degree nodes in large graphs, in: Proceedings of the IEEE International Conference on Big Data, Washington, D.C., 2016, pp. 142–149. doi:10.1109/BigData.2016.7840599. [5] D. Kempe, J. Kleinberg, E. Tardos, Maximizing the spread of influence through a social network, in: Proceedings of the ACM International Con- ference on Knowledge Discovery and Data Mining (SIGKDD), Washington, D.C., 2003, pp. 137–146. doi:10.1145/956750.956769. [6] R. Cohen, K. Erez, D. ben Avraham, S. Havlin, Breakdown of the internet under intentional attack, Physical Review Letters 86 (2001) 3682–3685. doi:10.1103/PhysRevLett.86.3682. [7] P. Van Mieghem, H. Wang, X. Ge, S. Tang, F. A. Kuipers, Influence of assortativity and degree-preserving rewiring on the spectra of networks, The European Physical Journal B 76 (4) (2010) 643–652. doi:10.1140/ epjb/e2010-00219-x. [8] C. Orsini, M. M. Dankulov, P. Colomer-de Simon, A. Jamakovic, P. Ma- hadevan, A. Vahdat, K. E. Bassler, Z. Toroczkai, M. Boguna, G. Caldarelli, S. Fortunato, D. Krioukov, Quantifying randomness in real networks, Na- ture Communications 6 (2015) 8627. doi:10.1038/ncomms9627. 12 [9] R. K. Kincaid, S. J. Kunkler, M. D. Lamar, D. J. Phillips, Algorithms and complexity results for finding graphs with extremal randi´c index, Wiley Networks 67 (4) (2016) 338–347. doi:10.1002/net.21680. [10] I. Stanton, A. Pinar, Constructing and sampling graphs with a prescribed joint degree distribution, ACM Journal of Experimental Algorithmics 17 (2012) 3.5:3.1–3.5:3.25. doi:10.1145/2133803.2330086. [11] M. Gjoka, B. Tillman, A. Markopoulou, Construction of simple graphs with a target joint degree matrix and beyond, in: 2015 IEEE Conference on Computer Communications (INFOCOM), 2015, pp. 1553–1561. doi: 10.1109/INFOCOM.2015.7218534. [12] R. Taylor, Constrained switchings in graphs, in: Proceedings of the Eighth Australian Conference on Combinatorial Mathematics, Vol. 884, Springer Berlin Heidelberg, 1981, pp. 314–336. doi:10.1007/BFb0091828. [13] H. J. Ryser, Combinatorial properties of matrices of zeros and ones, doi:10.4153/ Canadian Journal of Mathematics 9 (1957) 371–377. CJM-1957-044-3. [14] R. Kannan, P. Tetali, S. Vempala, Simple Markov-chain algorithms for generating bipartite graphs and tournaments, Random Structures & Algo- rithms 14 (4) (1999) 293–308. doi:10.1002/(SICI)1098-2418(199907) 14:4<293::AID-RSA1>3.0.CO;2-G. [15] S. Maslov, K. Sneppen, Specificity and stability in topology of protein doi:10.1126/science. networks, Science 296 (5569) (2002) 910–913. 1065103. [16] M. E. J. Newman, Mixing patterns in networks, Physical Review E 67 (2003) 026126. doi:10.1103/PhysRevE.67.026126. [17] R. Xulvi-Brunet, I. Sokolov, Changing correlations in networks: Assorta- tivity and dissortativity, Acta Physica Polonica B 36 (5) (2005) 1431–1455. [18] W. Winterbach, D. de Ridder, H. J. Wang, M. Reinders, P. Van Mieghem, Do greedy assortativity optimization algorithms produce good results?, The European Physical Journal B 85 (5) (2012) 151. doi:10.1140/epjb/ e2012-20899-2. [19] L. Li, D. Alderson, Towards a theory of scale-free graphs: Definition, properties, and implications, Internet Mathematics 2 (4) (2005) 431–523. doi:10.1080/15427951.2005.10129111. [20] J. Zhou, X. Xu, J. Zhang, J. Sun, M. Small, J.-A. Li, Generating an assortative network with a given degree distribution, International Jour- nal of Bifurcation and Chaos 18 (11) (2008) 3495–3502. doi:10.1142/ S0218127408022536. 13 [21] N. Meghanathan, Maximal assortative matching for complex network graphs, Journal of King Saud University – Computer and Information Sci- ences 28 (2) (2016) 230–246. doi:https://doi.org/10.1016/j.jksuci. 2015.10.004. [22] B. D. McKay, A. Piperno, Practical graph isomorphism II, Journal of Sym- bolic Computation 60 (2014) 94–112. doi:10.1016/j.jsc.2013.09.003. [23] P. Erdos, T. Gallai, Graphs with prescribed degrees of vertices (Hungarian), Matematikai Lapok 11 (1960) 264–274. 14
1305.4389
1
1305
2013-05-19T18:29:11
Implementation of linear maps with circulant matrices via modulo 2 rectifier circuits of bounded depth
[ "cs.DS" ]
In the present note we show that for any positive integer k an arbitrary Boolean circulant matrix can be implemented via modulo 2 rectifier circuit of depth 2k-1 and complexity O(n^{1+1/k}), and also via circuit of depth 2k and complexity O(n^{1+1/k} log^{-1/k} n).
cs.DS
cs
Implementation of linear maps with circulant matrices via modulo 2 rectifier circuits of bounded depth∗ Igor S. Sergeev† Abstract In the present note we show that for any constant k ∈ N an ar- bitrary Boolean circulant matrix can be implemented via modulo 2 rectifier circuit of depth 2k − 1 and complexity O (cid:0)n1+1/k(cid:1), and also via circuit of depth 2k and complexity O (cid:16)n1+1/k log−1/k n(cid:17). Recall that rectifier (m, n)-circuit is an oriented graph with n vertices labeled as inputs and m vertices labeled as outputs. Modulo 2 rectifier circuit implements a Boolean m×n matrix A = (ai,j) iff for any i and j the number of oriented paths from j-th input to i-th output is congruent to ai,j modulo 2. Complexity of a circuit is the number of edges in it, circuit depth is the maximal length of an oriented path. See details in [3, 4]. n × n matrix Z = (zi,j) is circulant iff for any i, j one has zi,j = z0,k, where k = (j − i) mod n. Consider a linear map with Boolean circulant n×n matrix -- it computes a cyclic (algebraic, over GF (2)) convolution with some constant vector A. Indeed, components of vector C = (C0, . . . , Cn−1) which is a convolution of vectors A = (A0, . . . , An−1) and B = (B0, . . . , Bn−1) satisfy formulae: Ck = X i+j≡k mod n AiBj. The following theorem allows to extend results [1, 2] on comparison of complexity of implementation of some circulant matrices via rectifier circuits and modulo 2 rectifier circuits to bounded depth circuits. ∗Research supported in part by RFBR, grants 11 -- 01 -- 00508, 11 -- 01 -- 00792, and OMN RAS "Algebraic and combinatorial methods of mathematical cybernetics and information systems of new generation" program (project "Problems of optimal synthesis of control systems"). †e-mail: [email protected] 1 Theorem 1. For any k ∈ N an arbitrary Boolean circulant n × n matrix Z can be implemented via modulo 2 rectifier circuit: a) of depth 2k − 1 and complexity at most f (2k − 1)n1+1/k; b) of depth 2k and complexity at most f (2k)n(cid:16) n The proof is by induction. For k = 1 we use a trivial depth-1 circuit of complexity O(n2) and a circuit of depth 2 and complexity O(n2/ log n) provided by O.B. Lupanov's method [4]. log n(cid:17)1/k . Now we prove an induction step from k − 1 to k. We use the polyno- mial multiplication method due to A.L. Toom [6] together with . Schonhage's idea [5] allowing to extend the method to binary polynomials. The depth-d polynomial multiplication is reduced to several parallel depth-(d − 2) multi- plications. Split a vector of variables into q blocks of length n/q and interpret each block as a vector of coefficients of a polynomial from the ring R = GF (2)[y]/(y2·3s + y3s + 1). Parameter s satisfies condition 3s ≥ n/q. So, multiplication of binary polynomials of degree n − 1 can be performed as a multiplication of polynomials of degree n/q − 1 over R. The latter multiplication can be performed via DFT of order 3m ≥ 2q with primitive root ζ = ys+1−m ∈ R. Next, we describe a circuit. Its input is a polynomial B(x) = P Bixi ∈ R[x] of degree q − 1. A constant factor is denoted by A(x) = P Aixi. Output is the product C(x) = A(x)B(x) = P Cixi. 1. Compute B(ζ 0), . . . , B(ζ 3m 2. Compute C(ζ i) = A(ζ i)B(ζ i) for all i = 0, . . . , 3m − 1. 3. Compute coefficients of C(x). We implement stages 1 and 3 via depth-1 circuits and stage 2 -- via circuit of depth d − 2. Next, we estimate the circuit complexity, denote it by M(d, n). −1). 1. Multiplication by a power of y in R has linear complexity. Hence, the value of polynomial F (x) at the point yp can be computed with linear complexity as well. Therefore, the complexity of stage 1 is O(3m3sq). 2. Every multiplication at the stage 2 is a multiplication of binary poly- nomials of degree 2 · 3s − 1 with a subsequent modulo reduction. Perform multiplication via circuit of depth d − 2 and complexity M(d − 2, 2 · 3s) provided by induction hypothesis. Reduction of a polynomial g(y) (here, of degree 4 · 3s − 1) modulo y2·3s + y3s + 1 is performed via duplication of some 2 of its coefficients (that is, outputs of a preceding subcircuit) and identifying of some coefficients, since every coefficient of g is to be used at most twice. Henceforth, modulo reduction can be embedded into multiplication circuit with no depth increasing and with at most doubling of the circuit complexity. Thus, the total complexity of stage 2 is at most 2 · 3mM(d − 2, 2 · 3s). 3. By the fundamental property of DFT, coefficients of C(x) satisfy Ci = C ∗(ζ −i), where polynomial C ∗(x) has coefficients C(ζ i). Thus, the complexity of stage 3 is that of stage 1, O(3m3sq). To transform the product of polynomials over R backward to the product of binary polynomials, one performs a substitution x = y2·3s. The substitu- tion preserves depth and complexity of the circuit. The choice of parameters to obtain required complexity bounds is: q = n1/k for d = 2k − 1 and q = (n/ log n)1/k for d = 2k; 3s = Θ(n/q), 3m = Θ(q). (By construction, f (k) = O(ck) for some constant c.) References [1] Gashkov S. B., Sergeev I. S. On the complexity of linear Boolean op- erators with thin matrices. J. Applied and Industrial Math. 2011. 5(2), 202 -- 211. [2] Grinchuk M. I., Sergeev I. S. Thin circulant matrices and lower bounds on the complexity of some Boolean operators. Diskretn. Anal. Issled. Oper. 2011. 18(5), 38 -- 53 (in Russian). [3] Jukna S. Boolean function complexity. Advances and frontiers. Springer -- Verlag, 2012. [4] Lupanov O. B. On rectifier and switching-and-rectifier circuits. Dokl. Akad. Nauk SSSR. 1956. 111(6), 1171 -- 1174 (in Russian). [5] Schonhage A. Schnelle multiplikation von polynomen uber korpern der charakteristik 2. Acta Inf. 1977. 7, 395 -- 398. [6] Toom A. L. The complexity of a scheme of functional elements realizing the multiplication of integers. Soviet Math. Doklady. 1963. 4, 714 -- 716. 3 3 1 0 2 y a M 9 1 ] S D . s c [ 1 v 9 8 3 4 . 5 0 3 1 : v i X r a Реализация линейных преобразований с циркулянтными матрицами вентильными схемами по модулю 2 ограниченной глубины∗ И. С. Сергеев† Аннотация В настоящей заметке показано, что при любой постоянной k ∈ N произвольную булеву циркулянтную матрицу можно ре- ализовать вентильной схемой по модулю 2 глубины 2k − 1 и сложности O (cid:0)n1+1/k(cid:1), а также схемой глубины 2k и сложности O (cid:16)n1+1/k log−1/k n(cid:17). Напомним, что вентильная (m, n)-схема (cid:22) это ориентированный ациклический граф, в котором n вершин отмечены как входы и m вер- шин отмечены как выходы. Вентильная схема по модулю 2 реализует булеву m × n-матрицу A = (ai,j) тогда и только тогда, когда при любых i и j число ориентированных путей из j-го входа в i-й выход сравнимо с ai,j по модулю 2. Сложностью схемы называется число ребер в ней, а глубиной (cid:22) максимальная длина ориентированного пути. Подробнее см. в [3, 5]. n × n-матрица Z = (zi,j) называется циркулянтной, если при любых i, j выполнено zi,j = z0,k, где k = (j − i) mod n. Рассмотрим линейный булев оператор размера n × n с циркулянт- ной матрицей (cid:22) он реализует циклическую (алгебраическую, над GF (2)) ∗Работа выполнена при финансовой поддержке РФФИ, проекты 11 -- 01 -- 00508 и 11 -- 01 -- 00792, и программы фундаментальных исследований ОМН РАН ¾Алгебраические и комбинаторные методы математической кибернетики и информационные системы нового поколения¿ (проект ¾Задачи оптимального синтеза управляющих систем¿). †эл. адрес: [email protected] 1 свертку с некоторым постоянным вектором A. Действительно, компонен- ты вектора C = (C0, . . . , Cn−1) (cid:22) свертки векторов A = (A0, . . . , An−1) и B = (B0, . . . , Bn−1), выражаются формулами: Ck = X i+j≡k mod n AiBj. Следующая теорема позволяет распространить результаты [1, 2] о сравнении сложности реализации некоторых циркулянтных матриц вен- тильными схемами и вентильными схемами по модулю 2 на схемы огра- ниченной глубины. Теорема 1. При k ∈ N произвольную булеву циркулянтную n × n- матрицу Z можно реализовать вентильной схемой по модулю 2: . log n(cid:17)1/k а) глубины 2k − 1 и сложности не более f (2k − 1)n1+1/k; б) глубины 2k и сложности не более f (2k)n(cid:16) n Рассуждение проведем по индукции. При k = 1 предъявляются три- виальная схема глубины 1 и сложности O(n2), а также схема глубины 2 и сложности O(n2/ log n), которая строится методом О.Б. Лупанова [3]. Докажем индуктивный переход от k − 1 к k. Для доказательства ис- пользуется метод А.Л. Тоома умножения многочленов [4] вместе с при- емом А. Шенхаге [6], позволяющим распространить метод на двоичные многочлены. Умножение многочленов с глубиной d сводится к несколь- ким параллельным умножениям глубины d − 2. Разобьем вектор переменных на q частей длины n/q. Эти части ин- терпретируем как вектора коэффициентов многочленов из кольца R = GF (2)[y]/(y2·3s + y3s + 1) при младших степенях y. Параметр s выбирается из условия 3s ≥ n/q. Сведем умножение двоичных многочленов степени n−1 к умножению многочленов степени n/q −1 над R. Последнее умножение выполним при помощи ДПФ порядка 3m ≥ 2q с примитивным корнем ζ = ys+1−m ∈ R. Опишем схему. На входе многочлен B(x) = P Bixi ∈ R[x] степени q − 1. Постоянный сомножитель обозначим через A(x) = P Aixi. На выходе (cid:22) произведение C(x) = A(x)B(x) = P Cixi. 1. Вычисляем B(ζ 0), . . . , B(ζ 3m 2. Вычисляем C(ζ i) = A(ζ i)B(ζ i) для всех i = 0, . . . , 3m − 1. 3. Вычисляем коэффициенты многочлена C(x). −1). 2 Этапы 1 и 3 реализуем схемами глубины 1, а этап 2 (cid:22) схемой глубины d − 2. Оценим сложность схемы, обозначим ее M(d, n). 1. Умножение на степень y в кольце R выполняется с линейной слож- ностью, поэтому с линейной сложностью вычисляется значение много- члена F (x) в точке yp. Следовательно, сложность первой схемы оцени- вается как O(3m3sq). 2. Каждое из умножений на шаге 2 есть умножение двоичных много- членов степени 2 · 3s − 1 с последующим приведением по модулю. Умно- жение выполним методом из индуктивного предположения глубины d−2 и сложности M(d − 2, 2 · 3s). Приведение многочлена (в данном случае, степени 4 · 3s − 1) по модулю y2·3s + y3s + 1 достигается дублировани- ем некоторых его коэффициентов (выходов предшествующей схемы) и отождествлением некоторых коэффициентов, т.к. каждый коэффициент приводимого многочлена используется не более чем дважды. Следова- тельно, приведение по модулю можно реализовать без увеличения глуби- ны и с не более чем двукратным увеличением сложности. Общую слож- ность второго этапа теперь можно оценить как 2 · 3mM(d − 2, 2 · 3s). 3. Согласно основному свойству ДПФ искомые коэффициенты мно- гочлена C(x) находятся как Ci = C ∗(ζ −i), где многочлен C ∗(x) имеет коэффициенты C(ζ i). Поэтому сложность этапа 3 можно оценить так же, как и сложность этапа 1, O(3m3sq). Чтобы результат умножения многочленов над R преобразовать (об- ратно) в результат умножения двоичных многочленов, надо выполнить подстановку x = y2·3s и привести подобные. Это преобразование реали- зуется отождествлением выходов и не влияет на глубину и сложность схемы. Оценки теоремы получаются при следующем выборе параметров: q = n1/k при d = 2k − 1 и q = (n/ log n)1/k при d = 2k; 3s = Θ(n/q), 3m = Θ(q). (По построению, f (k) = O(ck) при некоторой константе c.) Список литературы [1] Гашков С. Б., Сергеев И. С. О сложности линейных булевых опе- раторов с редкими матрицами. Дискретный анализ и исследование операций. 2010. 17(3), 3 -- 18. [2] Гринчук М. И., Сергеев И. С. Редкие циркулянтные матрицы и ниж- ние оценки сложности некоторых булевых операторов. Дискретный анализ и исследование операций. 2011. 18(5), 38 -- 53. 3 [3] Лупанов О. Б. О вентильных и контактно-вентильных схемах. ДАН СССР. 1956. 111(6), 1171 -- 1174. [4] Тоом А. Л. О сложности схемы из функциональных элементов, реализующей умножение целых чисел. Доклады АН СССР. 1963. 150(3), 496 -- 498. [5] Jukna S. Boolean function complexity. Advances and frontiers. Springer -- Verlag, 2012. [6] Schonhage A. Schnelle multiplikation von polynomen uber korpern der charakteristik 2. Acta Inf. 1977. 7, 395 -- 398. 4
1806.06126
1
1806
2018-06-15T21:11:56
Tight Bound of Incremental Cover Trees for Dynamic Diversification
[ "cs.DS" ]
Dynamic diversification---finding a set of data points with maximum diversity from a time-dependent sample pool---is an important task in recommender systems, web search, database search, and notification services, to avoid showing users duplicate or very similar items. The incremental cover tree (ICT) with high computational efficiency and flexibility has been applied to this task, and shown good performance. Specifically, it was empirically observed that ICT typically provides a set with its diversity only marginally ($\sim 1/ 1.2$ times) worse than the greedy max-min (GMM) algorithm, the state-of-the-art method for static diversification with its performance bound optimal for any polynomial time algorithm. Nevertheless, the known performance bound for ICT is 4 times worse than this optimal bound. With this paper, we aim to fill this very gap between theory and empirical observations. For achieving this, we first analyze variants of ICT methods, and derive tighter performance bounds. We then investigate the gap between the obtained bound and empirical observations by using specially designed artificial data for which the optimal diversity is known. Finally, we analyze the tightness of the bound, and show that the bound cannot be further improved, i.e., this paper provides the tightest possible bound for ICT methods. In addition, we demonstrate a new use of dynamic diversification for generative image samplers, where prototypes are incrementally collected from a stream of artificial images generated by an image sampler.
cs.DS
cs
Tight Bound of Incremental Cover Trees for Dynamic Diversification Hannah Marienwald1,2, Wikor Pronobis1 Klaus-Robert Müller1,2,3,4 and Shinichi Nakajima1,2,5 1TU Berlin, 2Berlin Big Data Center, 3Korea University, 4MPI for Informatics, 5AIP, RIKEN [email protected] {hannah.marienwald@campus., klaus-robert.mueller@, nakajima@}tu-berlin.de [email protected] Abstract Dynamic diversification-finding a set of data points with maximum diversity from a time- dependent sample pool-is an important task in recommender systems, web search, database search, and notification services, to avoid showing users duplicate or very similar items. The incremental cover tree (ICT) with high computational efficiency and flexibility has been applied to this task, and shown good performance. Specifically, it was empirically observed that ICT typically provides a set with its diversity only marginally (∼ 1/1.2 times) worse than the greedy max-min (GMM) algorithm, the state-of-the-art method for static diversification with its performance bound optimal for any polynomial time algorithm. Nevertheless, the known performance bound for ICT is 4 times worse than this optimal bound. With this paper, we aim to fill this very gap between theory and empirical observations. For achieving this, we first analyze variants of ICT methods, and derive tighter performance bounds. We then investigate the gap between the obtained bound and empirical observations by using specially designed artificial data for which the optimal diversity is known. Finally, we analyze the tightness of the bound, and show that the bound cannot be further improved, i.e., this paper provides the tightest possible bound for ICT methods. In addition, we demonstrate a new use of dynamic diversification for generative image samplers, where prototypes are incrementally collected from a stream of artificial images generated by an image sampler. Introduction 1 The diversification problem is a notoriously important issue in a number of popular applications, e.g., in recommender systems [24, 23, 22], web search [11, 20], and database search [19, 6, 15]. Diversity helps to avoid showing users duplicate or very similar items, etc. Formally, it is defined as follows: Definition 1 (Diversification problem) Let V = {v1, . . . vN} be a set of N points in some metric space (V, d) with distance metric d : V × V → R+. The goal of the k-max-min diversification problem (for k ≤ N) is to select a subset S of V such that S = argmaxS(cid:48)⊆V,S(cid:48)=k div(S(cid:48)), where the diversity is defined as the minimum distance of any pair of data points in a set, i.e., div(S(cid:48)) = mins,s(cid:48)∈S(cid:48),s(cid:54)=s(cid:48) d(s, s(cid:48)). (1) (2) This problem is known to be NP-hard [9], and variety of approximation methods have been proposed [9, 18, 10, 20, 16, 8]. Among them, greedy max-min [18] is one of the state-of-the-art methods, although it was proposed several decades ago [10, 8]. It was shown that GMM is guaranteed to provide an approximate solution with its diversity no smaller than d∗/2, where d∗ is the diversity of the optimal solution [18]. Furthermore, it was also shown that d∗/2 is the best achievable bound by any polynomial time algorithm [18]. Recently, in many web applications including recommender systems, web search, and notification services, the diversification algorithm is required to handle streaming data, where the sample pool V is 1 Figure 1: Achieved inverse diversities relative to GMM on the Cities, Faces and MNIST data set. Detailed setting of experiments is described in Section 4. dynamic-some new items can be added and some old items can be removed from time to time. Drosou and Pitoura (2014) [8] argued that the cover tree (CT), which was originally proposed for nearest neighbor search [3, 12], is an appropriate tool to meet those streaming requirements. In particular a family of CT approaches, called the incremental cover trees (ICTs), are suitable for dynamic diversification, because it allows addition and removal of items online. The authors reported excellent empirical performance. Especially, two variants, called ICT Greedy and ICT Inherit, typically provide a set with its diversity only 1/1.2 times smaller than GMM (see Fig.1 for our experimental results). Nevertheless, the theoretically known performance bound of ICT is d∗/8 [8], which is 4 times worse than GMM. The goal of this paper is therefore to fill this gap between theory and empirical observations. We theoretically analyze the property of ICT, and derive a tighter performance bound, d∗/6, for ICT Greedy and ICT Inherit. Then, we investigate the obtained bound and the empirical observations in details, by using specially designed artificial data for which the optimal diversity is known. Finally, we analyze the tightness of performance bounds, and show that our proposed bounds cannot be improved further, i.e., for worst case analysis, this paper gives the tightest possible bounds of all ICT variants. In addition, we demonstrate a new application of dynamic diversification for generative image samplers, where prototypes are incrementally collected from a stream of artificial images generated by an image sampler. 2 Background As discussed already above, the k-max-min diversification problem is known to be NP-hard [18]. Therefore, various approximation algorithms have been proposed (see [13] for an overview). In order to assess the accuracy of their approximation, a theoretical bound on the worst possible performance is usually given. Definition 2 [21] (α-approximation algorithm) An α-approximation algorithm for an optimization problem produces for all instances of the problem a solution whose value is within a factor α of the value of the optimal solution. α is called the approximation factor. Let Sf = f (V, k) be a diverse subset of V of size k, which was computed using method f. f is said to be an α-approximation algorithm, iff for all possible diversification problems (3) where d∗ is the optimal diversity. Small values for α indicate better guaranteed performance, but because the approximate solution can at most be as good as the optimal solution, α ≥ 1. Along with the computational complexity, the approximation factor is an important criterion that theoretically guarantees the performance of an algorithm. div(Sf ) ≥ d∗/α, 2 Algorithm 2 Cover Tree for k-Max-Min Diversifi- cation Problem Input: CT - a cover tree for data set V , k - size of the subset Output: S - diverse subset of V of size k 1: i ← imax 2: while Ci < k do i ← i − 1 3: 4: end while 5: S ← select k nodes from Ci 6: return S Algorithm 1 Greedy Max-Min (GMM) Input: V - a set of points, k - size of the subset Output: S - diverse subset of V of size k 1: S ← randomly selected point v ∈ V 2: while S < k do s∗ ← argmaxv∈V \S mins∈S d(v, s) 3: S ← S ∪ {s∗} 4: 5: end while 6: return S In this section we summarize GMM, one of the most established algorithms, and cover tree-based approaches. We give for each method the complexity and the approximation factor. 2.1 Greedy Max-Min (GMM) Algorithm Although proposed several decades ago, greedy max-min (GMM) [18] is still state-of-the-art for the diversification problem. A detailed description of the algorithm can be found in Algorithm 1. GMM approximates the diverse subset in a greedy manner, starting with either a randomly selected data point (line 1) [1] or the two most distant data points of the set [18]. In subsequent iterations the data point with the largest pairwise distance to the current subset is added to the diverse set (line 3, 4). As the authors showed, GMM has an approximation factor αGMM of 2 and a complexity that is in O(N · k). Incremental Cover-tree (ICT) Approaches 2.2 Although, originally proposed for sublinear-time k-nearest neighbor search, the cover tree [4] can easily be adapted for diverse set approximation. A cover tree for a data set V is a leveled tree such that each layer of the tree covers the layer beneath it. Every layer of the tree is associated with an integer level i, which decreases as we descend the tree. The lowest layer of the tree holds the whole data set V and is associated with the smallest level imin, whereas the root of the tree is associated with the largest level imax. A node in the tree corresponds to a single data point in V , but a data point might map to multiple nodes. However, any point can only appear once in each layer. Let layer Ci be the set of all nodes at level i. For all level i with imin ≤ i ≤ imax, the following invariants must be met: (1) Nesting: Ci ⊆ Ci−1. Once a point p ∈ V appears in Ci, every lower layer in the tree has a node associated with p. (2) Covering: For every p ∈ Ci−1, there exists a q ∈ Ci such that d(p, q) ≤ bi and the node in Ci associated with q is a parent of the node of p in Ci−1. (3) Separation: For all distinct p, q ∈ Ci, d(p, q) > bi. Here b > 1 denotes the base of the cover tree. The cover tree was proposed with b = 2, but extended to arbitrary bases in [8] (cf. Fig. 8 in Appendix F for cover tree examples). Due to the invariants, each layer of the tree might already be an useful approximation. The general procedure of using a cover tree for the k-max-min diversification problem, is shown in Algorithm 2. It aims to find the termination layer Ci of the cover tree, i.e. the first layer that holds at least k nodes. In general Ci ≥ k, thus, a subset of nodes must be selected (line 5). Possible selection strategies were introduced in [8] and are presented below.1 ICT Basic ICT Basic is the most straight-forward approach. It randomly selects k nodes out of Ci, with its complexity in O(k). Because of the random selection, the diversity of the subset computed with ICT Basic might be the same as the diversity of the whole termination layer. ICT Greedy ICT Greedy combines the cover tree approach with GMM. After the termination layer was located, we apply GMM on Ci in order to select k nodes. Compared to the purely random approach, this selection strategy will, in most cases, give results with higher diversity. By applying GMM only on Ci instead of V , the complexity drastically reduces and is in O(Ci · k). 1 The authors of [8] also proposed a CT variant, called the cover-tree batch (CT Batch), with guaranteed approximation factor α = 2. However, the cover-tree construction is as slow as GMM, and it cannot accept addition and removal of items in streaming data. 3 ICT Inherit is the most enhanced ICT Inherit approach. It maintains the performance of ICT Greedy but further reduces the complexity. A detailed description can be found in Algorithm 3. Instead of applying GMM on the whole layer Ci, we initialize the diverse subset with the previous layer Ci+1 (line 5) and only select some nodes from the termination layer (line 6 to 9). Due to the separa- tion invariant of the cover tree, Ci+1 already has a high diversity and, therefore, is an adequate initial- ization for the selection process. The complexity of ICT Inherit is in O (Ci \ Ci+1 · (k − Ci+1)). Algorithm 3 Cover Tree Inherit Input: CT - a cover tree for data set V , k - size of the subset Output: S - diverse subset of V of size k 1: i ← imax 2: while Ci < k do i ← i − 1 3: 4: end while 5: S ← Ci+1 6: while S < k do s∗ ← argmaxc ∈ Ci\(S∪Ci+1) mins∈S d(c, s) 7: S ← S ∪ {s∗} 8: 9: end while 10: return S 2.2.1 Approximation Factor In [8] a first attempt to estimate the approximation factor was made. Proposition 1 [8] For f ∈ {ICTBasic, ICTGreedy, ICTInherit} For a cover tree built with b = 2, this results in an approximation factor of α = 8, regardless of which selection strategy is used. However, as we will see in Sec. 3, a lower and tighter approximation factor for ICT Greedy and ICT Inherit can be proven. αf = 2b2 b−1 . (4) 2.3 Diversification of Dynamic Data In many applications the set, for which a diverse subset is required, is not static. New data points must be added or old ones have to be removed from time to time. Unfortunately, GMM is not an adequate choice for the diversification of dynamic data. Whenever the data set V is changed, GMM has to be rerun from scratch. Whereas the cover tree is a dynamic data structure. Insertion and removal of data points state no problem and the cover tree can easily be used for the diversification of dynamic data using the approaches presented above. Adding or removing a data point has complexity O(c6 · N log N ) where c is the expansion constant [4, 8]. 3 Theoretical Analysis Because of the cover tree properties, each layer of the cover tree might already be an appropriate starting point for the approximation of the diverse set. However, depending on the selection strategy, the quality of the diversity is likely to differ. We expect ICT Greedy and ICT Inherit to give results with higher diversity than ICT Basic. In the following we will prove that the approximation factor derived in [8] is only a loose bound when it comes to the GMM-based selection strategies. Theorem 1 Let Ci be the termination layer, i.e. the first layer of the cover tree that holds at least k nodes (5) (cid:111) 2b b−1 ) (6) (7) (8) (9) and β ∈ R+ be defined, such that ∀j > i,Cj < k, bi = d∗ β . The diversity of every subset of Ci can be bounded ∀ C ⊆ Ci : div (C) ≥ d∗ (cid:110) d∗ Furthermore, Ci will hold a subset C of k nodes with diversity of at least β , d∗(1 − 1 ∃ C ⊆ Ci,C = k : div (C) ≥ max β . β and β < 2b2 b−1. It follows div(C) ≤ 1 + 2b d∗ b−1 . 4 Figure 2: Visualization of the theoretical bounds derived in Sec. 3. (left) Guaranteed approximation factor for ICT Basic and ICT Inherit for different values of the base b. ICT Greedy has the same approximation factor as ICT Inherit. (right) The bound on the diversity derived in Eq. (8) for various values of β and b = 2. Separation Property shows the first part of the maximum and Covering Property shows the latter part of the maximum. The intercept of both lines shows what is stated in Eq. (9). The worst case approximation factor is 6. We give a sketch of the proof. For a detailed discussion see Appendix B. Eq. (7) and the first part of the maximum in Eq. (8) follows from the separation property of the cover tree. The latter part of the maximum follows from the covering and nesting property. Any layer of the cover tree covers the whole data set. As a consequence Ci is guaranteed to hold a subset of nodes, that cover the optimal diverse set. The triangle inequality can then be used, to bound the distance between those nodes. This gives rise to (cid:3) the existence of C and the latter part of the maximum. For some β it is crucial to select a subset of Ci in an appropriate manner. Thus, the diversity strongly depends on the strategy, that is used to select k nodes out of Ci. Corollary 1 Let SICTGreedy ⊆ Ci be a subset of k nodes selected from Ci using GMM (ICT Greedy). The diversity of SICTGreedy is at least div(cid:0)SICTGreedy(cid:1) ≥ max (cid:110) d∗ 2 d∗(1 − 1 β β , 1 2b b−1 ) . (10) (11) The approximation factor α of ICT Greedy is given by div(SICTGreedy) ≤ 2 + 2b d∗ b−1 = αICTGreedy. For a detailed proof see Appendix C. The diversity of the selected subset cannot be worse than d∗ /β, because that bound is given by the separation criterion. As it was shown in [18], GMM has an approximation factor of 2. The best possible diversity in layer Ci is given by Eq. (8). We get what is stated in Eq. (10). (cid:3) For b = 2, this results in an approximation factor of αICTGreedy = 6. Compared to ICT Greedy, ICT Inherit has a lower complexity. Moreover, ICT Inherit has the same bound on the diversity and the same approximation factor. Theorem 2 Let SICTInherit ⊆ Ci be a subset of k nodes selected from Ci. It holds all nodes from the previous layer Ci+1 and remaining nodes were selected from Ci \ Ci+1 using GMM (ICT Inherit). The bound of the diversity of SICTInherit is the same as the bound for div(cid:0)SICTGreedy(cid:1), i.e. div(cid:0)SICTInherit(cid:1) ≥ max (cid:110) d∗ 2 d∗(1 − 1 β β , 1 2b b−1 ) (cid:111) (cid:111) The approximation factor α of ICT Inherit is given by div(SICTInherit) ≤ 2 + 2b d∗ b−1 = αICTInherit. For a detailed proof, see Appendix D. Instead of starting with a randomly selected data point, ICT Inherit initializes GMM with Ci+1. An approximation factor of 2 for GMM was proven by induction in [18]. In order to prove that initializing GMM still leads to an approximation factor of 2, it is thus 5 . (12) (13) Figure 3: 2D artificial data consisting of 2× 2 (left), 3× 3 (center) or 5× 5 grid points (right) and random, uniformly distributed points. The optimal diversity is d∗ = 1.0. sufficient to show the minimum pairwise distance in Ci+1 is larger than or equal to half of the optimal diversity of Ci. Because of the separation property of the cover tree, the nodes in Ci+1 are guaranteed to have larger pairwise distance than the nodes in Ci. Using also the nesting property Ci+1 ⊆ Ci, we can (cid:3) conclude that div (Ci+1) is sufficiently large. Figure 2 (left) shows the approximation factor for different bases b. Especially for b = 2, using ICT Greedy or ICT Inherit as selection strategy reduces the approximation factor. Figure 2 (right) shows the bound on the diversity derived in Eq. (8). One can see, for small β the diversity of the subset is given by the separation criterion. This can also be explained intuitively. As β increases, the pairwise distance that is bounded by the separation criterion decreases. However, the cover radius bi of each node decreases as well, so that at least k nodes in Ci must lie close to the data points in the optimal solution to be able to cover them. Therefore, the pairwise distance of those nodes increases as β decreases. When the termination layer corresponds to a lower level of the tree (larger β), it is beneficial to use a GMM-based selection strategy. The minimum of both bounds corresponds to the approximation factor. 4 Tightness of Performance Bounds According to our theory in Section 3, the approximation factor of ICT methods are αICTBasic = 8, αICTGreedy = αICTInherit = 6 for b = 2. In this section, we investigate if these bounds are tight or whether there is still room for improvement. We first conducted an artificial data experiment, designed for validating our theory. We created a set of data points consisting of grid points and random points (see Fig. 3 for examples). For k equal to the number of grid points, the optimal diverse subset is given by the grid. Using the methods presented above, we approximate the diverse subsets and computed the relative /Sf for f ∈ {GMM, ICTBasic, ICTGreedy, ICTInherit}. According to Eq. (3), the inverse diversity d∗ inv. computed rel. diversity indicate better results. By repeating the experiments (100 trials each), we were able to estimate the distribution of the rel. inv. diversity. Figure 4 shows the result on the 2D and 5D grid data for base b set to 2. inv. diversity can at most be as large as the approximation factor and small rel. We still observe a big gap between the theoretical bounds and empirical observations. Although GMM has an approximation factor that is three times lower than the guaranteed approximation factor of ICT Greedy and ICT Inherit with b = 2, only minor differences can be seen. One can see, that the center of the distribution of the observed rel. inv. diversity is even lower than 2. The highest observed rel. inv. diversity was 2.9 for ICT Inherit, 2.6 for ICT Greedy and 3.9 for ICT Basic on the 2D data set. Note that for larger k, we tend to select nodes from lower layers of the tree. Lower layers hold more, but evenly spaced nodes, because their cover radius bi is smaller. This might explain the excellent performance on the 5D grid data. The approximation factor is defined as an upper bound. Thus, when an approximation factor is proven, it does not imply, that no smaller approximation factor is possible. Because of the high performance of the cover tree approaches on the grid data sets, one might expect lower approximation factors, than the ones that were proven in Sec. 3. However, we provide two examples, that show the tightness of αICTBasic, αICTGreedy and αICTInherit (see Appendix E). Thereby, we have shown that no lower approximation factor can be proven. Note, that the rel. inv. diversity does not only depend on the data pool, but also on the order in which the data is added to the tree. Even for the examples, which are discussed in the Appendix, we only get the worst case rel. inv. diversity, if the data points are added in a specific order. 6 Figure 4: Estimated distribution of the relative inverse diversity on the 2D (left) and 5D (right) grid data. The cover tree was built with b = 2. The dashed vertical lines indicate the proven approximation factor. When this order is changed, we might also get the optimal diverse set. See the Appedendix A for the incremental insertion algorithm of the cover tree. With the excellent performance on the artificial data and this observation at hand, we can conclude, that observing the worst possible rel. inv. diversity is highly unlikely, but not impossible. We also conducted real world data experiments - both high dimensional and large sample sized. Cities [5] consists of the latitude and longitude of cities in Europe. Faces [2] consists of 60x64 grey- scale images of people taken with varying pose and expressions. MNIST [14] holds 28x28 images of handwritten digits. For each of the data sets we ran GMM and the cover tree approaches (built with b = 2) with varying diverse set sizes (k ∈ [2, 100]). In general the optimal diversity is unknown. Therefore, we plotted the inverse diversity relative to the diversity of GMM, i.e., div(SGMM )/div(Sf ), where f ∈ {ICTBasic, ICTGreedy, ICTInherit} corresponds to the applied method. This can be used to bound the true rel. inv. diversity. If, for example, div(SGMM )/div(SICTInherit) = 1.5, we can conclude /div(SICTInherit) ≤ 3, because GMM has an approximation factor of 2. d∗ Figure 1 shows the inv. diversity relative to the diversity of GMM on the Cities, Faces and MNIST data set. ICT Greedy, ICT Inherit and GMM compute subsets with diversities of almost the same magnitude. Even ICT Basic gives results with high diversity. Note, that the inv. diversity relative to GMM of ICT Basic resembles a step-function. This can be explained by the layer-wise structure of the cover tree. When k is small compared to the number of nodes in the termination layer, ICT Basic might select poorly which results in lower diversity than ICT Inherit. As k approaches the size of the layer, both approaches will select similar subsets. 5 Application to Image Generator As a new use of dynamic diversification, we applied ICT Inherit to sequentially collect a diverse set from the MCMC image sequence generated by the plug and play generative networks (PPGN) [17],2 which have shown to provide highly diverse realistic images with high resolution. For generated images by MCMC sampling, there is strong correlation between subsequent images. One needs to cherry-pick diverse images by hand, or generate a long sequence and randomly choose images from it, to show how diverse the images are, that a new sampling strategy generates. Dynamic diversification by ICT Inherit can automate this process, and might be used as a standard tool to assess the diversity of samplers. 2 The code is available from https://github.com/Evolving-AI-Lab/ppgn. 7 Figure 5: k = 5 randomly chosen images (left) from the MCMC sequence of PPGN for Volcano class, and the corresponding diverse sets (right) chosen by ICT Inherit, after 20 (bottom), 100 (middle), and 200 (top) MCMC steps. Fig.5 shows images of the Volcano class generated by PPGN. We ran PPGN up to 200 steps, adding a new image to ICT Inherit in each step. In the right half of Fig.12, we show the k = 5 diverse images after 20 (bottom row), 100 (middle row), and 200 (top row) steps of image generation. For comparison, we show randomly chosen images in the left half. We can see that ICT Inherit successfully chose more diverse images than the random choice. More examples for other classes are shown in Appendix G. 6 Conclusion Selecting a diverse subset of a dynamic sample pool-dynamic diversification-is a common problem in many machine learning applications. The diversification problem is known to be NP-hard, but polynomial time approximation algorithms, such as greedy max-min (GMM) algorithm, can have an approximation factor of 2, i.e., they are guaranteed to give a solution with diversity larger than half of the optimal diversity. However, GMM has to be performed from scratch every time the sample pool is updated, e.g., new items are added or old items are removed, and therefore is not suitable for dynamic diversification. Previous work argued that cover trees, originally proposed for nearest neighbor search, could be adapted for dynamic diversification, and proposed ICT Basic, ICT Greedy and ICT Inherit, which gave results only marginally worse than the results of GMM, while the approximation factor of those approaches was assumed to be four times larger. In this work we have conducted both theoretical analyses and extensive experiments to fill the gap between the theoretical bound and empirical observation. Specifically, we could prove a tighter approximation factor for ICT Greedy and ICT Inherit, reducing it to 6 instead of 8 for a cover tree with base b = 2. Through artificial experiment, we have validated the bounds, and assessed the tightness of the bounds. Even on real world data sets, all three cover tree approaches give excellent results, with diversities almost of the same magnitude as the diversity given by GMM. The performance of the cover tree approaches is remarkably higher than the theoretical approximation factor, which might imply that our bounds are still loose. However, we found worst case examples that achieve the theoretical approximation factor, which proves that our bounds for ICT are tightest possible. In general, the diversity of subsets computed with one of the cover tree approaches does not only depend on the data pool, but also on the order in which the data is added to the tree. Therefore, we conclude, that observing the worst possible relative inverse diversity is highly unlikely. Further effort must be made to assess how likely cover tree approaches give solutions with worst possible diversity. Finally, our demonstration of dynamic diversification for generative image samplers shows the high potential of our theoretical insight for practical applications. Future work will also study diversification in scientific applications, where systematically creating a diverse (and therefore representative) subset of large data corpora can lead to novel insight, e.g. in molecular dynamics or sampling applications in chemistry. Acknowledgments The authors thank Vignesh Srinivasan of Fraunhofer HHI for discussion on the image generator application. This work was supported by the German Research Foundation (GRK 1589/1) by the Federal Ministry of Education and Research (BMBF) under the project Berlin Big Data Center (FKZ 01IS14013A). 8 References [1] Sofiane Abbar, Sihem Amer-Yahia, Piotr Indyk, Sepideh Mahabadi, and Kasturi R Varadarajan. Diverse near neighbor problem. In Proceedings of the twenty-ninth annual symposium on Computational geometry, pages 207–214. ACM, 2013. [2] The UCI KDD Archive. CMU faces images. http://kdd.ics.uci.edu/databases/faces/faces.html. Accessed on 2018-05-18. [3] Alina Beygelzimer, Sham Kakade, and John Langford. Cover trees for nearest neighbor. In Proc. of ICML, pages 97–104, 2006. [4] Alina Beygelzimer, Sham Kakade, and John Langford. Cover trees for nearest neighbor. In Proceedings of the 23rd international conference on Machine learning, pages 97–104. ACM, 2006. [5] Center For International Earth Science Information Network-CIESIN-Columbia University. Gridded popu- lation of the world: Basic demographic characteristics. https://doi.org/10.7927/H45H7D7F. Accessed on 2016-12-13. [6] E. Demidova, P. Fankhauser, X. Zhou, and W. Nejdl. DivQ: Diversification for keyword search over structured databases. In Proc. of SIGIR, pages 331–338, 2010. [7] Marina Drosou and Evaggelia Pitoura. Poikilo: A tool for evaluating the results of diversification models and algorithms. Proceedings of the VLDB Endowment, 6(12):1246–1249, 2013. [8] Marina Drosou and Evaggelia Pitoura. Diverse set selection over dynamic data. IEEE Transactions on Knowledge and Data Engineering, 26(5):1102–1116, 2014. [9] E. Erkut. The discrete p-dispersion problem. European Journal of Operational Research, 1(1), 1990. [10] E. Erkut, Y. Ulkusal, and O Yenicerioglu. A comparison of p-dispersion heuristics. Computers and Operations Research, 21(10), 1995. [11] S. Gollapudi and A. Sharma. An axiomatic approach for result diversification. In Proc. of WWW, pages 381–390, 2009. [12] M. Izbicki and C. R. Shelton. Fast cover trees. In Proc. of ICML, 2015. [13] Matevž Kunaver and Tomaž Požrl. Diversity in recommender systems–a survey. Knowledge-Based Systems, 123:154–162, 2017. [14] Yann LeCun and Corinna Cortes. MNIST handwritten digit database. http://yann.lecun.com/exdb/mnist/, 2010. [15] Z. Liu, P. Sun, and Y. Chen. Structured search result differentiation. In Proc. of VLDB, 2009. [16] E. Minack, W. Siberski, and W. Nejdl. Incremental diversification for very large sets: A streaming-based approach. In Proc. of SIGIR, 2011. [17] A. Nguyen, J. Clune, Y. Bengio, A. Dosovitskiy, and J. Yosinski. Plug & play generative networks: Conditional iterative generation of images in latent space. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 3510–3520, 2017. [18] SS Ravi, Daniel J Rosenkrantz, and Giri Kumar Tayi. Facility dispersion problems: Heuristics and special cases. In Workshop on Algorithms and Data Structures, pages 355–366. Springer, 1991. [19] E. Vee, U. Srivastava, J. Shanmugasundaram, P. Bhat, and S. A. Yahia. Efficient computation of diverse query results. In Proc. of ICDE, pages 228–236, 2008. [20] M. R. Vieira, H. L. Razente, M. C. N. Barioni, M. Hadjieleftheriou, D. Srivastava, C. T. Jr., and V. J. Tsotras. On query result diversification. In Proc. of ICDE, 2011. [21] David P Williamson and David B Shmoys. The design of approximation algorithms. Cambridge university press, 2011. [22] C. Yu, L. V. Lakshmanan, and S. Amer-Yahia. Recommendation diversification using explanations. In Proc. of ICDE, 2009. [23] M. Zhang and N. Hurley. Avoiding monotony: Improving the diversity of recommendation lists. In Proc. of RecSys, 2008. [24] C.-N. Ziegler, S. M. McNee, J. A. Konstan, and G. Lausen. Improving recommendation lists through topic diversification. In Proc. of WWW, pages 381–390, 2005. 9 A Incremental Insertion Algorithm 4 shows how a data point p can be inserted in an existing cover tree. It is based on the insertion algorithm in [4], which was extended to arbitrary bases in [8]. We reduced the complexity of the algorithm by omitting the nearest-parent heuristic. Algorithm 4 Insert(p, Qi, i) Input: p - data point Qi - subset of nodes of layer i of the cover tree Output: Cover tree with p inserted 1: C ← {children(q)q ∈ Qi} 2: if minc∈C d(p, c) > bi then 3: 4: else return true 5: Qi−1 ←(cid:110) (cid:111) c ∈ Cd(p, c) ≤ bi b−1 flag ← Insert(p, Qi−1, i − 1) if flag and d(p, Qi) ≤ bi then q∗ ← choose node in Qi as parent make p a child of q∗ return false 6: 7: 8: 9: 10: 11: 12: 13: 14: end if else return flag end if We start with the root layer Insert(p, Cimax , imax) and traverse the cover tree until we find the first layer such that p is separated from all other nodes (line 2). Only the nodes that can cover p are considered in each iteration (Qi). When we found an appropriate layer (line 7), we add p as a child to one node in Qi (line 8,9). B Proof of Theorem 1 B.1 Bound on β Recall (Eq. (6)), that β is defined as the fraction of the optimal diversity and the cover radius of the termination layer. Because the optimal solution is not known, the exact value of β can in general not be identified. We will use the properties of the cover tree to give a bound on possible values of β. We first consider how β must be chosen, so that Ci holds at least k nodes. To do so, assume we try to enclose, two data points p and p(cid:48) with d(p, p(cid:48)) = d∗ with one ball. A single ball won't be able to enclose those two data points, if its radius is less than d∗ /2. No matter where the ball is placed, the maximal distance it can enclose is less than 2 · d∗ /2 and thus, smaller than the distance between p and p(cid:48). Because it holds for any pair of data points, the same will hold for the general case of k data points. If the pairwise distance between two data points is at least d∗, any ball with radius less than d∗ /2 can only enclose one of those k data points at once. Thus, we need at least k balls to enclose k data points. v ∈ desc(c). Furthermore, we say that a layer C of the cover tree covers a set of nodes C(cid:48), if Let desc(c) denote the the set of descendants of node c. We say, that a node c covers a node v, if desc(c) . (14) As a consequence of the covering and the nesting property, each layer of the cover tree does not only cover the layer beneath it, but covers the whole data set V , i.e. ∀i ∈ [imin, imax] : desc(c) = V. (15) Let S∗ ⊆ V with div(S∗) = d∗ denote the optimal diverse set. Because S∗ is a subset of V , Ci will cover the optimal solution i.e. (16) (cid:33) (cid:33) C(cid:48) ⊆ c∈C (cid:32)(cid:91) (cid:32)(cid:91) S∗ ⊆ (cid:91) c∈Ci desc(c). c∈Ci 10 The maximal distance to any descendant of any node c ∈ Ci can be bounded bi+1 b − 1 Thus, if the maximal distance to any descendant is less than d∗ /2, any node c in Ci will only be able to cover one of the optimal data points in S∗. Because S∗ = k, Ci is guaranteed to hold at least k nodes, if ∀c ∈ Ci,∀v ∈ desc(c) : d(c, v) < b b − 1 (17) = . d∗ β ⇔ d∗ bi+1 b − 1 b b − 1 β ⇔ 2b b − 1 2 ≤ d∗ ≤ d∗ 2 ≤ β (18) (19) (20) (we can use ≤ instead of strict inequality, because bi+1/b−1 is already a strict upper bound for the distance to the descendants). We have shown, that Ci will hold at least k data points, if bi ≤ d∗ · b−1/2b. Note, that the cover tree might already hold k nodes in an higher layer, especially because Ci must not only cover S∗ but the whole data set V . In those cases, the diversity of the solution will be higher (separation criterion). This property can be used to find an upper bound for β. Assume Ci is the termination layer and bi = d∗ · b−1/2b2. In that case bi+1 = b · d∗ · b−1/2b2 = d∗ · b−1/2b. However, as shown above, this implies that Ci+1 holds at least k nodes. Thus, Ci cannot be the termination layer, because Ci+1 would have been. We can conclude β < 2b2 b − 1 . (21) B.2 Bound on the Diversity We prove each part of the maximum in Eq. (8) individually. The first part follows immediately from the separation criterion and the definition of β. Any subset of Ci will have a diversity of at least d∗ /β, ∀c, c(cid:48) ∈ Ci, d(c, c(cid:48)) > bi ⇒ div(Ci) > . (22) d∗ β In order to prove the second part of the maximum, we assume every data point of the optimal solution is covered by a single node in Ci, i.e. β ≥ 2b/b−1. Let c, c(cid:48) ∈ Ci be an arbitrary pair of nodes in the termination layer which covers p, p(cid:48) ∈ S∗. Without loss of generality we assume c covers p, c(cid:48) covers p(cid:48) and d(p, p(cid:48)) ≥ d∗. Because of the covering property bi+1 b − 1 bi+1 b − 1 b b − 1 b b − 1 d(c(cid:48), p(cid:48)) < d∗ β d∗ β d(c, p) < (23) (24) = = . Using the triangle inequality, we get d(p, c) + d(c, p(cid:48)) ≥ d(p, p(cid:48)) d(p, c) + d(c, c(cid:48)) + d(c(cid:48), p(cid:48)) ≥ d(p, p(cid:48)) d(c, c(cid:48)) ≥ d(p, p(cid:48)) − d(p, c) − d(c(cid:48), p(cid:48)) d(c, c(cid:48)) > d∗ − d∗ β d(c, c(cid:48)) > d∗(1 − 1 β b b − 1 2b b − 1 b b − 1 − d∗ ). β (25) (26) (27) (28) (29) Because any data point of the optimal solution is by assumption covered by one node in Ci and the pairwise distance of those data points is at least d∗, it follows that Ci holds a subset of k nodes, that have pairwise distance of at least d∗(1 − 1/β · 2b/b−1). Recall, that we assumed β ≥ 2b/b−1 in the beginning of the second part of the proof, to make sure that every data point of the optimal solution is covered by a different node of the termination layer. This does not impose any restrictions on the validity of the bound, because for β < 2b/b−1, max{d∗ /β and the overall bound still holds. This concludes the proof of the theorem. /β, d∗(1 − 1/β · 2b/b−1)} = d∗ 11 B.3 Fraction of Diversities First note, that d∗ bound of the diversity in Eq. (8) is minimal, when /β decreases and d∗ · (1 − 1/β · 2b/b−1) increases as β increases. As a consequence, the Solving for β leads to d∗ β = d∗(1 − 1 β 2b b − 1 ). 1 β = 1 − 1 β 2b b − 1 1 β (1 + ) = 1 2b b − 1 2b b − 1 1 + = β. We use this minimum and give a bound on the fraction of the diversities (cid:110) max (cid:110) d∗ d∗ β , d∗(1 − 1 β 2b b−1 ) (cid:111)(cid:111) d∗ div(C) ≤ = minβ d∗ d∗ 1+ 2b b−1 = 1 + 2b b − 1 . (30) (31) (32) (33) (34) (35) (36) (37) (38) (39) (40) (41) C Proof of Corollary of Theorem 1 Suppose we use ICT Greedy to select a subset of k nodes from Ci. The diversity of the selected subset cannot be worse than d∗ /β, because that bound is given by the separation criterion. As it was shown in [18], GMM has an approximation factor of 2. We select k nodes from Ci not from V itself. Thus, the best possible diversity is not d∗, but rather given by Eq. (8), i.e. the optimal diversity in layer Ci. We get what is stated in Eq. (10). As it was shown in [18], the complexity of GMM is in O(N · k) where N is the size of the set, from which k data points are selected. Here we select data points from the termination layer, i.e. N = Ci. Analogous to what was shown in Sec. B.3, we can prove the approximation factor of ICT Greedy. Solving for β leads to d∗ β = 1 2 d∗(1 − 1 β 2b b − 1 ) β = 2 + 2b b − 1 . Again, we use this value for the calculation of the minimum of div(SICTGreedy) (cid:110) max (cid:110) d∗ d∗ 2 d∗(1 − 1 β , 1 β 2b b−1 ) (cid:111)(cid:111) d∗ div(SICTGreedy) ≤ = minβ d∗ d∗ 2+ 2b b−1 = 2 + 2b b − 1 . D Proof of Theorem 2 ICT Inherit uses GMM to calculate a subset of layer Ci. Instead of starting with a randomly selected data point (as in GMM or ICT Greedy resp.), we start with Ci+1 and subsequently add new data points. The proof of the approximation factor of GMM relies on induction, thereby it was shown that 12 the approximation factor holds after each iteration (see [18] for more details). Once it is shown that Ci+1 does not contradict an approximation factor of 2, the remaining proof in [18] can simply be applied. Thus, we show for any possible value of β the minimum possible pairwise distance in Ci+1 is larger than or equal to half of the optimal diversity in Ci. Because the diversity of Ci can at most be as large as the optimal diversity, β ≥ 1 (recall Eq. (7)). As it was stated in the first theorem, β < 2b2/b−1. According to the separation criterion ∀c, c(cid:48) ∈ Ci+1, d(c, c(cid:48)) > bi+1 = b · d∗ (cid:20) (cid:26) d∗ β ≥ max 1 2 d∗(1 − 1 β , β . b · d∗ β (cid:27) ) . 2b b − 1 (cid:20) ∀β ∈ 1, (cid:111) 2b2 b − 1 = d∗ β b · d∗ β ≥ d∗ β and thus, we show (cid:110) d∗ Case A max 2 d∗(1 − 1 β β , 1 2b b−1 ) (cid:110) d∗ holds, since b > 1. 2 d∗(1 − 1 β , 1 β Case B max (cid:111) 2b b−1 ) (42) (43) (44) (45) (46) (47) (48) (49) (50) (51) (52) = 1 2 d∗(1 − 1 β β 2b b−1 ) b · d∗ b · d∗ β b · 1 β b + 2b b − 1 4b b − 1 2b + 2b · (b + 1) b − 1 ) 2b b − 1 b b − 1 d∗(1 − 1 β d∗ − d∗ − 1 β β b b − 1 ≥ 1 2 ≥ 1 2 ≥ 1 2 ≥ β 2 ≥ β ≥ β div(Ci+1) ≥ max (cid:26) d∗ β , 1 2 d∗(1 − 1 β 2b b − 1 ) (cid:27) holds for β ∈(cid:104) (cid:104) . 1, 2b2 b−1 Thus, which was to be shown. When GMM is initialized with Ci+1 it only has to select k − Ci+1 data points. It is easy to see that the complexity reduces. In the first iteration, the distances from each data point in Ci+1 to every data point in Ci \ Ci+1 is computed in order to find the next data point. In each subsequent iteration, only the distance between the data point which was selected in the last iteration and the remaining available data set is computed. In total, ICT Inherit performs (Ci \ Ci+1 · (k − Ci+1)) + (Ci \ Ci+1 − m) (53) distance computations and has therefore a complexity of O (Ci \ Ci+1 · (k − Ci+1)). Because ICT Inherit has the same bound on the diversity as ICT Greedy (cf. (10) and (12)), both approaches have the same approximation factor. k−Ci+1−1(cid:88) m=1 E Tightness of the Proven Approximation Factors The approximation factor is defined as an upper bound. Thus, when an approximation factor is proven, it does not imply, that no smaller approximation factor is possible. In this section we give two examples, that show the tightness of the derived approximation factors for arbitrary bases and k = 2. 13 E.1 Tightness of αICTBasic Let the data set be defined as  (cid:18) v 0 (cid:18) 0 (cid:19) , b + µ (cid:19) V = {0} ∪  (cid:91) J∈[1,Jmax]  J(cid:88) j=1 b2 · (cid:18) 1 (cid:19)j−1 b   ∪ (cid:26) b3 b − 1 (cid:27) , − η v ∈ ± where µ, η > 0 small and Jmax be the smallest integer such that b3−Jmax b − 1 − bimin+1 ≤ η. (54) (55) Most of the data points in V lie on the line between (− b3 T , where the distance between neighboring data points decreases as we move to the ends of the line. Only the data point (0, b + µ)T does not lie on that line, but above the midpoint (0, 0)T . We choose the Euclidean distance as distance metric. The optimal solution S∗ ⊆ V for k = 2 is given by b−1 − η, 0) T and ( b3 b−1 + η, 0) with a diversity of S∗ = {(− b3 b − 1 T + η, 0) , ( b3 b − 1 − η, 0) T} d∗ = 2 b3 b − 1 − 2η ≈ 2 b3 b − 1 . (56) (57) The cover tree for V is built with base b such that data points are incrementally added, ordered according to their absolute x value. As a result, we get the following cover tree: • imax: Cimax = (0, 0)T(cid:111) (cid:110) • i = 1: Ci = Ci+1 ∪(cid:110) (0, b + µ)T ,−b2, b2(cid:111) (cid:26)(cid:16)−(cid:80)imax−i • imin: Cimin = Cimin+1 ∪(cid:110) • 1 > i > imin: Ci = Ci+1 ∪ (− b3 b−1 + η, 0) j=1 T b2 ·(cid:0) 1 (cid:17)T (cid:1)j−1 T(cid:111) b−1 − η, 0) , ( b3 , 0 b , (cid:16)(cid:80)imax−i j=1 b2 ·(cid:0) 1 b (cid:1)j−1 (cid:17)T(cid:27) , 0 The data point (0, 0)T will be the root node and each lower layer of the tree will hold the next two outer data points on the line. imax must be large enough so that the root is able to cover even the most distant data points, i.e. the optimal solution. − η b3 b − 1 > ≥ b3 b − 1 bimax+1 b − 1 bimax+1 b − 1 imax ≥ 2 (58) (59) (60) For simplicity, we assume imax = 2 (any layer above i = 2 will hold only the root). The layer with imin = imax − Jmax − 1 will hold the whole data set V . Because the distance between any data point in V and (0, b + µ)T is larger than b1, there will be a node for (0, b + µ)T in layer i = 1. We will proof the cover tree properties to show that this is a valid cover tree. (1) Nesting: Obviously holds, as Ci+1 ⊆ Ci. (2) Covering: Holds for i = 1, because the maximal distance of any point in C1 to the root (0, 0)T is b2 = bimax. Let 1 > i > imin be an arbitrary level. The nodes b2 ·(cid:0) 1 (cid:1)j−1 (cid:17)T and , 0 (cid:16)−(cid:80)imax−i−1 b2 ·(cid:0) 1 (cid:17)T b2 ·(cid:0) 1 (cid:1)j−1 b and j=1 , 0 b (cid:17)T (cid:1)j−1 (cid:16)(cid:80)imax−i , 0 j=1 (cid:16)(cid:80)imax−i−1 (cid:17)T (cid:1)j−1 b2 ·(cid:0) 1 j=1 , 0 b (cid:16)−(cid:80)imax−i j=1 are the parents of the nodes . Their distance b 14 j=1 b2 · imax−i(cid:88) imax−i(cid:88) imax−i−1(cid:88) j=1 b , 0 T (cid:19)j−1 (cid:18) 1 (cid:19)j−12 (cid:18) 1 (cid:19)j−1 (cid:18) 1 b b2 · b2 · b j=1 + 02 (cid:18) 1 b + b2 · can be computed as , b , 0 (cid:18) 1 T (cid:19)j−1 (cid:19)j−1 − (cid:18) 1 (cid:19)j−1 − (cid:18) 1 (cid:19)−(i+1−imax)(cid:33)2 b2 · b2 · b b d j=1 b2 ·  imax−i−1(cid:88) (cid:118)(cid:117)(cid:117)(cid:117)(cid:116)imax−i−1(cid:88) (cid:118)(cid:117)(cid:117)(cid:117)(cid:116)imax−i−1(cid:88) (cid:118)(cid:117)(cid:117)(cid:116)(cid:32) (cid:18) 1 (cid:113) −b2 · j=1 j=1 b = = = (−b3−imax+i)2 = = b3−imax+i = bi+1 (cid:19)imax−i−12 (61) (62) (63) (64) (65) (66) (67) (analogously for negative data points). Therefore, the covering property holds. It also holds for level imin, because the nodes are the parents of the nodes (− b3 T . Their distance can be computed as T and ( b3 and , 0 b b b−1 + η, 0) d (cid:17)T (cid:19)j−1 (cid:18) 1 b−1 − η, 0) (cid:16)−(cid:80)Jmax (cid:1)j−1 j=1 b2 ·(cid:0) 1  Jmax(cid:88) (cid:115)(cid:18)(cid:18) b3 (cid:115)(cid:18) b − 1 η − b3−Jmax (cid:115)(cid:18) b3−Jmax b − 1 b2 · j=1 = = b − b3−Jmax (cid:19)2 b − 1 , 0 b − 1 (55) ≤ = bimin+1 − bimin+1 − b3−Jmax b − 1 (cid:16)(cid:80)Jmax j=1 b2 ·(cid:0) 1 T (cid:18) b3 (cid:18) b3 (cid:19) b − 1 , − b − 1 (cid:17)T  , 0 (cid:1)j−1 (cid:19)T (cid:19)(cid:19)2 − η, 0 + 02 − η (cid:19)2 (68) (69) (70) (71) (72) (73) (74) (75) (analogously for the negative data points). Thus, the covering property holds for every layer of the cover tree. (3) Separation: For every imax > i ≥ imin, the closest pairwise distance we observe in layer Ci for any node is the distance to the (self-child) of its parent. For level i = 1 the closest distance of nodes in Ci is b + µ > b1, therefore, the separation property holds. Let 1 > i ≥ imin be an arbitrary level. This distance to a parent was computed in Eq. (61) (or Eq. (68)) to be bi+1, which is larger than bi. Thus, the separation property holds for every layer of the tree. We have seen, that the above defined cover tree is valid and fullfills the cover tree properties. The termination layer for k = 2 is C1. When applying ICT Basic, we might get (0, 0)T , (0, b + µ)T(cid:111) (cid:110) SICTBasic = as a diverse subset, with div(SICTBasic) = b + µ ≈ b. Comparing the approximated diverse subset with the optimal solution, we get lim µ,η→0 d∗ div(SICTBasic) 15 = 2b2 b − 1 , Figure 6: Example for which ICT Basic might give a relative diversity of almost 8. Each part of the figure corresponds to one layer of the cover tree. The data set V (with µ = η = 0.1) is plotted as grey dots. Nodes are plotted as black dots, encircled with a ball defined by the corresponding covering radius. The optimal solution for k = 2 with d∗ ≈ 16 is plotted as red dots. ICT Basic randomly selects two nodes from the first layer with at least k nodes (here: fourth layer, i = 1). i.e. the worst possible approximation factor. Thus, we have shown, that no tighter approximation factor for ICT Basic exists. The following part gives an example with b set to 2. (cid:27) E.1.1 Example for b = 2 Let the data set be defined as (cid:26)(cid:18) v (cid:19) (cid:18) 0 (cid:19) , 0 V = 2 + µ v ∈ ±{0, 4, 6, 7, 7.5, 7.75, 7.875, . . . 8 − η} (76) where µ, η > 0 small. Because η (cid:54)= 0, V is finite. We use Euclidean distance as distance metric. For k = 2 the optimal solution is given by (−(8 − η), 0)T and (8 − η, 0)T with d∗ ≈ 16. The cover tree is built with b = 2 such that data points are incrementally added, ordered according to their absolute x value. Figure 6 shows the first ten layer of the cover tree with imax = 4 (note that the layer i ≥ 2 only hold the root). ICT Basic will randomly select two data points from the first layer with at least k nodes. This corresponds to level i = 1 (fourth layer). ICT Basic might randomly select (0, 0)T and (0, 2 + µ)T with div(SICTBasic) ≈ 2. Thus, we get d∗ div(SICTBasic) = 8 lim µ,η→0 (77) which shows the tightness of the derived approximation factor. (4, 0)T , or (0, 0)T and (−4, 0)T will be the selected nodes. Thus, div(SICTInherit) = 4. Note, for this example ICT Inherit would select a subset with higher diversity: either (0, 0)T and E.2 Tightness of αICTGreedy and αICTInherit Let the data set be defined as V = 0,± (1 − µ) ,± + 1 − η (cid:26) vv ∈ (cid:18) b b − 1 (cid:19)(cid:27) ∪ (cid:91) J∈[1,Jmax] 1 + J(cid:88) j=1 1 b ±   , j−1 (78) where µ, η > 0 small. Note that, the value of µ must be chosen such that i = 0 is the largest possible integer with bi < 1 + µ. Furthermore, Jmax is the smallest integer such that All of the data points in V lie on the line between −(cid:16) b 1 b Jmax ≤ η. (cid:17) b−1 + 1 − µ (cid:16) b (cid:17) b−1 + 1 − µ , where the distance between neighboring data points decreases as we move to the ends of the line. We choose the Euclidean and (79) 16 distance as distance metric. The optimal solution S∗ ⊆ V for k = 2 is given by S∗ = with a diversity of − (cid:18) b (cid:26) (cid:18) b b − 1 b − 1 (cid:19) + 1 − η , + 1 − η (cid:19) (cid:18) b (cid:18) b b − 1 (cid:19)(cid:27) (cid:19) d∗ = 2 + 1 − 2η ≈ 2 b − 1 + 1 . The cover tree for V is built with base b such that data points are incrementally added, ordered according to their absolute x value. As a result, we get the following cover tree: • i > iter: Ci = {0} j−1(cid:111) j−1(cid:17) • iter = 0: Citer = Citer+1 ∪ {− (1 + µ) , 1 + µ} (cid:17) (cid:111) b−1 + 1 − η • iter > i > imin: Ci = Ci+1 ∪(cid:110)−(cid:16)(cid:80)−i • imin: Cimin = Cimin+1 ∪(cid:110)−(cid:16) b b−1 + 1 − η ,(cid:80)−i j=1 j=1 1 b 1 b . , b 1 b 1 b j=1 j=1 nodes −(cid:16) 1 +(cid:80)−i The data point 0 will be the root node and each lower layer of the tree will hold the next two outer data points on the line. Any layer before level iter (the termination layer) will hold only the root. The layer with imin = − (Jmax + 1) will hold the whole data set V . We will proof the cover tree properties to show that this is a valid cover tree. (1) Nesting: Obviously holds, as Ci+1 ⊆ Ci. (2) Covering: Obviously holds for i > iter, because those layers only hold the root. For i = iter = 0, the maximal distance of any point in C0 to the root 0 is d(0, 1 + µ) = 1 + µ. Since iter is the largest possible integer i, such that bi < 1 + µ (see above), it follows biter+1 ≥ 1 + µ. Let iter > i > imin be an arbitrary level. The j−1 and j−1(cid:17) and 1 +(cid:80)−(i+1) 1 +(cid:80)−(i+1) j−1. Their distance can be computed as 1 + −i(cid:88) −(i+1)(cid:88) (cid:118)(cid:117)(cid:117)(cid:117)(cid:116)1 +  − (cid:118)(cid:117)(cid:117)(cid:117)(cid:116)1 +  − −(i+1)(cid:88) −(i+1)(cid:88) j−1 are the parents of the nodes 1 +(cid:80)−i  1 + 1 + −i(cid:88) −(i+1)(cid:88) 2 2 −(i+1) , 1 + j−1 j−1 j−1 j−1 j−1 j−1 1 b 1 b 1 b 1 b 1 b j=1 j=1 j=1 j=1 j=1 = = j=1 1 b d 1 b 1 b + 1 b j=1 j=1 −(i+1) = 1 b because the nodes −(cid:16) = bi+1 1 +(cid:80)Jmax (analogously for negative data points). Therefore, the covering property holds. It also holds for level imin, b−1 + 1 − η j=1 j=1 1 b 1 b j−1 are the parents of the nodes −(cid:16) b and 1+(cid:80)Jmax j−1(cid:17) (80) (81) (82) (83) (84) (85) (86) (cid:17) 17 and b b−1 + 1 − η. Their distance can be computed as j−1 1 b , b b − 1 + 1 − η  (cid:33) − Jmax−1 b − 1 b b − 1 b + 1 − 1 (cid:33)2 Jmax−1 b − 1 η − 1 b (cid:33)2 (cid:19)(cid:19)2 Jmax−1 b − 1 (cid:18) 1 b − 1 Jmax − 1 b Jmax (1 − b) Jmax(cid:19)2 d = = j=1 1 + Jmax(cid:88) (cid:118)(cid:117)(cid:117)(cid:116)(cid:32)(cid:32) (cid:118)(cid:117)(cid:117)(cid:116)(cid:32) (cid:118)(cid:117)(cid:117)(cid:116)(cid:32) (cid:115)(cid:18) 1 (cid:115)(cid:18) 1 b b − 1 b (79) ≤ = = = = 1 b 1 b = bimin+1 Jmax −(imin+1) (cid:18) b b − 1 (cid:19)(cid:33)2 + 1 − η (87) (88) (89) (90) (91) (92) (93) (94) (95) (96) (analogously for the negative data points). Thus, the covering property holds for every layer of the cover tree. (3) Separation: For every imax > i ≥ imin, the closest pairwise distance we observe in layer Ci for any node is the distance to the (self-child) of its parent. For level i = iter = 0 the closest distance of nodes in Ci is 1 + µ > b0, therefore, the separation property holds. Let 0 > i ≥ imin be an arbitrary level. This distance to a parent was computed in Eq. (82) (or Eq. (87)) to be bi+1, which is larger than bi. Thus, the separation property holds for every layer of the tree. We have seen, that the above defined cover tree is valid and fullfills the cover tree properties. The termination layer for k = 2 is C0. When applying ICT Inherit, we will get SICTInherit = {0, 1 + µ} or SICTInherit = {0,− (1 + µ)} as a diverse subset, with div(SICTInherit) = 1 + µ ≈ 1. Comparing the approximated diverse subset with the optimal solution, we get d∗ div(SICTInherit) = 2b b − 1 + 2, lim µ,η→0 (97) (98) i.e. the worst possible approximation factor. ICT Greedy can give the same solution when the root node is randomly chosen in the first iteration. Thus, we also get d∗ div(SICTGreedy) = 2b b − 1 + 2. lim µ,η→0 (99) Thus, we have shown, that no tighter approximation factor for ICT Greedy and ICT Inherit exists. The following part gives an example with b set to 2. E.2.1 Example for b = 2 Let the data set be defined as V = {vv ∈ ±{0, 1 + µ, 2, 2.5, 2.75, 2.875, . . . 3 − η}} (100) 18 Figure 7: Example for which ICT Greedy and ICT Inherit might give a relative diversity of almost 6. Each part of the figure corresponds to one layer of the cover tree. The data set V (with µ = η = 0.1) is plotted as gray dots. Nodes are plotted as black dots, encircled with a ball defined by the corresponding covering radius. The optimal solution for k = 2 with d∗ ≈ 6 is plotted as red dots. ICT Inherit selects the root node and one of the two nodes from the first layer with at least k nodes (here: fourth layer, i = 0). ICT Greedy can return the same solution as ICT Inherit, when the root is selected randomly as first data point of the solution. Table 1: Summary of conducted experiments. Experiment Dimension Artificial Grid 2D Grid 5D Cities Faces MNIST Real 2 5 2 624 784 Sample Size {500, 1000, 5000} 5000 10975 3840 70000 Diverse Set Size k Distance Metric {4, 9, 25} {32, 243, 1024} [2, 100] [2, 100] [2, 100] Euclidean Euclidean Euclidean Cosine Cosine where µ, η > 0 small. Because η (cid:54)= 0, V is finite. We use Euclidean distance as distance metric. For k = 2 the optimal solution is given by −(3 − η) and 3 − η with d∗ ≈ 6. The cover tree is built with b = 2 such that data points are incrementally added, ordered according to their absolute value. Figure 7 shows the first ten layer of the cover tree with imax = 3. The first layer with at least k nodes is level i = 0 (fourth layer). ICT Inherit is initialized with the root and selects one of the remaining nodes of level 0. Thus, SICTInherit = {0,−(1 + µ)} or SICTInherit = {0, 1 + µ} with div(SICTInherit) ≈ 1. Thus, we get d∗ div(SICTInherit) = 6 lim µ,η→0 (101) which shows the tightness of the derived approximation factor. When the root is selected randomly as first data point of the solution, ICT Greedy can return the same solution as ICT Inherit. Thus, we also get d∗ div(SICTGreedy) = 6. lim µ,η→0 (102) F Additional Figures and Tables Figure 8 shows each layer of a cover tree built with b = 2 on a 2D grid data example with k = 9. Table 1 summarizes information for the artificial and real data in our experiments. For the cover tree we used the implementation provided in [7]. Figure 9 shows the computation time of selecting the diverse subsets for the different approaches. One can clearly see the efficiency of the cover-tree approaches. Compared to GMM, ICT Basic, ICT Greedy 19 Figure 8: Example of a cover tree with b = 2 for a two dimensional data set (grey, red). Each plot shows one level i of the cover tree with all nodes (black) encircled with a ball of radius 2i. The red dots correspond to the optimal diverse solution with k = 9. Figure 9: Computation time in ms on the Cities, Faces and MNIST data sets. All experiments were conducted on a Intel(R) Xeon(R) CPU E5-2640 v4 with 2.40GHz. and ICT Inherit have fast computation time even for large k. The computation time of the cover tree approaches shows a step function behavior. Again, this can be explained by the layer-wise structure of the cover tree. When the termination layer holds exactly k nodes, no selection must be made. We can also see the difference in the complexity of ICT Greedy and ICT Inherit. When the layer before the termination layer holds almost k nodes, i.e. Ci+1 ≈ Ci, ICT Inherit only has to select few nodes. G Examples of diverse images generated by PPGN Figs. 10–17 show the k = 5 randomly chosen images (left) from the MCMC sequence of PPGN conditioned on several ImageNet classes, and the corresponding diverse sets (right) chosen by ICT Inherit, after 20 (bottom), 100 (middle), and 200 (top) MCMC steps. We can see that ICT Inherit chose more diverse images in shape (e.g., Volcano (Fig. 5), Greenhouses, Spiders), composition (e.g., Sheep, Clocks), and color (e.g., Train). 20 Figure 10: k = 5 randomly chosen images (left) from the MCMC sequence of PPGN for Greenhouse class, and the corresponding diverse sets (right) chosen by ICT Inherit, after 20 (bottom), 100 (middle), and 200 (top) MCMC steps. Figure 11: k = 5 randomly chosen images (left) from the MCMC sequence of PPGN for Sheep class, and the corresponding diverse sets (right) chosen by ICT Inherit, after 20 (bottom), 100 (middle), and 200 (top) MCMC steps. Figure 12: k = 5 randomly chosen images (left) from the MCMC sequence of PPGN for Train class, and the corresponding diverse sets (right) chosen by ICT Inherit, after 20 (bottom), 100 (middle), and 200 (top) MCMC steps. Figure 13: k = 5 randomly chosen images (left) from the MCMC sequence of PPGN for Spider class, and the corresponding diverse sets (right) chosen by ICT Inherit, after 20 (bottom), 100 (middle), and 200 (top) MCMC steps. 21 Figure 14: k = 5 randomly chosen images (left) from the MCMC sequence of PPGN for Dog class, and the corresponding diverse sets (right) chosen by ICT Inherit, after 20 (bottom), 100 (middle), and 200 (top) MCMC steps. Figure 15: k = 5 randomly chosen images (left) from the MCMC sequence of PPGN for Polar Bear class, and the corresponding diverse sets (right) chosen by ICT Inherit, after 20 (bottom), 100 (middle), and 200 (top) MCMC steps. Figure 16: k = 5 randomly chosen images (left) from the MCMC sequence of PPGN for Guitar class, and the corresponding diverse sets (right) chosen by ICT Inherit, after 20 (bottom), 100 (middle), and 200 (top) MCMC steps. Figure 17: k = 5 randomly chosen images (left) from the MCMC sequence of PPGN for Clock class, and the corresponding diverse sets (right) chosen by ICT Inherit, after 20 (bottom), 100 (middle), and 200 (top) MCMC steps. 22
1308.3520
1
1308
2013-08-15T22:17:59
Fixed-Parameter and Approximation Algorithms: A New Look
[ "cs.DS" ]
A Fixed-Parameter Tractable (\FPT) $\rho$-approximation algorithm for a minimization (resp. maximization) parameterized problem $P$ is an FPT algorithm that, given an instance $(x, k)\in P$ computes a solution of cost at most $k \cdot \rho(k)$ (resp. $k/\rho(k)$) if a solution of cost at most (resp. at least) $k$ exists; otherwise the output can be arbitrary. For well-known intractable problems such as the W[1]-hard {Clique} and W[2]-hard {Set Cover} problems, the natural question is whether we can get any \FPT-approximation. It is widely believed that both {Clique} and {Set-Cover} admit no FPT $\rho$-approximation algorithm, for any increasing function $\rho$. Assuming standard conjectures such as the Exponential Time Hypothesis (ETH) \cite{eth-paturi} and the Projection Games Conjecture (PGC) \cite{r3}, we make the first progress towards proving this conjecture by showing that 1. Under the ETH and PGC, there exist constants $F_1, F_2 >0$ such that the {Set Cover} problem does not admit an FPT approximation algorithm with ratio $k^{F_1}$ in $2^{k^{F_2}}\cdot \text{poly}(N,M)$ time, where $N$ is the size of the universe and $M$ is the number of sets. 2. Unless $\NP\subseteq \SUBEXP$, for every $1> \delta > 0$ there exists a constant $F(\delta)>0$ such that {Clique} has no FPT cost approximation with ratio $k^{1-\delta}$ in $2^{k^{F}}\cdot \text{poly}(n)$ time, where $n$ is the number of vertices in the graph. In the second part of the paper we consider various W[1]-hard problems such as {\dst}, {\dsf}, Directed Steiner Network and {\mec}. For all these problem we give polynomial time $f(\text{OPT})$-approximation algorithms for some small function $f$ (the largest approximation ratio we give is $\text{OPT}^2$).
cs.DS
cs
Fixed-Parameter and Approximation Algorithms: A New Look Rajesh Chitnis ∗ MohammadTaghi Hajiaghayi∗ Guy Kortsarz† October 3, 2018 Abstract A Fixed-Parameter Tractable (FPT) r -approximation algorithm for a minimization (resp. maximiza- tion) parameterized problem P is an FPT algorithm that, given an instance (x,k) ∈ P computes a solution of cost at most k· r (k) (resp. k/r (k)) if a solution of cost at most (resp. at least) k exists; otherwise the output can be arbitrary. For well-known intractable problems such as the W[1]-hard Clique and W[2]- hard Set Cover problems, the natural question is whether we can get any FPT-approximation. It is widely believed that both Clique and Set-Cover admit no FPT r -approximation algorithm, for any increasing function r . However, to the best of our knowledge, there has been no progress towards proving this conjecture. Assuming standard conjectures such as the Exponential Time Hypothesis (ETH) [20] and the Projection Games Conjecture (PGC) [30], we make the first progress towards proving this conjecture by showing that • Under the ETH and PGC, there exist constants F1,F2 > 0 such that the Set Cover problem does not admit a FPT approximation algorithm with ratio kF1 in 2kF2 · poly(N,M) time, where N is the size of the universe and M is the number of sets. • Unless NP ⊆ SUBEXP, for every 1 > d > 0 there exists a constant F(d ) > 0 such that Clique has no FPT cost approximation with ratio k1−d · poly(n) time, where n is the number of vertices in the graph. in 2kF In the second part of the paper we consider various W[1]-hard problems such as Directed Steiner Tree, Directed Steiner Forest, Directed Steiner Network and Minimum Size Edge Cover. For all these problem we give polynomial time f (OPT)-approximation algorithms for some small function f (the largest ap- proximation ratio we give is OPT2). Our results indicate a potential separation between the classes W[1] and W[2]; since no W[2]-hard problem is known to have a polynomial time f (OPT)-approximation for any function f . Finally, we answer a question by Marx [26] by showing the well-studied Strongly Con- nected Steiner Subgraph problem (which is W[1]-hard and does not have any polynomial time constant factor approximation) has a constant factor FPT-approximation. 1 Introduction Parameterized Complexity is a two-dimensional generalization of "P vs. NP" where in addition to the overall input size n, one studies the effects on the computational complexity of a secondary measurement that captures additional relevant information. This additional information can be, for example, a structural restriction on the input distribution considered, such as a bound on the treewidth of an input graph or the ∗Department of Computer Science, University of Maryland at College Park, USA. Supported in part by NSF CAREER award 1053605, NSF grant CCF-1161626, ONR YIP award N000141110662, DARPA/AFOSR grant FA9550-12-1-0423, and a University of Maryland Research and Scholarship Award (RASA). The first author is also supported by a Simons Award for Graduate Students in Theoretical Computer Science. The second author is also with AT&T Labs. Email: {rchitnis, hajiagha}@cs.umd.edu †Rutgers University, Camden, NJ. Supported in part by NSF grant number 434923. Email: [email protected] 1 size of a solution. For general background on the theory see [10]. For decision problems with input size n, and a parameter k, the two dimensional analogue (or generalization) of P, is solvability within a time bound of O( f (k)nO(1)), where f is a function of k alone. Problems having such an algorithm are said to be fixed parameter tractable (FPT). The W -hierarchy is a collection of computational complexity classes: we omit the technical definitions here. The following relation is known amongst the classes in the W -hierarchy: FPT = W [0] ⊆ W [1] ⊆ W [2] ⊆ . . .. It is widely believed that FPT 6= W[1], and hence if a problem is hard for the class W [i] (for any i ≥ 1) then it is considered to be fixed-parameter intractable. We say that a problem is W-hard if it is hard for the class W[i] for some i ≥ 1. When the parameter is the size of the solution then the most famous examples of W[1]-hard and W[2]-hard problems are Clique and Set Cover respectively. We define these two problems below: Clique Input : An undirected graph G = (V,E), and an integer k Problem: Does G have a clique of size at least k? Parameter: k Set Cover Input: Universe U = {u1,u2, . . . ,un} and a collection S = {S1,S2, . . . ,Sm} of subsets of U such that Sm j=1 S j = U. Problem: Is there a subcollection S′ ⊆ S such that S′ ≤ k andSSi∈S′ Si = U? Parameter: k The next natural question is whether these fixed-parameter intractable problems at least admit parame- terized approximation algorithms. 1.1 Parameterized Approximation Algorithms We follow the notation from Marx [27]. Any NP-optimization problem can be described as O = (I,sol,cost,goal), where I is the set of instances, sol(x) is the set of feasible solutions for instance x, the positive integer cost(x;y) is the cost of solution y for instance x, and goal is either min or max. We assume that cost(x,y) can be computed in polynomial time, y ∈ sol(x) can be decided in polynomial time, and y = xO(1) holds for every such y. Definition 1.1. Let r : N → R≥1 be a computable function such that r (k) ≥ 1 for every k ≥ 1; if goal=min then k · r (k) is nondecreasing and if the goal=max then k/r (k) is unbounded and nondecreasing. An FPT approximation algorithm with approximation ratio r (x,k) ∈ S ∗ × N satisfying sol(x) 6= /0 and for O is an algorithm A that, given an input computes y ∈ sol(x) such that (opt(x) ≤ k opt(x) ≥ k if goal = min if goal = max (cost(x,y) ≤ k· r (k) cost(x,y) ≥ k/r (k) if goal = min if goal = max (*) (**) We require that on input (x,k) the algorithm A runs in f (k)·xO(1) time, for some computable function f . Note that if the input does not satisfy (*), then the output can be arbitrary. 2 Remark 1.2. Given an output y ∈ sol(x) we can check in FPT time if it satisfies (**). Hence we can assume that an FPT approximation algorithm always1 either outputs a y ∈ sol(x) that satisfies (**) or outputs a default value reject. We call such an FPT approximation algorithm that has this property as normalised. Classic polynomial-time approximation algorithms determine the performance ratio by comparing the output with the optimum. In FPT approximation algorithms there is a subtle difference: we compare the output to the parameter to determine the approximation ratio. Fellows [14] asked about finding an FPT approximation algorithm for W[2]-hard Dominating Set (which is a special case of Set Cover), or ruling out such a possibility. The following conjecture due to Marx (personal communication) is widely believed in the FPT community: Conjecture 1.3. Both Set Cover and Clique do not admit an FPT algorithm with approximation ratio r , for any function r . However to the best of our knowledge there has been no progress towards proving this conjecture, even under assumptions from complexity theory. In this paper we take a first step towards proving Conjecture 1.3, under well-known and reasonable2 assumptions from complexity theory like the Exponential Time Hypoth- esis (ETH) of Impagliazzo et al. [20] and the Projection Games Conjecture (PGC) of Moshkovitz [30]. For both minimization and maximization problems, the most interesting and practical case is the in- put (x,k) when k = OPT (x). This motivates the definition of the following variant of FPT approximation algorithms: : N → R≥1 be a computable function such that r (k) ≥ 1 for every k ≥ 1; if goal=min Definition 1.4. Let r then k · r (k) is nondecreasing and if goal=max then k/r (k) is unbounded and nondecreasing. An FPT optimum approximation algorithm for O with approximation ratio r is an algorithm A′ that, given an input x ∈ S ∗ satisfying sol(x) 6= /0 outputs a y ∈ sol(x) such that (cost(x,y) ≤ OPT (x)· r (OPT (x)) cost(x,y) ≥ OPT (x)/r (OPT (x)) if goal = min if goal = max (1) We require that on input x the algorithm A runs in f (OPT (x))·xO(1) time, for some computable function f . In Section 2.2, we show the following theorem: Theorem 1.5. Let O be a minimization problem in NPand A be an FPT approximation algorithm for O with ratio r . On input (x,k) let the running time of A be f (k)·xO(1) for some non-decreasing computable function f . Then O also has an FPT optimum approximation algorithm A′ with approximation ratio r , and whose running time on input x is also f (OPT (x))·xO(1) Hence for minimization problems, it is enough to prove hardness results only for the notion of FPT optimum approximation algorithms (see Definition 1.4). We do not know any relation between the two definitions for maximization problems, and hence we prove hardness results for both Definition 1.1 and Definition 1.4. 1even if the input does not satisfy (*) 2It is very important to only work under well-believed assumptions, since otherwise we will be able to prove pretty much what we want, but it is of no value. 3 2 Our Results We make the first progress towards proving Conjecture 1.3, under standard assumptions from complex- ity theory. In particular for Set Cover we assume the Exponential Time Hypothesis (ETH) [20] and the Projection Games Conjecture (PGC) [30]3. The PGC gives a reduction from SAT to Projection Games. Composing this with the standard reduction from Projection Games to Set Cover gives a reduction from SAT to Set Cover. Since the ETH gives a lower bound on the running time of SAT, we are able to show the following inapproximability result in Section 4: Theorem 2.1. Under the ETH and PGC, 1. There exist constants F1,F2 > 0 such that the Set Cover problem does not admit an FPT optimum approximation algorithm with ratio r (OPT ) = OPT F1 in 2OPT F2 ·poly(N,M) time, where N is the size of the universe and M is the number of sets. 2. There exist constants F3,F4 > 0 such that the Set Cover problem does not admit an FPT approximation algorithm with ratio r (k) = kF3 in 2kF4 · poly(N,M) time, where N is the size of the universe and M is the number of sets. In Section 5, we consider the Clique problem. We use the result of Zuckerman [33] which states that it is )-approximation for Clique. Given any problem X ∈ NP, by using the Zuckerman NP-hard to get an O(n1−e reduction from X to Clique allows us to show the following result. Theorem 2.2. Unless NP ⊆ SUBEXP, for every 1 > d > 0 1. There exists a constant F(d ) > 0 such that Clique has no FPT optimum approximation with ratio r (OPT ) = OPT 1−d in 2OPT F · poly(n) time, where n is the number of vertices in the graph. 2. There exists a constant F′(d ) > 0 such that Clique has no FPT approximation with ratio r (k) = k1−d in 2kF′ · poly(n) time, where n is the number of vertices in the graph. 2.1 Polytime f (OPT )-approximation for W-hard problems ≤ 22k O(1) We also deal with the following question: given that a problem is W-hard, can we maybe get a good polynomial-time approximation for the problem? Any problem in NP can be solved in 2nO(1) time by simply enumerating all candidates for the witness. If the parameter k is at least log n, then we immediately have 2k ≥ n and the problem can be solved in 2nO(1) time which is FPT time in k. So for large values of the parameter the brute force algorithm itself becomes an FPT algorithm. Hence the intrinsic hardness to obtain FPT algorithms for intractable problems is when the parameter k is small (say at most log n). In this case, we show how to replace the impossible FPT solution by a good approximation, namely f (OPT ) approximation for some small function f . We systematically design polynomial-time f (OPT ) approxi- mation algorithms for a number of W[1]-hard minimization problems such as Minimum Size Edge Cover, Strongly Connected Steiner Subgraph, Directed Steiner Forest and Directed Steiner Network. Each of the aformentioned problems is known to have strong inapproximability (in terms of input size). Since we can assume OPT is small, this implies f (OPT ) is small as well. Therefore for these W[1]-hard problems, if the parameter is large then we can get an FPT algorithm, otherwise if the parameter is small (then OPT is small as well, otherwise we can reject for these minimization problems)and we obtain a reasonable approximation in polynomial time. These results point towards a separation between the classes W[1] and W[2] since we do not know any W[2]-hard problem which has a polynomial-time f (OPT )-approximation, for any function 3The PGC is stated in Section 3.2, and the ETH is stated in Section 3.1 4 f . In fact, Marx (personal communication) conjectured that the W[2]-hard Set Cover problem does not have a polynomial-time f (OPT )-approximation for any function f . Finally in Section 7 we show that the well-studied W[1]-hard Strongly Connected Steiner Subgraph problem has an FPT 2-approximation algorithm. This answers a question by Marx [26] regarding finding a problem which is fixed-parameter intractable, does not have a constant factor approximation in polynomial time but admits a constant factor FPT approximation. To the best of our knowledge no such W[2]-hard problem (parameterized by solution size) is known, and this indicates another potential difference between W[1] and W[2]. 2.2 Proof of Theorem 1.5 Let x ∈ S ∗ be the input for A′. The algorithm A′ runs the algorithm A on the instances (x,1), (x,2), . . . until the first k such that the output of A on (x,k) is a solution of cost at most k · r (k). Then A′ outputs A(x,k). By Definition 1.1, we know that k ≤ OPT (x). Hence k· r (k) ≤ OPT (x)· r (OPT (x)). It remains to analyze the running time of A′. f (i)·xO(1) = f (i)(cid:17)·xO(1) ≤ OPT (x)· f (OPT (x))·xO(1) = f (OPT (x))·xO(1), since f is non-decreasing and Since k ≤ OPT (x), the running time of A′ is upper bounded by (cid:229) i=1 f (i)·xO(1) ≤ (cid:229) OPT (x) i=1 i=1 (cid:16)(cid:229) OPT (x) OPT (x) ≤ x. k 3 Conjectures from Computational Complexity In this section, we describe two conjectures from computational complexity that we work with in this paper. 3.1 Exponential Time Hypothesis Impagliazzo, Paturi and Zane [20] formulated the following conjecture which is known as the Exponential Time Hypothesis (ETH). Exponential Time Hypothesis (ETH) 3-SAT cannot be solved in 2o(n) time where n is the number of variables. Using the Sparsification Lemma of Calabro, Impagliazzo and Paturi [5], the following lemma was shown in [20]. Lemma 3.1. Assuming ETH, 3-SAT cannot be solved in 2o(m) time where m is the number of clauses. In the reductions from 3-SAT to Clique, Vertex Cover and Independent Set, the number of vertices formed in the graphs is equal to the number of clauses in the 3-SAT instance and hence Lemma 3.1 gives evidence against subexponential algorithms for the above three problems. This is enough to give some belief in the ETH. We note that ETH and its variants have been used to prove lower bounds in both FPT [23] and exact exponential algorithms [8]. We refer to [24] for a nice survey on lower bounds using ETH. In this paper, we use ETH to give inapproximability results for Set Cover.4 4It is not clear what Moshkovitz [30] refers to as the size of a SAT instance. If it the number of variables, then we use the ETH as is. Otherwise if it refers to the number of clauses, then we are still fine by the Sparsification Lemma [5] 5 3.2 The Projection Games Conjecture First we define a projection game. Note that with a loss of factor two we can assume that the alphabet is the same for both sides. The input to a projection game consists of: • A bipartite graph G = (V1,V2,E) • A finite alphabets S • Constraints (also called projections) given by p e : S → S for every e ∈ E. that satisfies as many of the edges as possible. We say that The goal is to find an assignment f : V1 ∪V2 → S an edge e = {a,b} ∈ E is satisfied, if the projection constraint holds, i.e., p e(f (a)) = f (b). We denote the size of a projection game by n = V1 +V2 +E. Conjecture 3.2. (Projection Games Conjecture [30]) There exists c > 0 such that for every e > 0, there is a polynomial reduction RED-1 from SAT5 to Projection Games which maps an instance I of SAT to an instance I1 of Projection Games such that: 1. If a YES instance I of SAT satisfies Ic ≥ 1 2. If a NO instance I of SAT satisfies Ic ≥ 1 3. The size of I1 is almost-linear in the size of I, and is given by I1 = n = I1+o(1) · poly( 1 e ). 4. The alphabet S e , then all edges of I1 can be satisfied. e , then at most e -fraction of the edges of I1 can be satisfied. for I1 has size poly( 1 e ). A weaker version of the conjecture is known, but the difference is that the alphabet in [31] has size exp( 1 e ). As pointed out in [30], the Projection Games Conjecture is an instantiation of the Sliding Scale Conjecture of Bellare et al. [2] from 1993. Thus, in fact this conjecture is actually 20 years old. But we have reached a state of knowledge now that it seems likely that the Projection Games Conjecture will be proved not long from now (see Section 1.2 of [30]). Thus it seems that posing this conjecture is quite reasonable. In contrast to this is the Unique Games Conjecture [21]. On the positive side, it seems that the Unique Games Conjecture is much more influential than the Projection Games Conjecture. But it seems unlikely (to us) that the Unique Games Conjecture will be resolved in the near future. 4 An FPT Inapproximability Result for Set Cover The goal of this section is to prove Theorem 2.1. 4.1 Reduction from Projection Games to Set Cover The following reduction from Projection Games to Set Cover is known, see [1, 25]. We sketch a proof below for completeness. Theorem 4.1. There is a reduction RED-2 from Projection Games to Set Cover which maps an instance I1 = (G = (V1,V2,E),S ,p ) of Projection Games to an instance I2 of Set Cover such that: 1. If all edges of I1 can be satisfied, then I2 has a set cover of size V1 +V2. 2. If at most e -fraction of edges of I1 can be satisfied, then the size of a minimum set cover for I2 is at least V1+V2 √32e 5SAT is the standard Boolean satisfiability problem 6 3. The instance I2 has S 4. The time taken for the reduction is upper bounded by 2O( 1√e ) × poly(S × (V1 +V2) sets and the size of the universe is 2O( 1√e ) ×S )× poly(E +V1 +V2) 2 ×E 4.1.1 Proof of Theorem 4.1 Definition 4.2. An (m, ℓ)-set system consists of a universe B and collection of subsets {C1, . . . ,Cm} such that if the union of any sub-collection of ℓ-sets from the collection {C1, . . . ,Cm,C1, . . . ,Cm} is B, then the collection must contain both Ci and Ci for some i ∈ [m]. It is known that an (m, ℓ)-set system with a universe size B = O(22ℓm2) exists, and can be constructed in 2O(ℓ) · mO(1) time [1]. Consider the following reduction: Projection Games Instance: (G = (V1,V2,E),S ,p ) such that S = m. Set Cover Instance: Let B be a (m, ℓ) set system. The universe for the set cover instance consists of E × B. Define the following subsets of E × B • For all vertices v ∈ V2 and x ∈ S • For all vertices u ∈ V1 and y ∈ S , define the subset Sv,x =Se∋v{e}×Cx , define the subset Su,y =Se∋u{e}×Cp e(y) The Set Cover instance produced is (E × B,{Sw,x w ∈ V1 ∪V2,x ∈ S }) The following theorem is shown in [22]. We give a proof below for the sake of completeness. Theorem 4.3. If all edges of G can be satisfied then the instance of Set Cover constructed has a set cover of size V1 +V2. On the other hand if at most 2 ℓ2 -fraction of edges of G can be satisfied then the minimum size of set cover for the Set Cover instance constructed above is ℓ 8 (V1 +V2). Assuming Theorem 4.3, we obtain Theorem 4.1 by setting e = 2 . Hence the size of the universe is E × B = E×B = E× 2O( 1√e ) ×S × (V1 +V2). We prove Theorem 4.3 via the following two lemmas: S S ℓ2 in Theorem 4.3. Recall that m = 2 and the number of sets is Lemma 4.4. If all the edges of G can be satisfied then the instance of Set Cover has a set cover of size V1 +V2 Proof. Let d : V1 ∪V2 → S denote a labeling for G that satisfies all the edges E. Pick the following set of sets S = Sw,d (w) w ∈ V1 ∪V2. The number of sets in S is V1 +V2. We claim that S is a valid set cover for E × B. For every edge e = (u,v0 we show the following holds The definition of Su,d (u) and Sv,d (v) implies {e}× B ⊆ Su,d (u) ∪ Sv,d (v) Since d satisfies all the edges (and hence also satisfies e), we have P e(d (u)) = d (v). Therefore {e}×Cd (v) ⊆ Sv,d (v) and {e}×CP e(d (u)) ⊆ Su,d (u) {e}×Cd (v) = {e}×CP 7 e(d (u)) ⊆ Su,d (u) (2) (3) (4) Now we can see that Equation 3 and Equation 4 imply Equation 2. Moreover, taking the union of the the proof. containment relation implied by Equation 2 for all edges e, we get E × B ⊆Su∈V1∪V2 Su,d (u) which completes ℓ2 -fraction of edges of G can be satisfied then the minimum size of set cover for the 8 (V1 +V2). Lemma 4.5. If at most 2 Set Cover instance is ℓ Proof. We prove the contrapositive. Suppose there is a set cover S with S < ℓ vertex w define the set of labels 8 (V1 +V2). Then for each This implies that S = (cid:229) w∈V1∪V2 Lw. Hence the average cardinality of Lw satisfies Lw = {c ∈ S Sw,c ∈ S} (cid:229) w∈V1∪V2 V1 +V2 S ℓ 8 = 4 vertices such that Lw > ℓ 4 of the vertices w ∈ V1 ∪V2 satisfy Lw ≤ 1 2 and Lv < ℓ 2. V1 +V2 ≤ 2, then the total sum (cid:229) wLw would be greater than ℓ If there are more than ℓ 8, which is a contradiction. Hence at least 3 2. Since we can assume that the bipartite graph of the Projection Games instance is regular, we have that at least half the edges have both endpoints (u,v) such that Lu < ℓ Definition 4.6. We say that an edge e = (u,v) is frugally covered if Lu < ℓ random. We now show that the expected fraction of edges covered by d ′ is at least 2 the proof. Consider the following labeling d ′ for G: for every w ∈ V1 ∪V2 choose an element from Lw uniformly at ℓ2 , which will complete To show this, we obtain that each frugally covered edge is satisfied by d ′ with probability at least ℓ2 . Since there are at least E2 frugally covered edges, we are done. It remains to show that any frugally covered edge is satisfied by d ′ with probability at least 4 ℓ2 . Let e = (u,v) be any frugally covered edge. Let Lu = {a1,a2, . . . ,ap} and Lv = {b1,b2, . . . ,bq}. Since e is frugally covered we have ℓ 2 > max{p,q}. The sets in S completely cover E × B, and hence they also cover e× B. Note, that for any vertex w /∈ {u,v} we have Sw,x ∩{eB} = 0 for all x ∈ S . In other words, no element of the set e× B can be covered by any of the sets Sw,x for any vertex w /∈ {u,v}. Therefore the set e× B is covered by the sets chosen for vertices u and v. That is, 2 and Lv < ℓ 2. 4 This means that B is covered by a family of p + q ≤ ℓ sets, all of which are either of the form Ci or Ci. Since (B,Ci) form a (m, ℓ) set system, there exists an index i such that both Ci and Ci are present among the p + q sets. This implies for some ai,b j we have P e(ai) = b j. Since we choose the labels uniformly at random, pq we choose both d ′(u) = ai and d ′(v) = b j. Thus the probability that e is satisfied by d ′ with probability 1 ℓ )2 = 4 pq ≥ ( 2 is at least 1 ℓ2 . 8 By definition of Sv,x, we have Sv,x ∩ ({e}× B) = {e}× Cx. Similarly Su,y ∩ ({e}× B) = {e}× CP stricting the sets Su,ai and Sv,b j to {e}× B in the above containment we get Cb j(cid:17) [j=1 {e}× B ⊆(cid:16){e}× CP (ai)(cid:17)∪(cid:16){e}× [i=1 p q e(y). Re- Therefore, we have p q [i=1 {e}× B ⊆ ( Su,ai )∪ ( [j=1 Sv,b j ) B ⊆(cid:16) p [i=1 CP (ai)(cid:17)∪(cid:16) q [j=1 Cb j(cid:17) 4.2 Composing the Two Reductions: Composing the reductions from Conjecture 3.2 and Theorem 4.1 we get: Theorem 4.7. There exists c > 0, such that for every e > 0 there is a reduction RED-3 from SAT to Set Cover which maps an instance I of SAT to an instance I2 of Set Cover such that e , then I2 has a set cover of size b . 1. If a YES instance I of SAT satisfies Ic ≥ 1 2. If a NO instance I of SAT satisfies Ic ≥ 1 3. The size N of the universe for the instance I′ is 2O( 1√e ) × poly( 1 4. The number M of sets for the set cover instance I′ is poly( 1 5. The total time required for RED-3 is emph(I) + 2O( 1√e ) × poly( 1 e )× poly(I). e )× poly(I). e )× poly(I). e , then I2 does not have a set cover of size less than b √32e . e ). Note that the number of elements is very large compared to the number of sets. where b ≤ I1 = I1+o(1) · poly( 1 Proof. We apply the reduction from Theorem 4.1 with S poly( 1 in the given theorem. We work out each of the values below: e ) and V1 +V2 +E = n = I1+o(1) · e ). Substituting these values in Conjecture 3.2 and Theorem 4.1, we get the parameters as described = poly( 1 1. If I is a YES instance of SAT satisfying e ≥ 1 Ic , then RED-1 maps it to an instance I1 = (G = ,p ) of Projection Games such that all edges of I1 can be satisfied. Then RED-2 maps (V1,V2,E),S I1 to an instance I2 of Set Cover such that I2 has a set cover of size b = V1 +V2 ≤ V1 +V2 +E = I1 = I1+o(1) · poly( 1 e ). 2. If I is a NO instance of SAT satisfying e ≥ 1 Ic , then RED-1 maps it to an instance I1 = (G = (V1,V2,E),S ,p ) of Projection Games such that at most e -fraction of the edges of I1 can be satis- fied. Then RED-2 maps I1 to an instance I2 of Set Cover such that I2 does not have a set cover of size b √32e , where b is as calculated above. 3. By Theorem 4.1(3), the size of the universe is 2O( 1√e ) ×S 2 ×E. Observing that S E ≤ I1 = I1+o(1) · poly( 1 4. By Theorem 4.1(3), the number of sets is S V2 ≤ I1 = I1+o(1) · poly( 1 e ), it follows that the size of the universe is 2O( 1√e ) × poly( 1 = poly( 1 e )× poly(I). × (V1 +V2). Observing that S e ), it follows that the number of sets is poly( 1 = poly( 1 e ) and e )× poly(I). e ) and V1 + 5. Since RED-3 is the composition of RED-1 and RED-2, the time required for RED-3 is the summation of the times required for RED-1 and RED-2. By Conjecture 3.2, the time required for RED-1 is poly(I). By Theorem 4.1(4), the time required for RED-2 is at most 2O( 1√e )×poly(S )×poly(E+V1+V2). Observing that S e ) and V1 +V2 +E = I1 = I1+o(1) · poly( 1 e ), it follows that the time required for RED-2 is at most 2O( 1√e ) × poly( 1 e )× poly(I). Adding up the two, the time required for RED-3 is at most poly(I) + 2O( 1√e ) × poly( 1 e )× poly(I). = poly( 1 Finally we are ready to prove Theorem 2.1. 9 4.3 Proof of Theorem 2.1(1) The roadmap of the proof is as follows: suppose to the contrary there exists an FPT optimum approximation algorithm, say A, for Set Cover with ratio r (OPT ) = OPT F1 in 2OPT F2 · poly(N,M) time, where N is the size of the universe and M is the number of sets (recall Definition 1.4). We will choose the constant F1 such that using RED-3 from Theorem 4.7 (which assumes PGC), the algorithm A applied to the instance I2 will be able to decide the instance I1 of SAT. Then to violate ETH we will choose the constant F2 such that the running time of A summed up with the time required for RED-3 is subexponential in I. Let c > 0 be the constant from Conjecture 3.2. Fix some constant 1 > d > 0 and let c∗ = min{c,2− 2d }. Note that c∗ Ic , since c ≥ c∗. We carry out the reduction RED-3 e ). Let l > 0 be a given by Theorem 4.7. From Conjecture 3.2(3), we know that I1 = I1+o(1) · poly( 1 l . Then Theorem 4.7 implies b ≤ I1+o(1) · ( 1 l . constant such that the poly( 1 e ) However we have chosen e = 1 2 ≤ 1− d . Choosing e = 1 Ic∗ implies e ≥ 1 e ) is upper bounded by ( 1 e ) Ic∗ , and hence asymptotically we get l c∗ = I2+l c∗ b ≤ I2 ·I (5) c∗ Choose the constant F1 such that 4(2 + l c∗) ≥ F1. Suppose Set Cover has an FPT optimum approximation algorithm A with ratio r (OPT ) = OPT F1 (recall Definition 1.4). We show that this algorithm A can decide the SAT problem. Consider an instance I of SAT, and let I2 =RED-3(I) be the corresponding instance of Set Cover. Run the FPT approximation algorithm on IG, and let A(I2) denote the output of ALG. We have the following two cases: • • b √32e ≤ A(I2): Then we claim that I is a NO instance of SAT. Suppose to the contrary that I is b a YES instance of SAT. Then Theorem 4.7(1) implies b ≥ OPT (I2). Hence √32e ≤ A(I2) ≤ OPT · r (OPT ) = OPT 1+F1 = b 1+F1 ⇒ 1√32e ≤ b F1. However, asymptotically we have c∗ 1√32e = I 4 ≥ (I2+l c∗ )F1 = b F1, where the last two inequalities follows from the choice of F1 and Equation 5 respectively. This leads to a contradiction, and therefore I is a NO instance of SAT. c∗2 √32 > I b √32e > A(I2): Then we claim that I is a YES instance of SAT. Suppose to the contrary that I is a NO b instance of SAT. Then Theorem 4.7(2) implies OPT (I2) ≥ √32e > A(I2) ≥ OPT (I2) ≥ b √32e . Therefore we have b √32e . Therefore we run the algorithm A on the instance I2 and compare the output this comparison allows us to decide the SAT problem. b √32e with ne . As seen above, We now choose the constant F2 such that the running time of A summed up with the time required for RED-3 is subexponential in I. c∗ 2 )× poly(I) = poly(I) + 2o(I) · poly(I) since c∗ By Theorem 4.7(5), the total time taken by RED-3 is poly(I)+2O( 1√e )×poly( 1 c∗2 ) × poly(I e )×poly(I) = poly(I)+ 2 ≤ 1− d . Hence total time taken by 2O(I RED-3 is subexponential in I. We now show that there exists a constant F2 such that the claimed running time of 2OPT F2 · poly(N,M) for the algorithm A is subexponential in I, thus contradicting ETH. We do not have to worry about the poly(N,M) factor: the reduction time is subexponential in I, and hence max{N,M} is also upper bounded by a subexponential function of I. Hence, we essentially want to choose a constant F2 > 0 such that OPT F2 ≤ MF2 = o(I). From Theorem 4.7(4), we know that M ≤ S ×V1 + V2. Since a . We have seen earlier in the proof that S = poly( 1 e ), let a > 0 be a constant such that the S ≤ ( 1 e ) 10 l V1 +V2 ≤ I1 ≤ I2 · ( 1 e ) OPTF2 = o(I), which is what we wanted to show. = I2+c∗l . Therefore MF2 ≤ (I2+c∗l +c∗a )F2. Choosing F2 < 1 2+l c∗+2a c∗ gives 4.4 Proof of Theorem 2.1(2) Observe that due to Theorem 1.5, Theorem 2.1(1) implies Theorem 2.1(2). 5 An FPT Inapproximability Result for Clique We use the following theorem due to Zuckerman [33], which in turn is a derandomization of a result of Hastad [19] . [19, 33] Let X be any problem in NP. For any constant e > 0 there exists a polynomial Theorem 5.1. time reduction from X to Clique so that the gap between the clique sizes corresponding to the YES and NO instances of X is at least n1−e , where n is the number of vertices of the Clique instances. d d +2, or equivalently d = 2e 5.1 Proof of Theorem 2.2(1) Fix a constant 1 > d > 0. Set 0 < e = 1−e . Let X be any problem in NP. Let the Hastad-Zuckerman reduction from X to Clique [19, 33] which creates a gap of at least n1−e map an instance I of X to the corresponding instance IG of Clique. Since the reduction is polynomial, we know that n = IG = ID for some constant D(e ) > 0. Note that D depends on e , which in turn depends on d . Hence, ultimately D depends on d . If I is a YES instance of X, then IG contains a clique of size at least n1−e since each graph has a trivial clique of size one and the gap between YES and NO instances of Clique is at least n1−e . Similarly, observe that a graph on n vertices can have a clique of size at most n. To maintain the gap of at least n1−e , it follows if I is a NO instance of X then the maximum size of a clique in IG is at most ne . To summarize, we have • If I is a YES instance, then OPT (IG) ≥ n1−e • If I is a NO instance, then OPT (IG) ≤ ne Suppose Clique has an FPT optimum approximation algorithm A with ratio r (OPT ) = OPT 1−d (recall Definition 1.4). We show that this algorithm A can decide the problem X. Consider an instance I of X, and let IG be the corresponding instance of Clique. Run the FPT approximation algorithm on IG, and let A(IG) denote the output of A. We have the following two cases: • ne instance of X, then we have ne contradiction. ≥ A(IG): Then we claim that I is a NO instance of X. Suppose to the contrary that I is a YES = n2e , which is a d r (OPT (IG))) = (OPT (IG)) OPTIG d ) ≥ A(IG) ≥ ≥ (n1−e • ne instance of X, then we have ne < A(IG): Then we claim that I is a YES instance of X. Suppose to the contrary that I is a NO < A(IG) ≤ OPT (IG) ≤ ne , which is a contradiction. We run the algorithm A on the instance IG and compare the output A(IG) with ne . As seen above, this comparison allows us to decide the problem X. We now show how to choose the constant F such that the running 2OPT F D+1 works. Note that OPT (IG) ≤ n always. Hence 2OPT F D+1 · poly(I) = 2o(I) · poly(I). This implies we can could solve X in subexponential time using A. However X was any problem chosen from the class NP, and hence NP ⊆ SUBEXP. · poly(n) is subexponential in I. We claim that F = 1 · poly(ID) = 2IDF · poly(n) = 2(ID)F · poly(I) = 2I · poly(n) ≤ 2nF D 11 W[1]-hardness Strongly Connected Steiner Forest Guo et al. [16] Directed Steiner Forest Directed Steiner Network Minimum Edge Cover Directed Multicut Lemma 6.2 Lemma 6.4 Lemma 6.6 Marx and Razgon [29] Polytime Approx. Ratio OPT e (Lemma 6.1) OPT 1+e (Lemma 6.3) OPT 2 (Lemma 6.5) OPT − 1 (Lemma 6.7) 3· OPT [17] Figure 1: Polytime f (OPT )-approximation for W[1]-hard problems e d d +1, or equivalently d = 5.2 Proof of Theorem 2.2(2) Fix a constant 1 > d > 0. Set 0 < e = 1−e . Let X be any problem in NP. Let the Hastad-Zuckerman reduction from X to Clique [19, 33] which creates a gap of at least n1−e map an instance I of X to the corresponding instance IG of Clique. Since the reduction is polynomial, we know that n = IG = ID for some constant D(e ) > 0. Note that D depends on e , which in turn depends on d . Hence, ultimately D depends on d . If I is a YES instance of X, then IG contains a clique of size at least n1−e since each graph has a trivial clique of size one and the gap between YES and NO instances of Clique is at least n1−e . Similarly, observe that a graph on n vertices can have a clique of size at most n. To maintain the gap of at least n1−e , it follows if I is a NO instance of X then the maximum size of a clique in IG is at most ne . (recall Defini- ) to tion 1.1). We show that this algorithm ALG can decide the problem X. Set k = ne . On the input (IG,ne ALG, there are two possible outputs: Suppose Clique has an FPT approximation algorithm ALG with ratio r (k) = k1−d • ALG outputs reject ⇒ OPT (IG) < ne • ALG outputs a clique of size ≥ k ⇒ I is a YES instance of X ⇒ I is a NO instance of X k1−d = kd r (k) = k r (k) ⇒ OPT (IG) ≥ k = (ne d ) = n1−e Therefore the FPT approximation algorithm ALG can decide the problem X ∈ NP. We now show how to choose the constant F′ such that the running exp(kF′)· poly(n) is subexponential in I. We claim that F′ = 1 ·poly(ID) = e De D+1 · poly(I) = 2o(I) · poly(I). 2I chosen from the class NP, and hence NP ⊆ SUBEXP. This implies we can could solve X in subexponential time using ALG. However X was any problem e ·D+1 works. This is because 2kF′ ·poly(n) = 2ne F′ ·poly(n) = 2I e DF′ 6 Polytime f (OPT )-approximation for W[1]-hard problems In Section 2.1 we have seen the motivation for designing polynomial time f (OPT )-approximation algo- rithms for W[1]-hard problems such as Minimum Size Edge Cover, Strongly Connected Steiner Subgraph, Directed Steiner Forest and Directed Steiner Network. Our results are summarized in Figure 1. 6.1 The Strongly Connected Steiner Subgraph Problem Lemma 6.1. For any constant e > 0, the Strongly Connected Steiner Subgraph problem has a 2· OPT e - approximation in polynomial time. Proof. Fix any constant e > 0. Let Grev denote the reverse graph obtained from G, i.e., reverse the ori- entation of each edge. Any solution of the Strongly Connected Steiner Subgraph instance must contain 12 a path from t1 to each terminal in T \ t1 and vice versa. Consider the following two instances of the e -approximation Directed Steiner Tree problem: I1 = (G,t1,T \ t1) and I2 = (Grev,t1,T \ t1). In [6] an T e - is designed for Directed Steiner Tree in polynomial time, for any constant e > 0. Let E1,E2 be the T approximate solutions for the two instances and say that their optimum solutions are OPT1,OPT2 respec- tively. Let OPT be the size of optimum solution for the Strongly Connected Steiner Subgraph instance, then clearly OPT≥ max{OPT1,OPT2}. Clearly E1∪E2 is a solution for the Strongly Connected Steiner Subgraph instance as E j is a solution for I j for 1 ≤ j ≤ 2. It now remains to bound the size of this solution: e OPT. As every ter- E1 ∪ E2 ≤ E1 +E2 ≤ T minal has at least one incoming edge (and these edges are pairwise disjoint) we get that OPT ≥ T = k. e Therefore T 6.2 The Directed Steiner Forest Problem The Directed Steiner Forest problem is LabelCover hard and thus admits no 2log1−e n-approximation for any constant e [9]. The best know approximation factor for the problem is n 2 3 [12, 3]. We now define the problem formally: ≤ OPT e which implies a 2· OPT e -approximation factor. e OPT1 +T e OPT2 = T e (OPT1 +OPT2) ≤ 2T Directed Steiner Forest Input : A digraph G = (V,E) and a set of terminals T = {(s1,t1), . . . , (sk,tk)}. Problem: Does there exist a set E′ ⊆ E such that E′ ≤ p and (V,E′) has a si → ti path for every i ∈ [k]. Parameter: p Lemma 6.2. The Directed Steiner Forest problem is W[1]-hard parameterized by solution size plus number of terminal pairs. Proof. We give a reduction from the Strongly Connected Steiner Subgraph problem. Consider an instance (G,T, p) of Strongly Connected Steiner Subgraph where T = {t1,t2, . . . ,tℓ}. We now build a new graph G∗ as follows: • Add 2ℓ new vertices: for every i ∈ ℓ, we introduce vertices ri and si. • For every i ∈ [ℓ], add the edges (ri,ti) and (ti,si). Let the terminal pairs be T ∗ ={(ri,s j) 1≤ i, j ≤ ℓ;i 6= j}. We claim that the Strongly Connected Steiner Subgraph instance (G,T ) has a solution of size p if and only if there is a solution for the Directed Steiner Forest instance (G∗,T ∗) of size p + 2ℓ. Suppose there is a solution for the Strongly Connected Steiner Subgraph instance of size p. Adding the edges from E(G∗) \ E(G) clearly gives a solution for the Directed Steiner Forest instance of size p + 2ℓ. Conversely, suppose we have a solution for the Directed Steiner Forest instance of size p + 2ℓ. Since ti is the only out-neighbor, in-neighbor of ri,si respectively the solution must contain all the edges from E(G∗)\ E(G). Removing these edges clearly gives a solution of size p to the Strongly Connected Steiner Subgraph instance. Note that T ∗ = ℓ(ℓ− 1). Since Strongly Connected Steiner Subgraph is W[1]-hard parameterized by solution size plus number of terminals, we have that Directed Steiner Forest is W[1]-hard parameterized by solution size plus number of terminal pairs. Lemma 6.3. The Directed Steiner Forest problem admits an OPT 1+e -approximation in polynomial time. Proof. Let S = {v ∃ x such that (v,x) ∈ T}. For every v ∈ S, let Tv = {x (v,x) ∈ T}. For each v ∈ S, let the optimum for the instance (G,v,Tv) of Directed Steiner Tree be OPTv. Clearly OPTv ≤ OPT , where OPT is 13 e -approximation the optimum of the given Directed Steiner Forest instance.For each v ∈ S, we take the Tv given in [6] for the instance (G,v,Tv) of Directed Steiner Tree, and output the union of all these Steiner trees. Clearly this gives a feasible solution. We now analyze the cost. Since each vertex in S must have its own outgoing edge in the solution, we have S ≤ OPT . Similarly, for every v ∈ S each vertex of Tv must have its own incoming edge in the solution, and hence Tv ≤ OPT . Hence ≤ OPT 2+e . the cost of our solution is upper bounded by (cid:229) Therefore, we get a OPT 1+e -approximation. ·OPT ≤ S·OPT 1+e v∈S OPT e e v∈STv ·OPTv ≤ (cid:229) 6.3 The Directed Steiner Network Problem The Directed Steiner Network problem is not known to admit any non-trivial approximation and of course is LabelCover hard. We define the problem formally: Directed Steiner Network Input : A digraph G = (V,E), a set of terminals T = {(s1,t1), . . . , (sk,tk)}, a demand di between si,ti for every i ∈ [k] Problem: Does there exist a set E′ ⊆ E such that E′ ≤ p and (V,E′) has di disjoint si → ti paths for every i ∈ [k]. Parameter: p Lemma 6.4. The Directed Steiner Network problem is W[1]-hard parameterized by solution size plus num- ber of terminal pairs. Proof. The lemma follows from Lemma 6.2 and the fact that the Directed Steiner Forest problem is a special case of the Directed Steiner Network problem with di = 1 for every i. Lemma 6.5. The Directed Steiner Network problem admits an OPT 2-approximation in polynomial time. Proof. Let S = {v ∃ x such that (v,x) ∈ T} and S′ = {x ∃ v such that (v,x) ∈ T}. For every v ∈ S, let Tv = {x (v,x) ∈ T}. For each v ∈ S and x ∈ TV , let the demand for the pair (v,x) be dvx. Make v as a sink and x as a source. Using min-cost max-flow, find the smallest edge set, say Evx, such that there are dvx disjoint v → x paths in G. Clearly Evx ≤ OPT since any solution for the Directed Steiner Network instance must contain dvx disjoint v → x paths. Also, as seen before OPT ≥ S since each vertex in S must have at least own outgoing edge in any solution. Similarly OPT ≥ S′. We output Sv∈S,x∈Tv Evx as our solution. Clearly this is a feasible solution. Its cost is (cid:229) v∈S,x∈Tv OPT ≤ S·S′·OPT ≤ OPT ·OPT ·OPT , and hence this gives an OPT 2-approximation. v∈S,x∈Tv Evx ≤ (cid:229) 6.4 The Minimum Size Edge Cover Problem In this section, we show that the Minimum Size Edge Cover problem is W[1]-hard parameterized by size of the solution, and it admits an (OPT − 1)-approximation in polynomial time. The best approximation for Minimum Size Edge Cover is O(n0.172) due to Chlamtac et al. [7]. Minimum Size Edge Cover Input : A graph G = (V,E) and an integer k Problem : Does there exists a set S ⊆ V such that S ≤ p and the number of edges with both endpoints in S is at least k. Parameter : p 14 To show that W[1]-hardness of Minimum Size Edge Cover we reduce from the Multicolored Clique problem which is known to be W[1]-hard [13]6: Lemma 6.6. The Minimum Size Edge Cover problem is W[1]-hard parameterized by the size of the solution. Proof. Given an instance I1 = (G,f , p) of Multicolored Clique, we can consider another instance I2 = (G,k, p) of Minimum Size Edge Cover where k =(cid:0)p 2(cid:1). Clearly if I1 is a YES instance, then G has a multi- colored clique and I2 is a YES instance. In the other direction, if I2 is a YES instance then the p-sized set must form a clique in G, and must be in different color classes as f is a proper vertex coloring. This shows that Minimum Size Edge Cover is W[1]-hard parameterized by the size of the covering set. Now we show give an approximation algorithm for the Minimum Size Edge Cover problem. Lemma 6.7. The Minimum Size Edge Cover problem admits an (OPT − 1)-approximation in polynomial time. Proof. Let k be the desired number of edges in the solution and let OPT be the minimum number of vertices required. If there is a feasible solution, then there must be at least k edges in the graph. Pick any k edges, and let p′ the size of the set which is the union of their endpoints. Clearly p′ ≤ 2k. Since k ≤ OPT (OPT−1) , we have p′ ≤ 2k ≤ OPT (OPT − 1), and hence we get a (OPT − 1)-approximation7. 2 7 Constant Factor FPT Approximation For SCSS In this section we show that SCSS has an FPT 2-approximation. We define the problem formally: Strongly Connected Steiner Subgraph (SCSS) Input : An directed graph G = (V,E), a set of terminals T = {t1,t2, . . . ,tℓ} and an integer p Problem: Does there exists a set E′ ⊆ E such that E′ ≤ p and the graph G′ = (V,E′) has a ti → t j path for every i 6= j Parameter: p Lemma 7.1. Strongly Connected Steiner Subgraph has an FPT 2-approximation. Proof. Let Grev denote the reverse graph obtained from G, i.e., reverse the orientation of each edge. Any solution of SCSS instance must contain a path from t1 to each terminal in T \t1 and vice versa. Consider the following two instances of the Directed Steiner Tree problem: I1 = (G,t1,T \ t1) and I2 = (Grev,t1,T \ t1), and let their optimum be be OPT1,OPT2 respectively. Let OPT be the optimum of given SCSS instance and k be the parameter. If OPT > k then we output anything (see Definition 1.1). Otherwise we have k ≥ OPT ≥ max{OPT1,OPT2}. We know that the Directed Steiner Tree problem is FPT parameterized by the size of the solution [11]. Hence we find the values OPT1,OPT2 in time which is FPT in k. Clearly the union of solutions for I1 and I2 os a solution for instance I of SCSS. The final observation is OPT1 + OPT2 ≤ OPT + OPT = 2· OPT . Guo et al. [16] show that SCSS is W[1]-hard parameterized by solution size plus number of terminals. It is known that SCSS has no log2−e n-approximation in polynomial time for any fixed e > 0, unless NP has quasi-polynomial Las Vegas algorithms [18]. Combining these facts with Lemma 7.1 implies that SCSS 6Cai [4] has independently shown the W[1]-hardness of Minimum Size Edge Cover with parameter p. They call this problem as MAXIMUM p-VERTEX SUBGRAPH 7In fact, any feasible solution gives a (OPT − 1)-approximation 15 is a W[1]-hard problem that is not known to admit a constant factor approximation in polynomial time but has a constant factor FPT approximation. This answers a question by Marx [26]. Previously the only such problem known was a variant of the Almost-2-SAT problem [32] called 2-ASAT-BFL, due to Marx and Razgon [28]. 8 Open Problems In this paper, we have made some progress towards proving Conjecture 1.3. We list two of the open problems below: • Is there a W[2]-hard problem that admits an f (OPT )-approximation in polynomial time, for some function increasing f ? In Section 6, we showed that various W[1]-hard problems admit f (OPT )- approximation algorithms in polynomial time, but no such W[2]-hard problem is known. • Is there a W[2]-hard problem that admits an FPT approximation algorithm with ratio r , for any function r ? Grohe and Gruber [15] showed that the W[1]-hard problem of finding k vertex disjoint cycles in a directed graph has a FPT approximation with ratio r , for some computable function r . However, no such W[2]-hard problem is known. It is known [15, 26] that the existence of an FPT approximation algorithm with ratio r implies that there is an r ′(OPT )-approximation in polynomial time, for some function r ′. Therefore, a positive answer to the first question implies a positive answer to the second question. References [1] S. Arora and C. Lund. Approximation algorithms for NP-hard problems. Ed. D Hochbaum, PWS Publishing Co., Boston, MA, USA, 1997. [2] M. Bellare, S. Goldwasser, C. Lund, and A. Russeli. Efficient probabilistically checkable proofs and applications to approximations. In STOC, 1993. [3] P. Berman, A. Bhattacharyya, K. Makarychev, S. Raskhodnikova, and G. Yaroslavtsev. Improved approximation for the directed spanner problem. In ICALP (1), pages 1 -- 12, 2011. [4] L. Cai. Parameterized complexity of cardinality constrained optimization problems. Comput. J., 51(1):102 -- 121, 2008. [5] C. Calabro, R. Impagliazzo, and R. Paturi. A duality between clause width and clause density for sat. In IEEE Conference on Computational Complexity, pages 252 -- 260, 2006. [6] M. Charikar, C. Chekuri, T. Cheung, Z. Dai, A. Goel, S. Guha, and M. Li. Approximation algorithms for directed Steiner problems. J. of Algorithms, 33, 1999. [7] E. Chlamtac, M. Dinitz, and R. Krauthgamer. Everywhere-sparse spanners via dense subgraphs. FOCS, 2012. [8] M. Cygan, H. Dell, D. Lokshtanov, D. Marx, J. Nederlof, Y. Okamoto, R. Paturi, S. Saurabh, and M. Wahlstrom. On Problems as Hard as CNFSAT. CCC 2012. [9] Y. Dodis and S. Khanna. Design networks with bounded pairwise distance. In STOC, 1999. 16 [10] R. Downey and M. Fellows. Parameterized Complexity. Springer-Verlag, 1999. [11] S. E. Dreyfus and R. A. Wagner. The steiner problem in graphs. Networks, 1(3), 1971. [12] M. Feldman, G. Kortsarz, and Z. Nutov. Improved approximation algorithms for directed steiner forest. J. Comput. Syst. Sci., 78(1):279 -- 292, 2012. [13] M. Fellows, D. Hermelin, F. Rosamond, and S. Vialette. On the parameterized complexity of multiple- interval graph problems. Theor. Comp. Sci., 410(1), 2009. [14] M. R. Fellows, J. Guo, D. Marx, and S. Saurabh. Data Reduction and Problem Kernels (Dagstuhl Seminar 12241). Dagstuhl Reports, 2(6):26 -- 50, 2012. [15] M. Grohe and M. Gruber. Parameterized approximability of the disjoint cycle problem. In ICALP, pages 363 -- 374, 2007. [16] J. Guo, R. Niedermeier, and O. Such´y. Parameterized complexity of arc-weighted directed steiner problems. SIAM J. Discrete Math., 25(2):583 -- 599, 2011. [17] A. Gupta. Improved results for directed multicut. In SODA, pages 454 -- 455, 2003. [18] E. Halperin and R. Krauthgamer. Polylogarithmic inapproximability. In STOC '03: Proceedings of the thirty-fifth annual ACM symposium on Theory of computing, pages 585 -- 594, New York, NY, USA, 2003. ACM Press. [19] J. Hastad. Clique is hard to approximate within n1−e . In FOCS, 1996. [20] R. Impagliazzo and R. Paturi. On the complexity of k-sat. J. Comput. Syst. Sci., 62(2), 2001. [21] S. Khot. On the Unique Games Conjecture. In FOCS, page 3, 2005. [22] Lecture-Notes. http://www.cs.washington.edu/education/courses/cse533/05au/lecture14.pdf. [23] D. Lokshtanov, D. Marx, and S. Saurabh. Known algorithms on graphs on bounded treewidth are probably optimal. In SODA, pages 777 -- 789, 2011. [24] D. Lokshtanov, D. Marx, and S. Saurabh. Lower bounds based on the exponential time hypothesis. Bulletin of the EATCS, 105:41 -- 72, 2011. [25] C. Lund and M. Yannakakis. On the hardness of approximating minimization problems. J. ACM, 41(5):960 -- 981, 1994. [26] D. Marx. Parameterized complexity and approximation algorithms. Comput. J., 51(1), 2008. [27] D. Marx. Completely inapproximable monotone and antimonotone parameterized problems. Journal of Computer and System Sciences, 79(1), 2013. [28] D. Marx and I. Razgon. Constant ratio fixed-parameter approximation of the edge multicut problem. Inf. Process. Lett., 109(20):1161 -- 1166, 2009. [29] D. Marx and I. Razgon. Fixed-parameter tractability of multicut parameterized by the size of the cutset. In STOC, pages 469 -- 478, 2011. [30] D. Moshkovitz. The Projection Games Conjecture and The NP-Hardness of ln n-Approximating Set- Cover. APPROX, 2012. 17 [31] D. Moshkovitz and R. Raz. Two-query PCP with subconstant error. J. ACM, 57(5), 2010. [32] I. Razgon and B. O'Sullivan. Almost 2-sat is fixed-parameter tractable. J. Comput. Syst. Sci., 75(8):435 -- 450, 2009. [33] D. Zuckerman. Linear degree extractors and the inapproximability of max clique and chromatic num- ber. In STOC, pages 681 -- 690, 2006. 18
1801.04425
1
1801
2018-01-13T11:55:45
Longest Common Prefixes with $k$-Errors and Applications
[ "cs.DS" ]
Although real-world text datasets, such as DNA sequences, are far from being uniformly random, average-case string searching algorithms perform significantly better than worst-case ones in most applications of interest. In this paper, we study the problem of computing the longest prefix of each suffix of a given string of length $n$ over a constant-sized alphabet that occurs elsewhere in the string with $k$-errors. This problem has already been studied under the Hamming distance model. Our first result is an improvement upon the state-of-the-art average-case time complexity for non-constant $k$ and using only linear space under the Hamming distance model. Notably, we show that our technique can be extended to the edit distance model with the same time and space complexities. Specifically, our algorithms run in $\mathcal{O}(n \log^k n \log \log n)$ time on average using $\mathcal{O}(n)$ space. We show that our technique is applicable to several algorithmic problems in computational biology and elsewhere.
cs.DS
cs
Longest Common Prefixes with k-Errors and Applications Lorraine A.K. Ayad, Panagiotis Charalampopoulos, Costas S. Iliopoulos, and Solon P. Pissis Department of Informatics, King's College London, London, UK [lorraine.ayad,panagiotis.charalampopoulos, costas.iliopoulos,solon.pissis]@kcl.ac.uk Abstract. Although real-world text datasets, such as DNA sequences, are far from being uniformly random, average-case string searching algo- rithms perform significantly better than worst-case ones in most appli- cations of interest. In this paper, we study the problem of computing the longest prefix of each suffix of a given string of length n over a constant- sized alphabet that occurs elsewhere in the string with k-errors. This problem has already been studied under the Hamming distance model. Our first result is an improvement upon the state-of-the-art average-case time complexity for non-constant k and using only linear space under the Hamming distance model. Notably, we show that our technique can be extended to the edit distance model with the same time and space com- plexities. Specifically, our algorithms run in O(n logk n log log n) time on average using O(n) space. We show that our technique is applicable to several algorithmic problems in computational biology and elsewhere. 1 Introduction The longest common prefix (LCP) array is a commonly used data structure alongside the suffix array (SA). The LCP array stores the length of the longest common prefix between two adjacent suffixes of a given string as they are stored (in lexicographical order) in the SA [20]. A typical use combining the SA and the LCP array is to simulate the suffix tree functionality using less space [2]. However, there are many practical scenarios where the LCP array may be applied without making use of the SA. The LCP array provides us with essential information regarding repetitiveness in a given string and is therefore a useful data structure for analysing textual data in areas such as molecular biology, musicology, or natural language processing (see [21] for some applications). It is also quite common to account for potential alterations within textual data (sequences). For example, they can be the result of DNA replication or sequencing errors in DNA sequences. In this context, it is natural to define the longest common prefix with k-errors. Given a string x[0 . . n − 1], the longest common prefix with k-errors for every suffix x[i . . n − 1] is the length of the longest common prefix of x[i . . n − 1] and any x[j . . n − 1], where j 6= i, with applying up to k substitution operations [21]. Some applications are given below. Interspersed Repeats. Repeated sequences are a common feature of genomes. One type in particular, interspersed repeats, are known to occur in all eukaryotic genomes. These repeats have no repetitive pattern and appear irregularly within DNA sequences [15]. Single nucleotide polymorphisms result in the existence of interspersed repeats that are not identical [19]. Identifying these repeats has been linked to genome folding locations and phylogenetic analysis [24]. Genome Mappability Data Structure. In [3] the authors showed that using the longest common prefixes with k-errors they can construct, in O(n) worst-case time, an O(n)-sized data structure answering the following type of queries in O(1) time per query: find the smallest m such that at least µ of the substrings of x of length m do not occur more than once in x with at most k errors. This is a data structure version of the genome mappability problem [8, 21, 4]. Longest Common Substring with k-Errors. The longest common substring with k-errors problem has received much attention recently, in particular due to its ap- plications in computational biology [27, 18, 26]. We are asked to find the longest substrings of two strings that are at distance at most k. The notion of longest common prefix with k-errors is thus closely related to the notion of longest com- mon substring with k-errors. We refer the interested reader to [1, 10, 11, 14, 25]. All-Pairs Suffix/Prefix Overlaps with k-Errors. Finding approximate overlaps is the first stage of most genome assembly methods. Given a set of strings and an error-rate ǫ, the goal is to find, for all pairs of strings, their suffix/prefix matches (overlaps) that are within distance k = ⌈ǫℓ⌉, where ℓ is the length of the overlap [23, 28, 16]. By concatenating the strings to form one single string x and then computing longest common prefixes with k-errors for x only against the prefixes of the strings we have all the information we need to solve this problem. Our Model. We assume the standard word-RAM model with word size w = Ω(log n). Although real-world text datasets are far from being uniformly random, average-case string searching algorithms perform significantly better than worst- case ones in most applications of interest. We are thus interested in the average- case behaviour of our algorithms. When we state average-case time complexities for our algorithms, we assume that the input is a string x of length n over an alphabet Σ of size σ > 1 with the letters of x being independent and identically distributed random variables, uniformly distributed over Σ. In the context of molecular biology we typically have Σ = {A,C,G,T} and so we assume σ = O(1). Related Works. The problem of computing longest common prefixes with k- errors was first studied by Manzini for k = 1 in [21]. We distinguish the following techniques that can be applied to solve this and other related problems. Non-constant k and ω(n) space: In this case, we can make use of the well- known data structure by Cole et al [7]. The size of the data structure is O(n (c log n)k k! ), where c > 1 is a constant. 2 Constant k and O(n) space: In this case, we can make use of the technique by Thankachan et al [25] which builds heavily on the data structure by Cole et al. The working space is exponential in k but O(n) for k = O(1). Non-constant k and O(n) space: In this case, there exists a simple O(n2k)- time worst-case algorithm to solve the problem. The best-known average- case algorithm was presented in [3]. It requires O(n(σR)k log log n(log k + log log n)) time on average, where R = ⌈(k + 2)(logσ n + 1)⌉. Other related works: In [14] it was shown that a strongly subquadratic-time algorithm for the longest common substring with k-errors problem, for k = Ω(log n) and binary strings, refutes the Strong Exponential Time Hypothe- sis. Thus subquadratic-time solutions for approximate variants of the prob- lem have been developed [14]. A non-deterministic algorithm is also known [1]. Our Contribution. In this paper, we continue the line of research for non-constant k and O(n) space to investigate the limits of computation in the average-case setting; in particular in light of the worst-case lower bound shown in [14]. We make the following threefold contribution. log log n . 1. We first show a non-trivial upper bound of independent interest: the expected length of the maximal longest common prefix with k-errors between a pair of suffixes of x is O(logσ n) when k ≤ log n 2. By applying this result, we significantly improve upon the state-of-the-art algorithm for non-constant k and using O(n) space [3]. Specifically, our al- gorithm runs in O(n logk n log log n) time on average using O(n) space. 3. Notably, we extend our results to the edit distance model with no extra cost thus solving the genome mappability data structure problem, the longest common substring with k-errors problem, and the all-pairs suffix/prefix over- laps with k-errors problem in strongly sub-quadratic time for k ≤ log n log log n . 2 Preliminaries We begin with some basic definitions and notation. Let x = x[0]x[1] . . . x[n−1] be a string of length x = n over a finite ordered alphabet Σ of size Σ = σ = O(1). For two positions i and j on x, we denote by x[i . . j] = x[i] . . . x[j] the substring (sometimes called factor ) of x that starts at position i and ends at position j. We recall that a prefix of x is a substring that starts at position 0 (x[0 . . j]) and a suffix of x is a substring that ends at position n − 1 (x[i . . n − 1]). Let y be a string of length m with 0 < m ≤ n. We say that there exists an occurrence of y in x, or, more simply, that y occurs in x, when y is a substring of x. Every occurrence of y can be characterised by a starting position in x. We thus say that y occurs at the starting position i in x when y = x[i . . i + m − 1]. The Hamming distance between two strings x and y, with x = y, is defined as dH (x, y) = {i : x[i] 6= y[i], i = 0, 1, . . . ,x−1}. If x 6= y, we set dH (x, y) = ∞. The edit distance between x and y is the minimum total cost of a sequence of edit operations (insertions, deletions, substitutions) required to transform x into y. It is known as Levenshtein distance for unit cost operations. We consider 3 this special case here. If two strings x and y are at (Hamming or edit) distance at most k we say that x and y have k-errors or have at most k errors. We denote by SA the suffix array of x. SA is an integer array of size n storing the starting positions of all (lexicographically) sorted non-empty suffixes of x, i.e. for all 1 ≤ r < n we have x[SA[r − 1] . . n − 1] < x[SA[r] . . n − 1] [20]. Let lcp(r, s) denote the length of the longest common prefix between x[SA[r] . . n− 1] and x[SA[s] . . n − 1] for positions r, s on x. We denote by LCP the longest common prefix array of x defined by LCP[r] = lcp(r − 1, r) for all 1 ≤ r < n, and LCP[0] = 0. The inverse iSA of the array SA is defined by iSA[SA[r]] = r, for all 0 ≤ r < n. It is known that SA, iSA, and LCP of a string of length n, over a constant-sized alphabet, can be computed in time and space O(n) [22, 9]. It is then known that a range minimum query (RMQ) data structure over the LCP array, that can be constructed in O(n) time and O(n) space [5], can answer lcp-queries in O(1) time per query [20]. The lcp queries are also known as longest common extension (LCE) queries. The permuted LCP array, denoted by PLCP, has the same contents as the LCP array but in different order. Let i− denote the starting position of the lexicographic predecessor of x[i . . n−1]. For i = 0, . . . , n−1, we define PLCP[i] = LCP[iSA[i]] = lcp(iSA[i−], iSA[i]]), that is, PLCP[i] is the length of the longest common prefix between x[i . . n − 1] and its lexicographic predecessor. For the starting position j of the lexicographically smallest suffix we set PLCP[j] = 0. For any k ≥ 0, we define lcpk(y, z) as the largest ℓ ≥ 0 such that y[0 . . ℓ − 1] and z[0 . . ℓ − 1] exist and are at Hamming distance at most k; note that this is defined for a pair of strings. We analogously define the permuted LCP array with k-errors, denoted by PLCPk. For i = 0, . . . , n − 1, we have that PLCPk[i] = max j=0,...,n−1, j6=i lcpk(x[i . . n − 1], x[j . . n − 1]). The main computational problem in scope can be formally stated as follows. PLCP with k-Errors Input: A string x of length n and an integer 0 < k < n Output: PLCPk and Pk; Pk[i] 6= i, for i = 0, . . . , n − 1, is such that x[i . . i + ℓ − 1] ≈k x[Pk[i] . . Pk[i] + ℓ − 1], where ℓ = PLCPk[i] We assume that k ≤ log n log log n throughout, since all relevant time-complexities contain an n logk n factor and any larger k would force this value to be Ω(n2): n logk n ≤ cn2 ⇔ k log log n ≤ log(cn) ⇔ k ≤ log c + log n log log n , c ≥ 1. 3 Computing PLCPk In this section we propose a new algorithm for the PLCP with k-Errors problem under both the Hamming and the edit distance (Levenshtein distance) 4 models. This algorithm is based on a deeper look into the expected behaviour of the longest common prefixes with k-errors. This in turn allows us to make use of the y-fast trie, an efficient data structure for maintaining integers from a bounded domain. We already know the following result for errors under the Hamming distance model. Theorem 1 ([3]). Problem PLCP with k-Errors for 1 ≤ k ≤ log n log log n can be solved in average-case time O(n(σR)k log2 log n), where R = ⌈(k+2)(logσ n+1)⌉, using O(n) extra space. In the rest of this section, we show the following result for errors under both the Hamming and the edit distance models. Theorem 2. Problem PLCP with k-Errors can be solved in average-case time O(n ck k! logk n log log n), where c is a constant, using O(n) extra space. For clarity of presentation, we first do the analysis and present the algorithm under the Hamming distance model in Sections 3.1 and 3.2. We then show how to extend our technique to work under the edit distance model in Section 3.3. 3.1 Expectations The expected maximal value in the LCP array is 2 logσ n + O(1) [13]. We can thus obtain a trivial O(k logσ n) bound on the expected length of the maximal longest common prefix with k-errors for arbitrary k and σ. By looking deeper into the expected behaviour of the longest common prefixes with k-errors we show the following result of independent interest for when k ≤ log n Theorem 3. Let x be a string of length n over an alphabet of size σ > 1 and 1 ≤ k ≤ log n (a) The expected length of the maximal longest common prefix with k-errors be- log log n be an integer. log log n . tween a pair of suffixes of x is O(logσ n). (b) There exists a constant α such that the expected number of pairs of suffixes of x with a common prefix with k-errors of length at least α logσ n is O(1). Proof (a). Let us denote the ith suffix of x by xi = x[i . . n − 1]. Further let us define the following random variables: Xi,j = lcpk(xi, xj ) and Y = max 0≤i<j≤n−1 Xi,j. Claim. Pr(Xi,j ≥ m) ≤ (cid:18)m k(cid:19) 1 σm−k . Proof (of Claim). Each possible set of positions where a substitution is allowed is a subset of one of the (cid:0)m k(cid:1) subsets of m of size k. For each of these subsets, we can disregard what happens in the k chosen positions; in order to yield a match with k-errors, the remaining m − k positions must match and each of them matches with probability 1 σ . The claim follows by applying the Union-Bound (Boole's inequality). ⊓⊔ 5 By applying the Union-Bound again we have that Pr(Y ≥ m) = Pr([i<j {Xi,j ≥ m}) ≤ Xi<j Pr(Xi,j ≥ m) ≤ n2(cid:18)m k(cid:19) 1 σm−k , for m ≥ k and Pr(Y ≥ m) = 1 for m ≤ k. The expected value of Y is given by: E[Y ] = ∞ Xm=1 Pr(Y ≥ m) = α(logσ +k) Xm=1 Pr(Y ≥ m) } {z ≤α(logσ n+k) + ∞ Xm=α(logσ n+k)+1 Pr(Y ≥ m). (Note that we bound the first summand using that Pr(Y ≥ m) ≤ 1 for all m.) Claim. Let rm,k = (cid:18)m k(cid:19). We have that 2 for m ≥ 6k. rm−1,k ≤ 3 rm,k Proof (of Claim). rm,k rm−1,k = m (m − k − 1) ≤ 6k (6k − k − 1) = 6k (5k − 1) ≤ 3 2 . ⊓⊔ By assuming β = α(logσ n + k) + 1 ≥ 6k, for some α > 1, we apply the above claim to bound the second summand as follows. ∞ Xm=β = ∞ Xm=β Pr(Y ≥ m) ≤ n2(cid:18)6k k (cid:19)(cid:18) 2 ≤ An6(cid:18) 3 ∞ Xm=β 3(cid:19)5k(cid:18) 3 2σ(cid:19)β−k n2(cid:18)m k(cid:19) 1 ∞ σm−k ≤ Xm=β ≤ n2(cid:18)6k k (cid:19)(cid:18) 2 2σ(cid:19)α logσ n 2σ(cid:19)m−k ≤ An6(cid:18) 3 n2(cid:18)6k k (cid:19)(cid:18) 3 2(cid:19)m−6k 1 σm−k 3(cid:19)5k(cid:18) 3 2σ(cid:19)β−k ∞ Xm=0 (cid:18) 3 2σ(cid:19)m = An6 nα(1−1/ log3/2 σ) for some constant A since σ ≥ 2 and (6k)k ≤ 23 log nkk ≤ n3 logk n = O(n4). Then 1 − 1/ log3/2 σ > 0 and we can thus pick an α large enough such that this sum is O(n−ǫ) for any ǫ > 0. ⊓⊔ Proof (b). Let Ii,j,m be the indicator random variable for the event {Xi,j ≥ m}. We then have that E[Xi<j Ii,j,m] = Xi<j E[Ii,j,m] = Xi<j Pr(Xi,j ≥ m), which we have already shown is O(1) if m = α logσ n for some α > 1. ⊓⊔ 6 i a0 j0 p X X X X i + m − 1 ae je Fig. 1: The (e+1)th error is any possible substitution at a position je < p ≤ i+m. 3.2 Improved Algorithm for Hamming Distance We then want to find a longest prefix of the σk(cid:0)λ The y-fast trie, introduced in [29], supports insert, delete and search (exact, predecessor and successor queries) in time O(log log U ) with high probability, using O(n) space, where n is the number of stored values and U is size of the universe. We consider each substring of x of length at most λ = α log n for a constant α satisfying Theorem 3 (b) as a λ-digit number; note that by our assumptions this number fits in a computer word. We thus have U = σλ and hence log log U = O(log log n + log α) = O(log log n). We initialise PLCPk and Pk for each i based on the longest common prefix of x[i . . n − 1] (i.e. not allowing any errors) that occurs elsewhere using the SA and the LCP array; this can be done in O(n) time. For each pair of suffixes that share a prefix of at least λ we perform (at most) k LCE queries to find their longest common prefix allowing for k-errors; by Theorem 3 these pairs are O(1). We then initialise the y-fast trie by inserting x[i . . i + λ − 1] to it for each position i of x with i ≤ n − λ. (For the rest of the positions, for which we reach the end of x, we insert x[i . . n − 1] after some trivial technical considerations.) This procedure takes time O(n log log n) in total. k(cid:1) strings of length at most λ that are at Hamming distance at most k from x[i . . i + λ − 1] that occurs elsewhere in x as well as an occurrence of it. If this prefix is of length λ, we find all positions t in x for which dH (x[i . . i + λ − 1], x[t . . t + λ − 1]) ≤ k and treat each of them individually. We generate a subset of the σk(cid:0)λ k(cid:1) strings; we avoid generating some that we already know do not occur in x. We only want to allow the first error at position p, where i ≤ p ≤ i + PLCP0[i]. Let us denote the substitution at position j with letter a by (j, a). Suppose that the longest prefix of x[i . . n − 1] after substitutions (j0, a0), . . . , (je, ae) that occurs elsewhere in the string is of length m. We then want to allow the (e + 1)th error at positions je < p ≤ i + m; inspect Figure 1 for an illustration. It should be clear that we obtain each possible sequence of substitutions at most once. We view each string z created after at most k substitution operations as a number; the aim is to find its longest prefix that occurs elsewhere in x. To this end we perform at most three queries over the y-fast trie: an exact; a predecessor; and a successor query. If the exact query is unsuccessful, then either the predecessor or the successor query will return a factor z′ of x that attains the maximal longest common prefix that any factor of x has with z. Note that it may be the case that z′ only occurs at position i; however in this case lcpk(z, z′) will be smaller 7 or equal than the value currently stored at PLCPk[i] due to how we generate each such string z. Hence we do not perform an invalid update of PLCPk[i]. Having found z′, we can then compute the length of the longest common prefix between z and z′ in constant time using standard bit-level operations. For clarity of presentation we assume z = z′ = λ. An XOR operation between z and z′ provides us with an integer d specifying the positions of errors (bits set on when d is viewed as binary). If d 6= 0, we take δ = ⌊log d⌋, which provides us with the index of the leftmost bit set on which in turn specifies the length of the longest common prefix between z and z′; specifically lcp0(z, z′) = ⌊ λ⌈log σ⌉−δ−1 ⌋. If z = z′ we perform LCE queries between all suffixes of the text that have z as a prefix and x[j . . j + λ − 1]; by Theorem 3 we expect this to happen O(1) times in total, so the cost is immaterial. We have α log n positions where we need to consider the k errors, yielding an logk n log log n). ⌈log σ⌉ overall time complexity of O(nσk(cid:0)α log n We thus obtain the following result. k (cid:1) log log n) = O(n (ασ)k k! Theorem 2. Problem PLCP with k-Errors can be solved in average-case k! ≤ (ασ)ασ = O(1) and hence the required time k! logk n log log n), where c is a constant, using O(n) extra space. time O(n ck Remark 1. We have that (ασ)k is bounded by O(n logk n log log n). Remark 2. If α log n > w, where w is the word size in the word-RAM model, we can make use of the deterministic data structure presented in [6] (Theorem 1 therein), which can be built in O(n) time for a string x of length n and answers predecessor queries (i.e. given a query string p, it returns the lexicographically largest suffix of x that is smaller than p) in time O( p log σ w +logp+log log σ). In particular, the queries in scope can be answered in time O(log log n) per query. 3.3 Edit Distance We next consider computing PLCPk under the edit distance model; however in this case we observe that x[i . . n − 1] and x[i + j . . n − 1] are at edit distance j for i − k ≤ j ≤ i + k. We hence alter the definition so that PLCPk[i] refers to the longest common prefix of x[i . . n − 1] with k-errors occurring at a position j /∈ Si,k = {i − k, . . . , i + k}. The proof of Theorem 3 can be extended to allow for k-errors under the edit distance. In this case we have that Pr(Xi,j ≥ m) ≤ (cid:0)m σm−k ; this can be seen by following the same reasoning as in the first claim of the proof with two extra considerations: (a) each deletion/insertion operation conceptually shifts the letters to be matched (giving the 3k factor); (b) the letters to be matched are m minus the number of deletions and substitutions and hence at least m− k. The extra 3k factor gets consumed by (2/3)5k later in the proof since 2 5√3/3 < 1. k(cid:1) 3k On the technical side, we modify the algorithm of Section 3.2 as follows: 8 x[j . . n − 1] j j + k n − 1 i i + k x[i . . n − 1] n − 1 Fig. 2: We need to perform k extension steps in 2k + 1 diagonals of the dynamic programming matrix for x[i . . n − 1] and x[j . . n − 1]. 1. At each position, except for σ− 1 substitutions, we also consider σ insertions and 1 deletion. This yields a multiplicative 2k factor in the time complexity. We keep counters ins for insertions and del for deletions; for each length we obtain, we add del and subtract ins. 2. When querying for a string z while processing position i we now have to check that we do not return a position j ∈ Si,k. We can resolve this by spending O(k) time for each position i; when we start processing position i, we create an array of size O(k) that stores for each position j ∈ Si,k a position fj /∈ Si,k with the maximal longest common prefix with x[j . . n− 1] using the SA and the LCP array. When a query returns a position j ∈ Si,k we instead consider fj. 3. We replace the LCE queries used to compute values in PLCPk longer than λ (that required O(k) time in total) by the Landau-Vishkin technique [17] to perform extensions. For an illustration inspect Figure 2. We initiate 2k + 1 diagonal paths in the classical dynamic programming matrix for x[i . . n − 1] and x[j . . n−1]. The ith diagonal path above and the ith diagonal path below the main diagonal are initialised to i errors. The path starting at the main diagonal is initialised to 0 errors. We first perform an LCE query between x[i . . n− 1] and x[j + d . . n− 1], for all 0 ≤ d ≤ k, and an LCE query between x[i + d . . n− 1] and x[j . . n− 1], for all 1 ≤ d ≤ k. Then, for all 1 ≤ d ≤ k, we try to extend a path with exactly d− 1 errors to a path with exactly d errors. We perform an insertion, a deletion, or a substitution with a further LCE query and pick the farthest reaching extension. The bottom-most extension of any diagonal when d = k specifies the length of the longest common prefix with k-errors. The whole process takes time O(k2). 9 4 Genome Mappability Data Structure The genome mappability problem has already been studied under the Hamming distance model [8, 21, 4]. We can also define the problem under the edit distance model. Given a string x of length n and integers m < n and k < m, we are asked to count, for each length-m substring x[i . . i + m − 1] of x, the number occ of other substrings of x occurring at a position j /∈ Si,k = {i − k, . . . , i + k} that are at edit distance at most k from x[i . . i + m − 1]. We then say that this substring has k-mappability equal to occ. Specifically, we consider a data structure version of this problem [3]. Given x and k, construct a data structure, which, for a query value µ given on-line, returns the minimal value of m that forces at least µ length-m substrings of x to have k-mappability equal to 0. Theorem 4 ([3]). An O(n)-sized data structure answering genome mappability queries in O(1) time per query can be constructed from PLCPk in time O(n). By combining Theorem 2 with Theorem 4 we obtain the first efficient algo- rithm for the genome mappability data structure under the edit distance model. 5 Longest Common Substring with k-Errors In the longest common substring with k-errors problem we are asked to find the longest substrings of two strings that are at distance at most k. The Ham- ming distance version has received much attention due to its applications in computational biology [27, 18, 26]. Under edit distance, the problem is largely unexplored. The average k-error common substring is an alignment-free method based on this notion for measuring string dissimilarity under Hamming distance; we denote the induced distance by Distk(x, y) for two strings x and y (see [27] for the definition). Distk(x, y) can be computed in time O(x + y) from arrays Λx,y and Λy,x, defined as Λx,y[i] = max 0≤j≤y−1 (lcpk(x[i . .x − 1], y[j . .y − 1])). A worst-case and a more practical average-case algorithm for the computation of Λx,y have been presented in [25, 26]. This measure was extended to allow for wildcards (don't care letters) in the strings in [12]. Here we provide a natural generalisation of this measure: the average k-error common substring under the edit distance model. The sole change is in the definition of Λx,y[i]: except for substitution, we also allow for insertion and deletion operations. The algorithm of Section 3.3 can be applied to compute Λx,y under the edit distance model within the same complexities. We start by constructing the y-fast trie for y. We then do the queries for the suffixes of x; we now also check for an exact match (i.e. for x[i . . i + α log(x +y)− 1]). We obtain the following result. Theorem 5. Given two strings x and y of length at most n and a distance threshold k, arrays Λx,y and Λy,x and Distk(x, y) can be computed in average- case time O(n ck k! logk n log log n), where c is a constant, using O(n) extra space. 10 Remark 3. By applying Theorem 5 we essentially solve the longest common substring with k-errors for x and y within the same complexities. 6 All-Pairs Suffix/Prefix Overlaps with k-Errors Given a set of strings and an error-rate ǫ, the goal is to find, for all pairs of strings, their suffix/prefix matches (overlaps) that are within distance k = ⌈ǫℓ⌉, where ℓ is the length of the overlap [23, 28, 16]. Using our technique but only inserting prefixes of the strings in the y-fast trie and querying for all starting positions (suffixes) in a similar manner as in Section 3.1, we obtain the following result. Theorem 6. Given a set of strings of total length n and a distance thresh- old k, the length of the maximal longest suffix/prefix overlaps of every string against all other strings within distance k can be computed in average-case time O(n ck k! logk n log log n), where c is a constant, using O(n) extra space. References 1. Amir Abboud, Ryan Williams, and Huacheng Yu. More applications of the poly- nomial method to algorithm design. In SODA, SODA '15, pages 218–230. Society for Industrial and Applied Mathematics, 2015. 2. Mohamed Ibrahim Abouelhoda, Stefan Kurtz, and Enno Ohlebusch. Replacing suffix trees with enhanced suffix arrays. Journal of Discrete Algorithms, 2(1):53– 86, 2004. 3. Hayam Alamro, Lorraine A. K. Ayad, Panagiotis Charalampopoulos, Costas S. Iliopoulos, and Solon P. Pissis. Longest common prefixes with k-mismatches and applications. In SOFSEM, volume 10706 of LNCS, pages 636–649. Springer Inter- national Publishing, 2018. 4. Mai Alzamel, Panagiotis Charalampopoulos, Costas S. Iliopoulos, Solon P. Pissis, Jakub Radoszewski, and Wing-Kin Sung. Faster algorithms for 1-mappability of a sequence. In COCOA, volume 10628 of LNCS, pages 109–121. Springer Interna- tional Publishing, 2017. 5. Michael A. Bender and Martín Farach-Colton. The LCA problem revisited. In LATIN, volume 1776 of LNCS, pages 88–94. Springer-Verlag, 2000. 6. Philip Bille, Inge Li Gørtz, and Frederik Rye Skjoldjensen. Deterministic indexing for packed strings. In CPM, volume 78 of LIPIcs, pages 6:1–6:11. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2017. 7. Richard Cole, Lee-Ad Gottlieb, and Moshe Lewenstein. Dictionary matching and indexing with errors and don't cares. In STOC, STOC '04, pages 91–100. ACM, 2004. 8. Thomas Derrien, Jordi Estellé, Santiago Marco Sola, David Knowles, Emanuele Raineri, Roderic Guigó, and Paolo Ribeca. Fast computation and applications of genome mappability. PLoS ONE, 7(1), 2012. Inducing the LCP-array. In WADS, volume 6844 of LNCS, 9. Johannes Fischer. pages 374–385. Springer-Verlag, 2011. 10. Tomás Flouri, Emanuele Giaquinta, Kassian Kobert, and Esko Ukkonen. Longest common substrings with k mismatches. Inf. Process. Lett., 115(6-8):643–647, 2015. 11 11. Szymon Grabowski. A note on the longest common substring with k-mismatches problem. Inf. Process. Lett., 115(6-8):640–642, 2015. 12. Sebastian Horwege, Sebastian Lindner, Marcus Boden, Klas Hatje, Martin Koll- mar, Chris-Andre Leimeister, and Burkhard Morgenstern. Spaced words and kmacs: fast alignment-free sequence comparison based on inexact word matches. Nucleic Acids Research, 42(Webserver-Issue):7–11, 2014. 13. S. Karlin, G. Ghandour, F. Ost, Tavare S., and L. J. Korn. New approaches In Proceedings of the National for computer analysis of nucleic acid sequences. Academy of Sciences USA, volume 80, pages 5660–5664, 1983. 14. Tomasz Kociumaka, Jakub Radoszewski, and Tatiana A. Starikovskaya. Longest common substring with approximately k mismatches. CoRR, abs/1712.08573, 2017. 15. Roman Kolpakov, Ghizlane Bana, and Gregory Kucherov. mreps: efficient and flexible detection of tandem repeats in DNA. Nucleic Acids Research, 31(13):3672– 3678, 2003. 16. Gregory Kucherov and Dekel Tsur. Improved filters for the approximate suffix- prefix overlap problem. In SPIRE, volume 8799 of LNCS, pages 139–148. Springer, 2014. 17. Gad M. Landau and Uzi Vishkin. Efficient string matching in the presence of errors. In IEEE, editor, FOCS, pages 126–136. IEEE Computer Society, 1985. 18. Chris-Andre Leimeister and Burkhard Morgenstern. Kmacs: the k -mismatch av- erage common substring approach to alignment-free sequence comparison. Bioin- formatics, 30(14):2000–2008, 2014. 19. Kung-Hao Liang. Bioinformatics for Biomedical Science and Clinical Applications. Woodhead Publishing Series in Biomedicine. Woodhead Publishing, 2013. 20. Udi Manber and Eugene W. Myers. Suffix arrays: A new method for on-line string searches. SIAM J. Comput., 22(5):935–948, 1993. 21. Giovanni Manzini. Longest common prefix with mismatches. In SPIRE, volume 9309 of LNCS, pages 299–310. Springer, 2015. 22. Ge Nong, Sen Zhang, and Wai Hong Chan. Linear suffix array construction by almost pure induced-sorting. In DCC, IEEE, pages 193–202, 2009. 23. Kim R. Rasmussen, Jens Stoye, and Eugene W. Myers. Efficient q-gram filters for finding all epsilon-matches over a given length. Journal of Computational Biology, 13(2):296–308, 2006. 24. Arian FA Smit. Interspersed repeats and other mementos of transposable elements in mammalian genomes. Current Opinion in Genetics & Development, 9(6):657– 663, 1999. 25. Sharma V. Thankachan, Alberto Apostolico, and Srinivas Aluru. A provably effi- cient algorithm for the k -mismatch average common substring problem. Journal of Computational Biology, 23(6):472–482, 2016. 26. Sharma V. Thankachan, Sriram P. Chockalingam, Yongchao Liu, Alberto Apos- tolico, and Srinivas Aluru. ALFRED: A practical method for alignment-free dis- tance computation. Journal of Computational Biology, 23(6):452–460, 2016. 27. Igor Ulitsky, David Burstein, Tamir Tuller, and Benny Chor. The average common substring approach to phylogenomic reconstruction. Journal of Computational Biology, 13(2):336–350, 2006. 28. Niko Välimäki, Susana Ladra, and Veli Mäkinen. Approximate all-pairs suffix/pre- fix overlaps. Inf. Comput., 213:49–58, 2012. 29. Dan E. Willard. Log-logarithmic worst-case range queries are possible in space theta(n). Inf. Process. Lett., 17(2):81–84, 1983. 12
1402.3488
2
1402
2015-09-17T14:17:51
A Unifying Model for Representing Time-Varying Graphs
[ "cs.DS", "cs.DM", "cs.SI" ]
Graph-based models form a fundamental aspect of data representation in Data Sciences and play a key role in modeling complex networked systems. In particular, recently there is an ever-increasing interest in modeling dynamic complex networks, i.e. networks in which the topological structure (nodes and edges) may vary over time. In this context, we propose a novel model for representing finite discrete Time-Varying Graphs (TVGs), which are typically used to model dynamic complex networked systems. We analyze the data structures built from our proposed model and demonstrate that, for most practical cases, the asymptotic memory complexity of our model is in the order of the cardinality of the set of edges. Further, we show that our proposal is an unifying model that can represent several previous (classes of) models for dynamic networks found in the recent literature, which in general are unable to represent each other. In contrast to previous models, our proposal is also able to intrinsically model cyclic (i.e. periodic) behavior in dynamic networks. These representation capabilities attest the expressive power of our proposed unifying model for TVGs. We thus believe our unifying model for TVGs is a step forward in the theoretical foundations for data analysis of complex networked systems.
cs.DS
cs
A Unifying Model for Representing Time-Varying Graphs Klaus Wehmuth National Laboratory for Scientific Computing (LNCC) Av. Get´ulio Vargas, 333 25651-075 – Petr´opolis, RJ – Brazil [email protected] Eric Fleury ENS de Lyon / INRIA – Universit´e de Lyon UMR CNRS – ENS Lyon – UCB Lyon 1 – INRIA 5668 46, all´ee d’Italie 69364 – Lyon Cedex 07, France [email protected] National Laboratory for Scientific Computing (LNCC) Artur Ziviani Av. Get´ulio Vargas, 333 25651-075 – Petr´opolis, RJ – Brazil [email protected] Abstract Graph-based models form a fundamental aspect of data representation in Data Sciences and play a key role in modeling complex networked sys- tems. In particular, recently there is an ever-increasing interest in modeling dynamic complex networks, i.e. networks in which the topological structure (nodes and edges) may vary over time. In this context, we propose a novel model for representing finite discrete Time-Varying Graphs (TVGs), which are typically used to model dynamic complex networked systems. We ana- lyze the data structures built from our proposed model and demonstrate that, 1 for most practical cases, the asymptotic memory complexity of our model is in the order of the cardinality of the set of edges. Further, we show that our proposal is an unifying model that can represent several previous (classes of) models for dynamic networks found in the recent literature, which in general are unable to represent each other. In contrast to previous models, our proposal is also able to intrinsically model cyclic (i.e. periodic) behavior in dynamic networks. These representation capabilities attest the expressive power of our proposed unifying model for TVGs. We thus believe our uni- fying model for TVGs is a step forward in the theoretical foundations for data analysis of complex networked systems. 1 Introduction Data representation is a fundamental aspect in the field of Data Science [1, 2, 3]. In this context, graph models for representing complex networked systems find broad applicability in several different areas, ranging from techno-social systems [4] to computational systems biology [5]. In a typical graph model, nodes denote objects of the domain of interest (e.g., individuals or genes), and edges express interactions between these objects. Characteristics of objects and their interactions can be represented as node and edge properties, in a similar way to the attributes of relations. Indeed, advanced graph analytics is at the core of the new field of Network Science [6, 7, 8]. Much of the utility of the graph abstraction, however, actually resides in the fact that it can represent relations between a set of objects as well as their connectivity properties, which derive from the notion of paths in a straightforward way without the need of further assumptions that are not explicit in the graph abstraction itself. Based upon graph representations, there is a lot of studies focused on investigating dynamic processes, such as random walks or information diffusion, over complex networks represented by graphs [9, 10, 11, 12]. More recently, there is an ever-increasing interest in investigating not only the process dynamics on networks, but also the dynamics of networks, i.e. when the network structure (nodes and edges) may vary over time [13, 14, 15, 16]. Indeed, Braha and Bar-Yam [17] indicate that new insights can be obtained from the dynamical behavior, including a dramatic time dependence of the role of nodes that is not apparent from static (time aggregated) analysis of node connectivity and network topology. Analyzing the dynamics of networks, however, brings a difficulty since the original graph abstraction was not created considering time 2 relations between nodes. As a consequence, the need to extend the basic graph abstraction to include time relations between nodes arose, leading to many models for representing Time-Varying Graphs (TVGs), also known in the literature as temporal or time-dependent networks [18, 20, 19, 21, 22, 23, 24, 25, 26]. Although recent TVG models appear extending the basic graph concept to in- clude time relations (Section 4 discusses related work), they are nonetheless not general enough to satisfy the needs of different complex networked systems and also in many cases rely on assumptions that are not explicitly expressed in the model. For instance, in models based on snapshots (i.e., a series of static graphs), as those in [20, 19], it is implicitly assumed that a node in a given snapshot is connected to ‘itself’ in the next snapshot, making it possible to extend the transi- tivity of edges over time. This assumption, however, is not made explicit in the snapshot model. Therefore, when analyzed without this implicit assumption, a snapshot model is a sequence of disconnected graphs and therefore no connectiv- ity is possible between different time instants. The need to handle this assumption, which is not explicitly part of the model, brings difficulties since the structure of the model by itself is no longer sufficient to properly represent its behavior, mak- ing the semantics, applicability, interpretation, and analysis of such models more complex. In this paper, we propose a new unifying model for representing finite dis- crete TVGs. Our proposed model is sufficiently general to capture the needs of distinct dynamic networks [20, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31], whereas not requiring any further assumption that is not already explicitly con- tained in the model itself. Further, our model aims at preserving the strictly dis- crete nature of the basic graph abstraction, while also allowing to properly rep- resent time relations between nodes. The model we propose is based upon our recent work [32, 33], which shows that structures such as multilayer and time- varying networks are in fact isomorphic to directed static graphs. Our proposal in this paper, however, is specifically tailored for use with TVGs. Furthermore, we also demonstrate the unifying properties of our proposed model for represent- ing TVGs by describing how it represents several previous (classes of) models for dynamic networks found in the recent literature, which in general are unable to represent each other. In contrast to previous TVG models, our proposal is able to intrinsically model cyclic (i.e. periodic) behavior in complex dynamic networks. These representation features attest the expressive power of our proposed unify- ing model for TVGs. Finally, we also demonstrate that, for most practical cases, the asymptotic memory complexity of our TVG model is determined by the car- dinality of the set of edges in the model. We thus believe our unifying model for 3 TVGs is a step forward in the theoretical foundations for data analysis of complex networked systems.1 This paper proceeds as follows. Section 2 introduces our proposed unifying model for representing TVGs and its main properties. Section 3 discusses data structures to properly represent TVGs using our model. In Section 4, we show how our unifying model can be used to represent previous models for dynamic networks while these models in general are unable to represent each other. Finally, we conclude in Section 5. 2 Proposed model for representing TVGs The TVG model we introduce in this paper is a particular case of a MultiAspect Graph (MAG) [32], in which the vertices and time instants are the key features (i.e., aspects) to be represented by the model. A MAG is a structure capable of representing multilayer and time-varying networks, while also having the property of being isomorphic to a directed graph. The MAG structural form is similar to the multilayer structure recently presented by [35], since in both cases the proposed structure has a construction similar to an even uniform hypergraph associated with an adjacency concept similar to the one of simple directed graphs. Formally, a MAG can be defined as an object H “ pA,Eq, where E is a set of edges and A is a finite list of sets, each of which is called an aspect. In our case, for modeling a TVG, we have two aspects, namely vertices and time instants, A “ 2. For the sake of simplicity, this 2-aspect MAG can be regarded as i.e. representing a TVG with an object H “ pV,E,Tq, where V is the set of nodes, T is the set of time instants, and E Ď V T V T is the set of edges. As a matter of notation, we denote VpHq as the set of all nodes in H, EpHq the set of all edges in H, and TpHq the set of all time instants in H. An edge e P EpHq is defined as an ordered quadruple e “ pu,ta,v,tbq, where u,v P VpHq are the origin and destination nodes, respectively, while ta,tb P TpHq are the origin and destination time instants, respectively. Therefore, e“pu,ta,v,tbq should be understood as a directed edge from node u at time ta to node v at time tb. If one needs to represent an undirected edge in the TVG, both pu,ta,v,tbq and pv,tb,u,taq should be in EpHq. We also define four canonical projections, each projection mapping a dynamic edge into each one of its components: 1A preliminary version of this paper appears as a technical report [34]. 4 π1 : EpHq Ñ VpHq pu,ta,v,tbq ÞÑ u, π2 : EpHq Ñ TpHq pu,ta,v,tbq ÞÑ ta, π3 : EpHq Ñ VpHq pu,ta,v,tbq ÞÑ v, π4 : EpHq Ñ TpHq pu,ta,v,tbq ÞÑ tb. An edge e “ pu,ta,v,tbq in our model may be classified into four classes de- pending on its temporal characteristic: 1. Spatial edges connect two nodes at the same time instant, e is in the form of e “ pu,ta,v,taq, where u ‰ v; 2. Temporal edges connect the same node at two distinct time instants, e is in the form of e “ pu,ta,u,tbq, where ta ‰ tb; 3. Mixed edges connect distinct nodes at distinct time instants, e is in the form of e “ pu,ta,v,tbq, where u ‰ v and ta ‰ tb; 4. Spatial-temporal self-loop edges connect the same node at the same time instant, e is in the form of e “ pu,ta,u,taq. The definition of a TVG H is as general as possible and does not impose any order on the time set TpHq. One may, however, stick to the classical time notion and impose a total order on TpHq. In this context, where TpHq has a linear order, both mixed or temporal dynamic edges e “ pu,ta,v,tbq can also be classified as progressive or regressive depending on the order of their temporal components. Dynamic edges that are originated at an earlier time instant and destined to a later time instant are progressive (ta ă tb), whereas dynamic edges originated at a later time instant and destined to an earlier time instant are regressive (ta ą tb). 5 Regressive edges are particularly useful for creating cyclic TVGs, which in turn can be applied to model networks with a cyclic periodic behavior. Further, we define a temporal node as an ordered pair pu,taq, where u P VpHq and ta P TpHq. The set V TpHq of all temporal nodes in a TVG H is given by the cartesian product of the set of nodes and the set of time instants, i.e. V TpHq “ VpHq TpHq. As a notation note, a temporal node is represented by the ordered pair that defines it, e.g. pu,taq. The usage of the object H “ pV,E,Tq to represent a TVG is formally de- scribed in the technical report [34]. Therein, the representation of the TVG based on temporal nodes is proven to be isomorphic to a directed static graph. This is an important theoretical result since this allows the use of the isomorphic directed graph as a tool to analyze both the properties of a TVG and the behavior of dy- namic processes over a TVG, as done is this work. This model is then shown to unify the representation of several previous (classes of) models for TVGs of the recent literature, which in general are unable to represent each other, as we show in further detail in Section 4. 3 Algebraic representations and structures In this section, we discuss ways to properly represent a TVG using our proposed model. Similarly to static graphs, a TVG can be fully represented by an algebraic structure, like the MAG structure from which our TVG model is derived [33]. We thus first present a TVG algebraic representation based on the adjacency tensor in Section 3.1. In this work, we adopt matrix-based representations, in particular the adjacency matrix (Section 3.2). We also present the TVG incidence matrix In order to illustrate such representations, we use the TVG W in Section 3.3. presented in Figure 1, where spatial edges are represented by solid arrows and temporal edges by dashed arrows. Finally, in Section 3.4, we analyze the memory complexity for storing a TVG using our model. 3.1 TVG adjacency tensor The TVG adjacency tensor follows from the adjacency matrix widely used to rep- resent static graphs. However, since the dynamic edges used in the TVG are ordered quadruples, this representation has as a consequence to be done by means of a 4th order tensor. 6 Figure 1: TVG W : Example for the algebraic representation. We then define the adjacency tensor of a TVG H as a 4th order tensor ApHq with dimension VpHqTpHqVpHqTpHq that has an entry for every possible dynamic edge in H. Each dynamic edge present in the TVG H is repre- sented by a non-zero entry in the adjacency tensor ApHq, while all other entries have a zero value. The non-zero entries represent the weight of the corresponding dynamic edge in the represented TVG. In the case of a unweighted TVG, the non- zero entries corresponding to the dynamic edges present in the TVG have value 1. The notation ApHqu,ta v,tb is used to identify the entry corresponding to the dynamic edge pu,ta,v,tbq of the TVG H. As an example, the adjacency tensor of the TVG W depicted in Figure 1 has dimension 4 3 4 3, having a total of 144 entries. For instance, the pair of dynamic spatial edges connecting node 0 at time t0 to node 3 at time t0 is represented by the entries ApWq0,t0 , where both carry value 1 as the 3,t0 TVG W is unweighted. Note that, even though the TVG adjacency tensor ApHq has dimension VpHtq TpHtq VpHtq TpHtq, only the entries corresponding to dynamic edges present in the TVG H have non-zero values. and ApWq3,t0 0,t0 3.2 TVG adjacency matrix Since every MAG has a directed static graph that is isomorphic to it [32], the same holds for our TVG model, since it is a particular specialized case of a MAG. Consequently, it follows that the TVG can be represented by an adjacency matrix. In the more general environment represented by a MAG, a companion tuple 7 000111222333t0t1t2 is used in order to properly identify and position each temporal node of the iso- morphic graph in the adjacency matrix. Since the case we present in this work is restricted to MAGs with 2 aspects, it follows that the companion tuple is reduced to a pair, which in the first entry has the number of nodes and the second entry has the number of time instants. For instance, considering the TVG example of Figure 1, the companion tuple associated with its adjacency matrix is p4,3q, since there are 4 nodes and 3 time instants. The function of the companion tuple is only to ensure that the order by which the temporal nodes are placed in the adjacency matrix is the one shown in Figure 2. Since in the case where the number of as- pects is restricted to 2 this placement can be easily achieved, in this work we do not further mention the companion tuple. To get the TVG adjacency matrix, we only need to consider that each temporal node pu,taq can be thought of as a node in a static graph. This static graph has VT nodes and, as a consequence, its adjacency matrix has VTV T “ V2 T2 entries. Since the non-zero entries of this matrix correspond to the dynamic edges of the TVG, further analysis show that this matrix is usually sparse and can therefore be stored in an efficient way. Figure 2: The matrix form of the adjacency tensor of TVG W . Figure 2 shows the matrix representation obtained for the illustrative TVG W 8 shown in Figure 1. From Figure 2, we highlight that the matrix form of the TVG adjacency tensor has interesting structural properties. First, each one of the four nodes (identified as 0, 1, 2, and 3) of the TVG W clearly appears as a separate entity in each of the three time instants (t0, t1, and t2) that compose the TVG W . Second, the main block diagonal (lightly shaded) contains the entries correspond- ing to the spatial edges at each time instant. In these three blocks the entries corresponding to the spatial edges of the TVG carry value 1. Third, the unshaded entries at the off-diagonal blocks correspond to the temporal edges. The eight progressive temporal edges present at the TVG W are indicated by the value 1 on the first superior diagonal. Finally, the dark shaded entries are the ones that correspond to the mixed edges. Since no mixed edges are present in the example TVG W , all these entries contain value 0. Further, we remark that the entries cor- responding to progressive (mixed and temporal) edges are above the main block diagonal, whereas the edges corresponding to regressive edges appear below the main block diagonal. All these structural properties derive from the order adopted for representing the nodes and time instants present in the TVG and can be readily verified in the matrix form in a quite convenient way. Note that the procedure used to obtain the matrix form of the adjacency ten- sor is the well-known matricization or unfolding of a tensor [36]. In fact, since each entry of the matrix corresponds to an entry in the tensor, the process can be reversed, obtaining the corresponding tensor from its matrix form. 3.3 TVG incidence matrix The incidence matrix of a TVG is the incidence matrix corresponding to the di- rected static graph obtained though the temporal node representation presented in more detail in [34]. For instance, considering the TVG W shown in Figure 1, there is a temporal edge connecting node 0 at time t0 to node 0 at time t1. Without loss of generality, we can label this edge as e0 and assign it the coordinate 0 for the edge dimension of the incidence tensor. As a consequence, this edge is represented 0,0 “ 1. Taking the temporal in the incidence tensor by setting C0 edge connecting node 0 at time t1 to node 0 at time t2 and labeling it as e1, its 0,1 “ 1. By repeating representation on the incidence tensor is C1 this procedure for each edge in the TVG, the corresponding incidence tensor is created. Since the TVG W has 16 edges, being 8 temporal edges and 8 spatial edges, 4 nodes, and 3 time instants, the corresponding incidence tensor has a total of 4 16 3 “ 192 entries, from which 160 carry value 0, 16 carry value ´1, and 16 value 1. Note that the resulting matrix has 12 rows (for 3 times and 4 nodes) 0,0 “ ´1 and C1 0,1 “ ´1 and C2 9 and 16 columns, one for each edge in the TVG, totalizing 12 16 “ 192 entries. Figure 3 shows the matrix representation of the incidence tensor correspond- ing to the TVG W shown in Figure 1. In this representation, the eight temporal edges present in the TVG are labeled as edges e0 to e7 and the 8 spatial edges as edges e8 to e15. Considering this labeling, it is straightforward to verify the correspondence of the incidence tensor in matrix form to the TVG. Figure 3: The matrix form of the incidence tensor of TVG W . 3.4 Memory complexity for storing a TVG In this subsection, we analyze the memory complexity for storing a TVG. This analysis is valid for the TVG representations based on adjacency and incidence as well as their corresponding algebraic structures, which have all been discussed in Sections 3.1 to 3.3. In the general case, TVGs may have disconnected nodes or unused time in- stants. A disconnected node is defined as a node that has no dynamic edge inci- dent to it, i.e. a node with no connection at any time instant. In a similar way, an unused time instant in a TVG is defined as a time instant at which there is no dynamic edge originated from or destined to it. In most practical cases, however, a TVG is expected to have none or very few disconnected nodes as well as a un- used time instants as compared with the total number of nodes or time instants, respectively. We show that when a TVG has no disconnected nodes and unused time in- stants, or if the number of disconnected nodes and unused time instants is sig- nificantly lower than the number of dynamic edges, then the amount of storage 10 needed to represent a TVG is determined by the number of dynamic edges in the TVG. In other words, we show in this section that in most practical cases the memory complexity MCpHq for storing a given TVG H is MCpHq “ ΘpEpHqq, where EpHq is the set of dynamic edges in the TVG H. The first step to achieve this is to show that the set of connected nodes and the set of used time instants of a TVG can be recovered from the set of dynamic edges. Lemma 1 shows this by using the dynamic edge definition and the canoni- cal projections defined in Section 2. Lemma 1. In any given TVG H, the set of connected nodes and the set of used time instants can be recovered from the set EpHq that contains the dynamic edges of H. Proof. Let VCpHq be the set of connected nodes on TVG H. We now show that VCpHq can be constructed from the set EpHq. Since VCpHq contains only con- nected nodes, for every u P VCpHq there is at least one dynamic edge incident to u. Let eu P EpHq be a dynamic edge incident to node u. Then, either eu is of the form pu,,,q or of the form p,,u,q, and therefore, either u “ π1peuq or u “ π3peuq. Therefore, we can write VCpHq as VCpHq “ tπ1peq,π3pequ . ď ePEpHq We now use a similar reasoning to recover the set of used time instants from the set EpHq. Let TUpHq be the set of used time instants in H and let tu be a used time instant. Then, there is at least one dynamic edge eu P EpHq of the form p,tu,,q or p,,,tuq such that tu “ π2peuq or tu “ π4peuq. Hence, we can write TUpHq as ď TUpHq “ tπ2peq,π4pequ . ePEpHq Since Lemma 1 shows that the both sets of connected nodes and used time instants in a given TVG H can be recovered from the set of dynamic edges EpHq, we can conclude that such information is redundant and does not need to be stored to represent a TVG. Therefore, to represent any given TVG H, it suffices to store the set of dynamic edges EpHq as well as the sets of disconnected nodes and unused time instants of the TVG. 11 We now demonstrate in Theorem 1 that when the sets of disconnected nodes and unused time instants of a TVG are significantly smaller than the set of dy- namic edges, which is actually expected in most practical cases, then the asymp- totic memory complexity of the TVG representation is determined by the cardi- nality of the set of dynamic edges. Theorem 1. If the set of disconnected nodes and the set of unused time instants are smaller than the set of dynamic edges, then the memory complexity MCpHq for storing a given TVG H is determined by the size of the set of dynamic edges, i.e. MCpHq “ ΘpEpHqq. Proof. Let H be an arbitrary TVG, EpHq its set of dynamic edges, VCpHq its set of connected nodes, VNpHq its set of disconnected nodes, TUpHq its set of used time instants, TNpHq its set of unused time instants, and MCpHq the memory complexity for storing the TVG H. Note that VpHq“ VCpHqYVNpHq and TpHq“ TUpHqY TNpHq, whereas VCpHqXVNpHq “ H and TUpHqX TNpHq “ H. Since Lemma 1 shows that VCpHq and TUpHq can be recovered from EpHq, it follows that to store a representation of H in memory, it suffices to store EpHq, VNpHq, and TNpHq. We now analyze the asymptotic bounds for the memory complexity for storing these sets, together with the assumption that VNpHq` TNpHq ă EpHq. • Lower bound for MCpHq: Since for storing the set EpHq it is necessary at least to store an ordered quadruple for each dynamic edge e P EpHq, the memory needed is c1 EpHq, where c1 is an integer constant. To store the set VNpHq it is necessary to store all nodes u P VNpHq and therefore the memory needed is c2 VNpHq, while to store the set TNpHq it is nec- essary to store all time instants u P TNpHq, leading to a memory need of c3 TNpHq. Therefore, the total memory need is at least c1 EpHq` c2VNpHq`c3TNpHq, and MCpHq “ ΩpEpHq`VNpHq`TNpHqq. Finally, from our assumption that VNpHq`TNpHqăEpHq, we conclude that MCpHq “ ΩpEpHq). • Upper bound for MCpHq: On the upper bound analysis, we see that the information to be stored is at most the same three sets EpHq, VNpHq, and TNpHq, which had to be stored in the lower bound analysis. Therefore, we conclude that MCpHq “ OpEpHq). Since MCpHq “ ΩpEpHqq and also MCpHq “ OpEpHqq, we finally conclude that MCpHq “ ΘpEpHqq, if VNpHq`TNpHq ă EpHq. 12 Corollary 1. The complete expression of the memory complexity for a given TVG H is MCpHq “ ΘpVNpHq`TNpHq`EpHqq. Proof. It follows from the proof of Theorem 1 that the formal and complete ex- pression of the lower bound memory complexity for storing a given TVG H is MCpHq “ ΩpVNpHq`TNpHq`EpHqq, where VNpHq its set of disconnected nodes, TNpHq its set of unused time instants, and EpHq the set of dynamic edges, while the upper bound is MCpHq “ ΩpVNpHq`TNpHq`EpHqq. We therefore conclude that complete form of the memory complexity is MCpHq “ ΘpVNpHq` TNpHq`EpHqq. Since in most practical cases the amount of disconnected nodes and unused time instants is significantly smaller than the number of dynamic edges (i.e., VNpHq`TNpHq ! EpHq), we can conclude that the expected amount of mem- ory needed to store a representation of a given TVG H is determined by the size of the set of dynamic edges EpHq, i.e. MCpHq “ ΘpEpHqq as states Theorem 1. Furthermore, any given TVG H for most practical applications can typically be expected to be sparse, i.e. the number of dynamic edges is significantly smaller than the squared number of temporal nodes (EpHq ! V TpHq2), thus allowing its storage in a compact form, similar to the compressed forms used for sparse matrices [37]. 4 A unifying TVG model In this section, we show that the TVG model we propose can be used to represent many previous models found in the literature. Further, these models are not always capable of representing each other and none of them has the same representation range of the unifying model we propose. In order to assert that all the considered models can be directly represented by our model, we show that each of these models is in fact a subset of what is representable in our model and can therefore be easily represented in our model, maintaining any previously obtained result as at least valid on a special case. To achieve this, we show that each of the studied models can be represented in our TVG model by using only a subset of the types of dynamic edges available on our model (see Section 2). We achieve this by presenting the general structure of the matrix form of the adjacency tensor of the TVG that represents the model under study. We establish a set of four nodes V “ t0,1,2,3u and a set of three time instants T “ tt0,t1,t2u to be used to illustrate all of the following analyses. This is 13 done without loss of generality, since the same procedure could be applied to any set of nodes and time instants present in a TVG. To show the representation in our model of the different TVG models found in the literature, we group them into classes that can be represented in our unifying model in similar ways and analyze these classes in the remaining of this section. 4.1 Models based on snapshots Some snapshot models for TVGs adopt an aggregate graph and a sequence of successive state sub-graphs that represent the network in a discrete way as time passes. Some examples are the models proposed by Ferreira [19] and Xuan et al. [20]. We also consider in this same class of snapshot models the models proposed by Holme [21] and Holme and Saramaki [26], where edges are represented as triples of the form pi, j,tq meaning the existence of a contact between nodes i and j at time t. Still under this same class, we also consider the models proposed by Tang et al. [23, 38, 39], as well as all other models in which the TVG is proposed as a sequence of static graphs (i.e., the snapshots), each of them representing the TVG at a given time instant. Snapshot models are widely used in the literature and in general give an in- tuitive and straightforward notion of TVGs. Nevertheless, the snapshot models also demand some assumptions to be made without having them explicitly con- structed in the model. For instance, it is usually assumed in such snapshot models that the nodes have a sort of memory that allows the transitivity induced by the edges to propagate on each node over time. This means that a path can be con- structed passing through a given node even if this node is disconnected from all others during a period of time, meaning that the node is capable of retaining the edge transitivity during the period of disconnection. Even though this behavior is straightforward and intuitively expected in many cases, it is not constructed within the model and has to be assumed as an additional (external) property of the model, resulting that this assumption has also to be incorporated into the algorithms used with those model and thus making these algorithms dependent of these external assumptions. From the analysis of the snapshot models, we remark that clearly they only use edges connecting nodes in the same given time instant. This is consistent with the concept of spatial dynamic edges proposed in our model. In this way, all the TVGs constructed in this class of snapshot models can be represented in our model by using only spatial dynamic edges, given that all the necessary nodes and time instants are present in our model. Thus, a TVG with four nodes and 14 three time instants in this class of snapshot model would be represented in our model by a TVG whose adjacency tensor in matrix form is as the one presented in Figure 4. The entries containing “*” may have non-zero values, indicating the potential presence of a spatial edges. Note that all the entries of this kind are located in the main block diagonal of the adjacency tensor in matrix form, which actually corresponds to the snapshots. Figure 4: Snapshot models represented by our unifying TVG model. In our general representation, we allow spatial and temporal self-loops (i.e. dynamic edges connecting a node to itself at the same time instant). This kind of edge is represented on the main diagonal of the matrix, just as it would be on an adjacency matrix of a static graph. Any TVG of the snapshot class can be represented in this straightforward way in our proposed unifying model. Actually, snapshot models are in fact a sub- space of the representable TVGs in our model, making clear that this whole class of snapshot models is rather a subset of the representable TVGs in our model. Further, in snapshot models, each snapshot is formally disconnected from each other (although arguably implicitly connected), since the temporal connections are not explicitly constructed in the snapshot models. The number of dynamic edges used to represent a TVG of this kind is the 15 same as the number of edges present in the original snapshot-based representation. Therefore, the memory complexity for storing TVGs in our model is the same found on the original snapshot-based representation, which is compatible with the memory complexity discussed in Section 3.4. 4.2 Models based on continuous time intervals (CTI) The class discussed in this subsection includes models that use a presence function defined over continuous time intervals (i.e. t P R`), such as the continuous time version of TVG proposed by Casteigts et al. [24]. We further assume that the presence function used in such models is constructed in such a way that every time interval (or their union) has a non-zero and finite measure. Although this assumption is not explicitly stated in the original paper, it is consistent with all examples and the reasoning present therein. It is also important to remind that the model we construct is a discrete version of the continuous time interval model that nonetheless retains all information present on the original model based on continuous time intervals. In order to represent TVGs based on continuous time intervals in our unifying model, some representations are possible depending on the target application of the model that defines the semantics associated with an edge in the TVG. An example with three possible representations is presented in Figure 5 and each of the these three representations is explained in the following. If the semantic of a time interval pta,tbs associated with an edge e between two nodes u and v is that the edge exists from the beginning of the interval (i.e. from time ta) until the end of the interval (i.e. until time tb), it is possible to represent the existence of such an edge by using a mixed dynamic edge. This is consistent with the original semantics, where the edge e exists in the interval delimited by the mixed edge (i.e. from ta until tb). A concrete example of this first representation is shown comparing Figures 5(a) and 5(b). The edge between nodes 0 and 1 present at the time interval p1,15s shown in Figure 5(a) is represented by the mixed dynamic edge p0,t1,1,t15q in Figure 5(b). Similarly, the edge between nodes 1 and 2 at the time interval p5,7s is represented by the mixed dynamic edge p1,t5,2,t7q. In the case an edge is present at different time intervals, we represent this edge by having one mixed edge for each time interval. Further, if the edge between nodes u and v is bidirectional, this edge is represented at each time interval by the pair of edges pu,ta,v,tbq and pv,ta,u,tbq. Note that once the edges present in the TVG are defined for all time intervals, it is possible to construct the set T 16 (a) TVG model based on con- tinuous time intervals (b) First representation: Use of mixed edges (c) Second representation: Snapshots (d) Third representation: Use of temporal and spatial edges Figure 5: Converting continuous time intervals into a discrete TVG. of time instants based on the dynamic edges present in the set E. From this, we conclude that the TVGs in this class modeled by continuous time intervals can be represented in our model using only progressive mixed dynamic edges. Figure 6 shows the possible non-zero entries for a TVG with four nodes and three time instants based on the model of continuous time intervals using the first representation we are describing. Clearly from Figure 6, this kind of TVG is a subspace (and therefore a subset) of the TVGs representable by our proposed unifying model. Thus, we conclude that TVGs of this class are particular cases of the TVGs representable in our model. Even though this first representation by our model carries all information present in the original TVG based on continuous time intervals, it still relies on an assumption that is not explicitly present in this first representation. Namely, this assumption concerns that the time instants present on each mixed dynamic edge represent the time intervals on which the edge exists. Note that the same happens in the original model based on continuous time intervals. For example, using this assumption, a path between nodes 0 and 2 exists at any given time in- 17 012(1,15](5,7]01t1t5t70101222t1501201t1t5t70101222t1501201t1t5t70101222t15012 Figure 6: The first representation of TVGs based on continuous time intervals. stant during the interval between t5 and t7. To understand that this assumption is made in a manner that does not directly follows as a property of the structure of the TVG, notice that it makes the transitivity of the relation implied by an edge more difficult and cumbersome to determine. This happens because an external processing is needed to verify the presence of the edge (either by the time intervals indicated on the mixed dynamic edge or by the set of intervals on the continuous time model) in order to be able to establish its transitivity to another edge. To es- tablish the existence of a path connecting two nodes, it is necessary to compute the intersections of the time intervals on which each edge exists. The resulting path then exists on the time interval obtained by this intersection. Therefore, the exis- tence of a path connecting nodes in this kind of representation can be non-intuitive and computationally expensive to determine, thus impacting considerations about connectivity, reachability, communicability, and any other property derived from the transitivity of edges in a TVG. A second representation (Figure 5(c)) comes from the realization that the con- tinuous time intervals model is in fact a continuos form of the snapshot model, in which edges are present at infinite (uncountable) time instants. Therefore, a natu- ral way to represent the CTI model in a discrete form is to have the time instants 18 set T formed by the beginning and end instants of each interval present on the CTI model, and then placing the corresponding edge at each time instant for which an edge is present in the CTI model. The result of this is a snapshot representation of the CTI model, as shown in Figure 5(c), where the edge between nodes 0 and 1 is present at instants t0,t5,t7, and t15, while the edge between nodes 1 and 2 is present at instants t5 and t7. This representation has the same characteristics we highlighted for the snapshot class of models. Although the TVG connectivity can be readily determined at each time instant, the snapshots (i.e. time instants) are formally disconnected from each other. Hence, if any sort of connectivity between time instants is to be considered, it has to be stated as an additional assumption, which is not directly encoded in the representation. A third representation (Figure 5(d)) can be derived from the second one (snap- shots), by formally placing temporal dynamic edges where the connectivity be- tween successive time instants is desired. In our example, this leads to the repre- sentation shown in Figure 5(d), where temporal nodes are used to connect nodes 0 and 1 between time instants t0,t5,t7, and t15 and to connect nodes 1 and 2 from time instant t5 to t7. This reflects the fact that in the original CTI model the edge p0,1q was present at the interval pt0,t15s, while the edge p1,2q was present at the interval pt5,t7s. Figure 7 shows the possible non-zero entries on the matrix form of the adjacency tensor of a TVG of this class using this third representation. Figure 7: The third representation of TVGs based on continuous time intervals. 19 In order to determine the memory complexity of representing a TVG based on continuous time intervals in our proposed unifying model, we state the following proposition, based on the third representation, presented in Figure 5(d), which uses the largest number of dynamic edges: Proposition 1. A TVG based on continuous time intervals with n nodes, m edges, and η continuous time intervals defining these edges can be represented in our model with Opη2q dynamic edges. Proof. For each time interval in the continuous time representation, a mixed dy- namic edge is created on our model. Since each mixed edge requires two time instants to be defined, it follows that the representation in our model requires at most 2η time instants. Therefore, in our model we have T “ 2η in the worst case. To decompose a mixed dynamic edge into spatial and temporal dynamic edges, at most T spatial dynamic edges are needed to connect the two nodes on the mixed edge in all possible time instants. Further, at most 2pT´ 1q temporal dynamic edges are needed to connect the nodes over all possible time instants. Therefore, to fully decompose a mixed edge, at most 2pT´ 1q`T “ 3T´ 2 dynamic edges are needed. Hence, as η mixed dynamic edges are needed in the representation, to fully decompose them into spatial and temporal edges, at most ηp3T´ 2q dynamic edges are needed. Expanding and substituting T “ 2η for the worst case, we have ηp3T´ 2q “ ηp6η ´ 2q “ 6η2´ 2η. We therefore conclude that the number of dynamic edges needed is Opη2q. From this, we further conclude that, for a TVG with η continuous time inter- vals, in our model we have E “ Opη2q. Therefore, the memory complexity of the representation based on continuous time instants is Opη2q, which is compati- ble with the memory complexity discussed in Section 3.4. 4.3 Models based on spatial and temporal edges (STE) Some models like the one proposed by Kostakos [22] are based on the idea that a class of links represent instantaneous iterations between distinct nodes while 20 other class represent a waiting state of a given node. These concepts are formal- ized in our proposed unifying model by spatial and temporal dynamic edges. In our model, these dynamic edges are fully formalized and can be used to make a unambiguous representation of this kind of TVG. Figure 8 depicts the entries that may be non-zero on the matrix form of the adjacency tensor of a TVG of this class having four nodes and three time instants. It is again clear that this class of TVGs can be thus represented as a subset of the TVGs that can be represented by the unifying model we propose. Figure 8: Representation of TVGs based on spatial and temporal edges. 4.4 Models based on temporal and mixed edges (TME) Some works found in the recent literature, such as the one by Kim and Ander- son [25], loosely suggest the use of edges connecting nodes at different time in- stants. TVGs of this class can be represented in our model using only temporal and mixed dynamic edges. Figure 9 shows the matrix form of the adjacency ten- sor of a TVG of this class. It can be seen that this is also a particular case of the TVGs that can be represented using our unifying model. 21 Figure 9: Representation of TVGs based on temporal and mixed edges. 4.5 Overview on the unifying representation of previous mod- els Table 1 shows a representation map that indicates if a (class of) TVG model(s) is able to represent another (class of) TVG model(s). We compare the unifying representation model we propose with the models based on (i) snapshots, (ii) con- tinuous time intervals (CTI), (iii) spatial and temporal edges (STE), and (iv) tem- poral and mixed edges (TME), which have been presented in Sections 4.1 to 4.4, respectively. Snapshot models can only represent TVGs of the continuous time intervals (CTI) class, since they are in fact a continuos time version of the snapshot model. Direct representation of other models by snapshots is not possible because the snapshot model lacks the notion of temporal edges. Models based on continuous time in- tervals (CTI) and spatial and temporal edges (STE) can represent snapshot models because they support the notion of spatial edges as well as they are mutually able to represent each other. Models based on temporal and mixed edges (TME) are able to represent models based on continuous time intervals (CTI) in a discretized way. Remark that the converse is not true, i.e. models based on CTI are unable to 22 Table 1: Representation map between TVG models: An entry is checked if the (class of) model(s) in the row is able to represent the (class of) model(s) in the column. STE TME Unifying model (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) Snapshots CTI STE TME Unifying model (cid:88) (cid:88) (cid:88) Snapshots CTI (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) represent models based on TME as they lack the notion of mixed edges. Further- more, note that models based on TME are unable to represent in all cases models with spatial edges, such as the ones based on snapshots and STE. This is because, although a mixed edge could be seen as a composition of a spatial and a temporal edge, a mixed edge is unable to represent a single spatial edge, thus preventing the representation of these cases. Overall, we remark that considering the previous classes of TVG models, none is able to represent all others. This basically happens because the kind of edges present in one model not necessarily can be transformed into the kind of edges present in another model or class of models. In contrast, we have shown along this section that all classes of previous TVG models we consider can be repre- sented in the unifying model we propose, whereas these previous TVG models not necessarily are able to represent each other, as shown in Table 1. Addition- ally, none of the previous TVG models makes use of regressive edges, which could be used in our proposal to intrinsically model cyclic (i.e. periodic) behavior in dynamic networks. Therefore, we highlight that none of the previous analyzed models have all the representation capabilities and thus the same expressive power of our proposed unifying model for TVGs. 5 Summary and outlook In this paper, we have proposed a novel model for representing finite discrete Time-Varying Graphs (TVGs). We have shown that our model is simple, yet flex- ible and efficient for the representation and modeling of dynamic networks. The proposed model preserves the discrete nature of the basic graph abstraction and has algebraic representations similar to the ones used on a regular graph. More- 23 over, we have also shown that our unifying model has enough expressive power to represent several previous (classes of) models for dynamic networks found in the recent literature, which in general are unable to represent each other, and also to intrinsically represent cyclic (i.e. periodic) behavior of dynamic networks. To further illustrate the flexibility of our model, we remark that our model can also be used to represent time schedules using a TVG. For example, in this case, the nodes can be thought of as locations and mixed edges as the amount of time taken to move between locations. Such representation can model scheduled arrivals and departures in transportation systems allowing, for instance, the evaluation whether a connection is feasible or the delivery time for logistics management. We have analyzed the proposed model proving that if the TVG nodes can be considered as independent entities at each time instant, the analyzed TVG is isomorphic to a directed static graph. This basic theoretical result has provided the ground for achieving other theoretical results that show that some properties of the analyzed TVG can be inferred from the temporal node representation of that TVG. This is an important set of theoretical results because this allows the use of the isomorphic directed graph as a tool to analyze both the properties of a TVG and the behavior of dynamic processes over a TVG. We have also demonstrated that, for most practical cases, the asymptotic memory complexity of our TVG model is determined by the cardinality of the set of edges. Further, from the basic definition of the model we proposed for representing TVGs, we have derived some basic properties such as communicability and connectivity using only properties that follow directly from the underlying structure of the model, such as the transitivity of the relation induced by the dynamic edges. As a consequence, in contrast to previous works, our model can be used without the need of external assumptions, meaning that all properties are derived from explicit properties of the TVG, in the same way that happens with static graphs. As future work, we intend to apply our proposed TVG model in the analysis of different dynamic complex networks as well as of properties over such dynamic networks. An example of such analysis is the recent work by Costa et al. [40]. In that work, authors analyze the concept of time centrality for information dif- fusion in dynamic complex networks using the TVG model we propose in this paper, thus investigating the relative importance of different time instants to start a information diffusion process. 24 Acknowledgment The cooperation among authors has been supported by STIC-AmSud. K. Wehmuth and A. Ziviani acknowledge that their work was partially funded by the Brazilian funding agencies CAPES, CNPq, and FAPERJ as well as the Brazilian Ministry of Science, Technology, and Innovation (MCTI). E. Fleury acknowledges the sup- port by MILYON. References [1] V. Dhar, “Data science and prediction,” Communication of the ACM, vol. 56, no. 12, pp. 64–73, Dec. 2013. [2] C. A. Mattmann, “Computing: A vision for data science,” Nature, vol. 493, no. 7433, pp. 473–475, Jan. 2013. [3] H. V. Jagadish, J. Gehrke, A. Labrinidis, Y. Papakonstantinou, J. M. Patel, R. Ramakrishnan, and C. Shahabi, “Big data and its technical challenges,” Communications of the ACM, vol. 57, no. 7, pp. 86–94, Jul. 2014. [4] A. Vespignani, “Predicting the behavior of techno-social systems,” Science, vol. 325, no. 5939, pp. 425–428, Jul. 2009. [5] H. Kitano, “Computational systems biology,” Nature, vol. 420, no. 6912, pp. 206–210, Nov. 2002. [6] T. G. Lewis, Network science: Theory and applications. Wiley, 2009. [7] L. Kocarev, “Network science: A new paradigm shift,” IEEE Network, vol. 24, no. 6, pp. 6–9, Nov. 2010. [8] U. Brandes, G. Robins, A. McCraine, and S. Wasserman, “What is network science?” Network Science Journal, vol. 1, no. 1, pp. 1–15, Apr. 2013. [9] R. Pastor-Satorras and A. Vespignani, “Epidemic spreading in scale-free net- works,” Physical Review Letters, vol. 86, pp. 3200–3203, Apr. 2001. [10] D. Kempe, J. Kleinberg, and E. Tardos, “Maximizing the spread of influ- ence through a social network,” in Proc. of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), pp. 137–146, Aug. 2003. 25 [11] A. Barrat, M. Barthelemy, and A. Vespignani, Dynamical Processes on Com- plex Networks. Cambridge University Press, 2008. [12] M. Iliofotou, M. Faloutsos, and M. Mitzenmacher, “Exploiting dynamicity in graph-based traffic analysis: Techniques and applications,” in Proc. of the ACM International Conference on Emerging Networking Experiments and Technologies (ACM CoNEXT), pp. 241–252, Dec. 2009. [13] N. Ganguly, A. Deutsch, and A. Mukherjee, Eds., Dynamics on and of com- plex networks. Springer, 2009. [14] D. Figueiredo, P. Nain, B. Ribeiro, E. de Souza e Silva, and D. Towsley, “Characterizing continuous time random walks on time varying graphs,” ACM SIGMETRICS Performance Evaluation Review, vol. 40, no. 1, pp. 307– 318, Jun. 2012 [15] P. Holme and J. Saramaki, Eds., Temporal Networks. Springer, 2013. [16] P. Holme, “Modern temporal network theory: arXiv:1508.01303, 33 p., Aug. 2015. A colloquium,” [17] D. Braha and Y. Bar-Yam, “From centrality to temporary fame: Dynamic centrality in complex networks,” Complexity, vol. 12, no. 2, pp. 59–63, Nov. 2006. [18] S. A. Hill and D. Braha, “Dynamic model of time-dependent complex net- works,” Physical Review E, vol. 82, no. 4, Oct. 2010. [19] A. Ferreira, “Building a reference combinatorial model for MANETs,” IEEE Network, vol. 18, no. 5, pp. 24–29, Oct. 2004. [20] B. B. Xuan, A. Ferreira, and A. Jarry, “Evolving graphs and least cost jour- neys in dynamic networks,” in Proc. of the Symposium on Modeling and Optimization in Mobile, Ad Hoc and Wireless Networks (WiOpt), Mar. 2003. [21] P. Holme, “Network reachability of real-world contact sequences,” Physical Review E, vol. 71, no. 4, pp. 1–8, Apr. 2005. [22] V. Kostakos, “Temporal graphs,” Physica A: Statistical Mechanics and its Applications, vol. 388, no. 6, pp. 1007–1023, Mar. 2009. 26 [23] J. Tang, M. Musolesi, C. Mascolo, and V. Latora, “Temporal distance metrics for social network analysis,” in Proc. of the ACM Workshop on Online Social Networks (WOSN). pp. 31–36, Aug. 2009. [24] A. Casteigts, P. Flocchini, W. Quattrociocchi, and N. Santoro, “Time-varying graphs and dynamic networks,” International Journal of Parallel, Emergent and Distributed Systems, vol. 27, no. 5, pp. 387–408, Oct. 2012. [25] H. Kim and R. Anderson, “Temporal node centrality in complex networks,” Physical Review E, vol. 85, no. 2, Feb. 2012. [26] P. Holme and J. Saramaki, “Temporal networks,” Physics Reports, vol. 519, no. 3, pp. 97–125, Oct. 2012. [27] J. I. Alvarez-Hamelin, E. Fleury, A. Vespignani, and A. Ziviani, “Complex dynamic networks: Tools and methods (guest editorial),” Computer Net- works, vol. 56, no. 3, pp. 967–969, Dec. 2012. [28] C. Sengul, A. C. Viana, and A. Ziviani, “A survey of adaptive services to cope with dynamics in wireless self-organizing networks,” ACM Computing Surveys, vol. 44, no. 4, pp. 23:1–23:35, Sep. 2012. [29] A. Guimaraes, A. B. Vieira, A. P. C. Silva, and A. Ziviani, “Fast centrality- driven diffusion in dynamic networks,” in Proc. of the Workshop on Sim- plifying Complex Networks for Practitioners (SIMPLEX), World Wide Web conference (WWW), pp. 821–828, May 2013. [30] L. Martinet, C. Crespelle, and E. Fleury, “Dynamic contact network analysis in hospital wards,” in Proc. of the Workshop on Complex Networks (Com- pleNet), pp. 241–249, Mar. 2014. [31] Q. Wang, “Link prediction and threads in email networks,” in Proc. of the International Conference on Data Science and Advanced Analytics (DSAA), pp. 470–476, Oct. 2014. [32] K. Wehmuth, E. Fleury, and A. Ziviani, “On MultiAspect Graphs,” arXiv:1408.0943, 30 p., Aug. 2014. [33] K. Wehmuth, E. Fleury, and A. Ziviani, “MultiAspect Graphs: Algebraic representation and algorithms,” arXiv:1504.07893, 61 p., Aug. 2015. 27 [34] K. Wehmuth, A. Ziviani, and E. Fleury, “A Unifying Model for Representing Time-Varying Graphs,” INRIA Technical Report no. RR-8466, 39 p., Jan. 2014. [35] M. Kivela, A. Arenas, M. Barthelemy, J. P. Gleeson, Y. Moreno, and M. A. Porter, “Multilayer networks,” Journal of Complex Networks, Jul. 2014. [36] T. G. Kolda, “Multilinear operators for higher-order decompositions,” San- dia National Laboratories, Technical Report, Apr. 2006. [37] R. Barrett, M. Berry, T. F. Chan, J. Demmel, J. M. Donato, J. Dongarra, V. Eijkhout, R. Pozo, C. Romine, and H. V. der Vorst, Templates for the solution of linear systems: Building blocks for iterative methods. SIAM, 1994. [38] J. Tang, S. Scellato, M. Musolesi, C. Mascolo, and V. Latora, “Small-world behavior in time-varying graphs,” Physical Review E, vol. 81, no. 5, pp. 81– 84, May 2010. [39] J. Tang, M. Musolesi, C. Mascolo, V. Latora, and V. Nicosia, “Analysing information flows and key mediators through temporal centrality metrics,” in Proc. of the ACM EuroSys Workshop on Social Network Systems (SNS), pp. 1–6, Apr. 2010. [40] E. C. Costa, A. B. Vieira, K. Wehmuth, A. Ziviani, and A. P. C. Silva, “Time centrality in dynamic complex networks,” arXiv:1504.00241, 12 p., Apr. 2015. 28
1903.07531
1
1903
2019-03-18T16:17:36
Counting independent sets and colorings on random regular bipartite graphs
[ "cs.DS" ]
We give a fully polynomial-time approximation scheme (FPTAS) to count the number of independent sets on almost every $\Delta$-regular bipartite graph if $\Delta\ge 53$. In the weighted case, for all sufficiently large integers $\Delta$ and weight parameters $\lambda=\tilde\Omega\left(\frac{1}{\Delta}\right)$, we also obtain an FPTAS on almost every $\Delta$-regular bipartite graph. Our technique is based on the recent work of Jenssen, Keevash and Perkins (SODA, 2019) and we also apply it to confirm an open question raised there: For all $q\ge 3$ and sufficiently large integers $\Delta=\Delta(q)$, there is an FPTAS to count the number of $q$-colorings on almost every $\Delta$-regular bipartite graph.
cs.DS
cs
COUNTING INDEPENDENT SETS AND COLORINGS ON RANDOM REGULAR BIPARTITE GRAPHS CHAO LIAO, JIABAO LIN, PINYAN LU, AND ZHENYU MAO ABSTRACT. We give a fully polynomial-time approximation scheme (FPTAS) to count the number of independent sets on almost every ∆-regular bipartite graph if ∆ ≥ 53. In the weighted case, for all ∆(cid:17), we also obtain an FPTAS on almost sufficiently large integers ∆ and weight parameters λ = eΩ(cid:16) 1 every ∆-regular bipartite graph. Our technique is based on the recent work of Jenssen, Keevash and Perkins (SODA, 2019) and we also apply it to confirm an open question raised there: For all q ≥ 3 and sufficiently large integers ∆ = ∆(q), there is an FPTAS to count the number of q-colorings on almost every ∆-regular bipartite graph. 1. INTRODUCTION Counting independent sets on bipartite graphs (#BIS) plays a significant role in the field of approximate counting. A wide range of counting problems in the study of counting CSPs [DGJ10, BDG+13, GGY17] and spin systems [GJ12, GJ15, GSVY16, CGG+16], have been proved to be #BIS- equivalent or #BIS-hard under approximation-preserving reductions (AP-reductions) [DGGJ04]. Despite its great importance, it is still unknown whether #BIS admits a fully polynomial-time approximation scheme (FPTAS) or it is as hard as counting the number of satisfying assignments of Boolean formulas (#SAT) under AP-reduction. In this paper, we consider the problem of approximating #BIS (and its weighted version) on random regular biparite graphs. Random regular bipartite graphs frequently appear in the anal- ysis of hardness of counting independent sets [MWW09, DFJ02, Sly10, SS12, GSVY16]. Therefore, understanding the complexity of #BIS on such graphs is potentially useful for gaining insights into the general case. Let Z(G, λ) = ∑I∈I (G) λI where I(G) is the set of all independent sets of a graph G and λ > 0 is the weight parameter. This function also arises in the study of the hardcore model of lattice gas systems in statistical mechanics. Hence we usually call Z(G, λ) the partition function of the hardcore model with fugacity λ. In the case where input graphs are allowed to be nonbipartite, the approximability for counting the number of independent sets (#IS) is well understood. Exploiting the correlation decay prop- erties of Z(G, λ), Weitz [Wei06] presented an FPTAS for graphs of maximum degree ∆ at fugacity λ < λc(∆) = (∆−1)∆−1 (∆−2)∆ . On the hardness side, Sly [Sly10] proved that, unless NP = RP, there is a constant ε = ε(∆) that no polynomial-time approximation scheme exists for Z(G, λ) on graphs of maximum degree ∆ at fugacity λc(∆) < λ < λc(∆) + ε(∆). Later, this result was improved at any fugacity λ > λc(∆) [SS12, GSV16]. In particular, these results state that if ∆ ≤ 5, there is an FPTAS for #IS on graphs of maximum degree ∆, otherwise there is no efficient approximation algorithm unless NP = RP. The situation is different on bipartite graphs. To the best of our knowledge, no NP-hardness result is known even on graphs with unbounded degree. Surprisingly, Liu and Lu [LL15] designed an FPTAS for #BIS which only requires one side of the vertex partition to be of maximum degree ∆ ≤ 5. On the other hand, it is #BIS-hard to approximate Z(G, λ) at fugacity λ > λc(∆) on biparite graphs of maximum degree ∆ ≥ 3 [CGG+16]. 1 Recently, Helmuth, Perkins, and Regts [HPR18] developed a new approach via the polymer model and gave efficient counting and sampling algorithms for the hardcore model at high fugac- ity on certain finite regions of the lattice Zd and on the torus (Z/nZ)d. Their approach is based on a long line of work [PS75, PS76, KP86, Bar16, BS16, PR17]. Shortly after that, Jessen, Keevash, and Perkins [JKP19] designed an FPTAS for the hardcore model at high fugacity on bipartite expander graphs of bounded degree. And they further extended the result to random ∆-regular bipartite graphs with ∆ ≥ 3 at fugacity λ > (2e)250. This is the first efficient algorithm for the hardcore model at fugacity λ > λc(∆) on random regular bipartite graphs. A natural question is, can we design FPTAS for lower fugacity and in particular the problem #BIS on random regular bipartite n,∆ denote the set of all ∆-regular bipartite graphs graphs? Indeed, we obtain such results. Let G bip with n vertices on both sides. Theorem 1. For ∆ ≥ 53 and fugacity λ ≥ 1, with high probability (tending to 1 as n → ∞) for a graph G chosen uniformly at random from G bip n,∆, there is an FPTAS for the partition function Z(G, λ). Theorem 2. For all sufficiently large integers ∆ and fugacity λ = eΩ(cid:0) 1 to 1 as n → ∞) for a graph G chosen uniformly at random from G bip function Z(G, λ). ∆(cid:1), with high probability (tending n,∆, there is an FPTAS for the partition For notational convenience, we use the term "on almost every ∆-regular bipartite graph" to denote that a property holds with high probability (tending to 1 as n → ∞) for randomly chosen graphs from G bip n,∆. Counting proper q-colorings on a graph is another extensively studied problem in the field of approximate counting [Jer95, BD97, BDGJ99, DF03, HV03, Hay03, Mol04, DFFV06, HV06, GK12, DFHV13, LY13, GLLZ18], which is also shown to be #BIS-hard but unknown to be #BIS-equivalent [DGGJ04]. In general graphs, if the number of colors q is no more than the maximum degree ∆, there may not be any proper coloring over the graph. Therefore, approximate counting is studied in the range that q ≥ ∆ + 1. It was conjectured that there is an FPTAS if q ≥ ∆ + 1, but the current 6 [Vig00, CDM+19]. The conjecture was best result is q ≥ α∆ + 1 with a constant α slightly below 11 only confirmed for the special case ∆ = 3 [LYZZ17]. On bipartite graphs, the situation is quite different. For any q ≥ 2, we know that there always exist proper q-colorings for every bipartite graph. So it is natural to wonder under which relations between q and ∆ there is an FPTAS to count the number of q-colorings on biparite graphs. Using a technique analogous to that for #BIS, we obtain an FPTAS to count the number of q-colorings on random ∆-regular bipartite graphs for all sufficiently large integers ∆ = ∆(q) for any q ≥ 3. Theorem 3. For q ≥ 3 and ∆ ≥ 100q10 where q = ⌈q/2⌉, with high probability (tending to 1 as n → ∞) for a graph chosen uniformly at random from G bip n,∆, there is an FPTAS to count the number of q-colorings. This result confirms a conjecture in [JKP19]. 1.1. Our Technique. The classical approach to designing approximate counting algorithms is ran- dom sampling via Markov chain Monte Carlo (MCMC). However, it is known that the Markov chains are slowly mixing on random bipartite graphs for both independent set and coloring if the degree ∆ is not too small. Taking #BIS as an example, a typical independent set of a random reg- ular bipartite graph of degree at least 6 is unbalanced: it either chooses most of its vertices from the left side or the right side. Thus, starting from an independent set with most vertices from the left side, a Markov chain is unlikely to reach an independent set with most of its vertices from the right side in polynomial time. Even so, a recent beautiful work exactly makes use of the above separating property to design approximately counting algorithm [JKP19]. By making the fugacity λ > (2e)250 sufficiently large, 2 they proved that most contribution of the partition function comes from extremely unbalanced independent sets, those which occupy almost no vertices on one side and almost all vertices on the other side. In particular, for a bipartite graph G = (L, R, E) with n vertices on both sides, they identified two independent sets I = L and I = R as ground states as they have the largest weight λn among all the independent sets. They proved that one only needs to sum up the weights of states which are close to one of the ground states, for no state is close to both ground states and the contribution from the states which are far away from both ground states is exponentially small. However, the ground state idea cannot be directly applied to counting independent sets and counting colorings since each valid configuration is of the same weight. We extend the idea of ground states to ground clusters, which is not a single configuration but a family of configura- tions. For example, we identify two ground clusters for independent sets, those which are entirely chosen from vertices on the left side and those which are entirely chosen entirely from vertices on the right side. If a set of vertices is entirely chosen from vertices on one side, it is obviously an independent set. Thus each cluster contains 2n different independent sets. Similarly, we want to prove that we can count the configurations which are close to one of the ground clusters and then add them up. For counting colorings, there are multiple ground clusters indexed by a subset of colors ∅ ( X ( [q]: colorings which color L only with colors from X and color R only with colors from [q] \ X. Unlike the ground states in [JKP19], our ground clusters may overlap with each other and some configurations are close to more than one ground clusters. In addition to proving that the number of configurations which are far away from all ground clusters are exponentially small, we also need to prove that the number of double counted configurations are small. After identifying ground states and with respect to a fixed ground state, Jessen, Keevash, and Perkins [JKP19] defined a polymer model representing deviations from the ground state and rewrote the original partition function as a polymer partition function. We follow this idea and define a polymer model representing deviations from a ground cluster. However, deviation from a ground cluster is much subtler than deviation from a single ground state. For example, if we de- fine polymer as connected components from the deviated vertices in the graph, we cannot recover the original partition function from the polymer partition function. We overcome this by defining polymer as connected components in graph G2, where an edge of G2 corresponds to a path of length at most 2 in the original graph. Here, a compatible set of polymers also corresponds to a family of configurations in the original problem, while it corresponds to a single configuration in [JKP19]. It is much more common in counting problems that most contribution is from a neighborhood of some clusters rather than a few isolated states. So, we believe that our development of the technique makes it suitable for a much broader family of problems. Independent work. Towards the end of this project, we learned that the authors of [JKP19] ob- tained similar results in their upcoming journal version submission. 2. PRELIMINARIES In this section, we review some basic definitions and concepts, introduce necessary notations and set up some facts and tools. 2.1. Independent sets and colorings. All graphs considered in this paper are unweighted, undi- rected, with no loops but may have multiple edges1. Let G = (V, E) be a graph. We use dG(u, w) 1There is no essential difference from keeping the graphs simple. We allow multiple edges just for writing convenience. 3 to denote the distance between two vertices u, w in the graph G. For ∅ ( U, W ⊆ V, de- fine dG(U, W) = minu∈U,w∈W dG(u, w). Let U ⊆ V be a nonempty set. We define NG(U) = {v ∈ V : dG({v} , U) = 1} to be the neighborhood of U and emphasize that NG(U) ∩ U = ∅. We use G[U] to denote the induced subgraph of G on U. Let E2 be the set of unordered pairs (u, v) such that u 6= v and dG(u, v) ≤ 2. We define G2 to be the graph (V, E2). It is clear that if the maximum degree of G is at most ∆, then the maximum degree of G2 is at most ∆2. An independent set of the graph G is a subset U ⊆ V such that (u, w) 6∈ E for any u, w ∈ U. We use I(G) to denote the set of all independent sets of G. The weight of an independent set I is λI where λ > 0 is a paramter called fugacity. We use Z(G, λ) = ∑I∈I (G) λI to denote the partition function of the graph G. Clearly, Z(G, 1) is the number of indepndent sets of G. For any positive integer i, we use [i] to denote the set {1, 2, . . . , i}. Let q ≥ 3 be an integer. Define q = ⌊q/2⌋ and q = ⌈q/2⌉. A coloring σ : V → [q] over the graph G is a mapping which assigns to each vertex of G a color from [q]. We say σ is proper if σ(u) 6= σ(v) for any edge (u, v) ∈ E. We use C(G) to denote the set of all proper colorings over G. Sometimes we need to consider the rescriction of a coloring and we use σU to denote the coloring obtained by restricting σ over a subset U ⊆ V. Whenever G = (L, R, E) is a bipartite graph and σ is coloring over G, we simply write σX instead of σX for all X ∈ {L, R}. For a number of disjoint sets S1, S2, . . . , Sk, we use ⊔k i=1Si to denote their union and stress the fact that they are disjoint. For a number of colorings σ1 : V1 → [q], σ2 : V2 → [q], . . . , σk : Vk → [q], if Vi and Vj are disjoint for any 1 ≤ i 6= j ≤ k, then i=1σi is the coloring over ⊔k ∪k For two positive real numbers a and b, we say a is an ε-relative approximation to b for some ε > 0 if exp(−ε)b ≤ a ≤ exp(ε)b, or equivalently exp(−ε)a ≤ b ≤ exp(ε)a. A fully polynomial- time approximation scheme (FPTAS) is an algorithm that for every ε > 0 outputs an ε-relative approximation to Z(G) in time (G/ε)C for some constant C > 0, where Z(G) is some quantity, i=1Vi such that its resctriction over Vi is σi for any 1 ≤ i ≤ k. like the number of independent sets, of graphs G that we would like to compute. 2.2. Random regular bipartite graphs. We follow the model of random regular bipartite graphs in [MWW09]. Let ∆ be a positive integer. We use G ∼ G bip n,∆ to denote sampling a bipartite graph G in the following way. At the beginning, the two sides of G both have exactly n vertices and there are no edges between them. In the i-th round, we sample a perfect matching Mi over the complete bipartite graph Kn,n uniformly at random and independently of previous rounds. We repeat this process for ∆ rounds and add the edges in M1, M2, . . . , M∆ to the graph G. We do not merge multiple edges in G to keep it ∆-regular. We remark that this distribution of random graphs is contiguous with a uniformly random ∆-regular simple (without multiple edges) bipar- tite graph, which implies that Lemma 4 and similar results also apply to the latter distribution. See [MRRW97] for more information. In the following, we discuss the property of random regular bipartite graphs. We say a ∆-regular bipartite graph G = (L, R, E) with n vertices on both sides is an (α, β)- expander if for all subsets U ⊆ L or U ⊆ R with U ≤ αn, N(U) ≥ βU. This property is called the expansion property of G. We use G ∆ α,β to denote the set of all ∆-regular bipartite (α, β)- expander. The following lemma states that under certain conditions almost every ∆-regular graph is an (α, β)-expander. Lemma 4 ([Bas81]). If 0 < α < 1/β < 1 and ∆ > H(α) + H(αβ) H(α) − αβH(1/β) , then lim n→∞ Pr G∼Gbip n,∆hG ∈ G ∆ α,βi = 1. 4 In addition to the expansion property, random regular graphs may also have the following property. For 0 < a, b < 1, we say a bipartite graph G = (L, R, E) with n vertices on both sides has the (a, b)-cover property if NG(U) > (1 − b)n for all U ⊆ L or U ⊆ R with U ≥ an. 2.3. The polymer model. We follow the way in [HPR18] to introduce the polymer model and related tools. For a complete introduction to this model, see this wonderful book [FV17]. Let G be a graph and Ω be a finite set. A polymer γ = (γ, ωγ) consists of a support γ which is a connected subgraph of G and a mapping ωγ which assigns to each vertex in γ some value in Ω. We use γ to denote the number of vertices of γ. There is also a weight function w(γ, ·) : C → C for each polymer γ. There can be many polymers defined on the graph G and we use Γ∗ = Γ∗(G) to denote the set of all polymers defined on it. However, at the moment we do not give a constructive definition of polymers. Such definitions are presented when they are needed, see Section 3.2 and Section 5.2. We say two polymers γ1 and γ2 are compatible if dG(γ1, γ2) > 1 and we use γ1 ∼ γ2 to denote that they are compatible. For a subset Γ ⊆ Γ∗ of polymers, it is compatible if any two different polymers in this set are compatible. We define S(Γ∗) = {Γ ⊆ Γ∗ : Γ is compatible} to be the collection of all compatible subsets of polymers. For any Γ ∈ S(Γ∗), we define Γ to be the the subgraph of G by putting together the support of all polymers in Γ. It is well defined since Γ is compatible. We also define(cid:12)(cid:12)Γ(cid:12)(cid:12) to be the number of vertices of the subgraph Γ and ωΓ = ∪γ∈Γωγ. We say (Γ∗, w) is a polymer model defined on the graph G and the partition function of this polymer model is Ξ(G, z) = ∑ Γ∈S (Γ∗) w(γ, z), ∏ γ∈Γ where z is a complex variable and ∏γ∈∅ w(γ, z) = 1 by convention. The following theorem2 states conditions that Ξ(G, z) can be approximated efficiently. Theorem 5 ([HPR18], Theorem 2.2). Fix ∆ and let G be a set of graphs of degree at most ∆. Suppose: • There is a constant C such that for all G ∈ G, the degree of Ξ(G, z) is at most CG. • For all G ∈ G and γ ∈ Γ∗(G), w(γ, z) = aγzγ where aγ 6= 0 can be computed in time • For every connected subgraph G′ of every G ∈ G, we can list all polymers γ ∈ Γ∗(G) with γ = G′ • There is a constant R > 0 such that for all G ∈ G and z ∈ C with z < R, Ξ(G, z) 6= 0. exp(O(γ + log2 G)). in time exp(O(G′)). Then for every z with z < R, there is an FPTAS for Ξ(G, z) for all G ∈ G. The following condition by Koteck `y and Preiss (KP-condition) is useful to show that Ξ(G, z) is zero-free in certain regions. Lemma 6 ([KP86]). Suppose there is a function a : Γ∗ → R>0 and for every γ∗ ∈ Γ∗, ∑ ea(γ)w(γ, z) ≤ a(γ∗). Then Ξ(G, z) 6= 0. γ: γ6∼γ∗ To verify the KP-condition, usually we need to enumerate polymers and the following lemma is useful to bound the number of enumerated polymers. Lemma 7 ([BCKL13]). For any graph G = (V, E) with maximum degree ∆ and v ∈ V, the number of connected induced subgraphs of size k ≥ 2 containing v is at most (e∆)k−1/2. As a corollary, the number of connected induced subgraphs of size k ≥ 1 containing v is at most (e∆)k−1. 2Here we only need a special case of the original theorem. 5 2.4. Some useful lemmas. Throughout this paper, we use H(x) to denote the binary entropy function H(x) = −x log2 x − (1 − x) log2(1 − x), x ∈ (0, 1). Moreover, we extend this function to the interval [0, 1] by defining H(0) = H(1) = 0. This is reasonable since limx→0+ H(x) = limx→1− H(x) = 0. Lemma 8. It holds that H(x) ≤ 2px(1 − x) ≤ 2√x for all 0 ≤ x ≤ 1. Proof. Let f (x) = 2√x(1−x) ∂ f /∂x ≥ 0 for any 1/2 ≤ x < 1. It holds that . Since f (x) = f (1 − x) and f (1/2) = 1, it suffices to show that H(x) (1 − x) log2 1/(1 − x) − x log2 1/x = , ∂ f ∂x H(x)2px(1 − x) g(x) H(x)2px(1 − x) ≥ 0 for all 1/2 ≤ x < 1, since g(1/2) = 0, limx→1− g(x) = 0 and g is concave over [1/2, 1). The concavity of g follows from ∂2g ∂x2 = (1 − 2x) log2 e (1 − x)x ≤ 0 for 1/2 ≤ x < 1. Lemma 9. It holds that H(x) ≤ −2x log2 x for all 0 < x ≤ 1/2. Proof. Let f (x) = H(x) + 2x log2 x = x log2 x− (1− x) log2(1− x), it suffices to show that f (x) ≤ 0 for x ∈ (0, 1/2]. In fact, limx→0+ f (x) = 0, f (1/2) = 0 and f is convex over (0, 1/2]. The convexity of f follows from (cid:3) ∂2 f ∂x2 = (1 − 2x) log2 e x(1 − x) ≥ 0 for 0 < x ≤ 1/2. Lemma 10. For all a ≥ 1, H(x) − 1/aH(ax) ≥ x(ln a − x) log2 e for all 0 ≤ x ≤ 1/a. Proof. Recall that −x 1−x ≤ ln(1 − x) ≤ −x for any 0 < x < 1. Thus for any 0 < x < 1/a, H(x) − 1/aH(ax) = (x ln a − (1 − x) ln(1 − x) + 1/a(1 − ax) ln(1 − ax)) · log2 e ≥ (x ln a − (1 − x)(−x) + 1/a(1 − ax)(−ax)/(1 − ax)) · log2 e = x(ln a − x) · log2 e And the inequality holds trivially for x = 0 and x = 1/a. Lemma 11. It holds that H(cid:18) x 1 − y(cid:19) (1 − y) − H(x) ≤ −xy log2 e for all 0 ≤ x, y < 1 with x + y < 1. (cid:3) (cid:3) Proof. It holds that for any 0 ≤ x, y < 1 with x + y < 1, H (x/(1 − y)) (1 − y) − H(x) + xy log2 e = ((1 − x) ln(1 − x) + (1 − y) ln(1 − y) − (1 − x − y) ln(1 − x − y) + xy) log2 e , f (x, y) log2 e. Thus it suffices to show that f (x, y) ≤ 0 for 0 ≤ x, y < 1 with x + y < 1. Fix 0 ≤ x < 1. We verify that f (x, 0) = 0 and ∂ f ∂y = − ln(1 − y) + ln(1 − x − y) + x = ln 6 1 − x − y 1 − y + x ≤ −x/(1 − y) + x ≤ 0 for any 0 ≤ y < 1 − x. Lemma 12 ([MU17, Lemma 10.2]). Suppose that n is a positive integer and k ∈ [0, 1] is a number such that kn is an integer. Then (cid:3) 2H(k)n n + 1 ≤(cid:18) n kn(cid:19) ≤ 2H(k)n. Lemma 13. For b > a > 0, the function f (λ) = λa/(λ + 1)b is monotonically increasing on [0, monotonically decreasing on [ a b−a , +∞). Proof. It holds that for all λ > 0. ∂ f ∂λ = eln f (λ) · a − (b − a)λ λ(λ + 1) a b−a ] and (cid:3) 3. COUNTING INDEPENDENT SETS FOR λ ≥ 1 Throughout this section, we consider integers ∆ ≥ 53, fugacity λ ≥ 1 and set parameters ζ, α, β to be ζ = 1.28, α = 2.9 ∆ , β = ∆ 2.9ζ . Lemma 14. For ∆ ≥ 53, lim n→∞ n,∆hG ∈ G ∆ α,βi = 1. Pr G∼Gbip Proof. We verify that the conditions in Lemma 4 are satisfied. Recall that ζ = 1.28, α = 2.9/∆, β = ∆/(2.9ζ) and ∆ ≥ 53. Clearly 0 < α < 1/β < 1. Let f (∆) = ∆ − H(α)+H(αβ) H(α)−αβH(1/β). It follows from Lemma 10 that H(α) − αβH(1/β) = H(2.9/∆) − 1/ζH(2.9ζ/∆) ≥ 2.9/∆(ln ζ − 2.9/∆) log2 e ≥ 2.9/∆(ln 1.28 − 2.9/1000) log2 e ≥ 1/∆ for any ∆ ≥ 1000. Then f (∆) ≥ ∆ − H(2.9/1000) + H(1/ζ) 1/∆ ≥ 0.2∆ > 0 for ∆ ≥ 1000. For 53 ≤ ∆ < 1000, we can use computers to verify that f (∆) > 0. Actually, in the (cid:3) current setting of parameters, f (52) ≈ −0.06 < 0 < f (53) ≈ 0.11. In the rest of this section, whenever possible, we will simplify notations by omitting super- scripts, subscripts and brackets with the symbols between (but this will not happen in the state- ment of lemmas and theorems). For example, Z(G, λ) may be written as Z if G and λ are clear from context. 3.1. Approximating Z(G, λ). For all G = (L, R, E) ∈ G ∆ α,β, X ∈ {L, R} and λ ≥ 1, we define IX (G) = {I ∈ I(G) : I ∩ X < αn} , ZX (G, λ) = ∑ I∈IX (G) λI. The main result in this part is that we can use ZL(G, λ) + ZR(G, λ) to approximate Z(G, λ). 7 Lemma 15. For ∆ ≥ 53 and λ ≥ 1, there are constants C = C(∆) > 1 and N = N(∆) so that for all α,β with n > N vertices on both sides, ZL(G, λ) + ZR(G, λ) is a C−n-relative approximation to G ∈ G ∆ Z(G, λ). Proof. Let N1, C1, N2, C2 be the constants in Lemma 16 and Lemma 17, respectively. It follows from these lemmas that exp(−(C−n 1 + C−n 2 ))Z ≤ ZL + ZR ≤ exp(C−n 1 + C−n 2 )Z 2 ≤ 2 min(C1, C2)−n =(cid:0)min(C1, C2)/21/n(cid:1)−n for all n > max(N1, N2). It is clear that C−n C−n for another constant C = C(∆) > 1 and for all n > N ≥ max(N1, N2) where N = N(∆) is another sufficiently large constant. Therefore we obtain 1 + C−n < exp(−C−n)Z ≤ ZL + ZR ≤ exp(C−n)Z for all n > N. Lemma 16. For ∆ ≥ 3 and λ ≥ 1, there are constants C = C(∆) > 1 and N = N(∆) so that for α,β with n > N vertices on both sides, ∑I∈IL(G)∪IR(G) λI is a C−n-relative approximation to all G ∈ G ∆ Z(G, λ). (cid:3) Proof. It is clear that (1) ∑ I∈IL∪IR λI ≥ (λ + 1)n. Let B = I \ (IL ∪ IR). For any I ∈ B, it follows from the definition of B that I ∩ L ≥ αn and I ∩ R ≥ αn. Using the expansion property, we obtain N(I ∩ L) ≥ β⌊αn⌋ and thus I ∩ R ≤ n − N(I ∩ L) ≤ (1 − 1/ζ)n where 1/ζ = β⌊αn⌋/n ≥ αβ − β/n. Analogously, it holds that I ∩ L ≤ (1 − 1/ζ)n. In the following, we assume n ≥ N1 for some N1 = N1(∆) > 0, such that (2) We obtain an upper bound of ∑I∈B λI as follows: 1 − 1/ζ ≤ 0.219. a) Consider an independent set I ∈ B. Recall that αn ≤ I ∩ L ≤ (1 − 1/ζ)n. We first enu- merate a subset U ⊆ L with αn ≤ U ≤ (1 − 1/ζ)n and then enumerate all independent sets I with I ∩ L = U. Since 1 − 1/ζ < 1/2, there are at most n(cid:18) n ⌊(1 − 1/ζ)n⌋(cid:19) ≤ n2H(1−1/ζ)n ways to enumerate such a set U, where the inequality follows from Lemma 12. b) Now fix a set U ⊆ L. Recall that every independent set I ∈ B satisfies I ∩ R ≤ (1 − 1/ζ)n. Therefore ∑ λI = λU ∑ I∈B: I∩L=U c) Combining the first two steps we obtain I∈B: I∩L=U λI∩R ≤ λ(1−1/ζ)n (λ + 1)(1−1/ζ)n . (3) ∑ I∈B λI ≤ n2H(1−1/ζ)nλ(1−1/ζ)n(λ + 1)(1−1/ζ)n = n2H(1−1/ζ)n(λ2 + λ)(1−1/ζ)n. Using Equation (1) and Equation (3), we obtain (4) ∑I∈B λI ∑I∈IL∪IR λI ≤ n2H(1−1/ζ)n(λ2 + λ)(1−1/ζ)n (λ + 1)n 8 = n( f (λ))n, where f (λ) = 2H(1−1/ζ) · Since 1 − 1/ζ < 1/ζ, it follows from Lemma 13 that λ1−1/ζ (λ + 1)1/ζ . for all λ ≥ 1. So there exists some constant C > 1 such that f (λ) ≤ f (1) = 2H(1−1/ζ)−1/ζ < 1 Equation (4) ≤ n( f (1))n < C−n for all n > N ≥ N1 where N = N(∆) is another sufficiently large constant. Using the upper bound on Equation (4) and 1 + x ≤ exp(x) for any x ∈ R we obtain ∑ I∈IL∪IR λI ≤ Z = ∑ I∈IL∪IR λI + ∑ I∈B λI ≤ exp(cid:0)C−n(cid:1) ∑ I∈IL∪IR λI for all n > N. Lemma 17. For ∆ ≥ 53 and λ ≥ 1, there are constants C > 1 and N so that for all G ∈ G ∆ vertices on both sides, ZL(G, λ) + ZR(G, λ) is a C−n-relative approximation to ∑I∈IL(G)∪IR(G) λI. Proof. For any I ∈ IL ∩ IR, it holds that I ∩ L < αn and I ∩ R < αn. Clearly ∑I∈IL∪IR (λ + 1)n. Therefore α,β with n > N λI ≥ (cid:3) (5) ∑I∈IL∩IR ∑I∈IL∪IR where the last inequality follows from Lemma 12. Recall that α = 2.9/∆ and ∆ ≥ 53. Then λ + 1 !n ≤ n2 4H(α)λ2α , ∑ λI 4H(α)λ2α λI ≤ (λ + 1)−n ⌊αn⌋ k=0(cid:18)n k(cid:19)λk!2 λ + 1 (cid:12)(cid:12)(cid:12)(cid:12)λ=1 ≤ 0.76 < 1. Equation (5) ≤(cid:16)1/(cid:16)0.76n2/n(cid:17)(cid:17)−n < C−n It follows from Lemma 13 that 4H(α)λ2α/(λ + 1) is monotonically decreasing in λ on [1, ∞) for all fixed ∆ ≥ 53. Thus for some constant C > 1 and for all n > N where N is a sufficiently large constant. Using the upper bound on Equation (5) and 1 + x ≤ exp(x) for any x ∈ R we obtain ∑ I∈IL∪IR λI ≤ ZL + ZR = ∑ λI + ∑ I∈IL∪IR I∈IL∩IR λI ≤ exp(C−n) ∑ λI I∈IL∪IR for all n > N. 3.2. Approximating ZX (G, λ). In this subsection, we discuss how to approximate ZX (G, λ) for any graph G ∈ G ∆ α,β, X ∈ {L, R} and λ ≥ 1. We will use the polymer model (see Section 2.3). First we constructively define the polymers we need. For any I ∈ IX (G), we can partition the graph (G2)[I ∩ X ] into connected components U1, U2, . . . , Uk for some k ≥ 0 (trivially k = 0 if I ∩ X = ∅). There are no edges in G2 between Ui and Uj for any 1 ≤ i 6= j ≤ k. If k > 0, let p(I) = {(U1, 1U1), (U2, 1U2), . . . , (Uk, 1Uk )} where 1Ui is the unique mapping from Ui to {1}. If k = 0, let p(I) = ∅. We define the set of all polymers to be (cid:3) Γ∗ X (G) = [I∈IX (G) p(I) 9 and each element in this set is called a polymer. When the graph G and X are clear from the context, we simply denote by Γ∗ the set of polymers. Clearly, p is a mapping from IX (G) to the set(cid:8)Γ ∈ S(Γ∗ (G)) : (cid:12)(cid:12)Γ(cid:12)(cid:12) < αn(cid:9) since(cid:12)(cid:12)(cid:12)p(I)(cid:12)(cid:12)(cid:12) = I ∩ X < αn for all I ∈ IX (G). For each polymer γ, define its weight function w(γ, ·) as X w(γ, z) = λγ(λ + 1)−N(γ)zγ, where z is a complex variable. The weight function can be computed in polynomial time in γ. The partition function of the polymer model (Γ∗, w) on the graph G2 is the following sum: Ξ(z) = ∑ Γ∈S (Γ∗) w(γ, z). ∏ γ∈Γ Recall that two polymers γ1 and γ2 are compatible if dG2 (γ1, γ2) > 1 and this condition is equiva- lent to dG(γ1, γ2) > 2. Lemma 18. For all bipartite graphs G = (L, R, E) with n vertices on both sides, X ∈ {L, R} and λ ≥ 0, ZX (G, λ) ≤ Γ∈S (Γ∗):Γ≥αn 10 w(γ, 1) ≤ ∏ γ∈Γ Γ∈S (Γ∗):Γ≥αn ZX (G, λ) = (λ + 1)n ∑ (G)):Γ<αn ∏ γ∈Γ Γ∈S (Γ∗ X w(γ, 1). ∑ Thus λI = ZX (G, λ) = ∑ I∈IX Proof. Recall that in the definition of polymers, p is a mapping from IX to(cid:8)Γ ∈ S(Γ∗) : (cid:12)(cid:12)Γ(cid:12)(cid:12) < αn(cid:9). Fix Γ ∈ S(Γ∗) with(cid:12)(cid:12)Γ(cid:12)(cid:12) < αn. It holds that where the last equality follows from(cid:12)(cid:12)Γ(cid:12)(cid:12) < αn. Since Γ is compatible, NG(Γ) = ⊔γ∈ΓNG(γ) and (cid:12)(cid:12)(L ⊔ R) \ (X ⊔ NG(Γ))(cid:12)(cid:12) = n − ∑γ∈Γ NG(γ). Thus λI = λΓ(λ + 1)(L⊔R)\(X⊔NG(Γ)), Equation (6) = λ∑γ∈Γ γ(λ + 1)n−∑γ∈Γ N(γ) Γ∈S (Γ∗):Γ<αn λI = ∑ I∈IX : I∩X =Γ I∈IX : p(I)=Γ I∈IX : p(I)=Γ ∑ λI. ∑ (6) = (λ + 1)n ∏ γ∈Γ = (λ + 1)n ∏ γ∈Γ λγ(λ + 1)−N(γ) w(γ, 1). This completes the proof. Lemma 19. For ∆ ≥ 53 and λ ≥ 1, there are constants C > 1 and N so that for all G = (L, R, E) ∈ G ∆ with n > N vertices on both sides and X ∈ {L, R}, α,β (cid:3) (λ + 1)nΞ(1) = (λ + 1)n ∑ Γ∈S (Γ∗ X ∏ γ∈Γ (G)) w(γ, 1) is a C−n-relative approximation to ZX (G, λ). Proof. It is clear that ZX (G, λ) ≥ (λ + 1)n. Then using Lemma 18 and Lemma 21 we obtain (7) (λ + 1)nΞ(1) − ZX (G, λ) ∑ ∑ 2−βΓ. for some constant C > 1 and for all n > N where N is a sufficiently large constant. Using the upper bound on Equation (7) and 1 + x ≤ exp(x) for any x ∈ R we obtain ZX (G, λ) ≤ (λ + 1)nΞ(1) = ZX (G, λ) + ((λ + 1)nΞ(1) − ZX (G, λ)) ≤ exp(C−n)ZX (G, λ) To enumerate each Γ ∈ S(Γ∗) with(cid:12)(cid:12)Γ(cid:12)(cid:12) ≥ αn at least once, we first enumerate an integer αn ≤ k ≤ k=⌈αn⌉(cid:16)22√1/α−β(cid:17)k n, then since Γ ⊆ X , we choose k vertices from X . Therefore n ∑ Equation (7) ≤ k=⌈αn⌉(cid:16)22√n/k−β(cid:17)k k(cid:19)2−βk ≤ 2H(k/n)n2−βk ≤ n ∑ k=⌈αn⌉(cid:18)n k=⌈αn⌉ n ∑ n ∑ ≤ , where the inequalities follow from Lemma 12 and Lemma 8. Recall that ζ = 1.28, α = 2.9/∆, β = ∆/(2.9ζ) and ∆ ≥ 53. Let f (∆) = 2√1/α − β = 2√∆/2.9 − ∆/(2.9ζ). We obtain It follows from Lemma 20 that f (∆) is monotonically decreasing in ∆ on [53, +∞). Thus Equation (7) ≤ = (cid:16)22√2.9/∆−1/ζ(cid:17)n 1 − 2 f (∆) 2 f (∆)αn 1 − 2 f (∆) (cid:16)22√2.9/53−1/1.28(cid:17)n 1 − 22√53/2.9−53/(2.9×1.28) ≤ 0.81n/0.98 < C−n Equation (7) ≤ for all n > N. Lemma 20. The function f (∆) = 2√1/α − β is monotonically decreasing on [53, +∞). Proof. Recall that ζ = 1.28, α = 2.9/∆, β = ∆/(2.9ζ). It holds that ∂ f ∂∆ = 1 √2.9∆ − 1 2.9ζ ≤ 1 1 √2.9 × 53 − 2.9 × 1.28 ≈ −0.19 < 0 for all ∆ ≥ 53. Lemma 21. For all polymers γ ∈ Γ∗ defined by G = (L, R, E) ∈ G ∆ α,β, X ∈ {L, R} and λ ≥ 1, (cid:3) (cid:3) w(γ, z) ≤ (2−βz)γ. As a corollary, w(γ, 1) ≤ 2−βγ and for all compatible Γ ⊆ Γ∗(G), w(γ, 1) ≤ 2−βΓ. ∏ γ∈Γ Proof. Let n = L = R and let γ be any polymer. It follows from the definition of polymers that γ ≤ αn and by the expansion property, N(γ) ≥ βγ. Thus we have w(γ, z) = λγ(λ + 1)−N(γ)zγ ≤ (λ(λ + 1)−β)γzγ ≤ (2−βz)γ where the last inequality follows from Lemma 13 since β > 1 and λ ≥ 1. In particular, w(γ, 1) ≤ 2−βΓ. 2−βγ. For any compatible Γ, it holds that(cid:12)(cid:12)Γ(cid:12)(cid:12) = ∑γ∈Γ γ. Thus ∏γ∈Γ w(γ, 1) ≤ ∏γ∈Γ 2−βγ = (cid:3) 11 α,β and 3.3. Approximating the partition function of the polymer model. Lemma 22. For ∆ ≥ 53 and λ ≥ 1, there is an FPTAS for Ξ(1) for all G = (L, R, E) ∈ G ∆ X ∈ {L, R}. Proof. We use the FPTAS in Theorem 5 to design the FPTAS we need. To this end, we generate a graph G2 in polynomial time in G for any G ∈ G ∆ α,β. We use this new graph G2 as input to the FPTAS in Theorem 5. It is straightforward to verify the first three conditions in Theorem 5, only with the exception that the information of G2 may not be enough because certain connectivity information in G is discarded in G2. Nevertheless, we can use the original graph G whenever needed and thus the first three conditions are satisfied. For the last condition, Lemma 23 verifies (cid:3) it. Lemma 23. There is a constant R > 1 so that for ∆ ≥ 53 and λ ≥ 1, Ξ(z) 6= 0 for all G ∈ G ∆ α,β, X ∈ {L, R} and z ∈ C with z < R, . Proof. Set R = 1.001. For any γ ∈ Γ∗, let a(γ) = tγ where t =(cid:0)−1 + √1 + 8e(cid:1) /(4e) ≈ 0.346. We will verify that the KP-condition (8) ∑ γ:γ6∼γ∗ etγw(γ, z) ≤ t(cid:12)(cid:12)γ∗(cid:12)(cid:12) b) then enumerate an integer k from 1 to ⌊αn⌋; c) finally enumerate γ with v ∈ γ and γ = k. Since γ is connected in G2, applying Lemma 7 and using Lemma 21 to bound w(γ, z) we obtain holds for any γ∗ ∈ Γ∗ and any z < R. It then follows from Lemma 6 that Ξ(z) 6= 0 for any z < R. Recall that dG2 (γ, γ∗) ≤ 1 for all γ 6∼ γ∗. Thus there is always a vertex v ∈ γ ⊆ X such γ 6∼ γ∗ at least once, we can that v ∈ γ∗ ⊔ NG2 (γ∗). The number of such vertices v is at most ∆2(cid:12)(cid:12)γ∗(cid:12)(cid:12). So to enumerate each a) first enumerate a vertex v in X ∩(cid:0)γ∗ ∪ NG2 (γ∗)(cid:1); etγw(γ, z) ≤ ∆2(cid:12)(cid:12)γ∗(cid:12)(cid:12) et2−βz + e(cid:12)(cid:12)γ∗(cid:12)(cid:12) 1 + k=2(cid:0)e∆2(cid:1)k−1 xk−1! = Let x = et+1∆22−βR. Since z < R, we obtain x(2 − x) 2e(1 − x) ·(cid:12)(cid:12)γ∗(cid:12)(cid:12). Recall that ζ = 1.28, β = ∆/(2.9ζ) and ∆ ≥ 53. It follows from Lemma 24 that ∆22−β is monoton- ically decreasing in ∆ on [53, +∞). Thus it holds that 2−1etk2−βkzk! . ∑ γ:γ6∼γ∗ etγw(γ, z) ≤ x ∑ γ:γ6∼γ∗ ⌊αn⌋ ∑ 1 2 ∞ ∑ k=2 (9) x = et+1∆22−βR ≤(cid:16)et+1∆22−βR(cid:17)(cid:12)(cid:12)(cid:12)(cid:12)∆=53 ≤ 0.545, x(2 − x) 2e(1 − x) < 0.33 < t. (cid:3) and hence This completes the proof. Lemma 24. The function f (∆) = ∆22−β is monotonically decreasing on [53, +∞). 12 Proof. Recall that ζ = 1.28, β = ∆/(2.9ζ). It is equivalent to show that ∂ ln f /∂∆ < 0 for all ∆ ≥ 53. It holds that ∂ ln f ∂∆ = 2 ∆ − ln 2 2.9ζ ≤ 2 53 − ln 2 2.9 × 1.28 ≈ −0.15 < 0 for all ∆ ≥ 53. 3.4. Putting things together. Using the results from previous parts, we obtain our main result for counting independent sets. Theorem 1. For ∆ ≥ 53 and fugacity λ ≥ 1, with high probability (tending to 1 as n → ∞) for a graph G chosen uniformly at random from G bip n,∆, there is an FPTAS for the partition function Z(G, λ). (cid:3) Proof. This theorem follows from Lemma 14 and Lemma 25. (cid:3) Algorithm 1 Counting independent sets at fugacity λ ≥ 1 for ∆ ≥ 53 1: Input: A graph G = (L, R, E) ∈ G ∆ 2: Output: bZ such that exp(−ε)bZ ≤ Z(G, λ) ≤ exp(ε)bZ 3: if n ≤ N or ε ≤ 2C−n then α,β with n vertices on both sides and ε > 0 Exit; (G), w). (G), w). Use the brute-force algorithm to computebZ ← Z(G, λ); 4: 5: 6: end if 7: ε′ ← ε − C−n; 8: Use the FPTAS in Lemma 22 to obtainbZL, an ε′-relative approximation to the partition function 9: Use the FPTAS in Lemma 22 to obtain bZR, an ε′-relative approximation to the partition func- 10: bZ ← (λ + 1)n(cid:16)bZL +bZR(cid:17); tion Ξ(z) at z = 1 of the polymer model (Γ∗ R Ξ(z) at z = 1 of the polymer model (Γ∗ L Lemma 25. For ∆ ≥ 53 and λ ≥ 1, there is an FPTAS for Z(G, λ) for all G ∈ G ∆ α,β. Proof. First we state our algorithm. See Algorithm 1 for a pseudocode description. The input is a graph G = (L, R, E) ∈ G ∆ α,β and an approximation parameter ε > 0. The output is a number bZ to approximate Z(G, λ). We use ΞX (z) to denote the partition function of the poly- mer model (Γ∗ (G), w) for X ∈ {L, R}. Let N1, C2, N2, C2 be the constants in Lemma 15 and X Lemma 19, respectively. These two lemmas show that (λ + 1)n (ΞL(1) + ΞR(1)) is a C−n 2 ≤ 2 min(C1, C2)−n ≤ C−n-relative approximation to Z(G, λ) for another constant C > 1 and all n > N ≥ max(N1, N2) where N is another sufficiently large constant. If n ≤ N or ε ≤ 2C−n, If ε > 2C−n, we apply the FPTAS in we use the brute-force algorithm to compute Z(G, λ). Lemma 22 with approximation parameter ε′ = ε − C−n to obtain outputs bZL and bZR which ap- proximate ΞL(1) and ΞR(1) , respectively. Let bZ = (λ + 1)n(bZL +bZR) be the output. It is clear that exp(−ε)bZ ≤ Z(G, λ) ≤ exp(ε)bZ. Then we show that Algorithm 1 is indeed an FPTAS. It is required that the running time of our algorithm is bounded by (n/ε)C3 for some constant C3 and for all n > N3 where N3 is a constant. Let N3 = N. If ε ≤ 2C−n, the running time of the algorithm would be 2.1n ≤ (nCn/2)C3 ≤ (n/ε)C3 If ε > 2C−n, the running time of the algorithm would be (n/ε′)C4 = for sufficient large C3. (n/(ε − C−n))C4 ≤ (2n/ε)C4 ≤ (n/ε)C3 for sufficient large C3, where C4 is a constant from the 1 + C−n (cid:3) FPTAS in Lemma 22. 13 Let λl = (ln ∆)4 ∆ = eΩ(cid:0) 1 fugacity λ > λl and set parameters α, β to be ∆(cid:1) 4. COUNTING INDEPENDENT SETS FOR λ = eΩ(cid:0) 1 ∆(cid:1). Throughout this section, we consider sufficiently large integers ∆, α = (ln ∆)2 ∆ , β = 1 3α . We define a set G ∆ α,α,β of graphs as α,α,β =nG ∈ G ∆ G ∆ α,β : G has the (α, α)-cover propertyo . α,α,βi = 1. n,∆hG ∈ G ∆ Pr G∼Gbip Lemma 26. For all sufficiently large integers ∆, lim n→∞ Proof. In this proof we only consider sufficiently large integers ∆. Recall that α = (ln ∆)2 β = 1 3α . It suffices to show that ∆ and (10) (11) lim n→∞ Pr G∼Gbip n,∆ lim n→∞ n,∆hG ∈ G ∆ α,βi = 1, Pr G∼Gbip [G has the (α, α)-cover property] = 1. First we verify that the conditions in Lemma 4 are satisfied and then Equation (10) follows. Clearly, H(α)−αβH(1/β). Recall that ∆ is sufficiently large. Thus α can be 0 < α < 1/β < 1. Let f (∆) = ∆ − H(α)+H(αβ) sufficiently small. Using Lemma 10 we obtain H(α) − αβH(1/β) = H(α) − 1/3H(3α) ≥ α(ln 3 − α) log2 e ≥ α = (ln ∆)2 ∆ . Hence f (∆) ≥ ∆ − H(0.01) + H(1/3) (ln ∆)2/∆ ≥ ∆ − ∆ (ln ∆)2 > 0. Then we show that Equation (11) is satisfied. It is equivalent to show that lim n→∞ Pr G∼Gbip n,∆ [G does not have the (α, α)-cover property] → 0. Assume that a ∆-regular bipartite graph G = (L, R, E) with n vertices on both sides does not have this property. Then there is a pair (U, V) with U ⊆ L, V ⊆ R or U ⊆ R, V ⊆ L that U = ⌈αn⌉, V = ⌈αn⌉ and N(U) ∩ V = ∅. Applying union bound we obtain (12) [G does not have the (α, α)-cover property] Pr G∼Gbip n,∆ ≤ 2 ∑ ∑ U⊆L:U=⌈αn⌉ V⊆R: V=⌈αn⌉ Pr G∼Gbip n,∆ [N(U) ∩ V = ∅] . Using Lemma 12 and the perfect matching generation procedure of the distribution G bip n,∆, we obtain Equation (12) ≤ 2(cid:18) n ⌈αn⌉(cid:19)2(cid:18)(cid:18)n − ⌈αn⌉ ⌈αn⌉ (cid:19)(cid:30)(cid:18) n ⌈αn⌉(cid:19)(cid:19)∆ . 14 It then follows from Lemma 8 that Equation (12) ≤ 2 · 2(2H(α)+o(1))n(cid:16)2(H( α ≤ 2(n + 1)∆ ·(cid:16)22H(α)+∆(H( α 2H(α) + ∆(cid:18)H(cid:18) α 1 α − ∆α2 log2 e + o(1) as n → ∞. Recall that ∆ is sufficiently large. Using Lemma 9 and Lemma 11 we obtain 1−α )+o(1))(1−α)n−(H(α)+o(1))n(n + 1)(cid:17)∆ 1−α )(1−α)−H(α))+o(1)(cid:17)n 1 − α(cid:19) (1 − α) − H(α)(cid:19) + o(1) (ln ∆)2 − ∆(cid:18) (ln ∆)2 ∆ (cid:19)2 ∆ (cid:19) log2 e + o(1) < C < 0 log2 e + o(1) ∆ (ln ∆)4 ≤ 4α log2 4(ln ∆)2 = ∆ log2 ≤(cid:18) 4(ln ∆)3 ∆ − for some constant C = C(∆) < 0 as n → ∞. Therefore Equation (12) ≤ 2(n + 1)∆2Cn → 0 as n → ∞. Putting together Theorem 1 and the result in this section, we obtain the following. (cid:3) Theorem 2. For all sufficiently large integers ∆ and fugacity λ = eΩ(cid:0) 1 to 1 as n → ∞) for a graph G chosen uniformly at random from G bip function Z(G, λ). Proof. Let α′, β′ be the parameters in Section 3. Let G = G ∆ Lemma 14 and Lemma 26 that lim n→∞ n,∆, there is an FPTAS for the partition ∆(cid:1), with high probability (tending α′,β′ ∩ G ∆ α,α,β. It then follows from [G ∈ G] = 1. For λ ≥ 1, we apply the algorithm from (cid:3) Pr G∈Gbip n,∆ Theorem 1. For λl < λ < 1, we apply the algorithm from Lemma 33. Therefore, in the rest of this section, we only consider fugacity λl < λ < 1. The notations and definitions in the rest of this section would be identical to those in Section 3. So we only review needed materials briefly and state results different from those in Section 3. 4.1. Approximating Z(G, λ). Recall that IX (G) = {I ∈ I(G) : I ∩ X < αn} , ZX (G, λ) = ∑ I∈IX (G) λI. The main result in this part is that we can use ZL(G, λ) + ZR(G, λ) to approximate Z(G, λ) for all λl < λ < 1. Lemma 27. For all sufficiently large integers ∆, there are constants C = C(∆) > 1 and N = N(∆) so that for all G ∈ G ∆ α,α,β with n > N vertices on both sides and λl < λ < 1, ZL(G, λ) + ZR(G, λ) is a C−n-relative approximation to Z(G, λ). Proof. In this proof we only consider sufficiently large integers ∆. Applying Lemma 28, it suffices to show that ZL(G, λ) + ZR(G, λ) is a C−n-relative approximation to ∑I∈IL∪IR λI. For any I ∈ 15 IL ∩ IR, it holds that I ∩ L < αn and I ∩ R < αn. Clearly ∑I∈IL∪IR α ≤ 1/2, Lemma 12 and λl < λ < 1 we obtain (13) ∑I∈IL∩IR ∑I∈IL∪IR λI λI ≤ (λ + 1)−n ⌊αn⌋ k=0(cid:18)n k(cid:19)λk!2 ∑ ≤ (λ + 1)−n ⌊αn⌋ k(cid:19)!2 k=0(cid:18)n ∑ λI ≥ (λ + 1)n. Using λl + 1!n ≤ n2 4H(α) . Recall that ∆ is sufficiently large, α = (ln ∆)2 for any 0 ≤ x ≤ 1 we obtain ∆ and λl = (ln ∆)4 ∆ . Using Lemma 9 and ln(x + 1) ≥ x/2 ln 4H(α) λl + 1 1 = H(α) ln 4 − ln(λl + 1) ≤ 2α log2 α 4(ln ∆)2 = ∆ for some constant C1 = C1(∆) < 0. Therefore 4(ln ∆)3 ≤ < C1 < 0 ∆ ln 4 − λl/2 ∆ (ln ∆)2 − (ln ∆)4 2∆ ln − (ln ∆)4 2∆ Equation (13) < n2(cid:16)e−C1(cid:17)−n =(cid:18) e−C1 n2/n(cid:19)−n < C−n for another constant C = C(∆) > 1 and for all n > N where N = N(∆) is a sufficiently large constant. Using the upper bound on Equation (13) and 1 + x ≤ exp(x) for any x ∈ R we obtain ∑ I∈IL∪IR λI ≤ ZL + ZR = ∑ I∈IL∪IR λI + ∑ I∈IL∩IR λI ≤ exp(C−n) ∑ λI I∈IL∪IR α,α,β and λ ∈ R, ∑I∈IL(G)∪IR(G) λI = Z(G, λ). for all n > N. Lemma 28. For ∆ ≥ 3, G ∈ G ∆ Proof. Let B = I \ (IL ∪ IR). If suffices to show that B = ∅. Suppose B is not empty. Then there is an independent set I ∈ B such that I ∩ L ≥ αn and I ∩ R ≥ αn. Applying the cover property, we obtain that I ∩ R ≤ R \ N(I ∩ L) < αn, which contradicts that I ∩ R ≥ αn. Thus B = ∅. 4.2. Approximating ZX (G, λ). Recall that for all G = (L, R, E) ∈ G ∆ sides and X ∈ {L, R}, we defined a polymer model (Γ∗ X function of this model is denoted by α,α,β with n vertices on both (G), w) of the graph G2. The partition (cid:3) (cid:3) Ξ(z) = ∑ Γ∈S (Γ∗ X ∏ γ∈Γ (G)) w(γ, 1) where z is a complex variable and w(γ, 1) = λγ(λ + 1)−N(γ)zγ. Lemma 29. For all sufficiently large integers ∆, there are constants C = C(∆) > 1 and N = N(∆) so that for all G = (L, R, E) ∈ G ∆ α,α,β with n > N vertices on both sides, X ∈ {L, R} and λl < λ < 1, (λ + 1)nΞ(1) = (λ + 1)n ∑ Γ∈S (Γ∗ X ∏ γ∈Γ (G)) w(γ, 1) is a C−n-relative approximation to ZX (G, λ). 16 Proof. In this proof we only consider sufficiently large integers ∆. (λ + 1)n. Then using Lemma 18 and the cover property we obtain It is clear that ZX (G, λ) ≥ (14) (λ + 1)nΞ(1) − ZX (G, λ) ZX (G, λ) ≤ ∑ Γ∈S (Γ∗):Γ≥αn w(γ, 1) ≤ ∏ γ∈Γ ∑ Γ∈S (Γ∗):Γ≥αn λΓ (λ + 1)(α−1)n . For any γ, since γ < αn, it follows from the expansion property that NG(γ) ≥ βγ. The compatibility of Γ states that dG(γ1, γ2) > 2 for any γ1 6= γ2 in Γ, implying NG(γ1) ∩ NG(γ2) = ∅. Using these two facts, for any Γ ∈ S(Γ∗), β(cid:12)(cid:12)Γ(cid:12)(cid:12) = β ∑ γ∈Γ γ ≤ ∑ γ∈ΓNG(γ) ≤ n, implying that(cid:12)(cid:12)Γ(cid:12)(cid:12) ≤ n/β. To enumerate each Γ ∈ S(Γ∗) with(cid:12)(cid:12)Γ(cid:12)(cid:12) ≥ αn at least once, we first enumerate an integer αn ≤ k ≤ n/β, then since Γ ⊆ X , we choose k vertices from X . Recall that ∆ is sufficiently large. Using Lemma 12, α < 1/β ≤ 1/2, αβ = 1/3 and λl < λ < 1 we obtain Equation (14) ≤ ⌊n/β⌋ ∑ k=⌈αn⌉(cid:18)n k(cid:19)λk (λ + 1)(α−1)n ≤ n 2H(1/β) (λ + 1)1−α!n ≤ n 2H(3α) (λl + 1)1−α!n . Recall that α = (ln ∆)2 obtain ∆ and λl = (ln ∆)4 ∆ . Using Lemma 9 and ln(x + 1) ≥ x/2 for any 0 ≤ x ≤ 1 we 2H(3α) ln (λl + 1)1−α = H(3α) ln 2 − (1 − α) ln(λl + 1) ≤ 6α log2 6(ln ∆)2 1 3α ln 2 − λl/4 (ln ∆)4 4∆ ∆ 3(ln ∆)2 − (ln ∆)4 4∆ ln − = ∆ 6(ln ∆)3 ≤ < C1 < 0 ∆ for some constant C1 = C1(∆) < 0. Therefore Equation (14) < n(cid:16)e−C1(cid:17)−n =(cid:18) e−C1 n2/n(cid:19)−n < C−n for some constant C = C(∆) > 1 and for all n > N where N = N(∆) is a sufficiently large constant. Using the upper bound on Equation (14) and 1 + x ≤ exp(x) for any x ∈ R we obtain ZX (G, λ) ≤ (λ + 1)nΞ(1) = ZX (G, λ) + ((λ + 1)nΞ(1) − ZX (G, λ)) ≤ exp(C−n)ZX (G, λ) for all n > N. Lemma 30. For all polymers γ ∈ Γ∗ X 1, w(γ, 1) ≤ (λ + 1)−βγ. Proof. For every γ ∈ Γ∗, it follows from the definition of polymers that γ < αn. Using the expansion property we obtain (G) defined by G = (L, R, E) ∈ G ∆ α,α,β, X ∈ {L, R} and λl < λ < (cid:3) w(γ, 1) = λγ(λ + 1)−N(γ) ≤ (λ + 1)−βγ. 17 (cid:3) 4.3. Approximating the partition function of the polymer model. α,α,β and X ∈ {L, R}. Lemma 31. For all sufficiently large integers ∆ and λl < λ < 1, there is an FPTAS for Ξ(1) for all G = (L, R, E) ∈ G ∆ Proof. We use the FPTAS in Theorem 5 to design the FPTAS we need. To this end, we generate a graph G2 in polynomial time in G for any G ∈ G ∆ α,α,β. We use this new graph G2 as input to the FPTAS in Theorem 5. It is straightforward to verify the first three conditions in Theorem 5, only with the exception that the information of G2 may not be enough because certain connectivity information in G is discarded in G2. Nevertheless, we can use the original graph G whenever needed and thus the first three conditions are satisfied. For the last condition, Lemma 32 verifies (cid:3) it. Lemma 32. There is a constant R > 1 so that for all sufficiently large integers ∆, G = (L, R, E)∈ G ∆ α,α,β, X ∈ {L, R} and z ∈ C with z < R, Ξ(z) 6= 0. Proof. In this proof we only consider sufficiently large integers ∆. Set R = 2. For any γ, let a(γ) = γ. We will verify that the KP-condition (15) ∑ γ:γ6∼γ∗ eγw(γ, z) ≤(cid:12)(cid:12)γ∗(cid:12)(cid:12) holds for any γ∗ and any z < R. It then follows from Lemma 6 that Ξ(z) 6= 0 for any z < R. Recall that dG2(γ, γ∗) ≤ 1 for all γ 6∼ γ∗. Thus there is always a vertex v ∈ γ ⊆ X such that at least once, we can v ∈ γ∗ ⊔ NG2 (γ∗). The number of such vertices v is at most ∆2(cid:12)(cid:12)γ∗(cid:12)(cid:12). So to enumerate each γ 6∼ γ∗ a) first enumerate a vertex v in X ∩(cid:0)γ∗ ∪ NG2 (γ∗)(cid:1); b) then enumerate an integer k from 1 to ⌊αn⌋; c) finally enumerate γ with v ∈ γ and γ = k. Since γ is connected in G2, using Lemma 7 and Lemma 30 and λl < λ < 1 we obtain (16) ∑ γ:γ6∼γ∗ eγw(γ, z) ≤ ∑ γ:γ6∼γ∗ Recall that ∆ is sufficiently large, β = 1 0 ≤ x ≤ 1 we obtain eγw(γ, 1) · zγ ≤ ∆2(cid:12)(cid:12)γ∗(cid:12)(cid:12) ≤(cid:12)(cid:12)γ∗(cid:12)(cid:12) 3(ln ∆)2 and λl = (ln ∆)4 3α = ∆ ⌊αn⌋ ∑ k=1 (e∆2)k−1ek(λ + 1)−βkRk ∞ ∑ k=1(cid:16)e2∆2(λl + 1)−βR(cid:17)k . ∆ . Using ln(x + 1) ≥ x/2 for any ln(cid:16)e2∆2(λl + 1)−βR(cid:17) = 2 + 2 ln ∆ − β ln(λl + 1) + ln R ∆ ≤ 2 + 2 ln ∆ − 3(ln ∆)2 · (ln ∆)4 2∆ + ln R Therefore (ln ∆)2 6 + 2 + ln 2 = 2 ln ∆ − < −1. which proves Equation (15). Equation (16) ≤(cid:12)(cid:12)γ∗(cid:12)(cid:12) ∞ ∑ k=1 e−k = 1 e − 1(cid:12)(cid:12)γ∗(cid:12)(cid:12) <(cid:12)(cid:12)γ∗(cid:12)(cid:12), 18 (cid:3) α,α,β. Lemma 33. For all sufficiently large integers ∆ and λl < λ < 1, there is an FPTAS for Z(G, λ) for all G ∈ G ∆ Proof. This can be readily obtained by replacing facts used in the proof of Lemma 25 with corre- sponding results obtained in this section. (cid:3) 5. COUNTING COLORINGS Throughout this section, we consider integers q ≥ 3, ∆ ≥ 100q10 and set parameters s, α, β to be We define a set G ∆ q,s,α,β of graphs as q,s,α,β =nG ∈ G ∆ G ∆ Lemma 34. For q ≥ 3 and ∆ ≥ 100q10, lim n→∞ s = ∆1/2 . 3 1 ∆1/2 , β = 1 18q5 , α = α,β : G has the (s, α/q)-cover propertyo . n,∆hG ∈ G ∆ q,s,α,βi = 1. Proof. Recall that s = 1 18q5 , α = 1 3 . It suffices to show that Pr G∼Gbip ∆1/2 and β = ∆1/2 n,∆hG ∈ G ∆ α,βi = 1, (17) (18) lim n→∞ lim n→∞ Pr G∼Gbip Pr G∼Gbip n,∆ [G has the (s, α/q)-cover property] = 1. First we verify that the conditions in Lemma 4 are satisfied and then Equation (17) follows. Let f (∆) = ∆ − H(α)+H(αβ) H(α)−αβH(1/β). It follows from Lemma 10 that H(1/∆1/2) − 1/3H(3/∆1/2) ≥ 1/∆1/2(cid:16)ln 3 − 1/∆1/2(cid:17) log2 e > 1.2/∆1/2 for any ∆ ≥ 4. Then f (∆) ≥ ∆ − H(1/100) + H(1/3) H(1/∆) − 1/3H(3/∆) ≥ 0.1∆ > 0 for any ∆ ≥ 100. Then we show that Equation (18) is satisfied. It is equivalent to show that [G does not have the (s, α/q)-cover property] = 0. lim n→∞ Pr G∼Gbip n,∆ Assume that a ∆-regular bipartite graph G = (L, R, E) with n vertices on both sides does not have the (s, α/q)-cover property. Then there is a pair (U, V) with U ⊆ L, V ⊆ R or U ⊆ R, V ⊆ L that U = ⌈sn⌉, V = ⌈α/qn⌉ and N(U) ∩ V = ∅. Thus (19) [G does not have the (s, α/q)-cover property] Pr G∼Gbip n,∆ ≤ 2 ∑ ∑ U⊆L:U=⌈sn⌉ V⊆R:V=⌈α/qn⌉ Pr G∼Gbip n,∆ [N(U) ∩ V = ∅] . Using Lemma 12 and the perfect matching generation procedure of the distribution G bip n,∆, we obtain Equation (19) ≤ 2(cid:18) n ⌈sn⌉(cid:19)(cid:18) n ⌈α/qn⌉(cid:19)(cid:18)(cid:18)n − ⌈α/qn⌉ ⌈sn⌉ (cid:19)(cid:30)(cid:18) n ⌈sn⌉(cid:19)(cid:19)∆ . 19 Recall that s = 1 18q5 and α = 1 ∆1/2 . It then follows from Lemma 8 that Equation (19) ≤ 2 · 2(cid:16)H(s)+H( α ≤ 2(n + 1)∆ ·(cid:18)2 1 − α/q(cid:19)(cid:18)1 − 1 + ∆(cid:18)H(cid:18) q +o(1)(cid:17)n−(H(s)+o(1))n(n + 1)(cid:19)∆ 1−α/q(cid:17)+o(1)(cid:17)(cid:16)1− α q(cid:17)−H(s)+o(1)(cid:17)(cid:19)n q )+o(1)(cid:17)n(cid:18)2(cid:16)H(cid:16) s 1+∆(cid:16)H(cid:16) s 1−α/q(cid:17)(cid:16)1− α q(cid:19) − H(s) + o(1)(cid:19) ≤ 1 − ∆ (sα/q log2 e + o(1)) α s for all sufficiently large n. Using Lemma 11 we obtain ≤ 1 − 100q10 1 18q5 /q log2 e/2 25q3 9 log2 e ≤ 1 − < 1/C for some constant C > 1 and for all sufficiently large n. Therefore Equation (19) ≤ 2(n + 1)∆C−n → 0 as n → ∞. (cid:3) In the rest of this section, whenever possible, we will simplify notations by omitting super- scripts, subscripts and brackets with the symbols between (but this will not happen in the state- ment of lemmas and theorems). For example, C(G) may be written as C if G is clear from context. 5.1. Approximating C(G). For all q ≥ 3, ∆ ≥ 3, G = (L, R, E) ∈ G ∆ q,s,α,β and ∅ ( X ( [q], we define CX(G) = {σ ∈ C(G) : dX(σ) < αn} L R ([q] \ X)(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12)σ−1 where dX(σ) =(cid:12)(cid:12)(cid:12)σ−1 (X)(cid:12)(cid:12)(cid:12) (recall that σL = σL and σR = σR). The main result of this subsection is that we can use ∑X: X∈{q,q} CX(G) to approximate C(G). Lemma 35. For q ≥ 3 and ∆ ≥ 100q10, there are constants C = C(q) > 1 and N = N(q) such that q,s,α,β with n > N vertices on both sides, Z is a C−n-relative approximation to C(G), where for all G ∈ G ∆ Z = (q q)(cid:12)(cid:12)(cid:12)C[q](G)(cid:12)(cid:12)(cid:12) if q is even, otherwise Z = (q q)(cid:16)(cid:12)(cid:12)(cid:12)C[q](G)(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12)C[q](G)(cid:12)(cid:12)(cid:12)(cid:17). Proof. Let N1, C1, N2, C2 and N3, C3 be the constants in Lemma 36, Lemma 37 and Lemma 38, re- spectively. It follows from these lemmas that 2 + C−n for all n > max(N1, N2, N3). It is clear that exp(−(C−n 1 + C−n 3 ))Z ≤ C ≤ exp(C−n 1 + C−n 2 + C−n 3 )Z C−n 1 + C−n 2 + C−n 3 ≤ 3 min(C1, C2, C3)−n =(cid:18) min(C1, C2, C3) 31/n (cid:19)−n < C−n for another constant C = C(q) > 1 and for all n > N ≥ max(N1, N2, N3) where N = N(q) is another sufficiently large constant. Therefore we obtain for all n > N. exp(−C−n)Z ≤ C ≤ exp(C−n)Z 20 (cid:3) Lemma 36. For q ≥ 3 and ∆ ≥ 100q10, there are constants C = C(q) > 1 and N = N(q) such that for all G ∈ G ∆ C(G). Proof. For any coloring ω, let q,s,α,β with n > N vertices on both sides,(cid:12)(cid:12)(cid:12)SX: ∅(X([q] CX(G)(cid:12)(cid:12)(cid:12) is a C−n-relative approximation to L R maj(ω) =nc ∈ [q] : (cid:12)(cid:12)(cid:12)ω−1(c)(cid:12)(cid:12)(cid:12) ≥ sno . Fix σ ∈ C. If maj(σL) ∩ maj(σR) 6= ∅, then there exists a color c ∈ [q] that(cid:12)(cid:12)(cid:12)σ−1 (c)(cid:12)(cid:12)(cid:12) ≥ sn and (cid:12)(cid:12)(cid:12)σ−1 (c)(cid:12)(cid:12)(cid:12) ≥ sn. Since(cid:12)(cid:12)(cid:12)σ−1 (c)(cid:12)(cid:12)(cid:12) ≥ sn, it follows from the cover property that(cid:12)(cid:12)(cid:12)N(σ−1 (c))(cid:12)(cid:12)(cid:12) > (1 − α/q)n. Since σ is proper, then(cid:12)(cid:12)(cid:12)σ−1 (c)(cid:12)(cid:12)(cid:12) ≤ n −(cid:12)(cid:12)(cid:12)N(σ−1 (c))(cid:12)(cid:12)(cid:12) < α/qn < sn, which contradicts that (cid:12)(cid:12)(cid:12)σ−1 (c)(cid:12)(cid:12)(cid:12) ≥ sn. Therefore, maj(σL)∩ maj(σR) = ∅ for any σ ∈ C. Let B = {σ ∈ C : σ 6∈ ∪XCX}. We dX(σ) =(cid:12)(cid:12)(cid:12)σ−1 ([q] \ X)(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12)σ−1 (X)(cid:12)(cid:12)(cid:12) = ∑ c∈maj(σR)(cid:12)(cid:12)(cid:12)σ−1 (c)(cid:12)(cid:12)(cid:12) + ∑ c∈maj(σL)(cid:12)(cid:12)(cid:12)σ−1 (c)(cid:12)(cid:12)(cid:12) c∈maj(σL)(cid:16)n −(cid:12)(cid:12)(cid:12)N(σ−1 (c))(cid:12)(cid:12)(cid:12)(cid:17) + ∑ c∈maj(σR)(cid:16)n −(cid:12)(cid:12)(cid:12)N(σ−1 R claim that maj(σL) + maj(σR) ≤ q − 1 for any σ ∈ B. Suppose that maj(σL) + maj(σR) = q for some σ. Let X = maj(σL). Then we have (c))(cid:12)(cid:12)(cid:12)(cid:17) ≤ ∑ < αn. R R R R L L L L L L By definition σ ∈ CX(G) and thus σ /∈ B. least once. We give an upper bound of B via the following procedure which enumerates each σ ∈ B at a) Recall that maj(σL) ⊔ maj(σR) ≤ q − 1 for any σ ∈ B. Thus we enumerate two sets A, B ⊆ [q] such that A ⊔ B = q − 1. Clearly, there are at most q2q ways to enumerate such sets. b) Assume that A and B have been enumerated out. Then we enumerate colorings σ ∈ B with maj(σL) ⊆ A and maj(σR) ⊆ B. To this end, we can enumerate σL and σR independently and combine them together. c) Consider σL with maj(σL) ⊆ A. Clearly,(cid:12)(cid:12)(cid:12)σ−1 L ([q] \ A)(cid:12)(cid:12)(cid:12) ≤ (q − A)sn. Thus we enumerate ⌊(q−A)sn⌋ ) ≤ n ) ways to enumerate such a set. a set Lminor ⊆ L with size ⌊(q − A)sn⌋. Since qs ≤ 1/2, there are at most ( ( n ⌊qsn⌋ σ−1 L orings σL with maj(σL) ⊆ A. Analogously, there are at most ( n ⌊qsn⌋ enumerate colorings σR with maj(σR) ⊆ B. d) Assume that Lminor has been enumerated out. Then we count colorings σ ∈ B with ([q] \ A) ⊆ Lminor. The number of such colorings is upper bounded by q(q−A)snAn. )q(q−A)snAn ways to enumerate col- e) Putting c) and d) together, there are at most ( n )q(q−B)snBn ways to f) Combining all the previous steps, we obtain that ⌊qsn⌋ B ≤ q2q(cid:18) n ⌊qsn⌋(cid:19)2 q(2q−A−B)snAnBn ≤ q2q4H(qs)nq(q+1)snqn(q − 1)n, where the inequality follows from Lemma 12. 21 Clearly ∪XCX ≥ qnqn and we obtain (20) B ∪XCX ≤ q2q(cid:16)4H(qs)q(q+1)s(1 − 1/q)(cid:17)n . Recall that s = 1 q ≥ 2 we obtain (21) 4H(qs)q(q+1)s(1 − 1/q) ≤ 16 18q5 . It holds that qs ≤ 1 9q4 . Using Lemma 8, ln(1 + x) ≤ x for any x > −1 and 1 18q5 (1 − 1/q) ln q 18q5 − 1 ln q 9q4 + 1 9 × 4 q(cid:19) 18 × 8 − 1(cid:19) 1 q(cid:19) + + 1 3q2 q 1 9q4 + 1 ≤ exp(cid:18) ln 16 3q2 + ≤ exp(cid:18)(cid:18) ln 16 2q(cid:19) < exp(cid:18)− 3 × 2 1 < 1/C1 for some constant C1 = C1(q) > 1. Therefore, Equation (20) ≤ q2qC−n 1 = C1 (q2q)1/n!−n < C−n for another constant C = C(q) > 1 and n > N where N = N(q) is a sufficiently large constant. Using the upper bound on Equation (20) and 1 + x ≤ exp(x) for any x ∈ R we obtain ∪XCX ≤ C = ∪XCX + B ≤ exp(C−n)∪XCX for all n > N. Lemma 37. For q ≥ 3 and ∆ ≥ 100q10, there are constants C = C(q) > 1 and N = N(q) such that for q,s,α,β with n > N vertices on both sides, ∑X: ∅(X([q] CX(G) is a C−n-relative approximation to all G ∈ G ∆ (cid:3) (cid:12)(cid:12)(cid:12)SX: ∅(X([q] CX(G)(cid:12)(cid:12)(cid:12). ([q] \ (X ∩ Y))(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12)σ−1 (cid:12)(cid:12)(cid:12)σ−1 R L Proof. Fix two sets ∅ ( X 6= Y ( [q]. Clearly, X ∩ Y + [q] \ (X ∪ Y) ≤ (max(X, Y) − 1) + (q − max(X, Y)) = q − 1. For any σ ∈ CX ∩ CY, it holds that L (X ∪ Y)(cid:12)(cid:12)(cid:12) ≤(cid:16)(cid:12)(cid:12)(cid:12)σ−1 =(cid:16)(cid:12)(cid:12)(cid:12)σ−1 L < 2αn. L ([q] \ X)(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12)σ−1 ([q] \ X)(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12)σ−1 R R ([q] \ Y)(cid:12)(cid:12)(cid:12)(cid:17) +(cid:16)(cid:12)(cid:12)(cid:12)σ−1 (X)(cid:12)(cid:12)(cid:12)(cid:17) +(cid:16)(cid:12)(cid:12)(cid:12)σ−1 (X)(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12)σ−1 ([q] \ Y)(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12)σ−1 R R L (Y)(cid:12)(cid:12)(cid:12)(cid:17) (Y)(cid:12)(cid:12)(cid:12)(cid:17) This shows that for σ ∈ CX ∩ CY most of the vertices in L are colored using colors from X ∩ Y and most of the vertices in R are colored using colors from [q] \ (X ∪ Y). According to this, we can upper bound CX ∩ CY via the following procedure which enumerates each σ ∈ CX ∩ CY at least once. First we enumerate a set B ⊆ L ∪ R with B = ⌊2αn⌋. Then the vertices in B can be colored arbitrarily, but the vertices in L \ B can only be colored with colors from X ∩ Y and the vertices in R \ B can only be colored with colors from [q] \ (X ∪ Y). Thus we obtain CX ∩ CY ≤(cid:18) 2n ⌊2αn⌋(cid:19)q2αnX ∩ Yn[q] \ (X ∪ Y)n ≤(cid:16)4H(α)q2αq(q − 1)(cid:17)n , 22 where the inequality follows from Lemma 12 and X ∩ Y + [q] \ (X ∪ Y) ≤ q − 1. It is clear that ∪XCX ≥ qnqn and we obtain CX ∩ CY ∪XCX ≤(cid:16)4H(α)q2α(1 − 1/q)(cid:17)n ∆1/2 ≤ 1 . 10q5 . Since α ≤ qs ≤ 1/2 and 2α ≤ (q + 1)s, it follows from the Recall that s = 1 upper bound on Equation (21) that 18q5 and α = 1 for some constant C1 = C1(q) > 1. Therefore 4H(α)q2α(1 − 1/q) ≤ 4H(qs)q(q+1)s(1 − 1/q) < 1/C1 (22) ∑X6=Y CX ∩ CY ∪XCX ≤ 4qC−n 1 ≤(cid:18) C1 4q/n(cid:19)−n < C−n for another constant C = C(q) > 1 and n > N where N = N(q) is a sufficiently large constant. Using the upper bound on Equation (22) and 1 + x ≤ exp(x) for any x ∈ R we obtain ∪XCX ≤ ∑ X CX ≤ ∪XCX + ∑ X6=Y CX ∩ CY ≤ exp(C−n)∪XCX (cid:3) for all n > N. Lemma 38. For q ≥ 3 and ∆ ≥ 100q10, there are constants C = C(q) > 1 and N = N(q) such that q,s,α,β with n > N vertices on both sides, Z is a C−n-relative approximation to ∑X: ∅(X([q] for all G ∈ G ∆ CX(G), where Z = (q Proof. It follows from the symmetry of colors that CX = CY for any X and Y with X = Y. Fix Y with Y < q or Y > q. We upper bound CY via the following procedure which enumerates each coloring σ ∈ CY at least once. For each σ ∈ CY, it holds that dY(σ) < αn. Thus we can enumerate a set B ⊆ L ∪ R with B = ⌊αn⌋. The vertices in B can be colored arbitrarily, but the colors of the vertices in L \ B can only be chosen from Y and the vertices in R \ B can only be colored with colors from [q] \ Y. Thus we obtain q)(cid:12)(cid:12)(cid:12)C[q](G)(cid:12)(cid:12)(cid:12) if q is even, otherwise Z = (q q)(cid:16)(cid:12)(cid:12)(cid:12)C[q](G)(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12)C[q](G)(cid:12)(cid:12)(cid:12)(cid:17). CY ≤(cid:18) 2n ⌊αn⌋(cid:19)qαnYn[q] \ Yn ≤(cid:16)4H(α/2)qα(q − 1)(q + 1)(cid:17)n , where the inequality follows from Lemma 12 and Y · [q] \ Y ≤ (q − 1)(q + 1). Clearly Z ≥ qnqn and we obtain CY Z ≤(cid:16)4H(α/2)qα(1 − 1/q)(1 + 1/q)(cid:17)n ∆1/2 ≤ 1 Recall that α = 1 10q5 . Using Lemma 8, ln(1 + x) ≤ x for any x > −1 and q ≥ 2 we obtain 4H(α/2)qα(1 − 1/q2) ≤ 16 1 q2√20q q . ≤(cid:16)4H(α/2)qα(1 − 1/q2)(cid:17)n q2! + 1 ln q 10q5 − 1 + 10 × 4 − 1(cid:19) 1 q2(cid:19) 1 10q5 (1 − 1/q2) ≤ exp ln 16 q2p20q ≤ exp(cid:18)(cid:18) ln 16 √20 × 2 ≤ exp(cid:18)− 2q2(cid:19) 1 < 1/C1 23 for some constant C1 = C1(q) > 1. Therefore ∑Y: Y<q∨Y>q CY (23) Z ≤ 2qC−n 1 ≤(cid:18) C1 2q/n(cid:19)−n < C−n for another constant C = C(q) > 1 and n > N where N = N(q) is a sufficiently large constant. Using the upper bound on Equation (23) and 1 + x ≤ exp(x) for any x ∈ R we obtain Z ≤ ∑ X CX = Z + ∑ Y: Y<q∨Y>q CY ≤ exp(C−n)Z for all n > N. (cid:3) 5.2. Approximating CX(G). In this subsection, we discuss how to approximate CX(G) for G = q,s,α,β and X ⊆ [q] with X ∈ nq, qo. We will use the polymer model (see Sec- (L, R, E) ∈ G ∆ tion 2.3). First we constructively define the polymers we need. For any σ ∈ CX(G), let U = {v ∈ L : σ(v) 6∈ X} ∪ {v ∈ R : σ(v) 6∈ [q] \ X}. We can partition the graph (G2)[U] into con- nected components U1, U2, . . . , Uk for some k ≥ 0. There are no edges in G2 between Ui and Uj for any 1 ≤ i 6= j ≤ k. If k > 0, let p(σ) = {(U1, σU1 ) , (U2, σU2 ) , . . . , (Uk, σUk )}. If k = 0, let p(σ) = ∅. We define the set of all polymers to be Γ∗X(G) = [σ∈CX (G) p(σ), and each element in this set is called a polymer. When the graph G and X are clear from the context, we simply denote by Γ∗ the set of polymers. For each polymer γ ∈ Γ∗, define its weight function w(γ, ·) as where z is a complex variable and w(γ, z) = Cγ(G) Xn (q − X)n zγ, Cγ(G) = {σ ∈ CX(G) : σγ = ωγ ∧ σ(L \ γ) ⊆ X ∧ σ(R \ γ) ⊆ [q] \ X} . The number of colorings in Cγ(G) can be computed in polynomial time in γ since N(γ) ≤ βγ and Cγ(G) = ∏ X \ ωγ(N(v) ∩ V(γ))! ∏ ([q] \ X) \ ωγ(N(v) ∩ V(γ))! , v∈L v∈R where V(γ) is the set of vertices of the subgraph γ. The partition function of the polymer model (Γ∗, w) on the graph G2 is the following sum: Ξ(z) = ∑ Γ∈S (Γ∗) w(γ, z). ∏ γ∈Γ Recall that two polymers γ1 and γ2 are compatible if dG2 (γ1, γ2) > 1 and this condition is equiva- lent to dG(γ1, γ2) > 2. We also extend the definition of Cγ(G) to Γ ∈ S(Γ∗(G)): CΓ(G) =(cid:8)σ ∈ CX(G) : σΓ = ωΓ ∧ σ(L \ Γ) ⊆ X ∧ σ(R \ Γ) ⊆ [q] \ X(cid:9) . Lemma 39. For q ≥ 3, all bipartite graphs G = (L, R, E) with n vertices on both sides and ∅ ( X ( [q], (24) w(γ, 1). ∑ CX(G) = Xn(q − X)n Γ∈S (Γ∗X(G)):Γ<αn 24 ∏ γ∈Γ Proof. Rewrite the right hand side of Equation (24) as RHS = ∑ Γ∈S (Γ∗):Γ<αn Xn(q − X)n ∏ γ∈Γ w(γ, 1) = ∑ Γ∈S (Γ∗):Γ<αn CΓ, where the last step follows from Lemma 41. It is now sufficient to show that the set P ,(cid:8)CΓ : Γ ∈ S(Γ∗) ∧(cid:12)(cid:12)Γ(cid:12)(cid:12) < αn(cid:9) is a partition of CX. It follows from the definition of CΓ that CΓ1 ∩ CΓ2 = ∅ if Γ1 6= Γ2. For any σ ∈ CX, it follows from the definition of p(σ) that p(σ) is compatible and(cid:12)(cid:12)(cid:12)p(σ)(cid:12)(cid:12)(cid:12) < αn, which shows that p(σ) ∈ P and thus CX ⊆ ∪CΓ∈PCΓ. For any σ ∈ CΓ ∈ P, it follows from the definition (cid:3) of CΓ that dX(σ) < αn, which implies that σ ∈ CX and thus ∪CΓ∈P CΓ ⊆ CX. Lemma 40. For q ≥ 3 and ∆ ≥ 100q10, there are constants C = C(q) > 1 and N = N(q) such that for all G ∈ G ∆ q,s,α,β with n > N vertices on both sides and X ⊆ [q] with X ∈nq, qo, Xn(q − X)nΞ(1) = Xn(q − X)n ∑ Γ∈S (Γ∗X(G)) w(γ, 1) ∏ γ∈Γ is a C−n-relative approximation to CX(G). Proof. Clearly CX ≥ qnqn. Then using Lemma 39 and Lemma 42 we obtain (25) Xn(q − X)nΞ(1) − CX CX ≤ ≤ ∑ Γ∈S (Γ∗):Γ≥αn ∑ Γ∈S (Γ∗):Γ≥αn w(γ, 1) ∏ γ∈Γ (1 − 1/q)(β−1)Γ. To enumerate each Γ ∈ S(Γ∗) with(cid:12)(cid:12)Γ(cid:12)(cid:12) ≥ αn at least once, we first enumerate an integer αn ≤ k ≤ 2n, then we choose k first vertices from L ∪ R and enumerate all possible colorings over these k vertices. Therefore Equation (25) ≤ 2n ∑ k=⌈αn⌉(cid:18)2n k(cid:19)qk(1 − 1/q)(β−1)k ≤ ≤ ≤ 2n ∑ k=⌈αn⌉ 2H(k/(2n))2nqk(1 − 1/q)(β−1)k √2n/kq(1 − 1/q)β−1(cid:17)k √2/αq(1 − 1/q)β−1(cid:17)k 2n ∑ k=⌈αn⌉(cid:16)4 k=⌈αn⌉(cid:16)4 2n ∑ , where the inequalities follow from Lemma 12 and Lemma 8. Recall that α = 1 Let f (∆) = 4 ∆1/2 and β = ∆1/2 3 . √2/αq(1 − 1/q)β−1. Using ∆ ≥ 100q10, q ≥ 2, and the inequality ln(1 + x) ≤ x for any 25 x > −1, we obtain f (∆) ≤ exp(cid:18)√2∆1/4 ln 4 + ln q −(cid:18) ∆1/2 = exp(cid:18)∆1/4(cid:18)√2 ln 4 − ≤ exp ∆1/4 √2 ln 4 − ≤ exp(cid:18)∆1/4(cid:18)√2 ln 4 − √20 ≈ −1.02 < −1, we obtain f (∆) ≤ exp(cid:16)−∆1/4 + ln q + 1/q(cid:17) ≤ exp(cid:16)− ≤ exp(cid:16)− 1 − f (∆) ≤ Equation (25) ≤ f (∆)k ≤ f (∆)αn ∞ ∑ k=⌈αn⌉ 1 1 ∆1/4 3 − 1(cid:19) 1 q(cid:19) q(cid:19) 3q (cid:19) + ln q + qpq! + ln q + q! √10 3 √20(cid:19) + ln q + q(cid:19) . √10q2pq + ln q + 1/q(cid:17) √2 + ln 2 + 1/2(cid:17) √10 × 4 × ≈ exp (−16.7) < 1. 2 3 1 f (∆)−α (1 − f (∆))1/n!−n < C−n Since √2 ln 4 − 2 3 Therefore, we have for some constant C = C(q) > 1 and for all n > N where N = N(q) is a sufficiently large constant. Using the upper bound on Equation (25) and 1 + x ≤ exp(x) for any x ∈ R we obtain CX ≤ Xn(q − X)nΞ(1) = CX +(cid:0)Xn(q − X)nΞ(1) − CX(cid:1) ≤ exp(C−n)CX for all n > N. Lemma 41. For q ≥ 3, all bipartite graphs G = (L, R, E) with n vertices on both sides, ∅ ( X ( [q] and Γ ∈ S(Γ∗X(G)), (26) (cid:3) Xn(q − X)n ∏ γ∈Γ w(γ, 1) = CΓ(G). Proof. For any γ ∈ Γ, let Vγ = γ ⊔ NG(γ). It holds that (27) Cγ(G) w(γ, 1) = = Xn(q − X)n Cγ(G[Vγ]) XVγ∩L(q − X)Vγ∩R , where Cγ(G[Vγ]) is the set of colorings σ ∈ [q]Vγ that is proper in the graph G[Vγ], σγ = ωγ, σ(N(γ) ∩ L) ⊆ X and σ(N(γ) ∩ R) ⊆ [q] \ X. Since Γ is compatible, for any different γ1 ∈ Γ and γ2 ∈ Γ, it holds that dG(γ1, γ2) > 2 and thus Vγ1 ∩ Vγ2 = ∅. Let l = n − (⊔γ∈ΓVγ) ∩ L and r = n − (⊔γ∈ΓVγ) ∩ R. Then we have CΓ(G) = Xl(q − X)r ∏ γ∈ΓCγ(G[Vγ]) = Xn(q − X)n ∏ γ∈Γ = Xn(q − X)n ∏ γ∈Γ 26 Cγ(G[Vγ]) XVγ∩L(q − X)Vγ∩R w(γ, 1), where the first step follows from the definition of Cγ(G[Vγ]), the second step follows from that (cid:3) Vγ1 ∩ Vγ2 = ∅ for any different γ1, γ2 ∈ Γ and the last step follows from Equation (27). Lemma 42. For q ≥ 3, ∆ ≥ 100q10, G ∈ G ∆ q,s,α,β, ∅ ( X ( [q] with X ∈nq, qo and γ ∈ Γ∗(G), As a corollary, for any compatible Γ ⊆ Γ∗(G), w(γ, 1) ≤ (1 − 1/q)(β−1)γ . w(γ, 1) ≤ (1 − 1/q)(β−1)Γ . ∏ γ∈Γ Proof. With out loss of generality, we fix ∅ ( X ( [q] with X = q and the other case (if exist) is symmetric. Fix γ ∈ Γ∗. Since G is an (α, β)-expander and γ ≤ αn, it follows from Lemma 43 that N(γ) ≥ (β − 1)γ. Let l = N(γ) ∩ L and r = N(γ) ∩ R. Then w(γ, 1) = Cγ(G) Xn(q − X)n ≤ qn−l(q − 1)lqn−r(q − 1)r qnqn ≤ (1 − 1/q)l+r ≤ (1 − 1/q)(β−1)γ. For any compatible Γ, it holds that(cid:12)(cid:12)Γ(cid:12)(cid:12) = ∑γ∈Γ γ. Thus ∏ γ∈Γ w(γ, 1) ≤ ∏ γ∈Γ (1 − 1/q)(β−1)γ = (1 − 1/q)(β−1)Γ. (cid:3) Lemma 43. For ∆ ≥ 3 and G = (L, R, E) ∈ G ∆ for all U ⊆ L ∪ R with U ≤ αn. Proof. It follows from the expansion property that α,β with n vertices on both sides, NG(U) ≥ (β − 1)U N(U) = N(U ∩ L) \ U + N(U ∩ R) \ U ≥ (N(U ∩ L) − U ∩ R) + (N(U ∩ R) − U ∩ L) ≥ (βU ∩ L − U ∩ R) + (βU ∩ R − U ∩ L) = (β − 1)U. (cid:3) q,s,α,β and X ⊆ [q] with 5.3. Approximating the partition function of the polymer model. Lemma 44. For q ≥ 3 and ∆ ≥ 100q10, there is an FPTAS for Ξ(1) for all G ∈ G ∆ X ∈nq, qo. Proof. We use the FPTAS in Theorem 5 to design the FPTAS we need. To this end, we generate a graph G2 in polynomial time in G for any G ∈ G ∆ q,s,α,β. We use this new graph G2 as input to the FPTAS in Theorem 5. It is straightforward to verify the first three conditions in Theorem 5, only with the exception that the information of G2 may not be enough because certain connectivity information in G is discarded in G2. Nevertheless, we can use the original graph G whenever needed and thus the first three conditions are satisfied. For the last condition, Lemma 45 verifies (cid:3) it. Lemma 45. There is a constant R > 1 such that for all q ≥ 3, ∆ ≥ 100q10, G ∈ G ∆ X ∈nq, qo, Ξ(z) 6= 0 for all z ∈ C with z < R. q,s,α,β and X ⊆ [q] with 27 Proof. Set R = 2. For any γ ∈ Γ∗, let a(γ) = γ. We will verify that the KP-condition (28) ∑ eγw(γ, z) ≤(cid:12)(cid:12)γ∗(cid:12)(cid:12) γ: γ6∼γ∗ holds for any γ∗ ∈ Γ∗ and any z < R. It then follows from Lemma 6 that Ξ(z) 6= 0 for any z < R. Fix γ∗ ∈ Γ∗. Recall that dG2 (γ, γ∗) ≤ 1 for all γ 6∼ γ∗. Thus there is always a vertex enumerate each γ 6= γ∗ at least once, we can v ∈ γ such that v ∈ γ∗ ⊔ NG2 (γ∗). The number of such vertices v is at most (∆2 + 1)(cid:12)(cid:12)γ∗(cid:12)(cid:12). So to a) first enumerate a vertex v ∈ γ∗ ⊔ NG2 (γ∗); b) then enumerate an integer k from 1 to ⌊αn⌋; c) finally enumerate γ with v ∈ γ and γ = k. Since γ is connected in G2, applying Lemma 7 and using Lemma 42 to bound w(γ, z) we obtain (29) (e∆2)k−1qkek(1 − 1/q)(β−1)kzk. ⌊αn⌋ ∑ k=1 ∑ γ:γ6∼γ∗ Adding some extra nonnegative terms and using z < R, we obtain Recall that β = ∆1/2 3 and ∆ ≥ 100q10. It holds that e2∆2q(1 − 1/q)β−1R = exp(cid:18)2 + 2 ln ∆ + ln q + . ∞ ∑ k=1(cid:16)e2∆2q(1 − 1/q)β−1R(cid:17)k 3q (cid:19) + ln R − ∆1/2 1 q eγw(γ, z) ≤ (∆2 + 1)(cid:12)(cid:12)γ∗(cid:12)(cid:12) (cid:12)(cid:12)γ∗(cid:12)(cid:12) Equation (29) ≤ ∆2 + 1 e∆2 ≤ exp(cid:18)2 + 2 ln 100 + 21 ln q + ≤ exp(cid:18)2 + 2 ln 100 + 21 ln 2 + 1 q 1 2 + ln R − + ln 1.1 − 10 3 10 3 q4(cid:19) 24(cid:19) < 2−10, where the inequalities follow from the monotonicity of corresponding functions. Therefore Equation (29) ≤ which proves Equation (28). ∆2 + 1 e∆2 ∞ ∑ k=1 (cid:12)(cid:12)γ∗(cid:12)(cid:12) 2−10k ≤ 2(cid:12)(cid:12)γ∗(cid:12)(cid:12) 2−10 1 − 2−10 <(cid:12)(cid:12)γ∗(cid:12)(cid:12), (cid:3) 5.4. Putting things together. Using the results from previous parts, we obtain our main result for counting colorings. Theorem 3. For q ≥ 3 and ∆ ≥ 100q10, with high probability (tending to 1 as n → ∞) for a graph chosen uniformly at random from G bip n,∆, there is an FPTAS to count the number of q-colorings. Proof. This theorem follows from Lemma 34 and Lemma 46. (cid:3) Lemma 46. For q ≥ 3 and ∆ ≥ 100q10, there is an FPTAS for C(G) for all G ∈ G ∆ Proof. First we state our algorithm. See Algorithm 2 for a pseudocode description. Fix q ≥ 3 and ∆ ≥ 100q10. The input is a graph G = (L, R, E) ∈ G ∆ q,s,α,β and an approximation parameter ε > 0. The output is a number bZ to approximate C(G). We use Ξ1(z) and Ξ2(z) to denote the partition functions of the polymer models (Γ∗[q](G), w) and (Γ∗[q](G), w), respectively. Let N1, C2, N2, C2 be q,s,α,β. 28 Algorithm 2 Counting colorings for q ≥ 3 and ∆ ≥ 100q10 1: Input: A graph G = (L, R, E) ∈ G ∆ 2: Output: bZ such that exp(−ε)bZ ≤ C(G) ≤ exp(ε)bZ 3: if n ≤ N or ε ≤ 2C−n then q,s,α,β with n vertices on both sides and ε > 0 Exit; Use the brute-force algorithm to computebZ ← C(G); 4: 5: 6: end if 7: ε′ ← ε − C−n; 8: Use the FPTAS in Lemma 44 to obtainbZ1, an ε′-relative approximation to the partition function Ξ(z) at z = 1 of the polymer model (Γ∗[q](G), w). 9: if q is even then 10: 11: else 12: 13: 14: end if the constants in Lemma 35 and Lemma 40, respectively. Let Z = (q function Ξ(z) at z = 1 of the polymer model (Γ∗[q](G), w). q)q2nbZ1; q)(cid:16)qq(cid:17)n(cid:16)bZ1 +bZ2(cid:17); bZ ← (q Use the FPTAS in Lemma 44 to obtain bZ2, an ε′-relative approximation to the partition bZ ← (q q)(cid:12)(cid:12)(cid:12)C[q](G) + C[q](G)(cid:12)(cid:12)(cid:12). These two lemmas show that Z is a C−n Z = (q 2 ≤ 2 min(C1, C2)−n ≤ C−n-relative approximation to C(G) for another constant C > 1 and all n > N ≥ max(N1, N2) where N is another sufficiently large constant. If n ≤ N or ε ≤ 2C−n, we use the brute-force algorithm to compute C(G). If ε > 2C−n, we apply the FPTAS in Lemma 44 with approximation parameter ε′ = ε − C−n to obtain bZ1, an ε′-relative approximation to Ξ1(1). If q is even, then bZ = (q q)q2nbZ1 is the output of the algorithm. Otherwise, we apply again the FPTAS in Lemma 44 with approximation parameter ε′ = ε − C−n to obtain bZ2, an ε′-relative approximation to Ξ2(1). And the output is bZ = (q Then we show that Algorithm 2 is indeed an FPTAS. It is required that the running time of our algorithm is bounded by (n/ε)C3 for some constant C3 and for all n > N3 where N3 is a constant. Let N3 = N. If ε ≤ 2C−n, the running time of the algorithm would be qn ≤ (nCn/q)C3 ≤ (n/ε)C3 If ε > 2C−n, the running time of the algorithm would be (n/ε′)C4 = for sufficient large C3. (n/(ε − C−n))C4 ≤ (2n/ε)C4 ≤ (n/ε)C3 for sufficient large C3, where C4 is a constant from the q)(cid:16)qq(cid:17)n(cid:16)bZ1 +bZ2(cid:17). It is clear that exp(−ε)bZ ≤ C(G) ≤ exp(ε)bZ. q)(cid:12)(cid:12)(cid:12)C[q](G)(cid:12)(cid:12)(cid:12) if q is even, otherwise 1 + C−n (cid:3) FPTAS in Lemma 44. REFERENCES [Bar16] [Bas81] Alexander I. Barvinok. Combinatorics and Complexity of Partition Functions, volume 30 of Algorithms and combinatorics. Springer, 2016. Leonid A. Bassalygo. Asymptotically optimal switching circuits. Problems of Information Transmission, 17(3):206 -- 211, 1981. [BCKL13] Christian Borgs, Jennifer T. Chayes, Jeff Kahn, and L´aszl ´o Lov´asz. Left and right convergence of graphs [BD97] with bounded degree. Random Struct. Algorithms, 42(1):1 -- 28, 2013. Russ Bubley and Martin Dyer. Path coupling: A technique for proving rapid mixing in Markov chains. In Proceedings of the 38th Annual IEEE Symposium on Foundations of Computer Science (FOCS'97), pages 223 -- 231. IEEE, 1997. 29 [BDG+13] Andrei A. Bulatov, Martin E. Dyer, Leslie Ann Goldberg, Mark Jerrum, and Colin McQuillan. The express- ibility of functions on the Boolean domain, with applications to counting CSPs. J. ACM, 60(5):32:1 -- 32:36, 2013. [BDGJ99] Russ Bubley, Martin Dyer, Catherine Greenhill, and Mark Jerrum. On approximately counting colorings of [BS16] small degree graphs. SIAM Journal on Computing, 29(2):387 -- 400, 1999. Alexander I. Barvinok and Pablo Sober ´on. Computing the partition function for graph homomorphisms with multiplicities. J. Comb. Theory, Ser. A, 137:1 -- 26, 2016. [CDM+19] Sitan Chen, Michelle Delcourt, Ankur Moitra, Guillem Perarnau, and Luke Postle. Improved bounds for randomly sampling colorings via linear programming. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2019, San Diego, California, USA, January 6-9, 2019, pages 2216 -- 2234, 2019. Jin-Yi Cai, Andreas Galanis, Leslie Ann Goldberg, Heng Guo, Mark Jerrum, Daniel Stefankovic, and Eric Vigoda. #BIS-hardness for 2-spin systems on bipartite bounded degree graphs in the tree non-uniqueness region. J. Comput. Syst. Sci., 82(5):690 -- 711, 2016. Martin Dyer and Alan Frieze. Randomly coloring graphs with lower bounds on girth and maximum de- gree. Random Structures & Algorithms, 23(2):167 -- 179, 2003. [CGG+16] [DF03] [DFFV06] Martin Dyer, Abraham D Flaxman, Alan M Frieze, and Eric Vigoda. Randomly coloring sparse random graphs with fewer colors than the maximum degree. Random Structures & Algorithms, 29(4):450 -- 465, 2006. [DFHV13] Martin Dyer, Alan Frieze, Thomas P Hayes, and Eric Vigoda. Randomly coloring constant degree graphs. [DFJ02] Random Structures & Algorithms, 43(2):181 -- 200, 2013. Martin E. Dyer, Alan M. Frieze, and Mark Jerrum. On counting independent sets in sparse graphs. SIAM J. Comput., 31(5):1527 -- 1541, 2002. [DGGJ04] Martin E. Dyer, Leslie Ann Goldberg, Catherine S. Greenhill, and Mark Jerrum. The relative complexity of approximate counting problems. Algorithmica, 38(3):471 -- 500, 2004. [DGJ10] Martin E. Dyer, Leslie Ann Goldberg, and Mark Jerrum. An approximation trichotomy for boolean #CSP. [FV17] J. Comput. Syst. Sci., 76(3-4):267 -- 277, 2010. Sacha Friedli and Yvan Velenik. Statistical Mechanics of Lattice Systems: A Concrete Mathematical Introduction. Cambridge University Press, 2017. [GJ12] [GGY17] Andreas Galanis, Leslie Ann Goldberg, and Kuan Yang. Approximating partition functions of bounded- degree boolean counting constraint satisfaction problems. In 44th International Colloquium on Automata, Lan- guages, and Programming, ICALP 2017, July 10-14, 2017, Warsaw, Poland, pages 27:1 -- 27:14, 2017. Leslie Ann Goldberg and Mark Jerrum. Approximating the partition function of the ferromagnetic potts model. J. ACM, 59(5):25:1 -- 25:31, 2012. Leslie Ann Goldberg and Mark Jerrum. A complexity classification of spin systems with an external field. Proceedings of the National Academy of Sciences of the United States of America, 43(112):1316113166, 2015. David Gamarnik and Dmitriy Katz. Correlation decay and deterministic FPTAS for counting colorings of a graph. Journal of Discrete Algorithms, 12:29 -- 47, 2012. [GK12] [GJ15] [GLLZ18] Heng Guo, Chao Liao, Pinyan Lu, and Chihao Zhang. Counting hypergraph colourings in the local lemma regime. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2018, Los Angeles, CA, USA, June 25-29, 2018, pages 926 -- 939, 2018. Andreas Galanis, Daniel Stefankovic, and Eric Vigoda. Inapproximability of the partition function for the antiferromagnetic ising and hard-core models. Combinatorics, Probability & Computing, 25(4):500 -- 559, 2016. [GSVY16] Andreas Galanis, Daniel Stefankovic, Eric Vigoda, and Linji Yang. Ferromagnetic potts model: Refined [GSV16] [Hay03] [HPR18] [HV03] [HV06] [Jer95] #BIS-hardness and related results. SIAM J. Comput., 45(6):2004 -- 2065, 2016. Thomas P Hayes. Randomly coloring graphs of girth at least five. In Proceedings of the 35th Annual ACM Symposium on Symposium on Theory of Computing (STOC'03), pages 269 -- 278. ACM, 2003. Tyler Helmuth, Will Perkins, and Guus Regts. Algorithmic Pirogov-Sinai theory. CoRR, abs/1806.11548, 2018. Thomas P Hayes and Eric Vigoda. A non-markovian coupling for randomly sampling colorings. In Proceed- ings of the 44th Annual IEEE Symposium on Foundations of Computer Science (FOCS'03), pages 618 -- 627. IEEE, 2003. Thomas P Hayes and Eric Vigoda. Coupling with the stationary distribution and improved sampling for colorings and independent sets. The Annals of Applied Probability, 16(3):1297 -- 1318, 2006. Mark Jerrum. A very simple algorithm for estimating the number of k-colorings of a low-degree graph. Random Structures and Algorithms, 7(2):157 -- 166, 1995. 30 [JKP19] [KP86] [LL15] [LY13] [LYZZ17] [Mol04] Matthew Jenssen, Peter Keevash, and Will Perkins. Algorithms for #BIS-hard problems on expander graphs. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2019, San Diego, California, USA, January 6-9, 2019, pages 2235 -- 2247, 2019. R. Koteck ´y and D. Preiss. Cluster expansion for abstract polymer models. Communications in Mathematical Physics, 103(3):491 -- 498, Sep 1986. Jingcheng Liu and Pinyan Lu. FPTAS for #bis with degree bounds on one side. In Proceedings of the Forty- Seventh Annual ACM on Symposium on Theory of Computing, STOC 2015, Portland, OR, USA, June 14-17, 2015, pages 549 -- 556, 2015. Pinyan Lu and Yitong Yin. Improved FPTAS for multi-spin systems. In Proceedings of APPROX-RANDOM, pages 639 -- 654. Springer, 2013. Pinyan Lu, Kuan Yang, Chihao Zhang, and Minshen Zhu. An FPTAS for counting proper four-colorings on cubic graphs. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, Barcelona, Spain, Hotel Porta Fira, January 16-19, pages 1798 -- 1817, 2017. Michael Molloy. The Glauber dynamics on colorings of a graph with high girth and maximum degree. SIAM Journal on Computing, 33(3):721 -- 737, 2004. [MRRW97] M. S. O. Molloy, H. Robalewska, R. W. Robinson, and N. C. Wormald. 1-factorizationss of random regular [MU17] graphs. Random Struct. Algorithms, 10(3):305 -- 321, May 1997. Michael Mitzenmacher and Eli Upfal. Probability and Computing: Randomization and Probabilistic Techniques in Algorithms and Data Analysis. Cambridge University Press, 2017. [MWW09] Elchanan Mossel, Dror Weitz, and Nicolas Wormald. On the hardness of sampling independent sets beyond [PR17] [PS75] [PS76] [Sly10] [SS12] [Vig00] [Wei06] the tree threshold. Probability Theory and Related Fields, 143(3):401 -- 439, 2009. Viresh Patel and Guus Regts. Deterministic polynomial-time approximation algorithms for partition func- tions and graph polynomials. Electronic Notes in Discrete Mathematics, 61:971 -- 977, 2017. S. A. Pirogov and Ya. G. Sinai. Phase diagrams of classical lattice systems. Theoretical and Mathematical Physics, 25(3):1185 -- 1192, Dec 1975. S. A. Pirogov and Ya. G. Sinai. Phase diagrams of classical lattice systems continuation. Theoretical and Mathematical Physics, 26(1):39 -- 49, Jan 1976. Allan Sly. Computational transition at the uniqueness threshold. In 51th Annual IEEE Symposium on Foun- dations of Computer Science, FOCS 2010, October 23-26, 2010, Las Vegas, Nevada, USA, pages 287 -- 296, 2010. Allan Sly and Nike Sun. The computational hardness of counting in two-spin models on d-regular graphs. In 53rd Annual IEEE Symposium on Foundations of Computer Science, FOCS 2012, New Brunswick, NJ, USA, October 20-23, 2012, pages 361 -- 369, 2012. Eric Vigoda. Improved bounds for sampling colorings. Journal of Mathematical Physics, 41(3):1555 -- 1569, 2000. Dror Weitz. Counting independent sets up to the tree threshold. In Jon M. Kleinberg, editor, Proceedings of the 38th Annual ACM Symposium on Theory of Computing, Seattle, WA, USA, May 21-23, 2006, pages 140 -- 149. ACM, 2006. (Chao Liao) CSE, SHANGHAI JIAO TONG UNIVERSITY, NO.800 DONGCHUAN ROAD, MINHANG DISTRICT, SHANG- HAI, CHINA. E-mail address: [email protected] (Jiabao Lin) ITCS, SHANGHAI UNIVERSITY OF FINANCE AND ECONOMICS, NO.100 WUDONG ROAD, YANGPU DISTRICT, SHANGHAI, CHINA. E-mail address: [email protected] (Pinyan Lu) ITCS, SHANGHAI UNIVERSITY OF FINANCE AND ECONOMICS, NO.100 WUDONG ROAD, YANGPU DISTRICT, SHANGHAI, CHINA. E-mail address: [email protected] (Zhenyu Mao) ITCS, SHANGHAI UNIVERSITY OF FINANCE AND ECONOMICS, NO.100 WUDONG ROAD, YANGPU DISTRICT, SHANGHAI, CHINA. E-mail address: [email protected] 31
1612.01748
1
1612
2016-12-06T10:55:34
Deterministic Indexing for Packed Strings
[ "cs.DS" ]
Given a string $S$ of length $n$, the classic string indexing problem is to preprocess $S$ into a compact data structure that supports efficient subsequent pattern queries. In the \emph{deterministic} variant the goal is to solve the string indexing problem without any randomization (at preprocessing time or query time). In the \emph{packed} variant the strings are stored with several character in a single word, giving us the opportunity to read multiple characters simultaneously. Our main result is a new string index in the deterministic \emph{and} packed setting. Given a packed string $S$ of length $n$ over an alphabet $\sigma$, we show how to preprocess $S$ in $O(n)$ (deterministic) time and space $O(n)$ such that given a packed pattern string of length $m$ we can support queries in (deterministic) time $O\left(m/\alpha + \log m + \log \log \sigma\right), $ where $\alpha = w / \log \sigma$ is the number of characters packed in a word of size $w = \Theta(\log n)$. Our query time is always at least as good as the previous best known bounds and whenever several characters are packed in a word, i.e., $\log \sigma \ll w$, the query times are faster.
cs.DS
cs
Deterministic Indexing for Packed Strings Philip Bille∗ [email protected] Inge Li Gørtz∗ [email protected] Frederik Rye Skjoldjensen† [email protected] June 28, 2018 Abstract Given a string S of length n, the classic string indexing problem is to preprocess S into a compact data structure that supports efficient subsequent pattern queries. In the deterministic variant the goal is to solve the string indexing problem without any random- ization (at preprocessing time or query time). In the packed variant the strings are stored with several character in a single word, giving us the opportunity to read multiple charac- ters simultaneously. Our main result is a new string index in the deterministic and packed setting. Given a packed string S of length n over an alphabet σ, we show how to preprocess S in O(n) (deterministic) time and space O(n) such that given a packed pattern string of length m we can support queries in (deterministic) time O (m/α + log m + log log σ) , where α = w/ log σ is the number of characters packed in a word of size w = Θ(log n). Our query time is always at least as good as the previous best known bounds and whenever several characters are packed in a word, i.e., log σ ≪ w, the query times are faster. 1 Introduction Let S be a string of length n over an alphabet of size σ. The string indexing problem is to preprocess S into a compact data structure that supports efficient subsequent pattern queries. Typical queries include existential queries (decide if the pattern occurs in S), reporting queries (return all positions where the pattern occurs), and counting queries (returning the number of occurrences of the pattern). The string indexing problem is a classic well-studied problem in combinatorial pattern matching and the standard textbook solutions are the suffix tree and the suffix array (see e.g., [1, 2, 3, 4]). A straightforward implementation of suffix trees leads to an O(n) preprocessing time and space solution that given a pattern of length m supports existential and counting queries in time O(m log σ) and reporting queries in time O(m log σ + occ), where occ is the number of occurrences of the pattern. The suffix array implemented with additional arrays storing longest common prefixes leads to a solution that also uses O(n) preprocessing time and space while supporting existential and counting queries in time O(m + log n) and reporting queries in time O(m + log n + occ). If we instead combine suffix trees with perfect hashing [5] we obtain O(n) expected preprocessing time and O(n) space, while supporting existential and counting queries in time O(m) and reporting queries in time O(m + occ). The above bounds ∗Supported by the Danish Research Council (DFF -- 4005-00267, DFF -- 1323-00178) and the Advanced Technology Foundation †Supported by the Danish Research Council (DFF -- 1323-00178) 1 hold assuming that the alphabet size σ is polynomial in n. If this is not the case, additional time for sorting the alphabet is required [6]. For simplicity, we adopt this convention in all of the bounds throughout the paper. In the deterministic variant the goal is to solve the string indexing problem without any randomization. In particular, we cannot combine suffix trees with perfect hashing to obtain O(m) or O(m + occ) query times. In this setting Cole et al. [7] showed how to combine suffix trees and suffix array into the suffix tray that uses O(n) preprocessing time and space and supports existential and counting queries in O(m + log σ) time and reporting queries in O(m + log σ + occ) time. Recently, the query times were improved by Fischer and Gawrychowski [8] to O(m + log log σ) and O(m + log log σ + occ), respectively. In the packed variant the strings are given in a packed representation, with several char- acters in a single word [9, 10, 11, 12]. For instance, DNA-sequences have an alphabet of size 4 and are therefore typically stored using 2 bits per character with 32 characters in a 64-bit word. On packed strings we can read multiple characters in constant time and hence poten- tially do better than the immediate Ω(m) or Ω(m + occ) lower bound for existential/counting queries and reporting queries, respectively. In this setting Takagi et al. [12] recently intro- duced the packed compact trie that stores packed strings succinctly and also supports dynamic insertion and deletions of strings. In a static and deterministic setting their data structure implies a linear space and superlinear time preprocessing solution that uses O( m α log log n) and O( m α log log n + occ) query time, respectively. In this paper, we consider the string indexing problem in the deterministic and packed setting simultaneously, and present a solution that improves all of the above bounds. 1.1 Setup and result We assume a standard unit-cost word RAM with word length w = Θ(log n), and a standard instruction set including arithmetic operations, bitwise boolean operations, and shifts. All strings in this paper are over an alphabet Σ of size σ. The packed representation of a string A is obtained by storing α = w/ log σ characters per word thus representing A in O(A log σ/w) words. If A is given in the packed representation we simply say that A is a packed string. Throughout the paper let S be a string of length n. Our goal is to preprocess S into a compact data structure that given a packed pattern string P supports the following queries. Count(P ): Return the number of occurrence of P in S. Locate(P ): Report all occurrences of P in S. Predecessor(P ): Returns the predecessor of P in S, i.e., the lexicographic largest suffix in S that is smaller than P . We show the following main result. Theorem 1. Let S be a string of length n over an alphabet of size σ and let α = w/ log σ be the number of characters packed in a word. Given S we can build an index in O(n) deterministic time and space such that given a packed pattern string of length m we can support Count and Predecessor in time O( m α + log m + log log σ + occ) time. α + log m + log log σ) and Locate in time O( m 2 Compared to the result of Fischer and Gawrychowski [8], Thm 1 is always at least as good and whenever several characters are packed in a word, i.e., log σ ≪ w, the query times are faster. Compared to the result of Takagi et al. [12], our query time is a factor log log n faster. Technically, our results are obtained by a novel combination of previous techniques. Our general tree decomposition closely follows Fischer and Gawrychowski [8], but different ideas are needed to handle packed strings efficiently. We also show how to extend the classic suffix array search algorithm to handle packed strings efficiently. 2 Preliminaries Deterministic hashing and predecessor We use the following results on deterministic hashing and predecessor data structures. Lemma 1 (Ružić [13, Theorem 3]). A static linear space dictionary on a set of k keys can be deterministically constructed in time O(k(log log k)2), so that lookups to the dictionary take time O(1). Fischer and Gawrychowski [8] use the same result for hashing characters. In our context we will apply it for hashing words of packed characters. Lemma 2 (Fischer and Gawrychowski [8, Proposition 7]). A static linear space predecessor data structure on a set of k keys from a universe of size u can be constructed deterministically in O(k) time and O(k) space such that predecessor queries can be answered deterministically in time O(log log u). Suffix tree The suffix tree TS of S is the compacted trie over the n suffixes from the string S. We assume that the special character $ 6∈ Σ is appended to every suffix of S such that each string is ending in a leaf of the tree. The edges are sorted lexicographic from left to right. We say that a leaf represents the suffix that is spelled out by concatenating the labels of the edges on the path from the root to the leaf. In the same way an internal node represents a string that is a prefix of at least one of the suffixes. For a node v in TS, we say that the subtree of v is the tree induced by v and all proper descendants of v. We distinguish between implicit and explicit nodes: implicit nodes are conceptual and refer to the original non branching nodes from the trie without compacted paths. Explicit nodes are the branching nodes in the original trie. When we refer to nodes that are not specified as either explicit or implicit, then we are always referring to explicit nodes. The lexicographic ordering of the suffixes represented by the leafs corresponds to the ordering of the leafs from left to right in the compacted trie. For navigating from node to child, each node has a predecessor data structure over the first characters of every edge going to a child. With the predecessor data structure from Lemma 2 navigation from node to child takes O(log log σ) time and both the space and the construction time of the predecessor data structure is linear in the number of children. Suffix array Let S1, S2, . . . , Sn be the n suffixes of S from left to right. The suffix array SAS of S gives the lexicographic ordering of the suffixes such that SSAS[i] refers to the ith lexicographic greatest suffix of S. This means that for every 1 < i ≤ n we have that SSAS[i−1] is lexicographic smaller than SSAS [i]. For simplicity we let SAS[i] refer to the suffix SSAS [i] and we say that SAS[i] represents the suffix SSAS [i]. Every suffix from S with pattern P as a 3 prefix will be located in a consecutive range of SAS. This range corresponds to the range of consecutive leafs in the subtree spanned by the explicit or implicit node that represents P in TS. We can find the range of SAS where P prefix every suffix by performing binary search twice over SAS. A naïve binary search takes O(m log n) time: We maintain the boundaries, L and R, of the current search interval and in each iteration we compare the median string from the range L to R in SAS, with P , and update L and R accordingly. This can be improved to O(m + log n) time if we have access to additional arrays storing the value of the longest common prefixes between a selection of strings from SAS. We construct the suffix array from the suffix tree in O(n) time. 3 Deterministic index for packed strings In this section we describe how to construct and query our deterministic index for packed strings. This structure is the basis for our result in Thm 1. For short patterns where m < logσ(n) − 1 we store tabulated data that enables us to answer queries fast. We construct the tables in O(n) time and space and answer queries in O(log log σ + occ) time. For long patterns where m ≥ logσ(n) − 1 we use a combination of a suffix tree and a suffix array that we construct in O(n) time and space such that queries take O(m/α + log log n + occ) time. For m ≥ logσ(n) − 1 we have that log log n = log( log n log σ log σ) = log logσ n + log log σ ≤ log(logσ n − 1) + 1 + log log σ ≤ log m + 1 + log log σ. This gives us a query time of O(m/α + log m + log log σ + occ) for the deterministic packed index. We need the following connections between TS and SAS: For each explicit node t in TS we store a reference to the range of SAS that corresponds to the leafs spanned by the subtree of t and for each index in SAS we store a reference to the corresponding leaf in TS that represents the same string. We first describe our word accelerated algorithm for matching patterns in SAS that we need for answering queries on long patterns. Then we describe how to build and use the data structures for answering queries on short and long patterns. 3.1 Packed matching in SAS We now show how to word accelerate the suffix array matching algorithm by Manber and Myers [2]. They spend O(m) time reading P but by reading α characters in constant time we can reduce this to O(m/α). We let LCP(i, j) denote the length of the longest common prefix between the suffixes SAS[i] and SAS[j] and obtain the result in Lemma 3. Lemma 3. Given the suffix array SAS over the packed string S and a data structure for answering the relevant LCP queries, we can find the lexicographic predecessor of a packed pattern P of length m in SAS in O(m/α + log n) time where α is the number of characters we can pack in a word. In the algorithm by Manber and Myers we maintain the left and right boundaries of the current search interval of SAS denoted by L and R and the longest common prefix between SAS[L] and P , and between SAS[R] and P , that we denote by l and r, respectively. Initially the search interval is the whole range of SAS such that L = 1 and R = n. In an iteration we do as follows: If l = r we start comparing SAS[M ] with P from index l + 1 until we find a mismatch and update either L and l, or R and r, depending on whether SAS[M ] is lexicographic larger or smaller than P . Otherwise, when l 6= r, we perform an LCP query that enable us to either 4 w1 w2 i + c′ . . . i − 1 i . . . i + c 000 i + c + 1 . . . i + α − 1 i + α . . . i + c + α 000 i . . . i + c 000..000 . . . 000..000 000 000..000 . . . 000..000 i + c + 1 . . . i + α − 1 101 s1 s2 g Figure 1: Alignment of α characters that extends over a word boundary where c′ = c + 1 − α. The relevant part of the lower word w1 and upper word w2 is combined with bitwise shifts, a bitwise or and the g bits on the right is set to 0. half the range of SAS without reading from P or start comparing SAS[M ] with P from index l + 1 as in the l = r case. When l > r there are three cases: If LCP(L, M ) > l then P is lexicographic larger than SAS[M ] and we set L to M and continue with the next iteration. If LCP (L, M ) < l then P is lexicographic smaller than SAS[M ] and we set R to M and set r to LCP(L, M ) and continue with the next iteration. If LCP (L, M ) = l then we compare SAS[M ] and P from index l + 1 until we find a mismatch. Let that mismatch be at index l + i. If the mismatch means that P is lexicographic smaller than SAS[M ] then we set R to M and set r to l + i − 1 and continue with the next iteration. If the mismatch means that P is lexicographic larger than SAS[M ] then we set L to M and set l to l + i − 1 and continue with the next iteration. Three symmetrical cases exists when r > l. We generalize their algorithm to work on word packed strings such that we can compare α characters in constant time. In each iteration where we need to read from P we align the next α characters from P and SAS[M ] such that we can compare them in constant time: Assume that we need to read the range from i to i + α − 1 in P . If this range of characters is contained in one word we do not need to align. Otherwise, we extract the relevant parts of the words that contain the range with bitwise shifts and combine them in walign with a bitwise or. See Figure 1. We align the α characters from SAS[M ] in the same way and store them in w′ align. align to construct a word where the most significant set bit is at a bit position that belong to the mismatching character with the lowest index. We obtain the position of the most significant set bit in constant time with the technique of Fredman and Willard [14]. From this we know exactly how many of the next α characters that match and we can increase i accordingly. Since every mismatch encountered result in a halving of the search range of SAS we can never read more than O(log n) incomplete chunks. The number of complete chunks we read is bounded by O(m/α). Overall we obtain a O(m/α + log n) time algorithm for matching in SAS. This result is summarized in Lemma 3. We use a bitwise exclusive or operation between walign and w′ 3.2 Handling short patterns Now we show how to answer count, locate and lexicographic predecessor queries on short patterns. We store an array containing an index for every possible pattern P where m < logσ(n) − 1 and at the index we store a pointer to the deepest node in TS that prefix P . We call this node dP . We use dP as the basis for answering every query on short patterns. We assume that the range in SAS spanned by dP goes from l to r. We answer predecessor queries as follows: If P is lexicographic smaller than SAS[0] then P has no predecessor in SAS. 5 Otherwise, we find the predecessor as follows: If dP is representing P then the predecessor of P is located at index l − 1 of SAS. Otherwise, we assume that dP prefix P with i characters and need to decide whether P continues on an edge out of dP or P deviates from TS in dP . We do this by querying the predecessor data structure over the children of dP with character i + 1 of P . If this query does not return an edge, then P [i + 1] is lexicographic smaller than the first character of every edge out of dP , and the predecessor of P is the string located at index l − 1 of SAS. If this query returns an edge epred then there are two cases. Case 1: The first character of epred is not identical to P [i + 1]. Then the predecessor of P is the lexicographic largest string in the subtree under epred. Case 2: The first character on epred is identical to P [i + 1]. In this case, if there exists an pred out of dP on the left side of epred, then the predecessor of P is the lexicographic pred and otherwise the predecessor is the string at index edge e′ largest string in the subtree under e′ l − 1 of SAS. We report the node in TS that represents the predecessor of P . We let epred be defined as above and answer count queries as follows: If dP represents P we return the number of leafs spanned by dP in TS. If P instead continues and ends on epred we report the number of leafs spanned by the subtree below epred. We answer locate queries in the same way but instead of reporting the range we report the strings in the range. We find dP in O(1) time and epred in O(log log σ) time. In total we answer predecessor and count queries in O(log log σ) time and locate queries in O(log log σ + occ) time Since m < logσ(n) − 1 there exists σ + σ2 + . . . + σ⌊logσ(n)−1⌋ ≤ σ⌊logσ(n)⌋ ≤ σlogσ n = n short patterns and we compute them in O(n) time by performing a preorder traversal of TS bounded to depth logσ(n) − 1. Let dP be the node we are currently visiting and let dnext be the node we visit next. When we visit dP we fill the tabulation array for every string that is lexicographic larger or equal to the string represented by dP and lexicographic smaller than the string represented by dnext. We fill each of these indices with a pointer to dP since dP is the deepest node in TS that represents a string that prefix these strings. We can store the tabulation array in O(n) space. 3.3 Handling long patterns Now we show how to answer count, locate and lexicographic predecessor queries on long patterns. We first give an overview of our solution followed by a detailed description of the individual parts. In TS we distinguish between light and heavy nodes. If a subtree under a node spans at least log2 log n leafs, we call the node heavy, otherwise we call it light. A node is a heavy branching node if it has at least two heavy children and all the heavy nodes constitutes a subtree that we call the heavy tree. We decompose the heavy tree into micro trees of height α and we augment every micro tree with a data structure that enables navigation from root to leaf in constant time. For micro trees containing a heavy branching node we do this with deterministic hashing and for micro trees without a heavy branching node we just compare the relevant part of P with the one unique path of the heavy tree that goes through the micro tree. To avoid navigating the light nodes we in each light node store a pointer to the range of SAS that the node spans. We construct two predecessor data structures for each micro tree: The light predecessor structure over the strings represented by the light nodes that are connected to the heavy nodes in the micro tree and the heavy predecessor structure over the heavy nodes in the micro tree. We answer queries on P as follows: We traverse the heavy tree in chunks of α characters until we are unable to traverse a complete micro tree. This means that P either continues in a light node, ends in the micro tree or deviates from TS in the micro 6 α α α α . . . Figure 2: The decomposition of HTS in micro trees of height α. One micro tree is shown with the root at string depth α and the boundary nodes at string depth 2α tree. We can decide if P continues in a light node with the light predecessor structure and if this is the case we answer the query with the packed matching algorithm on the range of SAS spanned by the light node. Otherwise, we use the heavy predecessor structure for finding dP in the micro tree and use dP for answering the query as in section 3.2. The following sections describes in more detail how we build our data structure and answer queries and gives a time and space . 3.3.1 Data structure This section describes our data structure in details. If a subtree under a node in TS spans at least log2 log n leafs, we call the node heavy. The heavy tree HTS is the induced subgraph of all the the heavy nodes in TS. We decompose HTS into micro trees of string depth α. A node, explicit or implicit, is a boundary node if its string depth is a multiple of α. Except for the original root and leafs of HTS, each boundary node belongs in two micro trees i.e., a boundary node at depth dα is root in a micro tree that starts at string depth dα and is a leaf in a micro tree that starts at string depth (d − 1)α. Figure 2 shows the decomposition of HTS into micro trees of string depth α. We augment every micro tree with information that enables us to navigate from root to leaf in constant time. To avoid using too much space we promote only some of the implicit boundary nodes to explicit nodes. We distinguish between three kinds of micro trees: • Type 1. At least one heavy branching node exists in the micro tree: We promote the root and leafs to explicit nodes and use deterministic hashing to navigate the micro tree from root to leaf. Because the micro tree is of height α, each of the strings represented by the leafs in the micro tree fits in a word and can be used as a key for hashing. We say that the root is a hashing node and the leafs are hashed nodes. We will postpone the analysis of time and space used by the micro trees that use hashing for navigation. • Type 2. No heavy branching node exists in the micro tree: When the micro tree does not contain a heavy branching node, the micro tree is simply a path from root to leaf. Here we distinguish between two cases: 7 -- Type 2a. The micro tree contains a non branching heavy node: We promote the root and leaf to explicit nodes. Navigating from root to leaf takes constant time by comparing the string represented by the leaf with the appropriate part of P . We charge the space increase from the promotion of the root and leaf to the non branching heavy node. Since there are at most n non branching heavy nodes we never promote more than 2n implicit nodes from type 2a micro trees. -- Type 2b. The micro tree does not contain a heavy node: If the root is a boundary node where the micro tree above contains a heavy node we promote the root to an explicit node and store a pointer to the root of the nearest micro tree below that contains a heavy node. The path from root to root corresponds to a substring in S and we navigate by comparing this string to the appropriate part of P . We charge the space increase from the promotion of the root to the heavy node descendant. Since we have at most n heavy nodes we promote no more than n implicit nodes from type 2b micro trees. We ignore every micro tree where the micro tree above does not contain a heavy node. We say that a node in TS is a heavy leaf if it is a heavy node with no heavy children. We want to bound the number of heavy branching nodes and heavy leafs. Every heavy leaf spans at least log2 log n leafs of TS. This means we can have at most n/ log2 log n heavy leafs in TS. Since we have at most one branching heavy node per heavy leafs the number of heavy branching nodes is at most n/ log2 log n. We want to bound the number of implicit nodes that are promoted to explicit hashed nodes. This number is critical for constructing all hash functions in O(n) time. We bound the number of promoted hashed nodes by associating each with the nearest descendant that is either a heavy branching node or a heavy leaf: Let l be a promoted hashed node in a micro tree that contain a heavy branching node h. Then every promoted hashed node above l is associated with h or a node above h in the tree. Hence, no other promoted node can be associated with the first encountered heavy branching or leaf node below l. Since we have at most O(n/ log2 log n) heavy branching and heavy leaf nodes we also have at most O(n/ log2 log n) implicit nodes that are promoted to explicit hashed nodes. With deterministic hashing from Lemma 1 the total time for constructing the explicit hashing nodes are: O Xh∈H h log2 log h! = O Xh∈H h log2 log(n/ log2 log n)! = O log2 log(n/ log2 log n) · Xh∈H h! = O(cid:18)log2 log(n/ log2 log n) n log2 log n(cid:19) = O(n) Here H is the set of all the hash functions and we bound the elements in every hash function h to n/ log2 log n. Summing the elements of every hash function is bounded by the maxi- mum number of promoted nodes, i.e. O(n/ log2 log n). To conclude, we spend linear time constructing the hash functions in the micro trees that contain a heavy branching node. We associate two predecessor data structures with each micro tree that contains a heavy node: The first predecessor structure contains every light node that is a child of a heavy node in the micro tree. We call this predecessor data structure for the light predecessor structure of the micro tree. The key for each light node is the string on the path from the root of 8 the micro tree to the node itself padded with character $ such that every string has length α. These keys are ordered lexicographic in the predecessor data structure and a successful query yields a pointer to the node. The second predecessor structure is similar to the first but contains every heavy node in the micro tree. We call this predecessor structure for the heavy predecessor structure. We use Lemma 2 for the predecessor structures. The total size of every light and heavy predecessor structures is O(n) and a query in both take O(log log n) because the universe is of size (σ + 1)α. For each light node that are a child of a heavy node we additionally store pointers to the range of SAS that corresponds to the leafs in TS that the light node spans. 3.3.2 Answering queries We answer queries on long patterns as follows. First we search for the deepest micro tree in HTS where the root prefix P . We do this by navigating the heavy tree in chunks of α characters starting from the root. Assuming that we have already matched a prefix of P consisting of i chunks of α characters we need to show how to match the (i + 1)th chunk: If the micro tree is of type 1 and P has length at least (i + 1)α, we try to hash the substring P [iα, (i + 1)α]. If we obtain a node v from the hash function we continue matching chunk P [(i + 1)α, (i + 2)α] from v. If the micro tree is of type 2 we compare α sized chunks of P with the string on the unique path from root to the first micro tree with an explicit root and continue matching from here. We have found the deepest micro tree where the root prefix P when we are unable to match a complete chunk of α characters or are unable reach a micro tree with an explicit root. From this micro tree we need to decide whether the query is answered by searching SAS from a light node or answered by finding dP in the micro tree, where dP is defined as in Section 3.2, i.e. the deepest node in TS that prefix P . We check if P continues in a light node by querying the light predecessor structure of the micro tree with the next unmatched α characters from P and pad with character $ if less than α characters remain unmatched in P . If the light node returned by the query represents a string that prefix P we answer the query by searching the range of SAS spanned by the light node with the packed matching algorithm. When P does not continue in a light node we instead find and use dP for answering the query: If the micro tree is of type 2b or the root of the micro tree represents P then dP is the root of the micro tree. Otherwise, we find dP by querying the heavy predecessor structure three times as follows: We call the remaining part of P , padded to length α with character $, for p0. We first query the predecessor structure with p0 which yields a node that represents a string n0. We then construct a string, p1, that consists of the longest common prefix of p0 and n0, and as above, padded to length α. We query the predecessor structure with p1 which yield a new node that represents a string n1. We then construct a string, p2, that consists of the longest common prefix of p0 and n1, again padded to length α. At last, we query the predecessor structure with p2 which returns dP . Given dP , we answer count, locate and lexicographic predecessor queries exactly as we did in section 3.2. Now we prove the correctness of our queries. First we prove that if P continues in a light node then the query in the light predecessor structure returns that light node: Assume that P goes through the light node lP that has a heavy parent in the micro tree Tp and that we query the light predecessor structure with the string Qα. Let Lpred be the string that represents lP in the light predecessor structure. Since P goes through lP then Lpred is identical or lexicographic smaller than Qα. Let L′ pred be the successor of Lpred in the light predecessor structure. Since Lpred is lexicographic smaller than L′ pred and has a longer common prefix 9 dP T1 T2 T3 Figure 3: Searching for a prefix of P in HTS pred has with Qα, then L′ with Qα than L′ is identical or lexicographic larger than Lpred and lexicographic smaller than L′ on Qα in the light predecessor structure will return lP . pred must be lexicographic larger than Qα. Since Qα pred, a query We now prove that the queries in the heavy predecessor structure always returns dP : Because P is not prefixed by a leaf of the micro tree or a light node from the light predecessor structure we know that dP is a heavy node in the micro trie. In Figure 3, dP is depicted and P either ends on or deviates from the edge e that leads to the tree T2. The trees T1, T2 and T3 combined with dP and the edge e constitutes the subtree of dP . If P deviates to the left or ends on e then P is lexicographic smaller than every string represented in T2. If P deviates to the right then P is lexicographic larger than every string represented in T2. Assume that P deviates to the right on e. Then the query to the heavy predecessor structure with pattern p0 will yield n0 that represents the lexicographic largest string in T2. The pattern p1 will then be represented by the implicit node from where P deviates from e. The pattern p1 is lexicographic smaller than every string represented in T2 and a query will yield n2 as the lexicographic largest node in T1 or, if T1 is empty, the node dP . Either way, the query on p2 will yield the node dP . We can make similar arguments for the other cases where P ends on e, deviates left from e, ends at dP or goes through dP without following e. The following gives an analysis of the running time of our queries. We spend at most O(m/α) time traversing the heavy tree. Both predecessor structures contains strings over a universe of size n such that a query takes O(log log n) time using Lemma 2. Each light node spans at most log2 log n leafs which corresponds to an interval of length log2 log n in SAS that we search in O(m/α + log log log n) time with the word accelerated algorithm for matching in SAS. Overall, we spend O(m/α + log log n) time for answering count and lexicographic predecessor queries and O(m/α + log log n + occ) time for answering locate queries. Since we only query this data structure for patterns where m ≥ logσ(n) − 1 we have that log log n = log( log n log σ log σ) = log logσ(n) + log log(σ) ≤ log(logσ(n) − 1) + 1 + log log(σ) ≤ log(m) + 1 + log log(σ), such that we answer count and lexicographic predecessor queries in O(m/α + log m + log log σ) time and locate queries in O(m/α + log m + log log σ + occ) time. Combined with our solution for patterns where m < logσ(n) − 1, that answer the queries in O(log log σ) and O(log log σ + occ) time, respectively, we can for patterns of any length answer count and lexicographic predecessor queries in O(m/α + log m + log log σ) time and locate queries in O(m/α + log m + log log σ + occ) time. This is our main result which is summarized in Thm 1. 10 References [1] Gusfield, D.: Algorithms on strings, trees, and sequences: computer science and compu- tational biology. Cambridge (1997) [2] Manber, U., Myers, G.: Suffix arrays: a new method for on-line string searches. siam Journal on Computing 22(5) (1993) 935 -- 948 [3] McCreight, E.M.: A space-economical suffix tree construction algorithm. J. ACM 23(2) (1976) 262 -- 272 [4] Weiner, P.: Linear pattern matching algorithms. In: Proc. 14th Switching and Automata Theory. (1973) 1 -- 11 [5] Fredman, M.L., Komlós, J., Szemerédi, E.: Storing a sparse table with 0(1) worst case access time. J. ACM 31(3) (1984) 538 -- 544 [6] Farach-Colton, M., Ferragina, P., Muthukrishnan, S.: On the sorting-complexity of suffix tree construction. J. ACM 47(6) (2000) 987 -- 1011 [7] Cole, R., Kopelowitz, T., Lewenstein, M.: Suffix trays and suffix trists: structures for faster text indexing. In: Automata, Languages and Programming. Springer (2006) 358 -- 369 [8] Fischer, J., Gawrychowski, P.: Alphabet-dependent string searching with wexponential search trees. In: Combinatorial Pattern Matching, Springer (2015) 160 -- 171 [9] Bille, P.: Fast searching in packed strings. Journal of Discrete Algorithms 9(1) (2011) 49 -- 56 [10] Ben-Kiki, O., Bille, P., Breslauer, D., Gasieniec, L., Grossi, R., Weimann, O.: Towards optimal packed string matching. Theoret. Comput. Sci. 525 (2014) 111 -- 129 [11] Belazzougui, D.: Worst-case efficient single and multiple string matching on packed texts in the word-RAM model. J. Disc. Algorithms 14 (2012) 91 -- 106 [12] Takagi, T., Inenaga, S., Sadakane, K., Arimura, H.: Packed compact tries: A fast and efficient data structure for online string processing. In: Combinatorial Algorithms: 27th International Workshop, IWOCA 2016, Helsinki, Finland, August 17-19, 2016, Proceed- ings. Volume 9843., Springer (2016) 213 [13] Ružić, M.: Constructing efficient dictionaries in close to sorting time. In: International Colloquium on Automata, Languages, and Programming, Springer (2008) 84 -- 95 [14] Fredman, M.L., Willard, D.E.: Surpassing the information theoretic bound with fusion trees. J. Comput. System Sci. 47(3) (1993) 424 -- 436 11
1110.0583
1
1110
2011-10-04T05:43:28
Algorithms for the strong chromatic index of Halin graphs, distance-hereditary graphs and maximal outerplanar graphs
[ "cs.DS" ]
We show that there exist linear-time algorithms that compute the strong chromatic index of Halin graphs, of maximal outerplanar graphs and of distance-hereditary graphs.
cs.DS
cs
ALGORITHMS FOR THE STRONG CHROMATIC INDEX OF HALIN GRAPHS, DISTANCE-HEREDITARY GRAPHS AND MAXIMAL OUTERPLANAR GRAPHS Ton Kloks1, Sheung-Hung Poon1, Chin-Ting Ung1, and Yue-Li Wang2 National Tsing Hua University, No. 101, Sec. 2, Kuang Fu Rd., Hsinchu, Taiwan 1 Department of Computer Science [email protected], [email protected] 2 Department of Information Management National Taiwan University of Science and Technology No. 43, Sec. 4, Keelung Rd., Taipei, 106, Taiwan [email protected] Abstract. We show that there exist linear-time algorithms that compute the strong chromatic index of Halin graphs, of maximal outerplanar graphs and of distance-hereditary graphs. 1 Introduction Definition 1. Let G = (V, E) be a graph. A strong edge coloring of G is a proper edge coloring such that no edge is adjacent to two edges of the same color. Equivalently, a strong edge coloring of G is a vertex coloring of L(G)2, the square of the linegraph of G. The strong chromatic index of G is the minimal integer k such that G has a strong edge coloring with k colors. We denote the strong chromatic index of G by sχ′(G). Recently it was shown that the strong chromatic index is bounded by (2 − ǫ)∆2 for some ǫ > 0, where ∆ is the maximal degree of the graph [22].3 Earlier, Andersen showed that the strong chromatic index of a cubic graph is at most ten [1]. Let G be the class of chordal graphs, or the class of cocomparability graphs, or the class of weakly chordal graphs. If G ∈ G then also L(G)2 ∈ G and it follows that the strong chromatic index can be computed in polynomial time for these classes [3 -- 5]. Also for graphs of bounded treewidth there exists a polynomial time algorithm that computes the strong chromatic index [24].4 3 In their paper Molloy and Reed state that ǫ > 0.002 when ∆ is sufficiently large. 4 This algorithm checks in O(n(s + 1)t) time whether a partial k-tree has a strong edge coloring that uses at most s colors. Here, the exponent t = 24(k+1)+1. Definition 2. Let T be a tree without vertices of degree two. Consider a plane em- bedding of T and connect the leaves of T by a cycle that crosses no edges of T . A graph that is constructed in this way is called a Halin graph. Halin graphs have treewidth at most three. Furthermore, if G is a Halin graph of bounded degree, then also L(G)2 has bounded treewidth and thus the strong chromatic index of G can be computed in linear time. Recently, Ko-Wei Lih, et al., proved that a cubic Halin graph other than one of the two 'necklaces' Ne2 (the complement of C6) and Ne4, has strong chromatic index at most 7. The two exceptions have strong chromatic index 9 and 8, respectively. If T is the underlying tree of the Halin graph, and if G 6= Ne2 and G is not a wheel Wn with n 6= 0 mod 3, then Ping-Ying Tsai, et al., show that the strong chromatic index is bounded by sχ′(T ) + 3. (See [25, 26] for earlier results that appeared in regular papers.5) If G is a Halin graph then L(G)2 has bounded rankwidth. In [10] it is shown that there exists a polynomial algorithm that computes the chromatic number of graphs with bounded rankwidth, thus the strong chromatic index of Halin graphs can be computed in polynomial time. In passing, let us mention the following result. A class of graphs G is χ-bounded if there exists a function f such that χ(G) 6 f(ω(G)) for G ∈ G. Here χ(G) is the chromatic number of G and ω(G) is the clique number of G. Recently, Dvor´ak and Kr´al showed that for every k, the class of graphs with rankwidth at most k is χ-bounded [8]. Obviously, the graphs L(G)2 have a uniform χ-bound for graphs G in the class of Halin graphs. In Section 2 we show that there exists a linear-time algorithm that com- putes the strong chromatic index of Halin graphs. In Section 3 we show that there exists a linear-time algorithm that computes the strong chromatic index of distance-hereditary graphs. In Section 4 we show that there exists a linear-time algorithm that computes the strong chromatic index of maximal outerplanar graphs. 2 The strong chromatic index of Halin graphs The following lemma is easy to check. Lemma 1 (Ping-Ying Tsai). Let Cn be the cycle with n vertices and let Wn be the wheel with n vertices in the cycle. Then sχ′(Cn) = 3 5 4   if n = 0 mod 3 if n = 5 otherwise sχ′(Wn) = n + 3 n + 5 n + 4   if n = 0 mod 3 if n = 5 otherwise. 5 The results of Ko-Wei Lih and Ping-Ying Tsai, et al., were presented at the Sixth Cross- Strait Conference on Graph Theory and Combinatorics which was held at the National Chiao Tung University in Taiwan in 2011. 2 A double wheel is a Halin graph in which the tree T has exactly two vertices that are not leaves. Lemma 2 (Ping-Ying Tsai). Let W be a double wheel where x and y are the vertices of T that are not leaves. Then sχ′(T ) = d(x) + d(y) − 1 where d(x) and d(y) are the degrees of x and y. Furthermore, sχ′(W) =   sχ′(T ) + 4 = 9 sχ′(T ) + 2 = d(y) + 4 sχ′(T ) + 1 = d(x) + d(y) if d(x) = d(y) = 3, i.e., if W = ¯C6 if d(y) > d(x) = 3 if d(y) > d(x) > 3. Let G be a Halin graph with tree T and cycle C. Then obviously, sχ′(G) 6 sχ′(T ) + sχ′(C). (1) The linegraph of a tree is a claw-free blockgraph. Since a sun Sr with r > 3 has a claw, L(T ) has no induced sun Sr with r > 3. It follows that L(T )2 is a chordal graph [18] (see also [3]; in this paper Cameron proves that L(G)2 is chordal for any chordal graph G). Notice that sχ′(T ) = χ(L(T )2) = ω(L(T )2) 6 2∆(G) − 1 ⇒ sχ′(G) 6 2∆(G) + 4. (2) 2.1 Cubic Halin graphs In this subsection we outline a simple linear-time algorithm for the cubic Halin graphs. Theorem 1. There exists a linear-time algorithm that computes the strong chro- matic index of cubic Halin graphs. Proof. Let G be a cubic Halin graph with plane tree T and cycle C. Let k be a natural number. We describe a linear-time algorithm that checks if G has a strong edge coloring with at most k colors. By Equation (2) we may assume that k is at most 10. Thus the correctness of this algorithm proves the theorem. Root the tree T at an arbitrary leaf r of T . Consider a vertex x in T . There is a unique path P in T from r to x in T . Define the subtree Tx at x as the maximal connected subtree of T that does not contain an edge of P. If x = r then Tx = T . Let H(x) be the subgraph of G induced by the vertices of Tx. Notice that, if x 6= r then the edges of H(x) that are not in T form a path Q(x) of edges in C. For x 6= r define the boundary B(x) of H(x) as the following set of edges. (a) The unique edge of P that is incident with x. (b) The two edges of C that connect the path Q(x) of C with the rest of C. (c) Consider the endpoints of the edges mentioned in (a) and (b) that are in Tx. Add the remaining two edges that are incident with each of these endpoints to B(x). 3 Thus the boundary B(x) consists of at most 9 edges. The following claim is easy to check. It proves the correctness of the algorithm described below. Let e be an edge of H(x). Let f be an edge of G that is not an edge of H(x). If e and f are at distance at most 1 in G then e or f is in B(x).6 Consider all possible colorings of the edges in B(x). Since B(x) contains at most 9 edges and since there are at most k different colors for each edge, there are at most k9 6 109 different colorings of the edges in B(x). The algorithm now fills a table which gives a boolean value for each coloring of the boundary B(x). This boolean value is TRUE if and only if the coloring of the edges in B(x) extends to an edge coloring of the union of the sets of edges in B(x) and in H(x) with at most k colors, such that any pair of edges in this set that are at distance at most one in G, have different colors. These boolean values are computed as follows. We prove the correctness by induction on the size of the subtree at x. First consider the case where the subtree at x consists of the single vertex x. Then x 6= r and x is a leaf of T . In this case B(x) consists of three edges, namely the three edges that are incident with x. These are two edges of C and one edge of T . If the colors of these three edges in B are different then the boolean value is set to TRUE. Otherwise it is set to FALSE. Obviously, this is a correct assignment. Next consider the case where x is an internal vertex of T . Then x has two children in the subtree at x. Let y and z be the two children and consider the two subtrees rooted at y and z. The algorithm that computes the tables for each vertex x processes the sub- trees in order of increasing number of vertices. (Thus the roots of the subtrees are visited in postorder). We now assume that the tables at y and z are computed correctly and show how the table for x is computed correctly and in constant time. That is, we prove that the algorithm described below computes the table at x such that it contains a coloring of B(x) with a value TRUE if and only if there exists an extension of this coloring to the edges of H(x) and B(x) such that any two different edges e and f at distance at most one in G, each one in H(x) or in B(x), have different colors. Consider a coloring of the edges in the boundary B(x). The boolean value in the table of x for this coloring is computed as follows. Notice that (i) B(y) ∩ B(z) consists of one edge and this edge is not in B(x), and (ii) B(x) ∩ B(y) consists of at most four edges, namely the edge (x, y) and the three edges of B(y) that are incident with one vertex of C ∩ H(y). Likewise, B(x) ∩ B(z) consists of at most four edges. 6 Two edges in G are at distance at most one if the subgraph induced by their endpoints is either P3, or K3 or P4. We assume that it can be checked in constant time if two edges e and f are at distance at most one. This can be achieved by a suitable data structure. 4 The algorithm varies the possible colorings of the edge in B(y) ∩ B(z). Colorings of B(x), B(y) and B(z) are consistent if the intersections are the same color and the pairs of edges in B(x) ∪ B(y) ∪ B(z) that are at distance at most one in G have different colors. A coloring of B(x) is assigned the value TRUE if there exist colorings of B(y) and B(z) such that the three colorings are consistent and B(y) and B(z) are assigned the value TRUE in the tables at y and at z respectively. Notice that the table at x is built in constant time. Consider a coloring of B(x) that is assigned the value TRUE. Consider color- ings of the edges of B(y) and B(z) that are consistent with B(x) and that are assigned the value TRUE in the tables at y and z. By induction, there exist exten- sions of the colorings of B(y) and B(z) to the edges of H(y) and H(z). The union of these extensions provides a k-coloring of the edges in H(x). Consider two edges e and f in B(x) ∪ B(y) ∪ B(z). If their distance is at most one then they have different colors since the coloring of B(x) ∪ B(y) ∪ B(z) is consistent. Let e and f be a pair of edges in H(x). If they are both in H(y) or both in H(z) then they have different colors. Assume that e is in H(y) and assume that f is not in H(y). If e and f are at distance at most one, then e or f is in B(y). If they are both in B(y), then they have different colors, due to the consistency. Otherwise, by the induction hypothesis, they have different colors. This proves the claim on the correctness. Finally, consider the table for the vertex x which is the unique neighbor of r in T . By the induction hypothesis, and the fact that every edge in G is either in B(x) or in H(x), G has a strong edge coloring with at most k colors if and only if the table at x contains a coloring of B(x) with three different colors for which the boolean is set to TRUE. This proves the theorem. ⊓⊔ Remark 1. The involved constants in this algorithm are improved considerably by the recent results of Ko-Wei Lih, Ping-Ying Tsai, et al.. 2.2 Halin graphs of general degree Theorem 2. There exists a linear-time algorithm that computes the strong chro- matic index of Halin graphs. Proof. The algorithm is similar to the algorithm for the cubic case. Let G be a Halin graph, let T be the underlying plane tree, and let C be the cycle that connects the leaves of T . Since L(T )2 is chordal the chromatic number of L(T )2 is equal to the clique number of L(T )2, which is sχ′(T ) = max { d(u) + d(v) − 1 (u, v) ∈ E(T ) }, 5 where d(u) is the degree of u in the tree T . By Formula (1) and Lemma 1 the strong chromatic index of G is one of the six possible values7 sχ′(T ), sχ′(T ) + 1, . . . , sχ′(T ) + 5. Root the tree at some leaf r and consider a subtree Tx at a node x of T . Let H(x) be the subgraph of G induced by the vertices of Tx. Let y and z be the two boundary vertices of H(x) in C. We distinguish the following six types of edges corresponding to H(x). 1. The set of edges in Tx that are adjacent to x. 2. The edge that connects x to its parent in T . 3. The edge that connects y to its neighbor in C that is not in Tx. 4. The set of edges in H(x) that have endpoint y. 5. The edge that connects z to its neighbor in C that is not in Tx. 6. The set of edges in H(x) that have endpoint z. When x is adjacent to y then we make a separate type for the edge (x, y) and similar in the case where x is adjacent to z. Notice that the set of edges of every type has bounded cardinality, except the first type. Consider a 0/1-matrix M with rows indexed by the six to eight types of edges and columns indexed by the colors. A matrix entry Mij is 1 if there is an edge of the row-type i that is colored with the color j and otherwise this entry is 0. Since M has at most 8 rows, the rank over GF[2] of M is at most 8. Two colorings are equivalent if there is a permutation of the colors that maps one coloring to the other one. Let S ⊆ {1, . . . , 8} and let W(S) be the set of colors that are used by edges of type i for all i ∈ S. A class of equivalent colorings is fixed by the set of cardinalities { W(S) S ⊆ {1, . . . , 8} }. We claim that the number of equivalence classes is constant. The number of ones in the row of the first type is the degree of x in H(x). Every other row has at most 3 ones. This proves the claim. Consider the union of two subtrees, say at x and x′. The algorithm considers all equivalence classes of colorings of the union, and checks, by table look-up, whether it decomposes into valid colorings of H(x) and H(x′). An easy way to do this is as follows. First double the number of types, by distinguishing the edges of H(x) and H(x′). Then enumerate all equivalence classes of colorings. Each equivalence class is fixed by a sequence of 216 numbers, as above. By table look- up, check if an equivalence class restricts to a valid coloring for each of H(x) and H(x′). Since this takes constant time, the algorithm runs in linear time. This proves the theorem. ⊓⊔ 7 Actually, according to the recent results of Ping-Ying Tsai, et al., the strong chromatic index of G is at most sχ′(T ) + 3 except when G is a wheel or ¯C6. 6 3 Distance-hereditary graphs Definition 3 ([15]). A graph G is distance hereditary if any two nonadjacent vertices in a component of any induced subgraph H are at the same distance in H as they are in the graph G. In other words, any two chordless paths between two nonadjacent vertices is of the same length. Distance-hereditary graphs are exactly the graphs that have rankwidth one [6]. In this section we prove that there is a linear-time algo- rithm that computes the strong chromatic index of distance-hereditary graphs. Distance-hereditary graphs are perfect. They are the graphs without induced gem, house, hole or domino. Cameron proves in [5] that, for k > 4, if G has no induced cycles of length more than four then also L(G)2 has no such induced cycles. It follows that, if G is distance hereditary then L(G)2 is perfect. There- fore, to compute the chromatic number of L(G)2 it suffices to compute the clique number. s ❅❅ s s s s ❅ s s ❅ s s s s s s s s s ❜ s s ❇ ❇ ✂ ❇ ❜ ❜ ✧ ✂ ❇ s s ❅ ✂ ✂ ✧ ❅ ✧ s Fig. 1. A graph is distance hereditary if it has no induced house hole, domino or gem. A pendant vertex in a graph is a vertex of degree one. A twin is a pair of vertices x and y with the same open or the same closed neighborhood. When x and y are adjacent then the twin is called a true twin and otherwise it is called a false twin. A P4 is a path with four vertices. Theorem 3 ([2]). A graph G is distance hereditary if and only if G is obtained from an edge by a sequence of the following operations. (a) Creation a pendant vertex. (b) Creation of a twin. Lemma 3. Let G be a graph and consider the graph G′ obtained from G by creating a false twin x′ of a vertex x in G. Then L(G′)2 is obtained from L(G)2 by a series of true twin operations. Proof. Let a1, . . . , as be the neighbors of x in G. By definition of L(G)2, each edge (x′, ai) is a true twin of the edge (x, ai) in L(G′)2. ⊓⊔ Definition 4. A graph G is a cograph if G has no induced P4. A cograph is obtained from a graph consisting of one vertex by a series of twin operations. Chordal cographs are the graphs without induced P4 and C4. These are also called trivially perfect. 7 Lemma 4. If G is a cograph then L(G)2 is trivially perfect. Proof. A cograph with at least two vertices is either the join or the union of two cographs G1 and G2. Assume that G is the join of two cographs G1 and G2. The set of edges with one endpoint in G1 and the other in G2 are a clique in L(G)2. Furthermore, this set of edges is adjacent to every edge that is contained in Gi for i ∈ {1, 2}. In other words, every component of L(G)2 has a universal vertex, i.e., a vertex adjacent to all other vertices. The graphs that satisfy this property are exactly the graphs in which every component is the comparability graph of a tree and these are exactly the graphs without induced P4 and C4 [27]. ⊓⊔ Notice that Lemma 4 provides a linear-time algorithm for computing the strong chromatic index of cographs. A cotree decomposition can be obtained in linear time. Assume that G is the join of two cographs G1 and G2. Then every edge with both ends in G1 is adjacent in L(G)2 to every edge with both ends in G2. Let X be the set of edges with one endpoint in G1 and the other endpoint in G2. By dynamic programming on the cotree, compute the clique numbers of L(G1)2 and L(G2)2. Add X to the sum of both. If G is the union of G1 and G2 then the strong chromatic index of G is the maximum of the clique numbers of L(G1)2 and L(G2)2. This proves the following theorem. Theorem 4. There exists a linear-time algorithm that computes the strong chro- matic index of cographs. Lemma 5. If G is distance hereditary then every neighborhood in L(G)2 induces a trivially perfect graph. Proof. We prove the theorem by induction on the elimination ordering of G by pendant vertices and elements of twins. First, assume that G′ is obtained from G by creating a false twin x′ of a vertex x in G. By Lemma 3 L(G′)2 is obtained from L(G)2 by a series of true twin operations. In that case the claim follows easily, by induction. Secondly, consider the operation which adds a pendant vertex x′, made adja- cent to a vertex x in G. Let a1, . . . , as be the neighbors of x in G. Notice that the adjacencies of the edge (x, x′) in L(G′)2 are of the following types of edges in G. (a) All edges (x, ai), i ∈ {1, . . . , s}. Call this set of edges X. (b) The edges (ai, aj) ∈ E(G), for i, j ∈ {1, . . . , s}. (c) Edges (ai, u), for i ∈ {1, . . . , s} and u ∈ NG(ai) \ NG[x]. Call two vertices in NG(x) equivalent if they have the same neighbors in the graph G−NG[x]. Since there is no house, hole, domino or gem every equivalence class is joined to or disjoint from every other equivalence class. Let H be the graph with vertex set the set of equivalence classes and edge set the pairs of equivalence classes that are joined. Since G has no gem, the graph H has no induced P4 and so it is a cograph. Furthermore, by Lemma 4 L(H)2 is trivially perfect. 8 Consider the components of G − NG[x]. For any two components C1 and C2 their neighborhoods NG(C1) and NG(C2) are either disjoint or ordered by inclu- sion. First consider the components that have a maximal neighborhood in NG(x) and remove all other components. Consider the equivalence classes defined by these components. The graph on these equivalence classes is a cograph and the square of the linegraph is a chordal cograph. Next, consider such an equivalence class Q with at least two vertices. Remove the components C of G − NG[x] with N(C) = Q. If there are some components left of which the neighborhood is prop- erly contained in Q then partition the vertices of Q into secondary equivalence classes. If there are no more components with their neighborhood contained in Q then define the secondary equivalence classes as sets of single vertices. As above, for each equivalence class Q, the secondary equivalence classes form a cograph HQ. Also, L(HQ)2 is trivially perfect. Continuation of this process de- fines a chordal cotree on the subgraph of L(G)2 induced by the edges of types (b) and (c). Notice that the set X of edges is universal in the neighborhood of (x, x′) in L(G)2. Finally, consider the case where G′ is obtained from G by creating a true twin x′ of a vertex x in G. Subdivide this operation into two steps. First create a false twin. Let G∗ be the graph obtained in this manner. We proved above that every neighborhood in L(G∗)2 is trivially perfect. Secondly, adding the edge (x, x′) to G∗ is similar to the operation of adding a pendant vertex. The set X of edges as described above, now consists of pairs of true twins in L(G)2. The other types of adjacencies of (x, x′), as described in (b) and (c), are the same as above. This proves the lemma. ⊓⊔ Theorem 5. There exists a linear-time algorithm that computes the strong chro- matic index of distance-hereditary graphs. Proof. Let G be distance hereditary. Consider a rank decomposition of G of rankwidth one. This is a pair (T , f) where T is a rooted binary tree and where f is a bijection from the vertices in G to the leaves of T . Consider a subtree Te of T rooted at some edge e of T . Define Ge as the subgraph of G induced by the vertices that are mapped to leaves in Te. Let Se be the set of vertices of Ge that have neighbors in G − V(Ge). The set Se is called the twinset of Ge [6]. All vertices of Se have the same neighbors in G − V(Ge). Consider an edge e of T and let e1 and e2 be the two children of e in T . The graph Ge is obtained from Ge1 and Ge2 by a join or by a union of the twinsets Se1 and Se2 . The twinset Se of Ge is either one of Se1 and Se2 or it is the union of the two [6]. Let e be a line in T with children e1 and e2. Let S1 and S2 be the twinsets of Ge1 and of Ge2 and assume that there is a join between S1 and S2. Let X be the set of edges between S1 and S2. For i ∈ {1, 2} choose a maximal clique Ωi in each L(Si)2 such that the set of end-vertices of edges in Ωi has a maximal number of neighbors in Gei − Si. Let ωi be the number of edges in this maximal clique. Let Ni be this number of neighbors. The algorithm keeps track of the maximal value of X + ω1 + ω2 + N1 + N2. It is easy to see that this algorithm can be implemented to run in linear time. ⊓⊔ 9 4 Maximal outerplanar graphs A maximal outerplanar graph G is a ternary tree T (i.e., every vertex in T has degree at most three) of triangles, where two triangles that are adjacent in the tree share an edge (see e.g., [17]). In [14] Hocquard, et al., prove that for every outerplanar graph G with max- imal degree ∆ > 3, sχ′(G) 6 3(∆ − 1). They also prove, among various other NP-completeness results, that strong edge 4-coloring is NP-complete for planar bipartite graphs with maximal degree three and any fixed girth. Definition 5. An extended triangle in a maximal outerplanar graph consists of a triangle plus all the edges that are incident with some vertex of the triangle. All edges of an extended triangle must be colored different. Let φ be the max- imal number of edges of all extended triangles in G. In the following theorem we prove that there exists a strong edges coloring that uses φ colors. Theorem 6. There exists a linear-time algorithm that computes the strong chro- matic index of maximal outerplanar graphs. Proof. The algorithm colors the edges in a greedy manner as follows. First we make one leaf node of T as the root. Then we traverse T in a breath-first manner. When we reach a node v, we color the uncolored edges of its corresponding extended triangle τ so that the colors used for uncolored edges are different from the colors of those colored edges in τ. As the number of edges of τ is at most φ, φ colors are sufficient to do the coloring of edges in τ. We proceed to color the edges in other extended triangles for other nodes in T via the breath- first search traversal order. At the end of the traversal, we finish the coloring of all edges in G using only φ colors. For the correctness of the algorithm, we argue as follows. It is easy to see that for any two edges of (e, e ′) within distance two, they must both appear in some extended triangle τ which implies that they will obtain different colors when τ is visited in the breadth-first traversal. Hence, the above coloring is thus a strong edge coloring for G, and we obtain that sχ′(G) = φ. ⊓⊔ 5 Concluding remarks If G is a circular-arc graph then L(G)2 is also a circular-arc graph [11]. Unfortu- nately, coloring a circular-arc graph is NP-complete [21]. When G is AT-free then also L(G)2 is AT-free [4]. As far as we know the complexity of coloring AT-free graphs is an open problem. There is some hope, since the maximum independent set problem is polynomial for this class of graphs. 10 For Halin graphs we tried to prove that there is an optimal strong edge- coloring such that the edges in the cycle can be colored with colors from a fixed set of constant size. If true, then this would probably improve the time- bound for the strong chromatic index problem on Halin graphs. Moser and Sik- dar prove that the maximum induced matching problem on planar graphs is fixed-parameter tractable [23]. As far as we know the parameterized complex- ity of the strong chromatic index problem on planar graphs is open. Computing a maximum induced matching in planar graphs, or in bipartite graphs is NP- complete [4]. An example of a distance-hereditary graph G for which L(G)2 is not chordal is depicted in Figure 2. s ❅ ❅ s s s s ❅ s s ❅ s Fig. 2. A distance-hereditary graph G for which L(G)2 is not chordal. Probably the following conjecture is true. If that is the case then the strong chromatic index can be computed in polynomial time for graphs of bounded rankwidth [8, 10]. Conjecture 1. There exists a function ρ : N → N for which the following holds. Let G be a graph of rankwidth k. Then the rankwidth of L(G)2 is at most ρ(k). 6 Acknowledgements Ton Kloks, Sheung-Hung Poon and Chin-Ting Ung thank the National Science Council of Taiwan for their support. Ton Kloks is supported under grant NSC 99 -- 2218 -- E -- 007 -- 016. Sheung-Hung Poon and Chin-Ting Ung are supported under grants NSC 99 -- 2218 -- E -- 007 -- 016, NSC 100 -- 2218 -- E -- 007 -- 007 and NSC 100 -- 2628 -- E -- 007 -- 020 -- MY3. References 1. Andersen, L., The strong chromatic index of a cubic graph is at most 10, Discrete Mathematics 108 (1992), pp. 231 -- 252. 2. Bandelt, H. and H. Mulder, Distance-hereditary graphs, Journal of Combinatorial The- ory, Series B 41 (1986), pp. 182 -- 208. 3. Cameron, K., Induced matchings, Discrete Applied Mathematics 24 (1989), pp. 97 -- 102. 11 4. Cameron, K., Induced matchings in intersection graphs, Discrete Mathematics 278 (2004), pp. 1 -- 9. 5. Cameron, K., R. Sritharan, and Y. Tang, Finding a maximum induced matching in weakly chordal graphs, Discrete Mathematics 266 (2003), pp. 133 -- 142. 6. Chang, M., S. Hsieh and G. Chen, Dynamic programming on distance-hereditary graphs, Proceedings ISAAC'97, Springer, Lecture Notes in Computer Science 1350 (1997), pp. 344 -- 353. 7. Dirac, G., On rigid circuit graphs, Abhandlungen aus dem Mathematischen Seminar der Universitat Hamburg 25 (1961), pp. 71 -- 76. 8. Dvor´ak, Z. and D. Kr´al, Classes of graphs with small rank decompositions are χ- bounded. Manuscript on ArXiv: 1107.2161.v1, 2011. 9. Faudree, R., A. Gy´arf´as, R. Schelp and Z. Tuza, The strong chromatic index of graphs, Ars Combinatorica 29B (1991), pp. 205 -- 211. 10. Ganian, R. and P. Hlinen´y, Better polynomial algorithms on graphs of bounded rankwidth, Proceedings IWOCA 09, LNCS 5874 (2009), pp. 266 -- 277. 11. Golumbic, M. and R. Laskar, Irredundancy in circular arc graphs, Discrete Applied Mathematics 44 (1993), pp. 79 -- 89. 12. Halin, R., Studies on minimally n-connected graphs, in (D. Welsh ed.) Combinatorial mathematics and its applications, Academic Press (1971), pp. 129 -- 136. 13. Hayward, R., J. Spinrad and R.Sritharan, Improved algorithms for weakly chordal graphs, ACM Transactions on Algorithms 3 (2007), pp. 1549 -- 6325. 14. Hocquard, H., P. Ochen and P. Valicov, Strong edge coloring and induced matchings. Manuscript 2011. 15. Howorka, E., A characterization of distance-hereditary graphs, The Quarterly Journal of Mathematics 28 (1977), pp. 417 -- 420. 16. Ka, T., The strong chromatic index of cubic Halin graphs. M.Phil. Thesis, Hong Kong Baptist University, 2003. 17. Kloks, T., Treewidth -- Computations and Approximations, Springer, Lecture Notes in Computer Science 842, 1994. 18. Laskar, R. and D. Shier, On powers and centers of chordal graphs, Discrete Applied Mathematics 6 (1983), pp. 139 -- 147. 19. Mahdian, M., The strong chromatic index of graphs. M.Sc. Thesis, Department of Com- puter Science, University of Toronto, 2000. 20. Mahdian, M., On the computational complexity of strong edge coloring, Discrete Ap- plied Mathematics 118 (2002), pp. 239 -- 248. 21. Marx, D., A short proof of the NP-completeness of circular arc coloring. Manuscript 2003. 22. Molloy, M. and B. Reed, A bound on the strong chromatic index of a graph, Journal of Combinatorial Theory, Series B 69 (1997), pp. 103 -- 109. 23. Moser, M. and S. Sikdar, The parameterized complexity of the induced matching problem in planar graphs, Discrete Applied Mathematics 157 (2009), pp. 715 -- 727. 24. Salavatipour, M., A polynomial algorithm for strong edge coloring of partial k-trees, Discrete Applied Mathematics 143 (2004), pp. 285 -- 291. 25. Shiu, W., P. Lam and W. Tam, On strong chromatic index of Halin graphs, Journal of Combinatorial Mathematics and Combinatorial Computing 57 (2006), pp. 211-222. 26. Shiu, W. and W. Tam, The strong chromatic index of complete cubic Halin graphs, Applied Mathematics Letters 22 (2009), pp. 754 -- 758. 27. Wolk, E., A note on "The comparability graph of a tree," Proceedings of the American Mathematical Society 16 (1965), pp. 17 -- 20. 28. Wu, J. and W. Lin, The strong chromatic index of a class of graphs, Discrete Mathe- matics 308 (2008), pp. 6254 -- 6261. 12
1802.07967
1
1802
2018-02-22T10:26:17
Near Isometric Terminal Embeddings for Doubling Metrics
[ "cs.DS", "cs.CG" ]
Given a metric space $(X,d)$, a set of terminals $K\subseteq X$, and a parameter $t\ge 1$, we consider metric structures (e.g., spanners, distance oracles, embedding into normed spaces) that preserve distances for all pairs in $K\times X$ up to a factor of $t$, and have small size (e.g. number of edges for spanners, dimension for embeddings). While such terminal (aka source-wise) metric structures are known to exist in several settings, no terminal spanner or embedding with distortion close to 1, i.e., $t=1+\epsilon$ for some small $0<\epsilon<1$, is currently known. Here we devise such terminal metric structures for {\em doubling} metrics, and show that essentially any metric structure with distortion $1+\epsilon$ and size $s(|X|)$ has its terminal counterpart, with distortion $1+O(\epsilon)$ and size $s(|K|)+1$. In particular, for any doubling metric on $n$ points, a set of $k=o(n)$ terminals, and constant $0<\epsilon<1$, there exists: (1) A spanner with stretch $1+\epsilon$ for pairs in $K\times X$, with $n+o(n)$ edges. (2) A labeling scheme with stretch $1+\epsilon$ for pairs in $K\times X$, with label size $\approx \log k$. (3) An embedding into $\ell_\infty^d$ with distortion $1+\epsilon$ for pairs in $K\times X$, where $d=O(\log k)$. Moreover, surprisingly, the last two results apply if only $K$ is a doubling metric, while $X$ can be arbitrary.
cs.DS
cs
Near Isometric Terminal Embeddings for Doubling Metrics Michael Elkin∗1 and Ofer Neiman†1 1Department of Computer Science, Ben-Gurion University of the Negev, Beer-Sheva, Israel. Email: {elkinm,neimano}@cs.bgu.ac.il August 27, 2018 Abstract Given a metric space (X, d), a set of terminals K ⊆ X, and a parameter t ≥ 1, we consider metric structures (e.g., spanners, distance oracles, embedding into normed spaces) that preserve distances for all pairs in K × X up to a factor of t, and have small size (e.g. number of edges for spanners, dimension for embeddings). While such terminal (aka source-wise) metric structures are known to exist in several settings, no terminal spanner or embedding with distortion close to 1, i.e., t = 1 + ǫ for some small 0 < ǫ < 1, is currently known. Here we devise such terminal metric structures for doubling metrics, and show that essentially any metric structure with distortion 1+ǫ and size s(X) has its terminal counterpart, with distortion 1+O(ǫ) and size s(K) + 1. In particular, for any doubling metric on n points, a set of k = o(n) terminals, and constant 0 < ǫ < 1, there exists • A spanner with stretch 1 + ǫ for pairs in K × X, with n + o(n) edges. • A labeling scheme with stretch 1 + ǫ for pairs in K × X, with label size ≈ log k. • An embedding into ℓd ∞ with distortion 1 + ǫ for pairs in K × X, where d = O(log k). Moreover, surprisingly, the last two results apply if only K is a doubling metric, while X can be arbitrary. 1 Introduction The area of low-distortion embeddings studies how well different metric spaces can be approximated by simpler, or more structured, metric spaces. Fundamental results in this realm include Bourgain's and Ma- tousek's embeddings of general metrics into high-dimensional Euclidean and ℓ∞ spaces [Bou85, Mat96], respectively, Gupta et al.'s [GKL03] embeddings of doubling metrics into normed spaces, and constructions of distance oracles and spanners for doubling metrics [HPM06, GGN06]. Linial et al. [LLR95] and Bartal [Bar96] demonstrated that low-distortion embeddings have numerous applications in Theoretical Computer Science. All these embeddings [Bou85, Mat96, GKL03] have inherent unavoidable dependencies in the total number of points n in both the distortion and in the dimension of the target space. In scenarios in which we have a metric space (X, d), and a subset K ⊆ X of important points, aka terminals, the current authors ∗This research was supported by the ISF grant No. (724/15). †Supported in part by the ISF grant 1817/17 and BSF grant 2015813. 1 and Filtser [EFN17] demonstrated that one can devise terminal embeddings, i.e., embeddings that provide guarantees on the distortion of all pairs that involve a terminal in K, and whose guarantees on the distortion and the dimension depend on k = K, as opposed to the dependencies on n in the classical embeddings. Specifically, it is shown in [EFN17] that essentially any known metric embedding into a normed space can be transformed via a general transformation into a terminal embedding, while incurring only a constant overhead in distortion. This constant overhead does not constitute a problem when the distortion of the original embedding is O(log n), as is the case for Bourgain's embedding. However, for the important family of embeddings of doubling metrics [Ass83, GKL03] the distortion in some cases is just 1 + ǫ, for an arbitrarily small ǫ > 0. (The dimension grows with 1/ǫ.) This is also the case in the constructions of spanners and distance oracles for these metrics, due to [Tal04, GGN06, HPM06]. Using the general transformation of [EFN17] on them results in stretch c, for some constant c ≥ 1 + √2, making the resulting embeddings and spanners far less appealing. A metric (X, d) has doubling constant λ if any ball of radius 2R in the metric (for any R > 0) can be covered by at most λ radius-R balls. The parameter log2 λ is called also the doubling dimension of the metric (X, d). A family of metrics is called doubling if the doubling dimension of each family member is constant. Doubling metrics constitute a useful far-reaching generalization of Euclidean low-dimensional met- rics. They have been extensively studied, see [Ass83, GKL03, CG06, HPM06, GGN06, CGMZ16, GR08, CLNS15, ES15, Got15, Nei16] and the references therein. Interestingly, these studies of doubling metrics have often produced improved bounds for low-dimensional Euclidean metrics as well. This was the case, e.g., for dynamic spanners for doubling and low-dimensional Euclidean metrics [GR08], spanners with low diameter, degree and weight [ES15], and fault-tolerant spanners [CLNS15]. In the current paper we devise a suit of terminal embeddings and metric structures, such as spanners, distance oracles and distance labeling schemes (see Section 2 for definitions), for doubling metrics with distortion 1 + ǫ, for an arbitrarily small ǫ > 0. In particular, Gupta et al. [GKL03] devised an embedding of metrics with doubling constant λ into ℓ∞ with distortion 1 + ǫ and dimension log n · λlog 1/ǫ+O(1). Our terminal embedding of doubling metrics into ℓ∞ has the same distortion, but the dimension is log k · λlog 1/ǫ+O(1), i.e., the dependency on n is replaced by (essentially) the same dependency on k. Johnson and Lindenstrauss [JL84] showed that any Euclidean metric can be embedded into an O( log n ǫ2 )- dimensional Euclidean one, with distortion 1 + ǫ. While we are not able to provide a general terminal coun- terpart of this fundamental result, we do so in the important special case of doubling metrics. Specifically, we show that an Euclidean (possibly high-dimensional1 ) point set with doubling constant λ admits a terminal embedding with distortion 1 + ǫ into an Euclidean space with dimension O((log k + log λ · log 1/ǫ)/ǫ2). Har-Peled and Mendel [HPM06], following [Tal04], and extending previous classical results about low- dimensional Euclidean spanners (see, e.g., [ADD+93, CDNS92, DHN93, NS07]), showed that for any n-point metric with doubling constant λ and ǫ > 0, there exists a (1 + ǫ)-spanner with n · λO(log 1/ǫ) edges. Note that when ǫ is very small, the coefficient of n may be pretty large even in Euclidean two-dimensional space. We devise a terminal (1 + ǫ)-spanner for doubling metrics with n + k · λO(log 1/ǫ) edges. In other words, when the number of terminals k is much smaller than n, the number of edges is just n + o(n), as opposed to n multiplied by a large constant. (Note, however, that the distortion that our spanner provides is for pairs in K × X, as opposed to X × X.) To the best of our knowledge, no such terminal spanners are known even for two-dimensional Euclidean point sets. We also provide analogous terminal counterparts of Har-Peled and Mendel's distance oracles [HPM06], 1By "high-dimensional" we mean here typically dimension log n or greater. 2 and Slivkins' distance labeling schemes [Sli07]. In addition, we study the setting in which the set of terminals K induces a doubling metric, while the entire point set X is a general (as opposed to doubling) metric. Surprisingly, we show that our terminal distance labeling and also embedding of doubling metrics into ℓ∞ apply in this far more general scenario as well, with the same stretch 1 + ǫ, and the same size/dimension as when X is a doubling metric. We also devise terminal spanners and terminal distance oracles for this more general scenario that K is doubling, while X is a general metric. Related Work: There has been several works which devised metric structures for partial subsets. Al- ready [CE05] considered distance preservers for a designated set of pairs. In [CGK13, Par14, Kav15] pairwise spanners for general metrics were studied, and in particular terminal spanners. Recently [AB18] introduced reachability preservers from a given set of sources. Interestingly, lately we realized that the general transformation from [EFN17] can also be easily ex- tended to produce terminal embeddings that apply to this general scenario (that points of X \ K lie in a general metric, while points of K lie in a special metric). However, as was mentioned above, that trans- formation increases the stretch by at least a constant factor, and is thus incapable of producing terminal embeddings with stretch 1 + ǫ. The only known to us terminal metric structure with distortion 1 + ǫ is a prioritized distance labeling scheme for graphs that exclude a fixed minor, due to the current authors and Filtser [EFN15]. In the current paper we provide the first near-isometric (i.e., having stretch 1 + ǫ) terminal spanners and embeddings. 1.1 Technical Overview The naive approach for building a terminal spanner for a given metric space (X, d), is to apply a known construction on the set of terminals K, and extend the spanner to X \ K by adding an edge from each point in X \ K to its nearest terminal. (The same approach can be used for distance oracles/labeling and embeddings.) This is essentially the approach taken by [EFN17] (albeit in a much more general setting). Unfortunately, such a construction cannot provide small 1 + ǫ stretch (it can be easily checked that it may give stretch at least 3). We need several ideas in order to provide small stretch. First, we use the well known property of doubling metrics, that balls contain bounded size nets (see Section 2 for definitions). We construct nets in all relevant distance scales, and enrich K by a set Y ⊇ K of net points. The points of Y are those net points that are, to a certain extent, close to K, depending on their distance scale. Then we apply a black-box construction of a spanner on the set Y . Finally, we extend the spanner to every x ∈ X \ Y , by adding a single edge from x : either to the nearest terminal, or to a single net point y ∈ Y . The set Y is carefully chosen so that each non-terminal x ∈ X \ K, either has a close-by terminal that "takes care" of it, and otherwise there is a net point y ∈ Y sufficiently close to x so that x will have good stretch going via y. One issue to notice is that even though Y is larger than K, it is still Y = O(K) (at least for constant ǫ, λ). So we can have many points in X \ Y that do not have a representative y ∈ Y . The main technical part of the paper is devoted to proving that the particular choice of Y guarantees low stretch for any pair (x, v) ∈ X × K, even when x has no representative y ∈ Y , by using the path through the nearest terminal to x. It is instrumental to think of the set Y as an "enriched" terminal set. This idea of enriching the terminal set K with additional points may be useful in other settings as well. In the setting when only K is doubling, our construction of terminal spanners (and also distance ora- cles/labeling schemes) is done by adding multiple edges from each x ∈ X \ K to nearby terminals that constitute a net. This approach can not work, however, for embeddings into normed spaces. A certain type 3 of embedding (such as the embedding of doubling metrics into ℓ∞) can be used in a non-black-box manner, and we show how to incorporate the points of X \ K into the embedding for K, without increasing the dimension. 2 Preliminaries 2.1 Embeddings, Spanners and Distance Oracles/Labeling Scheme Let (X, d) be a finite metric space. For a target metric (Z, dZ ), an embedding is a map f : X → Z, and the distortion of f is the minimal α (in fact, it is the infimum), such that there exists a constant c that for all x, y ∈ X (1) d(x, y) ≤ c · dZ (x, y) ≤ α · d(x, y) . When Z is the shortest path metric of a graph H and c = 1, we say that H is an α-spanner of (X, d). Given a set of terminals K ⊆ X, a terminal embedding guarantees (1) only for pairs in K × X. An approximate distance oracle is a data structure that can report a multiplicative approximation of d(x, y), for all x, y ∈ X. For K ⊆ X, it is a terminal distance oracle if it can report only pairs in K × X. The relevant parameters of an oracle are: its size (we measure the size in machine words), query time, and stretch factor (and to some extent, also the preprocessing time required to compute it). If one can distribute the data structure by storing a short label L(x) at each vertex x ∈ X, and compute the approximation to d(x, y) from L(x) and L(y) alone, this is called a distance labeling scheme. For x ∈ X and r > 0, let B(x, r) = {y ∈ X : d(x, y) ≤ r} be a closed ball. The doubling constant of X, denoted λ, is the minimal integer such that for every r > 0, every ball of radius 2r can be covered by λ balls of radius r. 2.2 Terminal Nets For r > 0, an r-net is a set N ⊆ X satisfying the following: 1. For all u, v ∈ N , d(u, v) > r, and 2. for each x ∈ X, there exists u ∈ N with d(x, u) ≤ r. The following claim is obtained by iteratively applying the definition of doubling constant. Claim 1 ([GKL03]). Fix any q, r > 0, and let N be an r-net. For any x ∈ X we have that B(x, q) ∩ N ≤ λlog⌈2q/r⌉ . It is well-known that a greedy algorithm that iteratively picks an arbitrary point u ∈ X to be in N , and removes every point within distance r of u, will create an r-net. Given a set of terminals K ⊆ X, we say that the greedy algorithm constructs a terminal r-net, if it prefers to take points from K until it is exhausted, and only then picks other points to N . We also observe that given a terminal 2r-net N , one may choose a terminal r-net N ′ that contains every terminal of N (by greedily picking to N ′ the terminals of N first -- note that N ′ is not guaranteed to contain all points of N , just the terminals). 4 2.3 Extendable Metric Structure Given a metric (X, d), we denote by d the distance function of some metric structure on it. We say that a family of structures is extendable, if the structure on a subset Y ⊆ X can be extended to the entire X (so that d remains the same for pairs in Y ), by hanging each x ∈ X \ Y on some u = u(x) ∈ Y and having that: 1. d(x, u) = d(x, u). 2. For any v ∈ Y , max{d(x, u), d(u, v)} ≤ d(x, v) ≤ d(x, u) + d(u, v). We argue that essentially all known structures are extendable. For each x ∈ X \ Y , let u = u(x) ∈ Y be the point onto which x is hanged. • Spanners. If the structure is a spanner on Y , then the extension for each x is done by adding the edge {x, u} with weight d(x, u). For any v ∈ Y , we indeed have that d(x, v) = d(x, u) + d(u, v), satisfying both requirements. • Distance labeling. For a distance labeling (or oracle), x stores the label of u and also d(x, u). For a query on (x, v) where v ∈ Y , return d(x, v) = d(x, u) + d(u, v). • Embeddings. If the structure is an embedding f : Y → ℓs adding a new coordinate, and defining f : X → ℓs+1 f (x) = (f (u), d(x, u)). Then we get that for all v ∈ Y , d(x, v) = (cid:16) d(u, v)p + d(x, u)p(cid:17)1/p satisfies both requirements for every 1 ≤ p ≤ ∞. p, then the extension f can be done by by setting for v ∈ Y , f (v) = (f (v), 0) and p , which 3 Terminal Metric Structures for Doubling Metrics In this section we present our main result. For ease of notation, we measure the size of the structure as the size per point (e.g. for a spanner with m edges over n points we say the size is m/n). Our main result is: Theorem 1. Let (X, d) be a metric space with X = n that has doubling constant λ, and fix any set K ⊆ X of size K = k. For 0 < ǫ < 1, assume that there exists an extendable metric structure for any Y ⊆ X that has stretch 1 + ǫ and size s(Y ), then there exists a structure for X with 1 + O(ǫ) stretch for pairs in K × X and size s(k · λO(log(1/ǫ))) + 1. The following corollary follows by applying this theorem with known embeddings/distance oracles/spanners constructions. Corollary 2. Let (X, d) be a metric space with X = n that has doubling constant λ, and fix any set K ⊆ X of size K = k. Then for any 0 < ǫ < 1, the following metric structures exists: 1. If (X, d) is Euclidean, then there exists a terminal embedding into ℓ2 with distortion 1 + ǫ and dimen- sion O((log k + log λ · log(1/ǫ))/ǫ2). 2. A terminal embedding into ℓ∞ with distortion 1 + ǫ and dimension log k · λlog(1/ǫ)+O(1) · log(1/ǫ). 3. A terminal spanner for (X, d) with stretch 1 + ǫ and k · λO(log(1/ǫ))) + n edges. 4. A terminal distance oracle with stretch 1 + ǫ, with size k · λO(log(1/ǫ)) + O(n) and query time λO(1). 5 5. A terminal distance labeling scheme with stretch 1 + ǫ, with label size λO(log(1/ǫ)) · log k · log log ∆k (where ∆k is the aspect ratio of K). 6. A terminal embedding into a distribution of tree-width t graphs2 with expected distortion 1 + ǫ for t ≤ λO(log log λ+log(1/ǫ)+log log ∆K ). Proof. The first item follows from [JL84], the second using [GKL03, Nei16], the third and fourth items use [HPM06] results, the fifth applies a result of [Sli07], and the sixth from [Tal04].3 In what follows we prove Theorem 1. Let (X, d) be a metric space with X = n and doubling constant λ, and let K ⊆ X be a set of terminals. Fix any 0 < ǫ < 1/20, set b = ⌈log(1/ǫ)⌉, and let ∆ = maxu,v∈K{d(u, v)}, δ = minu6=v∈K{d(u, v)} and s = ⌈log(∆/(ǫ2δ))⌉. Let S = {0, 1, . . . , s}, and for each i ∈ S define ri = 2i · ǫ2δ. Observe that r0 = ǫ2δ and rs ≥ ∆. 3.1 Construction 3.1.1 Multi-Scale Partial Partitions We begin by constructing partial partitions, based on terminal nets, in various scales. The clusters of the partition at level i are created by iteratively taking balls of radius ri centered at the points of a terminal ri-net. Some of these balls may be sufficiently far away from K, we call such clusters final, and do not partition them in lower levels. See Algorithm 1 for the full details. Algorithm 1 Partial-Partitions ((X, d), K) Let Ni = {xi,1, . . . , xi,bi} be a terminal ri-net of Ri; (For i < s, each u ∈ K ∩ Ni+1 will be in Ni as well); for j = 1, . . . , bi do 1: Rs = X; 2: for i = s, s − 1, . . . , 0 do Ci,j ← B(xi,j, ri) ∩ Ri; Ri ← Ri \ Ci,j; if d(xi,j, K) ≥ ri/ǫ then Let final(Ci,j) = true; else Let final(Ci,j) = f alse end if end for 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: Ri−1 = Sj : final(Ci,j )=f alse Ci,j ; 14: end for For every scale i ∈ S this indeed forms a partition of Ri ⊆ X, because Ni is an ri-net. Also, every cluster Ci,j in the partition of Ri has a center xi,j. Observe that every cluster containing a terminal is not final, and that each point in X has at most one final cluster containing it. In addition, the definition of 2See [RS91] for definition of tree-width. 3For the last two results, we note that our proof provides Y ⊇ K satisfying ∆Y ≤ O(∆K /ǫ4), on which we apply the labeling scheme of [Sli07], or the embedding of [Tal04]. 6 terminal net guarantees that the prefix of Ni consists of terminals, so each terminal u ∈ K must be assigned to a cluster centered at a terminal. Finally, notice that at level 0, every terminal is a center of its own cluster (since r0 < δ). 3.1.2 Marking Stage We now mark some of the clusters, these marked clusters are the "important" clusters whose center will participate in the black-box construction. For every terminal u ∈ K, let iu ∈ S be the maximal index such that u ∈ Niu , and mark every cluster Ci,j with center xi,j satisfying both conditions (recall that b = ⌈log(1/ǫ)⌉.) 1. iu − 2b ≤ i ≤ iu, and 2. d(u, xi,j) ≤ 2riu /ǫ2. 3.1.3 Constructing the Metric Structure Let Y ⊆ X be the collection of centers of marked clusters (note that K ⊆ Y ). Apply the black-box construction on Y , and extend it to X \ Y as follows. For every x ∈ X that lies in a final marked cluster C with center y, hang x on y (recall that x can be in at most one final cluster). In every other case (e.g., x is in a final unmarked cluster, or does not have a final cluster containing it), hang x on u ∈ K, the nearest terminal to x. 3.2 Analysis First we show that Y is sufficiently small. Claim 3. Y ≤ K · λ5b. Proof. We will show that each u ∈ K marks at most λ5b clusters. By Claim 1, the ball B(u, riu+2b+1) contains at most λlog(riu+2b+1/riu −2b) = λ4b+2 net points of Niu−2b (and only less net points from the other nets Niu−2b+1, . . . , Niu ). The second condition for marking implies that only centers in this ball can be marked by u. Since there are 2b + 1 possible levels i ∈ [iu − 2b, iu], at most (2b + 1) · λ4b+2 ≤ λ5b clusters may be marked by u. The bound on the size follows from Claim 3, and from the fact that each point in X \ Y is hanged from a single y ∈ Y , so it requires a single edge/memory word/coordinate. It remains to bound the stretch by 1 + O(ǫ) for pairs in K × X. By the assumption, the metric structure for Y induces a distance function d which is a 1 + ǫ approximation of d, w.l.o.g we assume that distances cannot contract, and expand by a factor of at most 1 + ǫ. Fix some x ∈ X and v ∈ K. Recall that by definition, if x was hanged on u ∈ Y , then d(x, u) must satisfy max{d(x, u), d(u, v)} ≤ d(x, u) ≤ d(x, u) + d(u, v) . Consider the following cases. Case 1: x does not have a final cluster containing it. In this case x lies very close to its nearest terminal u ∈ K, and all other terminals are at least 1/ǫ times farther away, so the stretch guaranteed for u will 7 suffice for x. More formally: the cluster C containing x at level 0 centered at y is not final, that is, d(y, K) < r0/ǫ. Since C has radius r0 = ǫ2δ, we have that d(x, u) = d(x, K) ≤ d(x, y) + d(y, K) ≤ ǫ2δ + ǫδ = (1 + ǫ)ǫδ . We have that d(u, v) ≤ d(u, x) + d(x, v) ≤ (1 + ǫ)ǫδ + d(x, v) ≤ 2ǫ · d(u, v) + d(x, v), so that Since d approximates d with stretch 1 + ǫ on K, d(u, v) ≤ d(x, v)/(1 − 2ǫ) . (2) (3) d(x, v) ≤ d(x, u) + d(u, v) (2) ≤ d(x, u) + (1 + ǫ)d(u, v) ≤ (1 + ǫ)ǫδ + (1 + ǫ)d(u, v) ≤ (1 + 3ǫ)d(u, v) ≤ (1 + 6ǫ)d(x, v) , (3) where the last two inequalities use that ǫ < 1/12. On the other hand, d(x, v) ≥ d(u, v) ≥ d(u, v) = (1 − ǫ) · d(u, v) + ǫ · d(u, v) ≥ (1 − ǫ) · (d(x, v) − d(x, u)) + ǫδ ≥ (1 − ǫ) · d(x, v) − (1 − ǫ)(1 + ǫ)ǫδ + ǫδ ≥ (1 − ǫ) · d(x, v) . (2) Case 2: x lies in a final marked cluster. Let C be the final marked cluster at level i ∈ S with center y that contains x. In this case we show that d(x, y) is smaller by roughly 1/ǫ than d(x, K), so that the stretch guaranteed for y ∈ Y will also be sufficient for x. Since C is final, d(y, v) ≥ d(y, K) > ri/ǫ, therefore (4) d(x, v) ≥ d(y, v) − d(x, y) ≥ ri/ǫ − ri > ri/(2ǫ) . Using that the structure built for Y has stretch at most 1 + ǫ, we have that d(x, v) ≤ d(x, y) + d(y, v) ≤ d(x, y) + (1 + ǫ)d(y, v) ≤ d(x, y) + (1 + ǫ)(d(x, y) + d(x, v)) = (2 + ǫ)d(x, y) + (1 + ǫ)d(x, v) ≤ (2 + ǫ)ri + (1 + ǫ)d(x, v) ≤ 2ǫ(2 + ǫ)d(x, v) + (1 + ǫ)d(x, v) ≤ (1 + 6ǫ)d(x, v) . (4) 8 And also, d(x, v) ≥ d(y, v) ≥ d(y, v) ≥ d(x, v) − d(x, y) ≥ d(x, v) − ri ≥ (1 − 2ǫ)d(x, v) . (4) Case 3: x lies in a final non-marked cluster C. Let u be the nearest terminal to x. Intuitively, since x is in a final cluster, all terminals are 1/ǫ farther away than the radius of C. However, since C is not marked, its center does not participate in the black-box construction for Y . Fortunately, the marking of clusters guarantees that u, the closest terminal to x, must be in a terminal net of very high scale (otherwise it would have marked C), and it follows that every other terminal is either very far away from u (and thus from x as well), or very close to u. Surprisingly, in both cases we can use the stretch bound guaranteed for K. We prove this observation formally in the following lemma. Lemma 4. For any point x contained in a final non-marked cluster C of level i with i < s, there exists a terminal u′ ∈ K such that d(x, u′) ∈ [ri/(2ǫ), 3ri/ǫ] and for any other terminal w ∈ K it holds that d(u′, w) ≤ ri or d(u′, w) ≥ ri/ǫ2. Proof. Since C with center y is the only final cluster containing x, the cluster C ′ with center y′ containing x at level i + 1 is not final (recall we assume i < s). Thus there exists a terminal z ∈ K with d(y′, z) ≤ ri+1/ǫ. Consider the terminal u′ ∈ Ni+1 which is the center of the cluster containing z at level i + 1 (we noted above that clusters containing a terminal must have a terminal as a center). By the triangle inequality d(x, u′) ≤ d(x, y′) + d(y′, z) + d(z, u′) ≤ ri+1 + ri+1/ǫ + ri+1 < 3ri/ǫ (note that the same bound holds for d(y, u′)). On the other hand, since C is final we have that d(y, u′) ≥ ri/ǫ, and thus d(x, u′) ≥ d(y, u′) − d(y, x) ≥ ri/ǫ − ri ≥ ri/(2ǫ). Next we show that u′ ∈ Ni+2b+1. Seeking contradiction, assume u′ /∈ Ni+2b+1 (or that i ≥ s − 2b so such a net does not exist), and consider the largest j such that u′ ∈ Nj . Since the nets are hierarchical and u′ ∈ Ni+1, it must be that i + 1 ≤ j ≤ i + 2b, which implies that d(u′, y) ≤ 3ri/ǫ < ri+b+2 < 2rj/ǫ2. By the marking procedure, the cluster C would have been marked by u′. Contradiction. We conclude that u′ ∈ Ni+2b+1. Fix any terminal w ∈ K, and we know show that d(u′, w) ≤ ri or d(u′, w) ≥ ri/ǫ2. Seeking contradiction, assume that ri < d(u′, w) < ri/ǫ2. Let v′ ∈ K be the center of the cluster containing w at level i, that is v′ ∈ Ni. Note that d(v′, w) ≤ ri, and thus v′ 6= u′. Since Ni+2b+1 is an ri+2b+1 = 2ri/ǫ2 net, and as d(u′, v′) ≤ ri + ri+2b, it must be that v′ /∈ Ni+2b+1. The contradiction will follow once we establish that v′ will mark C. Indeed, the largest j such that v′ ∈ Nj satisfies i ≤ j ≤ i + 2b, and also d(v′, y) ≤ d(v′, w) + d(w, u′) + d(u′, y) ≤ ri + ri+2b + 3ri+b ≤ 2rj/ǫ2, so C should have been marked. Next, we prove the stretch bound for the pair (x, v). Observe that if the final cluster C containing x and centered at y is of level s, then d(y, K) ≥ rs/ǫ, and thus d(x, K) ≥ d(y, K) − d(y, x) ≥ rs/(2ǫ) . (5) 9 This implies that d(x, v) ≤ d(x, u) + d(u, v) (5) ≤ d(x, u) + (1 + ǫ)d(u, v) ≤ d(x, v) + (1 + ǫ)rs ≤ d(x, v) + 2ǫ(1 + ǫ)d(x, v) ≤ (1 + 3ǫ)d(x, v) . Since d(u, v) ≤ ∆ ≤ rs, we get that d(x, v) ≥ d(x, u) (5) ≥ (1 − 2ǫ) · (d(x, v) − d(u, v)) + 2ǫ · d(x, u) ≥ (1 − 2ǫ) · d(x, v) − rs + rs ≥ (1 − 2ǫ) · d(x, v) . From now on we may assume that C is of level i with i < s. By Lemma 4 there exists u′ ∈ K such that d(x, u′) ∈ [ri/(2ǫ), 3ri/ǫ] and for any terminal w ∈ K, it holds that d(u′, w) ≤ ri or d(u′, w) ≥ ri/ǫ2. Note that since u is the nearest terminal to x, it must be that d(u, u′) ≤ ri, so we have that d(x, u) ∈ [ri/(3ǫ), 4ri/ǫ]. Finally, we consider the two cases for v: close or far from u′. Sub-case a: d(u′, v) ≤ ri. In this case d(u, v) ≤ 2ri, and thus d(x, v) ≥ d(x, u) − d(u, v) ≥ ri/(3ǫ) − 2ri ≥ ri/(4ǫ). It follows that d(x, v) ≤ d(x, u) + d(u, v) ≤ d(x, u) + (1 + ǫ)d(u, v) ≤ d(x, v) + (1 + ǫ)2ri ≤ d(x, v) + 5ri ≤ (1 + 9ǫ)d(x, v) . Since d(u, v) ≤ 2ri ≤ 8ǫ · d(x, v), we also have d(x, v) ≥ d(x, u) ≥ d(x, v) − d(u, v) ≥ (1 − 8ǫ) · d(x, v) . Sub-case b: d(u′, v) ≥ ri/ǫ2. Now we have that d(u′, v) ≤ d(u′, x) + d(x, v) ≤ 3ri/ǫ + d(x, v) ≤ 3ǫd(u′, v) + d(x, v), and so d(u′, v) ≤ d(x, v)/(1 − 3ǫ). It follows that d(x, v) ≤ d(x, u) + d(u, v) ≤ d(x, u) + (1 + ǫ)d(u, v) ≤ (2 + ǫ)d(x, u) + (1 + ǫ)d(x, v) ≤ (2 + ǫ)4ri/ǫ + (1 + ǫ)d(x, v) ≤ 9ǫ · d(u′, v) + (1 + ǫ)d(x, v) ≤ (1 + 12ǫ)d(x, v) . 10 Using that d(u, u′) ≤ ri and that d(x, v) ≥ (1− 3ǫ)d(u′, v) ≥ (1− 3ǫ)ri/ǫ2 ≥ ri/(2ǫ2), we conclude that d(x, v) ≥ d(u, v) ≥ d(u, v) ≥ d(v, x) − d(x, u′) − d(u′, u) ≥ d(v, x) − 3ri/ǫ − ri ≥ (1 − 8ǫ) · d(v, x) + 8ǫ · ri/(2ǫ2) − 3ri/ǫ − ri ≥ (1 − 8ǫ) · d(v, x) . 4 The case where only K is doubling So far we assumed that the entire metric (X, d) is doubling. It is quite intriguing to understand what results can be obtained where only the terminal set K is doubling, while X is arbitrary. We show that in such a case one can obtain terminal metric structures with guarantees similar to the standard results (non-terminal) that apply when the entire metric (X, d) is doubling. For spanners and distance labeling this follow by a simple extension of the black-box result, but unlike [MN07, EFN17], we use multiple points of K for extending each x ∈ X \ K. Theorem 2. Let (X, d) be a metric space on n points, and let K ⊆ X so that (K, d) has doubling constant λ. Then for any 0 < ǫ < 1 there exist: • A terminal spanner with stretch 1 + ǫ and O(n · λO(log(1/ǫ))) edges. • A terminal distance oracle with stretch 1 + ǫ, size n · λO(log(1/ǫ)), and query time λO(1). • A terminal labeling scheme with stretch 1 + ǫ, with label size λO(log(1/ǫ)) log k · log log ∆k (where ∆k is the aspect ratio of K). Observe that the result for the labeling scheme seems to improves Corollary 2, which requires that the whole metric is doubling. (In fact, the label size in Theorem 2 is slightly larger, this fact is hidden by the constant in the O(·) notation.) For embeddings, it is unclear how to use this extension approach, since it involves multiple points. We thus need to adjust the embedding itself. As an example to this adjustment, we have the following result, which strictly improves the corresponding item in Corollary 2. Its proof is in Section 4.2. Theorem 3. Let (X, d) be a metric space, and let K ⊆ X of size K = k so that (K, d) has doubling constant λ. Then for any 0 < ǫ < 1 there exists a terminal embedding of X into ℓ∞ with distortion 1 + ǫ, and dimension log k · λO(log(1/ǫ)). We remark that any embedding of (X, d) into ℓ∞ with distortion less than 3 for all pairs, requires in general dimension Ω(n) [Mat02]. We also note that a terminal version of the JL lemma is impossible whenever only K is Euclidean, and X \ K is not. To see this, note that any three vertices of K2,2 admit an isometric embedding to ℓ2, but embedding all four requires distortion √2. When only one vertex is non-terminal, all pairwise distances must be preserved up to 1 + ǫ, which is impossible for ǫ < 1/3, say. 11 4.1 Proof of Theorem 2 We prove the spanner result first. Let H be a spanner for (K, d) with stretch 1 + ǫ and k · λO(log(1/ǫ)) edges given by [HPM06], say. For any x ∈ X, let u = u(x) ∈ K be the closest terminal to x, and denote R = d(x, u). Take N (x) to be an ǫR-net of B(x, 2R/ǫ) ∩ K, by Claim 1, N (x) ≤ λO(log(1/ǫ)). Add the edges {(x, v)}v∈N (x), each with weight d(x, v) to the spanner. Since we added λO(log(1/ǫ)) edges for each point, the bound on the number of edges follows, and it remains to bound the stretch by 1 + O(ǫ). Clearly no distances can contract, and we bound the expansion. Fix x ∈ X and v ∈ K, and denote u = u(x) with R = d(x, u). In the case v /∈ B(x, 2R/ǫ) we have that R ≤ ǫ · d(x, v)/2, so that dH (x, v) ≤ dH (x, u) + dH(u, v) ≤ d(x, u) + (1 + ǫ)d(u, v) ≤ (2 + ǫ)d(x, u) + (1 + ǫ)d(x, v) = (2 + ǫ)R + (1 + ǫ)d(x, v) ≤ (1 + 3ǫ)d(x, v) . Otherwise, v ∈ B(x, 2R/ǫ). Let v′ ∈ N (x) be the nearest net point to v, with d(v, v′) ≤ ǫR ≤ ǫ · d(x, v) (recall u is the nearest terminal to x). Then dH(x, v) ≤ dH (x, v′) + dH(v′, v) ≤ d(x, v′) + (1 + ǫ)d(v′, v) ≤ d(x, v) + (2 + ǫ)d(v′, v) ≤ d(x, v) + (2 + ǫ)ǫ · d(x, v) ≤ (1 + 3ǫ)d(x, v) . The proof for the labeling scheme (and also distance oracle) is similar. Apply the black-box scheme on (K, d), and for each x ∈ X \ K define N (x) as above, and x stores all labels for v′ ∈ N (x) along with d(x, v′). Given a query (x, v), return minv′∈N (x){d(x, v′) + d(v, v′)}, where d is the distance function of the labeling scheme. 4.1.1 Lower Bound We now show that when only K is doubling, one cannot achieve a result as strong as Theorem 1 (there the number of edges in a spanner with stretch 1 + ǫ can be as low as n + o(n)). In fact, Theorem 2 is tight up to a constant factor in the exponent of λ. Claim 5. There exists a constant c > 0, so that for any (sufficiently large) integer n and any integer λ > 1, there is a metric (X, d) on n points with a subset K ⊆ X, so that (K, d) has doubling constant O(λ), but for any 0 < ǫ < 1, any terminal spanner of X with stretch 1 + ǫ must have at least n · λlog(c/ǫ) edges. Proof. Let t = ⌈log λ⌉, and let K be an ǫ-net of the unit sphere of Rt. Θ(1/ǫ)t−1 = λlog(c/ǫ) for some constant c. Define (X, d) by setting for each x, y ∈ X, d(x, y) =   distances between points in K correspond to the Euclidean distance, and are at most 2, so that K has doubling constant O(λ). Observe that any spanner with stretch 1 + ǫ must contain all the edges in K × X, because the distance between any two points in K is larger than ǫ, so any path from x ∈ X \ K to y ∈ K that does not contain the edge (x, y), will be of length greater than 1 + ǫ. It is well known that K = kx − yk2 . Note that 1 2 x, y ∈ K x ∈ X \ K, y ∈ K x, y ∈ X \ K 12 4.2 Proof of Theorem 3 We follow the embedding technique of [Nei16], but with different edge contractions defined below. Assume w.l.o.g that the minimal distance in (X, d) is 1. Let ∆ = diam(X), and for all 0 ≤ i ≤ log ∆ let (X, di) be the metric defined as follows: consider the complete graph on vertex set X, with edge {u, v} having weight d(u, v). For every x ∈ X and v ∈ K with d(x, v) < 2i−1 · ǫ/k, replace the weight of this edge by 0, and let di be the shortest path metric on this graph. Since any shortest path in this graph has at most 2k edges that contain a vertex in K, we have that d(x, y) − ǫ · 2i ≤ di(x, y) ≤ d(x, y) for all x, y ∈ X. For each 0 ≤ i ≤ log ∆ take a ri-net Ni with respect to (K, di) (i.e., take only terminals to the net), where ri = ǫ · 2i−2. Partition each Ni into t = λO(log(1/ǫ)) sets Ni1, . . . , Nit, such that for each u, v ∈ Nij, di(u, v) ≥ 5 · 2i. (To obtain Nij, one can greedily choose points from Ni \ (Sj′<j Nij′) until no more can be chosen. See [Nei16] for details.) Next we define the embedding, fix D = ⌈2t log(2k/ǫ)⌉, and let {e0, . . . , eD−1} be the standard orthonormal basis for RD, extended to an infinite sequence {ej}j∈N (that is, ej = ej (mod D) for all j ∈ N). For any 0 ≤ i ≤ log ∆ and 0 ≤ j ≤ t − 1, for x ∈ X let Define the embedding f : X → RD by gij(x) = min{2i+1, di(x, Nij)} . f (x) = log ∆ X i=0 t−1 X j=0 gij(x) · eit+j . Expansion Bound: Now we show that the embedding f under the ℓ∞ norm does not expand dis- tances for pairs in X × K by more than a factor of 1 + ǫ. Fix a pair x ∈ X and v ∈ K, and con- sider the h-th coordinate of the embedding fh, with 0 ≤ h ≤ D − 1. We have that fh(x) − fh(v) = Pi,j : h=it+j(mod D) gij(x) − gij(v). Let 0 ≤ i′ ≤ log ∆ be such that 2i′−1 ≤ d(x, v) < 2i′ , then for all i > i′ + log(2k/ǫ) it holds that d(x, v) < 2i−1 · ǫ/k and thus di(x, v) = 0, in particular, gij(x) = gij(v) gij(x) − gij(v) ≤ di(x, v) and gij(x) − gij(v) ≤ 2i+1 for all 0 ≤ i ≤ log ∆ and 0 ≤ j ≤ t − 1. and so there is no contribution at all from such scales. By the triangle inequality we also have that fh(x) − fh(v) ≤ X i,j : i≤i′+log(2k/ǫ),h=it+j(mod D) gij(x) − gij(v) ≤ i,j : i′−log(2k/ǫ)<i≤i′+log(2k/ǫ),h=it+j(mod D) X gij(x) − gij(v) + X i≤i′−log(2k/ǫ) 2i+1 ≤ di(x, v) + 2i′+1 · ǫ/k ≤ d(x, v)(1 + ǫ) . The third inequality holds, since by the choice of D there is at most one possible choice of i, j with i′ − log(2k/ǫ) < i < i′ + log(2k/ǫ) such that h = it + j(mod D), and the last inequality uses that k ≥ 4. By symmetry it follows that fh(x) − fh(v) ≤ d(x, v)(1 + ǫ), and thus f (x) − f (v) ≤ d(x, v)(1 + ǫ). Contraction Bound: Now we bound the contraction of the embedding for pairs containing a terminal. Fix x ∈ X and v ∈ K. We will show that there exists a single coordinate 0 ≤ h ≤ D − 1 such that fh(x) − fh(v) ≥ (1 − ǫ)d(x, v). Let 0 ≤ i ≤ log ∆ such that 2i ≤ d(x, v) < 2i+1, and let 0 ≤ j ≤ t − 1 13 be such that di(v, Nij ) ≤ ri (such a j must exist because Ni is an ri-net of K). Denote by u ∈ Nij the point satisfying di(v, Nij) = di(v, u). Since ri = ǫ · 2i−2 also gij(v) ≤ ri. We claim that di(x, Nij ) = di(x, u). To see this, first observe that di(x, u) ≤ di(x, v) + di(v, u) ≤ 2i+1 + ri < (5/4) · 2i+1. Consider any other y ∈ Nij, by the construction of Nij , di(y, u) ≥ 5 · 2i, so di(y, x) ≥ di(y, u) − di(x, u) > (5/2) · 2i+1 − (5/4) · 2i+1 = (5/4) · 2i+1 > di(x, u). Thus it follows that either gij(x) = 2i+1 ≥ di(x, y), or gij(x) = di(x, u) ≥ di(x, v) − di(v, u) ≥ di(x, v) − ri. Using that di(x, v) ≥ d(x, v) − ǫ · 2i, we conclude that gij(x) − gij(v) ≥ (di(x, v) − ri) − ri = di(x, v) − ǫ · 2i−1 ≥ d(x, v) − 2ǫ · 2i ≥ (1 − 2ǫ) · d(x, v) . Let 0 ≤ h ≤ D − 1 be such that h = it + j(mod D), for the values of i, j fixed above. Then we claim that any other pair i′, j such that h = i′k + j(mod D) has either 0 or very small contribution to the h coordinate. If i′ > i then it must be that i′ ≥ log(2k/ǫ) + i + 1 so that d(x, v) ≤ 2i+1 < 2i′−1 · ǫ/k, thus as before gi′j(x) = gi′j(v). For values of i′ such that i′ < i, then i′ ≤ i − log(2k/ǫ), thus X i′<i,j : h=i′t+j(mod D) 2i′+1 gi′j(x) − gi′j(v) ≤ X ≤ 2i · 2ǫ/k ≤ ǫ · d(x, v) . i′≤i−log(2k/ǫ) Finally, kf (x) − f (v)k∞ ≥ fh(x) − fh(v) gi′j(x) − gi′j(v) ≥ gij(v) − gij(x) − X ≥ d(x, v)(1 − 3ǫ) . i′<i,j : h=i′t+j(mod D) 5 Acknowledgements We are grateful to Paz Carmi for fruitful discussions. References [AB18] Amir Abboud and Greg Bodwin. Reachability preservers: New extremal bounds and approx- imation algorithms. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 1865 -- 1883, 2018. [ADD+93] I. Althofer, G. Das, D. Dobkin, D. Joseph, and J. Soares. On sparse spanners of weighted graphs. Discrete Comput. Geom., 9:81 -- 100, 1993. [Ass83] [Bar96] P. Assouad. Plongements lipschitziens dans Rn. Bull. Soc. Math. France, 111(4):429 -- 448, 1983. Y. Bartal. Probabilistic approximation of metric spaces and its algorithmic applications. In Proceedings of the 37th IEEE Symp. on Foundations of Computer Science, pages 184 -- 193, 1996. 14 [Bou85] J. Bourgain. On lipschitz embedding of finite metric spaces in hilbert space. Israel Journal of Mathematics, 52(1-2):46 -- 52, 1985. [CDNS92] Barun Chandra, Gautam Das, Giri Narasimhan, and Jos´e Soares. New sparseness results on graph spanners. In Proc. of 8th SOCG, pages 192 -- 201, 1992. [CE05] [CG06] D. Coppersmith and M. Elkin. Sparse source-wise and pair-wise distance preservers. In SODA: ACM-SIAM Symposium on Discrete Algorithms, pages 660 -- 669, 2005. T-H. Hubert Chan and Anupam Gupta. Small hop-diameter sparse spanners for doubling met- rics. In Proceedings of the Seventeenth Annual ACM-SIAM Symposium on Discrete Algorithm, SODA '06, pages 70 -- 78, Philadelphia, PA, USA, 2006. Society for Industrial and Applied Mathematics. [CGK13] Marek Cygan, Fabrizio Grandoni, and Telikepalli Kavitha. On pairwise spanners. In 30th International Symposium on Theoretical Aspects of Computer Science, STACS 2013, February 27 - March 2, 2013, Kiel, Germany, pages 209 -- 220, 2013. [CGMZ16] T.-H. Hubert Chan, Anupam Gupta, Bruce M. Maggs, and Shuheng Zhou. On hierarchical routing in doubling metrics. ACM Trans. Algorithms, 12(4):55:1 -- 55:22, August 2016. [CLNS15] T.-H. Hubert Chan, Mingfei Li, Li Ning, and Shay Solomon. New doubling spanners: Better and simpler. SIAM J. Comput., 44(1):37 -- 53, 2015. [DHN93] Gautam Das, Paul J. Heffernan, and Giri Narasimhan. Optimally sparse spanners in 3- dimensional euclidean space. In Proceedings of the Ninth Annual Symposium on Computational GeometrySan Diego, CA, USA, May 19-21, 1993, pages 53 -- 62, 1993. [EFN15] Michael Elkin, Arnold Filtser, and Ofer Neiman. Prioritized metric structures and embedding. In Proceedings of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, STOC 2015, Portland, OR, USA, June 14-17, 2015, pages 489 -- 498, 2015. [EFN17] Michael Elkin, Arnold Filtser, and Ofer Neiman. Terminal embeddings. Theor. Comput. Sci., 697:1 -- 36, 2017. [ES15] Michael Elkin and Shay Solomon. Optimal euclidean spanners: Really short, thin, and lanky. J. ACM, 62(5):35:1 -- 35:45, 2015. [GGN06] Jie Gao, Leonidas J. Guibas, and An Nguyen. Deformable spanners and applications. Comput. Geom. Theory Appl., 35(1-2):2 -- 19, August 2006. [GKL03] Anupam Gupta, Robert Krauthgamer, and James R. Lee. Bounded geometries, fractals, and low-distortion embeddings. In Proceedings of the 44th Annual IEEE Symposium on Founda- tions of Computer Science, FOCS '03, pages 534 -- , Washington, DC, USA, 2003. IEEE Com- puter Society. [Got15] Lee-Ad Gottlieb. A light metric spanner. In Proc. of 56th FOCS, pages 759 -- 772, 2015. [GR08] Lee-Ad Gottlieb and Liam Roditty. An optimal dynamic spanner for doubling metric spaces. In Algorithms - ESA 2008, 16th Annual European Symposium, Karlsruhe, Germany, September 15-17, 2008. Proceedings, pages 478 -- 489, 2008. 15 [HPM06] Sariel Har-Peled and Manor Mendel. Fast construction of nets in low-dimensional metrics and their applications. SIAM J. Comput., 35(5):1148 -- 1184, May 2006. [JL84] [Kav15] William Johnson and Joram Lindenstrauss. Extensions of Lipschitz mappings into a Hilbert space. In Conference in modern analysis and probability (New Haven, Conn., 1982), volume 26 of Contemporary Mathematics, pages 189 -- 206. American Mathematical Society, 1984. Telikepalli Kavitha. New pairwise spanners. In 32nd International Symposium on Theoretical Aspects of Computer Science, STACS 2015, March 4-7, 2015, Garching, Germany, pages 513 -- 526, 2015. [LLR95] N. Linial, E. London, and Y. Rabinovich. The geometry of graphs and some of its algorithmic applications. Combinatorica, 15(2):215 -- 245, 1995. [Mat96] J. Matousek. On the distortion required for embeding finite metric spaces into normed spaces. volume 93, pages 333 -- 344, 1996. [Mat02] Jiri Matousek. Lectures on Discrete Geometry. Springer-Verlag New York, Inc., Secaucus, NJ, USA, 2002. [MN07] Manor Mendel and Assaf Naor. Ramsey partitions and proximity data structures. Journal of the European Mathematical Society, 9(2):253 -- 275, 2007. [Nei16] Ofer Neiman. Low dimensional embeddings of doubling metrics. Theory Comput. Syst., 58(1):133 -- 152, 2016. [NS07] [Par14] [RS91] [Sli07] [Tal04] Giri Narasimhan and Michiel Smid. Geometric Spanner Networks. Cambridge University Press, New York, NY, USA, 2007. Merav Parter. Bypassing erdos' girth conjecture: Hybrid stretch and sourcewise spanners. In Automata, Languages, and Programming - 41st International Colloquium, ICALP 2014, Copenhagen, Denmark, July 8-11, 2014, Proceedings, Part II, pages 608 -- 619, 2014. Neil Robertson and P. D. Seymour. Graph minors: X. obstructions to tree-decomposition. J. Comb. Theory Ser. B, 52(2):153 -- 190, June 1991. Aleksandrs Slivkins. Distance estimation and object location via rings of neighbors. Distributed Computing, 19(4):313 -- 333, 2007. Kunal Talwar. Bypassing the embedding: Algorithms for low dimensional metrics. In Proceed- ings of the Thirty-sixth Annual ACM Symposium on Theory of Computing, STOC '04, pages 281 -- 290, New York, NY, USA, 2004. ACM. 16
1708.04341
1
1708
2017-08-14T22:06:44
Graphettes: Constant-time determination of graphlet and orbit identity including (possibly disconnected) graphlets up to size 8
[ "cs.DS", "q-bio.MN", "q-bio.QM" ]
Graphlets are small connected induced subgraphs of a larger graph $G$. Graphlets are now commonly used to quantify local and global topology of networks in the field. Methods exist to exhaustively enumerate all graphlets (and their orbits) in large networks as efficiently as possible using orbit counting equations. However, the number of graphlets in $G$ is exponential in both the number of nodes and edges in $G$. Enumerating them all is already unacceptably expensive on existing large networks, and the problem will only get worse as networks continue to grow in size and density. Here we introduce an efficient method designed to aid statistical sampling of graphlets up to size $k=8$ from a large network. We define graphettes as the generalization of graphlets allowing for disconnected graphlets. Given a particular (undirected) graphette $g$, we introduce the idea of the canonical graphette $\mathcal K(g)$ as a representative member of the isomorphism group $Iso(g)$ of $g$. We compute the mapping $\mathcal K$, in the form of a lookup table, from all $2^{k(k-1)/2}$ undirected graphettes $g$ of size $k\le 8$ to their canonical representatives $\mathcal K(g)$, as well as the permutation that transforms $g$ to $\mathcal K(g)$. We also compute all automorphism orbits for each canonical graphette. Thus, given any $k\le 8$ nodes in a graph $G$, we can in constant time infer which graphette it is, as well as which orbit each of the $k$ nodes belongs to. Sampling a large number $N$ of such $k$-sets of nodes provides an approximation of both the distribution of graphlets and orbits across $G$, and the orbit degree vector at each node.
cs.DS
cs
Graphettes: Constant-time determination of graphlet and orbit identity including (possibly disconnected) graphlets up to size 8 Adib Hasan1, Po-Chien Chung2, Wayne Hayes2*, 1 Ananda Mohan College, Mymensingh, Bangladesh 2 Dept. of Computer Science, University of California, Irvine, California, USA * Corresponding author: [email protected] Abstract Graphlets are small connected induced subgraphs of a larger graph G. Graphlets are now commonly used to quantify local and global topology of networks in the field. Methods exist to exhaustively enumerate all graphlets (and their orbits) in large networks as efficiently as possible using orbit counting equations. However, the number of graphlets in G is exponential in both the number of nodes and edges in G. Enumerating them all is already unacceptably expensive on existing large networks, and the problem will only get worse as networks continue to grow in size and density. Here we introduce an efficient method designed to aid statistical sampling of graphlets up to size k = 8 from a large network. We define graphettes as the generalization of graphlets allowing for disconnected graphlets. Given a particular (undirected) graphette g, we introduce the idea of the canonical graphette K(g) as a representative member of the isomorphism group Iso(g) of g. We compute the mapping K, in the form of a lookup table, from all 2k(k−1)/2 undirected graphettes g of size k ≤ 8 to their canonical representatives K(g), as well as the permutation that transforms g to K(g). We also compute all automorphism orbits for each canonical graphette. Thus, given any k ≤ 8 nodes in a graph G, we can in constant time infer which graphette it is, as well as which orbit each of the k nodes belongs to. Sampling a large number N of such k-sets of nodes provides an approximation of both the distribution of graphlets and orbits across G, and the orbit degree vector at each node. Author summary Graphlets are small subgraphs of a larger network. They have been used extensively for over a decade in the analysis of social, biological, and other networks. Unfortunately it is extremely expensive to exhaustively enumerate all graphlets appearing in a large graph, requiring days or weeks of computer time for recent large networks. Here we introduce a novel method for statistically sampling graphlets from large graphs. The time required does not depend upon the size of the input network, but instead upon the number of samples desired. In addition, existing methods only look at graphlets up to size 5 or 6; we allow graphlets up to size 8, which significantly improves on the sensitivity and specificity of network analysis. Our method will allow graphlets to be efficiently utilized to analyze networks of arbitrary size going into the future. PLOS 1/13 Fig 1. All (connected) graphlets of sizes k = 3, 4, 5 nodes, and their automorphism orbits; within each graphlet, nodes of equal shading are in the same orbit. The numbering of these graphlets and orbits were created by hand [8] and do not correspond to the automatically generated numbering used in this paper. The figure is taken verbatim from [16]. Introduction Network comparison is a growing area of research. In general the problem of complete comparison of large networks is intractable, being an N P -complete problem [1]. Thus, approximate heuristics are needed. Networks have been compared for statistical similarity from a high-level using simple, easy-to-calculate measures such as the degree distribution, clustering co-efficients, network centrality, among many others [2, 3]. While more sophisticated methods such as spectral analysis [4, 5] and topological indices [6] have been useful, the study of small subnetworks such as motifs [7] and graphlets [8, 9] have become popular. They have been used extensively to globally classify highly disparate types of networks [10] as well as to aid in local measures used to align networks [11 -- 14]. A graphlet is a small, connected, induced subgraph g of a larger graph G. Given a particular graphlet g, the automorphism orbits of g are the sets of nodes that are topologically identical to each other inside g. Graphlets and their automorphism orbits with up to k = 5 nodes were first introduced in 2004 [8], and are depicted in Fig 1. Recently, automated methods have been created that can enumerate, in a larger graph, all graphlets and their automorphism orbits up to graphlet size k = 5 [15] and subsequently to any k [16], although the latter authors only applied it up to k = 6. Unfortunately, we have found that these methods take a very long time (hours to days) even just to count graphlets up to size k = 5 on some large biological networks, such as those in BioGRID [17]. It is not clear that such methods, especially for even larger k, PLOS 2/13 will be applicable to the coming age of ever bigger networks, since the total number of graphlets appearing in a large network tends to increase exponentially with both k (the graphlet size) and n (the number of nodes in the large network). Eventually, an exhaustive enumeration of all graphlets appearing in a large network may become infeasible simply due to the number of graphlets that need to be enumerated, even under the optimization of using orbit counting equations. On the other hand, graphlets are too useful to abandon as a method of quantifying the topological structure of graphs. An achievable alternative for a large network G is to statistically sample its graphlets rather than exhaustively enumerate them. Additionally, such sampling could be useful with the recent advent of comprehensive biological network databases [18]: each sampled graphlet would act as a seed for local matching between larger networks, similar to how k-mers (short sequences of length k) are used for seed-and-extend sequence matching in BLAST [19]. To efficiently create a statistical sample of graphlets in a large network G, one must be able to take an arbitrary set of k nodes from G, and efficiently (preferably in constant time) determine both which graphlet is represented, as well as the automorphism orbits of each of the k nodes. Here, we solve this problem both by enumerating all graphlets (and their disconnected counterparts, which we term graphettes) and their automorphism orbits up to graphettes of size k = 8. We present a method that creates a lookup table that can quickly determine the graphette identity of any k nodes, as well as their automorphism orbits. Since the lookup table required significant time to pre-compute for k = 7 (a few hours on a single core) and k = 8 (hundreds of CPU weeks on a cluster), we provide the actual lookup tables for these values of k online at http://github.com/Neehan/Faye. Materials and methods Definitions and notations Given a graph G on n nodes, a k-graphette is a (not necessarily connected) induced subgraph g on any set of k nodes of G. There are many ways one could choose the k nodes, for example (i) choosing k nodes uniformly at random from G, or (ii) performing a local search around some node u. We expect the former to be useful only in dense networks, while the latter is probably more useful in sparse networks because most random sets of k nodes in a sparse graph will be highly disconnected and thus not very informative. One could also (iii) perform edge-based selection (with local expansion) to ensure dense regions are sampled more frequently than sparse regions [20]; still other methods have been suggested [21]. Given a set of k nodes, we wish to quickly ascertain which graphette is represented, and which automorphism orbits each of the k nodes belong to. To do that we need a canonical list of graphettes and their orbits, and a fast way to determine which canonical graphette is represented by any permutation of k nodes. Here we demonstrate how, if k is fixed and relatively small (k ≤ 8 in our case), this can be accomplished in constant time by pre-computing and storing a lookup table indexed by a bit vector representation of the lower triangular matrix of the (undirected) adjacency matrix of the induced subgraph. Given such an index, the value associated with that index identifies the canonical graphette (a canonical ordering of the nodes for that graphette). We also pre-compute the automorphism orbits of all the canonical graphettes. Thus, by reversing the lookup table we can, in constant time, infer the orbit identity of each of the k nodes in that k-graphette. As a corrollary, we can also update the (statistically sampled) graphette orbit degree vector of each of the k nodes, similar to the graphlet degree vector [9]. PLOS 3/13 V(G) The set of nodes of graph G We use the following abbreviations and notations throughout: G(V, E) The Graph with nodes V and edges E E(G, u, v) The boolean value denoting connectivity between nodes u and ⇐⇒, iff v of graph G If and only if S The number of elements in set S. Adj(G) The adjacency matrix representation of graph G Aut(G) The set of automorphisms of graph G K(g) Canonical isomorph of graphette g Fig 2. Three isomorphic representations of the Petersen graph. Canonization of graphettes If graphs G and H are isomorphic, it essentially means they are exactly the same graph, but drawn differently. For example, Fig 2 shows three different drawings of the Petersen graph. Technically, an isomorphism between networks G and H is a permutation π : V(G) → V(H) so that E(G, u, v) ⇐⇒ E(H, π(u), π(v)), Fig 3. All the possible 3-graphettes. Consider a 3-graphette with nodes w, x and y. There are only 4 possible such graphettes, depicted in Fig 3. However, by permuting the order of the nodes, each of these graphettes can be represented by several isomorphic variants. In order to determine if two graphettes are isomorphic, we will represent its (undirected) graph with the lower-triangle of its adjacency matrix. We will place this lower-triangular PLOS 4/13 0123456789012385764901234968571wxywxywxywxy1 Fig 4. All 3-graphettes with exactly one edge; the canonical one is the one with lowest integer representation (the middle one in this case). Each of them is placed in a lookup table indexed by the bit vector representation of its adjacency matrix, pointing at the canonical one. In this way we can determine that it is the one-edge 3-graphette in constant time. matrix into a bit vector, resulting in a representation similar to existing ones for orbit identification [16]. We now describe the idea of a canonical representative of each isomorph. To provide an explicit example, consider Fig 4, depicting the three isomorphic configurations of the 3-graphette that has exactly one edge. In order to determine that these graphettes are all isomorphic, we take the bit vector representation depicted, and define the lowest-numbered bitvector among all the isomorphs as the canonical representative. All the other isomorphs in the lookup table point to it. In this way, every graph on 3 nodes can be efficiently mapped to its canonical 3-isomorph. We also automatically determine the number of automorphism orbits (see below) for each canonical isomorph. Table 1 represents, for various values of k, the number of bits b(k) required to store the lower-triangular matrix of all graphettes on k nodes (i.e., the length of the bit vector used to store this matrix); the resulting total number possible representations of k nodes (which is simply 2b(k)); the number of canonical isomorphs N C(k); and the number of canonical automorphism orbits. Note that, to map each possible set of k nodes to their canonical isomorphs, the lookup table has 2b(k) entries, and each entry has a value between 0 and N C(k) − 1. Note that for k up to 8, the graphettes can be stored in 32 bits. In that case, the maximum space required will be 32 × 228 = 1 GB. This is as far as we go, for now. Moore's Law suggests that we may be able to go to k = 9 within a few years, and to k = 10 in perhaps a decade or two. We note that the most expensive part of our algorithm is creating the lookup table between an arbitrary set of k nodes, to the canonical graphette represented by those k nodes; in the absence of a requirement for this lookup table, one could use orbit counting equations [16] to generate automorphism orbits up to k = 12. Generating the lookup table from non-canonical to canonical graphettes Assume the large graph G has n nodes labeled 0 through n − 1, and pick an arbitrary set of k nodes U = {u0, u1, . . . , uk−1}. Create the subgraph g induced on the nodes in U ⊆ V(G), and let its bit vector representation B be of the form lower-triangular matrix described in Fig 4. We now describe how to create the lookup table that maps any such PLOS 5/13 wxywxywxyMatrix:wxyx0y10z000wxyx0y00z010wxyx0y00z100Bitvector:1000010101 k 1 2 3 4 5 6 7 8 9 10 11 12 bits #Graphs b(k) 0 1 3 6 10 15 21 28 36 45 55 66 Space b(k)2b(k) N C(k) 0 0.25 B 3 B 48 B 1.25 KB 60 KB 5.25 MB 2b(k) 1 2 8 64 1 K 32 K 2 M 256 M 896 MB 12346 274668 64 G 12005168 32 T 32 P 1018997864 165091172592 64 E 1 2 4 11 34 156 1044 288 GB 180 TB 220 PB 528 EB #Canonicals #Orbits 1 2 6 20 90 544 5096 79264 2208612 113743760 10926227136 1956363435360 2 Table 1. For each value of k: the number of bits b(k) = k(k−1) required to store the lower-triangle of the adjacency matrix for an undirected k-graphette; the number of such k-graphettes counting all isomorphs which is just 2b(k); the number of canonical k-graphettes (this will be the number of unique entries in the above lookup table [22], and up to k = 8, 14 bits is sufficient); and the total number of unique automorphism orbits (up to k = 8, 17 bits is sufficient) [27]. Note that up to k = 8, together the lookup table for canonical graphettes and their canonical orbits fits into 31 bits, allowing storage as a single 4-byte integer, with 1 bit to store whether the graphette is connected (i.e., also a graphlet). The suffixes K, M, G, T, P, and E represent exactly 210, 220, 230, 240, 250 and 260, respectively. B to its canonical representative. We iterate through all 2b(k) bit vectors in order; for each value B, we check to see if it is isomorphic to any of the previously found canonical graphettes; if so, the lookup table value is set to the previously found canonical graphette; otherwise we have a new, previously unseen canonical graphette and the lookup table value is set to itself (B). When checking for isomorphism between B and all previously found canonical graphettes, we use a relatively simple brute force approach. If the degree distribution of the two graphettes are different, we can immediately discard the pair as non-isomorphic; otherwise we resort to cycling through every permutation of the nodes checking each pair for graph equality, which has worst-case running time of k2k!. The total run time to compute the lookup table for a particular value k is thus bounded above by k2k! · N C(k) · 2b(k), where k! is the maximum number of permutations we need to check if a non-canonical matches an existing canonical, k2 is the worst-case running time to check if 2 specific permutations of k-graphettes are isomorphic, there are at most N C(k) canonicals to check against [22], and 2b(k) = 2n(n−1)/2 is the total number of undirected graphs on k nodes. More sophisticated approaches exist [23], which may more easily allow higher values of k. This process can also be parallelized, which is what we did for k = 8. Essentially, we can split the 2b(k) non-canonical graphettes into m sets of about 2b(k)/m graphettes each, and then spread the computation across m machines. For each of the m sets Si, we loop through all graphettes in that set and mark out which are isomorphic to each other. For each set Si, we will find a set Ti of lowest-numbered "temporary" canonical graphettes in Si, along with the map T C : Si → Ti of which graphettes in Si map to each temporary canonical in Ti. That is, for each graphette g ∈ Si, ∃h ∈ Ti for which the temporary canonical T C(g) = h. Finally, once all the m sets have been evaluated in this way, a second stage passes through all the Ti, i = 0, . . . , m − 1, merging the PLOS 6/13 temporary canonicals together into a final, global list of canonical graphettes, while also propagating these globally lowest-numbered canonicals back up through the m temporary canonical maps, so each graphette g globally maps to the globally lowest-numbered canonical; we call this process sifting for canonicals, and it may require several iterations to globally find the final list of canonicals. In this way we ran k = 8 in about a week across 600 cores, for a total of 600 CPU-weeks. This process could probably be made more efficient with smarter isomorphism checking [23, 24]. Graph automorphism and orbits An isomorphism π : V(g) → V(g) (from a graph g to itself) is called an automorphism. While an isomorphism is just a permutation of the nodes, it is called an automorphism if it results in exactly the same labeling of the nodes in the same order -- in other words exactly the same adjacency matrix. The set of all automorphisms of g will be called Aut(g). An automorphism orbit, or just orbit, of g is a minimally sized collection of nodes from V(g) that remain invariant under every automorphism of g [25]. There can be more than one automorphism orbit, and each orbit can have anywhere from 1 to k member nodes; refer again to Fig 1 for some examples. More formally, a set of nodes ω constitute an orbit of g iff: 1. For any node u ∈ ω and any automorphism π of g, u ∈ ω ⇐⇒ π(u) ∈ ω. 2. if nodes u, v ∈ ω, then there exists an automorphism π of g and a γ > 0 so that πγ(u) = v. Now, we shall prove a few relevant results that will be useful later for automatically enumerating the orbits. Proposition 1. For each node u ∈ V(g) and each automorphism π : V(g) → V(g), there exists an integer λ > 0 such that πλ(u) = u. Proof. Because π is an automorphism, u ∈ V(g) =⇒ π(u) ∈ V(g) =⇒ π2(u) ∈ V(g) ... =⇒ πi(u) ∈ V(g), ∀i ∈ N. Since V(g) is finite and π is bijective, the conclusion obviously follows. We shall call the set of nodes Cπ(u) = {u, π(u), . . . , πλ−1(u)} the cycle of u under automorphism π, where λ is the smallest positive integer such that πλ(u) = u. Note that λ is not unique since πλ(u) = π2λ(u) = ··· = u. Also, π, u, and λ are tied together into triples such that knowing any two determines the third. Corollary 1.1. π maps every node ∈ Cπ(u) to a node (possibly same) ∈ Cπ(u). Corollary 1.2. In any automorphism π of g, every node appears in exactly one cycle. PLOS 7/13 In other words, the cycles π creates are disjoint. (However, the cycles from different automorphisms might not be so.) Hence, it makes sense to say splitting an automorphism into its cycles. For example consider the permutation π = (201354) of (012345). Since π(0) = 2, π(2) = 1, π(1) = 0, the nodes (012) form a cycle. Now start with the next node, 3. π(3) = 3. So, (3) is another cycle. Finally, π(4) = 5, π(5) = 4, so, (45) form another cycle. Hence, the permutation (201354) is split into three cycles, namely (012), (3), (45). Proposition 2. The orbits are disjoint. (In other words, each node appears in exactly one orbit.) Proof. Assume the contrary, i.e., a node u ∈ V(g) appears in two different orbits ω1 and ω2. According to the second condition, for any other node v ∈ ω1, there exists an automorphism π of g and a γ so that πγ(u) = v. However, from the first condition, u ∈ ω2 =⇒ π(u) ∈ ω2 =⇒ π2(u) ∈ ω2 ... =⇒ πγ(u) ∈ ω2 =⇒ v ∈ ω2 Therefore, every node v ∈ ω1 also belongs to ω2. Hence, ω1 ⊆ ω2. Following the same logic, ω2 ⊆ ω1, implying ω1 = ω2. ⇒⇐ Corollary 2.1. Each cycle appears in exactly one orbit, which completely contains that cycle. Proof. If an orbit ω partially contains a cycle Cπ(u), then ω is not invariant under automorphism π, as π will map some node in ω (and Cπ(u)) to another node outside ω (but still in Cπ(u)) according to corollary 1.1, contradicting our definition of orbits. Since two orbits are disjoint, Cπ(u) must appear only in ω, and in none of the other orbits. These statements are enough to be able to find all orbits of each graphette, as we now demonstrate. Automatically enumerating all orbits of a graph From the propositions in the previous section, an algorithm to enumerate the orbits can be constructed like this: 1. Generate all automorphisms of g. 2. Split each automorphism into its cycles. 3. Merge the cycles from different automorphisms to form orbits. Generating all automorphisms of g Referring to Algorithm 1, the function generateAutomorphisms() applies every possible permutation of V(g) over Adj(g). Each permutation creates an isomorph of Adj(g). If Adj(g) is unchanged under some permutation π, then by definition, π is an automorphism of g. Hence it is saved into Aut(g). Two optimization strategies are employed: PLOS 8/13 Algorithm 1 Automatically enumerating automorphism orbits of a graph function generateAutomorphisms(Graph g) Aut(g) = {} for each permutation π of V(g) do // Find the automorphisms of g apply π over Adj(g) if Adj(g) == π(Adj(g)) then put π in Aut(g) end if end for end function function generateCycles(automorphism π) C = {} for node u in π do if u is not visited then mark u visited new cycle Cπ(u) = {} node v = π(u) while v != u do put v in Cπ(u) mark v visited v = π(v) end while put Cπ(u) in C end if end for end function function enumerateOrbits(C(g)) for each node u ∈ V(g) do ω(u) = u end for for cycle c ∈ C(g) do let ωmin = ∞ for node u ∈ c do ωmin = min(ωmin, ω(u)) end for for node u ∈ c do ω(u) = ωmin end for end for end function PLOS 9/13 1. No node is mapped to another node with unequal degree. 2. An automorphism of graph g is also an automorphism of its complement graph g(cid:48). In practice, this algorithm generates all automorphisms of all the canonical graphettes up to size 8 in a matter of seconds. Nevertheless, for additional speed up in higher sizes, modern sophisticated automorphism detection algorithms [23, 24] may be used. Splitting automorphisms into cycles An automorphism π of g is basically a permutation of nodes of g. Hence, to split π into cycles, we can repeatedly apply π over every node u ∈ π and remember the nodes u transforms into. This forms the cycle with node u, i.e. Cπ(u), which is saved in C. After first visit, each node is marked visited to prevent more visits. Merging cycles to enumerate orbits Suppose C(g) is the set of all cycles resulting from all the automorphisms of g. To enumerate orbits from it, first each node u is colored with a unique color ω(u) = u. Then ω(u) is continuously updated to reflect the current color of u, as the nodes belonging to same orbits are gradually colored by identical color. For the nodes of each cycle c ∈ C(g), we save their minimum color in ωmin, and then color all of them with ωmin. After coloring all the cycles in this way, nodes belonging to same orbits get the same color, and hence, get enumerated. Proof of correctness of Algorithm 1 Here we prove that Algorithm 1 determines every orbit of g. Suppose a set ω is among the final sets generated by Algorithm 1. We shall prove ω is an orbit of g by showing that it follows the two properties of orbits: 1. Let a node u ∈ ω form the cycle Cπ(u) under automorphism π. The generateCycles function will apply π repeatedly until it finds a λ so that πλ(u) = u and will therefore determine Cπ(u). Since the enumerateOrbits function assigned u to ω, it had also assigned all nodes in Cπ(u) to ω. Hence u ∈ ω ⇐⇒ π(u) ∈ ω. 2. Suppose nodes u, v ∈ ω. Then, either they belonged to a cycle from which they were assigned to a mutual set ω in enumerateOrbits function, or there is a third node w so that w shares separate cycles with u and v under different automorphisms π1 and π2. In the first case, u and v already belong to a common cycle. In the second case, assume πγ1 permutation φ = πγ2 automorphism [26], φ is also an automorphism. And notice that 2 (w) = v. Consider the . Since composition of two automorphisms is an 1 (w) = u and πγ2 2 ◦ π −γ1 1 (cid:0)π −γ1 1 (u)(cid:1) = πγ2 φ(u) = πγ2 2 2 (w) = v implying u and v belong to a common cycle under φ. Therefore, ω is indeed an orbit of g. Since each node was given a unique orbit color in the beginning of enumerateOrbits, every orbit of g will be eventually found by Algorithm 1. PLOS 10/13 Results and discussion Using the algorithms described herein, we have enumerated all possible graphlets, including the generalization of disconnected counterparts called graphettes, up to size k = 8. The code and data can be found in http://github.com/Neehan/Faye. (Note that the github code uses the upper triangle matrix, though we intend to convert it to use the lower tringle as that representation has already been established [16].) We have also enumerated all orbits up to size k = 8. More importantly to the statistical sampling technique described in the Introduction, we have used a bit-vector representation of all possible adjacency matrices of all possible sets of up to k = 8 nodes and created a lookup table from the 2k(k−1)/2 k-sets to their canonical graphette representatives. This allows us to determine, in constant time, the graphette represented by these k nodes, as well as the automorphism orbits of each nodes. This allows efficient estimation of both the global distribution of graphlets and orbits, as well as an estimation of the graphlet (or orbit) degree vector for each node in a large graph G. Although the lookup tables for k > 8 are at present too big to compute or store, we could also use NAUTY or SAUCY to enumerate all the canonical graphettes up to size k = 12, and use our orbit generation code Algorithm 1 to determine all the orbits in all graphettes up to size k = 12. We have verified that previous results are consistent with ours in terms of the number of distinct graphettes [22] and orbits [27] determined, as displayed in Table 1. In future work we will study which statistical sampling techniques most efficiently produce a good estimate of the complete graphlet and local (per-node) degree vectors. We also intend to study how this method may aid in cataloging of graphlets for database network queries, or in non-alignment network comparison [10]. Finally, there may be ways to combine our method with those of orbit counting equations [15, 16] to more efficiently produce samples of orbit counts. Acknowledgments We thank Sridevi Maharaj, Dillon Kanne, and the anonymous referees for several helpful suggestions on presentation. References 1. Cook SA. The Complexity of Theorem-proving Procedures. In: Proceedings of the Third Annual ACM Symposium on Theory of Computing. STOC '71. New York, NY, USA: ACM; 1971. p. 151 -- 158. Available from: http://doi.acm.org/10.1145/800157.805047. 2. Newman M. Networks: an introduction. 2010. United Slates: Oxford University Press Inc, New York. 2010; p. 1 -- 2. 3. Emmert-Streib F, Dehmer M, Shi Y. Fifty years of graph matching, network alignment and network comparison. Information Sciences. 2016;346:180 -- 197. 4. Wilson RC, Zhu P. A study of graph spectra for comparing graphs and trees. Pattern Recognition. 2008;41(9):2833 -- 2841. 5. Thorne T, Stumpf MP. Graph spectral analysis of protein interaction network evolution. Journal of The Royal Society Interface. 2012; p. rsif20120220. 6. Dehmer M, Emmert-Streib F, Shi Y. Interrelations of graph distance measures based on topological indices. PloS one. 2014;9(4):e94985. PLOS 11/13 7. Milo R, Shen-Orr S, Itzkovitz S, Kashtan N, Chklovskii D, Alon U. Network motifs: simple building blocks of complex networks. Science. 2002;298(5594):824 -- 827. 8. Przulj N, Corneil DG, Jurisica I. Modeling interactome: scale-free or geometric? Bioinformatics. 2004;20(18):3508 -- 3515. 9. Przulj N. Biological network comparison using graphlet degree distribution. Bioinformatics. 2007;23(2):e177 -- e183. 10. Yaveroglu ON, Malod-Dognin N, Davis D, Levnajic Z, Janjic V, Karapandza R, et al. Revealing the hidden language of complex networks. Scientific reports. 2014;4:4547. 11. Kuchaiev O, Milenkovi´c T, Memisevi´c V, Hayes W, Przulj N. Topological network alignment uncovers biological function and phylogeny. Journal of The Royal Society Interface. 2010;7(50):1341 -- 1354. doi:10.1098/rsif.2010.0063. 12. Malod-Dognin N, Przulj N. L-GRAAL: Lagrangian Graphlet-based Network Aligner. Bioinformatics. 2015;doi:10.1093/bioinformatics/btv130. 13. Saraph V, Milenkovi´c T. MAGNA: maximizing accuracy in global network alignment. Bioinformatics. 2014;30(20):2931 -- 2940. 14. Mamano N, Hayes W. SANA: Simulated Annealing far outperforms many other search algorithms for biological network alignment. Bioinformatics. 2017;0(0):8. 15. Hocevar T, Demsar J. A combinatorial approach to graphlet counting. Bioinformatics. 2014;30(4):559 -- 565. doi:10.1093/bioinformatics/btt717. 16. Melckenbeeck I, Audenaert P, Michoel T, Colle D, Pickavet M. An Algorithm to Automatically Generate the Combinatorial Orbit Counting Equations. PLoS ONE. 2016;11(1). doi:http://dx.doi.org/10.1371/journal.pone.0147078. 17. Chatr-aryamontri A, Breitkreutz BJ, Heinicke S, Boucher L, Winter A, Stark C, et al. The BioGRID interaction database: 2013 update. Nucleic Acids Research. 2013;41(D1):D816 -- D823. doi:10.1093/nar/gks1158. 18. Pillich RT, Chen J, Rynkov V, Welker D, Pratt D. NDEx: A Community Resource for Sharing and Publishing of Biological Networks. Protein Bioinformatics: From Protein Modifications and Networks to Proteomics. 2017; p. 271 -- 301. 19. Camacho C, Coulouris G, Avagyan V, Ma N, Papadopoulos JS, Bealer K, et al. BLAST+: architecture and applications. BMC Bioinformatics. 2009;10:421. 20. Rahman M, Bhuiyan MA, Al Hasan M. Graft: An efficient graphlet counting method for large graph analysis. IEEE Transactions on Knowledge and Data Engineering. 2014;26(10):2466 -- 2478. 21. Przulj N, Corneil DG, Jurisica I. Efficient estimation of graphlet frequency distributions in protein -- protein interaction networks. Bioinformatics. 2006;22(8):974 -- 980. 22. Sloane N. Online Encyclopedia of Integer Sequences (OEIS);. Available from: http://oeis.org/A000088. 23. Mckay BD. Nauty; 2010. Available from: http://users.cecs.anu.edu.au/bdm/nauty. PLOS 12/13 24. Codenotti P, Katebi H, Sakallah KA, Markov IL. Conflict Analysis and Branching Heuristics in the Search for Graph Automorphisms. In: Tools with Artificial Intelligence (ICTAI). IEEE; 2013. 25. Gross JL. Graph Theory -- Lecture 2: Structure and Representation -- Part A;. Available from: http://www.cs.columbia.edu/cs4203/files/GT-Lec2.pdf. 26. Automorphism of a group;. Available from: https: //groupprops.subwiki.org/wiki/Automorphism_of_a_group. 27. Sloane N. Online Encyclopedia of Integer Sequences (OEIS);. Available from: http://oeis.org/A000666. PLOS 13/13
1610.00209
1
1610
2016-10-02T00:15:53
Real Stability Testing
[ "cs.DS" ]
We give a strongly polynomial time algorithm which determines whether or not a bivariate polynomial is real stable. As a corollary, this implies an algorithm for testing whether a given linear transformation on univariate polynomials preserves real-rootedness. The proof exploits properties of hyperbolic polynomials to reduce real stability testing to testing nonnegativity of a finite number of polynomials on an interval.
cs.DS
cs
Real Stability Testing ∗ Prasad Raghavendra EECS UC Berkeley Nick Ryder Mathematics UC Berkeley Nikhil Srivastava Mathematics UC Berkeley October 4, 2016 1 Introduction A univariate polynomial with real coefficients is called real-rooted if all of its roots are real. Multivari- ate generalizations of this concept, known as hyperbolic and real stable polynomials, were defined in the 50's and in the 80's in the context of Partial Differential Equations and Control Theory, respec- tively1, and have since made contact with several areas of mathematics. In particular, a polynomial p ∈ R[x1, . . . , xn] is called real stable if it has no zeros with all coordinates in the open upper half of the complex plane. These polynomials have played a central role in several recent advances in theo- retical computer science and combinatorics - for instance, [AG14, MSS15a, MSS13, GSS11, BBL09]. Each of these works relies in a critical way on (1) understanding which polynomials are real stable (2) understanding which linear operators preserve real-rootedness and real stability. Motivated by (1) and (2), this paper studies the following two fundamental algorithmic problems: Problem 1. Given a bivariate polynomial2 p ∈ Rn[x, y], is p real stable? Problem 2. Given a linear operator T : Rn[x] → Rm[x], does T preserve real-rootedness? Problem 1 was solved in the univariate case by C. Sturm in 1835 [Stu35], who described a now well-known method that can be turned into a strongly polynomial quadratic time algorithm given the coefficients of p [BPR05]. However, we are unaware of any algorithm (polynomial time or not) for the bivariate case, or for Problem 2. The main result of this paper is a strongly polynomial time algorithm that solves Problem 1. Theorem 1.1 (Main). Given the coefficients of a bivariate polynomial p ∈ Rn[x, y], there is a deterministic algorithm which decides whether or not p is real stable in at most O(n5) arithmetic operations, assuming exact arithmetic. Part of the motivation for solving Problem 1 is the following theorem of Borcea and Branden, which shows that Problem 2 can be reduced to Problem 1. Theorem 1.2 (Borcea-Branden [BB09]). For every linear transformation T : Rn[x] → Rm[x], there is a bivariate polynomial p ∈ Rmax(n,m)[x, y] such that T preserves real-rootedness if and only if p is real stable. Moreover, the coefficients of p can be computed from the matrix of T in linear time. ∗This research was supported by NSF Grants CCF-1553751, NSF CCF-1343104 and NSF CCF-1407779. 1See [Pem12] for a more detailed history. 2We use Rn[x1, . . . , xk] to denote the vector space of real polynomials in x1, . . . , xk of degree at most n in each variable. 1 Thus, our main theorem immediately implies a solution to Problem 2 as well. To give the reader a feel for the objects at hand, we remark that the set of real stable polynomials in any number of variables is a nonconvex set with nonempty interior [Nui69]. In the univariate case, the interior of the set of real-rooted polynomials simply corresponds to polynomials with distinct roots, and its boundary contains polynomials which have roots with multiplicity greater than one. With regards to Problem 2, the prototypical example of an operator which preserves real rootedness is differentiation. Recent applications such as [MSS15b] rely on finding more elaborate differential operators with this property. We now describe the main ideas in our algorithm. It turns out that testing bivariate real stability is equivalent to testing whether a certain two parameter family of polynomials is real rooted. It is not clear how to check this continuum of real-rootedness statements in polynomial, or even in exponential time. To circumvent this, we use a deep convexity result from the theory of hyperbolic polynomials to reduce the two parameter family to a one parameter family of degree n polynomials, whose coefficients are themselves polynomials of degree n in the parameter. We then use a characterization of real-rootedness as postive semidefiniteness of certain moment matrices to further reduce this to checking that a finite number of univariate polynomials are nonnegative an interval. Finally, we solve each instance of the nonnegativity problem using Sturm sequences and a bit of algebra. The set of polynomials nonnegative on an interval forms a closed convex cone, so the last step of our algorithm may be viewed as a strongly polynomial time membership oracle for this cone. We would not be surprised if such a result is already known (at least as folklore) but we were unable to find a concrete reference in the literature, so this component of our method may be of independent interest. We see this result as being both mathematically fundamental, as well as useful for researchers who work with stable polyomials, particularly since many of their known applications so far (e.g.[MSS15a]) put special emphasis on properties of bivariate restrictions. More speculatively, it is possible that being able to test membership in the set of real stable polynomials is a step towards being able to optimize over them. 1.1 Related Work The paper [Hen10] studied the problem of testing whether a bivariate polynomial is real zero (a special case of real stability). It reduced that problem to testing PSDness of a one-parameter family of matrices which it then suggested could be solved using semidefinite programming, but without quite proving a theorem to that effect. This work is partly inspired by ideas in [Hen10]. The paper [KPV15] gives semidefinite programming based algorithms that can test whether certain restricted classes of multiaffine polynomials are real stable (in more than 2 variables). The problem of certifying that a univariate polynomial is nonnegative is typically stated (for instance, in lecture notes) as being the solution to a semidefinite program. If one were able to work out the appropriate error to which the SDP has to be solved, this could give a weakly polynomial time algorithm for nonnegativity, which we suspect must be known as folklore. The paper [PP08] analyzes a semidefinite programming based algorithm in the special case when the polynomial is nondegenerate in an appropriate sense. 2 1.2 Acknowledgments We thank Eric Hallman, Jonathan Leake, and Bernd Sturmfels for valuable discussions. We also thank Didier Henrion for valuable correspondence regarding other algorthimic approaches to these problems. 2 Real Stable and Hyperbolic Polynomials We recall below the definition of a real stable polynomial in an arbitrary number of variables. Definition 2.1. A polynomial p ∈ R[x1, . . . , xn] is called real stable if it is identically zero3 or if p(z1, . . . , zn) , 0 whenever Im(zi) > 0 for all i = 1, . . . , n. Equivalently, p is real stable if and only if the univariate restrictions are real rooted whenever e1, . . . , en > 0 and x1, . . . , xn ∈ R. t 7→ p(te1 + x1, te2 + x2, . . . , ten + xn) The equivalence between the two formulations above is an easy exercise. Note that a univariate polynomial is real stable if and only if it is real rooted. Note that we consider the zero polynomial to be real-rooted. We will frequently use the elementary fact that a limit of real-rooted polynomials is real-rooted, which follows from Hurwitz's theorem (see, e.g. [Wag11, Sec. 2]), or from the argument principle. Real Stable polynomials are closely related to the following more general class of polynomials. Definition 2.2. A homogeneous polynomial p ∈ R[x1, . . . , xn] is called hyperbolic with respect to a point e = (e1, . . . , en) ∈ Rn if p(e) > 0 and the univariate restrictions t 7→ p(te + x) are real rooted for all x ∈ Rn. The connected component of {x ∈ Rn : p(x) , 0} containing e is called the hyperbolicity cone of p with respect to e, and will be denoted K(p, e). Perhaps the most familiar example of a hyperbolic polynomial is the determinant of a symmetric matrix: X 7→ det(X) for real symmetric X, which is hyperbolic with respect to the identity matrix since the characteristic polynomial of a symmetric matrix is always real rooted. The corresponding hyperbolicity cone is the cone of positive semidefinite matrices. The most important theorem regarding hyperbolic polynomials says that hyperbolicity cones are always convex, and that hyperbolicity at one point in the cone implies hyperbolicity at every other point. Thus, hyperbolic polynomials and hyperbolicity cones may be viewed as generalizing determinants and PSD cones. Theorem 2.3 (Garding [Gar59]). If p ∈ R[x1, . . . , xn] is hyperbolic with respect to e ∈ Rn then: 1. K(p, e) is an open convex cone. 2. p is hyperbolic with respect to every point y ∈ K(p, e). 3Some works (e.g. [BB09]) consider only nonzero polynomials to be stable, while others [Wag11] include the zero polynomial. We find the latter convention more convenient. 3 The reason hyperbolic polynomials are relevant in this work is that real stable polynomials are essentially a special case of them. Theorem 2.4 (Borcea-Branden [BB09]). A nonzero bivariate polynomial p(x, y) of total degree at most m is real stable if and only if its homogenization is hyperbolic with respect to every point in pH(x, y, z) := zmp(x/z, y/z) R2 >0 × {0} = {(e1, e2, 0) : e1, e2 > 0}. Thus, real stable polynomials enjoy the strong structural properties guaranteed by Theorem 2.3 as well, and we exploit these in our algorithm. 3 Parameter Reduction via Hyperbolicity In this section we use the properties of hyperbolic polynomials to reduce real stability of a bivariate polynomial to testing real rootedness of a one parameter family of polynomials. Theorem 3.1 (Reduction to One-Parameter Family). A nonzero bivarite polynomial p ∈ Rn[x, y] ofis real stable if and only if following two conditions hold: 1. The one-parameter family of univariate polynomials qγ ∈ R[t] given by, qγ(t) = p(γ + t, t) ∈ R[t] are real rooted for all γ ∈ R. 2. The univariate polynomial is strictly positive on the interval (0, 1), t 7→ pH(t, 1 − t, 0) Proof. (real-stability of p =⇒ (1) & (2)) By Theorem 2.4, pH is hyperbolic with respect to the positive orthant R2 >0 R2 × {0}, this implies that for all (x, y, z) ∈ R3, >0 × {0}. Since (1, 1, 0) ∈ q(t) = pH(x + t, y + t, z) is real-rooted. Setting x = γ, y = 0 and z = 1 we get that qγ(t) = pH(γ + t, t, 1) = p(γ + t, t) is real-rooted for all γ ∈ R which is condition (1). Finally, since {(t, 1 − t, 0)t ∈ (0, 1)} ⊂ R2 >0 × {0} , and pH is hyperbolic with respect to R2 >0 ((1) & (2) =⇒ real-stability of p) First, we claim that the polynomial pH is hyperbolic with respect to (1, 1, 0). By (2) we have pH(1/2, 1/2, 0) > 0 so homogeneity implies that pH(1, 1, 0) > 0. It remains to show that qx,y,z(t) = pH(x + t, y + t, z) is real-rooted for all (x, y, z) ∈ R3. First, consider the case of (x, y, z) ∈ R3 with z , 0. × {0}, it follows that pH(t, 1 − t, 0) > 0 for all t ∈ (0, 1). ∀(x, y, z) ∈ R3 with z , 0, pH(x + t, y + t, z) is real-rooted 4 ⇐⇒ ∀(x, y, z) ∈ R3 with z , 0, pH( ⇐⇒ ∀(x, y, z) ∈ R3 with z , 0, pH( + t z , + t, x z x z y z y z + t z , 1) is real-rooted + t, 1) is real-rooted (replacing t/z with t) ⇐⇒ ∀(x, y) ∈ R2, pH(x + t, y + t, 1) is real-rooted ⇐⇒ ∀(x, y) ∈ R2, pH(x + t, t, 1) is real-rooted (replacing t with t − y) ⇐⇒ ∀γ ∈ R, p(γ + t, t) is real-rooted By Hurwitz's theorem, the limit of any sequence of real-rooted polynomials is real-rooted. There- fore, if qx,y,z(t) is real-rooted for all (x, y, z) ∈ R3 with z , 0 then qx,y,z(t) is real-rooted for all (x, y, z) ∈ R3. Given that pH is hyperbolic with respect to e = ( 1 2 , 0), its hyperbolicity cone K(pH, e) is a convex cone containing (1, 1, 0). Condition (2) implies that the connected component of {xp(x) , 0} containing (1, 1, 0) contains the open line segment from (1, 0, 0) to (0, 1, 0). Together, this implies that the positive quadrant R2 × {0} ⊆ K(pH, e). By Theorem 2.4, this implies that p is real-stable. (cid:3) 2 , 1 Thus, our algorithmic goal is reduced to testing whether a one-parameter family is real-rooted, and whether a given univariate polynomial is positive on an interval. We solve these problems in the sequel. 4 Real-rootedness of one-parameter families In this section we present two algorithms for testing real-rootedness of a one-parameter family of polynomials. Both algorithms reduce this problem to verifying nonnegativity of a finite number of polynomials on the real line. The first algorithm produces n polynomials of degree roughly O(n3), and has the advantage of being very simple, relying only on elementary techniques and standard algorithms such as fast matrix multiplication and the discrete Fourier transform. The second algorithm produces n polynomials of degree roughly O(n2) and runs significantly faster, but uses somewhat more specialized (but nonetheless classical) machinery from the theory of resultants. 4.1 A Simple O(n3+ω) Algorithm The first algorithm is based on the observation that real-rootedness of a single polynomial is equivalent to testing positive semidefiniteness of its moment matrix, which in turn is equivalent to testing nonnegativity of the elementary symmetric polynomials of that matrix. In the more general case of a one-parameter family, the latter polynomials turn out to be polynomials of bounded degree in the parameter, and it therefore suffices to verify that these are nonnegative everywhere. We begin by recalling the Newton Identities, which express the moments of a polynomial in terms of its coefficients. Lemma 4.1 (Newton Identities). If p(x) = n Xk=0 (−1)kxn−kck = c0 n Yi=1 (x − xi) ∈ R[x] 5 with c0 , 0 is a univariate polynomial with roots x1, . . . , xn, then the moments satisfy the recurrence: mk := n Xi=1 xk i mk = (−1)k−1 ck c0 + k−1 Xi=1 (−1)k−1+i ck−i c0 mi 0 6 k 6 n, mk = k−1 Xk−n (−1)k−1+i ck−i c0 mi m0 = n. k > n, The following consequences of Lemma 4.1 will be relevant to analyzing our algorithm. Corollary 4.2. 1. The moments m0, . . . , m2n−2 of a degree n polynomial can be computed from its coefficients in O(n2) arithmetic operations. 2. Suppose p(x) = Pn k=0(−1)kxn−kck(γ) c0(γ), . . . , cn(γ) ∈ Rd[γ] in a parameter γ. Then the moments of p are given by is a polynomial whose coefficients are polynomials for some polynomials rk ∈ Rdk[γ]. mk(γ) = rk(γ)/c0(γ)k, Proof. The first claim follows because each application of the recurrence requires at most n arith- metic operations. For the second claim, observe that each ratio ck−i(γ)/c0(γ) is a rational function with a numerator of degree at most d and denominator c0(γ). Thus, each application of the recur- rence increases the degree of the numerator by at most d and introduces an additional c0 in the denominator. (cid:3) As a subroutine, we will also need the following standard result in linear algebra. Theorem 4.3 (Keller-Gehrig [KG85]). Given an n × n complex matrix A, there is an algorithm which computes the characteristic polynomial of A in time O(nω log n). We now specify the algorithm and prove its correctness. Theorem 4.4. A polynomial pγ(x) = Pn k=0(−1)kxn−kck(γ) is real-rooted for all γ ∈ R if and only if the polynomials q0, . . . , qn output by SimpleRR are nonnegative on R. Moreover, SimpleRR runs in time O(dn2+ω + d2n3). Proof. We first show correctness. Let mk(p) denote the kth moment of the roots of a polynomial. By Sylvester's theorem [BPR05, Theorem 4.58], a real polynomial pγ(x) = n Xk=0 (−1)kxn−kck(γ) is real-rooted if and only if the corresponding moment matrix M(γ)k,l := mk+l−2(pγ) 6 is positive semidefinite. Since ν is even and c0 has real coefficients, we have for every γ ∈ R that is not a root of c0: M(γ) (cid:23) 0 ⇐⇒ c0(γ)νM(γ) = H(γ) (cid:23) 0. Since c0 has only finitely many roots and a limit of PSD matrices is PSD, we conclude that M(γ) (cid:23) 0 ∀γ ∈ R ⇐⇒ H(γ) (cid:23) 0∀γ ∈ R. Note that by Corollary 4.2 the entries of H(γ) are polynomials of degree at most d(ν + 2n − 2) in γ. We now recall a well-known4 (e.g., [HJ12]) characterization of positive semidefiniteness as a semialgebraic condition: an n × n real symmetric matrix A is PSD if and only if ek(A) > 0 for all k = 1, . . . , n, where ek(A) = XS=k det(AS,S) is the sum of all k × k principal minors of A. Thus, pγ is real-rooted for all γ ∈ R if and only if the polynomials qk(γ) := ek(H(γ)) for k = 1, . . . , n are nonnegative on R. Since each qk is a sum of determinants of order at most n in H(γ) it has degree at most n in the entries of H(γ), and we conclude that q1, . . . , qn ∈ RN[γ]. Thus, the qk can be recovered by interpolating them at the Nth roots of unity. Since the kth elementary symmetric function of a matrix is the coefficient of zn−k in its characteristic polynomial, this is precisely what is achieved in Step 2. For the complexity analysis, it is clear that Step 1 takes O(dn2) time. Constructing each Hankel matrix H(si) takes time O(dn + n2) by Corollary 4.2, and computing its elementary symmetric functions via the characteristic polynomial takes time O(nω log n), according to Theorem 4.3. Thus, the total time for each iteration is O(nω log n+dn), so the time for all iterations is O(dn2+ω log n+d2n3). The final step requires O(N log N) time for each ek using fast polynomial interpolation via the discrete Fourier transform, for a total of O(dn3 log n). Thus, the total running time is O(dn2+ω +d2n3), suppressing logarithmic factors. (cid:3) 4Here is a short proof: A is PSD iff det(zI − A) has only nonnegative roots. Since A is symmetric we know the roots are real. We now observe that a real-rooted polynomial has nonnegative roots if and only if its coefficients alternate in sign. 7 Algorithm SimpleRR Input: (n + 1) univariate polynomials c0, . . . , cn ∈ Rd[γ] with c0 . 0. Output: n univariate polynomials q1, . . . , qn ∈ R 3n2d[γ] 1. Let ν be the first even integer greater than or equal to n and let N = nd(2n − 2 + ν) = O(dn2). Let s1, . . . , sN ∈ C be the Nth roots of unity. 2. For each i = 1, . . . N: • Compute the n × n Hankel matrix H(si) with entries H(si)k,l := c0(si)νmk+l−2(psi), by applying the Newton identities (Lemma 4.1). • Compute the characteristic polynomial det(zI − H(si)) = n Xk=0 (−1)kzn−kek(H(si)) using the Keller-Gehrig algorithm (Theorem 4.3). 3. For each k = 1, . . . , n: Use the points ek(H(s1)), . . . , ek(H(sN)) to interpolate the coefficients of the polynomial Output q1, . . . , qn. qk(γ) := ek(H(γ)). 4.2 A Faster O(n4) Algorithm Using Subresultants The algorithm of the previous section is based on the generic fact that a matrix is PSD if and only if its elementary symmetric polynomials are nonnegative. In this section we exploit the fact that our matrices have a special structure – namely, they are moment matrices – to find a different finite set of polynomials whose nonnegativity suffices to certify their PSDness. These polynomials are called subdiscriminants, and turn out to be related to another class of polynomials called subresultants, for which there are known fast symbolic algorithms. Let Mp denote the n × n moment matrix corresponding to a polynomial p of degree n. Recall that Mp = VVT where V is the Vandermonde matrix formed by the roots of p. Let (Mp)i denote the leading principal i × i minor of Mp. We define subdiscriminants of a polynomial, and then show their relation to the leading principal minors of the moment matrix. For the remainder of this section it will be more convenient to use the notation p(x) = n Xk=0 akxk for the coefficients of a polynomial, with roots x1, . . . , xn and an , 0. Definition 4.5. The kth subdiscriminant of a polynomial p is defined as sDisck(p) = a2k−2 n XS⊂{1,...,n},S=k Y{i, j}⊂S (xi − xj)2 8 Lemma 4.6. The leading principal minors of the moment matrix are multiples of the subdiscriminants, (Mp)i = a2−2k n sDisck(p) = XS⊂{1,...,n},S=k Y{i, j}⊂S (xi − xj)2 Proof. Let Vi = 1 x1 ... xi−1 1 1 . . . xn . . . ... ... . . . xi−1 n  .  Then (Mp)i = det(ViVT i ). By Cauchy-Binet, this determinant is the sum over the determinants of all submatrices of size i × i. These submatrices are exactly the Vandermonde matrices formed by subsets of the roots of size i. Then the identity follows from the formula for the determinant of a Vandermonde matrix. (cid:3) Equipped with this we can provide an alternative characterization of real rootedness. Define the sign of a number, denoted sgn to be +1 if it is positive, −1 if it is negative, and 0 otherwise. Lemma 4.7. p is real-rooted if and only if the sequence sgn(sDisc1(p)), . . . , sgn(sDiscn(p)) is first 1's and then 0's. n Proof. Note that since an , 0 we have sgn(Disck) = sgn(a2(1−k) Disck) = sgn((Mp)i). It is clear from the definition of the subdiscriminants that if p is real-rooted with k distinct roots then sDisci is positive if i 6 k and sDisci = 0 if i > k. Conversely, given a polynomial p with k distinct roots, then if i > k we have all the minors of size i in VT is singular. Let x1, x2, . . . , xj be the real distinct roots of p and y1, ¯y1, . . . , yl, ¯yl be the distinct complex conjugate pairs of p where j + l = k. Suppose the multiplicities of xi are ni and yi are mi. Then the top left k × k submatrix of Mp is i contain two identical rows, and hence VT i does not have full rank, so ViVT i = Xi ni h1 xi · · · xk−1 i i +Xi mi h1 yi · · · yk−1 i i + ¯yi · · · ¯yi k−1i 1 ¯yi ... k−1 ¯yi   h1 1 = Xi ni h1 xi · · · xk−1 i i +Xi mi Re(yi) ... 1 Im(yi) ... 0 0 −1# "1 Re(yk−1 i ) Im(yk−1 i )  1 Im(yi) ... ) Im(yk−1 i ) Re(yi) ... Re(yk−1 i  T  This shows that this submatrix is positive definite if and only if the distinct roots are all real. Note that by Sylvester's criterion this submatrix is positive definite if and only if all the leading principal minors of size 6 k are positive. (cid:3) We now obtain a formula for the subdiscriminants of a polynomial in terms of its coefficients. The connection is provided by another family of polynomials called the subresultants. 9 1 xi ... xk−1 i 1 xi ... xk−1 i     1 yi ... yk−1 i  1   Definition 4.8. Let p = Pn k=0 akxk where an , 0. The kth subresultant of p, denoted sResk(p, p′) is the determinant of the submatrix obtained from the first 2n − 1 − 2k columns of the following (2n − 1 − 2k) × (2n − 1 − k) matrix: an 0 ... ... ... 0 nan · · · . . . . . . . . . . . . · · · · · · · · · · · · a0 · · · nan · · · · · · · · · · · · an 0 . . . · · · · · · a1 . . . 0 0 . . . · · · · · · . . . . . . · · · 0 0 a0 a1 0 ... 0   We will use two properties of subresultants. The first is a good bound on their degree as a consequence of the determinantal formula above. The second is quick algorithm to compute them. We refer the reader to [BPR05] for a more detailed discussion of subresultants. In this paper we will only be interested in subresultants of a polynomial with its derivative We are interested in this because of its relation to our leading principal minors: Lemma 4.9 ([BPR05] Proposition 4.27). Let p(x) = Pn k=0 akxk where an , 0 sResk(p, p′) = ansDiscn−k(p) Corollary 4.10. Since the first column of the determinant used to define the subresultant is divisible by an, we get sDisck(p) is a polynomial in our coefficients an, . . . , a0 of degree at most 2n. The benefit of studying the principal minors instead of the coefficients of the characteristic polyno- mial for our moment matrix is that we can use an algorithm from subresultant theory to quickly calculate all the minors at once. Theorem 4.11 ([BPR05] Algorithm 8.21). There exists an algorithm which, given a polynomial p of degree n returns a list of all of its subresultants sResk(p, p′) for k = 1, . . . , n in O(n2) time. Remark 4.12. Many computer algebra systems (e.g., Mathematica, Macaulay2) have built-in efficient algorithms to compute subresultants. We now combine the above facts to obtain a crisp condition for real-rootedness of a one-parameter family. Recall that by Theorem 3.1, we are interested in testing when a family of polynomials pγ(x) are real-rooted for all γ ∈ R, where pγ(x) = n Xk=0 ak(γ)xk with ck ∈ Rn[γ]. Let cm(γ) be the highest coefficient that is not identically zero. We are only interested in the case when m > 2. Proposition 4.13. If pγ(x) = Pn at most 2dn. k=0 xkck(γ) with ck ∈ Rd[γ], then sDisck(pγ) is a polynomial in γ of degree Proof. From our previous lemma, we know that sDisck is a polynomial in the coefficients of p of degree at most 2n. Since each of these coefficients ck(γ) is a polynomial in γ of degree at most d, our result follows. (cid:3) 10 We now extend our characterization of real-rootedness in terms of the signs of the principal minors of a fixed polynomial to a characterization for coefficients which are polynomials in γ. Theorem 4.14. pγ(x) is real-rooted for all γ ∈ R if and only if there exists a k such that sDisci(pγ) is a nonnegative polynomial which is not identically zero for all i 6 k and sDisci(pγ) is identically zero for i > k. Proof. First suppose that pγ(x) is real rooted for all γ ∈ R. Observe that cm(γ) vanishes for at most finitely many points Z1. Moreover, the degree m discriminant of pγ is a polynomial in γ, and is zero for at most finitely many points - call them Z2. Thus, for γ < Z1 ∪ Z2, we know that pγ has exactly m distinct real roots, so by Lemma 4.7 sDisci(pγ) is strictly positive for i 6 m and zero for i > m on this set. By continuity this implies that sDisci(pγ) is nonnegative and not identically zero on R for i 6 m, and sDisci(pγ) is identically zero for i > m, as desired. To prove the converse, note that for i 6 k, sDisci(pγ(t)) is not identically zero, and hence there are finitely many γ away from which sDisci(pγ) is positive for all i 6 k, and then all zero. By Lemma 4.7 we get that pγ(x) is real rooted for all these γ. Since real-rootedness is preserved by taking limits (by Hurwitz's theorem), we conclude that pγ(x) is real rooted for all γ ∈ R. (cid:3) Combining these observations, and using the O(n2) time algorithm to compute the subdiscrimi- nants, we arrive at the following O(n4) time algorithm for computing all the subdiscriminants. Algorithm FastRR Input: (n + 1) univariate polynomials c0, . . . , cn ∈ Rd[γ] with c0 . 0. Output: n univariate polynomials q1, . . . , qn ∈ R2dn[γ] 1. Find distinct points γ1, . . . , γ2dn ∈ such that cm(γi) , 0. 2. For each γi use the subresultant algorithm (Theorem 4.11) to compute all of the sResk(pγi), with k = 1, . . . , n. 3. Use the above values to compute 2dn different values qk(γ1), . . . , qk(γ2dn) for each of the polynomials k = 1, . . . , n. qk(γ) := sDisck(pγ) = cm(γ)−1sResm−k(pγ)), 4. Use fast interpolation to compute the coefficients of q1, . . . , qn. Output q1, . . . , qn. Theorem 4.15. FastRR runs in O(n4) time. Proof. Since cn(γ) is of degree at most d we can test 2dn + d points to find 2dn points on which cn(γ) doesnt vanish. Each evaluation takes O(d) times, so total this takes O(d2n) time. To compute sResk(pγi) for each 0 6 k 6 n − 1 and 1 6 i 6 2dn takes O(dn3) time by Theorem 4.11. Then to scale all the subresultants, since we have O(dn2) data points and have already computed cn(γi) takes O(dn2) time. Finally, since the degrees of the qk are at most 2dn, the total time to interpolate all of them is O(dn2 log n). (cid:3) 11 5 Univariate Nonnegativity Testing In this section, we describe an algorithm to test non-negativity of a univariate polynomial over the real line. Let p ∈ R[x] denote a univariate polynomial of degree d. The goal of the algorithm is to test if p(x) > 0 for all x ∈ R. A canonical approach for the problem would be to use a Sum-of-Squares semidefinite program to express p as a sum of squares of low-degree polynomials. Unfortunately, the resulting algorithm is not a symbolic algorithm, i.e., its runtime is not strongly polynomial in the degree d, since semidefinite programming is not known to be strongly polynomial. We will now describe a strongly polynomial time algorithm to test non-negativity of the polynomial p. Our starting point is an algorithm to count the number of real roots of a polynomial using Sturm sequences. We refer the reader to Basu et al. [BPR05] for a detailed presentation of Sturm sequences and algorithms to compute them. For our purposes, we will need the following lemma. Lemma 5.1. Given a univariate polynomial p ∈ R[x], the algorithm based on computing Sturm sequences uses O(deg(p)2) arithmetic operations to determine the number of real roots of p. The polynomial p is positive, i.e., p(x) > 0 for all x ∈ R, if and only if it has no real roots. Therefore, Lemma 5.1 yields an algorithm to test positivity using in O(d2) arithmetic operations. To test non- negativity, the only additional complication stems from the roots of the polynomial p. We begin with a simple observation. Fact 5.2. If p ∈ R[x] is monic then p(x) > 0 for all x ∈ R if and only if p has no real roots of odd multiplicity. Definition 5.3. A square-free decomposition of a polynomial p ∈ R[x] of degree d, is a set of polynomials {a1, . . . , ad} ∈ R[x] such that p(x) = d Yi=1 ai(x)i , and each ai has no roots with multiplicity greater than one. Alternately, for each i ∈ [d], ai(x)i consists of all roots of p with multiplicity exactly i. Square-free decompositions can be computed efficiently using gcd computations. Yun [Yun76] carries out a detailed analysis of square-free decomposition algorithms. In particular, he shows that an algorithm due to Musser can be used to compute square-free decompositions at the cost of constantly many gcd computations. Now, we are ready to describe an algorithm to test non-negativity. 12 Algorithm Nonnegative Input A monic polynomial p ∈ R[x], deg(p) = d Goal Test if p(x) > 0 for all x ∈ R. 1. Using Musser's algorithm, compute the square-free decomposition of p given by, p = Yi∈[d] ai i where ai ∈ R[x] has no roots with multiplicity greater than 1. 2. For each i ∈ [⌈ d 2 ⌉] • Using Sturm sequences, test if a2i−1 has real roots. If a2i−1 has real roots p is NOT non-negative. Runtime. Let Tcd(d) denote the time-complexity of computing the gcd of two univariate polyno- mials of degree d. The runtime of Musser's square-free decomposition algorithm is within constant factors of Tcd(d). Let Sreal(ℓ) denote the time-complexity of determining if a degree ℓ polynomial has no real roots. Observe that deg(ai) 6 deg(p) = d Xi Since Sreal(ℓ) is super-linear in ℓ, we have Pi∈[d] Sreal(ai) 6 Sreal(d) . The run-time of the algorithm is given by O(Tcd(d) + Sreal(d)). Using Sturm sequences, Sreal(d) = O(d2) elementary operations on real numbers (see [BPR05]). Using Euclid's algorithm, Tcd(d) = O(d2) elemenetary operations on real numbers. This yields an algorithm for non-negativity that incurs at most O(d2) elementary operations. 6 Conclusion and Discussion Finally, we combine the ingredients from sections 3, 4, and 5 to obtain the proof of our main theorem. Proof of Theorem 1.1. Given the coefficients of p, we can compute the coefficients of the one- parameter family in (1) of Theorem 3.1 in time at most O(n3). By Theorem 4.15, FastRR produces the polynomials q1, . . . , qn in time O(n4). We check that some final segment of these polynomials are identically zero by evaluating each one at O(n2) points. These polynomials have degree O(n2), so Nonnegative requires time O(n4) to check nonnegativity of each remaining one, for a total running time of O(n5). For part (2) of Theorem 3.1, we simply use a Sturm sequence to ensure that there are no roots in (0, 1), and then evaluate the polynomial at a single point to check that the sign is positive. (cid:3) The algorithm in this paper offers a starting point in the area of polynomial time algorithms for real stability. In addition to the obvious possibility of improving the running time to say O(n4) or below, several natural open questions remain: • Can the algorithm be generalized to 3 or more variables? The bottleneck to doing this is that we do not know how to check real rootedness of 2-parameter families, or equivalently, nonnegativity of bivariate polynomials. 13 • Is there an algorithm for testing whether a given polynomial is hyperbolic with respect to some direction, without giving the direction as part of the input? • Is there an algorithm for testing stability of bivariate polynomials with complex coefficients? Perhaps leaving the realm of strongly polynomial time algorithms, the major open question in this area is the following: a famous theorem of Helton and Vinnikov [HV07] asserts that every bivariate real stable polynomial can be written as p(x, y) = det(xA + yB + C) for some positive semidefinite matrices A, B and real symmetric C. Unfortunately, their proof does not give an efficient algorithm for finding these matrices. Can the ideas in this paper, perhaps via using SDPs to find sum-of-squares representations of certain nonnegative polynomials derived from p, be used to obtain such an algorithm? References [AG14] Nima Anari and Shayan Oveis Gharan, The kadison-singer problem for strongly rayleigh measures and applications to asymmetric tsp, arXiv preprint arXiv:1412.1143 (2014). [BB09] Julius Borcea and Petter Brändén, The lee-yang and pólya-schur programs. i. linear operators preserving stability, Inventiones mathematicae 177 (2009), no. 3, 541–569. [BBL09] Julius Borcea, Petter Brändén, and Thomas Liggett, Negative dependence and the geometry of polynomials, Journal of the American Mathematical Society 22 (2009), no. 2, 521–567. [BPR05] Saugata Basu, Richard Pollack, and Marie-Francoise Roy, Algorithms in real algebraic geometry, vol. 20033, Springer, 2005. [Gar59] Lars Garding, An inequality for hyperbolic polynomials, Journal of Mathematics and Me- chanics 8 (1959), no. 6, 957–965. [GSS11] Shayan Oveis Gharan, Amin Saberi, and Mohit Singh, A randomized rounding approach to the traveling salesman problem, Foundations of Computer Science (FOCS), 2011 IEEE 52nd Annual Symposium on, IEEE, 2011, pp. 550–559. [Hen10] Didier Henrion, Detecting rigid convexity of bivariate polynomials, Linear Algebra and its Applications 432 (2010), no. 5, 1218–1233. [HJ12] Roger A Horn and Charles R Johnson, Matrix analysis, Cambridge university press, 2012. [HV07] J William Helton and Victor Vinnikov, Linear matrix inequality representation of sets, Com- munications on pure and applied mathematics 60 (2007), no. 5, 654–674. [KG85] Walter Keller-Gehrig, Fast algorithms for the characteristics polynomial, Theoretical com- puter science 36 (1985), 309–317. [KPV15] Mario Kummer, Daniel Plaumann, and Cynthia Vinzant, Hyperbolic polynomials, inter- lacers, and sums of squares, Mathematical Programming 153 (2015), no. 1, 223–245. 14 [MSS13] Adam Marcus, Daniel A Spielman, and Nikhil Srivastava, Interlacing families i: Bipartite ramanujan graphs of all degrees, Foundations of Computer Science (FOCS), 2013 IEEE 54th Annual Symposium on, IEEE, 2013, pp. 529–537. [MSS15a] Adam W Marcus, Daniel A Spielman, and Nikhil Srivastava, Interlacing families ii: Mixed characteristic polynomials and the kadison–singer problem, Annals of Mathematics 182 (2015), no. 1, 327–350. [MSS15b] , Interlacing families iv: Bipartite ramanujan graphs of all sizes, Foundations of Computer Science (FOCS), 2015 IEEE 56th Annual Symposium on, IEEE, 2015, pp. 1358– 1377. [Nui69] Wim Nuij, A note on hyperbolic polynomials, Mathematica Scandinavica 23 (1969), no. 1, 69–72. [Pem12] Robin Pemantle, Hyperbolicity and stable polynomials in combinatorics and probability, arXiv preprint arXiv:1210.3231 (2012). [PP08] Helfried Peyrl and Pablo A Parrilo, Computing sum of squares decompositions with rational coefficients, Theoretical Computer Science 409 (2008), no. 2, 269–281. [Stu35] Charles Sturm, Mémoire sur la résolution des équations numériques, 1835. [Wag11] David Wagner, Multivariate stable polynomials: theory and applications, Bulletin of the American Mathematical Society 48 (2011), no. 1, 53–84. [Yun76] David Y.Y. Yun, On square-free decomposition algorithms, Proceedings of the Third ACM Symposium on Symbolic and Algebraic Computation (New York, NY, USA), SYMSAC '76, ACM, 1976, pp. 26–35. 15
1610.06008
3
1610
2018-07-07T17:31:19
K-clique-graphs for Dense Subgraph Discovery
[ "cs.DS" ]
Finding dense subgraphs in a graph is a fundamental graph mining task, with applications in several fields. Algorithms for identifying dense subgraphs are used in biology, in finance, in spam detection, etc. Standard formulations of this problem such as the problem of finding the maximum clique of a graph are hard to solve. However, some tractable formulations of the problem have also been proposed, focusing mainly on optimizing some density function, such as the degree density and the triangle density. However, maximization of degree density usually leads to large subgraphs with small density. In this paper, we introduce the k-clique-graph densest subgraph problem, k >= 3, a novel formulation for the discovery of dense subgraphs. Given an input graph, its k-clique-graph is a new graph created from the input graph where each vertex of the new graph corresponds to a k-clique of the input graph and two vertices are connected with an edge if they share a common (k-1)-clique. We define a simple density function, the k-clique-graph density, which gives compact and at the same time dense subgraphs, and we project its resulting subgraphs back to the input graph. In this paper we focus on the triangle-graph densest subgraph problem obtained for k=3. To optimize the proposed function, we present an efficient greedy approximation algorithm that scales well to larger graphs. We evaluate the proposed algorithm on real datasets and compare it with other algorithms in terms of the size and the density of the extracted subgraphs. The results verify the ability of the proposed algorithm in finding high-quality subgraphs in terms of size and density. Finally, we apply the proposed method to the important problem of keyword extraction from textual documents.
cs.DS
cs
K-clique-graphs for Dense Subgraph Discovery Giannis Nikolentzos1,2, Polykarpos Meladianos1,2, Yannis Stavrakas3, and Michalis Vazirgiannis1,2 1 Lix, ´Ecole Polytechnique, France 2 Athens University of Economics and Business, Greece 3 Institute for the Management of Information Systems RC "Athena", Greece {nikolentzos,pmeladianos,mvazirg}@aueb.gr, [email protected] Abstract. Finding dense subgraphs in a graph is a fundamental graph mining task, with applications in several fields. Algorithms for identifying dense subgraphs are used in biology, in finance, in spam detection, etc. Standard formulations of this problem such as the problem of finding the maximum clique of a graph are hard to solve. However, some tractable formulations of the problem have also been proposed, focusing mainly on optimizing some density function, such as the degree density and the triangle density. However, maximization of degree density usually leads to large subgraphs with small density, while maximization of triangle density does not necessarily lead to subgraphs that are close to being cliques. In this paper, we introduce the k-clique-graph densest subgraph problem, k ≥ 3, a novel formulation for the discovery of dense subgraphs. Given an input graph, its k-clique-graph is a new graph created from the input graph where each vertex of the new graph corresponds to a k-clique of the input graph and two vertices are connected with an edge if they share a common k − 1-clique. We define a simple density function, the k-clique-graph density, which gives compact and at the same time dense subgraphs, and we project its resulting subgraphs back to the input graph. In this paper, we focus on the triangle-graph densest subgraph problem obtained for k = 3. To optimize the proposed function, we present an efficient greedy approximation algorithm that scales well to larger graphs. We evaluate the proposed algorithm on real datasets and compare it with other algorithms in terms of the size and the density of the extracted sub- graphs. The results verify the ability of the proposed algorithm in finding high-quality subgraphs in terms of size and density. Finally, we apply the proposed method to the important problem of keyword extraction from textual documents. 1 Introduction In recent years, graph-based representations have become extremely popular for modelling real-world data. Some examples of data represented as graphs include social networks, protein or gene regulation networks and textual documents. The 2 problem of extracting dense subgraphs from such graphs has received a lot of attention due to its potential applications in many fields. Specifically, in the web graph, dense subgraphs may correspond to link spam [18] and hence, they can be used for spam detection. In bioinformatics, they are used for finding molec- ular complexes in protein-protein interaction networks [6] and for discovering motifs in genomic DNA [17]. In the field of finance, they are used for discover- ing migration motifs in financial markets [14]. Other applications include graph compression [10], graph visualization [1], real-time identification of important stories in Twitter [3] and community detection [12]. Given an undirected, unweighted graph G = (V, E), we will denote V = n the number of vertices and E = m the number of edges. Given a subset of vertices S ⊆ V , let E(S) be the set of edges that have both end-points in S. Hence, G(S) = (S, E(S)) is the subgraph induced by S. The density of the set (cid:1), the number of edges in S over the total possible edges. S is δ(S) = E(S)/(cid:0)S 2 Finding the set S that maximizes δ is not a meaningful problem, as density δ does not take into account the size of the subgraph. For example, a subgraph consisting of two vertices connected with an edge has higher density δ than a subgraph consisting of 100 vertices and all but one edge between them. However, clearly, we would prefer the latter subgraph from the former even if it achieves a lower value of density δ. Typically, the problem of dense subgraph discovery asks for a set of vertices S which is large and which has high density. Several different functions have been proposed in the literature that aim to solve this problem. Some of these functions can be optimized in polynomial time, however, most of these formulations of extracting dense subgraphs are NP-hard and also hard to approximate. Recently, there was a growing interest in the extraction of subgraphs whose vertices are highly connected to each other [32,7,31]. However, existing methods do not always find subgraphs with high density δ. Instead, they prefer subgraphs with many vertices even if their density δ is not very high. In many cases, we are interested in discovering sets of vertices where there is an edge between almost all their pairs. In this paper, we introduce a new formulation for extracting dense subgraphs. We define a new family of functions for measuring the density of a subgraph and we provide exact and approximate algorithms that allow the extraction of large subgraphs with high density δ by maximizing these functions. Our contributions are fourfold: (i) New formulation: We introduce the k-clique-graph densest subgraph (k- clique-GDS) problem, a new formulation for finding large subgraphs with high density δ. Given a value for k, we create a graph whose vertices correspond to k-cliques of the original graph and we draw edges between two k-cliques if they share a common (k − 1)-clique. We then extract a dense subgraph from the new graph and we project the result back to the original graph. We focus on the special case obtained for k = 3 which we call the triangle-graph densest subgraph (TGDS) problem. We define a new density function which is suited to the needs of our problem. 3 (ii) Approximation algorithm: We propose an efficient greedy approximation algorithm for the TGDS problem which removes one vertex at each iteration. The algorithm achieves nearly-optimal results on real-world networks. (iii) Experimental evaluation: We evaluate our approximation algorithm on several real-world networks. We compare the obtained subgraphs with those outputted by state-of-the-art algorithms and we observe that the proposed algorithm extracts subgraphs of high quality. We also present an application of our problem to the task of keyword extraction from textual documents. 2 Related Work In this Section, we review the related work published in the areas of Clique Find- ing, Dense Subgraph Discovery and Triangle Listing. Clique Finding. A clique is a graph whose vertices are all connected to each other. Hence, all cliques have density δ = 1. A maximum clique of a graph is a clique, such that there is no clique with more vertices. Finding the maximum clique of a graph is an NP-complete problem [22]. The maximum clique problem is also hard to approximate. More specifically, Hastad showed in [20] that for any  > 0, there is no polynomial algorithm that approximates the maximum clique within a factor better than O(n1−), unless NP has expected polynomial time algorithms. Feige presented in [15] a polynomial-time algorithm that approxi- mates the maximum clique within a ratio of O(n(log log n)2/(log n)3). A maximal clique is a clique that is not included in a larger clique. The Bron–Kerbosch algorithm is a recursive backtracking procedure [9] that lists all maximal cliques in a graph in O(3n/3) time. Dense Subgraph Discovery. The problem of finding a dense subgraph given an input graph has been widely studied in the literature [24]. As mentioned above, such a problem aims at finding a subset of vertices S ⊆ V of an input graph G that maximizes some notion of density. Among all the functions for evaluating dense subgraphs, degree density has gained increased popularity. The degree density of a set of vertices S is defined as d(S) = 2E(S)/S. The prob- lem of finding the set of vertices that maximizes the degree density is known as the densest subgraph (DS) problem. The set of vertices S ⊆ V that maximizes the degree density can be identified in polynomial time by solving a series of minimum-cut problems [19]. Charikar showed in [11] that the DS problem can also be formulated as a linear programming (LP) problem. In the same paper, the author proved that the greedy algorithm proposed by Asahiro et al. [5] provides a 1 2 -approximation to the DS problem in linear time. Some variations of the DS problem include the densest k-subgraph (DkS), the densest at-least-k-subgraph (DalkS) and the densest at-most-k-subgraph (DamkS) problems. These variations put restrictions on the size of the extracted subgraph. The DkS identifies the subgraph with exactly k vertices that maximizes the de- gree density and is known to be NP-complete [4]. Feige et al. provided in [16] an approximation algorithm with approximation ratio O(nδ), where δ < 1/3. The DalkS and DamkS problems were introduced by Andersen and Chellapilla 4 [2]. The first problem asks for the subgraph of highest degree density among all subgraphs with at least k vertices and is known to be NP-hard [23], while the second problem asks for the subgraph of highest density among all subgraphs with at most k vertices and is known to be NP-complete [2]. Tsourakakis introduced in [31] the k-clique densest subgraph (k-clique-DS) problem which generalizes the DS problem. The k-clique-DS problem maximizes the average number of k-cliques induced by a set S ⊆ V over all possible vertex subsets. For k = 3, we obtain the so-called triangle densest subgraph (TDS) problem which maximizes the triangle density defined as dtr(S) = t(S)/S where t(S) is the number of triangles in S. The author provides two polynomial-time algorithms that identify the exact set of vertices that maximizes the triangle density and a 1 3 -approximation algorithm which runs asymptotically faster than any of the exact algorithms. function fα(S) = E(S) − α(cid:0)S 2 There are several other recent algorithms that extract dense subgraphs by maximizing other notions of density [29,32,33]. It is worthwhile mentioning Tsourakakis et al.'s work [32]. The authors defined the optimal quasi-clique (OQC) problem which finds the subset of vertices S ⊆ V that maximizes the (cid:1) where α ∈ (0, 1) is a constant. The OQC problem is not polynomial-time solvable and the authors provided a greedy ap- proximation algorithm that runs in linear time and a local-search heuristic. Triangle Listing. Given a graph G, the triangle listing problem reports all the triangles in G. The triangle listing problem has been extensively studied and a large number of algorithms has been proposed [21,13,28]. A listing algorithm requires at least one operation per triangle. In the worst case, there are n3 trian- gles in terms of the number of vertices and m3/2 in terms of the number of edges. Hence, in the worst case, it takes m3/2 time just to report the triangles. The above algorithms require O(m3/2) time to list the triangles and they are thus optimal in the worst case. Recently, Bjorklund et al. proposed output sensitive algorithms which run asymptotically faster when the number of triangles in the graph is small [8]. 3 Problem Definition In this Section, we will introduce the k-clique-graph densest subgraph (k-clique- GDS) problem, a novel formulation for finding dense subgraphs. In the following, we will restrict ourselves to the case where k = 3, that is to triangles. At the end of the Section, we will describe how the proposed approach can be generalized to the case of k-cliques, k > 3. The cornerstone of the proposed method is the transformation of the input graph G = (V, E) into another graph G(cid:48) = (V (cid:48), E(cid:48)). The transformed graph G(cid:48) is a more abstract representation of G. Specifically, it encodes information regarding the triangles of the input graph G and the relationships between them. As a preprocessing step before applying the transformation, we assign labels to the edges of the input graph G. Given a set of labels L, (cid:96) : E → L is a function that assigns labels to the edges of the graph. Each edge is assigned 5 Algorithm 1 Construct triangle-graph Input: graph G = (V, E) Output: graph G(cid:48) = (V (cid:48), E(cid:48)) 1: Assign a unique label to each edge of the input graph G. 2: Extract all triangles in G by running a triangle listing algorithm. Let T (S) be the set of the extracted triangles. 3: Create a new empty graph G(cid:48). 4: For each triangle t ∈ T (G) create a vertex in the G(cid:48). 5: Connect two vertices in G(cid:48) with an edge if the corresponding triangles in G share a common edge. 6: Assign to the new edge the label of the edge that is shared between the two triangles. 7: Return G(cid:48). a unique label. Hence, the cardinality of the set L is equal to that of set E, L = E. We next proceed with the transformation of G into G(cid:48). The first step of the transformation procedure is to run a triangle listing algorithm. There are several available triangle listing algorithms as described in Section 2. Let T (S) be the set of triangles extracted from G. For each triangle t ∈ T (G), we create a vertex in the new graph G(cid:48). Therefore, each vertex represents one of the triangles extracted from G. Pairs of triangles that share a common edge in G are considered neighbors and are connected with an edge in G(cid:48). In other words, each edge in G(cid:48) corresponds to a pair of triangles sharing the same edge. The edges of G(cid:48) are also assigned labels. Each edge in G(cid:48) is given the label of the edge that is shared between the two corresponding triangles in G. For example, given a pair of triangles t1 = (v1, v2, v3) and t2 = (v1, v2, v4) where t1, t2 ∈ T (G), these triangles have a common edge e = (v1, v2) and the edge e(cid:48) that links them in G(cid:48) gets the same label as e, that is (cid:96)(e(cid:48)) = (cid:96)(e). A triangle has three edges, hence, although it can have any number of adjacent edges in G(cid:48), its labels come from a limited alphabet consisting of only three items (the labels of the three edges of the triangle in G). We call the transformed graph G(cid:48) the triangle-graph of G. Algorithm 1 describes the steps required to create G(cid:48) from G and Figure 1 illustrates how a graph containing 4 triangles is transformed into its triangle-graph. After creating the triangle-graph G(cid:48), we can find a subset of vertices S(cid:48) ⊂ V (cid:48) that correponds to a dense subgraph. As mentioned earlier, each vertex v ∈ S(cid:48) represents a triangle t of the input graph G. Each triangle t is a set of three vertices. Intuitively, the union of the vertices of all the triangles that belong to the set S(cid:48) will form a dense subgraph of G. To extract the set of vertices S(cid:48), we can define a density measure and optimize it. A simple measure we can employ is the well-known degree density defined as d(S(cid:48)) = 2E(S(cid:48))/S(cid:48). However, the above function will not necessarily lead to subgraphs with high density. Consider the two graphs shown in Figure 2. As can be seen from the Figure, the triangle-graphs emerging from the two input graphs are structurally equivalent, and hence, they have the same degree density. As a result, if the two graphs 6 Fig. 1. Example of an input graph (left) and the triangle-graph (right) created from it. There are 4 triangles in the input graph defined by the following triads of edges: (1, 2, 3), (3, 4, 5), (4, 7, 8) and (9, 10, 11). The first two as well as the second and third triangles have a common edge (edge 3 and edge 4 respectively). Hence, these pairs of triangles are connected with an edge in the triangle-graph. The fourth triangle does not share any edges with the other triangles, therefore, it has no adjacent edges in the triangle-graph. are components of a larger graph and there are no other subgraphs with higher value, they are equally likely solutions to the DS problem. However, it is obvious that the upper graph suits better our purpose, and we would like our algorithm to prefer this compared to the lower graph. To account for this problem, we define a new density measure which we call the triangle-graph density. (cid:80) v∈S(cid:48) minl∈L(v) Definition 1 (Triangle-Graph Density). Given an undirected, unweighted graph G = (V, E), first construct its triangle graph G(cid:48) = (V (cid:48), E(cid:48)). For any S(cid:48) ⊆ V (cid:48), we define its triangle-graph density as f (S(cid:48)) = d(S(cid:48)) S(cid:48) where d(S(cid:48)) = (cid:0)degS(cid:48)(v, l)(cid:1), L(v) the set of labels of the edges adjacent to v (three labels at most), and degS(cid:48)(v, l) the number of edges that are adjacent to v in the subgraph induced by S(cid:48) and are assigned the label l. The triangle-graph density will allow the discovery of subgraphs with high values of density δ. This is due to the fact that for each triangle t in G, the function takes into account the number of neighbors from all three edges of t. If a triangle t corresponding to the vertex v in G(cid:48) shares one of its edges with many other trian- gles, but the other two edges with no triangles, then minl∈L(v) Therefore, even if t has many neighbors, it contributes nothing to the triangle- graph density. Triangle-graph density seeks for subgraphs whose vertices belong to edges which all consist of large sets of vertices. Cliques are natural candidates for maximizing the function since all their edges are shared between several triangles. (cid:0)degS(cid:48)(v, l)(cid:1) = 0. We next introduce the triangle-graph densest subgraph problem, the opti- mization problem we address in this paper. 31524891012116734 7 Fig. 2. Two input graphs (left) and their triangle-graphs (right). The two triangle- graphs are structurally equivalent although the input graphs are not. Fig. 3. Example of an input graph (left) and the triangle-graph (right) created from it. There are 7 triangles in the input graph defined by the following triads of edges: (1, 2, 3), (1, 4, 6), (2, 4, 5), (3, 5, 6), (6, 7, 8), (8, 9, 10) and (5, 10, 11). Problem 1 (TGDS problem). Given an undirected, unweighted graph G = (V, E), create its triangle-graph G(cid:48) = (V (cid:48), E(cid:48)), and find a subset of vertices S∗ ⊆ V (cid:48) such that f (S∗) = arg maxS(cid:48)⊆V (cid:48) f (S(cid:48)). After optimizing the triangle-graph density, we end up with a set of vertices S(cid:48) ⊆ V (cid:48) and from these we obtain the set of vertices S ⊆ V that corresponds to the resulting subgraph. The set S consists of all the vertices that form the triangles in S(cid:48). It is clear that the TGDS problem can result in subgraphs with high values of density δ. What needs to be investigated next is what are the properties of the ex- tracted subgraphs and how they differ from the ones extracted from existing methods. The proposed triangle-graph densest subgraph (TGDS) problem seems to be very related to the triangle densest subgraph (TDS) problem introduced by Tsourakakis in [31]. However, as we will show next, the two problems can result in different solutions, and the subgraphs returned by TGDS are closer to being near-cliques compared to the ones returned by TDS. Consider the graph G and its triangle-graph G(cid:48) both shown in Figure 3. The optimal solution of TDS 31524631524611111112345678931524315246789101158666510 8 is the whole graph. Conversely, the optimal solution of TGDS is the subgraph induced by the vertices that form the 4-clique. Hence, the optimal solution of the proposed problem is a clique, while the optimal solution of TDS is a larger graph with lower density δ. The above example demonstrates that the optimal solutions of TGDS correspond to subgraphs that exhibit a stronger near-clique structure compared to TDS. The process of creating the k-clique graph for k > 3 is similar to the one described above for k = 3. Specifically, to construct the k-clique graph G(cid:48) = (V (cid:48), E(cid:48)), we first extract all the k-cliques from G. Then for each k-clique in G, we create a vertex v in G(cid:48). Two vertices v1, v2 ∈ V (cid:48) are connected with an edge if the corresponding cliques share a common (k − 1)-clique in G. For example, for k = 4, if two 4-cliques in G share a common triangle, an edge is drawn between them in G(cid:48). Each (k − 1)-clique in G is assigned a unique label and the edges of the k-clique graph are assigned the labels of the (k − 1)- cliques that are shared between their two endpoints. Then, the k-clique-graph density and the k-clique-graph densest subgraph (k-clique-GDS) problem are defined in a similar way as in the case of triangles. The algorithms presented in the next Section for maximizing triangle-graph density can be generalized to maximizing the k-clique-graph density. However, extracting k-cliques for k > 3 is a computationally demanding task, and hence, we restrict ourselves to the case where k = 3. 4 Proposed Algorithm (cid:0)degS(v, l)(cid:1). In this Section, we present a greedy algorithm for solving the TGDS problem. The algorithm is inspired by previously-introduced algorithms in the field of dense subgraph discovery. In what follows, we assume that we have extracted all triangles from the input graph and we have created the triangle-graph. Note that, for simplicity of notation, from now on, we denote by G = (V, E) the triangle-graph and not the input graph. We also denote by qS(v) the minimum degree of vertex v with respect to the three labels of its adjecent edges in the subgraph induced by S, that is qS(v) = minl∈L(v) We next provide an efficient algorithm for extracting a set of vertices S ⊆ V with high value of triangle-graph density f (S). The proposed algorithm is an adaptation of the greedy algorithm of Asahiro et al. [5]. The algorithm is illustrated as Algorithm 2. The algorithm iteratively removes the vertex v whose value d(v) is the smallest among all vertices. Subsequently, it computes the triangle-graph density of the subgraph induced by the remaining vertices. The output is the subgraph over all the produced subgraphs that maximizes triangle- graph density. The algorithm is linear to the number of vertices and the number of edges of the triangle-graph, hence its complexity is O(t + y) where t is the number of triangles in the input graph and y is the number of edges of the triangle-graph. Theorem 1. Let S be the set of vertices returned after the execution of Algo- rithm 2 and let S∗ be the set of vertices of the optimal subgraph. Consider the 9 Algorithm 2 Greedy algorithm Input: graph G = (V, E) Output: Subset of vertices S ⊆ V SV ← V for i ← V to 1 do the subgraph induced by Si Let v be the vertex whose minimum value of the three degrees is the smallest in Si−1 ← Si \ {v} end for S ← arg maxi=1,...,V f (Si) iteration of the greedy algorithm just before the first vertex u that belongs in the optimal set S∗ is removed, and let SI denote the vertex set currently kept in that iteration. Let also qSI (u) be the minimum degree of vertex u in SI with respect to the three labels of its adjacent edges. Then, it holds that f (S) ≥ S∗ SI f∗ G + (cid:19) (cid:18) 1 − S∗ SI qSI (u) Proof. Given a subset of vertices S ⊆ V and a vertex v, let qS(v) be the minimum degree of vertex v with respect to its three labels. Let also S∗ be the vertices of the optimal subgraph. The optimal value of the function is obtained for the set of vertices S∗ and is equal to f (S∗) = d(S∗)/S∗. Consider the iteration of the greedy algorithm just before the first vertex u that belongs in the optimal set S∗ is removed. Let SI denote the set of vertices still present before the removal of u. The value of the function for the set of vertices SI is then f (SI ) = d(SI )/SI. Since S∗ ⊆ SI ⊆ V , it holds that qV (v) ≥ qSI (v) ≥ qS∗ (v), ∀v. In each iter- ation, the algorithm removes the vertex with the minimum degree with respect to the three labels of its adjacent edges. Since u is the first vertex to be removed by the algorithm, it is also easy to see that qSI (v) ≥ qSI (u) ≥ qS∗ (u). Therefore, (cid:0)qSI (v) − qS∗ (v)(cid:1) + (cid:80) qSI (v) v∈SI\S∗ f (SI ) = v∈S∗ v∈S∗ v∈S∗ d(SI ) SI (cid:80) qS∗ (v) + (cid:80) (cid:80) qS∗ (v) + (cid:80) S∗f (S∗) + (cid:80) (cid:18) v∈SI\S∗ SI 1 − S∗ SI S∗ SI f (S∗) + v∈SI\S∗ SI = ≥ = = SI qSI (v) qSI (v) (cid:19) qSI (u) ≥ S∗f (S∗) + (SI − S∗)qSI (u) SI 10 The algorithm returns a set of nodes S which is the best over all iterations, hence we obtain (cid:18) (cid:19) f (S) ≥ f (SI ) ≥ S∗ SI f (S∗) + 1 − S∗ SI qSI (u) From the above result, we can see that the bound provided by the approx- imation algorithm highly depends on the relationship between SI, the size of the vertex set just before the first vertex of S∗ is removed, and S∗, the size of the optimal set. It also depends on the relationship between the optimal value of the triangle-graph density f (S∗) and the minimum degree qSI (u) of the first vertex of the optimal set S∗ to be removed from SI with respect to its three labels. The difference between SI and S∗, and between f (S∗) and qSI (u) is not very large in practice, and the algorithm leads to subgraphs with quality almost equal to that of the optimal subgraphs. 5 Experiments and Evaluation In this Section, we present the evaluation of the proposed approach for extracting dense subgraphs. We first give details about the datasets that we used for our experiments. We then present the employed experimental settings. And we last report on the results obtained by our approach and some other methods. 5.1 Experimental Setup For the evaluation of the proposed algorithms, we employed several publicly available graphs. The algorithms are applicable to simple unweighted, undirected graphs. Hence, we made all graphs simple by ignoring the edge direction in the case of directed graphs and by removing self-loops and egde weights, if any. Ta- ble 1 shows statistics of these graphs. The first ten datasets were obtained from UCIrvine Network Data Repository4, while the remaining datasets were obtained from Stanford SNAP Repository5. We compared the proposed algorithms with algorithms that solve the densest subgraph (DS), the triangle densest subgraph (TDS) and the optimal quasi-clique (OQC) problems. For the first two (DS and TDS problems), there are algorithms that solve these problems exactly in poly- nomial time. Hence, for small-sized datasets, we present the results obtained from both the exact and greedy approximation algorithms for each problem. For larger datasets, we report only on the results achieved by the greedy approxi- mation algorithms. With regards to the objective function of the OQC problem, we set the value of parameter α equal to 1/3 as suggested in [32]. All algorithms were implemented in Python6 and all experiments were conducted on a single machine with a 3.4GHz Intel Core i7 processor and 32GB of RAM. To assess 4 https://networkdata.ics.uci.edu/index.php 5 http://snap.stanford.edu/data/index.html 6 Code available is at https://github.com/giannisnik/ k-clique-graphs-dense-subgraphs Table 1. Graphs used for evaluating the algorithms. 11 Graph Karate Dolphins Lesmis Adjnoun Football Polbooks Celegansneural Polblogs Power Wiki-Vote ca-CondMat p2p-Gnutella31 Slashdot0902 email-EuAll web-NotreDame Amazon Youtube roadNet-CA V E 78 34 159 62 254 77 425 112 613 115 441 105 2,148 297 16,715 1,224 6,594 4,941 100,762 7,115 93,439 23,133 147,892 62,586 504,230 82,168 265,009 364,481 325,729 1,497,134 925,872 334,863 1,134,890 2,987,624 1,965,206 2,766,607 the quality of the extracted subgraphs, we employed the following measures: the density of the extracted subgraph δ(S) = E(S)/(cid:0)S to the number of triangles τ (S) = t(S)/(cid:0)S (cid:1), the density with respect (cid:1), that is the number of triangles in S over the total possible triangles, and the size of the subgraph S. The δ and τ measures take values between 0 and 1. The larger their value, the closer the sub- graph to being a clique. Therefore, we are interested in finding large subgraphs (large value of S) with δ and τ values close to 1. 3 2 5.2 Results and Discussion Table 2 summarizes the results obtained on small-sized graphs. We observe that on the small-sized graphs, the proposed algorithm (Greedy TGDS) returns in general subgraphs that are closer to being a clique compared to the competing algorithms. As we can see from the Table, the densities δ and τ of the subgraphs extracted by our algorithm are relatively high. Our initial intention was to design an algorithm for finding a set of vertices with many edges between them. The obtained results verify our intuition that the proposed approach is capable of finding near-cliques. Furthermore, we show in Table 3 the triangle-graph density of the subgraphs extracted by a brute-force exact algorithm and the proposed greedy approximation algorithm. We notice that on four out of the six graphs, the two densities are equal to each other, while on the other two, they are very close to each other. The obtained results indicate that the greedy algorithm achieves approximation ratios close to 1 on real-world networks. Hence, the approximation algorithm is nearly-optimal in practice. Next, we present results obtained on larger graphs. Specifically, Table 4 com- pares the four approaches on 12 graphs. In general, the proposed algorithm still manages to extract subgraphs with high values of δ and τ . However, on two 12 Table 2. Comparison of the extracted subgraphs by Goldberg's exact algorithm for the DS problem (Exact DS), Charikar's 1 2 approximation algorithm for the DS problem (Greedy DS), Tsourakakis's algorithm for the TDS problem (Exact TDS), Tsourakakis's 1 3 approximation algorithm for the TDS problem (Greedy TDS), Tsourakakis et al.'s greedy approximation algorithm for the OQC problem (Greedy OQC), and our greedy approximation algorithm for the TGDS problem (Greedy TGDS). S S S δ τ δ τ Dataset Exact DS Greedy DS Exact TDS Greedy TDS Greedy OQC Greedy TGDS S Karate 16 0.35 0.05 16 0.35 0.05 6 0.93 0.80 6 0.93 0.80 10 0.55 0.18 Dolphins 20 0.32 0.04 36 0.17 0.01 7 0.80 0.54 6 0.93 0.80 13 0.47 0.11 Lesmis 23 0.49 0.18 23 0.49 0.18 13 0.88 0.71 13 0.88 0.71 22 0.50 0.19 Adjnoun 48 0.20 0.01 44 0.22 0.01 41 0.23 0.01 41 0.23 0.01 16 0.48 0.11 Football 115 0.09 0.00 115 0.09 0.00 18 0.48 0.20 18 0.48 0.20 10 0.88 0.66 Polbooks 24 0.41 0.09 48 0.19 0.02 20 0.49 0.15 36 0.26 0.04 14 0.67 0.30 S 6 0.93 6 0.93 12 0.93 7 0.85 18 0.48 13 0.69 0.80 0.80 0.83 0.62 0.20 0.34 δ τ δ τ S δ τ δ τ Table 3. Triangle-graph densities of the subgraphs extracted by an exact agorithm and the proposed greedy approximation algorithm. Dataset Exact TGDS Greedy TGDS Karate Dolphins Lesmis Adjnoun Football Polbooks 2.25 2.25 7.60 2.36 6.0 3.89 2.25 2.25 7.60 2.39 6.0 4.02 graphs (Amazon, roadNet-CA), it fails to discover high-quality subgraphs in terms of density. Overall, the Greedy DS algorithm returns the largest subgraphs, followed by the Greedy TDS algorithm, while the Greedy OQC algorithm and the proposed algorithm return smaller subgraphs with higher values of density. We notice that the subgraphs extracted by the proposed greedy approximation algorithm resemble most those extracted by the Greedy TDS algorithm. On the ca-CondMat dataset, all the algorithms extract the same subgraph. There is a large clique hidden in this graph and all the algorithms manage to find it. 6 Application In this Section, we apply the proposed algorithm to a central problem in Natural Language Processing: extracting keywords from a textual document. Keyword extraction finds applications in several fields from information retrieval to text classification and summarization. Given a document d, we can represent it as a statistical graph-of-words, following earlier approaches in keyword extraction [26,27,30] and in summarization [25]. The construction of the graph is preceded by a preprocessing phase where standard text processing tasks are performed. The processed document is then transformed into an unweighted, undirected graph G whose vertices represent unique terms and whose edges represent co- occurrences between the connected terms within a fixed-size window. We then Table 4. Comparison of the extracted subgraphs by Charikar's 1 2 approximation algo- rithm for the DS problem (Greedy DS), Tsourakakis's 1 3 approximation algorithm for the TDS problem (Greedy TDS), Tsourakakis et al.'s greedy approximation algorithm for the OQC problem (Greedy OQC), and our greedy approximation algorithm for the TGDS problem (Greedy TGDS). 13 Dataset Celegansneural Polblogs Power Wiki-Vote ca-CondMat p2p-Gnutella31 soc-Slashdot0902 email-EuAll web-NotreDame Amazon Youtube roadNet-CA S 127 278 31 828 26 δ 0.13 0.20 0.20 0.11 1.0 1,549 0.005 0.39 219 0.13 505 1,367 0.11 0.91 9 Greedy DS Greedy TDS Greedy OQC Greedy TGDS S τ τ δ τ S 22 0.61 0.25 τ δ S 24 0.55 δ 0.13 0.005 30 0.47 0.21 0.020 102 0.54 0.195 100 0.55 0.202 74 0.67 0.343 0.021 12 0.54 0.195 12 0.54 0.195 12 0.54 0.195 0.004 464 0.19 0.014 133 0.47 0.131 152 0.42 0.104 1.0 0.0 1.0 0.11 26 1.0 10 0.40 26 1.0 1.0 14 0.48 0.0 26 22 0.15 0.016 0.097 171 0.50 0.165 155 0.54 0.200 145 0.56 0.225 0.005 200 0.29 0.041 97 0.51 0.164 91 0.52 0.179 0.012 457 0.34 0.114 305 0.51 0.255 155 1.0 0.761 16 0.45 0.178 1.0 1.0 1.0 9 0.91 0.761 170 0.03 0.001 1,860 0.049 0.0006 729 0.11 0.005 125 0.46 0.115 442 0.17 0.012 19,899 0.0001 168 0.017 0.0002 5 0.80 0.40 168 0.017 0.0002 0.0 employ the proposed algorithm to extract a dense subgraph from G. The vertices of the subgraph act as representative keywords of the document. To demonstrate the ability of the proposed approach to identify meaningful keywords, we extracted the text of this paper and we transformed it into a graph G using a window of size 3 (each word is connected with an edge with each one of its two preceding and two following words, if any). We then extracted a dense subgraph from G using the proposed greedy approximation algorithm. The output subgraph consists of the following 31 vertices: subgraphs, labels, maximizes, vertices, k, first, cliques, triangle, subgraph, algorithm, triangles, value, optimal, density, edges, large, g, number, vertex, given, function, clique, graph, v, e, set, problem, input, edge, extract, hence As we can observe, the extracted keywords capture the main concepts of the paper. 7 Conclusion In this paper, we propose a novel approach for extracting dense subgraphs. Given a graph, our algorithm first transforms it to a k-clique-graph. We then introduce a simple density measure to extract high-quality subgraphs. We propose a greedy approximation algorithm for maximizing the density function. We evaluate our proposed approach for the case where k = 3 on real graphs and we compare it with other popular measures. We also evaluate our proposed method on the task of keyword extraction from textual documents. Overall, our algorithm shows good performance in finding large near-cliques, and can serve as a useful addition to the list of dense subgraph discovery algorithms. 14 References 1. Alvarez-Hamelin, J.I., Dall'Asta, L., Barrat, A., Vespignani, A.: Large scale net- works fingerprinting and visualization using the k-core decomposition. In: NIPS'05. pp. 41–50 (2005) 2. Andersen, R., Chellapilla, K.: Finding Dense Subgraphs with Size Bounds. In: WAW'09, pp. 25–37 (2009) 3. Angel, A., Koudas, N., Sarkas, N., Srivastava, D., Svendsen, M., Tirthapura, S.: Dense subgraph maintenance under streaming edge weight updates for real-time story identification. The VLDB Journal 23(2), 175–199 (2014) 4. Asahiro, Y., Hassin, R., Iwama, K.: Complexity of Finding Dense Subgraphs. Dis- crete Applied Mathematics 121(1), 15–26 (2002) 5. Asahiro, Y., Iwama, K., Tamaki, H., Tokuyama, T.: Greedily Finding a Dense Subgraph. Journal of Algorithms 34(2), 203–221 (2000) 6. Bader, G.D., Hogue, C.W.: An automated method for finding molecular complexes in large protein interaction networks. BMC bioinformatics 4(1), 1 (2003) 7. Balalau, O.D., Bonchi, F., Chan, T., Gullo, F., Sozio, M.: Finding Subgraphs with Maximum Total Density and Limited Overlap. In: WSDM'15. pp. 379–388 (2015) 8. Bjorklund, A., Pagh, R., Williams, V.V., Zwick, U.: Listing Triangles. In: ICALP'14. pp. 223–234 (2014) 9. Bron, C., Kerbosch, J.: Algorithm 457: finding all cliques of an undirected graph. Communications of the ACM 16(9), 575–577 (1973) 10. Buehrer, G., Chellapilla, K.: A Scalable Pattern Mining Approach to Web Graph Compression with Communities. In: WSDM'08. pp. 95–106 (2008) 11. Charikar, M.: Greedy Approximation Algorithms for Finding Dense Components in a Graph. In: Approximation Algorithms for Combinatorial Optimization, pp. 84–95 (2000) 12. Chen, J., Saad, Y.: Dense Subgraph Extraction with Application to Community Detection. TKDE 24(7), 1216–1230 (2012) 13. Chiba, N., Nishizeki, T.: Arboricity and Subgraph Listing Algorithms. SICOMP'85 14(1), 210–223 (1985) 14. Du, X., Jin, R., Ding, L., Lee, V.E., Thornton Jr, J.H.: Migration Motif: A Spatial- Temporal Pattern Mining Approach for Financial Markets. In: KDD'09. pp. 1135– 1144 (2009) 15. Feige, U.: Approximating maximum clique by removing subgraphs. SIDMA'04 18(2), 219–225 (2004) 16. Feige, U., Peleg, D., Kortsarz, G.: The Dense k-Subgraph Problem. Algorithmica 29(3), 410–421 (2001) 17. Fratkin, E., Naughton, B.T., Brutlag, D.L., Batzoglou, S.: Motifcut: regulatory motifs finding with maximum density subgraphs. Bioinformatics 22(14), e150–e157 (2006) 18. Gibson, D., Kumar, R., Tomkins, A.: Discovering Large Dense Subgraphs in Mas- sive Graphs. In: VLDB'05. pp. 721–732 (2005) 19. Goldberg, A.V.: Finding a Maximum Density Subgraph. University of California 20. Hastad, J.: Clique is hard to approximate within n1−. In: FOCS'96. pp. 627–636 Berkeley, Technical Report (1984) (1996) 21. Itai, A., Rodeh, M.: Finding a Minimum Circuit in a Graph. SICOMP'78 7(4), 413–423 (1978) 22. Karp, R.M.: Reducibility among combinatorial problems. Springer (1972) 15 23. Khuller, S., Saha, B.: On Finding Dense Subgraphs. In: ICALP'09, pp. 597–608 (2009) 24. Lee, V.E., Ruan, N., Jin, R., Aggarwal, C.: A survey of algorithms for dense sub- graph discovery. In: Managing and Mining Graph Data, pp. 303–336 (2010) 25. Meladianos, P., Nikolentzos, G., Rousseau, F., Stavrakas, Y., Vazirgiannis, M.: Degeneracy-based Real-Time Sub-Event Detection in Twitter Stream. In: ICWSM'15. pp. 248–257 (2015) 26. Mihalcea, R., Tarau, P.: TextRank: Bringing Order into Texts. In: EMNLP'04. pp. 404–411 (2004) 27. Rousseau, F., Vazirgiannis, M.: Main Core Retention on Graph-of-words for Single- Document Keyword Extraction. In: ECIR'15. pp. 382–393 (2015) 28. Schank, T., Wagner, D.: Finding, Counting and Listing all Triangles in Large Graphs, an Experimental Study. In: WEA'05. pp. 606–609 (2005) 29. Sozio, M., Gionis, A.: The Community-search Problem and How to Plan a Suc- cessful Cocktail Party. In: KDD'10. pp. 939–948 (2010) 30. Tixier, A.J.P., Malliaros, F.D., Vazirgiannis, M.: A Graph Degeneracy-based Ap- proach to Keyword Extraction. In: EMNLP'16 (2016) 31. Tsourakakis, C.: The K-Clique Densest Subgraph Problem. In: WWW'15. pp. 1122–1132 (2015) 32. Tsourakakis, C., Bonchi, F., Gionis, A., Gullo, F., Tsiarli, M.: Denser than the Densest Subgraph: Extracting Optimal Quasi-Cliques with Quality Guarantees. In: KDD'13. pp. 104–112 (2013) 33. Wang, N., Zhang, J., Tan, K.L., Tung, A.K.: On Triangulation-based Dense Neigh- borhood Graph Discovery. VLDB Endowment 4(2), 58–68 (2010)
1911.06436
1
1911
2019-11-15T01:06:11
Weighted Triangle-free 2-matching Problem with Edge-disjoint Forbidden Triangles
[ "cs.DS", "math.CO" ]
The weighted $\mathcal{T}$-free $2$-matching problem is the following problem: given an undirected graph $G$, a weight function on its edge set, and a set $\mathcal{T}$ of triangles in $G$, find a maximum weight $2$-matching containing no triangle in $\mathcal{T}$. When $\mathcal{T}$ is the set of all triangles in $G$, this problem is known as the weighted triangle-free $2$-matching problem, which is a long-standing open problem. A main contribution of this paper is to give a first polynomial-time algorithm for the weighted $\mathcal{T}$-free $2$-matching problem under the assumption that $\mathcal{T}$ is a set of edge-disjoint triangles. In our algorithm, a key ingredient is to give an extended formulation representing the solution set, that is, we introduce new variables and represent the convex hull of the feasible solutions as a projection of another polytope in a higher dimensional space. Although our extended formulation has exponentially many inequalities, we show that the separation problem can be solved in polynomial time, which leads to a polynomial-time algorithm for the weighted $\mathcal{T}$-free $2$-matching problem.
cs.DS
cs
Weighted Triangle-free 2-matching Problem with Edge-disjoint Forbidden Triangles Yusuke Kobayashi∗ July 27, 2021 9 1 0 2 v o N 5 1 ] S D . s c [ 1 v 6 3 4 6 0 . 1 1 9 1 : v i X r a Abstract The weighted T -free 2-matching problem is the following problem: given an undirected graph G, a weight function on its edge set, and a set T of triangles in G, find a maximum weight 2- matching containing no triangle in T . When T is the set of all triangles in G, this problem is known as the weighted triangle-free 2-matching problem, which is a long-standing open problem. A main contribution of this paper is to give a first polynomial-time algorithm for the weighted T -free 2- matching problem under the assumption that T is a set of edge-disjoint triangles. In our algorithm, a key ingredient is to give an extended formulation representing the solution set, that is, we introduce new variables and represent the convex hull of the feasible solutions as a projection of another polytope in a higher dimensional space. Although our extended formulation has exponentially many inequalities, we show that the separation problem can be solved in polynomial time, which leads to a polynomial-time algorithm for the weighted T -free 2-matching problem. 1 Introduction 1.1 2-matchings without Short Cycles In an undirected graph, an edge set M is said to be a 2-matching1 if each vertex is incident to at most two edges in M . Finding a 2-matching of maximum size is a classical combinatorial optimization problem, which can be solved efficiently by using a matching algorithm. By imposing restrictions on 2-matchings, various extensions have been introduced and studied in the literature. Among them, the problem of finding a maximum 2-matching without short cycles has attracted attentions, because it has applications to approximation algorithms for TSP and its variants. We say that a 2-matching M is C≤k- free if M contains no cycle of length k or less, and the C≤k-free 2-matching problem is to find a C≤k-free 2-matching of maximum size in a given graph. When k ≤ 2, every 2-matching without self-loops and parallel edges is C≤k-free, and hence the C≤k-free 2-matching problem can be solved in polynomial time. On the other hand, when n/2 ≤ k ≤ n − 1, where n is the number of vertices in the input graph, the C≤k-free 2-matching problem is NP-hard, because it decides the existence of a Hamiltonian cycle. These facts motivate us to investigate the borderline between polynomially solvable cases and NP-hard cases of the problem. Hartvigsen [12] gave a polynomial-time algorithm for the C≤3-free 2-matching problem, and Papadimitriou showed that the problem is NP-hard when k ≥ 5 (see [6]). The polynomial solvability of the C≤4-free 2-matching problem is still open, whereas some positive results are known for special cases. For the case when the input graph is restricted to be bipartite, Hartvigsen [13], Kir´aly [18], and Frank [10] gave min-max theorems, Hartvigsen [14] and Pap [25] designed polynomial-time algorithms, Babenko [1] improved the running time, and Takazawa [27] showed decomposition theorems. Recently, ∗Research Institute for Mathematical Sciences, Kyoto University, Japan. Supported by JSPS KAKENHI Grant Numbers JP16K16010, 16H03118, and JP18H05291, Japan. Email: [email protected] 1Although such an edge set is often called a simple 2-matching in the literature, we call it a 2-matching to simplify the description. 1 Takazawa [29, 28] extended these results to a generalized problem. When the input graph is restricted to be subcubic, i.e., the maximum degree is at most three, B´erczi and V´egh [4] gave a polynomial-time algorithm for the C≤4-free 2-matching problem. Relationship between C≤k-free 2-matchings and jump systems is studied in [3, 8, 21]. There are a lot of studies also on the weighted version of the C≤k-free 2-matching problem. In the weighted problem, an input consists of a graph and a weight function on the edge set, and the objective is to find a C≤k-free 2-matching of maximum total weight. Kir´aly proved that the weighted C≤4-free 2-matching problem is NP-hard even if the input graph is restricted to be bipartite (see [10]), and a stronger NP-hardness result was shown in [3]. Under the assumption that the weight function satisfies a certain property called vertex-induced on every square, Makai [23] gave a polyhedral description and Takazawa [26] designed a combinatorial polynomial-time algorithm for the weighted C≤4-free 2-matching problem in bipartite graphs. The case of k = 3, which we call the weighted triangle-free 2-matching problem, is a long-standing open problem. For the weighted triangle-free 2-matching problem in subcubic graphs, Hartvigsen and Li [15] gave a polyhedral description and a polynomial-time algorithm, followed by a slight generalized polyhedral description by B´erczi [2] and another polynomial-time algorithm by Kobayashi [19]. Relationship between C≤k-free 2-matchings and discrete convexity is studied in [19, 20, 21]. 1.2 Our Results The previous papers on the weighted triangle-free 2-matching problem [2, 15, 19] deal with a generalized problem in which we are given a set T of forbidden triangles as an input in addition to a graph and a weight function. The objective is to find a maximum weight 2-matching that contains no triangle in T , which we call the weighted T -free 2-matching problem. In this paper, we focus on the case when T is a set of edge-disjoint triangles, i.e., no pair of triangles in T shares an edge in common. A main contribution of this paper is to give a first polynomial-time algorithm for the weighted T -free 2-matching problem under the assumption that T is a set of edge-disjoint triangles. Note that we impose an assumption only on T , and no restriction is required for the input graph. We now describe the formal statement of our result. Let G = (V, E) be an undirected graph with vertex set V and edge set E, which might have self-loops and parallel edges. For a vertex set X ⊆ V , let δG(X) denote the set of edges between X and V \ X. For v ∈ V , δG({v}) is simply denoted by δG(v). For v ∈ V , let δG(v) denote the multiset of edges incident to v ∈ V , that is, a self-loop incident to v is counted twice. We omit the subscript G if no confusion may arise. For b ∈ ZV≥0, an edge set M ⊆ E is said to be a b-matching (resp. b-factor) if M ∩ δ(v) ≤ b(v) (resp. M ∩ δ(v) = b(v)) for every v ∈ V . If b(v) = 2 for every v ∈ V , a b-matching and a b-factor are called a 2-matching and a 2-factor, respectively. Let T be a set of triangles in G, where a triangle is a cycle of length three. For a triangle T , let V (T ) and E(T ) denote the vertex set and the edge set of T , respectively. An edge set M ⊆ E is said to be T -free if E(T ) (cid:54)⊆ M for every T ∈ T . For a vertex set S ⊆ V , let E[S] denote the set of all edges with both endpoints in S. For an edge weight vector w ∈ RE, we consider the problem of finding a T -free b-matching (resp. b-factor) maximizing w(M ), which we call the weighted T -free b-matching (resp. b-factor) problem. Note that, for a set A and a vector c ∈ RA, we denote c(A) =(cid:80) a∈A c(a). Our main result is formally stated as follows. Theorem 1. There exists a polynomial-time algorithm for the following problem: given a graph G = (V, E), b(v) ∈ Z≥0 for each v ∈ V , a set T of edge-disjoint triangles, and a weight w(e) ∈ R for each e ∈ E, find a T -free b-factor M ⊆ E that maximizes the total weight w(M ). A proof of this theorem is given in Section 5. Since finding a maximum weight T -free b-matching can be reduced to finding a maximum weight T -free b-factor by adding dummy vertices and zero-weight edges, Theorem 1 implies the following corollary. 2 Corollary 2. There exists a polynomial-time algorithm for the following problem: given a graph G = (V, E), b(v) ∈ Z≥0 for each v ∈ V , a set T of edge-disjoint triangles, and a weight w(e) ∈ R for each e ∈ E, find a T -free b-matching M ⊆ E that maximizes the total weight w(M ). In particular, we can find a T -free 2-matching (or 2-factor) M ⊆ E that maximizes the total weight w(M ) in polynomial time if T is a set of edge-disjoint triangles. 1.3 Key Ingredient: Extended Formulation A natural strategy to solve the maximum weight T -free b-factor problem is to give a polyhedral descrip- tion of the T -free b-factor polytope as Hartvigsen and Li [15] did for the subcubic case. However, as we will see in Example 1, giving a system of inequalities that represents the T -free b-factor polytope seems to be quite difficult even when T is a set of edge-disjoint triangles. A key idea of this paper is to give an extended formulation of the T -free b-factor polytope, that is, we introduce new variables and represent the T -free b-factor polytope as a projection of another polytope in a higher dimensional space. Extended formulations of polytopes arising from various combinatorial optimization problems have been intensively studied in the literature, and the main focus in this area is on the number of inequalities that are required to represent the polytope. If a polytope has an extended formulation with polynomially many inequalities, then we can optimize a linear function in the original polytope by the ellipsoid method (see e.g. [11]). On the other hand, even if a linear function on a polytope can be optimized in polynomial time, the polytope does not necessarily have an extended formulation of polynomial size. In this context, the existence of a polynomial size extended formulation has been attracted attentions. See survey papers [5, 17] for previous work on extended formulations. In this paper, under the assumption that T is a set of edge-disjoint triangles, we give an extended formulation of the T -free b-factor polytope that has exponentially many inequalities (Theorem 5). In addition, we show that the separation problem for the extended formulation is solvable in polynomial time, and hence we can optimize a linear function on the T -free b-factor polytope by the ellipsoid method in polynomial time. This yields a first polynomial-time algorithm for the weighted T -free b-factor (or b-matching) problem. Note that it is rare that the first polynomial-time algorithm was designed with the aid of an extended formulation. To the best of our knowledge, the weighted linear matroid parity problem was the only such problem before this paper (see [16]). 1.4 Organization of the Paper The rest of this paper is organized as follows. In Section 2, we introduce an extended formulation of the T -free b-factor polytope, whose correctness proof is given in Section 4. In Section 3, we show a few technical lemmas that will be used in the proof. In Section 5, we give a polynomial-time algorithm for the weighted T -factor problem and prove Theorem 1. Finally, we conclude this paper with remarks in Section 6. Some of the proofs are postponed to the appendix. 2 Extended Formulation of the T -free b-factor Polytope Let G = (V, E) be a graph, b ∈ ZV≥0 be a vector, and T be a set of forbidden triangles. Throughout this paper, we only consider the case when triangles in T are mutually edge-disjoint. For an edge set M ⊆ E, define its characteristic vector xM ∈ RE by (cid:40) xM (e) = if e ∈ M , otherwise. 1 0 (1) The T -free b-factor polytope is defined as conv{xM M is a T -free b-factor in G}, where conv denotes the convex hull of vectors, and the b-factor polytope is defined similarly. Edmonds [9] shows that the 3 Figure 1: Graph G = (V, E) Figure 2: b-factor M1 Figure 3: b-factor M2 b-factor polytope is determined by the following inequalities. x( δ(v)) = b(v) 0 ≤ x(e) ≤ 1 x(e) + (cid:88) (cid:88) (1 − x(e)) ≥ 1 (v ∈ V ) (e ∈ E) ((S, F0, F1) ∈ F) (2) (3) (4) e∈F0 e∈F1 is odd. Note that x( δ(v)) =(cid:80) Here, F is the set of all triples (S, F0, F1) such that S ⊆ V , (F0, F1) is a partition of δ(S), and b(S) +F1 In order to deal with T -free b-factors, we consider the following constraint in addition to (2) -- (4). e∈ δ(v) x(e) and x(e) is added twice if e is a self-loop incident to v. x(E(T )) ≤ 2 (T ∈ T ) (5) However, as we will see in Example 1, the system of inequalities (2) -- (5) does not represent the T -free b-factor polytope. Note that when we consider uncapacitated 2-factors, i.e., we are allowed to use two copies of the same edge, it is shown by Cornuejols and Pulleyblank [7] that the T -free uncapacitated 2-factor polytope is represented by x(e) ≥ 0 for e ∈ E, x( δ(v)) = 2 for v ∈ V , and (5). Example 1. Consider the graph G = (V, E) in Figure 1. Let b(v) = 2 for every v ∈ V and T be the set of all triangles in G. Then, G has no T -free b-factor, i.e., the T -free b-factor polytope is empty. For e ∈ E, let x(e) = 1 if e is drawn as a blue line in Figure 1 and let x(e) = 1 2 otherwise. Then, we can easily check that x satisfies (2), (3), and (5). Furthermore, since x is represented as a linear combination of two b-factors M1 and M2 shown in Figures 2 and 3, x satisfies (4). In what follows in this section, we introduce new variables and give an extended formulation of the T -free b-factor polytope. For T ∈ T , we denote ET = {J ⊆ E(T ) J (cid:54)= E(T )}. For T ∈ T and J ∈ ET , we introduce a new variable y(T, J). Roughly, y(T, J) denotes the fraction of b-factors M satisfying M ∩ E(T ) = J. In particular, when x and y are integral, y(T, J) = 1 if and only if the b-factor M corresponding to (x, y) satisfies M ∩ E(T ) = J. We consider the following inequalities. (T ∈ T ) (T ∈ T , e ∈ E(T )) (6) (7) (8) If T is clear from the context, y(T, J) is simply denoted by y(J). Since triangles in T are edge-disjoint, this causes no ambiguity unless J = ∅. In addition, for α, β ∈ E(T ), y({α}), y({α, β}), and y(∅) are simply denoted by yα, yαβ, and y∅, respectively. We now strengthen (4) by using y. For (S, F0, F1) ∈ F, let TS = {T ∈ T E(T ) ∩ δ(S) (cid:54)= ∅}. For (T ∈ T , J ∈ ET ) (cid:88) (cid:88) J∈ET y(T, J) = 1 y(T, J) = x(e) e∈J∈ET y(T, J) ≥ 0 4 T ∈ TS with E(T ) = {α, β, γ} and E(T ) ∩ δ(S) = {α, β}, we define  q∗(T ) = yα + yαγ yβ + yβγ y∅ + yγ yαβ if α ∈ F0 and β ∈ F1, if β ∈ F0 and α ∈ F1, if α, β ∈ F1, if α, β ∈ F0. Note that this value depends on (S, F0, F1) ∈ F and y, but it is simply denoted by q∗(T ) for a notational convenience. We consider the following inequality. 2q∗(T ) ≥ 1 ((S, F0, F1) ∈ F) (9) (cid:88) e∈F0 (cid:88) (1 − x(e)) − (cid:88) T∈TS x(e) + e∈F1 For T ∈ TS with E(T ) = {α, β, γ} and E(T ) ∩ δ(S) = {α, β}, the contribution of α, β, and T to the left-hand side of (9) is equal to the fraction of b-factors M such that M ∩{α, β} (cid:54)≡ F1∩{α, β} (mod 2) by the following observations. • If α ∈ F0 and β ∈ F1, then (6) and (7) show that x(α) = yα + yαβ + yαγ and 1 − x(β) = 1 − (yβ + yαβ + yβγ) = y∅ + yα + yγ + yαγ. Therefore, x(α) + (1 − x(β)) − 2q∗(T ) = y∅ + yγ + yαβ, which denotes the fraction of b-factors M such that M ∩ {α, β} is even. • If β ∈ F0 and α ∈ F1, then (6) and (7) show that (1 − x(α)) + x(β) − 2q∗(T ) = y∅ + yγ + yαβ, which denotes the fraction of b-factors M such that M ∩ {α, β} is even. • If α, β ∈ F1, then (6) and (7) show that (1 − x(α)) + (1 − x(β)) − 2q∗(T ) = yα + yβ + yαγ + yβγ, which denotes the fraction of b-factors M such that M ∩ {α, β} is odd. • If α, β ∈ F0, then (6) and (7) show that x(α) + x(β)− 2q∗(T ) = yα + yβ + yαγ + yβγ, which denotes the fraction of b-factors M such that M ∩ {α, β} is odd. Let P be the polytope defined by P = {(x, y) ∈ RE × RY x and y satisfy (2), (3), and (5) -- (9)}, where Y = {(T, F ) T ∈ T , F ∈ ET}. Note that we do not need (4), because it is implied by (9). Define the projection of P onto E as projE(P ) = {x ∈ RE There exists y ∈ RY such that (x, y) ∈ P}. Our aim is to show that projE(P ) is equal to the T -free b-factor polytope. It is not difficult to see that the T -free b-factor polytope is contained in projE(P ). Lemma 3. The T -free b-factor polytope is contained in projE(P ). Proof. Suppose that M ⊆ E is a T -free b-factor in G and define xM ∈ RE by (1). For T ∈ T and J ∈ ET , define (cid:40) 1 0 yM (T, J) = if M ∩ E(T ) = J, otherwise. e ∈ F0 \(cid:83) We can easily see that (xM , yM ) satisfies (2), (3), and (5) -- (8). Thus, it suffices to show that (xM , yM ) satisfies (9). Assume to the contrary that (9) does not hold for (S, F0, F1) ∈ F. Then, xM (e) = 0 for every E(T ). Furthermore, since the contribution of E(T )∩δ(S) and T to the left-hand side of (9) is equal to 1 if and only if M ∩E(T )∩δ(S) (cid:54)≡ F1∩E(T ) (mod 2), we obtain M ∩ E(T ) ∩ δ(S) ≡ F1 ∩ E(T ) (mod 2) for every T ∈ TS. Then, E(T ) and xM (e) = 1 for every e ∈ F1 \(cid:83) M ∩ δ(S) = (M ∩ δ(S)) \ (cid:91) M ∩ E(T ) ∩ δ(S) E(T ) + T∈TS T∈TS (cid:88) T∈TS F1 ∩ E(T ) = F1. ≡ F1 \ (cid:91) T∈TS T∈TS E(T ) + (cid:88) T∈TS 5 Since M is a b-factor, it holds that M ∩ δ(S) ≡ b(S) (mod 2), which contradicts that b(S) + F1 is odd. To prove the opposite inclusion (i.e., projE(P ) is contained in the T -free b-factor polytope), we consider a relaxation of (9). For T ∈ TS with E(T ) = {α, β, γ} and E(T ) ∩ δ(S) = {α, β}, we define  q(T ) = yα + yαγ yβ + yβγ yγ 0 if α ∈ F0 and β ∈ F1, if β ∈ F0 and α ∈ F1, if α, β ∈ F1, if α, β ∈ F0. Since q(T ) ≤ q∗(T ) for every T ∈ TS, the following inequality is a relaxation of (9). ((S, F0, F1) ∈ F) (1 − x(e)) − (cid:88) 2q(T ) ≥ 1 (cid:88) x(e) + e∈F1 T∈TS (cid:88) e∈F0 (10) Note that there is a difference between (9) and (10) in the following cases. • If α, β ∈ F1, then the contribution of α, β, and T to the left-hand side of (10) is (1 − x(α)) + (1 − x(β)) − 2q(T ) = yα + yβ + yαγ + yβγ + 2y∅. • If α, β ∈ F0, then the contribution of α, β, and T to the left-hand side of (10) is x(α)+x(β)−2q(T ) = yα + yβ + yαγ + yβγ + 2yαβ. Define a polytope Q and its projection onto E as Q = {(x, y) ∈ RE × RY x and y satisfy (2), (3), (5) -- (8), and (10)}, projE(Q) = {x ∈ RE There exists y ∈ RY such that (x, y) ∈ Q}. Since (10) is implied by (9), we have that P ⊆ Q and projE(P ) ⊆ projE(Q). In what follows in Sections 3 and 4, we show the following proposition. Proposition 4. projE(Q) is contained in the T -free b-factor polytope. By Lemma 3, Proposition 4, and projE(P ) ⊆ projE(Q), we obtain the following theorem. Theorem 5. Let G = (V, E) be a graph, b(v) ∈ Z≥0 for each v ∈ V , and let T be a set of edge-disjoint triangles. Then, both projE(P ) and projE(Q) are equal to the T -free b-factor polytope. We remark here that we do not know how to prove directly that projE(P ) is contained in the T -free b-factor polytope. Introducing projE(Q) and considering Proposition 4, which is a stronger statement, is a key idea in our proof. We also note that our algorithm in Section 5 is based on the fact that the T -free b-factor polytope is equal to projE(P ). In this sense, both projE(P ) and projE(Q) play important roles in this paper. Example 2. Suppose that G = (V, E), b ∈ ZV≥0, and x ∈ RE are as in Example 1. Let T be the central triangle in G and let E(T ) = {α, β, γ}. If y ∈ RY satisfies (6) and (8), then yαβ + yβγ + yαγ ≤ 1. Thus, without loss of generality, we may assume that yαβ ≤ 1 3 by symmetry. Let S be a vertex set with δ(S) = {α, β}. Then, (10) does not hold for (S,{α},{β}) ∈ F, because x(α) + (1 − x(β)) − 2q(T ) = 1 − x(α) − x(β) + 2yαβ ≤ 2 3 < 1. Therefore, x is not in projE(Q). 3 Extreme Points of the Projection of Q In this section, we show a property of extreme points of projE(Q), which will be used in Section 4. We begin with the following easy lemma. 6 Lemma 6. Suppose that x ∈ RE satisfies (3) and (5). Then, there exists y ∈ RY that satisfies (6) -- (8). Proof. Let T ∈ T be a triangle with E(T ) = {α, β, γ} and x(α) ≥ x(β) ≥ x(γ). For J ∈ ET , we define y(T, J) as follows. • If x(α) ≥ x(β) + x(γ), then yαβ = x(β), yαγ = x(γ), y∅ = 1 − x(α), yα = x(α) − x(β) − x(γ), and yβ = yγ = yβγ = 0. • If x(α) < x(β) + x(γ), then yαβ = 1 2 (x(β) + x(γ) − x(α)), y∅ = 1 − 1 1 2 (x(α) + x(β) − x(γ)), yαγ = 1 2 (x(α) + x(γ) − x(β)), yβγ = 2 (x(α) + x(β) + x(γ)), and yα = yβ = yγ = 0. Then, y satisfies (6) -- (8). By using this lemma, we show the following. Lemma 7. Let x be an extreme point of projE(Q) and y ∈ RY be a vector with (x, y) ∈ Q. Then, one of the following holds. (i) x = xM for some T -free b-factor M ⊆ E. (ii) (5) is tight for some T ∈ T . (iii) (10) is tight for some (S, F0, F1) ∈ F with T + S = {T ∈ T E(T ) ∩ δ(S) ∩ S (cid:54)= ∅, where we define T + F1 (cid:54)= ∅}. Proof. We prove (i) by assuming that (ii) and (iii) do not hold. Since (10) is not tight for any (S, F0, F1) ∈ F with T + S (cid:54)= ∅, x is an extreme point of {x ∈ RE There exists y ∈ RY such that (x, y) satisfies (2) -- (8)}, because (4) is a special case of (10) in which T + S = ∅. By Lemma 6, this polytope is equal to {x ∈ RE x satisfies (2) -- (5)}. Since (5) is not tight for any T ∈ T , x is an extreme point of {x ∈ RE x satisfies (2) -- (4)}, which is the b-factor polytope. Thus, x is a characteristic vector of a b-factor. Since x satisfies (5), it holds that x = xM for some T -free b-factor M ⊆ E. 4 Proof of Proposition 4 In this section, we prove Proposition 4 by induction on T . If T = 0, then y does not exist and (10) is equivalent to (4). Thus, projE(Q) is the b-factor polytope, which shows the base case of the induction. Fix an instance (G, b,T ) with T ≥ 1 and assume that Proposition 4 holds for instances with smaller T . Suppose that Q (cid:54)= ∅, which implies that b(V ) is even as (V,∅,∅) (cid:54)∈ F by (10). Pick up x ∈ projE(Q) and let y ∈ RY be a vector with (x, y) ∈ Q. Our aim is to show that x is contained in the T -free b-factor polytope. In what follows in this section, we prove Proposition 4 as follows. We apply Lemma 7 to obtain one of (i), (ii), and (iii). If (i) holds, that is, x = xM for some T -free b-factor M ⊆ E, then x is obviously in the T -free b-factor polytope. If (ii) holds, that is, (5) is tight for some T ∈ T , then we replace T with a certain graph and apply the induction, which will be discussed in Section 4.1. If (iii) holds, that is, (10) is tight for some (S, F0, F1) ∈ F with T + S (cid:54)= ∅, then we divide G into two graphs and apply the induction for each graph, which will be discussed in Section 4.2. 4.1 When (5) is Tight In this subsection, we consider the case when (5) is tight for some T ∈ T . Fix a triangle T ∈ T with x(E(T )) = 2, where we denote V (T ) = {v1, v2, v3}, E(T ) = {α, β, γ}, α = v1v2, β = v2v3, and γ = v3v1 (Figure 4). Since (5) is tight, we obtain 2 = x(α) + x(β) + x(γ) = 2(yαβ + yαγ + yβγ) + yα + yβ + yγ = 2 − (yα + yβ + yγ) − 2y∅, 7 Figure 4: Construction of G(cid:48) and hence yα = yβ = yγ = y∅ = 0. Therefore, x(α) = yαβ + yαγ, x(β) = yαβ + yβγ, x(γ) = yαγ + yβγ, and yαβ + yαγ + yβγ = 1. We construct a new instance of the T -free b-factor problem as follows. Let G(cid:48) = (V (cid:48), E(cid:48)) be the graph obtained from G = (V, E) by removing E(T ) and adding a new vertex r together with three new ≥0 as b(cid:48)(r) = 1, b(cid:48)(v) = b(v) − 1 for edges e1 = rv1, e2 = rv2, and e3 = rv3 as in Figure 4. Define b(cid:48) ∈ ZV (cid:48) v ∈ {v1, v2, v3}, and b(cid:48)(v) = b(v) for v ∈ V \ {v1, v2, v3}. Define x(cid:48) ∈ RE(cid:48) as x(cid:48)(e1) = yαγ, x(cid:48)(e2) = yαβ, x(cid:48)(e3) = yβγ, and x(cid:48)(e) = x(e) for e ∈ E(cid:48) ∩ E. Let T (cid:48) = T \{T}, and let Y (cid:48) and F(cid:48) be the objects for the obtained instance (G(cid:48), b(cid:48),T (cid:48)) that are defined in the same way as Y and F. Define y(cid:48) as the restriction of y to Y (cid:48). We now show the following claim. Claim 8. (x(cid:48), y(cid:48)) satisfies (2), (3), (5) -- (8), and (10) with respect to the new instance (G(cid:48), b(cid:48),T (cid:48)). Proof. We can easily see that (x(cid:48), y(cid:48)) satisfies (2), (3), (5) -- (8). Consider (10) for (S(cid:48), F (cid:48) 0, F (cid:48) changing the roles of S(cid:48) and V (cid:48) \ S(cid:48) if necessary, we may assume that r ∈ S(cid:48). For (S(cid:48), F (cid:48) (resp. (S, F0, F1) ∈ F), we denote the left-hand side of (10) by h(cid:48)(S(cid:48), F (cid:48) 1) ∈ F(cid:48). By 1) ∈ F(cid:48) 0, F (cid:48) 1) (resp. h(S, F0, F1)). 1) ∈ F(cid:48) by the following case analysis and by 1) ≥ 1 for each (S(cid:48), F (cid:48) Then, we obtain h(cid:48)(S(cid:48), F (cid:48) 0, F (cid:48) 0, F (cid:48) 0, F (cid:48) the symmetry of v1, v2, and v3. 1. Suppose that v1, v2, v3 ∈ S(cid:48). Since (S(cid:48) \ {r}, F (cid:48) 0, F (cid:48) 1) ∈ F, we obtain h(cid:48)(S(cid:48), F (cid:48) 0, F (cid:48) 1) = h(S(cid:48) \ {r}, F (cid:48) 0, F (cid:48) 1) ≥ 1. 2. Suppose that v2, v3 ∈ S(cid:48) and v1 (cid:54)∈ S(cid:48). • If e1 ∈ F (cid:48) 0, then define (S, F0, F1) ∈ F as S = S(cid:48)\{r}, F0 = (F (cid:48) Since x(α) + (1 − x(γ)) − 2q(T ) = yαγ = x(cid:48)(e1), we obtain h(cid:48)(S(cid:48), F (cid:48) 0\{e1})∪{α}, and F1 = F (cid:48) • If e1 ∈ F (cid:48) 1, then define (S, F0, F1) ∈ F as S = S(cid:48) \{r}, F0 = F (cid:48) Since (1 − x(α)) + (1 − x(γ)) − 2q(T ) = yβγ + yαβ = 1 − x(cid:48)(e1), we obtain h(cid:48)(S(cid:48), F (cid:48) h(S, F0, F1) ≥ 1. 0, and F1 = (F (cid:48) 0, F (cid:48) 1∪{γ}. 1) = h(S, F0, F1) ≥ 1. 1 \{e1})∪{α, γ}. 1) = 0, F (cid:48) 3. Suppose that v1 ∈ S(cid:48) and v2, v3 (cid:54)∈ S(cid:48). • If e2, e3 ∈ F (cid:48) 0 \ {e2, e3}, and F1 = 1 ∪ {α, γ}. Since (1 − x(α)) + (1 − x(γ)) − 2q(T ) = yβγ + yαβ = x(cid:48)(e2) + x(cid:48)(e3), we obtain F (cid:48) h(cid:48)(S(cid:48), F (cid:48) • If e2 ∈ F (cid:48) 0, then define (S, F0, F1) ∈ F as S = S(cid:48) \ {r}, F0 = F (cid:48) 1) = h(S, F0, F1) ≥ 1. 0, F (cid:48) 0 \ {e2}) ∪ {α}, 0 and e3 ∈ F (cid:48) 1 \ {e3}) ∪ {γ}. Since x(α) + (1 − x(γ)) − 2q(T ) = yαγ ≤ 1 − x(cid:48)(e3), we obtain and F1 = (F (cid:48) 1) ≥ h(S, F0, F1) ≥ 1. 0, F (cid:48) h(cid:48)(S(cid:48), F (cid:48) • If e2, e3 ∈ F (cid:48) 0, F (cid:48) 1, then h(cid:48)(S(cid:48), F (cid:48) 1, then define (S, F0, F1) ∈ F as S = S(cid:48) \ {r}, F0 = (F (cid:48) 1) ≥ 2 − x(cid:48)(e2) − x(cid:48)(e3) ≥ 1. 4. Suppose that v1, v2, v3 (cid:54)∈ S(cid:48). • If F (cid:48) • If F (cid:48) 1 ∩ δG(cid:48)(r) = ∅, then h(cid:48)(S(cid:48), F (cid:48) 1 ∩ δG(cid:48)(r) ≥ 2, then h(cid:48)(S(cid:48), F (cid:48) 0, F (cid:48) 0, F (cid:48) 1) ≥ x(cid:48)(e1) + x(cid:48)(e2) + x(cid:48)(e3) = 1. 1) ≥ 2 − (x(cid:48)(e1) + x(cid:48)(e2) + x(cid:48)(e3)) = 1. 8 v2v1v3αβγv2v1v3e1e2e3r • If F (cid:48) 1 ∩ δG(cid:48)(r) = 1, then define (S, F0, F1) ∈ F as S = S(cid:48) \ {r}, F0 = F (cid:48) 0 \ δG(cid:48)(r), and F1 = F (cid:48) 1 \ δG(cid:48)(r). Then, we obtain h(cid:48)(S(cid:48), F (cid:48) 0, F (cid:48) 1) ≥ h(S, F0, F1) ≥ 1. By this claim and by the induction hypothesis, x(cid:48) is in the T (cid:48)-free b(cid:48)-factor polytope. That is, there i=1 λi = 1 t in G(cid:48) and non-negative coefficients λ1, . . . , λt such that(cid:80)t 1, . . . , M(cid:48) exist T (cid:48)-free b(cid:48)-factors M(cid:48) and λixM(cid:48) i , (11) t(cid:88) i=1 x(cid:48) = where xM(cid:48) ∈ RE(cid:48) is the characteristic vector of M(cid:48) For a T (cid:48)-free b(cid:48)-factor M(cid:48) ⊆ E(cid:48) in G(cid:48), we define a corresponding T -free b-factor ϕ(M(cid:48)) ⊆ E in G as i i defined in the same way as (1). if e1 ∈ M(cid:48), if e2 ∈ M(cid:48), if e3 ∈ M(cid:48). (M(cid:48) ∩ E) ∪ {α, β} (M(cid:48) ∩ E) ∪ {β, γ} i )(e) for each e ∈ E ∩ E(cid:48). By (11) again, it holds that (M(cid:48) ∩ E) ∪ {α, γ} (cid:88){λi e2 ∈ M(cid:48) i} = x(cid:48)(e1) + x(cid:48)(e2) = yαγ + yαβ = x(α), ϕ(M(cid:48)) = By (11), we obtain x(e) =(cid:80)t t(cid:88) and similar equalities hold for β and γ. Therefore, we obtain x =(cid:80)t (cid:88){λi e1 ∈ M(cid:48) i=1 λixϕ(M(cid:48) i )(α) = λixϕ(M(cid:48) i} + i=1 in the T -free b-factor polytope. i=1 λixϕ(M(cid:48) i ), which shows that x is 0 \(cid:83) 4.2 When (10) is Tight S∗ (cid:54)= ∅, where In this subsection, we consider the case when (10) is tight for (S∗, F ∗ S∗ = {T ∈ T E(T ) ∩ δ(S∗) ∩ F ∗ T + 1 (cid:54)= ∅}. In this case, we divide the original instance into two instances (G1, b1,T1) and (G2, b2,T2), apply the induction for each instance, and combine the two parts. We denote 0 = F ∗ F ∗ S∗ E(T ) and F ∗ 1 = F ∗ 4.2.1 Construction of (Gj, bj,Tj) We first construct (G1, b1,T1) and its feasible LP solution x1. Starting from the subgraph G[S∗] = (S∗, E[S∗]) induced by S∗, we add a new vertex r corresponding to V ∗ \ S∗, set b1(r) = 1, and apply the following procedure. 1 ) ∈ F with T + 1 \(cid:83) S∗ E(T ). 0 , F ∗ T∈T + T∈T + • For each f = uv ∈ F ∗ • For each f = uv ∈ F ∗ (Figure 6). Let b1(pf 0 with u ∈ S∗, we add a new edge ef = ur (Figure 5). Let x1(ef ) = x(f ). 1 with u ∈ S∗, we add a new vertex pf r = pf ur u) = 1, x1(ef r ) = 1 − x(f ). u) = x(f ), and x1(ef u and new edges ef u and ef u = upf • For each T ∈ T + S∗ with E(T ) ∩ δG(S∗) ∩ F ∗ 1 = 2 and V (T ) ∩ S∗ = 2, which we call a triangle of type (A), add new vertices p1, p2 and new edges e1, . . . , e6 as in Figure 7. Define b1(p1) = b1(p2) = 1 and x1(e1) = y∅ + yγ, x1(e4) = yβγ, x1(e2) = y∅ + yα, x1(e5) = 1 − y∅ − yγ, x1(e3) = yαβ, x1(e6) = 1 − y∅ − yα, where α, β, and γ are as in Figure 7. 9 Figure 5: An edge in F ∗ 0 Figure 6: An edge in F ∗ 1 • For each T ∈ T + S∗ with E(T ) ∩ δG(S∗) ∩ F ∗ 1 = 2 and V (T ) ∩ S∗ = 1, which we call a triangle of type (A'), add a new vertex p3 and new edges e1, e2, e3, e4, e7, e8, and e9 as in Figure 8. Define b1(p3) = 2 and x1(e1) = y∅ + yγ, x1(e7) = yβ, x1(e2) = y∅ + yα, x1(e8) = yαγ, x1(e3) = yαβ, x1(e9) = 1 − y∅ − yβ, x1(e4) = yβγ, where α, β, and γ are as in Figure 8. • For each T ∈ T + S∗ with E(T ) ∩ δG(S∗) ∩ F ∗ 1 = 1 and V (T ) ∩ S∗ = 2, which we call a triangle of type (B), add new vertices p1, p2, p3 and new edges e1, . . . , e9 as in Figure 9. Define b1(pi) = 1 for i ∈ {1, 2, 3}, and x1(e1) = y∅ + yβ, x1(e4) = yα, x1(e7) = y∅, x1(e2) = yαγ, x1(e5) = yαβ, x1(e8) = 1 − y∅ − yγ, x1(e3) = yγ, x1(e6) = yβγ, x1(e9) = 1 − y∅ − yα, where α, β, and γ are as in Figure 9. • For each T ∈ T + S∗ with E(T ) ∩ δG(S∗) ∩ F ∗ 1 = 1 and V (T ) ∩ S∗ = 1, which we call a triangle of type (B'), add a new vertex p4 and new edges e1, e2, and e10 as in Figure 10. Define b1(p4) = 1, and x1(e1) = y∅ + yβ, x1(e2) = yαγ, x1(e10) = 1 − y∅ − yβ, where α, β, and γ are as in Figure 10. In order to make it clear that pi and ei are associated with T ∈ T + i . Let G1 = (V1, E1) be the obtained graph. Define b1 ∈ ZV1≥0 by b1(v) = b(v) for v ∈ S∗ and b1(v) is as above for v ∈ V1 \ S∗. Define x1 ∈ RE1 by x1(e) = x(e) for e ∈ E[S∗] and x1(e) is as above for e ∈ E1 \ E[S∗]. S∗ with V (T ) ∩ S∗ = 2, say V (T ) ∩ S∗ = {u, v}, let ψ(T ) be the corresponding triangle in G1 whose vertex set is {u, v, r}. Let For each T ∈ TS∗ \ T + S∗ , we sometimes denote pT i and eT T1 = {T ∈ T V (T ) ⊆ S∗} ∪ {ψ(T ) T ∈ TS∗ \ T + S∗ with V (T ) ∩ S∗ = 2}, S∗ with ψ(T ). and let Y1 and F1 be the objects for the obtained instance (G1, b1,T1) that are defined in the same way as Y and F. Define y1 as the restriction of y to Y1, where we identify f ∈ F ∗ 0 with ef and identify T ∈ TS∗ \ T + Similarly, by changing the roles of S∗ and V \ S∗, we construct a graph G2 = (V2, E2) and an instance (G2, b2,T2), where the new vertex corresponding to S∗ is denoted by r(cid:48). Define x2, y2, Y2, and F2 in the S∗ is of type (A) (resp. type (B)) for (G1, b1,T1) if and same way as above. Note that a triangle T ∈ T + only if it is of type (A') (resp. type (B')) for (G2, b2,T2). We use the following claim, whose proof is given in Appendix A. Claim 9. For j ∈ {1, 2}, (xj, yj) satisfies (2), (3), (5) -- (8), and (10) with respect to the new instance (Gj, bj,Tj). 10 reffvuuS*rpffvuuS*efefuur Figure 7: A triangle of type (A) Figure 8: A triangle of type (A') Figure 9: A triangle of type (B) Figure 10: A triangle of type (B') 4.2.2 Pairing up Tj-free bj-factors S∗ < T for j ∈ {1, 2}, by Claim 9 and by the induction hypothesis, xj is in the Since Tj ≤ T − T + Tj-free bj-factor polytope. That is, there exists a set Mj of Tj-free bj-factors in Gj and a non-negative λM xM , where xM ∈ REj coefficient λM for each M ∈ Mj such that(cid:80) λM = 1 and xj =(cid:80) M∈Mj M∈Mj is the characteristic vector of M . 1 and eT 1 ) ≥ xj(eT 7 ) for each triangle T ∈ T + Let j ∈ {1, 2} and consider (Gj, bj,Tj). Since xj(eT 2 if necessary, we may assume that {eT S∗ of type (B), 7 } (cid:54)⊆ M for each M ∈ Mj S∗ of type (B). In what follows, we construct a collection of T -free b-factors in G by Since there is a one-to-one correspondence between δG1(r) and δG2(r(cid:48)), we identify them and denote r(cid:48) ∈ E2 are identified for each 1 . Since b1(r) = b2(r(cid:48)) = 1, it holds that M1 ∩ E0 = M2 ∩ E0 = 1 for every M1 ∈ M1 and for by swapping parallel edges eT and for each T ∈ T + combining M1 and M2. E0, that is, E0 = E1 ∩ E2 = δG1(r) = δG2(r(cid:48)). Note that ef f ∈ F ∗ every M2 ∈ M2. Define r ∈ E1 and ef 2 , eT M = {(M1, M2) M1 ∈ M1, M2 ∈ M2, M1 ∩ E0 = M2 ∩ E0}. Since x1(e) = x2(e) for e ∈ E0 by the definitions of x1 and x2, we can pair up a b1-factor M1 in M1 and a b2-factor M2 in M2 so that (M1, M2) ∈ M. More precisely, we can assign a non-negative coefficient λ(M1,M2) for each pair (M1, M2) ∈ M such that (12) (13) (14) 9 } 1 , . . . , eT (cid:88){λ(M1,M2) (M1, M2) ∈ M} = 1, (cid:88){λ(M1,M2) (M1, M2) ∈ M, e(cid:48) ∈ M1} = x1(e(cid:48)) (cid:88){λ(M1,M2) (M1, M2) ∈ M, e(cid:48) ∈ M2} = x2(e(cid:48)) (e(cid:48) ∈ E1), (e(cid:48) ∈ E2). Let (M1, M2) ∈ M. For a triangle T ∈ T + S∗ of type (A) or (A'), denote MT = (M1∪M2)∩{eT 11 rp2e6e5e1e3v2v3e2p1e4αγv2v3βS*v1re1p3αγv2v3βv1v1S*e4e8e9e2e3e7rp3e9e8e1v2v3p2αγv2v3βS*v1e7e2e3e4e5e6p1re1p4αγv2v3βv1v1S*e10e2 and define ϕ(M1, M2, T ) ⊆ E(T ) as {α} {γ} {α, β} {β, γ} {α, γ} {β} ϕ(M1, M2, T ) =  if MT = {e2, e5, e8} or MT = {e2, e5, e9}, if MT = {e1, e6, e8} or MT = {e1, e6, e9}, if MT = {e3, e5, e6, e8} or MT = {e3, e5, e6, e9}, if MT = {e4, e5, e6, e8} or MT = {e4, e5, e6, e9}, if MT = {e5, e6, e8, e9}, if MT = {e5, e6, e7}, where the superscript T is omitted here. Note that MT satisfies one of the above conditions, because Mj is a bj-factor for j ∈ {1, 2}. 10} and define ϕ(M1, M2, T ) ⊆ E(T ) as S∗ of type (B) or (B'), denote MT = (M1 ∪ M2) ∩ {eT For a triangle T ∈ T + 1 , . . . , eT  ∅ {α} {γ} {α, β} {β, γ} {α, γ} {β} if MT = {e1, e7}, if MT = {e4, e8, e10} or MT = {e5, e7, e10}, if MT = {e3, e9, e10} or MT = {e6, e7, e10}, if MT = {e5, e8, e9, e10}, if MT = {e6, e8, e9, e10}, if MT = {e2, e8, e9, e10}, if MT = {e1, e8, e9}, ϕ(M1, M2, T ) = where the superscript T is omitted here again. Note that MT satisfies one of the above conditions, because we are assuming that Mj is a bj-factor with {e2, e7} (cid:54)⊆ Mj for j ∈ {1, 2}. For (M1, M2) ∈ M, define M1 ⊕ M2 ⊆ E as M1 ⊕ M2 = (M1 ∩ E[S∗]) ∪ (M2 ∩ E[V \ S∗]) ∪ {f ∈ F ∗ r (cid:54)∈ M1 ∩ M2} ∪(cid:91){ϕ(M1, M2, T ) T ∈ T + 0 ef ∈ M1 ∩ M2} S∗}. ∪ {f ∈ F ∗ 1 ef We now use the following claims, whose proofs are postponed to Appendices B and C. Claim 10. For (M1, M2) ∈ M, M1 ⊕ M2 forms a T -free b-factor. Claim 11. It holds that x = (cid:88) λ(M1,M2)xM1⊕M2, (M1,M2)∈M where xM1⊕M2 ∈ RE is the characteristic vector of M1 ⊕ M2. By (12) and by Claims 10 and 11, it holds that x is in the T -free b-factor polytope. This completes the proof of Proposition 4. 5 Algorithm In this section, we give a polynomial-time algorithm for the weighted T -free b-factor problem and prove Theorem 1. Our algorithm is based on the ellipsoid method using the fact that the T -free b-factor polytope is equal to projE(P ) (Theorem 5). In order to apply the ellipsoid method, we need a polynomial- time algorithm for the separation problem. That is, for (x, y) ∈ RE × RY , we need a polynomial-time algorithm that concludes (x, y) ∈ P or returns a violated inequality. Let (x, y) ∈ RE × RY . We can easily check whether (x, y) satisfies (2), (3), and (5) -- (8) or not in polynomial time. In order to solve the separation problem for (9), we use the following theorem, which implies that the separation problem for (4) can be solved in polynomial time. 12 Figure 11: Replacement of a triangle T ∈ T Theorem 12 (Padberg-Rao [24] (see also [22])). Suppose we are given a graph G(cid:48) = (V (cid:48), E(cid:48)), b(cid:48) ∈ ZV (cid:48) ≥0, and x(cid:48) ∈ [0, 1]E(cid:48) 1) of δG(cid:48)(S(cid:48)) . Then, in polynomial time, we can compute S(cid:48) ⊆ V (cid:48) and a partition (F (cid:48) e∈F (cid:48) that minimize(cid:80) (1 − x(cid:48)(e)) subject to b(cid:48)(S(cid:48)) + F (cid:48) x(cid:48)(e) +(cid:80) 1 is odd. 0, F (cid:48) e∈F (cid:48) 0 1 T = {e1, e2, e3} and define x(cid:48)(e1) = x(α) + x(γ) − 2yαγ, In what follows, we reduce the separation problem for (9) to that for (4) and utilize Theorem 12. Suppose that (x, y) ∈ RE × RY satisfies (2), (3), and (5) -- (8). For each triangle T ∈ T , we remove E(T ) and add a vertex rT together with three new edges e1 = rT v1, e2 = rT v2, and e3 = rT v3 (Figure 11). Let E(cid:48) x(cid:48)(e2) = x(α) + x(β) − 2yαβ, x(cid:48)(e3) = x(β) + x(γ) − 2yβγ. (15) Let G(cid:48) = (V (cid:48), E(cid:48)) be the graph obtained from G by applying this procedure for every T ∈ T . Define ≥0 as b(cid:48)(v) = b(v) for v ∈ V and b(cid:48)(v) = 0 for v ∈ V (cid:48) \ V . By setting x(cid:48)(e) = x(e) for e ∈ E(cid:48) ∩ E b(cid:48) ∈ ZV (cid:48) and by defining x(cid:48)(e) as (15) for e ∈ E(cid:48) \ E, we obtain x(cid:48) ∈ [0, 1]E(cid:48) . We now show the following lemma. Lemma 13. Suppose that (x, y) ∈ RE × RY satisfies (2), (3), and (5) -- (8). Define G(cid:48) = (V (cid:48), E(cid:48)), b(cid:48), and x(cid:48) as above. Then, (x, y) violates (9) for some (S, F0, F1) ∈ F if and only if there exist S(cid:48) ⊆ V (cid:48) and a partition (F (cid:48) Proof. First, to show the "only if" part, assume that (x, y) violates (9) for some (S, F0, F1) ∈ F. Recall that TS = {T ∈ T E(T ) ∩ δG(S) (cid:54)= ∅}. Define S(cid:48) ⊆ V (cid:48) by 1 is odd and(cid:80) 1) of δG(cid:48)(S(cid:48)) such that b(cid:48)(S(cid:48)) + F (cid:48) x(cid:48)(e) +(cid:80) (1 − x(cid:48)(e)) < 1. 0, F (cid:48) e∈F (cid:48) e∈F (cid:48) 0 1 S(cid:48) = S ∪ {rT T ∈ T , V (T ) ∩ S ≥ 2}. Then, for each T ∈ TS, E(cid:48) follows: T ∩ δG(cid:48)(S(cid:48)) consists of a single edge, which we denote eT . Define F (cid:48) 0 and F (cid:48) 1 as 0 = (F0 ∩ E(cid:48)) ∪ {eT T ∈ TS, E(T ) ∩ F1 = 0 or 2}, F (cid:48) 1 = (F1 ∩ E(cid:48)) ∪ {eT T ∈ TS, E(T ) ∩ F1 = 1}. F (cid:48) 1) is a partition of δG(cid:48)(S(cid:48)) and b(cid:48)(S(cid:48)) + F (cid:48) To show that(cid:80) x(cid:48)(e) +(cid:80) It is obvious that (F (cid:48) (1 − x(cid:48)(e)) < 1, we evaluate x(cid:48)(eT ) or 1 − x(cid:48)(eT ) for each T ∈ TS. Let T ∈ TS be a triangle such that E(T ) = {α, β, γ} and E(T ) ∩ δG(S) = {α, β}. Then, we obtain the following by the definition of q∗(T ). 1 ≡ b(S) + F1 ≡ 1 (mod 2). 0, F (cid:48) e∈F (cid:48) e∈F (cid:48) 0 1 • If T ∈ TS and α, β ∈ F0, then x(α) + x(β) − 2q∗(T ) = x(cid:48)(eT ). • If T ∈ TS and α, β ∈ F1, then (1 − x(α)) + (1 − x(β)) − 2q∗(T ) = x(cid:48)(eT ). • If T ∈ TS, α ∈ F0, and β ∈ F1, then x(α) + (1 − x(β)) − 2q∗(T ) = y∅ + yγ + yαβ = 1 − x(cid:48)(eT ). • If T ∈ TS, β ∈ F0, and α ∈ F1, then (1 − x(α)) + x(β) − 2q∗(T ) = y∅ + yγ + yαβ = 1 − x(cid:48)(eT ). (cid:88) e∈F0 x(e) + 13 With these observations, we obtain (cid:88) e∈F (cid:48) 0 (cid:88) e∈F (cid:48) 1 x(cid:48)(e) + (1 − x(cid:48)(e)) = (cid:88) (1 − x(e)) − (cid:88) e∈F1 T∈TS 2q∗(T ) < 1, v2v1v3αβγv2v1v3e1e2e3rT 1) = (cid:80) e∈F (cid:48) x(cid:48)(e) + 0, F (cid:48) 1) 0∪F (cid:48) 1 1) < 1. We show the following 1) subject to (F (cid:48) 0, F (cid:48) 1) so that F (cid:48) 0 T and F1 = F (cid:48) 1 ∩ E(cid:48) T . (cid:80) which shows the "only if" part. We next show the "if" part. For edge sets F (cid:48) (1− x(cid:48)(e)) to simplify the notation. Let (S(cid:48), F (cid:48) e∈F (cid:48) 0, F (cid:48) 0, F (cid:48) 1 is odd. Among minimizers, we choose (S(cid:48), F (cid:48) 1 ⊆ E(cid:48), we denote g(F (cid:48) 1) be a minimizer of g(F (cid:48) 0, F (cid:48) 0, F (cid:48) 1 0, F (cid:48) is a partition of δG(cid:48)(S(cid:48)) and b(cid:48)(S(cid:48))+F (cid:48) is inclusion-wise minimal. To derive a contradiction, assume that g(F (cid:48) claim. Claim 14. Let T ∈ T be a triangle as shown in Figure 11 and denote F0 = F (cid:48) Then, we obtain the following. (i) If v1, v2, v3 (cid:54)∈ S(cid:48), then rT (cid:54)∈ S(cid:48). (ii) If v1, v2, v3 ∈ S(cid:48), then rT ∈ S(cid:48). (iii) If v1 ∈ S(cid:48), v2, v3 (cid:54)∈ S(cid:48), and F1 is even, then g( F0, F1) = x(cid:48)(e1) = x(α) + x(γ) − 2yαγ. (iv) If v1 ∈ S(cid:48), v2, v3 (cid:54)∈ S(cid:48), and F1 is odd, then g( F0, F1) = 1 − x(cid:48)(e1) = y∅ + yβ + yαγ. 0 ∩ E(cid:48) Proof of Claim14. Then, we derive a contradiction by the following case analysis and by the symmetry of e1, e2, and e3. (i) Assume that v1, v2, v3 (cid:54)∈ S(cid:48) and rT ∈ S(cid:48), which implies that F0 ∪ F1 = {e1, e2, e3}. • If F0 = {e1, e2} and F1 = {e3}, then g(F (cid:48) 0, F (cid:48) 1) ≥ g( F0, F1) = (x(α) + x(γ) − 2yαγ) + (x(α) + x(β) − 2yαβ) + (1 − x(β) − x(γ) + 2yβγ) = 1 + 2yα + 2yβγ ≥ 1, which is a contradiction. • If F0 = ∅ and F1 = {e1, e2, e3}, then g(F (cid:48) 0, F (cid:48) 1) ≥ g( F0, F1) = (1 − x(α) − x(γ) + 2yαγ) + (1 − x(α) − x(β) + 2yαβ) + (1 − x(β) − x(γ) + 2yβγ) = 1 + 2(1 − x(α) − x(β) − x(γ) + yαβ + yβγ + yαγ) = 1 + 2y∅ ≥ 1, which is a contradiction. • Suppose that F1 is even. Since b(cid:48)(S(cid:48)\{rT})+F (cid:48) 0 ∪ F (cid:48) g(F (cid:48) minimizer (S(cid:48), F (cid:48) 1) is chosen so that F (cid:48) 1), (S(cid:48) \ {rT}, F (cid:48) 0 \ δG(cid:48)(rT ), F (cid:48) 0, F (cid:48) 0, F (cid:48) 1\δG(cid:48)(rT )) ≤ 1 \ δG(cid:48)(rT )) is also a minimizer of g. This contradicts that a 1\δG(cid:48)(rT ) is odd and g(F (cid:48) 0\δG(cid:48)(rT ), F (cid:48) 1 is inclusion-wise minimal. (ii) Assume that v1, v2, v3 ∈ S(cid:48) and rT (cid:54)∈ S(cid:48), which implies that F0 ∪ F1 = {e1, e2, e3}. Then, we derive a contradiction by the same argument as (i). (iii) Suppose that v1 ∈ S(cid:48), v2, v3 (cid:54)∈ S(cid:48), and F1 is even. Then, we have one of the following cases. • If F0 = {e1} and F1 = ∅, then g( F0, F1) = x(cid:48)(e1) = x(α) + x(γ) − 2yαγ. • If F0 = {e2, e3} and F1 = ∅, then g( F0, F1) = (x(α) + x(β) − 2yαβ) + (x(β) + x(γ) − 2yβγ) = x(α) + x(γ) + 2(x(β) − yαβ − yβγ) ≥ x(α) + x(γ) ≥ x(α) + x(γ) − 2yαγ. 14 • If F0 = ∅ and F1 = {e2, e3}, then g( F0, F1) = (1 − x(α) − x(β) + 2yαβ) + (1 − x(β) − x(γ) + 2yβγ) = x(α) + x(γ) − 2yαγ + 2(1 − x(α) − x(β) − x(γ) + yαβ + yβγ + yαγ) ≥ x(α) + x(γ) − 2yαγ. Since (S(cid:48), F (cid:48) 0, F (cid:48) 1) is a minimizer of g(F (cid:48) 0, F (cid:48) 1), g( F0, F1) = x(cid:48)(e1) = x(α) + x(γ) − 2yαγ. (iv) Suppose that v1 ∈ S(cid:48), v2, v3 (cid:54)∈ S(cid:48), and F1 is odd. Then, we have one of the following cases by changing the labels of e2 and e3 if necessary. • If F0 = ∅ and F1 = {e1}, then g( F0, F1) = 1 − x(cid:48)(e1) = 1 − x(α) − x(γ) + 2yαγ. • If F0 = {e2} and F1 = {e3}, then g( F0, F1) = (x(α) + x(β) − 2yαβ) + (1 − x(β) − x(γ) + 2yβγ) ≥ 1 − x(α) − x(γ) + 2(x(α) − yαβ) ≥ 1 − x(α) − x(γ) + 2yαγ. Since (S(cid:48), F (cid:48) 0, F (cid:48) 0, F (cid:48) 1) is a minimizer of g(F (cid:48) 1), g( F0, F1) = 1−x(cid:48)(e1) = 1−x(α)−x(γ)+2yαγ = y∅+yβ +yαγ. (End of the Proof of Claim 14) Note that each T ∈ T satisfies exactly one of (i) -- (iv) of Claim 14 by changing the labels of v1, v2, In what follows, we construct (S, F0, F1) ∈ F for which (x, y) violates (9). We initialize (S, F0, F1) as and v3 if necessary. S = S(cid:48) ∩ V, F0 = F (cid:48) 0 ∩ E, F1 = F (cid:48) 1 ∩ E, and apply the following procedures for each triangle T ∈ T . • If T satisfies the condition (i) or (ii) of Claim 14, then we do nothing. • If T satisfies the condition (iii) of Claim 14, then we add α and γ to F0. • If T satisfies the condition (iv) of Claim 14, then we add α to F0 and add γ to F1. Then, we obtain that (F0, F1) is a partition of δG(S), b(S) + F1 ≡ b(cid:48)(S(cid:48)) + F (cid:48) 1 ≡ 1 (mod 2), and (cid:88) e∈F0 (cid:88) (1 − x(e)) − (cid:88) T∈TS x(e) + e∈F1 (cid:88) e∈F (cid:48) 0 (cid:88) e∈F (cid:48) 1 2q∗(T ) = x(cid:48)(e) + (1 − x(cid:48)(e)) < 1 by Claim 14. This shows that (x, y) violates (9) for (S, F0, F1) ∈ F, which completes the proof of "if" part. 1 is odd, and (cid:80) x(cid:48)(e) +(cid:80) Since the proof of Lemma 13 is constructive, given S(cid:48) ⊆ V (cid:48) and F (cid:48) 0, F (cid:48) 1) is a partition of δG(cid:48)(S(cid:48)), b(cid:48)(S(cid:48)) + F (cid:48) (1 − x(cid:48)(e)) < 1, we can construct (S, F0, F1) ∈ F for which (x, y) violates (9) in polynomial time. By combining this with Theorem 12, it holds that the separation problem for P can be solved in polynomial time. Therefore, the ellipsoid method can maximize a linear function on P in polynomial time (see e.g. [11]), and hence we can e∈E w(e)x(e) subject to x ∈ projE(P ). By perturbing the objective function if necessary, we can obtain a maximizer x∗ that is an extreme point of projE(P ). Since each extreme point of projE(P ) corresponds to a T -free b-factor by Theorem 5, x∗ is a characteristic vector of a maximum weight T -free b-factor. This completes the proof of Theorem 1. maximize(cid:80) 1 ⊆ E(cid:48) such that (F (cid:48) 0, F (cid:48) e∈F (cid:48) e∈F (cid:48) 0 1 15 6 Concluding Remarks This paper gives a first polynomial-time algorithm for the weighted T -free b-matching problem where T is a set of edge-disjoint triangles. A key ingredient is an extended formulation of the T -free b-factor polytope with exponentially many inequalities. As we mentioned in Section 1.3, it is rare that the first polynomial-time algorithm was designed with the aid of an extended formulation. This approach has a potential to be used for other combinatorial optimization problems for which no polynomial-time algorithm is known. Some interesting problems remain open. Since the algorithm proposed in this paper relies on the ellipsoid method, it is natural to ask whether we can design a combinatorial polynomial-time algorithm. It is also open whether our approach can be applied to the weighted C≤4-free b-matching problem in general graphs under the assumption that the forbidden cycles are edge-disjoint and the weight is vertex-induced on every square. In addition, the weighted C≤3-free 2-matching problem and the C≤4- free 2-matching problem are big open problems in this area. References [1] Maxim A. Babenko. Improved algorithms for even factors and square-free simple b-matchings. Algorithmica, 64(3):362 -- 383, 2012. doi:10.1007/s00453-012-9642-6. [2] Krist´of B´erczi. The triangle-free 2-matching polytope of subcubic graphs. Technical Report TR- 2012-2, Egerv´ary Research Group, 2012. [3] Krist´of B´erczi and Yusuke Kobayashi. An algorithm for (n− 3)-connectivity augmentation problem: Jump system approach. Journal of Combinatorial Theory, Series B, 102(3):565 -- 587, 2012. doi: 10.1016/j.jctb.2011.08.007. [4] Krist´of B´erczi and L´aszl´o A. V´egh. Restricted b-matchings in degree-bounded graphs. In Integer Programming and Combinatorial Optimization, pages 43 -- 56. Springer Berlin Heidelberg, 2010. doi: 10.1007/978-3-642-13036-6_4. [5] Michele Conforti, G´erard Cornu´ejols, and Giacomo Zambelli. Extended formulations in combinato- rial optimization. 4OR, 8(1):1 -- 48, 2010. doi:10.1007/s10288-010-0122-z. [6] G´erard Cornu´ejols and William Pulleyblank. A matching problem with side conditions. Discrete Mathematics, 29(2):135 -- 159, 1980. doi:10.1016/0012-365x(80)90002-3. [7] G´erard Cornuejols and William R. Pulleyblank. Perfect triangle-free 2-matchings. In Mathematical Programming Studies, pages 1 -- 7. Springer Berlin Heidelberg, 1980. doi:10.1007/bfb0120901. [8] William H. Cunningham. Matching, matroids, and extensions. Mathematical Programming, 91(3):515 -- 542, 2002. doi:10.1007/s101070100256. [9] Jack Edmonds. Maximum matching and a polyhedron with 0, 1-vertices. Journal of Research of the National Bureau of Standards B, 69:125 -- 130, 1965. [10] Andr´as Frank. Restricted t-matchings in bipartite graphs. Discrete Applied Mathematics, 131(2):337 -- 346, 2003. doi:10.1016/s0166-218x(02)00461-4. [11] Martin Grotschel, L´aszlo Lov´asz, and Alexander Schrijver. Geometric Algorithms and Combinatorial Optimization, volume 2 of Algorithms and Combinatorics. Springer, 1988. [12] David Hartvigsen. Extensions of Matching Theory. PhD thesis, Carnegie Mellon University, 1984. 16 [13] David Hartvigsen. The square-free 2-factor problem in bipartite graphs. In Integer Programming and Combinatorial Optimization, pages 234 -- 241. Springer Berlin Heidelberg, 1999. doi:10.1007/ 3-540-48777-8_18. [14] David Hartvigsen. Finding maximum square-free 2-matchings in bipartite graphs. Journal of Com- binatorial Theory, Series B, 96(5):693 -- 705, 2006. doi:10.1016/j.jctb.2006.01.004. [15] David Hartvigsen and Yanjun Li. Polyhedron of triangle-free simple 2-matchings in subcubic graphs. Mathematical Programming, 138(1-2):43 -- 82, 2012. doi:10.1007/s10107-012-0516-0. [16] Satoru Iwata and Yusuke Kobayashi. A weighted linear matroid parity algorithm. In Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of Computing - STOC 2017, pages 264 -- 276. ACM Press, 2017. doi:10.1145/3055399.3055436. [17] Volker Kaibel. Extended formulations in combinatorial optimization. Technical report, arXiv:1104.1023, 2011. [18] Zolt´an Kir´aly. C4free 2-factors in bipartite graphs. Technical Report TR-2012-2, Egerv´ary Research Group, 1999. [19] Yusuke Kobayashi. A simple algorithm for finding a maximum triangle-free 2-matching in subcubic graphs. Discrete Optimization, 7(4):197 -- 202, 2010. doi:10.1016/j.disopt.2010.04.001. [20] Yusuke Kobayashi. Triangle-free 2-matchings and M-concave functions on jump systems. Discrete Applied Mathematics, 175:35 -- 42, 2014. doi:10.1016/j.dam.2014.05.016. [21] Yusuke Kobayashi, J´acint Szab´o, and Kenjiro Takazawa. A proof of Cunningham's conjecture on restricted subgraphs and jump systems. Journal of Combinatorial Theory, Series B, 102(4):948 -- 966, 2012. doi:10.1016/j.jctb.2012.03.003. [22] Adam N. Letchford, Gerhard Reinelt, and Dirk Oliver Theis. Odd minimum cut sets and b- doi: SIAM Journal on Discrete Mathematics, 22(4):1480 -- 1487, 2008. matchings revisited. 10.1137/060664793. [23] M´arton Makai. On maximum cost Kt,t-free t-matchings of bipartite graphs. SIAM Journal on Discrete Mathematics, 21(2):349 -- 360, 2007. doi:10.1137/060652282. [24] Manfred W. Padberg and M. R. Rao. Odd minimum cut-sets and b-matchings. Mathematics of Operations Research, 7(1):67 -- 80, 1982. [25] Gyula Pap. Combinatorial algorithms for matchings, even factors and square-free 2-factors. Math- ematical Programming, 110(1):57 -- 69, 2007. doi:10.1007/s10107-006-0053-9. [26] Kenjiro Takazawa. A weighted Kt,t-free t-factor algorithm for bipartite graphs. Mathematics of Operations Research, 34(2):351 -- 362, 2009. doi:10.1287/moor.1080.0365. [27] Kenjiro Takazawa. Decomposition theorems for square-free 2-matchings in bipartite graphs. Discrete Applied Mathematics, 233:215 -- 223, 2017. doi:10.1016/j.dam.2017.07.035. [28] Kenjiro Takazawa. Excluded t-factors in bipartite graphs: A unified framework for nonbipartite matchings and restricted 2-matchings. In Integer Programming and Combinatorial Optimization, pages 430 -- 441. Springer International Publishing, 2017. doi:10.1007/978-3-319-59250-3_35. [29] Kenjiro Takazawa. Finding a maximum 2-matching excluding prescribed cycles in bipartite graphs. Discrete Optimization, 26:26 -- 40, 2017. doi:10.1016/j.disopt.2017.05.003. 17 A Proof of Claim 9 By symmetry, it suffices to consider (G1, b1,T1). Since the tightness of (10) for (S∗, F ∗ 1 ) implies that x1(δG1 (r)) = 1, we can easily see that (x1, y1) satisfies (2), (3), (5) -- (8). In what follows, we consider (10) for (x1, y1) in (G1, b1,T1). For edge sets F (cid:48) 1 ⊆ E1, we denote g(F (cid:48) (1 − 0, F (cid:48) 1) ∈ F1, let h(S(cid:48), F (cid:48) x1(e)) to simplify the notation. For (S(cid:48), F (cid:48) 0, F (cid:48) 1) denote the left-hand side of 1) ∈ F1 be a minimizer of h(S(cid:48), F (cid:48) (10). To derive a contradiction, let (S(cid:48), F (cid:48) 0, F (cid:48) 1) and assume that h(S(cid:48), F (cid:48) T = (V (cid:48) T , E(cid:48) T ) be the subgraph of G1 corresponding to T , that is, the subgraph induced by {r, p1, p2, v2, v3} (Figure 7), {r, p3, v1} (Figure 8), {r, p1, p2, p3, v2, v3} (Figure 9), or {r, p4, v1} (Figure 10). Let S = S(cid:48) ∩ (V (cid:48) T \ {v1, v2, v3}), F0 = F (cid:48) 0 ∩ E(cid:48) T , and F1 = F (cid:48) 1) < 1. By changing the roles of S(cid:48) and V (cid:48) \ S(cid:48) if necessary, we may assume that r (cid:54)∈ S(cid:48). S∗ , let v1, v2, v3, α, β, and γ be as in Figures 7 -- 10. Let G(cid:48) x1(e) +(cid:80) 1) =(cid:80) For T ∈ T + e∈F (cid:48) 0, F (cid:48) 0, F (cid:48) 0, F (cid:48) 0 , F ∗ 0, F (cid:48) e∈F (cid:48) 1 ∩ E(cid:48) T . 0 1 We show the following properties (P1) -- (P9) in Section A.1, and show that (x1, y1) satisfies (10) by using these properties in Section A.2. (P1) If T is of type (A) or (B) and v2, v3 (cid:54)∈ S(cid:48), then b1( S) + F1 is even. (P2) If T is of type (A), v2, v3 ∈ S(cid:48), and b1( S) + F1 is even, then g( F0, F1) ≥ min{x(α) + x(γ), 2 − x(α) − x(γ) − 2yβ}. (P3) If T is of type (B), v2, v3 ∈ S(cid:48), and b1( S) + F1 is even, then g( F0, F1) ≥ yα + yγ + yαβ + yβγ. (P4) If T is of type (A) or (B), v2, v3 ∈ S(cid:48), and b1( S) + F1 is odd, then g( F0, F1) ≥ y∅ + yβ + yαγ. (P5) If T is of type (A) or (B), v2 ∈ S(cid:48), v3 (cid:54)∈ S(cid:48), and b1( S) + F1 is even, then g( F0, F1) ≥ min{x(α) + x(β), 2 − x(α) − x(β) − 2yγ}. (P6) If T is of type (A) or (B), v2 ∈ S(cid:48), v3 (cid:54)∈ S(cid:48), and b1( S) + F1 is odd, then g( F0, F1) ≥ y∅ + yγ + yαβ. (P7) If T is of type (A') or type (B') and v1 (cid:54)∈ S(cid:48), then b1( S) + F1 is even. (P8) If T is of type (A') or type (B'), v1 ∈ S(cid:48), and b1( S) + F1 is even, then g( F0, F1) = min{x(α) + x(γ), 2 − x(α) − x(γ) − 2yβ}. (P9) If T is of type (A') or type (B'), v1 ∈ S(cid:48), and b1( S) + F1 is odd, then g( F0, F1) = y∅ + yβ + yαγ. Note that each T ∈ T + S∗ satisfies exactly one of (P1) -- (P9) by changing the labels of v2 and v3 if necessary. A.1 Proofs of (P1) -- (P9) A.1.1 When T is of type (A) We first consider the case when T is of type (A). In the former case, h(S(cid:48), F (cid:48) Proof of (P1) Suppose that T is of type (A) and v2, v3 (cid:54)∈ S(cid:48). If b1( S) + F1 is odd, then either p1 ∈ S 1) ≥ and F1 ∩ δG1(p1) is even or p2 ∈ S and F1 ∩ δG1(p2) is even. min{x1(e1) + x1(e5), 2 − x1(e1) − x1(e5)} = 1, which is a contradiction. The same argument can be applied to the latter case. Therefore, b1( S) + F1 is even. Proof of (P2) Suppose that T is of type (A), v2, v3 ∈ S(cid:48), and b1( S) + F1 is even. If p1 (cid:54)∈ S(cid:48), then we define (S(cid:48)(cid:48), F (cid:48)(cid:48) 0 and 1 \ {e5}) if e5 ∈ F (cid:48) (S(cid:48)(cid:48), F (cid:48)(cid:48) 1) holds, 1 ), we may assume that p1 ∈ S(cid:48). Similarly, we may assume by replacing (S(cid:48), F (cid:48) that p2 ∈ S(cid:48), which implies that S = {p1, p2}, F0 ∪ F1 = {e1, e2, e3, e4}, and F1 is even. Then, g( F0, F1) ≥ min{x(α) + x(γ), 2 − x(α) − x(γ) − 2yβ} by the following case analysis. 0 , F (cid:48)(cid:48) 0 ∪ {e1}, F (cid:48) 0 , F (cid:48)(cid:48) 1) with (S(cid:48)(cid:48), F (cid:48)(cid:48) 1 ∪ {e1}) if e5 ∈ F (cid:48) 1 ) = h(S(cid:48), F (cid:48) 0 \ {e5}, F (cid:48) 0 , F (cid:48)(cid:48) 1 ) ∈ F1 as (S(cid:48)(cid:48), F (cid:48)(cid:48) 1 ) = (S(cid:48) ∪ {p1}, F (cid:48) 1 ) = (S(cid:48) ∪ {p1}, F (cid:48) 1. Since h(S(cid:48)(cid:48), F (cid:48)(cid:48) 0 , F (cid:48)(cid:48) 0 , F (cid:48)(cid:48) 0, F (cid:48) 0, F (cid:48) 0, F (cid:48) 18 • If F1 = ∅, then g( F0, F1) = x1(e1) + x1(e2) + x1(e3) + x1(e4) = 2 − x(α) − x(γ) − 2yβ. • If F1 ≥ 2, then g( F0, F1) ≥ 2−(x1(e1)+x1(e2)+x1(e3)+x1(e4)) = x(α)+x(γ)+2yβ ≥ x(α)+x(γ). Proof of (P4) Suppose that T is of type (A), v2, v3 ∈ S(cid:48), and b1( S) + F1 is odd. In the same way as (P2), we may assume that S = {p1, p2}, F0 ∪ F1 = {e1, e2, e3, e4}, and F1 is odd. Then, g( F0, F1) ≥ y∅ + yβ + yαγ by the following case analysis and by the symmetry of v2 and v3. • If F1 = 3, then g( F0, F1) ≥ 3 − (x1(e1) + x1(e2) + x1(e3) + x1(e4)) ≥ 1 ≥ y∅ + yβ + yαγ. • If F1 = {e1}, then g( F0, F1) ≥ (1 − x1(e1)) + x1(e2) ≥ y∅ + yβ + yαγ. • If F1 = {e3}, then g( F0, F1) ≥ 1 − x1(e3) ≥ y∅ + yβ + yαγ. Proof of (P5) Suppose that T is of type (A), v2 ∈ S(cid:48), v3 (cid:54)∈ S(cid:48), and b1( S) + F1 is even. In the same 1 ∩ δG1(p2) is even by the same way as (P2), we may assume that p1 ∈ S(cid:48). If p2 ∈ S(cid:48), then b1(p2) + F (cid:48) calculation as (P1). Therefore, we may assume that p2 (cid:54)∈ S(cid:48), since otherwise we can replace (S(cid:48), F (cid:48) 0, F (cid:48) 1) with (S(cid:48) \ {p2}, F (cid:48) 1). That is, we may assume that S = {p1}, F0 ∪ F1 = {e1, e3}, and F1 is odd. Then, 1 \ δG1(p2)) without increasing the value of h(S(cid:48), F (cid:48) 0 \ δG1(p2), F (cid:48) 0, F (cid:48) g( F0, F1) ≥ min{(1 − x1(e1)) + x1(e3), x1(e1) + (1 − x1(e3))} = min{x(α) + x(β), 2 − x(α) − x(β)} ≥ min{x(α) + x(β), 2 − x(α) − x(β) − 2yγ}. Proof of (P6) Suppose that T is of type (A), v2 ∈ S(cid:48), v3 (cid:54)∈ S(cid:48), and b1( S) + F1 is odd. In the same way as (P5), we may assume that S = {p1}, F0 ∪ F1 = {e1, e3}, and F1 is even. Then, g( F0, F1) ≥ min{x1(e1) + x1(e3), 2 − x1(e1) − x1(e3)} = min{y∅ + yγ + yαβ, 2 − (y∅ + yγ + yαβ)} = y∅ + yγ + yαβ. A.1.2 When T is of type (A') Second, we consider the case when T is of type (A'). Proof of (P7) Suppose that T is of type (A') and v1 (cid:54)∈ S(cid:48). If b1( S) + F1 is odd, then S = {p3} 1) ≥ g( F0, F1) ≥ 1 by the following case analysis, which is a and F1 is odd. This shows that h(S(cid:48), F (cid:48) contradiction. 0, F (cid:48) • If F1 = {e1}, then g( F0, F1) ≥ (1 − x1(e1)) + x1(e2) + x1(e9) ≥ 1. The same argument can be applied to the case of F1 = {e2} by the symmetry of α and γ. • If F1 = {ei} for some i ∈ {3, 4, 8}, then g( F0, F1) ≥ (1 − x1(ei)) + x1(e9) ≥ 1. • If F1 = {e9}, then g( F0, F1) = 1 + 2y∅ ≥ 1. • If F1 ≥ 3, then g( F0, F1) ≥ 3 − (x1(e1) + x1(e2) + x1(e3) + x1(e4) + x1(e8) + x1(e9)) ≥ 1. Therefore, b1( S) + F1 is even. 19 Proof of (P8) Suppose that T is of type (A'), v1 ∈ S(cid:48), and b1( S) + F1 is even. Then, g( F0, F1) ≥ min{x(α) + x(γ), 2 − x(α) − x(γ) − 2yβ} by the following case analysis. • If F0 = {e8, e9} and F1 = ∅, then g( F0, F1) = x1(e8) + x1(e9) = x(α) + x(γ). • If F0 = ∅ and F1 = {e8, e9}, then g( F0, F1) = (1 − x1(e8)) + (1 − x1(e9)) = 2 − x(α) − x(γ) ≥ 2 − x(α) − x(γ) − 2yβ. • If F0 ∪ F1 = {e1, e2, e3, e4}, then g( F0, F1) ≥ min{x(α) + x(γ), 2 − x(α) − x(γ) − 2yβ} by the same calculation as (P2) in Section A.1.1. Proof of (P9) Suppose that T is of type (A'), v1 ∈ S(cid:48), and b1( S) + F1 is odd. Then, g( F0, F1) ≥ y∅ + yβ + yαγ by the following case analysis. • If F0 = {e8} and F1 = {e9}, then g( F0, F1) = x1(e8) + (1 − x1(e9)) = y∅ + yβ + yαγ. • If F0 = {e9} and F1 = {e8}, then g( F0, F1) = (1 − x1(e8)) + x1(e9) ≥ 1 ≥ y∅ + yβ + yαγ. • If F0 ∪ F1 = {e1, e2, e3, e4}, then g( F0, F1) ≥ y∅ + yβ + yαγ by the same calculation as (P4) in Section A.1.1. A.1.3 When T is of type (B) T , E(cid:48) Third, we consider the case when T is of type (B). Let G+ = (V +, E+) be the graph obtained from G(cid:48) T = (V (cid:48) T ) in Figure 9 by adding a new vertex r∗, edges e11 = rr∗, e12 = v2r∗, e13 = v3r∗, and self- loops e14, e15, e16 that are incident to v2, v3, and r∗, respectively (Figure 12). We define bT : V + → Z≥0 as bT (v) = 1 for v ∈ {r, p1, p2, p3} and bT (v) = 2 for v ∈ {r∗, v2, v3}. We also define xT : E+ → Z≥0 as xT (e) = x1(e) for e ∈ E(cid:48) T and xT (e11) = yα + yγ + yαβ + yβγ, xT (e12) = yα + yβ + yαγ + yβγ, xT (e13) = yβ + yγ + yαβ + yαγ, xT (e14) = y∅ + yγ, xT (e15) = y∅ + yα, xT (e16) = y∅. For J ∈ ET , define bT -factors MJ in G+ as follows: Mα = {e4, e8, e11, e12, e15}, Mαβ = {e5, e8, e9, e11, e13}, Mβ = {e1, e8, e9, e12, e13}, Mαγ = {e2, e8, e9, e12, e13}, M∅ = {e1, e7, e14, e15, e16}, Mγ = {e3, e9, e11, e13, e14}, Mβγ = {e6, e8, e9, e11, e12}. Then, we obtain(cid:80) y1(J) = 1 and(cid:80) y1(J)xMJ = xT , where xMJ ∈ RE+ J∈ET J∈ET is the characteristic vector of MJ . This shows that xT is in the bT -factor polytope in G+. Therefore, xT satisfies (4) with respect to G+ and bT . By using this fact, we show (P1), (P3), (P4), and (P6). Proof of (P1) Suppose that T is of type (B) and v2, v3 (cid:54)∈ S(cid:48). If b1( S) + F1 is odd, then bT ( S) + F1 is also odd. Since xT satisfies (4) with respect to G+ and bT , we obtain g( F0, F1) ≥ 1. This shows that h(S(cid:48), F (cid:48) 1) ≥ 1, which is a contradiction. Therefore, b1( S) + F1 is even. 0, F (cid:48) Proof of (P3) Suppose that T is of type (B), v2, v3 ∈ S(cid:48), and b1( S) + F1 is even. Since bT ( S ∪ {r∗, v2, v3}) + F1 ∪{e11} is odd and xT satisfies (4), we obtain g( F0, F1) + (1− xT (e11)) ≥ 1. Therefore, g( F0, F1) ≥ xT (e11) = yα + yγ + yαβ + yβγ. Proof of (P4) Suppose that T is of type (B), v2, v3 ∈ S(cid:48), and b1( S) + F1 is odd. Since bT ( S ∪ {r∗, v2, v3}) + F1 is odd and xT satisfies (4), we obtain g( F0, F1) + xT (e11) ≥ 1. Therefore, g( F0, F1) ≥ 1 − xT (e11) = y∅ + yβ + yαγ. 20 Figure 12: Construction of G+ Proof of (P6) Suppose that T is of type (B), v2 ∈ S(cid:48), v3 (cid:54)∈ S(cid:48), and b1( S) + F1 is odd. Since bT ( S ∪{v2}) + F1 is odd and xT satisfies (4), we obtain g( F0, F1) + xT (e12) ≥ 1. Therefore, g( F0, F1) ≥ 1 − xT (e12) = y∅ + yγ + yαβ. In what follows, we show (P5) by a case analysis. Proof of (P5) Suppose that T is of type (B), v2 ∈ S(cid:48), v3 (cid:54)∈ S(cid:48), and b1( S)+ F1 is even. If S∩{p1, p3} (cid:54)= ∅ and p2 (cid:54)∈ S, then we can add p2 to S(cid:48) without decreasing the value of h(S(cid:48), F (cid:48) 1). Therefore, we can show g( F0, F1) ≥ {x(α) + x(β), 2 − x(α) − x(β) − 2yγ} by the following case analysis. 0, F (cid:48) • Suppose that S = {p1, p2, p3}, which implies that F0 ∪ F1 = {e1, e2, e6, e9} and F1 is odd. -- If F1 = {ei} for i ∈ {1, 2, 6}, then g( F0, F1) ≥ (1 − x1(ei)) + x1(e9) ≥ x(α) + x(β). -- If F1 = {e9}, then g( F0, F1) = yα + yβ + yαγ + yβγ + 2y∅ = 2 − x(α) − x(β) − 2yγ. -- If F1 = 3, then g( F0, F1) ≥ 3 − (x1(e1) + x1(e2) + x1(e6) + x1(e9)) ≥ x(α) + x(β). • Suppose that S = {p1, p2}, which implies that F0 ∪ F1 = {e1, e2, e4, e6, e7} and F1 is even. -- If F1 = ∅, then g( F0, F1) = x1(e1) + x1(e2) + x1(e4) + x1(e6) + x1(e7) = 2− x(α)− x(β)− 2yγ. -- If F1 ≥ 2, then g( F0, F1) ≥ 2 − (x1(e1) + x1(e2) + x1(e4) + x1(e6) + x1(e7)) ≥ x(α) + x(β). • Suppose that S = {p2}, which implies that F0 ∪ F1 = {e3, e5, e7} and F1 is odd. -- If F1 = {ei} for i ∈ {3, 7}, then g( F0, F1) ≥ (1 − x1(ei)) + x1(e5) ≥ x(α) + x(β). -- If F1 = {e5}, then g( F0, F1) ≥ (1 − x1(e5)) + x1(e7) ≥ 2 − x(α) − x(β) − 2yγ. -- If F1 = {e3, e5, e7}, then g( F0, F1) = 3 − (x1(e3) + x1(e5) + x1(e7)) ≥ x(α) + x(β). • Suppose that S = {p2, p3}, which implies that F0 ∪ F1 = {e3, e4, e5, e9} and F1 is even. -- If F1 = ∅, then g( F0, F1) = x1(e3)+x1(e4)+x1(e5)+x1(e9) = x(α)+x(β)+2yγ ≥ x(α)+x(β). -- If F1 ≥ 2, then g( F0, F1) ≥ 2 − (x1(e3) + x1(e4) + x1(e5) + x1(e9)) = 2 − x(α) − x(β) − 2yγ. • If S = ∅, then F0 ∪ F1 = {e5, e8} and F1 is even. Therefore, g( F0, F1) ≥ min{x1(e5) + x1(e8), 2 − x1(e5) − x1(e8)} ≥ min{x(α) + x(β), 2 − x(α) − x(β) − 2yγ}. A.1.4 When T is of type (B') Finally, we consider the case when T is of type (B'). 21 rp3e9e8e1v2v3p2e7e2e3e4e5e6e11e12e13e14e15p1e16r* 0, F (cid:48) Proof of (P7) Suppose that T is of type (B') and v1 (cid:54)∈ S(cid:48). If b1( S) + F1 is odd, then S = {p4} 1) ≥ min{x1(e1) + x1(e10), 2 − x1(e1) − x1(e10)} = 1, which is a contradiction. Therefore, and h(S(cid:48), F (cid:48) b1( S) + F1 is even. Proof of (P8) Suppose that T is of type (B'), v1 ∈ S(cid:48), and b1( S) + F1 is even. If p4 (cid:54)∈ S(cid:48), then we 1 ) ∈ F1 as (S(cid:48)(cid:48), F (cid:48)(cid:48) define (S(cid:48)(cid:48), F (cid:48)(cid:48) 1 ) = (S(cid:48) ∪{p4}, F (cid:48) 0, F (cid:48) 1) 1 ), we may assume that p4 ∈ S(cid:48). Then, since F0 ∪ F1 = {e1, e2} and F1 is odd, we with (S(cid:48)(cid:48), F (cid:48)(cid:48) obtain 0 , F (cid:48)(cid:48) 1), by replacing (S(cid:48), F (cid:48) 0 , F (cid:48)(cid:48) 0 ∪{e1}, F (cid:48) 0 , F (cid:48)(cid:48) 1 \{e10}) if e10 ∈ F (cid:48) 1∪{e1}) if e10 ∈ F (cid:48) 0\{e10}, F (cid:48) 0 , F (cid:48)(cid:48) 1 ) = (S(cid:48)∪{p4}, F (cid:48) 1. Since h(S(cid:48)(cid:48), F (cid:48)(cid:48) 0 and (S(cid:48)(cid:48), F (cid:48)(cid:48) 1 ) = h(S(cid:48), F (cid:48) 0 , F (cid:48)(cid:48) 0, F (cid:48) g( F0, F1) ≥ min{(1 − x1(e1)) + x1(e2), x1(e1) + (1 − x1(e2))} ≥ min{x(α) + x(γ), 2 − x(α) − x(γ) − 2yβ}. Proof of (P9) Suppose that T is of type (B'), v1 ∈ S(cid:48), and b1( S) + F1 is odd. In the same way as (P8), we may assume that S = {p4}, F0 ∪ F1 = {e1, e2}, and F1 is even. Then, g( F0, F1) ≥ min{x1(e1) + x1(e2), (1 − x1(e1)) + (1 − x1(e2))} = min{y∅ + yβ + yαγ, 2 − (y∅ + yβ + yαγ)} = y∅ + yβ + yαγ. A.2 Condition (10) Recall that r (cid:54)∈ S(cid:48) is assumed and note that x1(δG1(r)) = 1. Let T(P 3) ⊆ T + S∗ be the set of triangles satisfying the conditions in (P3), i.e., the set of triangles of type (B) such that v2, v3 ∈ S(cid:48) and b1( S)+ F1 is even. Since yα +yγ +yαβ +yβγ = 1−x1(eT S∗ of type (B), if there exist two triangles T, T (cid:48) ∈ T(P 3), then h(S(cid:48), F (cid:48) 1 ) − x1(eT 2 )) ≥ 2 − x1(δG1 (r)) = 1, which is a contradiction. Similarly, if there exists a triangle T ∈ T(P 3) and an edge 2 )) + (1 − x1(e)) ≥ 2 − x1(δG1(r)) = 1, e ∈ (δG1(r) \ E(cid:48) which is a contradiction. Therefore, either T(P 3) = ∅ holds or T(P 3) consists of exactly one triangle, say T , and (δG1(r) \ E(cid:48) 2 ) holds for each triangle T ∈ T + 1) ≥ (1 − x1(eT 1 ) − x1(eT 2 )) + (1 − x1(eT (cid:48) 1) ≥ (1 − x1(eT 1, then h(S(cid:48), F (cid:48) 1 ) − x1(eT (cid:48) 1 )−x1(eT T ) ∩ F (cid:48) 0, F (cid:48) 0, F (cid:48) 1 = ∅. T ) ∩ F (cid:48) 1 ) ∈ F1 as F (cid:48)(cid:48) 1 = F (cid:48) Assume that T(P 3) = {T} and (δG1(r) \ E(cid:48) T ) ∩ F (cid:48) 1 = ∅. Define (S(cid:48)(cid:48), F (cid:48)(cid:48) 0 , F (cid:48)(cid:48) F (cid:48)(cid:48) 0 = (F (cid:48) S(cid:48)(cid:48) = S(cid:48) ∪ V (cid:48) T , 0(cid:52)δG1 (r)) \ E(cid:48) T , 1 ) is a partition of δG1 (S(cid:48)(cid:48)), b1(S(cid:48)(cid:48)) +F (cid:48)(cid:48) 0 , F (cid:48)(cid:48) 1)− h(S(cid:48)(cid:48), F (cid:48)(cid:48) 1 )− x1(eT 0, F (cid:48) 0 , F (cid:48)(cid:48) where (cid:52) denotes the symmetric difference. Note that (F (cid:48)(cid:48) (b1(S(cid:48)) + b1( S)) + (F (cid:48) 1− F1) ≡ 1 (mod 2), and h(S(cid:48), F (cid:48) x1(δG1(r) \ {x1(eT This shows that (V (cid:48)(cid:48) \ S(cid:48)(cid:48), F (cid:48)(cid:48) triangle T (cid:48) ∈ T + 0 , F (cid:48)(cid:48) of type (B) such that v2, v3 (cid:54)∈ S(cid:48) and b1( S) + F1 is odd with respect to (S(cid:48), F (cid:48) (P1). Therefore, by replacing (S(cid:48), F (cid:48) 1 = 2 ))− 0 , F (cid:48)(cid:48) 1 ) ∈ F1 is also a minimizer of h. 1 ) ∈ F1 is a minimizer of h such that r ∈ V (cid:48)(cid:48) \ S(cid:48)(cid:48). Furthermore, if a 1 ), then T (cid:48) is a triangle 0, F (cid:48) 1), which contradicts In what follows, we construct (S, F0, F1) ∈ F for which (x, y) violates (10) to derive a contradiction. S∗ satisfies the conditions in (P3) with respect to (V (cid:48)(cid:48) \ S(cid:48)(cid:48), F (cid:48)(cid:48) 2 )}) = 0. By these observations, (S(cid:48)(cid:48), F (cid:48)(cid:48) 1 ), we may assume that T(P 3) = ∅. 1) with (V (cid:48)(cid:48) \ S(cid:48)(cid:48), F (cid:48)(cid:48) 1 ) ≥ (1− x1(eT 1 \ E(cid:48) T , 1 ), x1(eT 0 , F (cid:48)(cid:48) 0 , F (cid:48)(cid:48) 0, F (cid:48) We initialize (S, F0, F1) as S = S(cid:48) ∩ V, F0 = F (cid:48) 0 ∩ E, F1 = F (cid:48) 1 ∩ E, and apply the following procedures for each triangle T ∈ T + S∗ . • Suppose that T satisfies the condition in (P1) or (P7). In this case, we do nothing. • Suppose that T satisfies the condition in (P2) or (P8). If g( F0, F1) ≥ x(α) + x(γ), then add α and γ to F0. Otherwise, since g( F0, F1) ≥ 2 − x(α) − x(γ) − 2yβ, add α and γ to F1. 22 • Suppose that T satisfies the condition in (P4) or (P9). In this case, add α to F0 and add γ to F1. • Suppose that T satisfies the condition in (P5). If g( F0, F1) ≥ x(α) + x(β), then add α and β to F0. Otherwise, since g( F0, F1) ≥ 2 − x(α) − x(β) − 2yγ, add α and β to F1. • Suppose that T satisfies the condition in (P6). In this case, add α to F0 and add β to F1. S∗ , because T(P 3) = ∅. Note that exactly one of the above procedures is applied for each T ∈ T + Then, we see that (S, F0, F1) ∈ F holds and the left-hand side of (10) with respect to (S, F0, F1) is at 1) < 1 is assumed, (x, y) violates (10) for (S, F0, F1) ∈ 1) by (P1) -- (P9). Since h(S(cid:48), F (cid:48) 0, F (cid:48) most h(S(cid:48), F (cid:48) F, which is a contradiction. 0, F (cid:48) B Proof of Claim 10 0 ef ∈ M1∩ M2} does not affect 0 } with {f ∈ F ∗ We can easily see that replacing (M1∪ M2)∩{ef f ∈ F ∗ the degrees of vertices in V . Since M1∪M2 contains exactly one of {ef v} or ef r(cid:48)) for f = uv ∈ F ∗ u, ef 1 , replacing (M1 ∪ M2) ∩ {ef 1 ef r (cid:54)∈ M1 ∩ M2} does not affect the degrees of vertices in V . 1 } with {f ∈ F ∗ v f = uv ∈ F ∗ r (= ef u, ef r , ef For every T ∈ T + S∗ of type (A) or (A'), since ϕ(M1, M2, T ) ∩ {α, γ} = MT ∩ {e8, e9}, ϕ(M1, M2, T ) ∩ {α, β} = MT ∩ {e3, e5}, and ϕ(M1, M2, T ) ∩ {β, γ} = MT ∩ {e4, e6} hold by the definition of ϕ(M1, M2, T ), replacing MT with ϕ(M1, M2, T ) does not affect the degrees of vertices in V . Furthermore, for every T ∈ T + S∗ of type (B) or (B'), since ϕ(M1, M2, T ) ∩ {α, γ} = MT ∩ {e2, e10}, ϕ(M1, M2, T ) ∩ {α, β} = MT ∩ {e5, e8}, and ϕ(M1, M2, T ) ∩ {β, γ} = MT ∩ {e6, e9} hold by the definition of ϕ(M1, M2, T ), replacing MT with ϕ(M1, M2, T ) does not affect the degrees of vertices in V . Since b(v) = b1(v) for v ∈ S∗ and b(v) = b2(v) for v ∈ V ∗ \ S∗, this shows that M1 ⊕ M2 forms a b-factor. Since Mj is Tj-free for j ∈ {1, 2}, M1 ⊕ M2 is a T -free b-factor. C Proof of Claim 11 By the definitions of x1, x2, and M1 ⊕ M2, (13) and (14) show that (cid:88) (M1,M2)∈M for e ∈ E \(cid:83) x(e) = λ(M1,M2)xM1⊕M2(e) (16) Let T ∈ T + S∗ E(T ). T∈T + S∗ be a triangle of type (A) for (G1, b1,T1) and let α, β, and γ be as in Figures 7 and 8. 23 By the definition of ϕ(M1, M2, T ), we obtain (M1,M2)∈M λ(M1,M2)xM1⊕M2(β) (cid:88) (cid:88){λ(M1,M2) ϕ(M1, M2, T ) = {α, β},{β, γ}, or {β}} (cid:88){λ(M1,M2) e4 ∈ MT} + (cid:88){λ(M1,M2) e3 ∈ MT} + = = (cid:88){λ(M1,M2) e7 ∈ MT} = x1(e3) + x1(e4) + x2(e7) = yαβ + yβγ + yβ = x(β). We also obtain(cid:88) (M1,M2)∈M λ(M1,M2)xM1⊕M2 (α) (cid:88){λ(M1,M2) ϕ(M1, M2, T ) (cid:54)= {γ},{β, γ},{β}} = 1 −(cid:88){λ(M1,M2) e1 ∈ MT} −(cid:88){λ(M1,M2) e4 ∈ MT} −(cid:88){λ(M1,M2) e7 ∈ MT} = = 1 − x1(e1) − x1(e4) − x2(e7) = 1 − y∅ − yγ − yβγ − yβ = x(α). Since a similar equality holds for γ by symmetry, (16) holds for e ∈ {α, β, γ}. Since T is a triangle of type (A') for (G1, b1,T1) if and only if it is of type (A) for (G2, b2,T2), the same argument can be applied when T is a triangle of type (A') for (G1, b1,T1). S∗ be a triangle of type (B) for (G1, b1,T1) and let α, β, and γ be as in Figures 9 and 10. Let T ∈ T + By the definition of ϕ(M1, M2, T ), we obtain (M1,M2)∈M λ(M1,M2)xM1⊕M2 (β) (cid:88) (cid:88){λ(M1,M2) ϕ(M1, M2, T ) (cid:54)= ∅,{α},{γ},{α, γ}} = 1 −(cid:88){λ(M1,M2) e2 ∈ MT} −(cid:88){λ(M1,M2) e3 ∈ MT} −(cid:88){λ(M1,M2) e4 ∈ MT} −(cid:88){λ(M1,M2) e7 ∈ MT} = = 1 − x1(e2) − x1(e3) − x1(e4) − x1(e7) = 1 − yαγ − yγ − yα − y∅ = x(β). We also obtain(cid:88) (M1,M2)∈M λ(M1,M2)xM1⊕M2 (α) (cid:88){λ(M1,M2) ϕ(M1, M2, T ) = {α},{α, β}, or {α, γ}} (cid:88){λ(M1,M2) e2 ∈ MT} + (cid:88){λ(M1,M2) e4 ∈ MT} + = = (cid:88){λ(M1,M2) e5 ∈ MT} = x1(e2) + x1(e4) + x1(e5) = yαγ + yα + yαβ = x(α). Since a similar equality holds for γ by symmetry, (16) holds for e ∈ {α, β, γ}. The same argument can be applied when T is a triangle of type (B') for (G1, b1,T1). Therefore, (16) holds for every e ∈ E, which complete the proof of the claim. 24
1902.02187
2
1902
2019-09-20T11:09:45
Top Tree Compression of Tries
[ "cs.DS" ]
We present a compressed representation of tries based on top tree compression [ICALP 2013] that works on a standard, comparison-based, pointer machine model of computation and supports efficient prefix search queries. Namely, we show how to preprocess a set of strings of total length $n$ over an alphabet of size $\sigma$ into a compressed data structure of worst-case optimal size $O(n/\log_\sigma n)$ that given a pattern string $P$ of length $m$ determines if $P$ is a prefix of one of the strings in time $O(\min(m\log \sigma,m + \log n))$. We show that this query time is in fact optimal regardless of the size of the data structure. Existing solutions either use $\Omega(n)$ space or rely on word RAM techniques, such as tabulation, hashing, address arithmetic, or word-level parallelism, and hence do not work on a pointer machine. Our result is the first solution on a pointer machine that achieves worst-case $o(n)$ space. Along the way, we develop several interesting data structures that work on a pointer machine and are of independent interest. These include an optimal data structures for random access to a grammar-compressed string and an optimal data structure for a variant of the level ancestor problem.
cs.DS
cs
Top Tree Compression of Tries∗ Philip Bille [email protected] Pawe(cid:32)l Gawrychowski [email protected] Inge Li Gørtz [email protected] Gad M. Landau Oren Weimann [email protected] [email protected] Abstract We present a compressed representation of tries based on top tree compression [ICALP 2013] that works on a standard, comparison-based, pointer machine model of computation and supports efficient prefix search queries. Namely, we show how to preprocess a set of strings of total length n over an alphabet of size σ into a compressed data structure of worst-case optimal size O(n/ logσ n) that given a pattern string P of length m determines if P is a prefix of one of the strings in time O(min(m log σ, m + log n)). We show that this query time is in fact optimal regardless of the size of the data structure. Existing solutions either use Ω(n) space or rely on word RAM techniques, such as tabulation, hashing, address arithmetic, or word-level parallelism, and hence do not work on a pointer machine. Our result is the first solution on a pointer machine that achieves worst-case o(n) space. Along the way, we develop several interesting data structures that work on a pointer machine and are of independent interest. These include an optimal data structures for random access to a grammar- compressed string and an optimal data structure for a variant of the level ancestor problem. 1 Introduction A string dictionary compactly represents a set of strings S = S1, . . . , Sk to support efficient prefix queries, that is, given a pattern string P determine if P is a prefix of some string in S. Designing efficient string dictionaries is a fundamental data structural problem dating back to the 1960's. String dictionaries are a key component in a wide range of applications in areas such as computational biology, data compression, data mining, information retrieval, natural language processing, and pattern matching. A key challenge and the focus of most of the recent work is to design efficient compressed string dictio- naries, that take advantage of repetitions in the strings to minimize space, while still supporting efficient queries. While many efficient solutions are known, they all rely on powerful word-RAM techniques, such as tabulation, address arithmetic, word-level parallelism, hashing, etc., to achieve efficient bounds. A natural question is whether or not such techniques are necessary for obtaining efficient compressed string dictionaries or if simpler and more basic computational primitives such as pointer-based data structures and character comparison suffice. model of computation. We achieve the following bounds: let n =(cid:80)k In this paper, we answer this question to the affirmative by introducing a new compressed string dictionary based on top tree compression that works on a standard comparison-based, pointer machine i=1 Si be the total length of the strings in S, let σ be the size of the alphabet, and m be the length of a query string P . Our compressed string dictionary uses O(n/ logσ n) space (space is measured as the number of words and not bits, see discussion below) and supports queries in O(min(m log σ, m + log n)) time. The space matches the information-theoretic worst-case space lower bound, and we further show that the query time is optimal for any comparison-based query algorithm regardless of the space. Compared to previous work our string dictionary is the first o(n) space solution in this model of computation. ∗An extended abstract appeared at ISAAC 2019 [17] 1 1.1 Computational Models We consider three computational models. In the comparison-based model algorithms only interact with the input by comparing elements. Hence they cannot exploit the internal representation of input elements, e.g., for hashing or word-level parallelism. The comparison-based model is a fundamental and well-studied computational model, e.g., in textbook results for sorting [45], string matching [44], and computational geometry [54]. Modern programming languages and libraries, such as the C++ standard template library, implement comparison-based algorithms by supporting abstract and user-specified comparison functions as function arguments. In our context, we say that a string dictionary is comparison-based if the query algorithm can only access the input string P via single character comparisons of the form P [i] ≤ c, where c is a character. In the pointer machine model, a data structure is a directed graph with bounded out-degree. Each node contains a constant number of data fields or pointer to other nodes and algorithms must access the data structure by traversing the graph. Hence, a pointer machine algorithm cannot implement random access structures such as arrays or perform address arithmetic. The pointer machine captures linked data structures such as linked-lists and search trees. The pointer machine model is a classic and well-studied model, see e.g. [1, 21, 22, 37, 60]. Finally, in the word RAM model of computation [36] the memory is an array of memory words, that each contain a logarithmic number of bits. Memory words can be operated on in unit-time using a standard set of arithmetic operations, boolean operations, and shifts. The word RAM model is strictly more powerful than the comparison-based model and the pointer-machine model and supports random access, hashing, address arithmetic, word-level parallelism, etc. (these are not possible in the other models). The space of a data structure in the word RAM model is the number of memory words used and the space in the pointer machine model is the total number of nodes. To compare the space of the models, we assume that each field in a node in the pointer machine stores a logarithmic number of bits. Hence, the total number of bits we can represent in a given space in both models is within a constant factor of each other. 1.2 Previous work The classic textbook string dictionary solution, due to Fredkin [31] from 1960, is to store the trie T of the strings in S and to answer prefix queries using a top-down traversal of T , where at each step we match a single character from P to the labels of the outgoing edges of a node. If we manage to match all characters of P then P is a prefix of a string in S and otherwise it is not. Depending on the representation of the trie and the model of computation we can obtain several com- binations of space and time complexity. On a comparison-based, pointer machine model of computation, we can store the outgoing edges of each in a biased search tree [14], leading to an O(n) space solution with query time O(min(m log σ, m + log n)). We can compress this solution by merging maximal identical complete subtrees of T [28], thus replac- ing T by a directed acyclic graph (DAG) D that represents T . This leads to a solution with the same query time as above but using only O(d) space, where d is the size of the smallest DAG D representing T . The size of D can be exponentially smaller than n, but may not compress at all. Consider for instance the case where T is a single path of length n where all edges have the same label (i.e., corresponding to a single string of the same letter). Even though T is highly compressible (we can represent it by the label and the length of the path) it does not contain any identical subtrees and hence its smallest DAG has size Ω(n). Using the power of the word RAM model improved representations are possible. Benoit et al. [13] and Raman et al. [55] gave succinct representations of tries that achieve O(n/ logσ n) space and O(m) query time, thus simultaneously achieving optimal query time and matching the worst-case information theoretic space lower bounds. These results rely on powerful word RAM techniques to obtain the bounds, such as tabulation and hashing. Numerous trie representations are known, see e.g., [4, 5, 6, 7, 8, 18, 26, 34, 40, 41, 53, 59, 61, 62, 63], but these all use word RAM techniques to achieve near optimal combinations of time and space. Another approach is to compress the strings according to various measures of repetitiveness, such as the empirical k-th order entropy [35, 46, 50, 56], the size of the Lempel-Ziv parse [9, 15, 23, 32, 33, 42, 52], 2 the size of the smallest grammar [24, 25, 32], the run-length encoded Burrows-Wheeler transform, [47, 48, 49, 57], and others [5, 10, 11, 30, 51, 58]. The above solutions are designed to support more general queries on the strings, but as noted by Ars and Fischer [5] they are straightforward to adapt to prefix queries. For example, if z is size of the Lempel-Ziv parse of the concatenation of the strings in S, the result of Christiansen and Etienne [23] implies a string dictionary of size O(z log(n/z)) that supports queries in time O(m + log n). Since z can be exponentially smaller than n, the space is significantly improved on highly-compressible strings. Since z = O(n/ logσ n) in the worst-case, the space is always O( n ) and thus almost optimal compared to the information theoretic lower bound. Similar bounds are known for the other measures of repetitiveness. As in the case of succinct representations of tries, all of these solutions use word RAM techniques. n/ logσ n )) = O( n log logσ n logσ n logσ n log( n 1.3 Our results We propose a new compressed string dictionary that achieves the following bounds: Theorem 1 Let S be a set of strings of total length n over an alphabet of size σ. On a comparison- based, pointer machine model of computation, we can construct a compressed string dictionary that uses O(n/ logσ n) space and answer queries in O(min(m log σ, m + log n)) time. Note that the space bound for Theorem 1 matches the information theoretic lower bound and the time bound matches the classic linear space implementation of tries with biased search trees. The result is the first o(n) space solution in this model of computation. Furthermore, we show that this time bound is optimal. Theorem 2 For any n, m ≤ n, and σ ≥ 2, there exists a set S of strings of total length n over an alphabet of size σ such that any comparison-based algorithm that checks if a given pattern P of length m belongs to S needs to perform Ω(min(m log σ, m + log n)) comparisons in the worst case. Note that Theorem 2 holds regardless of the space used, holds even for weaker membership queries, and only assumes that the algorithm is a comparison-based algorithm. We note that the upper bound holds on a pointer machine with comparisons and additions as arithmetic operations, while the lower bound only assumes comparisons. 1.4 Techniques In top tree compression [19] one transforms a labeled tree T into another tree T (called a top tree) that is of height O(log n) and represents a hierarchical decomposition of T into connected subgraphs (called clusters). Each cluster overlaps with other clusters in at most two nodes. Every leaf in T corresponds to a cluster consisting of a single edge in T and every internal node in T corresponds to a merge of two clusters. The top tree T is then compressed using the classical DAG compression resulting in the top DAG TD. The top DAG supports basic navigational queries on T in O(log n) time, has size O(n/ logσ n), can compress exponentially better than DAG compression, and is never worse than DAG compression by more than a O(log n) factor [16, 19, 29, 39]. Our main technical contribution is implementing prefix search optimally on the top DAG. To this end, we develop several optimal pointer machine data structures of independent interest: • A data structure for the path extraction problem, that asks to compactly represent an edge-labeled tree T such that given a node v we can efficiently return the labels on the root-to-v path in T . While an optimal solution for this problem can be obtained by plugging in known tools, more specifically a fully persistent queue [38], we believe that our self-contained solution is simpler and elegant. • A data structure for the weighted level ancestor problem, that asks to compactly represent an edge-weighted tree T such that given a node v and a positive number x we can efficiently return the rootmost ancestor of v whose distance from the root is at least x. An immediate implication of our weighted level ancestor data structure is an optimal data structure for the random access problem on grammar compressed strings. This improves a SODA'11 result [20] that required word RAM bit tricks. 3 • A data structure for the spine path extraction problem, that asks to compactly represent a top-tree compression TD such that given a cluster C we can efficiently return the characters of the unique path between the two boundary nodes of C. • For the lower bound, we show that any algorithm that given a string P [1, m] checks if(cid:80)m i=1 P [i] = 0 (mod 2) needs to perform Ω(m log σ) comparisons in the worst case. We then show that when n ≥ mσm this implies the Ω(m log σ) bound for our problem and when n < mσm it implies the Ω(m + log n) bound for our problem. 1.5 Roadmap In Section 2 we recall top trees and how a top tree of a tree T is obtained by merging (either vertically or a horizontally) the top trees of two subtrees of T that overlap on a single node. In Section 3 we present a simple randomized Monte-Carlo word RAM solution to the compressed string indexing problem that is the basis of our deterministic pointer machine solutions in the following sections. The solution is based on top trees and efficiently handles horizontal merges (deterministically) and vertical merges (randomized Monte-Carlo). In Section 4 we show how to handle vertical merges deterministically on a pointer machine, and in Section 5 we show that this suffices to achieve the O(m+log n) query time in Theorem 1. We show a different way to handle vertical merges in Section 6 and horizontal merges in Section 7. In Section 8 we show that these suffice to achieve the O(m log σ) query time in Theorem 1. Finally, in Section 9 we give a matching lower bound showing that the query time in Theorem 1 is optimal regardless of the size of the structure. 2 Preliminaries In this section we briefly review Karp-Rabin fingerprints [43], top trees [3], and top tree compression [19]. 2.1 Karp-Rabin Fingerprints The Karp-Rabin fingerprint [43] of a string x is defined as φ(x) = (cid:80)x i=1 x[i] · ci mod p, where c is a randomly chosen positive integer, and 2N c+4 ≤ p ≤ 4N c+4 is a prime. Karp-Rabin fingerprints guarantee that given two strings x and y, if x = y then φ(x) = φ(y). Furthermore, if x (cid:54)= y, then with high probability φ(x) (cid:54)= φ(y). Fingerprints can be composed and subtracted as follows. Lemma 1 Let x = yz be a string decomposable into a prefix y and suffix z. Given any two of the Karp- Rabin fingerprints φ(x), φ(y) and φ(z), it is possible to calculate the remaining fingerprint in constant time. 2.2 Clustering Let v be a node in T with children v1, . . . , vk in left-to-right order. Define T (v) to be the subtree induced by v and all proper descendants of v. Define F (v) to be the forest induced by all proper descendants of v. For 1 ≤ s ≤ r ≤ k let T (v, vs, vr) be the connected component induced by the nodes {v} ∪ T (vs) ∪ T (vs+1) ∪ ··· ∪ T (vr). A cluster with top boundary node v is a connected component of the form T (v, vs, vr), 1 ≤ s ≤ r ≤ k. A cluster with top boundary node v and bottom boundary node u is a connected component of the form T (v, vs, vr) \ F (u), 1 ≤ s ≤ r ≤ k, where u is a node in T (vs) ∪ ··· ∪ T (vr). We denote the top boundary node of a cluster C by top(C). Clusters can therefore have either one or two boundary nodes. For example, let p(v) denote the parent of v then a single edge (v, p(v)) of T is a cluster where p(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. Nodes that are not boundary nodes are called internal nodes. The path between the top and bottom boundary nodes in a cluster C is called the cluster's spine, and the string obtained by concatenating the labels on the spine from top to bottom is denoted spine(C). Two edge disjoint clusters A and B whose vertices overlap on a single boundary node can be merged if their union C = A∪ B is also a cluster. There are five ways of merging clusters (see Figure 1). Merges of type (a) and (b) are called vertical merges (C is then a vertical cluster) and can be done only if the 4 Figure 1: Five ways of merging clusters. The • nodes are boundary nodes that remain boundary nodes in the merged cluster. The ◦ nodes are boundary nodes that become internal (non-boundary) nodes in the merged cluster. Note that in the last four merges at least one of the merged clusters has a top boundary node but no bottom boundary node. common boundary node is not a boundary node of any other cluster except A and B. Merges of type (c),(d), and (e) are called horizontal merges (C is then a horizontal cluster) and can be done only if at least one of A or B does not have a bottom boundary node. 2.3 Top Trees A top tree T of T is a hierarchical decomposition of T into clusters. It is an ordered, rooted, labeled, and binary tree defined as follows (see Figure 2(a)-(c)). • The nodes of T correspond to clusters of T . • The root of T corresponds to the cluster T itself. The top boundary node of the root of T is the root of T . • The leaves of T correspond to the edges of T . The label of each leaf is the label of the corresponding edge (u, v) in T . • Each internal node of T corresponds to the merged cluster of its two children. The label of each internal node is the type of merge it represents (out of the five merging options). The children are ordered so that the left child is the child cluster visited first in a preorder traversal of T . Lemma 2 (Alstrup et al. [3]) Given a tree T of size nT , we can construct in O(nT ) time a top tree T of T that is of size O(nT ) and height O(log nT ). 2.4 Top Dags Every labeled tree can be represented with a directed acyclic graph (DAG) by identifying identical rooted subtrees and replacing them with a single copy. The top DAG of T , denoted TD, is the minimal DAG representation of the top tree T of T . We can compute it in O(nT ) time from T [28]1. Top DAGs have important properties for compression and computation [16, 19, 29, 39]. We need the following optimal worst-case compression bound. Lemma 3 (Dudek and Gawrychowski [29]) Given an ordered tree with nT nodes over an alphabet of size σ, we can construct a top DAG TD in O(nT ) time of size nTD = O(nT / logσ nT ). 3 A Simple Index We first present a simple randomized Monte-Carlo word RAM string index, that will be the starting point for our deterministic, comparison-based pointer machine solution in the later sections. 1Here we use edge labels instead of nodes label. The two definitions are equivalent and edge labels are more natural for tries. 5 (a)(b)(c)(e)(d) Figure 2: (a) A trie. Each edge label has a subscript to identify the corresponding leaf in the top tree in (c). (b) A hierarchical clustering of (a). (c) The top tree corresponding to (a). Blue nodes are vertical clusters and red nodes are horizontal clusters. (d) The top DAG of (c). 3.1 Data Structure Let T be the trie of the strings S = S1, . . . , Sk and let TD be the corresponding top DAG of T . Our data structure augments TD with additional information. For each cluster C in TD we store the following information. • If C is a leaf cluster representing an edge e, we store the label of e. • If C is an internal cluster with left and right child A and B, we store the label of the edge to the rightmost child of the top boundary node, the fingerprint φ(spine(C)), and the length spine(C). This requires constant space for each cluster and hence O(nTD) space in total. 3.2 Searching Given a pattern P of length m, we denote the unique node in T whose path from the root matches the longest prefix of P , the Given a pattern P of length m we find the longest matching prefix of P in T , i.e., the unique node locusT (P ) in T whose path from the root matches the longest prefix of P , as follows. First, compute and store all fingerprints of prefixes of P in O(m) time and space. By Lemma 1, we can then compute the fingerprint of any substring of P in O(1) time. Next, we traverse TD top-down while matching P . Initially, we search for P [1, m] starting at the root of TD. Suppose we have reached cluster C and have matched P [1, i]. If i = m we return m. Otherwise (i < m) there are three cases: Case 1: C is a leaf cluster. Let e be the edge stored in C. We compare P [i + 1] with the label of e. We return i + 1 if they match and otherwise i. Case 2: C is a horizontal cluster. Let A and B be the left and right child of C, respectively. We compare P [i + 1] with the label α of the edge to the rightmost child of A. If P [i + 1] ≤ α, we continue the search in A for P [i+1 . . . m]. Otherwise, we continue the search in B for P [i+1 . . . m]. Case 3: C is vertical cluster. Let A and B be the left and right child of C, respectively. If spine(A) > m − i we continue the search in A for P [i + 1 . . . m]. Otherwise, we compare the fingerprint 6 (c)<latexit sha1_base64="vZCAZ+pJxKG9QblqDBepXZNFbU8=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q7HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4bhjTw=</latexit><latexit sha1_base64="vZCAZ+pJxKG9QblqDBepXZNFbU8=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q7HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4bhjTw=</latexit><latexit sha1_base64="vZCAZ+pJxKG9QblqDBepXZNFbU8=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q7HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4bhjTw=</latexit><latexit sha1_base64="vZCAZ+pJxKG9QblqDBepXZNFbU8=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q7HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4bhjTw=</latexit>(d)<latexit sha1_base64="kAB7LveGU8jfRCmkTCpxS3KP4ew=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbDbt0s0m7E6EUvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78wapFAZd99spbGxube8Ud0t7+weHR+Xjk7ZJMs14iyUy0d2AGi6F4i0UKHk31ZzGgeSdYHw7r3eeuDYiUY84Sbkf06ESkWAUrfVQDS8H5Ypbcxci6+DlUIFczUH5qx8mLIu5QiapMT3PTdGfUo2CST4r9TPDU8rGdMh7FhWNufGni1Vn5MI6IYkSbZ9CsnB/T0xpbMwkDmxnTHFkVmtz879aL8Poxp8KlWbIFVt+FGWSYELmd5NQaM5QTixQpoXdlbAR1ZShTadkQ/BWT16Hdr3mWb6vVxpXeRxFOINzqIIH19CAO2hCCxgM4Rle4c2Rzovz7nwsWwtOPnMKf+R8/gCIZo09</latexit><latexit sha1_base64="kAB7LveGU8jfRCmkTCpxS3KP4ew=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbDbt0s0m7E6EUvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78wapFAZd99spbGxube8Ud0t7+weHR+Xjk7ZJMs14iyUy0d2AGi6F4i0UKHk31ZzGgeSdYHw7r3eeuDYiUY84Sbkf06ESkWAUrfVQDS8H5Ypbcxci6+DlUIFczUH5qx8mLIu5QiapMT3PTdGfUo2CST4r9TPDU8rGdMh7FhWNufGni1Vn5MI6IYkSbZ9CsnB/T0xpbMwkDmxnTHFkVmtz879aL8Poxp8KlWbIFVt+FGWSYELmd5NQaM5QTixQpoXdlbAR1ZShTadkQ/BWT16Hdr3mWb6vVxpXeRxFOINzqIIH19CAO2hCCxgM4Rle4c2Rzovz7nwsWwtOPnMKf+R8/gCIZo09</latexit><latexit sha1_base64="kAB7LveGU8jfRCmkTCpxS3KP4ew=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbDbt0s0m7E6EUvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78wapFAZd99spbGxube8Ud0t7+weHR+Xjk7ZJMs14iyUy0d2AGi6F4i0UKHk31ZzGgeSdYHw7r3eeuDYiUY84Sbkf06ESkWAUrfVQDS8H5Ypbcxci6+DlUIFczUH5qx8mLIu5QiapMT3PTdGfUo2CST4r9TPDU8rGdMh7FhWNufGni1Vn5MI6IYkSbZ9CsnB/T0xpbMwkDmxnTHFkVmtz879aL8Poxp8KlWbIFVt+FGWSYELmd5NQaM5QTixQpoXdlbAR1ZShTadkQ/BWT16Hdr3mWb6vVxpXeRxFOINzqIIH19CAO2hCCxgM4Rle4c2Rzovz7nwsWwtOPnMKf+R8/gCIZo09</latexit><latexit sha1_base64="kAB7LveGU8jfRCmkTCpxS3KP4ew=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbDbt0s0m7E6EUvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78wapFAZd99spbGxube8Ud0t7+weHR+Xjk7ZJMs14iyUy0d2AGi6F4i0UKHk31ZzGgeSdYHw7r3eeuDYiUY84Sbkf06ESkWAUrfVQDS8H5Ypbcxci6+DlUIFczUH5qx8mLIu5QiapMT3PTdGfUo2CST4r9TPDU8rGdMh7FhWNufGni1Vn5MI6IYkSbZ9CsnB/T0xpbMwkDmxnTHFkVmtz879aL8Poxp8KlWbIFVt+FGWSYELmd5NQaM5QTixQpoXdlbAR1ZShTadkQ/BWT16Hdr3mWb6vVxpXeRxFOINzqIIH19CAO2hCCxgM4Rle4c2Rzovz7nwsWwtOPnMKf+R8/gCIZo09</latexit>(b)<latexit sha1_base64="/IZxkdWWXhp/Wt2hgTFqXWy1ERc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6qweWgXHFr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du17zLN/XK42rPI4inME5VMGDa2jAHTShBQxG8Ayv8OYI58V5dz6WrQUnnzmFP3I+fwCFXI07</latexit><latexit sha1_base64="/IZxkdWWXhp/Wt2hgTFqXWy1ERc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6qweWgXHFr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du17zLN/XK42rPI4inME5VMGDa2jAHTShBQxG8Ayv8OYI58V5dz6WrQUnnzmFP3I+fwCFXI07</latexit><latexit sha1_base64="/IZxkdWWXhp/Wt2hgTFqXWy1ERc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6qweWgXHFr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du17zLN/XK42rPI4inME5VMGDa2jAHTShBQxG8Ayv8OYI58V5dz6WrQUnnzmFP3I+fwCFXI07</latexit><latexit sha1_base64="/IZxkdWWXhp/Wt2hgTFqXWy1ERc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6qweWgXHFr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du17zLN/XK42rPI4inME5VMGDa2jAHTShBQxG8Ayv8OYI58V5dz6WrQUnnzmFP3I+fwCFXI07</latexit>a1<latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit>b2<latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit><latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit><latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit><latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit>b3<latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit><latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit><latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit><latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit>a4<latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit><latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit><latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit><latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit>C1<latexit sha1_base64="7wGcRf7xMLiGxl4WEC2EdQ7oDbA=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfm0BuWK27VXYpsgpdDBXK1huWvwShmaYTSMEG17ntuYvyMKsOZwHlpkGpMKJvSMfYtShqh9rPlqnNyZZ0RCWNlnzRk6f6eyGik9SwKbGdEzUSv1xbmf7V+asJbP+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/CgDg24gxa0gcEYnuEV3hzhvDjvzseqteDkM+fwR87nD7YVjVs=</latexit><latexit sha1_base64="7wGcRf7xMLiGxl4WEC2EdQ7oDbA=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfm0BuWK27VXYpsgpdDBXK1huWvwShmaYTSMEG17ntuYvyMKsOZwHlpkGpMKJvSMfYtShqh9rPlqnNyZZ0RCWNlnzRk6f6eyGik9SwKbGdEzUSv1xbmf7V+asJbP+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/CgDg24gxa0gcEYnuEV3hzhvDjvzseqteDkM+fwR87nD7YVjVs=</latexit><latexit sha1_base64="7wGcRf7xMLiGxl4WEC2EdQ7oDbA=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfm0BuWK27VXYpsgpdDBXK1huWvwShmaYTSMEG17ntuYvyMKsOZwHlpkGpMKJvSMfYtShqh9rPlqnNyZZ0RCWNlnzRk6f6eyGik9SwKbGdEzUSv1xbmf7V+asJbP+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/CgDg24gxa0gcEYnuEV3hzhvDjvzseqteDkM+fwR87nD7YVjVs=</latexit><latexit sha1_base64="7wGcRf7xMLiGxl4WEC2EdQ7oDbA=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfm0BuWK27VXYpsgpdDBXK1huWvwShmaYTSMEG17ntuYvyMKsOZwHlpkGpMKJvSMfYtShqh9rPlqnNyZZ0RCWNlnzRk6f6eyGik9SwKbGdEzUSv1xbmf7V+asJbP+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/CgDg24gxa0gcEYnuEV3hzhvDjvzseqteDkM+fwR87nD7YVjVs=</latexit>C2<latexit sha1_base64="Necvnzo0t6tocaWtP8CYjXG/Gow=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h7VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7eZjVw=</latexit><latexit sha1_base64="Necvnzo0t6tocaWtP8CYjXG/Gow=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h7VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7eZjVw=</latexit><latexit sha1_base64="Necvnzo0t6tocaWtP8CYjXG/Gow=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h7VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7eZjVw=</latexit><latexit sha1_base64="Necvnzo0t6tocaWtP8CYjXG/Gow=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h7VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7eZjVw=</latexit>a5<latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit>C3<latexit sha1_base64="XwT7vC7eXZ/Tb64lpwGk8KW5ses=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSKuix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcDUoV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/fXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7kdjV0=</latexit><latexit sha1_base64="XwT7vC7eXZ/Tb64lpwGk8KW5ses=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSKuix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcDUoV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/fXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7kdjV0=</latexit><latexit sha1_base64="XwT7vC7eXZ/Tb64lpwGk8KW5ses=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSKuix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcDUoV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/fXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7kdjV0=</latexit><latexit sha1_base64="XwT7vC7eXZ/Tb64lpwGk8KW5ses=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSKuix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcDUoV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/fXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7kdjV0=</latexit>b6<latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit><latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit><latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit><latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit>C6<latexit sha1_base64="8yQs+h/XD++aSSbSAlDxEGKpC30=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuqx0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP72pjWA=</latexit><latexit sha1_base64="8yQs+h/XD++aSSbSAlDxEGKpC30=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuqx0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP72pjWA=</latexit><latexit sha1_base64="8yQs+h/XD++aSSbSAlDxEGKpC30=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuqx0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP72pjWA=</latexit><latexit sha1_base64="8yQs+h/XD++aSSbSAlDxEGKpC30=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuqx0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP72pjWA=</latexit>a7<latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit><latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit><latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit><latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit>b8<latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit><latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit><latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit><latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit>c9<latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit><latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit><latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit><latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit>d10<latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit><latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit><latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit><latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit>C4<latexit sha1_base64="ib2s5QkdFTkLZd/tcMNa4hS3Qws=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUtBjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h/VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/f1SqOWx1GEC7iEa/DgBhpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7qhjV4=</latexit><latexit sha1_base64="ib2s5QkdFTkLZd/tcMNa4hS3Qws=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUtBjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h/VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/f1SqOWx1GEC7iEa/DgBhpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7qhjV4=</latexit><latexit sha1_base64="ib2s5QkdFTkLZd/tcMNa4hS3Qws=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUtBjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h/VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/f1SqOWx1GEC7iEa/DgBhpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7qhjV4=</latexit><latexit sha1_base64="ib2s5QkdFTkLZd/tcMNa4hS3Qws=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUtBjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h/VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/f1SqOWx1GEC7iEa/DgBhpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7qhjV4=</latexit>C5<latexit sha1_base64="AoHTY7aRaGxagUwbpC0aOrzj5wE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSouix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7wljV8=</latexit><latexit sha1_base64="AoHTY7aRaGxagUwbpC0aOrzj5wE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSouix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7wljV8=</latexit><latexit sha1_base64="AoHTY7aRaGxagUwbpC0aOrzj5wE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSouix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7wljV8=</latexit><latexit sha1_base64="AoHTY7aRaGxagUwbpC0aOrzj5wE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSouix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7wljV8=</latexit>C7<latexit sha1_base64="rlDSomXhWQhP5z+evNJdnyzIQXc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IS3fsZlkhqUbPVRmApiYrK4m4y4QmbEzAJlittdCZtQRZmx6ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH78tjWE=</latexit><latexit sha1_base64="rlDSomXhWQhP5z+evNJdnyzIQXc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IS3fsZlkhqUbPVRmApiYrK4m4y4QmbEzAJlittdCZtQRZmx6ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH78tjWE=</latexit><latexit sha1_base64="rlDSomXhWQhP5z+evNJdnyzIQXc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IS3fsZlkhqUbPVRmApiYrK4m4y4QmbEzAJlittdCZtQRZmx6ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH78tjWE=</latexit><latexit sha1_base64="rlDSomXhWQhP5z+evNJdnyzIQXc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IS3fsZlkhqUbPVRmApiYrK4m4y4QmbEzAJlittdCZtQRZmx6ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH78tjWE=</latexit>C8<latexit sha1_base64="ssgYBNEh9qYTHDg3FpsA1oK0234=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIthjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IR1P+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/DgFhpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH8CxjWI=</latexit><latexit sha1_base64="ssgYBNEh9qYTHDg3FpsA1oK0234=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIthjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IR1P+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/DgFhpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH8CxjWI=</latexit><latexit sha1_base64="ssgYBNEh9qYTHDg3FpsA1oK0234=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIthjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IR1P+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/DgFhpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH8CxjWI=</latexit><latexit sha1_base64="ssgYBNEh9qYTHDg3FpsA1oK0234=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIthjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IR1P+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/DgFhpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH8CxjWI=</latexit>C9<latexit sha1_base64="qPbjZAl6Pdu29jKiQAs2eZKY50s=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIqi3Qi8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTBrzeucJleaxfDTTBP2IjiQPOaPGWg+Nwe2gXHGr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du1b1LN9fVeq1PI4inME5XIIH11CHO2hCCxiM4Ble4c0Rzovz7nwsWwtOPnMKf+R8/gDCNY1j</latexit><latexit sha1_base64="qPbjZAl6Pdu29jKiQAs2eZKY50s=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIqi3Qi8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTBrzeucJleaxfDTTBP2IjiQPOaPGWg+Nwe2gXHGr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du1b1LN9fVeq1PI4inME5XIIH11CHO2hCCxiM4Ble4c0Rzovz7nwsWwtOPnMKf+R8/gDCNY1j</latexit><latexit sha1_base64="qPbjZAl6Pdu29jKiQAs2eZKY50s=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIqi3Qi8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTBrzeucJleaxfDTTBP2IjiQPOaPGWg+Nwe2gXHGr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du1b1LN9fVeq1PI4inME5XIIH11CHO2hCCxiM4Ble4c0Rzovz7nwsWwtOPnMKf+R8/gDCNY1j</latexit><latexit sha1_base64="qPbjZAl6Pdu29jKiQAs2eZKY50s=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIqi3Qi8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTBrzeucJleaxfDTTBP2IjiQPOaPGWg+Nwe2gXHGr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du1b1LN9fVeq1PI4inME5XIIH11CHO2hCCxiM4Ble4c0Rzovz7nwsWwtOPnMKf+R8/gDCNY1j</latexit>(a)<latexit sha1_base64="RaKubww8bHA7bv0Y71M1/0w+EPc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q9HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4PXjTo=</latexit><latexit sha1_base64="RaKubww8bHA7bv0Y71M1/0w+EPc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q9HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4PXjTo=</latexit><latexit sha1_base64="RaKubww8bHA7bv0Y71M1/0w+EPc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q9HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4PXjTo=</latexit><latexit sha1_base64="RaKubww8bHA7bv0Y71M1/0w+EPc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q9HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4PXjTo=</latexit>a1<latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit>b2<latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit><latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit><latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit><latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit>b3<latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit><latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit><latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit><latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit>a4<latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit><latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit><latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit><latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit>a5<latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit>b6<latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit><latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit><latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit><latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit>a7<latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit><latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit><latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit><latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit>b8<latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit><latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit><latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit><latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit>c9<latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit><latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit><latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit><latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit>d10<latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit><latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit><latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit><latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit>a1<latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit>b2<latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit><latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit><latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit><latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit>b3<latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit><latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit><latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit><latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit>a4<latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit><latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit><latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit><latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit>a5<latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit>b6<latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit><latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit><latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit><latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit>a7<latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit><latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit><latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit><latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit>b8<latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit><latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit><latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit><latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit>c9<latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit><latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit><latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit><latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit>d10<latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit><latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit><latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit><latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit>C1<latexit sha1_base64="7wGcRf7xMLiGxl4WEC2EdQ7oDbA=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfm0BuWK27VXYpsgpdDBXK1huWvwShmaYTSMEG17ntuYvyMKsOZwHlpkGpMKJvSMfYtShqh9rPlqnNyZZ0RCWNlnzRk6f6eyGik9SwKbGdEzUSv1xbmf7V+asJbP+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/CgDg24gxa0gcEYnuEV3hzhvDjvzseqteDkM+fwR87nD7YVjVs=</latexit><latexit sha1_base64="7wGcRf7xMLiGxl4WEC2EdQ7oDbA=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfm0BuWK27VXYpsgpdDBXK1huWvwShmaYTSMEG17ntuYvyMKsOZwHlpkGpMKJvSMfYtShqh9rPlqnNyZZ0RCWNlnzRk6f6eyGik9SwKbGdEzUSv1xbmf7V+asJbP+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/CgDg24gxa0gcEYnuEV3hzhvDjvzseqteDkM+fwR87nD7YVjVs=</latexit><latexit sha1_base64="7wGcRf7xMLiGxl4WEC2EdQ7oDbA=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfm0BuWK27VXYpsgpdDBXK1huWvwShmaYTSMEG17ntuYvyMKsOZwHlpkGpMKJvSMfYtShqh9rPlqnNyZZ0RCWNlnzRk6f6eyGik9SwKbGdEzUSv1xbmf7V+asJbP+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/CgDg24gxa0gcEYnuEV3hzhvDjvzseqteDkM+fwR87nD7YVjVs=</latexit><latexit sha1_base64="7wGcRf7xMLiGxl4WEC2EdQ7oDbA=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfm0BuWK27VXYpsgpdDBXK1huWvwShmaYTSMEG17ntuYvyMKsOZwHlpkGpMKJvSMfYtShqh9rPlqnNyZZ0RCWNlnzRk6f6eyGik9SwKbGdEzUSv1xbmf7V+asJbP+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/CgDg24gxa0gcEYnuEV3hzhvDjvzseqteDkM+fwR87nD7YVjVs=</latexit>C2<latexit sha1_base64="Necvnzo0t6tocaWtP8CYjXG/Gow=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h7VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7eZjVw=</latexit><latexit sha1_base64="Necvnzo0t6tocaWtP8CYjXG/Gow=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h7VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7eZjVw=</latexit><latexit sha1_base64="Necvnzo0t6tocaWtP8CYjXG/Gow=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h7VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7eZjVw=</latexit><latexit sha1_base64="Necvnzo0t6tocaWtP8CYjXG/Gow=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h7VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7eZjVw=</latexit>C3<latexit sha1_base64="XwT7vC7eXZ/Tb64lpwGk8KW5ses=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSKuix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcDUoV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/fXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7kdjV0=</latexit><latexit sha1_base64="XwT7vC7eXZ/Tb64lpwGk8KW5ses=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSKuix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcDUoV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/fXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7kdjV0=</latexit><latexit sha1_base64="XwT7vC7eXZ/Tb64lpwGk8KW5ses=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSKuix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcDUoV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/fXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7kdjV0=</latexit><latexit sha1_base64="XwT7vC7eXZ/Tb64lpwGk8KW5ses=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSKuix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcDUoV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/fXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7kdjV0=</latexit>C4<latexit sha1_base64="ib2s5QkdFTkLZd/tcMNa4hS3Qws=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUtBjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h/VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/f1SqOWx1GEC7iEa/DgBhpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7qhjV4=</latexit><latexit sha1_base64="ib2s5QkdFTkLZd/tcMNa4hS3Qws=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUtBjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h/VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/f1SqOWx1GEC7iEa/DgBhpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7qhjV4=</latexit><latexit sha1_base64="ib2s5QkdFTkLZd/tcMNa4hS3Qws=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUtBjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h/VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/f1SqOWx1GEC7iEa/DgBhpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7qhjV4=</latexit><latexit sha1_base64="ib2s5QkdFTkLZd/tcMNa4hS3Qws=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUtBjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h/VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/f1SqOWx1GEC7iEa/DgBhpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7qhjV4=</latexit>C5<latexit sha1_base64="AoHTY7aRaGxagUwbpC0aOrzj5wE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSouix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7wljV8=</latexit><latexit sha1_base64="AoHTY7aRaGxagUwbpC0aOrzj5wE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSouix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7wljV8=</latexit><latexit sha1_base64="AoHTY7aRaGxagUwbpC0aOrzj5wE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSouix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7wljV8=</latexit><latexit sha1_base64="AoHTY7aRaGxagUwbpC0aOrzj5wE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSouix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7wljV8=</latexit>C6<latexit sha1_base64="8yQs+h/XD++aSSbSAlDxEGKpC30=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuqx0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP72pjWA=</latexit><latexit sha1_base64="8yQs+h/XD++aSSbSAlDxEGKpC30=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuqx0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP72pjWA=</latexit><latexit sha1_base64="8yQs+h/XD++aSSbSAlDxEGKpC30=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuqx0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP72pjWA=</latexit><latexit sha1_base64="8yQs+h/XD++aSSbSAlDxEGKpC30=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuqx0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP72pjWA=</latexit>C7<latexit sha1_base64="rlDSomXhWQhP5z+evNJdnyzIQXc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IS3fsZlkhqUbPVRmApiYrK4m4y4QmbEzAJlittdCZtQRZmx6ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH78tjWE=</latexit><latexit sha1_base64="rlDSomXhWQhP5z+evNJdnyzIQXc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IS3fsZlkhqUbPVRmApiYrK4m4y4QmbEzAJlittdCZtQRZmx6ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH78tjWE=</latexit><latexit sha1_base64="rlDSomXhWQhP5z+evNJdnyzIQXc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IS3fsZlkhqUbPVRmApiYrK4m4y4QmbEzAJlittdCZtQRZmx6ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH78tjWE=</latexit><latexit sha1_base64="rlDSomXhWQhP5z+evNJdnyzIQXc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IS3fsZlkhqUbPVRmApiYrK4m4y4QmbEzAJlittdCZtQRZmx6ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH78tjWE=</latexit>C8<latexit sha1_base64="ssgYBNEh9qYTHDg3FpsA1oK0234=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIthjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IR1P+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/DgFhpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH8CxjWI=</latexit><latexit sha1_base64="ssgYBNEh9qYTHDg3FpsA1oK0234=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIthjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IR1P+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/DgFhpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH8CxjWI=</latexit><latexit sha1_base64="ssgYBNEh9qYTHDg3FpsA1oK0234=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIthjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IR1P+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/DgFhpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH8CxjWI=</latexit><latexit sha1_base64="ssgYBNEh9qYTHDg3FpsA1oK0234=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIthjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IR1P+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/DgFhpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH8CxjWI=</latexit>C9<latexit sha1_base64="qPbjZAl6Pdu29jKiQAs2eZKY50s=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIqi3Qi8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTBrzeucJleaxfDTTBP2IjiQPOaPGWg+Nwe2gXHGr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du1b1LN9fVeq1PI4inME5XIIH11CHO2hCCxiM4Ble4c0Rzovz7nwsWwtOPnMKf+R8/gDCNY1j</latexit><latexit sha1_base64="qPbjZAl6Pdu29jKiQAs2eZKY50s=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIqi3Qi8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTBrzeucJleaxfDTTBP2IjiQPOaPGWg+Nwe2gXHGr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du1b1LN9fVeq1PI4inME5XIIH11CHO2hCCxiM4Ble4c0Rzovz7nwsWwtOPnMKf+R8/gDCNY1j</latexit><latexit sha1_base64="qPbjZAl6Pdu29jKiQAs2eZKY50s=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIqi3Qi8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTBrzeucJleaxfDTTBP2IjiQPOaPGWg+Nwe2gXHGr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du1b1LN9fVeq1PI4inME5XIIH11CHO2hCCxiM4Ble4c0Rzovz7nwsWwtOPnMKf+R8/gDCNY1j</latexit><latexit sha1_base64="qPbjZAl6Pdu29jKiQAs2eZKY50s=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIqi3Qi8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTBrzeucJleaxfDTTBP2IjiQPOaPGWg+Nwe2gXHGr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du1b1LN9fVeq1PI4inME5XIIH11CHO2hCCxiM4Ble4c0Rzovz7nwsWwtOPnMKf+R8/gDCNY1j</latexit>a<latexit sha1_base64="xCYow5BVFq3CiJo01XnPJUWogoA=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi06LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w++j4zV</latexit><latexit sha1_base64="xCYow5BVFq3CiJo01XnPJUWogoA=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi06LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w++j4zV</latexit><latexit sha1_base64="xCYow5BVFq3CiJo01XnPJUWogoA=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi06LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w++j4zV</latexit><latexit sha1_base64="xCYow5BVFq3CiJo01XnPJUWogoA=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi06LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w++j4zV</latexit>b<latexit sha1_base64="OV7Ydi5Qr7HqyJux9Lw5aK1l+Nk=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWq1gWK64VXcpsgleDhXI1RyWvwajmKURSsME1brvuYnxM6oMZwLnpUGqMaFsSsfYtyhphNrPlovOyZV1RiSMlX3SkKX7eyKjkdazKLCdETUTvV5bmP/V+qkJb/2MyyQ1KNnqozAVxMRkcTUZcYXMiJkFyhS3uxI2oYoyY7Mp2RC89ZM3oVOrepZbN5VGLY+jCBdwCdfgQR0acA9NaAMDhGd4hTfn0Xlx3p2PVWvByWfO4Y+czx/AE4zW</latexit><latexit sha1_base64="OV7Ydi5Qr7HqyJux9Lw5aK1l+Nk=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWq1gWK64VXcpsgleDhXI1RyWvwajmKURSsME1brvuYnxM6oMZwLnpUGqMaFsSsfYtyhphNrPlovOyZV1RiSMlX3SkKX7eyKjkdazKLCdETUTvV5bmP/V+qkJb/2MyyQ1KNnqozAVxMRkcTUZcYXMiJkFyhS3uxI2oYoyY7Mp2RC89ZM3oVOrepZbN5VGLY+jCBdwCdfgQR0acA9NaAMDhGd4hTfn0Xlx3p2PVWvByWfO4Y+czx/AE4zW</latexit><latexit sha1_base64="OV7Ydi5Qr7HqyJux9Lw5aK1l+Nk=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWq1gWK64VXcpsgleDhXI1RyWvwajmKURSsME1brvuYnxM6oMZwLnpUGqMaFsSsfYtyhphNrPlovOyZV1RiSMlX3SkKX7eyKjkdazKLCdETUTvV5bmP/V+qkJb/2MyyQ1KNnqozAVxMRkcTUZcYXMiJkFyhS3uxI2oYoyY7Mp2RC89ZM3oVOrepZbN5VGLY+jCBdwCdfgQR0acA9NaAMDhGd4hTfn0Xlx3p2PVWvByWfO4Y+czx/AE4zW</latexit><latexit sha1_base64="OV7Ydi5Qr7HqyJux9Lw5aK1l+Nk=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWq1gWK64VXcpsgleDhXI1RyWvwajmKURSsME1brvuYnxM6oMZwLnpUGqMaFsSsfYtyhphNrPlovOyZV1RiSMlX3SkKX7eyKjkdazKLCdETUTvV5bmP/V+qkJb/2MyyQ1KNnqozAVxMRkcTUZcYXMiJkFyhS3uxI2oYoyY7Mp2RC89ZM3oVOrepZbN5VGLY+jCBdwCdfgQR0acA9NaAMDhGd4hTfn0Xlx3p2PVWvByWfO4Y+czx/AE4zW</latexit>c<latexit sha1_base64="kD4Sw6elG9W7UxMK/BVw5G+hwL8=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi02LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w/Bl4zX</latexit><latexit sha1_base64="kD4Sw6elG9W7UxMK/BVw5G+hwL8=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi02LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w/Bl4zX</latexit><latexit sha1_base64="kD4Sw6elG9W7UxMK/BVw5G+hwL8=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi02LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w/Bl4zX</latexit><latexit sha1_base64="kD4Sw6elG9W7UxMK/BVw5G+hwL8=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi02LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w/Bl4zX</latexit>d<latexit sha1_base64="LMRKkiGgSyIHGwBU+V8UchHv94g=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjC7YV2lA2m0m7drMJuxuhhP4CLx4U8epP8ua/cdvmoK0vLDy8M8POvEEquDau++2UNja3tnfKu5W9/YPDo+rxSVcnmWLYYYlI1ENANQousWO4EfiQKqRxILAXTG7n9d4TKs0TeW+mKfoxHUkecUaNtdrhsFpz6+5CZB28AmpQqDWsfg3ChGUxSsME1brvuanxc6oMZwJnlUGmMaVsQkfYtyhpjNrPF4vOyIV1QhIlyj5pyML9PZHTWOtpHNjOmJqxXq3Nzf9q/cxEN37OZZoZlGz5UZQJYhIyv5qEXCEzYmqBMsXtroSNqaLM2GwqNgRv9eR16DbqnuX2Va3ZKOIowxmcwyV4cA1NuIMWdIABwjO8wpvz6Lw4787HsrXkFDOn8EfO5w/DG4zY</latexit><latexit sha1_base64="LMRKkiGgSyIHGwBU+V8UchHv94g=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjC7YV2lA2m0m7drMJuxuhhP4CLx4U8epP8ua/cdvmoK0vLDy8M8POvEEquDau++2UNja3tnfKu5W9/YPDo+rxSVcnmWLYYYlI1ENANQousWO4EfiQKqRxILAXTG7n9d4TKs0TeW+mKfoxHUkecUaNtdrhsFpz6+5CZB28AmpQqDWsfg3ChGUxSsME1brvuanxc6oMZwJnlUGmMaVsQkfYtyhpjNrPF4vOyIV1QhIlyj5pyML9PZHTWOtpHNjOmJqxXq3Nzf9q/cxEN37OZZoZlGz5UZQJYhIyv5qEXCEzYmqBMsXtroSNqaLM2GwqNgRv9eR16DbqnuX2Va3ZKOIowxmcwyV4cA1NuIMWdIABwjO8wpvz6Lw4787HsrXkFDOn8EfO5w/DG4zY</latexit><latexit sha1_base64="LMRKkiGgSyIHGwBU+V8UchHv94g=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjC7YV2lA2m0m7drMJuxuhhP4CLx4U8epP8ua/cdvmoK0vLDy8M8POvEEquDau++2UNja3tnfKu5W9/YPDo+rxSVcnmWLYYYlI1ENANQousWO4EfiQKqRxILAXTG7n9d4TKs0TeW+mKfoxHUkecUaNtdrhsFpz6+5CZB28AmpQqDWsfg3ChGUxSsME1brvuanxc6oMZwJnlUGmMaVsQkfYtyhpjNrPF4vOyIV1QhIlyj5pyML9PZHTWOtpHNjOmJqxXq3Nzf9q/cxEN37OZZoZlGz5UZQJYhIyv5qEXCEzYmqBMsXtroSNqaLM2GwqNgRv9eR16DbqnuX2Va3ZKOIowxmcwyV4cA1NuIMWdIABwjO8wpvz6Lw4787HsrXkFDOn8EfO5w/DG4zY</latexit><latexit sha1_base64="LMRKkiGgSyIHGwBU+V8UchHv94g=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjC7YV2lA2m0m7drMJuxuhhP4CLx4U8epP8ua/cdvmoK0vLDy8M8POvEEquDau++2UNja3tnfKu5W9/YPDo+rxSVcnmWLYYYlI1ENANQousWO4EfiQKqRxILAXTG7n9d4TKs0TeW+mKfoxHUkecUaNtdrhsFpz6+5CZB28AmpQqDWsfg3ChGUxSsME1brvuanxc6oMZwJnlUGmMaVsQkfYtyhpjNrPF4vOyIV1QhIlyj5pyML9PZHTWOtpHNjOmJqxXq3Nzf9q/cxEN37OZZoZlGz5UZQJYhIyv5qEXCEzYmqBMsXtroSNqaLM2GwqNgRv9eR16DbqnuX2Va3ZKOIowxmcwyV4cA1NuIMWdIABwjO8wpvz6Lw4787HsrXkFDOn8EfO5w/DG4zY</latexit> φ(spine(A)) with φ(P [i + 1 . . . i + 1 + spine(A)]). If they match, we continue the search in B for P [i + 1 + spine(A) . . . m]. Otherwise, we continue the search in A for P [i + 1 . . . m]. Lemma 4 The algorithm correctly computes the longest matching prefix of P in T . Proof. We show by induction that at cluster C the prefix P [1, i] matches the path from the root of T to top(C) and locusT (P ) ∈ C. If C is the root of TD the empty path to top(C) matches the empty prefix and locusT (P ) ∈ C = T . Inductively, suppose P [1, i] matches the path from the root to top(C) and locusT (P ) ∈ C. If m = i the longest prefix is thus P [1, m] and locusT (P ) = top(C). In each case, the algorithm maintains the invariant. The algorithm greedily matches as many characters from P as possible, and hence at the end of the traversal the algorithm has found the longest matching prefix of P . Next consider the running time. We compute all fingerprints of P in O(m) time. Each step of top- down traversal requires constant time and since the depth of TD is O(log n) the total time is O(m+log n). In summary, we have the following theorem. Theorem 3 Let S = S1, . . . , Sk be a set of strings of total length n, and let TD be the corresponding top DAG for the trie of S. On a word RAM model of computation, we can solve the compressed string indexing problem in O(nTD) = O(n/ logσ n) space and O(m + log n) time for any pattern of length m. The solution is randomized Monte-Carlo. In the next sections we show how to convert the above algorithm from a randomized algorithm on a word RAM machine into a deterministic algorithm on a pointer machine. We note that Theorem 3 and our subsequent solutions can be extended to other variants of prefix queries, such as counting queries, that return the number of occurrences of P . To do so, we store the size of each cluster in TD and use the above top-down search modified to also record the highest cluster E whose top boundary is locusT (P ). Since the size of E is the number of occurrences of P , we obtain a solution that also supports counting within the same complexities. From E we can also support reporting queries, that return the strings in S with prefix P , by simply decompressing E incurring additional linear time in the lengths of the strings with matching prefix. 4 Spine Extraction We first consider how to handle vertical clusters (Case 3) deterministically on a pointer machine. The key challenge is to efficiently extract the characters on the spine path of a vertical cluster from top to bottom without decompressing the whole cluster. We will use this to efficiently compute longest common prefixes between spine paths and substrings of P in order to achieve total O(m + log n) time. Given the top DAG TD, the spine path extraction problem is to compactly represent TD such that given any vertical cluster C we can return the characters of spine(C). We require that the characters are reported online and from top-to-bottom, that is, the characters must be reported in sequence and we can stop extraction at any point in time. The goal is to obtain a solution that is efficient in the length of the reported prefix. In the following sections we show how to solve the problem in O(nTD) space and O(m + log n) total time over all spine path extractions. We present a new data structure derived from the top DAG called the vertical top DAG and show how to use this to extract characters from a spine path. We then use this to compute the longest common prefixes between a spine path and any string and plug this in to the top down traversal in the simple solution from Section 3 to obtain Theorem 1. 4.1 Vertical Top Forest and Vertical Top DAG The vertical top forest V of T is a forest of ordered, rooted, and labeled binary trees. The nodes in V are all the vertical clusters of T and the leaf clusters of T that correspond to edges of a spine path of some cluster in T . The edges of V are defined as follows. A cluster C of type (a) with children A and B in T has two children in V. The left and right children are the unique vertical or leaf descendants of C in T whose spine path is spine(A) and spine(B), respectively. A cluster C of type (b) with children A and B in T has a single child in V, which is the unique vertical or leaf descendant of C in T whose spine path is spine(A). See Figure 3(a). We have the following correspondence between spine paths and subtrees in V. 7 Figure 3: (a) The vertical top forest of the top tree from Figure 2(c). (b) The vertical top DAG of (a). (c) The horizontal top forest of Figure 2(a). (d) The horizontal top DAG of (a). Lemma 5 Let C be a vertical merge in V and L be the leaves of V(C). Then, L are the edges on spine(C) and V(C) = O(L). Furthermore, the left-to-right ordering of L corresponds to the top-down ordering of the edges on spine(C). Proof. By definition of V and the ordering of children in T and V it follows that the edges on the spine in top-down order are the leaves L in left-to-right order. A cluster of type (b) in V(C) has a child that is either a leaf or a cluster of type (a). All clusters of type (a) have two children and hence V(C) = O(L). For instance in Figure 3(a), the descendant leaves of C6 are b3, a4, a5 in left-to-right ordering The vertical top DAG VD is the DAG obtained by merging identical subtrees of V according to the corresponding to the edges in the spine of C6 in Figure 2(b). DAG compression of TD. See Figure 3(b). 4.2 Spine Extraction We now show how to solve spine path extraction using the vertical top DAG VD. The key idea is to simulate a depth-first left-to-right order traversal of V(C) using a recursive traversal of VD. In order to use spine path extraction to search for a pattern we also need to be able to continue the search in some horizontal cluster of the top DAG after extracting characters on the spine. We will therefore define what we call a vertical exit cluster, from which we can quickly find the cluster to continue the search from. Define the vertical exit cluster, vexit(C, (cid:96)), for C at position (cid:96), 1 < (cid:96) ≤ spine(C) to be the lowest common ancestor of leaves (cid:96) − 1 and (cid:96) in V(C). Intuitively, if we have extracted the first (cid:96) characters of spine(C), then vexit(C, (cid:96)) is the cluster such that all leaves in the left subtree have been extracted and only one leaf in the right subtree (corresponding to the (cid:96)th character) has been extracted. Our goal is to implement spine path extraction in time O((cid:96) + height(C) − height(vexit(C, (cid:96)))). This will yield a telescoping sum when doing multiple extractions. Our data structure consists of the vertical top DAG VD. We augment each internal cluster by the label of the first edge on its spine path and each leaf cluster by the label of the stored edge. This uses O(nVD) space. Given a cluster C we implement spine path extraction by simulating a depth-first left-to-right order traversal of V(C) using a recursive traversal of VD. To extract the first character we return the stored label at C. Suppose we have extracted (cid:96)−1 characters, 1 < (cid:96) ≤ spine(C). To extract the next character continue the simulated depth-first search until we reach a cluster D in V(C) whose leftmost leaf is the (cid:96)th leaf of V(C). Return the character stored at D and the parent of D in V(C) as vexit(C, (cid:96)). (Note the parent of D is the cluster visited right before D in the simulated depth-first search.) By Lemma 5, the algorithm correctly solves spine path extraction and the total time to extract (cid:96) characters is O((cid:96) + height(C) − height(vexit(C, (cid:96)))). We need a stack to keep track of the current search path in the traversal using O(height(V(C))) = O(log nT ) = O(nTD) space. In summary, we have the following lemma. 8 a1<latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit>b3<latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit><latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit><latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit><latexit sha1_base64="iZgPCNJdoo2rVj13tFWXjtDhDiM=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSWtBjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg6tBueJW3YXIOng5VCBXc1D+6g9jlkZcIZPUmJ7nJuhnVKNgks9K/dTwhLIJHfGeRUUjbvxsseqMXFhnSMJY26eQLNzfExmNjJlGge2MKI7Nam1u/lfrpRje+JlQSYpcseVHYSoJxmR+NxkKzRnKqQXKtLC7EjammjK06ZRsCN7qyevQrlU9y/f1SqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+hXjXw=</latexit>a4<latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit><latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit><latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit><latexit sha1_base64="4g8HicLF5ARGnAzZ9CtVNqUrwEo=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUqjHghePFe0HtKFMtpt26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU0VZm8YiVr0ANRNcsrbhRrBeohhGgWDdYHq7qHefmNI8lo9mljA/wrHkIadorPWAw/qwXHGr7lJkE7wcKpCrNSx/DUYxTSMmDRWodd9zE+NnqAyngs1Lg1SzBOkUx6xvUWLEtJ8tV52TK+uMSBgr+6QhS/f3RIaR1rMosJ0Rmolery3M/2r91IQ3fsZlkhom6eqjMBXExGRxNxlxxagRMwtIFbe7EjpBhdTYdEo2BG/95E3o1Kqe5ft6pVnL4yjCBVzCNXjQgCbcQQvaQGEMz/AKb45wXpx352PVWnDymXP4I+fzB+hVjXw=</latexit>a5<latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit>C2<latexit sha1_base64="Necvnzo0t6tocaWtP8CYjXG/Gow=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h7VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7eZjVw=</latexit><latexit sha1_base64="Necvnzo0t6tocaWtP8CYjXG/Gow=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h7VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7eZjVw=</latexit><latexit sha1_base64="Necvnzo0t6tocaWtP8CYjXG/Gow=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h7VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7eZjVw=</latexit><latexit sha1_base64="Necvnzo0t6tocaWtP8CYjXG/Gow=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h7VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7eZjVw=</latexit>C6<latexit sha1_base64="8yQs+h/XD++aSSbSAlDxEGKpC30=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuqx0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP72pjWA=</latexit><latexit sha1_base64="8yQs+h/XD++aSSbSAlDxEGKpC30=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuqx0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP72pjWA=</latexit><latexit sha1_base64="8yQs+h/XD++aSSbSAlDxEGKpC30=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuqx0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP72pjWA=</latexit><latexit sha1_base64="8yQs+h/XD++aSSbSAlDxEGKpC30=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuqx0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP72pjWA=</latexit>C8<latexit sha1_base64="ssgYBNEh9qYTHDg3FpsA1oK0234=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIthjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IR1P+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/DgFhpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH8CxjWI=</latexit><latexit sha1_base64="ssgYBNEh9qYTHDg3FpsA1oK0234=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIthjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IR1P+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/DgFhpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH8CxjWI=</latexit><latexit sha1_base64="ssgYBNEh9qYTHDg3FpsA1oK0234=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIthjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IR1P+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/DgFhpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH8CxjWI=</latexit><latexit sha1_base64="ssgYBNEh9qYTHDg3FpsA1oK0234=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIthjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IR1P+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/DgFhpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH8CxjWI=</latexit>C9<latexit sha1_base64="qPbjZAl6Pdu29jKiQAs2eZKY50s=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIqi3Qi8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTBrzeucJleaxfDTTBP2IjiQPOaPGWg+Nwe2gXHGr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du1b1LN9fVeq1PI4inME5XIIH11CHO2hCCxiM4Ble4c0Rzovz7nwsWwtOPnMKf+R8/gDCNY1j</latexit><latexit sha1_base64="qPbjZAl6Pdu29jKiQAs2eZKY50s=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIqi3Qi8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTBrzeucJleaxfDTTBP2IjiQPOaPGWg+Nwe2gXHGr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du1b1LN9fVeq1PI4inME5XIIH11CHO2hCCxiM4Ble4c0Rzovz7nwsWwtOPnMKf+R8/gDCNY1j</latexit><latexit sha1_base64="qPbjZAl6Pdu29jKiQAs2eZKY50s=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIqi3Qi8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTBrzeucJleaxfDTTBP2IjiQPOaPGWg+Nwe2gXHGr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du1b1LN9fVeq1PI4inME5XIIH11CHO2hCCxiM4Ble4c0Rzovz7nwsWwtOPnMKf+R8/gDCNY1j</latexit><latexit sha1_base64="qPbjZAl6Pdu29jKiQAs2eZKY50s=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIqi3Qi8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTBrzeucJleaxfDTTBP2IjiQPOaPGWg+Nwe2gXHGr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du1b1LN9fVeq1PI4inME5XIIH11CHO2hCCxiM4Ble4c0Rzovz7nwsWwtOPnMKf+R8/gDCNY1j</latexit>a<latexit sha1_base64="xCYow5BVFq3CiJo01XnPJUWogoA=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi06LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w++j4zV</latexit><latexit sha1_base64="xCYow5BVFq3CiJo01XnPJUWogoA=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi06LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w++j4zV</latexit><latexit sha1_base64="xCYow5BVFq3CiJo01XnPJUWogoA=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi06LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w++j4zV</latexit><latexit sha1_base64="xCYow5BVFq3CiJo01XnPJUWogoA=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi06LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w++j4zV</latexit>b<latexit sha1_base64="OV7Ydi5Qr7HqyJux9Lw5aK1l+Nk=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWq1gWK64VXcpsgleDhXI1RyWvwajmKURSsME1brvuYnxM6oMZwLnpUGqMaFsSsfYtyhphNrPlovOyZV1RiSMlX3SkKX7eyKjkdazKLCdETUTvV5bmP/V+qkJb/2MyyQ1KNnqozAVxMRkcTUZcYXMiJkFyhS3uxI2oYoyY7Mp2RC89ZM3oVOrepZbN5VGLY+jCBdwCdfgQR0acA9NaAMDhGd4hTfn0Xlx3p2PVWvByWfO4Y+czx/AE4zW</latexit><latexit sha1_base64="OV7Ydi5Qr7HqyJux9Lw5aK1l+Nk=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWq1gWK64VXcpsgleDhXI1RyWvwajmKURSsME1brvuYnxM6oMZwLnpUGqMaFsSsfYtyhphNrPlovOyZV1RiSMlX3SkKX7eyKjkdazKLCdETUTvV5bmP/V+qkJb/2MyyQ1KNnqozAVxMRkcTUZcYXMiJkFyhS3uxI2oYoyY7Mp2RC89ZM3oVOrepZbN5VGLY+jCBdwCdfgQR0acA9NaAMDhGd4hTfn0Xlx3p2PVWvByWfO4Y+czx/AE4zW</latexit><latexit sha1_base64="OV7Ydi5Qr7HqyJux9Lw5aK1l+Nk=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWq1gWK64VXcpsgleDhXI1RyWvwajmKURSsME1brvuYnxM6oMZwLnpUGqMaFsSsfYtyhphNrPlovOyZV1RiSMlX3SkKX7eyKjkdazKLCdETUTvV5bmP/V+qkJb/2MyyQ1KNnqozAVxMRkcTUZcYXMiJkFyhS3uxI2oYoyY7Mp2RC89ZM3oVOrepZbN5VGLY+jCBdwCdfgQR0acA9NaAMDhGd4hTfn0Xlx3p2PVWvByWfO4Y+czx/AE4zW</latexit><latexit sha1_base64="OV7Ydi5Qr7HqyJux9Lw5aK1l+Nk=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWq1gWK64VXcpsgleDhXI1RyWvwajmKURSsME1brvuYnxM6oMZwLnpUGqMaFsSsfYtyhphNrPlovOyZV1RiSMlX3SkKX7eyKjkdazKLCdETUTvV5bmP/V+qkJb/2MyyQ1KNnqozAVxMRkcTUZcYXMiJkFyhS3uxI2oYoyY7Mp2RC89ZM3oVOrepZbN5VGLY+jCBdwCdfgQR0acA9NaAMDhGd4hTfn0Xlx3p2PVWvByWfO4Y+czx/AE4zW</latexit>a1<latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit><latexit sha1_base64="A3h6jb20Zv1DJrhRcinDu3FdguI=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEquDau++2UNja3tnfKu5W9/YPDo+rxSVsnmWLos0QkqhtSjYJL9A03ArupQhqHAjvh5HZe7zyh0jyRj2aaYhDTkeQRZ9RY64EOvEG15tbdhcg6eAXUoFBrUP3qDxOWxSgNE1TrnuemJsipMpwJnFX6mcaUsgkdYc+ipDHqIF+sOiMX1hmSKFH2SUMW7u+JnMZaT+PQdsbUjPVqbW7+V+tlJroJci7TzKBky4+iTBCTkPndZMgVMiOmFihT3O5K2JgqyoxNp2JD8FZPXod2o+5Zvr+qNRtFHGU4g3O4BA+uoQl30AIfGIzgGV7hzRHOi/PufCxbS04xcwp/5Hz+AOPJjXk=</latexit>b2<latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit><latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit><latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit><latexit sha1_base64="PJkh+0x1tT4lgTvX7Qu5cWNlwLE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjRdMW2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvGEqhUHX/XZKG5tb2zvl3cre/sHhUfX4pG2STDPus0QmuhtSw6VQ3EeBkndTzWkcSt4JJ7fzeueJayMS9YjTlAcxHSkRCUbRWg/hoDGo1ty6uxBZB6+AGhRqDapf/WHCspgrZJIa0/PcFIOcahRM8lmlnxmeUjahI96zqGjMTZAvVp2RC+sMSZRo+xSShft7IqexMdM4tJ0xxbFZrc3N/2q9DKObIBcqzZArtvwoyiTBhMzvJkOhOUM5tUCZFnZXwsZUU4Y2nYoNwVs9eR3ajbpn+f6q1mwUcZThDM7hEjy4hibcQQt8YDCCZ3iFN0c6L86787FsLTnFzCn8kfP5A+bTjXs=</latexit>a5<latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit><latexit sha1_base64="MF6Ho95LzIRUtuCbdF1GMRWZaZE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSYtFjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz3QQX1QrrhVdyGyDl4OFcjVHJS/+sOYpRFXyCQ1pue5CfoZ1SiY5LNSPzU8oWxCR7xnUdGIGz9brDojF9YZkjDW9ikkC/f3REYjY6ZRYDsjimOzWpub/9V6KYY3fiZUkiJXbPlRmEqCMZnfTYZCc4ZyaoEyLeyuhI2ppgxtOiUbgrd68jq0a1XP8v1VpVHL4yjCGZzDJXhwDQ24gya0gMEInuEV3hzpvDjvzseyteDkM6fwR87nD+nZjX0=</latexit>b6<latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit><latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit><latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit><latexit sha1_base64="hceR4GK2OiifmhkI6/LBBdV0gRU=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItVjwYvHivYD2lA22027dLMJuxOhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEihUHX/XYKG5tb2zvF3dLe/sHhUfn4pG3iVDPeYrGMdTeghkuheAsFSt5NNKdRIHknmNzO650nro2I1SNOE+5HdKREKBhFaz0Eg/qgXHGr7kJkHbwcKpCrOSh/9YcxSyOukElqTM9zE/QzqlEwyWelfmp4QtmEjnjPoqIRN362WHVGLqwzJGGs7VNIFu7viYxGxkyjwHZGFMdmtTY3/6v1Ugxv/EyoJEWu2PKjMJUEYzK/mwyF5gzl1AJlWthdCRtTTRnadEo2BG/15HVo16qe5furSqOWx1GEMziHS/DgGhpwB01oAYMRPMMrvDnSeXHenY9la8HJZ07hj5zPH+zjjX8=</latexit>a7<latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit><latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit><latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit><latexit sha1_base64="Ld8CyZ4j+K/E4jimw180YpKR9Ps=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1nqgw/qwXHGr7lJkE7wcKpCrNSx/DUYxSyOukElqTN9zE/QzqlEwyeelQWp4QtmUjnnfoqIRN362XHVOrqwzImGs7VNIlu7viYxGxsyiwHZGFCdmvbYw/6v1UwwbfiZUkiJXbPVRmEqCMVncTUZCc4ZyZoEyLeyuhE2opgxtOiUbgrd+8iZ0alXP8v1NpVnL4yjCBVzCNXhQhybcQQvawGAMz/AKb450Xpx352PVWnDymXP4I+fzB+zhjX8=</latexit>b8<latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit><latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit><latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit><latexit sha1_base64="+jb3BY2lGE//EA9yceJHtmkxgno=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIrTHghePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuML1d1LtPXBsRq0ecJdyP6FiJUDCK1noIho1hueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxg2/EyoJEWu2OqjMJUEY7K4m4yE5gzlzAJlWthdCZtQTRnadEo2BG/95E3o1Kqe5fubSrOWx1GEC7iEa/CgDk24gxa0gcEYnuEV3hzpvDjvzseqteDkM+fwR87nD+/rjYE=</latexit>c9<latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit><latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit><latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit><latexit sha1_base64="Zi/6UPxL/WvUtvKP+P7VTwhvjXs=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSIlRvBS8eK9oPaEPZbDft0s0m7E6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJFAZd99spbGxube8Ud0t7+weHR+Xjk7aJU814i8Uy1t2AGi6F4i0UKHk30ZxGgeSdYHI7r3eeuDYiVo84Tbgf0ZESoWAUrfXABjeDcsWtuguRdfByqECu5qD81R/GLI24QiapMT3PTdDPqEbBJJ+V+qnhCWUTOuI9i4pG3PjZYtUZubDOkISxtk8hWbi/JzIaGTONAtsZURyb1drc/K/WSzG89jOhkhS5YsuPwlQSjMn8bjIUmjOUUwuUaWF3JWxMNWVo0ynZELzVk9ehXat6lu+vKo1aHkcRzuAcLsGDOjTgDprQAgYjeIZXeHOk8+K8Ox/L1oKTz5zCHzmfP/L1jYM=</latexit>d10<latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit><latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit><latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit><latexit sha1_base64="BkLQmmkAUvQkWY3SdJiEQW1gADE=">AAAB7XicbZDLSgMxFIZP6q3WW9Wlm2ARXJWZIuiy4MZlBXuBdiiZTKaNzSRDkhHK0Hdw40IRt76PO9/GtJ2Ftv4Q+PjPOeScP0wFN9bzvlFpY3Nre6e8W9nbPzg8qh6fdIzKNGVtqoTSvZAYJrhkbcutYL1UM5KEgnXDye283n1i2nAlH+w0ZUFCRpLHnBLrrE40zH1vNqzWvLq3EF4Hv4AaFGoNq1+DSNEsYdJSQYzp+15qg5xoy6lgs8ogMywldEJGrO9QkoSZIF9sO8MXzolwrLR70uKF+3siJ4kx0yR0nQmxY7Nam5v/1fqZjW+CnMs0s0zS5UdxJrBVeH46jrhm1IqpA0I1d7tiOiaaUOsCqrgQ/NWT16HTqPuO769qzUYRRxnO4BwuwYdraMIdtKANFB7hGV7hDSn0gt7Rx7K1hIqZU/gj9PkDHDKOwg==</latexit>C1<latexit sha1_base64="7wGcRf7xMLiGxl4WEC2EdQ7oDbA=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfm0BuWK27VXYpsgpdDBXK1huWvwShmaYTSMEG17ntuYvyMKsOZwHlpkGpMKJvSMfYtShqh9rPlqnNyZZ0RCWNlnzRk6f6eyGik9SwKbGdEzUSv1xbmf7V+asJbP+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/CgDg24gxa0gcEYnuEV3hzhvDjvzseqteDkM+fwR87nD7YVjVs=</latexit><latexit sha1_base64="7wGcRf7xMLiGxl4WEC2EdQ7oDbA=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfm0BuWK27VXYpsgpdDBXK1huWvwShmaYTSMEG17ntuYvyMKsOZwHlpkGpMKJvSMfYtShqh9rPlqnNyZZ0RCWNlnzRk6f6eyGik9SwKbGdEzUSv1xbmf7V+asJbP+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/CgDg24gxa0gcEYnuEV3hzhvDjvzseqteDkM+fwR87nD7YVjVs=</latexit><latexit sha1_base64="7wGcRf7xMLiGxl4WEC2EdQ7oDbA=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfm0BuWK27VXYpsgpdDBXK1huWvwShmaYTSMEG17ntuYvyMKsOZwHlpkGpMKJvSMfYtShqh9rPlqnNyZZ0RCWNlnzRk6f6eyGik9SwKbGdEzUSv1xbmf7V+asJbP+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/CgDg24gxa0gcEYnuEV3hzhvDjvzseqteDkM+fwR87nD7YVjVs=</latexit><latexit sha1_base64="7wGcRf7xMLiGxl4WEC2EdQ7oDbA=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfm0BuWK27VXYpsgpdDBXK1huWvwShmaYTSMEG17ntuYvyMKsOZwHlpkGpMKJvSMfYtShqh9rPlqnNyZZ0RCWNlnzRk6f6eyGik9SwKbGdEzUSv1xbmf7V+asJbP+MySQ1KtvooTAUxMVncTUZcITNiZoEyxe2uhE2ooszYdEo2BG/95E3o1Kqe5fubSqOWx1GEC7iEa/CgDg24gxa0gcEYnuEV3hzhvDjvzseqteDkM+fwR87nD7YVjVs=</latexit>C3<latexit sha1_base64="XwT7vC7eXZ/Tb64lpwGk8KW5ses=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSKuix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcDUoV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/fXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7kdjV0=</latexit><latexit sha1_base64="XwT7vC7eXZ/Tb64lpwGk8KW5ses=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSKuix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcDUoV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/fXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7kdjV0=</latexit><latexit sha1_base64="XwT7vC7eXZ/Tb64lpwGk8KW5ses=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSKuix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcDUoV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/fXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7kdjV0=</latexit><latexit sha1_base64="XwT7vC7eXZ/Tb64lpwGk8KW5ses=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSKuix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcDUoV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/fXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7kdjV0=</latexit>C4<latexit sha1_base64="ib2s5QkdFTkLZd/tcMNa4hS3Qws=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUtBjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h/VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/f1SqOWx1GEC7iEa/DgBhpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7qhjV4=</latexit><latexit sha1_base64="ib2s5QkdFTkLZd/tcMNa4hS3Qws=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUtBjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h/VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/f1SqOWx1GEC7iEa/DgBhpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7qhjV4=</latexit><latexit sha1_base64="ib2s5QkdFTkLZd/tcMNa4hS3Qws=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUtBjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h/VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/f1SqOWx1GEC7iEa/DgBhpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7qhjV4=</latexit><latexit sha1_base64="ib2s5QkdFTkLZd/tcMNa4hS3Qws=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSUtBjoRePFe0HtKFstpt26WYTdidCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNECoOu++0UtrZ3dveK+6WDw6Pjk/LpWcfEqWa8zWIZ615ADZdC8TYKlLyXaE6jQPJuMG0u6t0nro2I1SPOEu5HdKxEKBhFaz00h/VhueJW3aXIJng5VCBXa1j+GoxilkZcIZPUmL7nJuhnVKNgks9Lg9TwhLIpHfO+RUUjbvxsueqcXFlnRMJY26eQLN3fExmNjJlFge2MKE7Mem1h/lfrpxje+plQSYpcsdVHYSoJxmRxNxkJzRnKmQXKtLC7EjahmjK06ZRsCN76yZvQqVU9y/f1SqOWx1GEC7iEa/DgBhpwBy1oA4MxPMMrvDnSeXHenY9Va8HJZ87hj5zPH7qhjV4=</latexit>C5<latexit sha1_base64="AoHTY7aRaGxagUwbpC0aOrzj5wE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSouix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7wljV8=</latexit><latexit sha1_base64="AoHTY7aRaGxagUwbpC0aOrzj5wE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSouix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7wljV8=</latexit><latexit sha1_base64="AoHTY7aRaGxagUwbpC0aOrzj5wE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSouix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7wljV8=</latexit><latexit sha1_base64="AoHTY7aRaGxagUwbpC0aOrzj5wE=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSouix0IvHivYD2lA220m7dLMJuxuhhP4ELx4U8eov8ua/cdvmoK0vLDy8M8POvEEiuDau++0UNja3tneKu6W9/YPDo/LxSVvHqWLYYrGIVTegGgWX2DLcCOwmCmkUCOwEk8a83nlCpXksH800QT+iI8lDzqix1kNjcD0oV9yquxBZBy+HCuRqDspf/WHM0gilYYJq3fPcxPgZVYYzgbNSP9WYUDahI+xZlDRC7WeLVWfkwjpDEsbKPmnIwv09kdFI62kU2M6ImrFerc3N/2q91IS3fsZlkhqUbPlRmApiYjK/mwy5QmbE1AJlittdCRtTRZmx6ZRsCN7qyevQrlU9y/dXlXotj6MIZ3AOl+DBDdThDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP7wljV8=</latexit>C7<latexit sha1_base64="rlDSomXhWQhP5z+evNJdnyzIQXc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IS3fsZlkhqUbPVRmApiYrK4m4y4QmbEzAJlittdCZtQRZmx6ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH78tjWE=</latexit><latexit sha1_base64="rlDSomXhWQhP5z+evNJdnyzIQXc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IS3fsZlkhqUbPVRmApiYrK4m4y4QmbEzAJlittdCZtQRZmx6ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH78tjWE=</latexit><latexit sha1_base64="rlDSomXhWQhP5z+evNJdnyzIQXc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IS3fsZlkhqUbPVRmApiYrK4m4y4QmbEzAJlittdCZtQRZmx6ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH78tjWE=</latexit><latexit sha1_base64="rlDSomXhWQhP5z+evNJdnyzIQXc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjoRePFe0HtKFstpN26WYTdjdCCf0JXjwo4tVf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNps1FvfuESvNYPppZgn5Ex5KHnFFjrYfmsD4sV9yquxTZBC+HCuRqDctfg1HM0gilYYJq3ffcxPgZVYYzgfPSINWYUDalY+xblDRC7WfLVefkyjojEsbKPmnI0v09kdFI61kU2M6Imolery3M/2r91IS3fsZlkhqUbPVRmApiYrK4m4y4QmbEzAJlittdCZtQRZmx6ZRsCN76yZvQqVU9y/c3lUYtj6MIF3AJ1+BBHRpwBy1oA4MxPMMrvDnCeXHenY9Va8HJZ87hj5zPH78tjWE=</latexit>a<latexit sha1_base64="xCYow5BVFq3CiJo01XnPJUWogoA=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi06LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w++j4zV</latexit><latexit sha1_base64="xCYow5BVFq3CiJo01XnPJUWogoA=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi06LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w++j4zV</latexit><latexit sha1_base64="xCYow5BVFq3CiJo01XnPJUWogoA=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi06LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w++j4zV</latexit><latexit sha1_base64="xCYow5BVFq3CiJo01XnPJUWogoA=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi06LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w++j4zV</latexit>b<latexit sha1_base64="OV7Ydi5Qr7HqyJux9Lw5aK1l+Nk=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWq1gWK64VXcpsgleDhXI1RyWvwajmKURSsME1brvuYnxM6oMZwLnpUGqMaFsSsfYtyhphNrPlovOyZV1RiSMlX3SkKX7eyKjkdazKLCdETUTvV5bmP/V+qkJb/2MyyQ1KNnqozAVxMRkcTUZcYXMiJkFyhS3uxI2oYoyY7Mp2RC89ZM3oVOrepZbN5VGLY+jCBdwCdfgQR0acA9NaAMDhGd4hTfn0Xlx3p2PVWvByWfO4Y+czx/AE4zW</latexit><latexit sha1_base64="OV7Ydi5Qr7HqyJux9Lw5aK1l+Nk=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWq1gWK64VXcpsgleDhXI1RyWvwajmKURSsME1brvuYnxM6oMZwLnpUGqMaFsSsfYtyhphNrPlovOyZV1RiSMlX3SkKX7eyKjkdazKLCdETUTvV5bmP/V+qkJb/2MyyQ1KNnqozAVxMRkcTUZcYXMiJkFyhS3uxI2oYoyY7Mp2RC89ZM3oVOrepZbN5VGLY+jCBdwCdfgQR0acA9NaAMDhGd4hTfn0Xlx3p2PVWvByWfO4Y+czx/AE4zW</latexit><latexit sha1_base64="OV7Ydi5Qr7HqyJux9Lw5aK1l+Nk=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWq1gWK64VXcpsgleDhXI1RyWvwajmKURSsME1brvuYnxM6oMZwLnpUGqMaFsSsfYtyhphNrPlovOyZV1RiSMlX3SkKX7eyKjkdazKLCdETUTvV5bmP/V+qkJb/2MyyQ1KNnqozAVxMRkcTUZcYXMiJkFyhS3uxI2oYoyY7Mp2RC89ZM3oVOrepZbN5VGLY+jCBdwCdfgQR0acA9NaAMDhGd4hTfn0Xlx3p2PVWvByWfO4Y+czx/AE4zW</latexit><latexit sha1_base64="OV7Ydi5Qr7HqyJux9Lw5aK1l+Nk=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWq1gWK64VXcpsgleDhXI1RyWvwajmKURSsME1brvuYnxM6oMZwLnpUGqMaFsSsfYtyhphNrPlovOyZV1RiSMlX3SkKX7eyKjkdazKLCdETUTvV5bmP/V+qkJb/2MyyQ1KNnqozAVxMRkcTUZcYXMiJkFyhS3uxI2oYoyY7Mp2RC89ZM3oVOrepZbN5VGLY+jCBdwCdfgQR0acA9NaAMDhGd4hTfn0Xlx3p2PVWvByWfO4Y+czx/AE4zW</latexit>c<latexit sha1_base64="kD4Sw6elG9W7UxMK/BVw5G+hwL8=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi02LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w/Bl4zX</latexit><latexit sha1_base64="kD4Sw6elG9W7UxMK/BVw5G+hwL8=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi02LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w/Bl4zX</latexit><latexit sha1_base64="kD4Sw6elG9W7UxMK/BVw5G+hwL8=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi02LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w/Bl4zX</latexit><latexit sha1_base64="kD4Sw6elG9W7UxMK/BVw5G+hwL8=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSItRjwYvHFuwHtKFstpN27WYTdjdCCf0FXjwo4tWf5M1/47bNQVtfWHh4Z4adeYNEcG1c99spbG3v7O4V90sHh0fHJ+XTs46OU8WwzWIRq15ANQousW24EdhLFNIoENgNpneLevcJleaxfDCzBP2IjiUPOaPGWi02LFfcqrsU2QQvhwrkag7LX4NRzNIIpWGCat333MT4GVWGM4Hz0iDVmFA2pWPsW5Q0Qu1ny0Xn5Mo6IxLGyj5pyNL9PZHRSOtZFNjOiJqJXq8tzP9q/dSEt37GZZIalGz1UZgKYmKyuJqMuEJmxMwCZYrbXQmbUEWZsdmUbAje+smb0KlVPcutm0qjlsdRhAu4hGvwoA4NuIcmtIEBwjO8wpvz6Lw4787HqrXg5DPn8EfO5w/Bl4zX</latexit>d<latexit sha1_base64="LMRKkiGgSyIHGwBU+V8UchHv94g=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjC7YV2lA2m0m7drMJuxuhhP4CLx4U8epP8ua/cdvmoK0vLDy8M8POvEEquDau++2UNja3tnfKu5W9/YPDo+rxSVcnmWLYYYlI1ENANQousWO4EfiQKqRxILAXTG7n9d4TKs0TeW+mKfoxHUkecUaNtdrhsFpz6+5CZB28AmpQqDWsfg3ChGUxSsME1brvuanxc6oMZwJnlUGmMaVsQkfYtyhpjNrPF4vOyIV1QhIlyj5pyML9PZHTWOtpHNjOmJqxXq3Nzf9q/cxEN37OZZoZlGz5UZQJYhIyv5qEXCEzYmqBMsXtroSNqaLM2GwqNgRv9eR16DbqnuX2Va3ZKOIowxmcwyV4cA1NuIMWdIABwjO8wpvz6Lw4787HsrXkFDOn8EfO5w/DG4zY</latexit><latexit sha1_base64="LMRKkiGgSyIHGwBU+V8UchHv94g=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjC7YV2lA2m0m7drMJuxuhhP4CLx4U8epP8ua/cdvmoK0vLDy8M8POvEEquDau++2UNja3tnfKu5W9/YPDo+rxSVcnmWLYYYlI1ENANQousWO4EfiQKqRxILAXTG7n9d4TKs0TeW+mKfoxHUkecUaNtdrhsFpz6+5CZB28AmpQqDWsfg3ChGUxSsME1brvuanxc6oMZwJnlUGmMaVsQkfYtyhpjNrPF4vOyIV1QhIlyj5pyML9PZHTWOtpHNjOmJqxXq3Nzf9q/cxEN37OZZoZlGz5UZQJYhIyv5qEXCEzYmqBMsXtroSNqaLM2GwqNgRv9eR16DbqnuX2Va3ZKOIowxmcwyV4cA1NuIMWdIABwjO8wpvz6Lw4787HsrXkFDOn8EfO5w/DG4zY</latexit><latexit sha1_base64="LMRKkiGgSyIHGwBU+V8UchHv94g=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjC7YV2lA2m0m7drMJuxuhhP4CLx4U8epP8ua/cdvmoK0vLDy8M8POvEEquDau++2UNja3tnfKu5W9/YPDo+rxSVcnmWLYYYlI1ENANQousWO4EfiQKqRxILAXTG7n9d4TKs0TeW+mKfoxHUkecUaNtdrhsFpz6+5CZB28AmpQqDWsfg3ChGUxSsME1brvuanxc6oMZwJnlUGmMaVsQkfYtyhpjNrPF4vOyIV1QhIlyj5pyML9PZHTWOtpHNjOmJqxXq3Nzf9q/cxEN37OZZoZlGz5UZQJYhIyv5qEXCEzYmqBMsXtroSNqaLM2GwqNgRv9eR16DbqnuX2Va3ZKOIowxmcwyV4cA1NuIMWdIABwjO8wpvz6Lw4787HsrXkFDOn8EfO5w/DG4zY</latexit><latexit sha1_base64="LMRKkiGgSyIHGwBU+V8UchHv94g=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FSSIuix4MVjC7YV2lA2m0m7drMJuxuhhP4CLx4U8epP8ua/cdvmoK0vLDy8M8POvEEquDau++2UNja3tnfKu5W9/YPDo+rxSVcnmWLYYYlI1ENANQousWO4EfiQKqRxILAXTG7n9d4TKs0TeW+mKfoxHUkecUaNtdrhsFpz6+5CZB28AmpQqDWsfg3ChGUxSsME1brvuanxc6oMZwJnlUGmMaVsQkfYtyhpjNrPF4vOyIV1QhIlyj5pyML9PZHTWOtpHNjOmJqxXq3Nzf9q/cxEN37OZZoZlGz5UZQJYhIyv5qEXCEzYmqBMsXtroSNqaLM2GwqNgRv9eR16DbqnuX2Va3ZKOIowxmcwyV4cA1NuIMWdIABwjO8wpvz6Lw4787HsrXkFDOn8EfO5w/DG4zY</latexit>(a)<latexit sha1_base64="RaKubww8bHA7bv0Y71M1/0w+EPc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q9HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4PXjTo=</latexit><latexit sha1_base64="RaKubww8bHA7bv0Y71M1/0w+EPc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q9HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4PXjTo=</latexit><latexit sha1_base64="RaKubww8bHA7bv0Y71M1/0w+EPc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q9HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4PXjTo=</latexit><latexit sha1_base64="RaKubww8bHA7bv0Y71M1/0w+EPc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q9HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4PXjTo=</latexit>(b)<latexit sha1_base64="/IZxkdWWXhp/Wt2hgTFqXWy1ERc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6qweWgXHFr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du17zLN/XK42rPI4inME5VMGDa2jAHTShBQxG8Ayv8OYI58V5dz6WrQUnnzmFP3I+fwCFXI07</latexit><latexit sha1_base64="/IZxkdWWXhp/Wt2hgTFqXWy1ERc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6qweWgXHFr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du17zLN/XK42rPI4inME5VMGDa2jAHTShBQxG8Ayv8OYI58V5dz6WrQUnnzmFP3I+fwCFXI07</latexit><latexit sha1_base64="/IZxkdWWXhp/Wt2hgTFqXWy1ERc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6qweWgXHFr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du17zLN/XK42rPI4inME5VMGDa2jAHTShBQxG8Ayv8OYI58V5dz6WrQUnnzmFP3I+fwCFXI07</latexit><latexit sha1_base64="/IZxkdWWXhp/Wt2hgTFqXWy1ERc=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6qweWgXHFr7kJkHbwcKpCrOSh/9YcxSyOUhgmqdc9zE+NnVBnOBM5K/VRjQtmEjrBnUdIItZ8tVp2RC+sMSRgr+6QhC/f3REYjradRYDsjasZ6tTY3/6v1UhPe+BmXSWpQsuVHYSqIicn8bjLkCpkRUwuUKW53JWxMFWXGplOyIXirJ69Du17zLN/XK42rPI4inME5VMGDa2jAHTShBQxG8Ayv8OYI58V5dz6WrQUnnzmFP3I+fwCFXI07</latexit>(c)<latexit sha1_base64="vZCAZ+pJxKG9QblqDBepXZNFbU8=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q7HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4bhjTw=</latexit><latexit sha1_base64="vZCAZ+pJxKG9QblqDBepXZNFbU8=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q7HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4bhjTw=</latexit><latexit sha1_base64="vZCAZ+pJxKG9QblqDBepXZNFbU8=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q7HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4bhjTw=</latexit><latexit sha1_base64="vZCAZ+pJxKG9QblqDBepXZNFbU8=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbCft0s0m7G6EEvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78waJ4Nq47rdT2Njc2t4p7pb29g8Oj8rHJ20dp4phi8UiVt2AahRcYstwI7CbKKRRILATTG7n9c4TKs1j+WimCfoRHUkeckaNtR6q7HJQrrg1dyGyDl4OFcjVHJS/+sOYpRFKwwTVuue5ifEzqgxnAmelfqoxoWxCR9izKGmE2s8Wq87IhXWGJIyVfdKQhft7IqOR1tMosJ0RNWO9Wpub/9V6qQlv/IzLJDUo2fKjMBXExGR+NxlyhcyIqQXKFLe7EjamijJj0ynZELzVk9ehXa95lu/rlcZVHkcRzuAcquDBNTTgDprQAgYjeIZXeHOE8+K8Ox/L1oKTz5zCHzmfP4bhjTw=</latexit>(d)<latexit sha1_base64="kAB7LveGU8jfRCmkTCpxS3KP4ew=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbDbt0s0m7E6EUvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78wapFAZd99spbGxube8Ud0t7+weHR+Xjk7ZJMs14iyUy0d2AGi6F4i0UKHk31ZzGgeSdYHw7r3eeuDYiUY84Sbkf06ESkWAUrfVQDS8H5Ypbcxci6+DlUIFczUH5qx8mLIu5QiapMT3PTdGfUo2CST4r9TPDU8rGdMh7FhWNufGni1Vn5MI6IYkSbZ9CsnB/T0xpbMwkDmxnTHFkVmtz879aL8Poxp8KlWbIFVt+FGWSYELmd5NQaM5QTixQpoXdlbAR1ZShTadkQ/BWT16Hdr3mWb6vVxpXeRxFOINzqIIH19CAO2hCCxgM4Rle4c2Rzovz7nwsWwtOPnMKf+R8/gCIZo09</latexit><latexit sha1_base64="kAB7LveGU8jfRCmkTCpxS3KP4ew=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbDbt0s0m7E6EUvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78wapFAZd99spbGxube8Ud0t7+weHR+Xjk7ZJMs14iyUy0d2AGi6F4i0UKHk31ZzGgeSdYHw7r3eeuDYiUY84Sbkf06ESkWAUrfVQDS8H5Ypbcxci6+DlUIFczUH5qx8mLIu5QiapMT3PTdGfUo2CST4r9TPDU8rGdMh7FhWNufGni1Vn5MI6IYkSbZ9CsnB/T0xpbMwkDmxnTHFkVmtz879aL8Poxp8KlWbIFVt+FGWSYELmd5NQaM5QTixQpoXdlbAR1ZShTadkQ/BWT16Hdr3mWb6vVxpXeRxFOINzqIIH19CAO2hCCxgM4Rle4c2Rzovz7nwsWwtOPnMKf+R8/gCIZo09</latexit><latexit sha1_base64="kAB7LveGU8jfRCmkTCpxS3KP4ew=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbDbt0s0m7E6EUvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78wapFAZd99spbGxube8Ud0t7+weHR+Xjk7ZJMs14iyUy0d2AGi6F4i0UKHk31ZzGgeSdYHw7r3eeuDYiUY84Sbkf06ESkWAUrfVQDS8H5Ypbcxci6+DlUIFczUH5qx8mLIu5QiapMT3PTdGfUo2CST4r9TPDU8rGdMh7FhWNufGni1Vn5MI6IYkSbZ9CsnB/T0xpbMwkDmxnTHFkVmtz879aL8Poxp8KlWbIFVt+FGWSYELmd5NQaM5QTixQpoXdlbAR1ZShTadkQ/BWT16Hdr3mWb6vVxpXeRxFOINzqIIH19CAO2hCCxgM4Rle4c2Rzovz7nwsWwtOPnMKf+R8/gCIZo09</latexit><latexit sha1_base64="kAB7LveGU8jfRCmkTCpxS3KP4ew=">AAAB6nicbZBNS8NAEIYn9avWr6pHL4tFqJeSFEGPBS8eK9oPaEPZbDbt0s0m7E6EUvoTvHhQxKu/yJv/xm2bg7a+sPDwzgw78wapFAZd99spbGxube8Ud0t7+weHR+Xjk7ZJMs14iyUy0d2AGi6F4i0UKHk31ZzGgeSdYHw7r3eeuDYiUY84Sbkf06ESkWAUrfVQDS8H5Ypbcxci6+DlUIFczUH5qx8mLIu5QiapMT3PTdGfUo2CST4r9TPDU8rGdMh7FhWNufGni1Vn5MI6IYkSbZ9CsnB/T0xpbMwkDmxnTHFkVmtz879aL8Poxp8KlWbIFVt+FGWSYELmd5NQaM5QTixQpoXdlbAR1ZShTadkQ/BWT16Hdr3mWb6vVxpXeRxFOINzqIIH19CAO2hCCxgM4Rle4c2Rzovz7nwsWwtOPnMKf+R8/gCIZo09</latexit> Lemma 6 Let VD be the vertical top DAG. We can represent VD in O(nVD) space such that given a vertical cluster C, we can support spine path extraction on C in O((cid:96) + height(C) − height(vexit(C, (cid:96)))) time, where (cid:96) is the length of the extracted prefix of spine(C). Note that we can use Lemma 6 to compute the longest common prefix of spine(C) and any string by reporting the characters on the spine path from top-to-bottom and comparing them with the string until we get a mismatch. This uses O((cid:96) + 1 + height(C) − height(vexit(C, (cid:96) + 1))) time, where (cid:96) is the length of the longest common prefix. 5 An O(m + log n) Time Solution We now plug in our spine path extraction algorithm from Section 4 into the simple algorithm from Section 3. Define the horizontal entry cluster for a vertical cluster C, denoted hentry(C), to be the highest horizontal cluster or leaf cluster in T (C) that contains all edges from top(C) to children within C. For a horizontal cluster or a leaf the horizontal exit cluster is the cluster itself. Note hentry(C) is the highest horizontal cluster or leaf cluster on the path from C to the leftmost leaf of C. Our data structure consists of the data structures from Section 3 without fingerprints and Section 4. This uses O(nTD) space. To search for a string P of length m, we use the same algorithm as in Section 3, but with the following new implementation of the vertical merges. Case 3: C is vertical cluster. Recall we have reached a vertical cluster C and have matched prefix P [1, i]. We check if the first character on spine(C) matches P [i + 1]. If it does not, we continue the algorithm from hentry(C). If it does, we extract characters from spine(C) in order to compute the length (cid:96) of the longest common prefix of spine(C) and P [i + 1, m] and the corresponding vertical exit cluster E = vexit(C, (cid:96) + 1). Let B be the right child of E in TD. We traverse the leftmost path from B to find hentry(B) and continue the search for P [i + (cid:96) + 1, m] from there. Lemma 7 The algorithm correctly computes the longest matching prefix of P in T . Proof. We show by induction that at cluster C the prefix P [1, i] matches the path from the root of T to top(C) and locusT (P ) ∈ C. If C is the root of TD the empty path to top(C) matches the empty prefix and locusT (P ) ∈ C = T . Inductively, suppose P [1, i] matches the path from the root to top(C) and locusT (P ) ∈ C. If m = i the longest prefix is thus P [1, m] and locusT (P ) = top(C). Correctness of Case 1 and Case 2 follows from Lemma 4. Consider Case 3 and let E and B be as in the description. By induction and correctness of spine extraction it follows that P [1, i + (cid:96)] matches the path from the root of T to top(B). By induction locusT (P ) ∈ C and thus locusT (P ) is a descendant of top(B) in C. Since top(B) is not a boundary node in E it follows that all ancestors of B in TD contains exactly the same edges out of top(B) as B. Hence, locusT (P ) ∈ B. Consider the time used in a vertical step from a cluster C . The time to compute the longest common prefix computation extracting (cid:96) characters and walking to the corresponding horizontal entry cluster hentry(vexit(C, (cid:96))) is O((cid:96) + h(C)− h(vexit(C, (cid:96)) + h(vexit(C, (cid:96)))− h(hentry(vexit(C, (cid:96)))) = O((cid:96) + h(C)− h(hentry(vexit(C, (cid:96)))). Hence, if we have z vertical steps from clusters C1, . . . , Cz extracting (cid:96)1, . . . , (cid:96)z characters ending in Ei = hentry(vexit(Ci, (cid:96)i)), respectively, we use time z(cid:88) (cid:32) z(cid:88) (cid:33) (cid:96)i + h(C1) − h(Ez) O((cid:96)i + h(Ci) − h(Ei)) = O = O(m + log nT ) . i=1 i=1 This follows from the fact that C1, . . . , Cz and E1, . . . , Ez all lie on the same root-to-leaf path in T and that h(Ei) ≥ h(Ci+1). As in Section 3, the total time used at horizontal merges is O(log nT ), as E1, . . . , Ez all lie on the same root-to-leaf path in T and we only walk down in the tree during the horizontal merges. This concludes the proof of the O(m + log n) query time in Theorem 1. 9 Figure 4: The tree decomposition for path extraction. The black nodes are the nodes in Ttop and the white nodes are the nodes in Tbot. The three root-to-leaf paths are stored as three linked lists sorted by increasing depth. The total size of the lists is 2 + 3 + 2 = 7. 6 Spine Path Extraction with Constant Overhead Next, we show how to achieve the O(m log σ) query time in Theorem 1. Our current solutions for horizontal merges (Case 2) from Section 3 and vertical merges (Case 3) from Section 5 both require Ω(m + log n) and hence we need new techniques for both cases to achieve the O(m log σ) time bound. We consider vertical merges in this section and horizontal merges in the next section. In this section, we improve the total time used on spine extraction to optimal O(m) time. To do so we first introduce and present a novel solution to a new path extraction problem on trees in Section 6.1 and then show how to use this to extract characters from the spine in Section 6.2. 6.1 Path Extraction in Trees Given a tree T with n nodes, the path extraction problem is to compactly represent T such that given a node v we can return the nodes on the path from the root of T to v in constant time per node. We require that the nodes are reported online and from top-to-bottom, that is, the nodes must be reported in sequence and we can stop the extraction at any point in time. The ordering of the nodes from top to bottom is essential. The other direction (from v to the root) is trivial since we can simply store parent pointers and traverse that path using linear space and constant time per node. If we allow word RAM tricks then we can easily solve the problem in the same bounds by using an existing level ancestor data structure [2, 12, 27]. We present an optimal solution that does not use word RAM tricks and works on a pointer machine. As mentioned in the introduction, an optimal solution can be also obtained by plugging in known tools, but we believe that our method is simpler and elegant. Let depth(v) and height(v) be the distance from v to the root and to deepest leaf in v's subtree, respectively. Decompose T into a top part Ttop consisting of nodes v, such that depth(v) ≤ height(v), and a bottom part Tbot consisting of the remaining nodes. For each leaf u in Ttop we store the path from the root of Ttop to u explicitly in a linked list sorted by increasing depth. (see Figure 4). Note that multiple copies of the same node may be stored across different lists. Each such path to a leaf u uses O(depth(u)) space, and hence the total space for all paths in Ttop is (cid:88) depth(u) ≤ (cid:88) height(u) = O(n) , u a leaf in Ttop u a leaf in Ttop where the first equality follows by definition of the decomposition and the second follows since the longest paths from a descendant leaf in T (u) to a leaf u in Ttop are disjoint for all the leaves u in Ttop. For all internal nodes in Ttop we store a pointer to a leaf below it. For all nodes v in Tbot we store a pointer to the unique ancestor v that is a leaf in Ttop. We answer a path extraction query for a node v as follows. If v is in Ttop we follow the leaf pointer and output the path stored in this leaf from the root until we reach v. If v is in Tbot we jump to the unique ancestor leaf u of v in Ttop. We extract the path from the root to u, while simultaneously following parent pointers from v until we reach u storing these nodes on a stack. That is, each time we extract a node from the root-to-u path we follow a parent pointer and put the 10 next node on the stack. We stop pushing nodes to the stack when we reach u. When we have output all nodes from the root to the leaf in Ttop we output the nodes from the stack. Since depth(u) ≤ height(u) the path from the root to u is at least as long as the path from v to u plus 1. Therefore, the whole path is extracted. We spend O(1) time per node and hence we have the following result. Lemma 8 Given a tree T with n nodes, we can solve the path extraction problem in linear space and preprocessing and constant time per reported node. 6.2 Optimal Spine Path Extraction We plug the path extraction solution into our depth-first search traversal of the vertical top DAG VD to speed up spine extraction and longest common prefix computation. Recall that given a vertical cluster C, our goal is to simulate a depth-first left-to-right order traversal of the subtree V(C) using the vertical top DAG VD. We construct the left-path suffix forest L of VD as follows. The nodes of L are the nodes of VD. If C has a left child A in VD then A is the parent of C in L. Hence, any leftmost path in VD corresponds to a path from a node to an ancestor of the node in L. We now store L with the path extraction data structure from Lemma 8. We implement the depth-first traversal as before except that whenever the traversal reaches an unexplored cluster C(cid:48) in V(C) we begin path extraction for that cluster corresponding to the path from C(cid:48) to the leftmost descendant leaf C. We extract the leaf C and then continue the depth-first traversal from there. Hence, the current search path of the depth-first traversal is partitioned into an alternating sequence of leftmost paths and right edges. Whenever we need to go up on a left edge in the traversal we extract the next node for the corresponding path extraction instance. To extract the topmost (cid:96) characters of spine(C) we now use constant time to find the leftmost descendant leaf of V(C) and then O((cid:96)) time to traverse the first (cid:96) leaves. Hence, we improve the time from O(height(V(C))+(cid:96)) to O((cid:96)). At any point during the traversal we maintain ongoing path extractions instances along the current search path. The stacks each of these need are of size at most linear in the length of their corresponding subpath of the search path and hence this requires at most O(log nVD) extra space. Lemma 9 We can represent the vertical top DAG VD in O(nVD) space such that given a vertical cluster C, we can support spine path extraction on C in O((cid:96)) time, where (cid:96) is the length of the extracted prefix of spine(C). 7 Horizontal Access We now show how to efficiently handle horizontal merges (Case 2). In the simple algorithm from Section 3 we use constant time at each horizontal merge leading to an O(log nT ) total time solution. Since we cannot afford O(log nT ) time we instead show how to handle all horizontal merges in O(m log σ) time. The key idea is to convert the problem into a variant of the random access problem for grammar compressed strings, and then design a linear-space logarithmic-query solution to the random access problem. We describe the random access problem in Section 7.1 and present our solution to it in Section 7.2, we introduce the horizontal top DAG in Section 7.3, and define and solve the horizontal access problem in Section 7.4. 7.1 Grammars and Random Access Grammar-based compression replaces a long string S by a small context-free grammar (CFG) G. We view a grammar G as a DAG, where each node is a grammar symbol and each rule defines directed ordered edges from the righthand side to the lefthand side. Given a node C in G, we define T (C) to be the parse tree rooted at C and S(C) to be the string consisting of the leaves of T (C) in left-to-right order. Note that given a rule C → C1C2 . . . Ck we have that S(C) = S(C1) · S(C2)··· S(Ck), where · denotes concatenation. Given a grammar G representing a string S, the random access problem is to compactly represent G while supporting fast access queries, that is, given an index i in S report S[i]. Bille et al. [20] showed how to do random access in O(log S) time using O(nG · αk(nG)) space2 on a 2Here αk(n) for any constant k denotes the inverse of the kth row of Ackermann's function, defined as αk(n) = 1 + αk(αk−1(n)) so that α1(n) = n/2, α2(n) = log n, α3(n) = log∗ n, and so on. 11 pointer machine model. Furthermore, given a node C in G, access queries can be supported on the string S(C) in time O(log S(C)). For our purposes, we need to slightly extend this result to gapped grammars. A gapped grammar is a grammar except that each internal rule is now of the form C → C1g1C2 . . . gk−1Ck, where gi is a non- negative integer called the gap. The string generated by G is now S(C) = S(C1)0g1 S(C2)··· S(Ck−1)0gk−1 S(Ck) and hence the resulting string generated is as before except for the inserted gaps of runs of 0's. Note that S(C) = S(C1) + g1 +S(C2) +··· + gk−1 +S(Ck. The above random access result is straightforward to generalize to gapped grammars: Lemma 10 (Bille et al. [20]) Let S be a string compressed into a gapped grammar S of size nS . Given a node v in S, we can support random access queries in S(v) in O(log(S(v))) time using O(nS · αk(nS )) space. The solution works on a pointer machine model of computation. 7.2 Horizontal Access in Linear Space Bille et al. [20] further showed that the inverse-Ackermann factor in the space complexity of Lemma 10 can be removed if we assume a word RAM model of computation. In this section we show that this can also be achieved on a pointer machine. To this end, we need to replace a single component in the solution of Bille et al., their weighted level ancestor structure. In the weighted level ancestor problem, we are given a tree T on n nodes with positive weights on the edges. For every node u ∈ T , let d(u) be its distance to the root, and let parent(u) be its parent. Then, the goal is to preprocess T to answer the following weighted level ancestor queries: given a non-root node u ∈ T and a positive number x ≤ d(u), find an ancestor v such that d(v) ≥ x but d(parent(v)) < x. Without getting into the proof of Lemma 10, it suffices to say that (1) performing a random access query boils down to performing O(log(S(v))) weighted level ancestor queries, and (2) in order for all these O(log(S(v))) queries to be done in total O(log(S(v))) time, the time for each weighted level d(v)−d(parent(v)) . Intuitively, we seek a position on an edge ancestor query should be proportional to log at distance x from the root, and the longer the found edge is the smaller the query time should be. We next show how to achieve such query time using linear space on a pointer machine, implying an inverse-Ackermann factor improvement to Lemma 10. d(u) d(u) Lemma 11 A tree T on n nodes can be preprocessed in O(n) space to answer a weighted level ancestor query for a node u ∈ T and a number x in O(1 + log d(v)−d(parent(v)) ) time, where v is the found ancestor of u. Proof. We start with partitioning T into slices. The ith slice, denoted Ti, consists of all nodes u ∈ T such that d(u) ∈ [2i, 2i+1). Observe that each Ti is a collection of trees. For each node u ∈ Ti, we store a pointer to an arbitrary descendant v such that no child of v belongs to Ti, denoted query(u) . In other words, v is a leaf in its corresponding tree of Ti (and also a descendant of u that belongs to the same tree of Ti). To answer a query for a node u ∈ Ti and a number x, we first replace u with query(u). This does not increase log(d(u)) by more than 1 and, because we replace u with its descendant, returns the same node. Thus, from now on we can assume that the input to a query is a node u ∈ Ti that is a leaf in its tree of Ti. For each such node, we store a pointer next(u) to the highest ancestor of u that still belongs to Ti. To answer a query for a node u ∈ Ti that is a leaf in its tree of Ti and a number x, we then check the following three cases: 1. x ≤ d(parent(next(u))), then we repeat with u replaced with parent(next(u)). 2. x > d(parent(next(u))) and x ≤ d(next(x)), then we return next(x). 3. x > d(next(u)), then we search for the answer among the ancestors of u in its tree of Ti. Observe that whenever Case 1 applies the value of log(d(u)) decreases by at least 1, and so it is enough to show how to separately preprocess each tree of Ti for weighted ancestor queries in O(1 + i− log(d(cid:48)(v)− d(cid:48)(parent(v)))) time, where v is the found node and d(cid:48)(v) is its distance to the root of the corresponding tree of Ti (note that the maximum value of d(cid:48)(v) is 2i). We can therefore focus on the following problem: preprocess a tree T with a parameter i such that d(u) ≤ 2i for every u ∈ T for weighted ancestor queries in O(1 + i − log(d(v) − d(parent(v)))) time, 12 Figure 5: Tree T with parameter i is decomposed into Ttop and Tbottom−. where v is the found ancestor of u, and u is always a leaf. The preprocessing proceeds recursively. We first partition T into the top part, denoted Ttop, and a collection of trees constituting the bottom part, denoted Tbottom. A node v ∈ T belongs to Ttop when d(v) ≤ 2i−1. Each leaf u ∈ Tbottom stores a pointer check(u) to its highest ancestor that still belongs to Tbottom. Let Tbottom− denote the collection of trees obtained by removing all leaves from Tbottom. Each leaf u ∈ Tbottom additionally stores a pointer top(u) to an arbitrary leaf in the subtree rooted at parent(check(u)) in Ttop, and a pointer bottom(u) to an arbitrary leaf in the subtree rooted at parent(u) in Tbottom−. We apply the above construction recursively with a parameter (i − 1) on Ttop and on every tree of Tbottom−. See Figure 5 for an illustration. To answer a query for a leaf u ∈ Tbottom and a number x, we check the following four cases: 1. x ≤ d(parent(check(u))), then we repeat with u replaced with top(u) in Ttop. 2. x > d(parent(check(u))) and x ≤ d(check(u)), then we return check(u). 3. x > d(parent(u)), then we return u. 4. x > d(check(u)) and x ≤ d(parent(u)), then we repeat with u replaced with bottom(u) and x decreased by d(check(u)) in the corresponding tree of Tbottom−. The cases are not mutually exclusive as it might happen that check(u) = u. Correctness of Case 2 and 3 is immediate. In Case 1 and 4 we recurse while maintaining the invariant that u is a leaf in the current tree, and the sought node is easily seen to belong to Ttop or Tbottom− (because we require x ≤ d(parent(u)) we can indeed consider Tbottom− instead of Tbottom), respectively. In every recursive step, the value of i decreases by 1. Also, if (cid:98)log(d(v) − d(parent(v)))(cid:99) = j then after i − j + 1 steps the edge from v to parent(v) cannot belong to the currently considered tree, and so there are at most i − j + 1 steps making the query time as required. To analyze the space, we assume that the partition into Tbottom and Ttop is only conceptual, and the stored information check(u), top(u) and bottom(u) is associated with a node u ∈ T . Because the leaves of Tbottom for which we need to store information are then removed and do not participate further in the construction, this is indeed possible and shows that the overall space is O(1) per node of T . Finally, even though we have only described how to answer a query for a leaf u ∈ Tbottom, the query algorithm rewritten to use the information stored at nodes of u ∈ T behaves as if u ∈ Tbottom and hence is correct. Corollary 1 Let S be a string compressed into a gapped grammar S of size nS . Given a node v in S, we can support random access queries in S(v) in log(S(v)) time using O(nS ) space. The solution works on a pointer machine model of computation. 13 2i−12i−1TtopTbottom−ucheck(u)bottom(u)top(u) 7.3 Horizontal Top Tree and Horizontal Top DAGs Similar to the vertical top forest we define the horizontal top forest H of T as a forest of ordered and rooted trees that consists of all horizontal clusters of T and leaves of T whose top boundary is shared with a horizontal cluster. We define the edges in of C in H as follows. Let C be a horizontal cluster C with children A and B in T . If A is a horizontal cluster or a leaf then the left child of C is A, and if A is a vertical cluster then the left child of C is hentry(A). Similarly, the right child of C is either B or hentry(B). See Figure 3. We have the following property of H. Lemma 12 Let C be a horizontal merge in H. Then, the leaves of H(C) are the edges to children of the top boundary node of C and the left-to-right ordering of the leaves correspond to the left-to-right ordering of the children of C in T . All nodes in H(C) has top(C) as top boundary node. Proof. By definition of H and the ordering of the children in T and H it follows that the edges to children of the top boundary node of C correspond to the leaves in H(C) in left-to-right order. Let C be a horizontal cluster with children A and B in T . Then top(A) = top(B) = top(C). Furthermore, by definition top(hentry(C)) = top(C). Hence, all nodes in H(C) has top(C) as top boundary node. For instance in Figure 3(c) the descendant leaves of C7 are a7, b8, c9, and d10 in left to right ordering corresponding to the edges to the children of top(C7). Given the horizontal top forest we define the horizontal top DAG HD as the DAG obtained by merging the subtrees of H according to the DAG compression of T into TD. 7.4 Gapped Grammars and Horizontal Access Let C be an internal cluster in H. The spine child of C is the unique child of C that contains the first edge of spine(C). A descendant cluster D of C is a spine descendant of C if all clusters on the path from C to D are spine children of their parent. Define the horizontal exit cluster for a horizontal cluster C and character α, denoted hexit(C, α), to be the highest cluster in H(C) that has the unique leaf in H(C) labeled α as a spine descendant. Given the horizontal top DAG HD, the horizontal access problem, is to compactly represent HD such that given a horizontal merge C and a character α ∈ Σ, we can efficiently determine if top(C) has an edge to a child labeled α within C and if so return the horizontal exit cluster hexit(C, α). In this section, we show how to solve the horizontal access problem in O(nHD) space and O(log σ) time. The characteristic vector of a cluster C is a binary string encoding the labels of edges to children of top(C). More precisely, given a character α ∈ Σ define rank(α) ∈ {1, . . . , σ} as the rank of α in the sorted order of characters of Σ. Also, given a cluster C in H define rank(C) to be the set of ranks of leaf labels in H(C). We define the characteristic vector S(C) recursively as follows. If C is a leaf cluster S(C) = 1 and if C is an internal cluster with children C1, . . . , Ck, then S(C) = S(C1)0g1S(C2)··· S(Ck−1)0gk−1S(Ck), where gi = min(rank(Ci+1)) − max(rank(Ci)) + 1. Note that S(C) ≤ σ for any cluster C. From the definition we have the following correspondence between the characteristic vector and the leaf labels of a cluster. Lemma 13 Given a cluster C in H and a character α ∈ Σ, α is a leaf label in H(C) iff S(C)[rank(α)− min(rank(C))] = 1. Let R1, . . . , Rz be the root clusters of the trees in H and note that if we add a virtual root cluster R as the parent of R1, . . . , Rz, H is a gapped parse tree for the string S = S(R1)··· S(Rz). Hence, the horizontal top DAG HD is a gapped grammar for the same string. By Lemma 13 we can determine if there is an edge labeled α out of top(C) in C using a random access query on the corresponding gapped grammar using time O(log S(C)) = O(log σ). If this edge exists, we can also find hexit(C, α) in the same time using similar ideas. More precisely, we have the following result. Lemma 14 Given a cluster C in H and a character α ∈ Σ we can solve the horizontal acces problem in O(nHD) space and O(log σ) time. Proof. By construction the characteristic vector of S(C) has length at most σ. Hence, by Corollary 1, we can determine if there is an edge α out of top(C) in C using O(nHD) space and O(log S(C)) = O(log σ) 14 time. If this is the case, we need to find hexit(C, α) in the same complexity. To do so, we augment the random access result of Corollary 1 as follows. We need the following definitions from Bille et al. [20] applied to HD to explain the approach. The heavy-path decomposition of HD partitions HD into heavy and light edges with the property that any root-to-leaf path in HD is decomposed into an alternating sequence of O(log σ) heavy paths and single light edges. The heavy-path suffix forest F of HD compactly encodes the heavy paths of HD in O(nHD) space and has the property that a subpath of a heavy path in HD uniquely corresponds to a path from a node v to an ancestor of v in F . Our random access solution from Corollary 1 on HD solves O(log σ) weighted ancestor queries on F using Lemma 11 and computes the alternating sequence of heavy subpaths and single light edges from C to the leaf cluster containing the edge labeled α. We construct a new contracted forest F (cid:48) from F as follows. Imagine we mark all the edges going to non-spine children in HD. Then, hexit(C, α) is the highest descendant of C whose path to the leaf containing α only consist of unmarked edges. Now mark the corresponding edges in F and construct F (cid:48) be contracting all unmarked edges. The weight of a contracted node is the weight of the highest of its included nodes in F . A weighted ancestor query on F (cid:48) now identifies the node corresponding to the lowest horizontal entry cluster on the heavy path in HD. Since we contract edges in F and reweigh them by adding the contracted edges the time for the weighted ancestor query is no more than the time for the corresponding query in F . To find hexit(C, α), we traverse the alternating sequence of heavy paths and light edges from top-to- bottom in HD to find the lowest marked edge whose lowest endpoint is hexit(C, α). At each heavy path we use a weighted ancestor query and at each light edge we simply check if it is marked. In total, this takes O(log σ) time. 8 An O(m log σ) Solution We can now plug in the spine extraction from Section 6.2 and the horizontal access from Section 7 into the simple algorithm from Section 3. Define the vertical entry cluster for a horizontal cluster C, denoted ventry(C), to be the highest vertical cluster or leaf cluster in T (C) that contains the first edge on spine(C). Our data structure consists of the data structure from Section 6.2 for spine path extraction and the data structure from Section 7.3 for horizontal access. Furthermore, we store for each vertical cluster in TD a pointer to its horizontal entry cluster and for each horizontal cluster a pointer to its vertical entry cluster. In total this uses O(nTD) space. To search we alternate between horizontal accesses using Lemma 14 and spine path extractions using Lemma 9. Instead of traversals to find entry clusters we jump directly using the new pointers. Specifically, we have the following modified algorithm: Initially, we search for P [1, m] starting at the root of TD. Suppose we have reached cluster C and have matched P [1, i]. If i = m we return m. Otherwise (i < m) there are three cases: Case 1: C is a leaf cluster. Let e be the edge stored in C. We compare P [i + 1] with the label of e. We return i + 1 if they match and otherwise i. Case 2: C is a horizontal cluster. Compute E = hexit(C, P [i+1]). If P [i+1] does not match return i. Otherwise, continue the search for P [i + 1, m] from ventry(E). Case 3: C is vertical cluster. We check if the first character on spine(C) matches P [i + 1]. If it does not we continue the algorithm from hentry(C). Otherwise, we extract characters from spine(C) in order to compute the length (cid:96) of the longest common prefix of spine(C) and P [i + 1, m] and the corresponding vertical exit cluster E = vexit(C, (cid:96) + 1). Continue the search for P [(cid:96) + 1, m] from hentry(E). Lemma 15 The algorithm correctly computes the longest matching prefix of P in T . Proof. We show by induction that at cluster C the prefix P [1, i] matches the path from the root of T to top(C) and locusT (P ) ∈ C. If C is the root of TD the empty path to top(C) matches the empty prefix and locusT (P ) ∈ C = T . Inductively, suppose P [1, i] matches the path from the root to top(C) 15 and locusT (P ) ∈ C. If m = i the longest prefix is thus P [1, m] and locusT (P ) = top(C). Correctness of Case 1 and Case 3 follows from Lemma 7. Consider Case 2. There are two cases. If P [i + 1] does not match, then by induction locusT (P ) = top(C) and we are done. Otherwise, top(C) has an edge to a child v labeled P [i + 1] in C and locusT (P ) is a descendant of v. Let E be as in the description. By Lemma 12 top(E) = top(C) and by the definition of ventry(E) we have top(ventry(E)) = top(E). Hence, by induction P [1, i] matches the path from the root of T to top(ventry(E)). Recall, that the horizontal exit cluster is the highest horizontal cluster in C that has P [i + 1] as a spine descendant. Hence, every cluster on the path from C to E has v and all descendants of v in C as internal nodes. In particular, locusT (P ) ∈ E and hence by definition locusT (P ) ∈ ventry(E). Consider the alternating sequence of horizontal accesses and spine extractions. Each time we go from a horizontal access to a spine extraction the current character of P must match the first character on the spine. Hence, each horizontal access is on a distinct character of P and the total number of horizontal accesses is at most m. By Lemma 14 it follows that the total time for horizontal accesses is O(m log σ). Since the sequence is alternating the number of spine extractions is at most m + 1. Hence, by Lemma 9 the total time for spine extractions is at most O(m). This concludes the proof of the O(m log σ) query time in Theorem 1. 9 Lower Bound case. In this section we prove Theorem 2. Namely, we show that any structure storing a set S of strings of total length n over an alphabet of size σ needs to perform Ω(min(m + log n, m log σ)) comparisons to decide if a given pattern string P [1, m] belongs to S. Every comparison should be of the form "P [i] ≤ c", where c is a character. Note that the size of the structure is irrelevant for us. We start with a technical lemma that is the gist of our lower bound. Lemma 16 For any σ ≥ 2 and m, any comparison-based algorithm that given a string P [1, m] over an i=1 P [i] = 0 (mod 2) needs to perform Ω(m log σ) comparisons in the worst alphabet of size σ checks if(cid:80)m Proof. The number of strings P [1, m] over an alphabet of size σ such that(cid:80)m that decides if(cid:80)m i=1 P [i] = 0 (mod 2) is at least σm−1(cid:98)σ/2(cid:99) ≥ σm/4. Consider the decision tree T corresponding to a comparison-based algorithm i=1 P [i] = 0 (mod 2) using less than m log σ − 2 comparisons in the worst case. Each node of T corresponds to a subset of possible inputs of the form [a1, b1] × . . . × [am, bm], in particular the root of T corresponds to [1, σ] × . . . × [1, σ] and its leaves correspond to disjoint subsets of inputs for which the answer is the same (yes or no) that together cover the whole [1, σ] × . . . × [1, σ]. Because the depth of T is assumed to be less than m log σ − 2, T contains less than 2m log σ−2 = σm/4 leaves, so there exists a leaf corresponding to a subset of inputs [a1, b1] × . . . × [am, bm] and two distinct strings i=1 Q[i] = 0 (mod 2) and P [i], Q[i] ∈ [ai, bi] for every i = 1, . . . , m. Because P [1, m] and Q[1, m] are distinct, there exists j such that P [j] (cid:54)= Q[j], and without losing generality P [j] < Q[j]. We define a new string P (cid:48)[1, m] by setting P (cid:48)[i] = P [i] for every i (cid:54)= j and i=1 P [i] = 1 (mod 2) and P (cid:48)[i] ∈ [ai, bi] for every i = 1, . . . , m, so the algorithm incorrectly decides that the answer for P (cid:48)[1, m] is the same as for P [1, m]. We proceed to the main part of the lower bound. Fix σ ≥ 2, n and m ≤ n. We consider two cases. P [1, m] and Q[1, m] such that (cid:80)m P (cid:48)[j] = P [j] + 1. Then(cid:80)m n ≥ mσm. The set S contains all strings P [1, m] such that(cid:80)m i=1 P (cid:48)[i] = 1 +(cid:80)m i=1 P [i] = (cid:80)m Ω(m log σ) comparisons. i=1 P [i] = 0 (mod 2). There are at most σm of such strings, and each of them is of length m, making their total length at most mσm ≤ n. Any structure that stores S and allows checking if a given pattern P [1, m] belongs to S implies i=1 P [i] = 0 (mod 2). By Lemma 16, this needs a comparison-based algorithm that checks if (cid:80)m (cid:96) ∈ [1, m)). Now the set S contains all strings P [1, m] such that (cid:80)(cid:96) comparison-based algorithm that checks if (cid:80)(cid:96) n < mσm. We choose the largest integer (cid:96) such that n ≥ mσ(cid:96) (by the assumption on n and m ≤ n, i=1 P [i] = 0 (mod 2) and P [(cid:96) + 1] = . . . = P [m] = 0. The total length of all such strings is at most mσ(cid:96) ≤ n. Any structure that stores S and allows checking if a given pattern P [1, m] belongs to S implies a i=1 P [i] = 0 (mod 2) and additionally P [(cid:96) + 1] = 16 a procedure that given a pattern P [1, (cid:96)] checks if (cid:80)(cid:96) . . . = P [m] = 0. When executed with P [1, m] = 0m the algorithm clearly needs to access every P [i] and so perform at least m comparisons. Additionally, the algorithm can be converted into i=1 P [i] = 0 (mod 2), which by Lemma 16 requires Ω((cid:96) log σ) comparisons. Combining these two lower bounds we obtain that Ω(m + (cid:96) log σ) comparisons are necessary. Rewriting the condition on (cid:96) and using the assumption that (cid:96) ≥ 1, we obtain (cid:96) = (cid:98)log(n/m)/ log σ(cid:99) ≥ 1/2 log(n/m)/ log σ, making our lower bound Ω(m + log(n/m)) = Ω(m − log m + log n) = Ω(m + log n). Combining the above two cases give us a lower bound of Ω(min(m+log n, m log σ)), because depending on the value of n we have a lower bound of either Ω(m log σ) or Ω(m + log n), thus the minimum of these two is always a correct lower bound. This proves Theorem 2. References [1] Peyman Afshani, Lars Arge, and Kasper Green Larsen. Higher-dimensional orthogonal range re- porting and rectangle stabbing in the pointer machine model. In Proc. 28th SoCG, pages 323 -- 332, 2012. [2] Stephen Alstrup and Jacob Holm. Improved algorithms for finding level ancestors in dynamic trees. In Proc. 27th ICALP, pages 73 -- 84, 2000. [3] Stephen Alstrup, Jacob Holm, Kristian De Lichtenberg, and Mikkel Thorup. Maintaining informa- tion in fully dynamic trees with top trees. ACM Trans. Algorithms, 1(2):243 -- 264, 2005. [4] J-I Aoe. An efficient digital search algorithm by using a double-array structure. IEEE Trans. Soft. Eng., 15(9):1066 -- 1077, 1989. [5] Julian Arz and Johannes Fischer. Lz-compressed string dictionaries. In Proc. 24th DCC, pages 322 -- 331, 2014. [6] Julian Arz and Johannes Fischer. Lempel -- ziv-78 compressed string dictionaries. Algorithmica, pages 1 -- 36, 2018. [7] Nikolas Askitis and Ranjan Sinha. Engineering scalable, cache and space efficient tries for strings. The VLDB Journal, 19(5):633 -- 660, 2010. [8] Djamal Belazzougui, Paolo Boldi, and Sebastiano Vigna. Dynamic z-fast tries. In Proc. 17th SPIRE, pages 159 -- 172, 2010. [9] Djamal Belazzougui, Fabio Cunial, Travis Gagie, Nicola Prezza, and Mathieu Raffinot. Composite repetition-aware data structures. In Proc. 26th CPM, pages 26 -- 39, 2015. [10] Djamal Belazzougui, Travis Gagie, Pawel Gawrychowski, Juha Karkkainen, Alberto Ord´onez, Si- mon J Puglisi, and Yasuo Tabei. Queries on lz-bounded encodings. In Proc. 25th DCC, pages 83 -- 92, 2015. [11] Djamal Belazzougui, Travis Gagie, Simon Gog, Giovanni Manzini, and Jouni Sir´en. Relative fm- indexes. In Proc. 21st SPIRE, pages 52 -- 64, 2014. [12] Michael A. Bender and Martin Farach-Colton. The level ancestor problem simplified. Theoret. Comput. Sci., 321(1):5 -- 12, 2004. [13] David Benoit, Erik D Demaine, J Ian Munro, Rajeev Raman, Venkatesh Raman, and S Srinivasa Rao. Representing trees of higher degree. Algorithmica, 43(4):275 -- 292, 2005. [14] Samuel W. Bent, Daniel D. Sleator, and Robert E. Tarjan. Biased search trees. SIAM J. Comput., 14(3):545 -- 568, 1985. [15] Philip Bille, Mikko B. Ettienne, Inge Li Gørtz, and Hjalte W. Vildhøj. Time-space trade-offs for lempel-ziv compressed indexing. Theor. Comput. Sci., 713:66 -- 77, 2018. 17 [16] Philip Bille, Finn Fernstrøm, and Inge Li Gørtz. Tight bounds for top tree compression. In Proc. 24th SPIRE, pages 97 -- 102, 2017. [17] Philip Bille, Pawe(cid:32)l Gawrychowski, Inge Li Gørtz, Gad M. Landau, and Oren Weimann. Top tree compression of tries. In Proc. 30th ISAAC, 2019. [18] Philip Bille, Inge Li Gørtz, and Frederik Rye Skjoldjensen. Deterministic indexing for packed strings. In Proc. 28th CPM, 2017. [19] Philip Bille, Inge Li Gørtz, Oren Weimann, and Gad M. Landau. Tree compression with top trees. Inf. Comput., 243:166 -- 177, 2015. Announced at ICALP 2013. [20] Philip Bille, Gad M. Landau, Rajeev Raman, Kunihiko Sadakane, Srinivasa Rao Satti, and Oren Weimann. Random access to grammar-compressed strings and trees. SIAM J. Comput., 44(3):513 -- 539, 2015. Announced at SODA 2011. [21] Barnard Chazelle. Lower bounds for orthogonal range searching: I. the reporting case. J. ACM, 37(2):200 -- 212, 1990. [22] Bernard Chazelle and Burton Rosenberg. Simplex range reporting on a pointer machine. Comput. Geom., 5(5):237 -- 247, 1996. [23] Anders R. Christiansen and Mikko B. Ettienne. Compressed indexing with signature grammars. In Proc. 13th LATIN, pages 331 -- 345, 2018. [24] Francisco Claude and Gonzalo Navarro. Self-indexed grammar-based compression. Fundamenta Informaticae, 111(3):313 -- 337, 2011. [25] Francisco Claude and Gonzalo Navarro. Improved grammar-based compressed indexes. In Proc. 19th SPIRE, pages 180 -- 192, 2012. [26] John J Darragh, John G Cleary, and Ian H Witten. Bonsai: a compact representation of trees. Softw. Pract. Exper., 23(3):277 -- 291, 1993. [27] Paul F. Dietz. Finding level-ancestors in dynamic trees. In Proc. 2nd WADS, pages 32 -- 40, 1991. [28] Peter J. Downey, Ravi Sethi, and Robert E. Tarjan. Variations on the common subexpression problem. J. ACM, 27(4):758 -- 771, 1980. [29] Bartlomiej Dudek and Pawe(cid:32)l Gawrychowski. Slowing down top trees for better worst-case compres- sion. In Proc. 29th CPM, pages 16:1 -- 16:8, 2018. [30] Andrea Farruggia, Travis Gagie, Gonzalo Navarro, Simon J Puglisi, and Jouni Sir´en. Relative suffix trees. Comput. J., 61(5):773 -- 788, 2017. [31] Edward Fredkin. Trie memory. Commun. ACM, 3(9):490 -- 499, 1960. [32] Travis Gagie, Pawe(cid:32)l Gawrychowski, Juha Karkkainen, Yakov Nekrich, and Simon J. Puglisi. A faster grammar-based self-index. In Proc. 6th LATA, pages 240 -- 251, 2012. [33] Travis Gagie, Pawe(cid:32)l Gawrychowski, Juha Karkkainen, Yakov Nekrich, and Simon J. Puglisi. LZ77- based self-indexing with faster pattern matching. In Proc. 11th LATIN, pages 731 -- 742, 2014. [34] Roberto Grossi and Giuseppe Ottaviano. Fast compressed tries through path decompositions. ACM J. Exp. Alg., 19:3 -- 4, 2015. [35] Roberto Grossi and Jeffrey Scott Vitter. Compressed suffix arrays and suffix trees with applications to text indexing and string matching. SIAM J. Comput., 35(2):378 -- 407, 2005. [36] Torben Hagerup. Sorting and searching on the word RAM. In Proc. 15th STACS, pages 366 -- 398, 1998. [37] Meng He, J. Ian Munro, and Gelin Zhou. Data structures for path queries. ACM Trans. Algorithms, 12(4):53:1 -- 53:32, 2016. 18 [38] Robert Hood and Robert Melville. Real-time queue operation in pure LISP. Inf. Process. Lett., 13(2):50 -- 54, 1981. [39] Lorenz Hubschle-Schneider and Rajeev Raman. Tree compression with top trees revisited. In Proc. 14th SEA, pages 15 -- 27, 2015. [40] Shunsuke Kanda, Kazuhiro Morita, and Masao Fuketa. Compressed double-array tries for string dictionaries supporting fast lookup. Knowl. Inf. Syst., 51(3):1023 -- 1042, 2017. [41] Shunsuke Kanda, Kazuhiro Morita, and Masao Fuketa. Practical implementation of space-efficient dynamic keyword dictionaries. In Proc. 24th SPIRE, pages 221 -- 233, 2017. [42] Juha Karkkainen and Esko Ukkonen. Lempel-Ziv parsing and sublinear-size index structures for string matching. In Proc. 3rd WSP, pages 141 -- 155, 1996. [43] Richard M. Karp and Michael O. Rabin. Efficient randomized pattern-matching algorithms. IBM Journal of Research and Development, 31(2):249 -- 260, 1987. [44] Donald E. Knuth, Jr. James H. Morris, and Vaughan R. Pratt. Fast pattern matching in strings. SIAM J. Comput., 6(2):323 -- 350, 1977. [45] Donald Erwin Knuth. The Art of Computer Programming, Volume 1. Addison Wesley, 1969. [46] Veli Makinen. Compact suffix array -- a space-efficient full-text index. Fundamenta Informaticae, 56(1-2):191 -- 210, 2003. [47] Veli Makinen and Gonzalo Navarro. Succinct suffix arrays based on run-length encoding. Nordic J. Comput., 12(1):40 -- 66, 2005. [48] Veli Makinen, Gonzalo Navarro, Jouni Sir´en, and Niko Valimaki. Storage and retrieval of individual genomes. In Proc. 13th RECOMB, pages 121 -- 137, 2009. [49] Veli Makinen, Gonzalo Navarro, Jouni Sir´en, and Niko Valimaki. Storage and retrieval of highly repetitive sequence collections. J. Comp.Bio., 17(3):281 -- 308, 2010. [50] Gonzalo Navarro and Veli Makinen. Compressed full-text indexes. ACM Comput. Surv., 39(1), 2007. [51] Gonzalo Navarro and Nicola Prezza. Universal compressed text indexing. Theor. Comput. Sci., 762:41 -- 50, 2019. [52] Takaaki Nishimoto, I Tomohiro, Shunsuke Inenaga, Hideo Bannai, and Masayuki Takeda. Dynamic index and lz factorization in compressed space. Disc. App. Math., 2019. [53] Andreas Poyias and Rajeev Raman. Improved practical compact dynamic tries. In Proc. 22nd SPIRE, pages 324 -- 336, 2015. [54] Franco P Preparata and Se June Hong. Convex hulls of finite sets of points in two and three dimensions. Communications of the ACM, 20(2):87 -- 93, 1977. [55] Rajeev Raman, Venkatesh Raman, and Srinivasa Rao Satti. Succinct indexable dictionaries with applications to encoding k-ary trees, prefix sums and multisets. ACM Trans. Algorithms, 3(4):43, 2007. [56] Kunihiko Sadakane. Compressed text databases with efficient query algorithms based on the com- pressed suffix array. In Proc. 11th ISAAC, pages 410 -- 421, 2000. [57] Jouni Sir´en, Niko Valimaki, Veli Makinen, and Gonzalo Navarro. Run-length compressed indexes are superior for highly repetitive sequence collections. In Proc. 15th SPIRE, pages 164 -- 175, 2008. [58] Takuya Takagi, Keisuke Goto, Yuta Fujishige, Shunsuke Inenaga, and Hiroki Arimura. Linear-size In Proc. 24th SPIRE, pages cdawg: new repetition-aware indexing and grammar compression. 304 -- 316, 2017. 19 [59] Takuya Takagi, Shunsuke Inenaga, Kunihiko Sadakane, and Hiroki Arimura. Packed compact tries: IEICE Trans. on Fund. Elect., A fast and efficient data structure for online string processing. Comm. and Comp. Sci., 100(9):1785 -- 1793, 2017. [60] Robert Endre Tarjan. A class of algorithms which require nonlinear time to maintain disjoint sets. J. Comput. System Sci., 18(2):110 -- 127, 1979. [61] Kazuya Tsuruta, Dominik Koppl, Shunsuke Kanda, Yuto Nakashima, Shunsuke Inenaga, Hideo arXiv preprint Bannai, and Masayuki Takeda. Dynamic packed compact tries revisited. arXiv:1904.07467, 2019. [62] Susumu Yata. Dictionary compression by nesting prefix/patricia tries. In Proc. 17th Meeting of the Association for Natural Language, 2011. [63] Naoki Yoshinaga and Masaru Kitsuregawa. A self-adaptive classifier for efficient text-stream pro- cessing. In Proc. 25th COLING, pages 1091 -- 1102, 2014. 20
1803.07813
2
1803
2018-08-30T10:44:30
Introducing higher order correlations to marginals' subset of multivariate data by means of Archimedean copulas
[ "cs.DS", "stat.CO" ]
In this paper, we present the algorithm that alters the subset of marginals of multivariate standard distributed data into such modelled by an Archimedean copula. Proposed algorithm leaves a correlation matrix almost unchanged, but introduces a higher order correlation into a subset of marginals. Our data transformation algorithm can be used to analyse whether particular machine learning algorithm, especially a dimensionality reduction one, utilises higher order correlations or not. We present an exemplary application on two features selection algorithms, mention that features selection is one of the approaches to dimensionality reduction. To measure higher order correlation, we use multivariate higher order cumulants, hence to utilises higher order correlations be to use the Joint Skewness Band Selection (JSBS) algorithm that uses third-order multivariate cumulant. We show the robust performance of the JSBS in contrary to the poor performance of the Maximum Ellipsoid Volume (MEV) algorithm that does not utilise such higher order correlations. With this result, we confirm the potential application of our data generation algorithm to analyse a performance of various dimensionality reduction algorithms.
cs.DS
cs
Introducing higher order correlations to marginals' subset of multivariate data by means of Archimedean copulas Krzysztof Domino∗1 and Adam Glos1,2 1Institute of Theoretical and Applied Informatics, Polish Academy of Sciences, Bałtycka 5, 44-100 Gliwice, Poland 2Institute of Informatics, Silesian University of Technology, ul. Akademicka 16, 44-100 Gliwice, Poland August 31, 2018 Abstract In this paper, we present the algorithm that alters the subset of marginals of multi- variate standard distributed data into such modelled by an Archimedean copula. Proposed algorithm leaves a correlation matrix almost unchanged, but introduces a higher order cor- relation into a subset of marginals. Our data transformation algorithm can be used to analyse whether particular machine learning algorithm, especially a dimensionality reduc- tion one, utilises higher order correlations or not. We present an exemplary application on two features selection algorithms, mention that features selection is one of the approaches to dimensionality reduction. To measure higher order correlation, we use multivariate higher order cumulants, hence to utilises higher order correlations be to use the Joint Skewness Band Selection (JSBS) algorithm that uses third-order multivariate cumulant. We show the robust performance of the JSBS in contrary to the poor performance of the Maximum El- lipsoid Volume (MEV) algorithm that does not utilise such higher order correlations. With this result, we confirm the potential application of our data generation algorithm to analyse a performance of various dimensionality reduction algorithms. Keywords: Archimedean copulas, Higher order correlations, Cumulant tensors, Dimensionality reduction, Joint Skewness Band Selection, Data generation. 1 Introduction While analysing real-life multivariate data such as financial data, e-commerce data, biomedical data, audio signals or high resolution images [1 -- 5], we have many features that carry valuable information. However, if a number of features is large, the computational cost of proceeding such data is high. To transfer such data to a smaller set of features, in such a way that most of the meaningful information is preserved, we can use a dimensionality reduction scheme [6]. Many dimensionality reduction schemes asses the importance of features by analysing their correlation or covariance. Hence, assuming that data follow a multivariate Gaussian distribution [7]. Such methods may be ineffective if dealing with information hidden in higher order correlations. As an example, one can consider the Principal Component Analysis (PCA) [8] that converts data into a subset of independent features via linear transformations determined by the eigenvectors of a covariance matrix. The PCA works well on data for which the second order correlations ∗[email protected] 1 dominate. However, the real data may possess higher order dependencies [9 -- 12], which in turn may change the optimal result. While it is usually easy to determine how higher correlations are considered for statistics based algorithm, in more advanced machine-learning algorithms it is not obvious to what ex- tend higher order correlations influence the output. As a straight example consider a Kernel enhanced PCA [13,14] or Kernel enhanced discriminant analysis [15], where the method's utility depends on the particular choice of the Kernel function given a particular data set. For further discussion of non linear dimensionality reduction algorithms see also [16]. There is as well a neural network approach to dimensionality reduction [17] where a dimensionality reduction for an outlier detection was performed by means of a neural networks on both artificially generated and real data. Another neural networks example that uses auto-encoders is discussed in [18,19]. The properly configured neural network (using auto-encoders) detects subtle anomalies success- fully, but the PCA fails. This suggest the sensitivity of such neural networks on higher order correlations. The main contributions of the presented work is the algorithm transforming multivariate Gaussian distributed data into non-Gaussian distributed one. We argue that such algorithm may be applicable to analyse various dimensionality reduction algorithms. More precisely, we present a method of transforming Gaussian distributed data into such with higher order correlations inside a chosen subset of marginals, but with a covariance (second order correlations) similar to those of original data. This is done by means of various Archimedean copulas [20], hence in addition all univariate marginal distributions are unchanged. In order to show that our method works properly, we have tested it on two distinct features selection algorithms: the MEV (Maximum Ellipsoid Volume) [21], that select features (a subset of marginals) on a basis of second order correlations, and the JSBS (Joint Skewness Band Selection) [22], that select features on a basis of third order correlations. To measure this correlations we use second and third order multivariate cumulants. We show that in contrary to MEV the JSBS can detect a subset of marginals that exhibit higher order correlations. The MEV is ineffective since the covariance matrix is almost unchanged by a data transformation. To provide the tool for machine-learning scientists, the presented algorithm is implemented in the Julia programming language [23] and is available on a GitHub repository [24]. The Julia is high level programming language, suitable for scientific computations, because it is open source and the code can be analysed and reviewed by scientist. Apart from this, linear operations and random sampling operations implemented in the Julia takes significantly less of the processor time than similar operations implemented in other well known programming languages, see [23]. Finally Julia is easily accessible from Pyhon containing a large collection of machine-learning tools. The paper is organized as follows. In Sec. 2 we provides basic facts concerning multivari- ate distribution and feature discrimination algorithms. In Sec. 3 we present and analyse our algorithm using MEV and JSBS algorithms. In Sec. 4 we sum up our results and discuss its applications and extensions. 2 Preliminaries To measure higher order correlations between features we use higher order multivariate cu- mulants. A multivariate cumulant is a multivariate extension of corresponding univariate cu- mulant [25]. As such a multivariate cumulant of order d can be represented in a form of a super-symmetric tensor M d ∈ R[n,d] [26, 27]. Such cumulant's tensor is the d-dimensional array indexed by i = (i1, . . . , id). The super-symmetry means here, that each permutation within i gives the index that refers to the same value of the tensor as i. Note that the first cumulant is an expectation and the second is a covariance matrix, that both fully describe Gaussian multivari- ate distribution. Importantly for Gaussian multivariate distribution cumulants of order higher 2 Table 1: Definition of Gumbel, Clayton and Ali-Mikhail-Haq copulas, and a possible correlation values. Note that Spearman's correlation ρ does not depend on choice of univariate marginal distributions. Copula name Gumbel Clayton AMH θ values ψθ(t) [1,∞) exp(−t 1 θ ) −1 (0,∞) (1 + t) θ 1−θ (0, 1) exp(t)−θ ρ values [0, 1) (0, 1) (0, 1/2) than 2, called higher order cumulants, are zero [28, 29]. Concluding we have zero higher order correlations there. Non-zero higher order correlations can be introduced by means of copulas. A copula C(u) : [0, 1]n → [0, 1] is a join multivariate cumulative distribution function with uniform marginal on a [0, 1] segment [30]. A sub-copula Cr at index r = (r1, . . . , rk) ⊂ (1, . . . , n) is a joint multivariate cumulative distribution of a r subset of marginals. There is an important family of copulas called Archimedean copulas, recently used to model various types of real life data such as: financial data [31 -- 34], hydrological data [35, 36], signals [37], wireless communication data [38] or biomedical data [39]. The Archimedean copula is introduced by a copula generator function ψ. Let ψθ : [0,∞) → [0, 1] be continuous function, parametrised by θ, such that ψθ(0) = 1 and θ ({0})], where ψ−1 ψθ(∞) = 0. Furthermore let ψθ be a strictly decreasing function on [0, inf ψ−1 is its pseudoinverse fulfilling ψ−1(0) = inf{u : ψ(u) = 0}. Finally let ψθ be the n-monotone in [0,∞) according to Definition 2.3 in [20]. Having introduced the generator function, the Archimedean copula takes the following form θ [0, 1] (cid:51) C(u) = ψ ψ−1(ui) , (1) (cid:33) (cid:32) n(cid:88) i=1 (cid:90) 1 (cid:90) 1 where u ∈ [0, 1]n. Well known examples of Archimedean copulas are Gumbel, Clayton and Ali- Mikhail-Haq (AMH) [40] ones. All of them are parametrized by a single real-value parameter θ. A properties of those copulas are presented in Table 1. The Spearman's correlation between marginal variables Xi1,Xi2 modelled by a copula C takes the form [41] 0 0 ρ(Xi1,Xi2) = 12 (2) where C(i1,i2) is a sub-copula for marginal variables Xi1 and Xi2. For copulas presented in Tab. 1 the Spearman's correlation depends monotonically on the θ parameter, and hence uniquely de- termines it, see Fig. 1. However for Archimedean copulas such bivariate Spearmann's correlation do not carry all information about dependency between marginals. C(i1,i2)(u1, u2)du1du2 − 3, In contrary to multivariate Gaussian distribution, higher order cumulants for Archimedean copula are not necessarily zero tensors, see Fig. 2. This fact implies higher order dependence between marginals. Due to its symmetry, an Archimedean copula with identical univariate marginal distributions produces only three distinct elements of the 3rd cumulant's tensor. Those are the super-diagonal element, the partial-diagonal one and the off-diagonal one. The covariance matrix of such copula model that have only two distinct elements: the diagonal one and the off-diagonal one. For sampling Archimedean copulas we use modified Marshall-Olkin Algorithm. The orig- inal algorithm is presented in Alg. 1. Note that the algorithm requires sample of inverse Laplace -- Stieltjes transform L−1 of the Archimedean copula generator ψθ. ψθ 3 (a) Clayton (b) Gumbel (c) AMH Figure 1: Relation between copula's parameter θ and Spearman's correlation given by Eq. (2) for various Archimedean copulas. Algorithm 1 Marshall-Olkin algorithm [43, 44] sampling an Archimedean copula. 1: Input: ψθ -- generating function of the Archimedean copula, x -- k samples of U (0, 1) distribution, y -- sample of U (0, 1) distribution. v = quantileL−1(ψθ)(y) k = length(x) for i = 1, . . . , k do 2: Output: sample of Archimedean copula. 3: function arch_sampler(ψθ, x, v) 4: 5: 6: 7: 8: 9: 10: end function end for return (u1, . . . , uk) ui ← ψθ (cid:16)− log(xi) (cid:17) v 2.1 MEV and JSBS algorithms Having introduced multivariate cumulants we can discuss now cumulants based features selection algorithms. Let Rt×n (cid:51) X = (X1, . . . , Xn) = (x1, . . . , xt) (cid:124) be the n dimensional sample from the random vector X = (X1, . . . ,Xn). Here Xi = (x1,i, . . . xt,i) (cid:124) ∈ Rt is a vector of t realisations of ith feature (marginal) while xl = (xl,i, . . . xl,n) ∈ Rn a single realisation of X . The feature selection algorithm chooses a subset {Xi1, . . . ,Xik}, which should provide as much information as possible comparing to original X . Alternatively the feature selection problem can be understood as providing new order of marginals (Xj1, . . .Xjn), which represents their importance. Then for fixed k subset {Xj1,Xj2, . . . ,Xjk} are a representative collection of the original X . MEV (Maximum Ellipsoid Volume) [21] is a feature selection algorithm, that iteratively removes the least informative variable. The choice bases on the maximisation of a hyper-ellipsoid volume in a eigenvector space of a covariance matrix of reminding marginals. In details for each marginal variable Xi the algorithm computes a determinant of subcovariance matrix which is constructed from the original one by removing i-th column and row. The variable, which provides smallest determinant is considered to be the least informative at this point. Then the MEV algorithm recursively searches for consecutive variable in remaining collection. This procedure provides the information order of marginal variables. However, as described above, the MEV algorithm is based on the covariance matrix being a second cumulant of multivariate data. Hence if for some subset of marginals cumulant of higher order is non-zero, it may be 4 02468101.00.50.00.51.0Spearman correlation02468101.00.50.00.51.0Spearman correlation0.00.51.01.00.50.00.51.0Spearman correlation (a) Clayton copula. (b) Gumbel copula. (c) AMH copula. Figure 2: Distinguishable elements of 3th cumulant tensor for Archimedean copulas with Gaus- sian standard univariate marginals, computed for t = 106 samples. Due to symmetry properties of the Archimedean copulas only 3 elements are distinguishable: the super-diagonal element at index i = (1, 1, 1), the partial-diagonal element at index i = (1, 1, 2) and the off-diagonal element at index i = (1, 2, 3). In a case of the Clayton copula we present theoretical outcomes [42] that are consistent with simulation ones, errors of simulation outcomes are negligible. The super- diagonal element values are zero due to univariate Gaussian marginals. Apart from this other cumulants' elements are non-zero. ignored by the MEV algorithm. The JSBS [22] algorithm is a natural extension of MEV algorithm, which analyse the third- order multivariate cumulant. Since such cumulant can be represented as the 3-mode tensor, for which determinant is not well defined, in [22] authors have optimized the following target function: (cid:104) (cid:118)(cid:117)(cid:117)(cid:116) det (1))(cid:62)(cid:105) M3 (1)(M3 det3(M2) JS(X) = , (3) where M3 (1) is an unfolded third cumulant M 3 in mode 1 and M2 is a covariance matrix. As cumulants are super-symmetric [26, 27], it is not important in which mode they are unfolded. 5 0.00.20.40.60.81.0Spearman between marginals0.40.30.20.10.0cumulant elementi=(1,2,3)i=(1,1,2)i=(1,1,1)0.00.20.40.60.81.0Spearman between marginals0.00.10.20.3cumulant element0.00.10.20.30.40.5Spearman between marginals0.30.20.10.00.1cumulant element The JS (Joint Skewness) can be interpreted as product of singular values taken from HOSVD of the third cumulant's tensor divided by the product of the covariance matrix eigenvalues raised to power 3. 3 The algorithm In this section we propose and analyse algorithm, which transforms part of the normally dis- tributed data. Our goal is to replace part of the originally Gaussian data by samples distributed according to various copulas. Our algorithm allows replacing arbitrary subset of marginal vari- ables of size k by chosen Archimedean copula. In particular we focused on copulas presented in Sec. 2. We use proposed algorithm to show difference between detection using the MEV and the JSBS algorithm. 3.1 Data malformation algorithm Suppose we have X ∈ Rt×n that are t samples from Gaussian n-variate distribution and we want to replace all realisations of i1, . . . , ik marginals, i.e. Xi1, . . . , Xik by X(cid:48) modelled by Archimedean k-variate copula, but leave unchanged other marginals i.e. those indexed by {1, . . . , n}\{i1, . . . , ik}. If we denote new data by X(cid:48), ideally we would expect cor(X) = cor(X(cid:48)) to make a transformation hard to detect by methods using the second order correlations only. Our algorithm, presented in Alg. 2, takes several steps: first data are standardized, so all marginal variables have zero mean and variance 1. Then based on these we produce new t samples of (k + 1)-variate random vector with independent marginals, all distributed accord- ing to U (0, 1) i.e. uniform distribution on [0, 1]. Those new core samples are generated in an information preserving way using Alg. 3 or naively for reference. Then the parametrization θ of Archimedean copula is derived. New samples are produced by means of Alg. 1 given core samples and the θ parameter. Finally original univariate distributions (Gaussian in our case) are recovered. , . . . , X(cid:48) ik i1 Let us first focus on the parameter θ derivation. While several approaches can be considered here, our method bases on the fact that correlation matrix of the Archimedean copula is constant outside the diagonal. We calculate the mean value of an upper-triangle of the Spearman's correlation matrix of data [Xi1, Xi2, . . . , Xik ], and then recover the θ value thanks to Eq. (2). Now let us consider the second part of the algorithm, which is presented in Alg. 3. Ob- serve first, that Alg. 1 converts k + 1 samples of U (0, 1) distribution into a sample of k-variate Archimedean copula. The naive approach would be to generate independently elements of Xcore ∈ [0, 1]t×(k+1) from U (0, 1) distribution, and transform them using Alg. 1 to t samples of k-variate Archimedean copula. Finally one transforms univariate marginals by quantile func- tions of original univariate frequency distributions (Gaussian in our case) to X(cid:48) . Such naive approach preserves univariate marginal distributions due to the copula approach, and roughly preserves a correlation inside a subset i1, . . . , ik if copula parameter is chosen properly, but results in almost no correlation between changed and not-changed marginals. This implies cor(X) (cid:54)≈ cor(X(cid:48)), which would made a detection easy for methods based on the second order correlation (the covariance matrix). To overcome this problem we need to collect information about the general correlation be- tween subsets of k changed and n − k non changed marginals and input it into Alg. 1. To store such information we use the (k + 1)th column of Xcore matrix i.e. the vector Xcore k+1 and substitute its elements for y in Alg. 1. In this algorithm we use a function , . . . , X(cid:48) ik i1 (cid:18)− log(xi) (cid:19) v f (xi, v) = ψθ (4) to compute a sample of ith marginal of the Archimedean copula. By the Archimedean copula generator definition, such function is strictly increasing in v for an arbitrary constant xi ∈ (0, 1). 6 Furthermore, v is a sample of inverse Laplace -- Stieltjes transform of the copula generator L−1 , ψθ which is the CDF function for the range of θ considered in this paper, see Tab. 1 and [44]. Its inverse (a quantile function) quantileL−1(ψθ) is strictly increasing if L−1 is continuous and non- decreasing if L−1 is discrete. Hence the composition f (quantileL−1(ψθ)(y)) is strictly increasing , and non-decreasing for discrete L−1 for continuous L−1 ψθ ψθ ψθ ψθ . In a case of the Gumbel and the Clayton copula we have [44] (cid:90) ∞ −∞ ψθ(s) = e−svdL−1 ψθ (v) = E(cid:0)e−sV(cid:1) (5) . ψθ ψθ ψθ for s ∈ [0,∞), where V is a random variable that is distributed according to L−1 In this case, if we extract most of information about the correlation between k changed and n − k unchanged marginals into vector Xcore k+1, we can carry this information (in a sense of ordering) through Alg. 1. In a case of the AMH copula we have discrete L−1 fulfilling a discrete version of the transform. In this case some information may be lost, since the function in not strictly increasing. Finally let us take a particular case of the Gumbel copula where L−1 is a Lévy stable distribution [44] without analytical form. Still, its element-wise sampling is discussed in [45,46]. Hence we sample t realisations of appropriate Lévy stable distribution using [45,46] and sort an outcome according to X core k+1. Such generated data is used in Alg 1. Since for large t outcome would converge to those from quantile function, we found our approach well motivated. This approach can be used for other copulas not considered in this paper, for which L−1 is not known. Following this discussion, our approach to preserve a correlation between k changed marginals and n− k unchanged marginals concerns preparing Xcore from data included in k marginals that are changed. For the sake of Alg. 1, Xcore must contain t realisations of k + 1 independent uniform marginals [43, 44]. However those marginals can be correlated with reminding n − k marginals of unchanged data, which should be preserve in changed data. Hence in Alg. 3 the eigenvector decomposition is performed in such a way that (k + 1)th eigenvalue is highest, i.e. (k + 1)th marginal carries largest information. We include this information in X core k+1. Note that function (4) is strictly increasing in xi for constant v ∈ (0, 1) as well. Hence substituting elements of Xcore for x in Alg. 1 will carry an information through the Algorithm as well. We call it local information since Xcore correspond to the ith marginal of the Archimedean copula. It is in contrary to Xcore k+1 that carry global information via v in Equation (4). Concluding, in our approach the global information is more significant that the local one. , . . . , Xcore ψθ k 1 i Algorithms presented here are implemented in a Julia programming language [23] and can be found on a GitHub repository [24], see gcop2arch function therein. 3.2 MEV vs JSBS algorithms In this section we show, that our algorithm generates data which distinguishes MEV and JSBS al- gorithms. Our experiment is based on 100-dimensional vector. We chose random covariance ma- trix Σ with ones on a diagonal, and generate 105 multivariate normal samples with 0 mean vector and covariance Σ. The covariance matrix was chosen as follows. First we chose M ∈ Rn×n, which elements are distributed according to uniform distribution U (0, 1). Let DM = diagm(MM(cid:62)) be diagonal matrix of MM(cid:62). Our covariance matrix take form Σ = DM − 1 2 MM(cid:62)DM Then 8 random variables were changed according to our algorithm, using both core pre- sented in Alg. 3 and core_naive, which generates samples according to uniform distribution. First kind of samples was considered using MEV and JSBS algorithms, second kind were anal- ysed using MEV algorithm only. − 1 2 . In Fig. 3 we present exemplary results on data malformed using Gumbel copula. The figure presents how many from 8 detected marginals are the malformed one. We observe, that in each case the JSBS algorithm have detected all malformed marginals. The MEV yields result similar to the random guess algorithm. Contrary we can see, that malformed data by means of the 7 Algorithm 2 Change a part of multivariate normal distributed data into Archimedean copula distributed one with similar covariance; X[:, ind] is a shortage for 'all elements with second index in ind'. 1: Input: X ∈ Rt,n -- t realization of n-variate normal distribution, dist -- label denoting S ← variance diagonal matrix of X µ ← mean vector of X k ← length of ind for i = 1, . . . , t do replacing Archimedean copula, ind -- variables indexes which are replaced. 2: Output: malformed data Xout within copula dist on marginal subset ind. 3: function arch_copula_malformation(X, dist, ind) 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: i ← S− 1 2 (xi − µ) xstd end for XU ← cdfN (0,1)(Xstd) Xcore ← core(Xstd[:, ind]) derive generator ψθ given dist derive parameter θ based on Xstd[:, ind] for i = 1, . . . , t do i [ind] ← arch sampler(ψθ, xcore xU i ← S xout i ) + µ) end for return Xout [1, . . . , k], xcore 1 2 (quantileN (0,1)(xU i,k+1) i 17: 18: 19: 20: end function (cid:46) XU ∈ [0, 1]t×n (cid:46) or with core_naive(ind) naive algorithm core_naive were partially detected by the MEV. We explain this fact by the large influence of the naive algorithm on the covariance matrix, see Fig. 3b. As discussed in the previous subsection, in the naive algorithm case we have zero correlation between malformed and not malformed subsets, which is not true in the core algorithm case. 3.3 Algorithm analysis In this section we analyse our algorithms using Clayton, Gumbel and AMH Archimedean copulas and different covariance matrices generators. In particular we have analysed 1. true random covariance matrix Σr, generated as described in Section 3.2, 2. constant correlation matrix Σc dom variables equal to a free parameter α ∈ [0, 1], α, where the correlation between two different marginal ran- 3. Toeplitz correlation matrix ΣT ρ , where the correlation between i-th and j-th elements equals ρi−j for ρ ∈ [0, 1], 4. noised version of Toeplitz correlation matrix ΣT ρ,ε [47], where ε corresponds to noise impact. Our measure of goodness of discrimination is the percentage of correctly discriminated vari- ables, i.e. if pth experiment has correctly recognized rp malformed variables, then the mean discriminability is defined as 100(cid:88) p=1 ¯D = rp 8 . (6) Note that ¯D = 1 is achieved when all malformed variables were correctly recognized for all experiments. Remark, that random guess would give the expectedly discriminability ¯Dtheor = 8 X ← X, randomN (0,1)(t) Σ ← cor(X) λ, U ← eigenvals(Σ), eigenvec(Σ) for l=1,. . . , t do Algorithm 3 core function for generating initial data form multivariate uniform distribution 1: Input: Xstandard ∈ Rt,k - t realization of k-variate normal distribution with standard normal 2: Output: Xcore ∈ Rt,k+1 -- t realisations of k + 1 independent U (0, 1). 3: function core(X) 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: end function (cid:46) ∈ Rt,k+1, append (k + 1)th column from N (0, 1) (cid:46) λ1 < . . . < λk+1 marginals xl ← xl · U for i=1,. . . , k+1 do l,i ← cdfN (0, √ xcore λi)(xl,i) end for end for return Xcore (a) Number of samples, for which given numbered of malformed variables were found (b) Relative covariance change for all samples Figure 3: Comparison of the core and the naive algorithms on data malformed using Gumbel copula. 3a: number of experiments, for which given number of malformed marginals were found. 'theoretical' is the theoretical number of 'detected' marginals in the case of a random guess. In all cases we have malformed 8 marginals an analyse 8 detected ones (left from the elimination procedure). 3b: relative change of covariance matrix calculated according to (cid:107)Σorig− Σnew(cid:107)/(cid:107)Σorig(cid:107) for all experiments. 0.08. We claim, that our algorithm works well if the discriminability of MEV algorithm is close to the theoretical, while for JSBS it is much higher. Let us analyze the algorithm. In Fig. 4 we show that its efficiency depends both on the choice of the correlation matrix generation method and the Archimedean copula used in the algorithm. For constant correlation matrix, the JSBS achieves full discriminability for all copulas, however the MEV still produces discriminability much higher than the random choice, especially in the AMH copula case given the ρ > 0.5 parameter of a constant correlation matrix. For random correlation matrix generation, JSBS achieved almost full discriminability for all copulas. In the case of MEV the efficiency was high for AMH, but small for Gumbel copula. 9 02468Number of malformed found050100Number of samplesJSBSMEVMEV, naivetheoretical150100sample index0.00.10.20.3orignew/origcorenaive (a) efficiency of MEV algorithm on malformed data using different copulas (b) efficiency of JSBS algorithm on malformed data using different copulas Figure 4: Comparison of 4a MEV and 4b JSBS algorithms on malformed data using the core algorithm, different copulas, and different methods of covariance matrices generation. Note for constant and random covariance matrices JSBS achieve full efficiency. (a) MEV algorithm (b) JSBS algorithm Figure 5: Efficiency of 5a the MEV and 5b the JSBS algorithm for noised Toeplitz correlation matrix with parameter ρ = 0.3. Note that the MEV discriminability is not affected significantly by the noise parameter ε value, while the JSBS discriminability in general rises with the noise strength. Note, that the AMH copula can achieve only ρ ∈ (0, 0.5) correlation, hence covariance matrices, implying high overall correlations, may be affected by the algorithm with the AMH 10 0.10.30.50.70.9constant,0.00.51.0efficiency of MEV1random 0.10.30.50.70.9toeplitz, ClaytonGumbelAMHrandom0.10.30.50.70.9constant,0.00.51.0efficiency of JSBS1random 0.10.30.50.70.9toeplitz, ClaytonGumbelAMHrandom0.00.10.20.30.40.5noise,0.00.51.0efficiency of MEV0.00.10.20.30.40.5noise,0.00.51.0efficiency of JSBSClaytonGumbelAMHrandom copula. Further as discussed in subsection 3.1 the algorithm with the AMH copula may lose some information due to the discrete inverse Laplace -- Stieltjes transform of the AMH copula generator. This observation may explain higher detectability by the MEV of data malformed using the AMH copula and constant correlation matrix parametrised by ρ < 0.5. The best stability of results can be observed for Toepltiz correlation matrices. Here the MEV achieves similar efficiency as the random choice for ρ ≤ 0.7. The JSBS achieves good discriminability, for all copulas, starting from the Toeplitz parameter ρ = 0.3. Here the Clayton copula produces almost full efficiency. In Fig. 5 we present impact of noise in the Toeplitz correlation matrix, on the detection performance. We observe that MEV performance does not depend on the noise parameter significantly. This is not the case for the JSBS, where in the case of Gumbel and AMH copulas the larger the noise parameter ε, the higher the discriminability is. The Clayton copula outcomes are good for all values of the ε. To conclude, the introduction of noise improves JSBS's and MEV's detection, but in the latter the case the change is negligible. In our opinion, this is due to the fact, that we lose some information while performing data malformed using the core algorithm, however this lose is small enough to be hidden in the noise. 4 Conclusions In this paper, we presented and analysed algorithm, which replaces a chosen subset of marginals, initially distributed by a multivariate Gaussian distribution by those distributed according to an Archimedean copula. While our algorithm is designed for particular Archimedean families, it can be easily generalised to other Archimedean copulas. The correctness of our algorithm was numerically confirmed by comparing two distinct feature selection algorithms: the JSBS that utilises higher order correlations and the MEV that does not utilise higher order correlations. The comparison was performed for a various choice of correlation matrices. While for some correlation matrices MEV has provided almost random results, JSBS in most cases has given almost full discrimination. Hence in our opinion, the algorithm can be used to provide data for analysis of various complicated machine-learning algorithms. Such analysis would determine, whether the algorithm utilises higher order correlations or not. One should note that our algorithm does not affect a covariance matrix significantly and leaves all univariate marginal distributions unchanged as well as it does not reshuffle realisations of data. It is why the algorithm does not introduce other factors apart from higher order correlations. The resulting algorithm can be generalised in various direction. First, we believe that the effect on a covariance matrix can be diminished, this would reduce discriminability of the MEV algorithm. Second, the algorithm can be generalised into a more extensive collection of copulas, not necessarily involving Archimedean ones. We can mention here the Marshall-Olkin bivariate copula or the Fréchet maximal copula derived from the Fréchet -- Hoeffding upper copula bound. Acknowledgments The research was partially financed by the National Science Centre, Poland -- project number 2014/15/B/ST6/05204. The authors would like to thank Jarosław Adam Mis- zczak for revising the manuscript and discussion. References [1] J. Fan, J. Lv, and L. Qi, "Sparse high-dimensional models in economics," Annual Review of Economics, vol. 3, pp. 291 -- 317, 2011. 11 [2] T. Ando and J. Bai, "Clustering huge number of financial time series: A panel data approach with high-dimensional predictors and factor structures," Journal of the American Statistical Association, vol. 112, no. 519, pp. 1182 -- 1198, 2017. [3] Y. Dai, B. Hu, Y. Su, C. Mao, J. Chen, X. Zhang, P. Moore, L. Xu, and H. Cai, "Feature selection of high-dimensional biomedical data using improved SFLA for disease diagno- sis," in Bioinformatics and Biomedicine (BIBM), 2015 IEEE International Conference on, pp. 458 -- 463, IEEE, 2015. [4] W. Li, G. Wang, and K. Li, "Clustering algorithm for audio signals based on the sequential Psim matrix and Tabu Search," EURASIP Journal on Audio, Speech, and Music Processing, vol. 2017, no. 1, p. 26, 2017. [5] K. Cordes, L. Grundmann, and J. Ostermann, "Feature evaluation with high-resolution im- ages," in International Conference on Computer Analysis of Images and Patterns, pp. 374 -- 386, Springer, 2015. [6] S. T. Roweis and L. K. Saul, "Nonlinear dimensionality reduction by locally linear embed- ding," science, vol. 290, no. 5500, pp. 2323 -- 2326, 2000. [7] R. O. Duda, P. E. Hart, and D. G. Stork, Pattern classification. John Wiley & Sons, 2012. [8] I. T. Jolliffe, "Principal components as a small number of interpretable variables: some examples," Principal Component Analysis, pp. 63 -- 77, 2002. [9] E. Jondeau, E. Jurczenko, and M. Rockinger, "Moment component analysis: An illustration with international stock markets," Journal of Business & Economic Statistics, pp. 1 -- 23, 2017. [10] J. C. Arismendi and H. Kimura, "Monte Carlo Approximate Tensor Moment Simulations," Available at SSRN 2491639, 2014. [11] H. Becker, L. Albera, P. Comon, M. Haardt, G. Birot, F. Wendling, M. Gavaret, C.-G. Bénar, and I. Merlet, "EEG extended source localization: tensor-based vs. conventional methods," NeuroImage, vol. 96, pp. 143 -- 157, 2014. [12] M. Geng, H. Liang, and J. Wang, "Research on methods of higher-order statistics for phase difference detection and frequency estimation," in Image and Signal Processing (CISP), 2011 4th International Congress on, vol. 4, pp. 2189 -- 2193, IEEE, 2011. [13] B. Schölkopf, A. Smola, and K.-R. Müller, "Nonlinear component analysis as a kernel eigen- value problem," Neural computation, vol. 10, no. 5, pp. 1299 -- 1319, 1998. [14] H. Hoffmann, "Kernel PCA for novelty detection," Pattern recognition, vol. 40, no. 3, pp. 863 -- 874, 2007. [15] G. Baudat and F. Anouar, "Generalized discriminant analysis using a kernel approach," Neural computation, vol. 12, no. 10, pp. 2385 -- 2404, 2000. [16] J. A. Lee and M. Verleysen, Nonlinear dimensionality reduction. Springer Science & Busi- ness Media, 2007. [17] M. Sakurada and T. Yairi, "Anomaly detection using autoencoders with nonlinear dimen- sionality reduction," in Proceedings of the MLSDA 2014 2nd Workshop on Machine Learning for Sensory Data Analysis, p. 4, ACM, 2014. 12 [18] W. Wang, Y. Huang, Y. Wang, and L. Wang, "Generalized autoencoder: A neural network framework for dimensionality reduction," in Proceedings of the IEEE conference on computer vision and pattern recognition workshops, pp. 490 -- 497, 2014. [19] G. E. Hinton and R. R. Salakhutdinov, "Reducing the dimensionality of data with neural networks," science, vol. 313, no. 5786, pp. 504 -- 507, 2006. [20] A. J. McNeil and J. Nešlehová, "Multivariate archimedean copulas, d-monotone functions and l1-norm symmetric distributions," The Annals of Statistics, pp. 3059 -- 3097, 2009. [21] C. Sheffield, "Selecting band combinations from multispectral data," Photogrammetric En- gineering and Remote Sensing, vol. 51, pp. 681 -- 687, 1985. [22] X. Geng, K. Sun, L. Ji, H. Tang, and Y. Zhao, "Joint Skewness and Its Application in Unsupervised Band Selection for Small Target Detection," Scientific reports, vol. 5, 2015. [23] J. Bezanson, A. Edelman, S. Karpinski, and V. B. Shah, "Julia: A fresh approach to numerical computing," SIAM Review, vol. 59, no. 1, pp. 65 -- 98, 2017. [24] K. Domino and A. Glos, "DatagenCopulaBased.jl." https://doi.org/10.5281/zenodo.1213710, 2018. [25] P. McCullagh and J. Kolassa, "Cumulants," Scholarpedia, vol. 4, no. 3, p. 4699, 2009. [26] M. D. Schatz, T. M. Low, R. A. van de Geijn, and T. G. Kolda, "Exploiting symmetry in tensors for high performance: Multiplication with symmetric tensors," SIAM Journal on Scientific Computing, vol. 36, no. 5, pp. C453 -- C479, 2014. [27] K. Domino, Ł. Pawela, and P. Gawron, "Efficient computation of higer-order cumulant tensors," SIAM Journal on Scientific Computing, vol. 40, no. 3, pp. A1590 -- A1610, 2018. [28] M. G. Kendall et al., "The advanced theory of statistics," The advanced theory of statistics., no. 2nd Ed, 1946. [29] E. Lukacs, "Characteristics functions," Griffin, London, 1970. [30] R. B. Nelsen, An introduction to copulas. Springer Science & Business Media, 2007. [31] U. Cherubini, E. Luciano, and W. Vecchiato, Copula methods in finance. John Wiley & Sons, 2004. [32] P. Embrechts, F. Lindskog, and A. McNeil, "Modelling dependence with copulas," Rap- port technique, Département de mathématiques, Institut Fédéral de Technologie de Zurich, Zurich, 2001. [33] N. Naifar, "Modelling dependence structure with Archimedean copulas and applications to the iTraxx CDS index," Journal of Computational and Applied Mathematics, vol. 235, no. 8, pp. 2459 -- 2466, 2011. [34] K. Domino and T. Błachowicz, "The use of copula functions for modeling the risk of invest- ment in shares traded on the Warsaw Stock Exchange," Physica A: Statistical Mechanics and its Applications, vol. 413, pp. 77 -- 85, 2014. [35] Q. Zhang, J. Li, and V. P. Singh, "Application of Archimedean copulas in the analysis of the precipitation extremes: effects of precipitation changes," Theoretical and applied climatology, vol. 107, no. 1-2, pp. 255 -- 264, 2012. 13 [36] G. Tsakiris, N. Kordalis, and V. Tsakiris, "Flood double frequency analysis: 2d-archimedean copulas vs bivariate probability distributions," Environmental Processes, vol. 2, no. 4, pp. 705 -- 716, 2015. [37] X. Zeng, J. Ren, Z. Wang, S. Marshall, and T. Durrani, "Copulas for statistical signal processing (part i): Extensions and generalization," Signal Processing, vol. 94, pp. 691 -- 702, 2014. [38] G. W. Peters, T. A. Myrvoll, T. Matsui, I. Nevat, and F. Septier, "Communications meets copula modeling: Non-standard dependence features in wireless fading channels," in Signal and Information Processing (GlobalSIP), 2014 IEEE Global Conference on, pp. 1224 -- 1228, IEEE, 2014. [39] R. F. Silva, S. M. Plis, T. Adalı, and V. D. Calhoun, "A statistically motivated frame- work for simulation of stochastic data fusion models applied to multimodal neuroimaging," NeuroImage, vol. 102, pp. 92 -- 117, 2014. [40] P. Kumar, "Probability distributions and estimation of Ali-Mikhail-Haq copula," Applied Mathematical Sciences, vol. 4, no. 14, pp. 657 -- 666, 2010. [41] B. Schweizer and E. F. Wolff, "On nonparametric measures of dependence for random variables," The annals of statistics, pp. 879 -- 885, 1981. [42] E. de Amo, M. D. Carrillo, J. F. Sánchez, and A. Salmerón, "Moments and associated measures of copulas with fractal support," Applied Mathematics and Computation, vol. 218, no. 17, pp. 8634 -- 8644, 2012. [43] A. W. Marshall and I. Olkin, "Families of multivariate distributions," Journal of the Amer- ican statistical association, vol. 83, no. 403, pp. 834 -- 841, 1988. [44] M. Hofert, "Sampling Archimedean copulas," Computational Statistics & Data Analysis, vol. 52, no. 12, pp. 5163 -- 5174, 2008. [45] A. J. McNeil, "Sampling nested Archimedean copulas," Journal of Statistical Computation and Simulation, vol. 78, no. 6, pp. 567 -- 581, 2008. [46] J. Nolan, Stable distributions: models for heavy-tailed data. Birkhauser New York, 2003. [47] J. Hardin, S. R. Garcia, and D. Golan, "A method for generating realistic correlation ma- trices," The Annals of Applied Statistics, pp. 1733 -- 1762, 2013. 14
1808.10658
1
1808
2018-08-31T10:09:44
Single-Source Bottleneck Path Algorithm Faster than Sorting for Sparse Graphs
[ "cs.DS" ]
In a directed graph $G=(V,E)$ with a capacity on every edge, a \emph{bottleneck path} (or \emph{widest path}) between two vertices is a path maximizing the minimum capacity of edges in the path. For the single-source all-destination version of this problem in directed graphs, the previous best algorithm runs in $O(m+n\log n)$ ($m=|E|$ and $n=|V|$) time, by Dijkstra search with Fibonacci heap [Fredman and Tarjan 1987]. We improve this time bound to $O(m\sqrt{\log n})$, thus it is the first algorithm which breaks the time bound of classic Fibonacci heap when $m=o(n\sqrt{\log n})$. It is a Las-Vegas randomized approach. By contrast, the s-t bottleneck path has an algorithm with running time $O(m\beta(m,n))$ [Chechik et al. 2016], where $\beta(m,n)=\min\{k\geq 1: \log^{(k)}n\leq\frac{m}{n}\}$.
cs.DS
cs
Single-Source Bottleneck Path Algorithm Faster than Sorting for Sparse Graphs Ran Duan ∗1, Kaifeng Lyu †1, Hongxun Wu ‡1, and Yuanhang Xie §1 1Institute for Interdisciplinary Information Sciences, Tsinghua University Abstract In a directed graph G = (V, E) with a capacity on every edge, a bottleneck path (or widest path) between two vertices is a path maximizing the minimum capacity of edges in the path. For the single-source all-destination version of this problem in directed graphs, the previous best algorithm runs in O(m + n log n) (m = E and n = V ) time, by Dijkstra search with Fibonacci heap [Fredman and Tarjan 1987]. We improve this time bound to O(m√log n), thus it is the first algorithm which breaks the time bound of classic Fibonacci heap when m = o(n√log n). It is a Las-Vegas randomized approach. By contrast, the s-t bottleneck path has an algorithm with running time O(mβ(m, n)) [Chechik et al. 2016], where β(m, n) = min{k ≥ 1 : log(k) n ≤ m n }. 1 Introduction The bottleneck path problem is a graph optimization problem finding a path between two ver- tices with the maximum flow, in which the flow of a path is defined as the minimum capacity of edges on that path. The bottleneck problem can be seen as a mathematical formulation of many network routing problems, e.g. finding the route with the maximum transmission speed between two nodes in a network, and it has many other applications such as digital compositing [FGA98]. It is also the important building block of other algorithms, such as the improved Ford-Fulkerson algorithm [EK72, FF56], and k-splittable flow algorithm [BKS02]. The minimax path problem which finds the path that minimizes the maximum weight on it is symmetric to the bottleneck path problem, thus has the same time complexity. 1.1 Our Results In a directed graph G = (V, E) (n = V , m = E), we consider the single-source bottleneck path (SSBP) problem, which finds the bottleneck paths from a given source node s to all other vertices. In the comparison-based model, the previous best time bound for SSBP is the traditional Dijkstra's algorithm [Dij59] with Fibonacci heap [FT87], which runs in O(m + n log n) time. Some progress has been made for slight variants of the SSBP problem: When the graph is undirected, SSBP is reducible to minimum spanning tree [Hu61], thus can be solved in randomized linear time [KKT95]; for the single-source single-destination bottleneck path (s-t BP) problem in directed ∗[email protected]. Supported by a China Youth 1000-Talent grant. †[email protected]. ‡[email protected]. §[email protected]. 1 graphs, Gabow and Tarjan [GT88] showed that it can be solved in O(m log∗ n) time, and this bound was subsequently improved by Chechik et al [CKT+16] to O(mβ(m, n)). However, until now no algorithm is known to be better than Dijkstra's algorithm for SSBP in directed graphs. And as noted in [FT87], Dijkstra's algorithm can be used to sort n numbers, so a "sorting barrier", O(m + n log n), prevents us from finding a more efficient implementation of Dijkstra's algorithm. In this paper, we present a breakthrough algorithm for SSBP that overcomes the sorting barrier. Our main result is shown in the following theorem: Theorem 1. Let G = (V, E) be a directed graph with edge weights w : E → R. In comparison-based model, SSBP can be solved in expected O(cid:0)m√log n(cid:1) time. Our algorithm is inspired by previous works on the s-t BP problem: the O(m log∗ n)-time algo- rithm by Gabow and Tarjan [GT88] and the O(mβ(m, n))-time algorithm by Chechik et al [CKT+16]. See Section 3 for our intuitions. 1.2 Related Works A "sorting barrier" seemed to exist for the the Minimum Spanning Tree problem (MST) for many years [Bor, Jar30, Kru56], but it was eventually broken by [Yao75, CT76]. Fredman and Tar- jan [FT87] gave an O(mβ(m, n))-time algorithm by introducing Fibonacci heap. The current best time bounds for MST include randomized linear time algorithm by Karger et al [KKT95], Chazelle's O(mα(m, n))-time deterministic algorithm [Cha00] and Pettie and Ramachandran's op- timal approach [PR02]. The single-source single-destination version of the bottleneck path (s-t BP) problem is proved to be equivalent to the Bottleneck Spanning Tree (BST) problem (see [CKT+16]). In the bottleneck spanning tree problem, we want to find a spanning tree rooted at source node s minimizing the max- imum edge weight in it. For undirected graph, the s-t BP can be reduced to the MST problem. For directed graph, Dijkstra's algorithm [Dij59] gave an O(n log n + m)-time solution using Fibonacci heap [FT87]. Then Gabow and Tarjan [GT88] gave an O(m log∗ n)-time algorithm based on recur- sively splitting edges into levels. Recently, Chechik et al. [CKT+16] improved the time complexity of BST and BP to randomized O(mβ(m, n)) time, where β(m, n) = min{k ≥ 1 : log(k) n ≤ m n }. All these algorithms are under comparison-based model. For word RAM model, an O(m)-time algorithm has been found by Chechik et al. [CKT+16]. For the all-pairs version of the bottleneck path (APBP) problem, we can sort all the edges and use Dijkstra search to obtain an O(mn) time bound. For dense graphs, it has been shown that APBP can be solved in truly subcubic time. Shapira et al. [SYZ07] gave an O(n2.575)-time APBP algorithm on vertex-weighted graphs. Then Vassilevska et al. [VWY07] showed that APBP for edge-weighted graphs can be solved in O(n2+ω/3) = O(n2.791) time based on computing (max, min)- product of real matrices, which was then improved by Duan and Pettie [DP09] to O(n(3+ω)/2) = O(n2.686). Here ω < 2.373 is the exponent of time bound for fast matrix multiplication [CW90, Wil12]. 2 Preliminaries For a directed graph G, we denote w(u, v) to be the edge weight of (u, v) ∈ E. Without additional explanation, we use the symbol n to denote the number of nodes and m to denote the number of edges in G. 2 2.1 Bottleneck Path Problems The capacity of a path is defined to be the minimum weight among traversed edges, i.e., if a path traverses e1, . . . , el ∈ E, then the capacity of the path is minl i=1 w(ei). For any u, v ∈ V , a path from u to v with maximum capacity is called a bottleneck path from u to v, and we denote this maximum capacity by b(u, v). Definition 2. The Single-Source Bottleneck Path (SSBP) problem is: Given a directed graph G = (V, E) with weight function w : E → R and a source s ∈ V , output b(s, t) for every t ∈ V , which is the maximum path capacity among all the paths from s to t. source node s. We use the triple (G, w, s) to denote a SSBP instance with graph G, weight function w(·) and It is more convenient to present our algorithm on a slight variant of the SSBP problem. We shall call it Arbitrary-Source Bottleneck Path with Initial Capacity (ASBPIC) problem. We assume that the edge weight w(e) of an edge e ∈ E is either a real number or infinitely large (+∞). We say an edge e is unrestricted if w(e) = +∞; otherwise we say the edge e is restricted. In the ASBPIC problem, an initial capacity h(v) is given for every node v ∈ V , and the capacity of a path is redefined to be the minimum between the initial capacity of the starting node and the minimum edge weights in the path, i.e., if the path starts with the node v ∈ V and traverses e1, . . . , el, then its capacity is min(cid:0){h(v)} ∪ {w(ei)}l i=1(cid:1). For any v ∈ V , a path ended with v with maximum capacity is called a bottleneck path ended with v, and we denote this maximum capacity as d(v). Definition 3. The Arbitrary-Source Bottleneck Path with Initial Capacity (ASBPIC) problem is: Given a directed graph G = (V, E) with weight function w : E → R ∪ {+∞} and initial capacity function h : V → R ∪ {±∞}, output d(v) for every v ∈ V , which is the maximum path capacity among all the paths ended with v. We use the triple (G, w, h) to denote an ASBPIC instance with graph G, weight function w(·), and inital capacity function h(·). Note that ASBPIC and SSBP are equivalent under linear-time reductions. Given an ASBPIC instance, we construct a new graph G′ from G by adding a new node s which has outgoing edges with weight h(v) to all the nodes v ∈ V having h(v) > −∞, then it suffices to find bottleneck paths from s to all other nodes in G′. On the other hand, a SSBP instance (G, w, s) can be easily reduced to the ASBPIC instance (G, w, h), where h(s) = maxe∈E{w(e)} and h(v) = −∞ for all v 6= s. 2.2 Dijkstra's Algorithm for SSBP and ASBPIC SSBP can be easily solved using a variant of Dijkstra's algorithm [Dij59]. In this algorithm, each node is in one of the three status: unsearched, active, or scanned. We associate each node v ∈ V with a label d′(v), which is the maximum path capacity among all the paths from s to v that only traverse scanned nodes or v. Initially, all the nodes are unsearched except s is active, and we set d′(s) = +∞ and d′(v) = −∞ for all v 6= s. We repeat the following step, which we call the Dijkstra step, until none of nodes is active: • Select an active node u with maximum label and mark u as scanned. For every outgoing edge (u, v) of u, update the label of v by d′(v) ← max{d′(v), min{d′(u), w(u, v)}}, (1) and mark v as active if v is unsearched. 3 We use priority queue to maintain the order of labels for active nodes. This algorithm runs in O(m + n log n) time when Fibonacci heap [FT87] is used. The algorithm we introduced above can also be adapted for solving ASBPIC. The only thing we need to change is that in the initial stage all nodes are active and d′(v) = h(v) for every v ∈ V . The resulting algorithm again runs in O(m + n log n) time. We shall call these two algorithms as Dijkstra's algorithm for SSBP and Dijkstra's algorithm for ASBPIC, or simply call any of them Dijkstra's algorithm when no confusion can arise. 2.3 Weak and Strong Connectivity in Directed Graph We also need some definitions about connectivity in graph theory in this paper. A directed graph is said to be weakly-connected if it turns to be a connected undirected graph when changing all of its directed edges to undirected edges. A directed graph is said to be strongly-connected if every pair of nodes can be reached from each other. A weakly- (or strongly-) connected components is defined to be a maximal weakly- (or strongly-) connected subgraph. 3 Intuitions for SSBP If all the edge weights are integers and are restricted in {1, . . . , c}, then SSBP can be solved in O(m + c) time using Dijkstra's algorithm with bucket queue. If the edge weights are not necessarily small integers but all the edges given to us are already sorted by weights, then we can replace the edge weights by their ranks and use Dijkstra's algorithm with bucket queue to solve the problem in O(m) time. However, edges are not sorted in general. If we sort the edges directly, then a cost of Ω(m log m) time is unavoidable in a comparison-based model, which is more expensive than the O(m + n log n) running time of Dijkstra's algorithm. Our algorithm is inspired by previous works on the single-source single-destination bottleneck path problem (s-t BP): the O(m log∗ n)-time algorithm by Gabow and Tarjan [GT88] and the O(mβ(m, n))-time algorithm by Chechik et al [CKT+16]. Gabow and Tarjan's algorithm for s-t BP consists of several stages. Let b(s, t) be the capacity of a bottleneck path from s to t. Initially, we know that b(s, t) is in the interval (−∞, +∞). In each stage, we narrow the interval of possible values of b(s, t). Assume that b(s, t) is known to be in the range (l, r). Let m(l,r) be the the number of edges with weights in the range (l, r) and k be a parameter. By applying the median- finding algorithm [BFP+73] repeatedly, we choose k thresholds λ1,··· , λk to split (l, r) into k + 1 subintervals (l, λ1), [λ1, λ2), [λ2, λ3), . . . , [λk−1, λk), [λk, r) such that for each subinterval, there are O(m(l,r)/k) edges of weight in it. Gabow and Tarjan then show that locating which subinterval contains b(s, t) can be done in O(m(l,r)) time by incremental search. Finally, the O(m log∗ n) running time bound is achieved by setting k appropriately at each stage. The algorithm by Chechik et al. is based on the framework of Gabow and Tarjan's algorithm, but instead of selecting the thresholds λ1, . . . , λk by median-finding repeatedly in O(m(l,r) log k) time, in this algorithm we select the k thresholds by randomly sampling in edge weights, and sort them in O(k log k) time. These thresholds partition the edges evenly with high probability, but it requires Ω(m log k) time to compute the partition explicitly. Then they show that actually we can locate which subinterval contains b(s, t) in O(m(l,r) + nk) (or O(m(l,r) + n log k)) time, without computing the explicit partition. The time bound for the overall algorithm is again obtained by setting k appropriately at each stage. We adapt Chechik et al.'s framework for the s-t BP problem to the SSBP problem. Our SSBP algorithm actually works on an equvialent problem called ASBPIC. In ASBPIC, there is no fixed source but every node has an initial capacity, and for all destination t ∈ V we need to compute the 4 capacity d(t) of a bottleneck path ended with t (See Section 2.1 for details). Instead of locating the subinterval for a single destination t, our algorithm locates the subintervals for all destinations t ∈ V . Thus we adopt a divide-and-conquer methodology. At each recursion, we follow the idea from Chechik et al. [CKT+16] to randomly sample k thresholds. Then we split the nodes into k + 1 levels V0, . . . , Vk, where the i-th level contains the nodes t that have d(t) in the i-th subinterval (0 ≤ i ≤ k). For each level Vi of nodes, we compute d(t) for every t ∈ Vi by reducing to solve the SSBP on a subgraph consisting of all the nodes in Vi and some of the edges connecting them. We set k to be fixed in all recursive calls, and the maximum recursion depth is O(log n/ log k) with high probability. The split algorithm becomes the key part of our algorithm. Note that at each recursion, we should reduce or avoid the use of operations that cost time O(log k) per node or per edge (e.g., binary searching for the subinterval containing a particular edge weight). This is because that, for example, if we execute an O(log k)-time operation for each edge at each recursion, then the overall time cost is O(m log k)·O(log n/ log k) = O(m log n), which means no improvement comparing with the previous O(m + n log n)-time Dijkstra's algorithm. Surprisingly, we can design an algorithm such that whenever we execute an O(log k)-time operation, we can always find one edge that does not appear in any subsequent recursive calls. Thus total time complexity for such operations is O(m log k), which gives us some room to obtain a better time complexity by adjusting the parameter k. 4 Our Algorithm Our algorithm for SSBP is as follows: Given a SSBP instance (G, w, s), we first reduce the SSBP problem to an ASBPIC instance (G, w, h), and then use a recursive algorithm (Figure 1) to solve the ASBPIC problem. The reduction is done by setting h(s) = maxe∈E{w(e)} and h(v) = −∞ for all v 6= s as described in the preliminaries. For convenience, we assume that in the original graph, all edge weights are distinct. This assumption can be easily removed. i A high-level description of our recursive algorithm for ASBPIC is shown in Figure 1. For two set A and B, A ⊎ B stands for the union of A and B with the assumption that A ∩ B = ∅. We use E(r) to denote the set of restricted edges in G, and similarly we use E(r) to denote the set of restricted edges in Gi for each ASBPIC instance (Gi, wi, hi). When the thresholds λ0, . . . , λk+1 are presence, we define the index of x for every x ∈ R to be the unique index i such that λi ≤ x < λi+1, and we denote it as I(x). For x = ±∞, we define I(−∞) = 0, I(+∞) = l. Note that all the subgraphs Gi at Line 10 are disjoint. We denote r = E − Pl i=0Ei to be the total number of edges in E that do not appear in any recursive calls of (Gi, wi, hi). For an edge (u, v) ∈ E, if u and v belong to different levels, then we say that (u, v) is cross-level. If u and v belong to the same level Vi and w(u, v) < λi, then we say that (u, v) is below-level; conversely, if w(u, v) ≥ λi+1 then we say that (u, v) is above-level. Besides the problem instance (G, w, h) of ASBPIC, our algorithm requires an additional integral parameter k. We set the parameter k = 2Θ(√log n) throughout our algorithm. The value of the parameter k does not affect the correctness of our algorithm, but it controls the number of recursive calls at each recursion. At each recursion, our algorithm first checks if G contains only one weakly-connected component. If not, then our algorithm calls itself to compute d in each weakly-connected component recursively. Now we can assume that G is weakly-connected (so n ≤ m). If the number of restricted edges is no more than 1, we claim that we can compute d(v) for all v 5 k ≥ 1. Input: Directed graph G = (V, E), weight function w(·), initial capacity function h(·); Parameter Output: For each v ∈ V , output d(v), the capacity of a bottleneck path ended with v. 1: if G is not weakly-connected then 2: Compute {d(v)}v∈V in each weakly-connected component recursively. 5: Compute {d(v)}v∈V in linear time and exit. 3: Let E(r) = {e ∈ E w(e) < +∞} be the set of restricted edges. 4: if E(r) ≤ 1 then 6: Sample l = min{k,E(r)} distinct edges from E(r) uniformly randomly. 7: Sort the sampled edges by weights, and let λ1 < ··· < λl be their weights. 8: Let λ0 = −∞, λl+1 = +∞. 9: Split V into l + 1 levels: V0 ⊎ V1 ⊎ ··· ⊎ Vl, where Vi = {v ∈ V λi ≤ d(v) < λi+1} . ⊲ Section 4.3 10: For every level Vi, reduce the computation of {d(v)}v∈Vi to a new ASBPIC instance (Gi, wi, hi), where Gi = (Vi, Ei) is a subgraph of G consisting of all the nodes in Vi and some of edges that connect them. Solve each (Gi, wi, hi) instance recursively. ⊲ Section 4.2 Figure 1: Main Algorithm in linear time. The specific algorithm will be introduced in Section 4.2. Lemma 4. ASBPIC can be solved in O(m) time if there is at most one restricted edge. If the number of restricted edges is more than 1, then our algorithm first sample l = min{k,E(r)} distinct edges from E(r) uniformly randomly and sort them by weights, that is, if the number of restricted edges is more than k, then we sample k distinct restricted edges and sort them; otherwise we just sort all the restricted edges. Let λi be the weight of the edge with rank i (1 ≤ i ≤ l) and λ0 = −∞, λl+1 = +∞. Next, we split V into l + 1 levels of nodes V = V0 ⊎ V1 ⊎ ··· Vl, where the i-th level of nodes is Vi = {v ∈ V I(d(v)) = i} = {v ∈ V λi ≤ d(v) < λi+1}. The basic idea of the split algorithm is: we run Dijkstra's algorithm for ASBPIC on the graph produced by mapping every edge weight w(e) and initial capacity h(v) in G to their indices I(w(e)) and I(h(v)), and we obtain the final label value d′(v) for each node v ∈ V (Remember that d′(v) is the label of v in Dijkstra's algorithm). It is easy to show that the final label value d′(v) equals I(d(v)), so the nodes can be easily split into levels according to their final labels. The specific split algorithm will be introduced in Section 4.3. The time complexity for a single splitting is given below. In Theorem 9 we show that this implies that the total time cost for splitting is O(m log n/ log k + m log k). Lemma 5. Splitting V into levels at Line 9 can be done in O(m + r log k) (Recall that r is the number of edges that do not appear in any subsequent recursive calls). Finally, for every level Vi, we compute d(·) for nodes in this level by reducing to a new ASBPIC instance (Gi, wi, hi), where Gi is a subgraph of G consisting of all the nodes in Vi and some of edges that connect them. We solve each new instance by a recursive call. The construction of (Gi, wi, hi) is as follows: • Gi = (Vi, Ei), where Vi is the nodes at level i in G, and Ei is the set of edges which connect two nodes at level i and are not below-level, i.e., Ei = {(u, v) ∈ E u, v ∈ Vi, w(u, v) ≥ λi}; • For any e ∈ Ei, wi(e) = +∞ if e is above-level; otherwise wi(e) = w(e); 6 • For any v ∈ Vi, hi(v) = max ({h(v)} ∪ {w(u, v) ∈ E u ∈ Vi+1 ⊎ ··· ⊎ Vl}). Lemma 6. We can construct all the new ASBPIC instances (G0, w0, h0), . . . , (Gl, wl, hl) in O(m) time. For v ∈ Vi, the value of d(v) in the instance (Gi, wi, hi) exactly equals to the value of d(v) in the instance (G, w, h). Proof. We can construct all these instances (Gi, wi, hi) for all 0 ≤ i ≤ l by linearly scanning all the nodes and edges, which runs in O(m) time. We prove the correctness by transforming (G, w, h) to (Gi, wi, hi) step by step, while preserving the values of d(v) for all v ∈ Vi. By definition, λi ≤ d(v) < λi+1 for all v ∈ Vi. We can delete all the nodes at level less than i and delete all the edges with weight less than λi, since no bottleneck path ended with a node in Vi can traverse them. Also, for every edge e with weight w(e) ≥ λi+1, we can replace the edge weight with +∞ since w(e) is certainly not the minimum in any path ended with a node in Vi. For every edge e = (u, v) where u ∈ Vi+1 ⊎···⊎ Vl and v ∈ Vi, the edge weight w(e) must be less than λi+1, otherwise d(v) ≥ min{d(u), w(u, v)} ≥ λi+1 leads to a contradiction. Thus contracting all the nodes in Vi+1 ⊎ ··· ⊎ Vl to a single node v0 with infinite initial capacity is a transformation preserving the values of d(v) for all v ∈ Vi. Finally, our construction follows by taking hi(v) to be the maximum between the weight of incoming edges from v0 and the initial capacity h(v) for every v ∈ Vi. Remark 4.1. In any subsequent recursive calls of (Gi, wi, hi), neither cross-level nor below-level edges will appear, and all the above-level edges will become unrestricted. Also, it is easy to see that r is just the total number of cross-level and below-level edges (Recall that r is the number of edges that do not appear in any subsequent recursive calls). 4.1 Running Time First we analyze the maximum recursion depth. The following lemma shows that randomly sampled thresholds evenly partition the restricted edges with high probability. Lemma 7. Let E(r) = {e1, . . . , eq} be q restricted edges sorted by their weights in E. Let f1, . . . , fk be k ≥ 2 random edges sampled from E(r) such that w(f1) < w(f2) < ··· < w(fk). Let λi = w(fi) for i = 1, . . . , k, and λ0 = −∞, λk+1 = +∞. Let Fi = {e ∈ E λi ≤ w(e) < λi+1}. Then for every t > 0, max0≤i≤k{Fi} < tq log k/k holds with probability 1 − k−Ω(t). Proof. Let M = tq log k/k. If max0≤i≤k{Fi} ≥ M , then there exists an edge ep such that ep is chosen but for any p + 1 ≤ j < p + M , ej is not chosen. Note that when p is given, this event happens with probability ≤ k · (1/q) · Qk−1 i=1 ((q − M − i)/(q − i)) ≤ (k/q) · (1 − M/q)k−1. By the union bound for all possible p, we have Pr(cid:20) max 0≤i≤k{Fi} ≥ tq log k/k(cid:21) ≤ k(1 − t log k/k)k−1 ≤ k−Ω(t), which completes the proof. For our purposes it is enough to analyze the case that k = 2Ω(√log n). The following lemma gives a bound for the maximum recursion depth using Lemma 7. Lemma 8. For k = 2Ω(√log n) where n is the number of nodes at the top level of recursion, the maximum recursion depth is O(log n/ log k) with probability 1 − n−ω(1). 7 Proof. It is not hard to see that the total number of recursive calls of our main algorithm is O(m). Applying Lemma 7 with t = Θ(log n) and the union bound for all recursive calls, we know that with probability at least 1 − k−Ω(t) · O(m) = 1 − n−Ω(log n)3/2 , after every split with E(r) > k, the number of restricted edges in Gi is less than (t log k/k) · E(r) for every (Gi, wi, hi). Thus after O(log m/ log(k/(t log k))) = O(log n/ log k) levels of recursion, every ASBPIC instance (G, w, h) has E(r) ≤ k, and this means that in any recursive call of (Gi, wi, hi), the graph Gi has at most one restricted edge, which will be directly solved at Line 5. The overall time complexity of our algorithm is given by the following theorem: Theorem 9. For k = 2Ω(√log n), with probability 1 − n−ω(1), our main algorithm shown in Figure 1 runs in O(m log n/ log k + m log k) time. i=0E(r) i Proof. Let r = E − Pl i=0Ei, r′ = E(r) − Pl each recursive call is O(m + (r + r′) log k). . First we show that the running time in In each recursive call of our algorithm, the time cost for sorting at Line 7 is O(l log l). For the sample edge ei with rank i, either Vi is not empty, or this edge is cross-level, below-level, or above-level. Let l1 be the number of edges in the former case, and l2 be the number of edges in the latter case. For the former case, note that we only run the split algorithm for weakly-connected graphs, so there are at least l1 − 1 cross-level edges, which implies l1 ≤ r + 1. For the latter case, ei becomes unrestricted or does not appear for every Gi, so l2 ≤ r′. Thus l = l1 + l2 ≤ r + r′ + 1 and the time cost for sorting is O((r + r′) log k). By Lemma 5, the split algorithm runs in O(m+r log k) time in each recursive call. All other parts of our algorithm run in linear time. Thus the running time for each recursion is O(m+(r+r′) log k). Note that the recursion depth is O(log n/ log k) with probability 1 − nω(1). We can complete the proof by adding the time cost for all the O(m) recursive calls together. Finally, we can get our main result by setting k = 2Θ(√log n). Theorem 10. SSBP can be solved in O(m√log n) time with high probability. Remark 4.2. The above time bound is also true for expected running time. It can be easily derived from the fact that the worst-case running time is at most nO(1). In the rest of this section, we introduce the algorithm for ASBPIC with at most one restricted edge and the split algorithm. 4.2 Algorithm for the Graph with at most One Restricted Edge We introduce our algorithm for the graph with at most one restricted edge in the following two lemmas. Lemma 11. For a given ASBPIC instance (G, w, h), if there is no restricted edge in G, then the values of d(v) for all v ∈ V can be computed in linear time. Proof. G contains only unrestricted edges, so for every v ∈ V , d(v) is just equal to the maximum value of h(u) among all the nodes u that can reach v. If v1 and v2 are in the same strongly- connected component, then d(v1) = d(v2). Thus we can use Tarjan's algorithm [Tar72] to contract every strongly-connected component to a node. The initial capacity of a node is the maximum h(u) for all u in the component, and the capacity of an edge between nodes is the maximum among edges connecting components. Then Dijkstra approach on DAG takes linear time. 8 Lemma 12. For a given ASBPIC instance (G, w, h), if there is exactly one restricted edge in G, then the values of d(v) for all v ∈ V can be computed in linear time. Proof. Let e0 = (u0, v0) be the only restricted edge in G. There are two kinds of paths in G: 1. Paths that do not traverse e. We remove e from G and use the algorithm in Lemma 11 to get d(v) for every node v ∈ V . 2. Paths that traverse e. Note that d(u0) got in the previous step is the maximum capacity to u0 through only unrestricted edges. Then we update d(v) by max{d(v), min{d(u0), w(u0, v0)}} for every node v that can be reached from v0. We output the values of d(·) after these two kinds of updates, then all the paths should have been taken into account. 4.3 Split Now we introduce the split algorithm at Line 9 in our main algorithm. As before, we use the notation I(x) for the index of a value x and d′(v) is the label of v in Dijkstra's algorithm. The goal of this procedure is to split V into l+1 levels, V = V0⊎V1⊎···⊎Vl, where Vi = {v ∈ V I(d(v)) = i}. We need to show that this can be done in O(m + r log k) time, where r = E − Pl i=0Ei is the total number of edges in E that do not appear in any (Gi, wi, hi). A straightforward approach to achieve this goal is to use Dijkstra's algorithm as described in Section 2.2. We map all the edge weights and initial capacities to their indices using binary searches, and run Dijkstra's algorithm for ASBPIC. The output should be exactly d′(v) = I(d(v)) for every v. However, this approach is rather inefficient. Evaluating the index I(x) for a given x requires Ω(log l) time in a comparison-based model, thus in total, this algorithm needs Ω(n log l) time to compute indices, and this does not meet our requirement for the running time. The major bottleneck of the above algorithm is the inefficient index evaluations. Our algorithm overcomes this bottleneck by reducing the number of index evaluations for both edge weights and initial capacities to be at most O(r + n/ log l). 4.3.1 Index Evaluation for Edge Weights First we introduce our idea to reduce the number of index evaluations for edge weights. Recall that in Dijkstra's algorithm for ASBPIC we maintain a label d′(v) for every v ∈ V . In every Dijkstra step, we extract an active node u with the maximum label, and for all edges (u, v) ∈ E we compute min{d′(u), I(w(u, v))} to update d′(v). In the straightforward approach we evaluate every I(w(u, v)) using binary search, but actually this is a big waste: 1. If w(u, v) ≥ λd′(u), then min{d′(u), I(w(u, v))} = d′(u), so there is no need to evaluate I(w(u, v)). 2. If w(u, v) < λd′(u), then min{d′(u), I(w(u, v))} = I(w(u, v)), so we do need to evaluate I(w(u, v)). However, it can be shown that (u, v) is either a cross-level edge or a below-level edge, so (u, v) will not appear in any subsequent recursive calls of (Gi, wi, hi). Using the method discussed above, we can reduce the number of index evaluations for edge weights i=0Ei in Dijkstra's algorithm. Lemma 14 gives a formal proof for this. to be at most r = E −Pl 9 4.3.2 Index Evaluation for Initial Capacities Now we introduce our idea to reduce the number of index evaluations for initial capacities. Recall that in Dijkstra's algorithm, we need to initialize the label d′(v) to be I(h(v)) for each v ∈ V , and maintain a priority queue for the labels of all active nodes. If we evaluate every I(h(v)) directly, we have to pay a time cost of Ω(n log l). In our split algorithm, we first find a spanning tree T of G after replacing all the edges with undirected edges. Then we partition the tree T into b = O(n/s) edge-disjoint (but not necessarily node-disjoint) subtrees, T1, . . . , Tb, each of size O(s). Theorem 13 shows that this partition can be found in O(n) time, and the proof is given in Appendix A. Theorem 13. Given a tree T = (V, E) with n nodes and given an integer 1 ≤ s ≤ n, there exists a linear time algorithm that can partition T into edge-disjoint subtrees, T1, . . . , Tb, such that the number of nodes in each subtree is in the range [s, 3s). We form b groups of nodes, U1, . . . , Ub, where Ui is the group of nodes that are in the i-th subtree Ti. In the running of Dijkstra's algorithm, we divide the active nodes in V into two kinds: 1. Updated node. This is the kind of node v that has d′(v) already been updated by Dijkstra's update rule (1), which means d′(v) = min{d′(u), I(w(u, v))} ≥ I(h(v)) for some u after a previous update. The value of min{d′(u), I(w(u, v))} is evaluated according to Section 4.3.1, so the value of d′(v) can be easily known. We can store such nodes in buckets to maintain the order of their labels. 2. Initializing node. This is the kind of node v whose d′(v) has not been updated by Dijkstra's update rule (1), so d′(v) = I(h(v)). However, we do not store the value of I(h(v)) explicitly. For each group Ui, we maintain the set of initializing nodes in Ui. We only compute the value of I(h(v)) when v is the maximum in its group, and use buckets to maintain the maximum values from all groups. If each group has size s = O(log k), the maximum can be found in O(log k) time by brute-force search. At each iteration in Dijkstra's algorithm, we extract the active node with the maximum label among the updated nodes and initializing nodes and mark it as scanned. For the case that the maximum node v ∈ Uj is an initializing node, we remove v from Uj, and compute d′(u) = I(h(u)) for the new maximum node u. However, if we compute this value directly using an index evaluation for h(u), then we will suffer a total cost Ω(n log l), which is rather inefficient. The idea to speed up is to check whether d′(u) = d′(v) before performing an index evaluation. This can be done in O(1) time since we can know the corresponding interval of h(u) from the value of d′(v) if I(h(u)) = d′(v). We only actually evaluate I(h(u)) if d′(u) 6= d′(v) after the Dijkstra step scans all nodes with level d′(v). In this way, we can always ensure that the number of index evaluations in a group never exceeds the number of different final label values d′(·) in this group. Indeed, it can be shown that if there are c different final label values d′(·) in a group Ui, then there must be at least c − 1 cross-level edges in Ti, which implies that the number of index evaluations for initial capacities should be no greater than r + b. (Remember b is the number of groups in the partition.) Lemma 15 gives a formal proof for this. 4.3.3 The O(m + r log k)-time Split Algorithm Now we are ready to introduce our split algorithm in full details. A pseudocode is shown in Figure 2. During the search at Line 5 - 21, Bi may contain groups with maximum nodes not at the i-th level, 10 thresholds −∞ = λ0 < λ1 < ··· < λl < λl+1 = +∞ Input: Directed graph G = (V, E), weight function w(·), initial capacity function h(·) , l + 2 Output: Split V into V0 ⊎ V1 ⊎ ··· ⊎ Vl where Vi = {v ∈ V λi ≤ d(v) < λi+1}. 1: Let s = min{⌈log l⌉, n}. Find a spanning tree T of G after replacing all the edges with undirected 2: Form b groups of nodes, U1, . . . , Ub, where Ui is the group of nodes that are in the i-th subtree Ti. 3: For each group Ui, find the maximum node v and evaluate I(h(v)). Initialize l + 1 buckets edges and partition T into b = O(n/s) edge-disjoint subtrees T1, . . . , Tb, each of size O(s). B0, . . . , Bl which store the groups according to the index of h(·) of their maximum nodes. 4: Initialize l + 1 buckets C0, . . . , Cl ← ∅ which store the active nodes according to d′(·). 5: for i ← l, l − 1, . . . , 1, 0 do 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: for all U ∈ Bi do for all u ∈ U with h(u) ≥ λi do Delete u from U and put u into Ci d′(u) ← i while Ci 6= ∅ do Extract a node u from Ci for all (u, v) ∈ E do ¯w ← min{d′(u), I(w(u, v))}. (Evaluate I(w(u, v)) only if w(u, v) < λd′(u)) if λ ¯w > h(v) then if d′(v) does not exist or ¯w > d′(v) then Delete v from Cd′(v) Delete v from the group U containing it (if any) and put v into C ¯w d′(v) ← ¯w while Bi contains at least one non-empty group do Extract an non-empty group U from Bi Find the maximum node u in U , evaluate I(h(u)), and put U into BI(h(u)) 21: 22: Split V according to d′ and return Figure 2: Split Algorithm e.g., when the maximum node in a group U is deleted at Line 17 and I(h(u)) of the new maximum node u in U has not been evaluated yet. We have the following observations: • For all v ∈ V , d′(v) is non-decreasing, and at the end we have d′(v) = I(d(v)). • Only at Line 3, 13 and 21 we need to evaluate the index of h(·) of a node or the index of an edge. Each index evaluation costs O(log l) time. • The numbers of executions of the while loops at Line 10 - 18, Line 19 - 21 are bounded by O(n). • The number of times entering the for loop at Line 7 - 9 can be bounded by the number of index evaluations at Line 3 and 21. Each loop costs O(log l) time. Our algorithm is an implementation of Dijkstra's algorithm, so the correctness is obvious. The running time analysis is based on the following lemmas: Lemma 14. If we evaluate I(w(u, v)) at Line 13, then the edge (u, v) will not be in any recursive calls of (Gi, wi, hi). 11 Proof. We evaluate I(w(u, v)) only if w(u, v) < λd′(u), so ¯w = I(w(u, v)) right after Line 13. Since u has already been scanned, d′(u) here is just its final value I(d(u)). Note that I(d(v)) ≥ If finally I(d(v)) > I(w(u, v)), then I(w(u, v)) is smaller min{I(d(u)), I(w(u, v))} = I(w(u, v)). than both I(d(u)) and I(d(v)), thus (u, v) is a below-level edge or cross-level edge. If I(d(v)) = I(w(u, v)), then I(d(v)) < I(d(u)) and (u, v) is a cross-level edge. Lemma 15. At Line 3 and 21, if we evaluate I(h(u)) for c nodes u in some group Ui, then the number of different final label values d′(·) in Ui is at least c. Thus, the number of edges in the subtree Ti corresponding to Ui that do not appear in any recursive calls of (Gi, wi, hi) is at least c − 1. Proof. At line 21, I(d(u)) must be less than i; otherwise, u should have been extracted at Line 11 before extracting u at Line 20, which is impossible. Also note that d(u) ≥ h(u), so I(h(u)) ≤ I(d(u)) for all u ∈ V . Thus, if u1 ∈ Ui is evaluated at Line 3 and there are c − 1 nodes u2, . . . , uc extracted from Ui at Line 21, then I(d(u1)), I(d(u2)), . . . , I(d(uc)) should be in c distinct ranges: [I(h(u1)), +∞), [I(h(u2)), I(h(u1))), . . . , [I(h(uc)), I(h(uc−1))), which implies that the number of different final values of d′(u) in Ui is at least c. Suppose we remove all the cross-level edges in Ti, i.e., remove all the edges (u, v) in Ti whose final values of d′(u) and d′(v) differ. Then the tree should be decomposed into at least c components since there are at least c different final values of d′(u) in Ui. Thus there are at least c− 1 cross-level edges in Ti. Finally, we can derive the O(m + r log k) time bound for our split algorithm. Proof for Lemma 5. By Lemma 14, the number of index evaluations at Line 13 is at most r. Let ci be the number of index evaluations at Line 3 and 21 for nodes in the group Ui. Then by Lemma 15, Pb i=1 ci ≤ r + b. Thus the total number of index evaluations in our split algorithm can be bounded by 2r + b ≤ O(r + n/ log l), which costs O(r log l + n) time. At Line 3, Line 7-9, Line 21, we need to do a brute-force search in a given group, and each search costs O(s) ≤ O(log l) time. Note that the number of the brute-force searches can be bounded by twice the number of index evaluations at Line 3 and 21, so the total time cost for brute-force search is O(r log l + n). It can be easily seen that all other parts of our split algorithm runs in linear time, so the overall time complexity is O(m + r log l) ≤ O(m + r log k). 5 Discussion We give an improved algorithm for solving SSBP in O(m√log n) time which is faster than sorting for sparse graphs. This algorithm is a breakthrough compared to traditional Dijkstra's algorithm using Fibonacci heap. There are some open questions remained to be solved. Can our algorithm for SSBP be further improved to O(mβ(m, n)), which is the time complexity for the currently best algorithm for s-t BP? Can we use our idea to obtain an algorithm for SSBP that runs faster than Dijkstra in word RAM model? References [BFP+73] Manuel Blum, Robert W. Floyd, Vaughan R. Pratt, Ronald L. Rivest, and Robert Endre Tarjan. Time bounds for selection. J. Comput. Syst. Sci., 7(4):448 -- 461, 1973. 12 [BKS02] Georg Baier, Ekkehard Kohler, and Martin Skutella. On the k-splittable flow problem. In European Symposium on Algorithms, pages 101 -- 113. Springer, 2002. [Bor] O Boruvka. O jistem problemu minimalnim, praca moravske prirodovedecke spolecnosti 3, 1926. [Cha00] B. Chazelle. A minimum spanning tree algorithm with inverse-Ackermann type com- plexity. J. ACM, 47(6):1028 -- 1047, 2000. [CKT+16] Shiri Chechik, Haim Kaplan, Mikkel Thorup, Or Zamir, and Uri Zwick. Bottleneck paths and trees and deterministic graphical games. In LIPIcs-Leibniz International Proceedings in Informatics, volume 47. Schloss Dagstuhl-Leibniz-Zentrum fuer Infor- matik, 2016. [CT76] [CW90] [Dij59] [DP09] [EK72] [FF56] D. Cheriton and R. E. Tarjan. Finding minimum spanning trees. SIAM J. Comput., 5:724 -- 742, 1976. Don Coppersmith and Shmuel Winograd. Matrix multiplication via arithmetic progres- sions. Journal of Symbolic Computation, 9(3):251 -- 280, 1990. Computational algebraic complexity editorial. Edsger W Dijkstra. A note on two problems in connexion with graphs. Numerische mathematik, 1(1):269 -- 271, 1959. Ran Duan and Seth Pettie. Fast algorithms for (max, min)-matrix multiplication and bottleneck shortest paths. In Proceedings of the twentieth annual ACM-SIAM sympo- sium on Discrete algorithms, pages 384 -- 391. Society for Industrial and Applied Math- ematics, 2009. Jack Edmonds and Richard M Karp. Theoretical improvements in algorithmic efficiency for network flow problems. Journal of the ACM (JACM), 19(2):248 -- 264, 1972. L. R. Ford and D. R. Fulkerson. Maximal flow through a network. Canadian Journal of Mathematics, 8(0):399 -- 404, January 1956. [FGA98] Elena Fernandez, Robert Garfinkel, and Roman Arbiol. Mosaicking of aerial photo- graphic maps via seams defined by bottleneck shortest paths. Oper. Res., 46(3):293 -- 304, March 1998. [Fre85] [FT87] [GT88] [Hu61] [Jar30] Greg N Frederickson. Data structures for on-line updating of minimum spanning trees, with applications. SIAM Journal on Computing, 14(4):781 -- 798, 1985. Michael L Fredman and Robert Endre Tarjan. Fibonacci heaps and their uses in im- proved network optimization algorithms. Journal of the ACM (JACM), 34(3):596 -- 615, 1987. Harold N Gabow and Robert E Tarjan. Algorithms for two bottleneck optimization problems. Journal of Algorithms, 9(3):411 -- 417, 1988. T. C. Hu. The maximum capacity route problem. Operations Research, 9(6):898 -- 900, 1961. Vojtech Jarnık. O jist´em probl´emu minim´alnım. Pr´aca Moravsk´e Prırodovedeck´e Spolec- nosti, 6:57 -- 63, 1930. 13 [KKT95] David R Karger, Philip N Klein, and Robert E Tarjan. A randomized linear-time algorithm to find minimum spanning trees. Journal of the ACM (JACM), 42(2):321 -- 328, 1995. [Kru56] Joseph B Kruskal. On the shortest spanning subtree of a graph and the traveling salesman problem. Proceedings of the American Mathematical society, 7(1):48 -- 50, 1956. [PR02] S. Pettie and V. Ramachandran. An optimal minimum spanning tree algorithm. J. ACM, 49(1):16 -- 34, 2002. [SYZ07] Asaf Shapira, Raphael Yuster, and Uri Zwick. All-pairs bottleneck paths in vertex weighted graphs. In Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms, pages 978 -- 985. Society for Industrial and Applied Mathematics, 2007. [Tar72] Robert Tarjan. Depth-first search and linear graph algorithms. SIAM journal on com- puting, 1(2):146 -- 160, 1972. [VWY07] Virginia Vassilevska, Ryan Williams, and Raphael Yuster. All-pairs bottleneck paths In Proceedings of the thirty-ninth annual for general graphs in truly sub-cubic time. ACM symposium on Theory of computing, pages 585 -- 589. ACM, 2007. [Wil12] Virginia Vassilevska Williams. Multiplying matrices faster than Coppersmith-Winograd. In Proceedings of the 44th symposium on Theory of Computing, STOC '12, pages 887 -- 898, New York, NY, USA, 2012. ACM. [Yao75] A. C. Yao. An O(E log log V ) algorithm for finding minimum spanning trees. Info. Proc. Lett., 4(1):21 -- 23, 1975. A Tree Partition Algorithm Now we introduce the tree partition algorithm used in our ASBPIC algorithm. There are many ways to do that. The tree partition algorithm we introduced here is a slight variant of the topological partition algorithm used in Frederickson's algorithm [Fre85]. Proof of Theorem 13 Proof. The core procedure in our tree partition algorithm is a recursive function Partition as shown in Figure 3. Partition takes a tree as the input, then it partitions the tree by calling itself for the subtrees. Using simple induction it can be shown that at any time from Line 3 to 9, U can always induce a connected subgraph in T , thus the induced subgraph is indeed a subtree. Every time Partition reports a group Ui at Line 7 during the running, we say that the subtree induced by Ui in T is chosen as a subtree candidate. The return value of Partition is a set of nodes R which can induce a subtree in T whose edges do not appear in any subtree candidate. To produce a tree partition for the spanning tree T of G, we pass T as the input to Parti- tion(T ). We collect the groups U1, . . . , Ub reported by Partition(T ) in order, and then merge the last group Ub with the set of nodes R returned by Partition(T ) or regard R as a new group if no group has been reported before. For the former case, let v be the root node v when Ub is reported, then v must be contained in both Ub and R, thus Ub after the merge can still induce a subtree in T . 14 1: function Partition(T ) Let v be the root of T 2: U ← {v} for all subtree T ′ of v do 3: 4: 5: 6: 7: 8: 9: U ← U ∪ Partition(T ′) if U ≥ s then Report a new group U U ← {v} return U Figure 3: Tree Partition Algorithm The running time of this algorithm is obviously O(n). Now we turn to analyze the correctness. Since the subtrees are clearly edge-disjoint and every edge is contained in exactly one subtree, we only need to show that the size of each group is in [s, 3s). It is easy to see that the set of nodes returned at Line 9 has the size in the range [1, s], so the size of each subtree candidate is in the range [s, 2s). If in the end there is no subtree candidate, then R = s = n nodes will be returned and regarded as the only group in the partition. If there exist at least one subtree candidates, then the size of Ub should be in the range [s, 3s). Thus we complete our proof. 15
1810.10635
1
1810
2018-10-24T21:43:32
Lower Bounds for Oblivious Data Structures
[ "cs.DS", "cs.CR" ]
An oblivious data structure is a data structure where the memory access patterns reveals no information about the operations performed on it. Such data structures were introduced by Wang et al. [ACM SIGSAC'14] and are intended for situations where one wishes to store the data structure at an untrusted server. One way to obtain an oblivious data structure is simply to run a classic data structure on an oblivious RAM (ORAM). Until very recently, this resulted in an overhead of $\omega(\lg n)$ for the most natural setting of parameters. Moreover, a recent lower bound for ORAMs by Larsen and Nielsen [CRYPTO'18] show that they always incur an overhead of at least $\Omega(\lg n)$ if used in a black box manner. To circumvent the $\omega(\lg n)$ overhead, researchers have instead studied classic data structure problems more directly and have obtained efficient solutions for many such problems such as stacks, queues, deques, priority queues and search trees. However, none of these data structures process operations faster than $\Theta(\lg n)$, leaving open the question of whether even faster solutions exist. In this paper, we rule out this possibility by proving $\Omega(\lg n)$ lower bounds for oblivious stacks, queues, deques, priority queues and search trees.
cs.DS
cs
Lower Bounds for Oblivious Data Structures Riko Jacob∗ Kasper Green Larsen† Jesper Buus Nielsen‡ Abstract An oblivious data structure is a data structure where the memory access patterns reveals no informa- tion about the operations performed on it. Such data structures were introduced by Wang et al. [ACM SIGSAC'14] and are intended for situations where one wishes to store the data structure at an untrusted server. One way to obtain an oblivious data structure is simply to run a classic data structure on an oblivious RAM (ORAM). Until very recently, this resulted in an overhead of ω(lg n) for the most natural setting of parameters. Moreover, a recent lower bound for ORAMs by Larsen and Nielsen [CRYPTO'18] show that they always incur an overhead of at least Ω(lg n) if used in a black box manner. To circumvent the ω(lg n) overhead, researchers have instead studied classic data structure problems more directly and have obtained efficient solutions for many such problems such as stacks, queues, deques, priority queues and search trees. However, none of these data structures process operations faster than Θ(lg n), leaving open the question of whether even faster solutions exist. In this paper, we rule out this possibility by proving Ω(lg n) lower bounds for oblivious stacks, queues, deques, priority queues and search trees. 1 Introduction A number of problem domains have emerged where an algorithm needs to store data in an untrusted memory, for instance in cloud computing and trusted computing platforms like the SGX. In these settings it is typically not enough to just encrypt the data, as the access pattern itself may leak sensitive information. An oblivious data structure[39] (ODS) is one which mitigates this problem by design. An ODS admits a set of operations. On each operation it will make some accesses to the untrusted memory. The memory accesses should look independent of the operations being executed. In a bit more detail, security of an ODS is defined as follows. There is an adversary which picks two sequences of operations of the same length. According to a fair coinflip, one of the sequences are executed and the adversary gets to see the memory accesses made by the ODS. It then has to guess which sequence of operations was executed. The data structure is called oblivious if no adversary can guess correctly with probability significantly bounded away from one-half. The canonical oblivious data structure is the oblivious RAM (ORAM), which is just an ODS for the array data structure. Given an ORAM it is much easier to construct an ODS for another data structure problem P : First construct a data structure for P which uses the same number of memory accesses per operation. Then run this data structure on top of the ORAM to hide the position of those memory accesses. The ORAM was first introduced by Goldreich and Ostrovsky [12]. In their model the maintained array has size n, the server memory has size poly(n), and the word size of both the array and the untrusted memory is Θ(lg n). We call this the natural setting below. In the Goldreich-Ostrovsky model, the client has memory size Θ(lg n) and the memory accesses leak their position to the adversary, but not the content being read or written. The rational behind leaking only positions and not contents is that the contents could simply be encrypted under a key stored by the client. Most likely due to the emerging practical applications, ORAMs ∗[email protected]. IT University Copenhagen. †[email protected]. Aarhus University. Supported by a Villum Young Investigator grant 13163 and an AUFF starting grant. ‡[email protected]. Aarhus University. Partially supported by the BETHE project under Independent Research Fund Denmark. Partially supported by the Concordium Blockchain Research Center, Aarhus University, Denmark. Partially supported by the European Union's Horizon 2020 research and innovation programme under grant agreement #731583 (SODA). 1 have received a lot of research attention recently, see for instance [32, 5, 16, 17, 20, 42, 36, 3, 11, 10, 2, 25, 13, 14]. The ORAM construction in [12] had a bandwidth overhead of poly-log(n), where the bandwidth overhead is defined to be the number of bits communicated with the memory divided with the number of bits read and written to the array maintained by the ORAM. The same paper also showed a lower bound on the bandwidth overhead of Ω(lg n). The lower bound was proven in a model, where the ORAM construction is not allowed to read the data it is storing (the so-called "balls in bins" model) and where the adversary was allowed to have an unbounded running time. In [23] Larsen and Nielsen proved the same lower bound in a model where the encoding of the data can be arbitrary and where the adversary's running time is only allowed to be polynomial time. Notice that this is the more challenging model when proving a lower bound. The first ORAM construction to meet the lower bound for non-trivial parameters was the Path ORAM [37]. It has amortized bandwidth overhead of O(lg n) for maintaining an array with entry size Ω(lg2 n) bits using an untrusted memory with word size Θ(lg n). The PathORAM having O(lg n) bandwidth overhead means that it accesses Θ(lg2 n) server cells, each storing Θ(lg n) bits, in order to retrieve an array entry of Θ(lg2 n) bits. In the more natural setting where both the array and the server memory has word size Θ(lg n) bits, the bandwidth overhead of the PathORAM is Θ(lg2 n). If we allow a larger client memory of m = nε, then [15] gave an ORAM with bandwidth overhead O(lg n). This also matches the lower bound of Larsen and Nielsen. The PathORAM paper and the lower bound of Larsen and Nielsen leave two intriguing open problems. 1) What is the bandwidth overhead in the natural setting where both the array and the server memory has word size Θ(lg n) bits. 2) Can the Θ(lg n) overhead be beaten by considering data structures less powerful than the array, such as queues, stacks, deques and priority queues? There does not appear to be any reduction from the array maintenance problem to any of these, as they lack support for random access to items stored in them. Hence it is completely plausible that there are more efficient ways to solve these problems than to take the classic solutions and run them through an optimal ORAM. If so, it would be very valuable to have a library of efficient data structures for use in the oblivious setting. Significant progress on the first question has been made recently in [29], where the authors present an ORAM, called PanORAMa, which achieves a bandwidth of Θ(lg n · lg lg n) in the natural setting. After the submission of this paper, the paper [1] completely solves the first problem by presenting an optimal ORAM, called OptORAMa, achieving a bandwidth overhead of Θ(lg n) in the natural setting. Previous work on oblivious data structures [39] suggested that there might be an affirmative answer to the second question. In [39], the authors presented stacks, queues and deques with O(lg n) bandwidth overhead when the server cell size, block size and the client memory are all Θ(lg n) bits. At the time these were developed, the best known ORAM construction in the natural setting had an overhead of O(lg2 n). Thus it could appear that efficient oblivious data structures are easier to design than full generality ORAMs. It is an intriguing and important open problem whether these can be improved even further. 1.1 Our Results Our main results show that there is no hope of designing more efficient oblivious data structures for the classic problems mentioned above: Theorem 1. [Informal] Let D be either an oblivious stack, queue, deque, priority queue or search tree, storing r-bit items for r ≥ 1 and let n be an upper bound on the number of items in D. If w denotes the cell size of D, m denotes the client memory size and D has failure probability at most 1/3, then D must have expected amortized running time Ω(lg(nr/m)r/w). For the most natural setting where the cell size w and the number of bits in the items, r, are within constant factors of each other, w = Θ(r), and for any client memory size m ≤ n1−ε, this lower bound simplifies to Ω(lg n). Since stacks, queues and deques have O(1) time solutions without any requirements of being oblivious, this means that the overhead resulting from being oblivious is Ω(lg n). For priority queues with r, w = Θ(lg n), the 2 best known classic solution is the priority queue resulting from Thorup's [38] reduction to sorting combined with Radix Sort, resulting in O(1) amortized time per operations. For r, w = ω(lg n) and r = Θ(w), one obtains the best classic priority queue also using Thorup's reduction to sorting combined with Han and Thorup's [18] integer sorting algorithm, resulting in a priority queue with O(√lg lg n) expected amortized time per operation. Thus for priority queues, being oblivious comes at a cost of at least Ω(lg n/√lg lg n). Finally, for search trees, there is the classic Fusion tree [9] supporting operations in O(lgw n) time and the y-fast trie [41] supporting operations in O(lg w) time when r = Θ(w). Thus one can always implement a search tree with O(min{lgw n, lg w}) = O(√lg n) time operations, hence obliviousness comes at a cost of at least Ω(√lg n) for search trees. We remark that the lower bound for search trees follows directly from the work of Larsen and Nielsen since search trees can solve the array maintenance problem without overhead. For the remaining problems, we need completely new proofs. 1.2 Related Results Proving lower bounds for data structures has a long history, starting with the introduction of the cell probe model by Yao [43]. Since then, many exciting techniques have been introduced [8, 26, 30, 33, 27, 31, 28, 34, 21, 22, 44, 4, 24, 40], with the current strongest lower bounds peaking at Ω((lg n/ lg lg n)2) [21]. Here we briefly survey the known lower bounds related to non-oblivious priority queues and search trees (stacks, queues and deques have constant time solutions without obliviousness). Tight lower bounds for search trees (predecessor search) were proven by Patra¸scu and Thorup [31] using an extension of the round elimination technique of Miltersen et al. [27]. Their lower bound holds even in the static case where no updates to the data are allowed. For priority queues, one cannot hope to prove an ω(1) lower bound in the cell probe model when w = Θ(r) (this is disappointing since the classic upper bound is O(√lg lg n)). The reason we cannot hope to prove ω(1) lower bounds is Thorup's reduction from priority queues to sorting: sorting can be done in linear time in the cell probe model (read the input and write it in sorted order). Hence priority queues have O(1) time cell probe solutions when w = Θ(r). In the external memory model (which corresponds to w = ω(r) and were we only charge for memory accesses and not computation time), we have a non-trivial lower bound of Ω((r/w) lg w/ lg lg n) for priority queues that support DecreaseKeys [6] and a near-matching upper bound of O((r/w) lg n/ lg lg n) [19]. Without DecreaseKeys, there are external memory priority queues supporting operations in O((r/w) lg n/ lg(m/w)) memory accesses [7]. 2 Lower Bounds We prove our lower bounds in the oblivious cell probe model of Larsen and Nielsen [23]. In this model, a data structure consists of a server memory of w-bit cells, each having an integer address in [K] for some K ≤ 2w. A data structure is furthermore equipped with a client memory of m bits, which is free to access. An oblivious cell probe data structure processes queries and updates by reading and writing to memory cells. For queries, the data structure terminates by announcing the answer to the query based on what it has probed. We refer to the reading and writing of a memory cell simply as probing it. The query and update time is defined as the number of cells it probes when processing a query and an update respectively. Randomized oblivious cell probe data structures furthermore have access to an arbitrarily long uniform random bit string R, which is referred to as the random oracle bit string. The bit string R is drawn before any operations are performed on the data structure and is chosen independently of the future operations. We say that a randomized oblivious data structure has failure probability δ if for every sequence of operations op1, . . . , opM , and for every query opi in that sequence, the probability that opi is answered correctly is at least 1 − δ. When processing updates and queries, the cells probed and the contents written to cells in each step may be an arbitrary deterministic function of the client memory, random oracle bit string and contents of all other cells probed so far while processing the current operation. The data structure is also allowed to update the client memory in each step, again setting the contents to an arbitrary deterministic function of the current memory, random oracle bit string and contents of cells probed so far. Allowing an arbitrary deterministic 3 function abstracts away the instruction set of a normal RAM and allows arbitrary computations free of charge. To define the security requirements of an oblivious data structure, let y := (op1, . . . , opM ) denote a sequence of M operations to a data structure problem. Let A(y) := (A(op1), . . . , A(opM )) denote the corresponding probe sequence, where each A(opi) is the list of probes made while processing opi. Note that A(y) is a deterministic function of the random oracle bit string and the sequence y. A data structure is then said to be oblivious if it satisfies the following security guarantee: Definition 1 (Security). An oblivious cell probe data structure is said to be secure if the following two properties hold: Indistinguishability: For any two sequences of operations y and z of the same length M , their probe sequences A(y) and A(z) cannot be distinguished with probability better than 1 4 by an algorithm which is polynomial time in M , w and the logarithm of the number of different updates and queries that can be performed on it. Formally, if An denotes the image of A on sequences of length n and f : An → {0, 1} denotes a polynomial time computable function, then it must be the case that Pr[f (A(y)) = 1] − Pr[f (A(z)) = 1] ≤ 1 4 for any two sequences y and z of length n. Here the probability is taken over the randomness of the data structure. Correctness: The oblivious cell probe data structure has failure probability at most 1/3 per operation. We remark that the above definition of indistinguishability requires that the adversary is deterministic. Since we are proving lower bounds, this restriction only strengthens our results, i.e., even if one needs only be secure against deterministic polynomial time adversaries, then our lower bounds still hold. With these definitions, we are ready to proceed to our proofs. We refer readers interested in a more formal definition of oblivious cell probe data structures to [23]. 2.1 Stacks In this section, we prove our lower bound for stacks and conclude by describing how a small change in the argument yields a similar lower bound for queues. Recall that a stack supports the two operations push and pop, where push adds an r-bit value to the "top" of the stack, and pop removes and returns the element last pushed to the stack (the "top" element). We prove the following lower bound: Theorem 2. Let D be a stack implemented in the oblivious cell probe model, with r-bit elements for r ≥ 1 and let n ≥ C be an upper bound on the number of elements in D, where C > 1 is some universal constant. If w ≥ 1 denotes the cell size of D, m ≥ w denotes the client memory size and D has failure probability at most 1/3, then there exists a sequence y of n operations such that D must have expected amortized running time Ω(lg(nr/m)r/w) on y. We let D be a stack as in Theorem 2, except that we assume it has failure probability no more than 1/32. Note that one can always obtain a stack with failure probability 1/32 by running a constant number of independent copies in parallel of a stack with failure probability 1/3. On a pop operation, we simply use a majority vote to determine the result. This increases the running time and memory size by only a constant factor. Throughout the proof, we let [K] ⊆ [2w] denote the set of possible addresses of the memory cells of D. To prove the theorem, we define a hard/expensive sequence y of n operations. The sequence is as follows: y := push(¯0), pop, push(¯0), pop, . . . , push(¯0), pop where ¯0 is the all-zeroes bit string of length r. The sequence y thus repeatedly pushes one element onto the stack, namely the all-zeroes bit string, and then immediately pops it again. This is done for a total of n 4 times, i.e., n/2 push operations and n/2 pop operations. The maximum size of the stack at any given time is thus 1. What makes y expensive in the oblivious setting, is that D's processing of y must be indistinguishable from many other sequences of n operations. To prove that y is expensive, we use the approach of Larsen and Nielsen [23] in their lower bound proof for online ORAMs. Their approach is an extension of the earlier information transfer method of Patra¸scu and Demaine [33], modified to capture the obliviousness requirement. The setup is as follows: Define an information transfer tree T as a binary tree with exactly n leaves. We assume that n is a power of two such that T is a perfect binary tree. For any sequence z = op1, . . . , opn of n operations, associate the i'th operation opi in z with the i'th leaf of T . When D processes the sequence z, it performs the probes A(z) = (A(op1), . . . , A(opn)) where each A(opi) is a sequence of probes pi,1, . . . , pi,ki performed by D when processing the operation opi. We assign every probe pi,j in every A(opi) to a node in T as follows: For a probe pi,j, let s ∈ [K] ⊆ [2w] denote the address of the memory cell probed. Let pi′,j ′ be the last probe prior to pi,j which also probed the cell with address s. We assign pi,j to the lowest common ancestor of the two leaves corresponding to opi′ and opi (leaf number i′ and i). If pi′,j ′ does not exist, i.e., the cell with address s was never probed before, then we do not assign pi,j to any node in T . Our goal is to show that for the sequence y, there must be many nodes in T that have many probes assigned to them. Since a probe is only assigned to one node in T , this implies that there must be a large number of probes in A(y). To prove this, define depth(v) for a node v ∈ T to be the distance from v to the root of T , i.e., the root has depth 0 and the leaves have depth lg n. If we use Pv(z) to denote the set of probes assigned to a node v ∈ T for a sequence of n operations z, then we prove the following: Lemma 1. If D has failure probability at most 1/32 and n ≥ C for some universal constant C > 1, then for every internal node v ∈ T of depth d = depth(v) ∈ {5, . . . , (1/2) lg(nr/m)}, it must be the case that E[Pv(y)] = Ω(nr/(w2d)). Intuitively, the lemma says that Pv(y) contains Ω(r/w) probes for every operation in v's subtree. Now, since an operation is contained in the subtree rooted at Ω(lg(nr/m)) nodes with a depth in {5, . . . , lg(nr/m)}, it follows that every operation must incur Ω(lg(nr/m)r/w) probes in total. Before proving Lemma 1, we prove formally that it implies Theorem 2. For this, observe that by linearity of expectation and the fact that any probe in A(y) is assigned to at most one node of T , we have: E[A(y)] ≥ Xv∈T (y) E[Pv(y)] (1/2) lg(nr/w) ≥ = Ω  (1/2) lg(nr/w) Xd=5 Xd=5 Xv∈T (y):depth(v)=d E[Pv(y)] 2d · (nr/(w2d))  = Ω(n lg(nr/w)r/w). Since there are n operations in y, this implies that the expected amortized running time of D is Ω(lg(nr/w)r/w). We thus set out to prove Lemma 1. For this, let v ∈ T be a node with d = depth(v) ∈ {5, . . . , (1/2) lg(nr/m)}. Consider the following random sequence Zv = op1, . . . , opn of n operations: For every operation opi not as- sociated to a leaf in v's subtree, we let opi = push(¯0) if i is odd and we let opi = pop if i is even. Thus Zv is identical to the sequence y outside the subtree rooted at v. The n/2d+1 operations opj, . . . , opj+n/2d+1 in v's left subtree are push(b1), . . . , push(bn/2d+1) where each bi is a uniform random and independently chosen r-bit string. The n/2d+1 operations in v's right subtree are all pop operations. Thus for the sequence Zv, we start by repeatedly pushing and popping ¯0 until we reach v's left subtree. We then push n/2d+1 random bit strings onto the stack and pop them again in v's right subtree. The intuition is that while D processes the pop operations in v's right subtree, it needs to recover all the random bits that were pushed during 5 the operations in v's left subtree. By an entropy argument, this means that D must read Ω(nr/2d+1) bits containing information about b1, . . . , bn/2d+1. This costs Ω(nr/(2d+1w)) probes as cells have w bits. Now observe that those probes must be assigned to v. To see this, note that if they were assigned to ancestors of v, then they read information that was written prior to the operations in v's left subtree were performed. Hence they cannot reveal useful information about b1, . . . , bn/2d+1. Similarly, if they were assigned to descendants of v, then they must be assigned to nodes in v's right subtree. But this means that the cell was already probed during v's right subtree and thus the probe reveals no new information about b1, . . . , bn/2d+1. We will use this line of argument to show that: Lemma 2. If D has failure probability at most 1/32 and n ≥ C for some universal constant C > 1, then for every internal node v ∈ T of depth d = depth(v) ∈ {5, . . . , (1/2) lg(nr/m)}, it must be the case that Pr[Pv(Zv) ≥ (1/100)nr/(w2d)] ≥ 1/2. Lemma 2 shows that for the random sequence Zv, there must often be many probes assigned to v. Before proving Lemma 2, we use it to finish the proof of Lemma 1. The key idea is that the indistinguishability assumption forces the behaviour of D to look identical regardless of whether it is processing y or Zv. Thus in some sense Pv(Zv) and Pv(y) have to be similar, i.e., y must also force many probes to be assigned to v. We argue formally as follows: Assume for the sake of contradiction that E[Pv(y)] ≤ (1/400)nr/(w2d). Then by Markov's inequality, we have Pr[Pv(y) ≥ (1/100)nr/(w2d)] ≤ 1/4. Moreover, Lemma 2 and an averaging argument implies that there exists a sequence z ∈ supp(Zv) such that Pr[Pv(z) ≥ (1/100)nr/(w2d)] ≥ 1/2. The following procedure now distinguishes y and z with probability at least 1/4: Let a ∈ {y, z} be one of the two sequences of n operations. From A(a), compute the set Pv(a). If Pv(a) ≥ (1/100)nr/(w2d) output 1. Otherwise output 0. Notice that for a = z, this algorithm outputs 1 with probability at least 1/2, whereas if a = y, it outputs 1 with probability at most 1/4, i.e., the algorithm distinguishes y and z with probability at least 1/4. Since the algorithm uses only A(a) to construct Pv(a) and since the algorithm runs in time polynomial in n, this contradicts D being an oblivious stack and completes the proof of Lemma 1. What remains is to prove Lemma 2. As mentioned above, our proof will exploit that the pop operations in v's right subtree have to recover all the random bits inserted into the stack by the push operations in v's left subtree. The formal proof proceeds via an encoding argument. We have two players Alice (encoder) and Bob (decoder) that share the random oracle bit string R used by D. Alice is given b1, . . . , bn/2d+1 as input and must send a message to Bob such that Bob can recover b1, . . . , bn/2d+1 from the message and R. Let H(·) denote binary entropy. Since b1, . . . , bn/2d+1 are uniform random r-bit strings that are chosen independently of each other and the random oracle bit string R, we have H(b1 . . . bn/2d+1 R) = nr/2d+1. It follows from Shannon's source coding theorem than any encoding (message of Alice) must have an expected length of at least nr/2d+1 bits if it allows Bob to recover b1, . . . , bn/2d+1. We now assume for the sake of contradiction Lemma 2 is false, i.e., D has failure probability at most 1/32 and satisfies Pr[Pv(Zv) ≥ (1/100)nr/(w2d)] < 1/2. Our goal is to show that this assumption allows Alice to send a message shorter than nr/2d+1 bits in expectation while still allowing Bob to recover b1, . . . , bn/2d+1. This is an information theoretic contradiction. Encoding. Alice is given b1, . . . , bn/2d+1 and R. She proceeds as follows: 1. She starts by constructing the sequence Zv from b1, . . . , bn/2d+1. Let Z 0 v denote the subsequence consisting of all operations preceeding v's subtree. Let Z r v denote the operations in v's left subtree (the push operations) and let Z ℓ v denote the operations in v's right subtree (the pop operations). Alice runs the sequence of operations Z 0 v on D using the randomness R. Here ◦ denotes concatenation and Z 0 v is simply the sequence of operations up to and including v's subtree. While doing so, she computes the set Pv(Zv) (this set does not depend on operations after v's subtree) and the set Q containing all pop operations in v's right subtree that fail to return the correct answer. If either v ◦ Z ℓ v ◦ Z r v ◦ Z ℓ v ◦ Z r 6 Pv(Zv) ≥ (1/100)nr/(w2d) or if Q ≥ (1/8)n/2d+1, then Alice sends a 0-bit followed by a naive encoding of b1, . . . , bn/2d+1, costing nr/2d+1 bits. Otherwise Alice sends a 1-bit and proceeds to the next step. 2. Alice now sends Bob the contents of the client memory as it was immediately after processing Z 0 v ◦ Z ℓ v, costing m bits. She also sends all cells probed by probes in Pv(Zv). When sending the cells probed by probes in Pv(Zv), she sends their addressess as well as their contents as they were immediately after processing Z 0 v. Accounting for specifying Pv(Zv), this costs at most lg n + ((1/100)nr/(w2d+1))· (lg K + w) bits. Finally, Alice also sends the set Q together with the correct answer to every pop (1/8)n/2d+1(cid:1) bits. This concludes Alice's operation in Q. This costs at most lg n + (1/8)nr/2d+1 + lg(cid:0) n/2d+1 v ◦ Z ℓ message. Decoding. Bob is given R and Alice's message. His task is to recover b1, . . . , bn/2d+1. He does as follows: 1. He starts by checking the first bit of Alice's message. If this is a 0-bit, he immediately recovers b1, . . . , bn/2d+1 from the remaining part of the message (the naive encoding). Otherwise, he proceeds to the next step. 2. Bob can privately compute Z 0 v and Z r v ◦ Z ℓ v. Finally, he skips over all operations in Z ℓ v as they are independent of b1, . . . , bn/2d+1. He does so and now runs Z 0 v on D using the randomness R. Once this has finished, he updates the client memory to what v ◦ Z ℓ Alice told him it was after Z 0 v. He also overwrites the contents of every cell probed in Pv(Zv) with the contents as they were after processing Z 0 v and runs all the operations in Z r v on D. He collects the list of answers returned by the pop operations in Z r v and finally corrects the answers to all those pop operations that appear in Q. We claim that all v ◦ Z ℓ pop operations in Z r v now give the correct answer for the sequence Z 0 v and thus Bob recovers bi from the answer to the (n/2d+1 − i + 1)'th pop operation in Z r v . To see this, observe that before applying the corrections in Q, all pop operations give the same answers as when Alice executed them. This is true for the following reason: Every time a probe is made in Z r v , Bob has the same contents of the probed cell as Alice did during her processing of the operation. Indeed, consider the first time a cell with some address s ∈ [K] is probed during the processing of Z r v . If that probe is in Pv(Zv), then the contents are correct since he updated the contents based on Alice's message. If the probe was assigned to an ancestor of v, it must be the case that the cell was not updated during Alice's processing of Z ℓ v (by the way we assigned probes). Hence the contents Bob has from his simulation of Z 0 v are also the correct contents after processing Z 0 v. Finally, the cell cannot be assigned to a descendant of v as this would contradict that it is the first time it is being probed during Z r v . It follows that Bob always has the same contents of the probed cells as Alice did, and hence his answers to the pop operations are consistent with Alice's answers (they use the same randomness R). v ◦ Z ℓ v ◦ Z r Analysis. What remains is to analyse the expected size of the encoding to derive our contradiction. Consider first the case in which Alice's message starts with a 1-bit. In this case, Alice sends no more than m + 2 lg n + ((1/100)nr/(w2d)) · (lg K + w) + (1/8)nr/2d+1 + lg(cid:18) n/2d+1 (1/8)n/2d+1(cid:19) bits. Using that lg K ≤ w by assumption, (cid:0) n/2d+1 (nr/2d+1)/16 (here we use both d ≥ 5 and d ≤ (1/2) lg(nr/m)), we can bound the above by: (1/16)nr/2d+1 + 2 lg n + (1/25)nr/2d+1 + (1/8)nr/2d+1 + (lg(8e)/8)n/2d+1 ≤ 2 lg n + (1/16 + 1/25 + 1/8 + 56/100)nr/2d+1 ≤ 2 lg n + (79/100)nr/2d+1 ≤ (1/8)n/2d+1(cid:1) ≤ (8e)(1/8)n/2d+1 (99/100)nr/2d+1. and m ≤ nr/22d = (nr/2d+1)/2d−1 ≤ 7 In the last line, we used that nr/2d+1 ≥ √nrm/2 which for n at least some sufficiently large constant is much bigger than 2 lg n. Letting C denote the event that Alice's message starts with a 0-bit, we get that the expected number of bits sent is 1 + Pr[C]nr/2d+1 + (1 − Pr[C])(99/100)nr/2d+1. This is increasing in Pr[C], thus we upper bound Pr[C]. First note that Pr[Pv(Zv) ≥ (1/100)nr/(w2d)] < 1/2 by assumption. Moreover, we have E[Q] = (1/32)n/2d+1 since D has failure probability at most 1/32. Hence Pr[Q ≥ (1/8)n/2d+1] ≤ 1/4. By Markov's inequality and a union bound, we have Pr[C] ≤ 1/2 + 1/4 = 3/4. Therefore the expected number of bits sent by Alice is upper bounded by: 1 + (3/4)nr/2d+1 + (1/4)(99/100)nr/2d+1 < nr/2d+1 = H(b1 ··· bn/2d+1 R) which gives our contradiction. 2.2 Other Data Structures In the following, we discuss extensions of the above lower bound to other oblivious data structures. First consider a queue supporting enqueue and dequeue operations. Observe that we can repeat all arguments in the proof of our stack lower bound, replacing any push operation by an enqueue operation and every pop operation by a dequeue operation. The only difference is in the encoding game where Bob uses the answer from the i'th dequeue operation to recover bi instead of using the (n/2d+1 − i + 1)'th pop operation (because a queue is First-In-First-Out as opposed to the Last-In-First-Out behaviour of a stack). Thus the lower bound of Theorem 2 also applies to queues. Since a deque can simulate both a stack and a queue, the same lower bound naturally applies to deques as well. A priority queue can simulate a queue simply by inserting items with increasing priority, hence the same running time lower bound applies to priority queues as well. Finally, a search tree can simulate all of these, as well as an array, hence the lower bound also applies to search tree and we conclude: Theorem 3. Let D be either a stack, queue, deque, priority queue or search tree implemented in the oblivious cell probe model, with r-bit elements for r ≥ 1 and let n be an upper bound on the number of elements in D. If w denotes the cell size of D, m denotes the client memory size and D has failure probability at most 1/3 per operation, then there exists a sequence y of n operations such that D must have expected amortized running time Ω(lg(nr/m)r/w) on y. References [1] G. Asharov, I. Komargodski, W.-K. Lin, K. Nayak, and E. Shi. Optorama: Optimal oblivious ram. Cryptology ePrint Archive, Report 2018/892, 2018. https://eprint.iacr.org/2018/892. [2] E. Boyle, K. Chung, and R. Pass. Oblivious parallel RAM and applications. In E. Kushilevitz and T. Malkin, editors, Theory of Cryptography - 13th International Conference, TCC 2016-A, Tel Aviv, Israel, January 10-13, 2016, Proceedings, Part II, volume 9563 of Lecture Notes in Computer Science, pages 175 -- 204. Springer, 2016. [3] K. Chung, Z. Liu, and R. Pass. Statistically-secure ORAM with o(log2 n) overhead. In P. Sarkar and T. Iwata, editors, Advances in Cryptology - ASIACRYPT 2014 - 20th International Conference on the Theory and Application of Cryptology and Information Security, Kaoshiung, Taiwan, R.O.C., December 7-11, 2014, Proceedings, Part II, volume 8874 of Lecture Notes in Computer Science, pages 62 -- 81. Springer, 2014. 8 [4] R. Clifford, A. Grønlund, and K. G. Larsen. New unconditional hardness results for dynamic and online problems. In Proc. 56th IEEE Symposium on Foundations of Computer Science, 2015. [5] I. Damgard, S. Meldgaard, and J. B. Nielsen. Perfectly secure oblivious RAM without random oracles. In Y. Ishai, editor, Theory of Cryptography - 8th Theory of Cryptography Conference, TCC 2011, Providence, RI, USA, March 28-30, 2011. Proceedings, volume 6597 of Lecture Notes in Computer Science, pages 144 -- 163. Springer, 2011. [6] K. Eenberg, K. G. Larsen, and H. Yu. DecreaseKeys are expensive for external memory priority queues. In STOC'17 -- Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of Computing, pages 1081 -- 1093. ACM, New York, 2017. [7] R. Fadel, K. V. Jakobsen, J. Katajainen, and J. Teuhola. Heaps and heapsort on secondary storage. Theoret. Comput. Sci., 220(2):345 -- 362, 1999. [8] M. L. Fredman and M. E. Saks. The cell probe complexity of dynamic data structures. In Proceedings of the 21st Annual ACM Symposium on Theory of Computing, pages 345 -- 354, 1989. [9] M. L. Fredman and D. E. Willard. Surpassing the information theoretic bound with fusion trees. Journal of Computer and System Sciences, 47(3):424 -- 436, 1993. [10] S. Garg, S. Lu, and R. Ostrovsky. Black-box garbled RAM. In V. Guruswami, editor, IEEE 56th Annual Symposium on Foundations of Computer Science, FOCS 2015, Berkeley, CA, USA, 17-20 October, 2015, pages 210 -- 229. IEEE Computer Society, 2015. [11] C. Gentry, S. Halevi, S. Lu, R. Ostrovsky, M. Raykova, and D. Wichs. Garbled RAM revisited. In P. Q. Nguyen and E. Oswald, editors, Advances in Cryptology - EUROCRYPT 2014 - 33rd Annual International Conference on the Theory and Applications of Cryptographic Techniques, Copenhagen, Denmark, May 11-15, 2014. Proceedings, volume 8441 of Lecture Notes in Computer Science, pages 405 -- 422. Springer, 2014. [12] O. Goldreich and R. Ostrovsky. Software protection and simulation on oblivious RAMs. J. ACM, 43(3):431 -- 473, 1996. [13] M. T. Goodrich. BIOS ORAM: improved privacy-preserving data access for parameterized outsourced storage. In B. M. Thuraisingham and A. J. Lee, editors, Proceedings of the 2017 on Workshop on Privacy in the Electronic Society, Dallas, TX, USA, October 30 - November 3, 2017, pages 41 -- 50. ACM, 2017. [14] M. T. Goodrich. Isogrammatic-fusion ORAM: improved statistically secure privacy-preserving cloud data access for thin clients. In Proceedings of the 13th ACM ASIA Conference on Information, Computer and Communication Security, 2018. To appear. [15] M. T. Goodrich and M. Mitzenmacher. Mapreduce parallel cuckoo hashing and oblivious RAM simu- lations. CoRR, abs/1007.1259, 2010. [16] M. T. Goodrich and M. Mitzenmacher. Privacy-preserving access of outsourced data via oblivious RAM simulation. In L. Aceto, M. Henzinger, and J. Sgall, editors, Automata, Languages and Programming - 38th International Colloquium, ICALP 2011, Zurich, Switzerland, July 4-8, 2011, Proceedings, Part II, volume 6756 of Lecture Notes in Computer Science, pages 576 -- 587. Springer, 2011. [17] M. T. Goodrich, M. Mitzenmacher, O. Ohrimenko, and R. Tamassia. Privacy-preserving group data access via stateless oblivious RAM simulation. In Rabani [35], pages 157 -- 167. [18] Y. Han and M. Thorup. Integer sorting in O(n√lg lg n) expected time and linear space. In Foundations of Computer Science, 2002. Proceedings. The 43rd Annual IEEE Symposium on, pages 135 -- 144. IEEE, 2002. 9 [19] S. Jiang and K. Green Larsen. A Faster External Memory Priority Queue with DecreaseKeys. ArXiv e-prints, June 2018. [20] E. Kushilevitz, S. Lu, and R. Ostrovsky. On the (in)security of hash-based oblivious RAM and a new balancing scheme. In Rabani [35], pages 143 -- 156. [21] K. G. Larsen. The cell probe complexity of dynamic range counting. In Proc. 44th ACM Symposium on Theory of Computation, pages 85 -- 94, 2012. [22] K. G. Larsen. Higher cell probe lower bounds for evaluating polynomials. In 53rd Annual IEEE Symposium on Foundations of Computer Science, FOCS 2012, pages 293 -- 301, 2012. [23] K. G. Larsen and J. B. Nielsen. Yes, there is an oblivious RAM lower bound! In H. Shacham and A. Boldyreva, editors, Advances in Cryptology - CRYPTO 2018 - 38th Annual International Cryptology Conference, Santa Barbara, CA, USA, Lecture Notes in Computer Science. Springer, 2018. [24] K. G. Larsen, O. Weinstein, and H. Yu. Crossing the logarithmic barrier for dynamic boolean data structure lower bounds. In Symposium on Theory of Computing, STOC 2018, 2018. To appear. [25] S. Lu and R. Ostrovsky. Black-box parallel garbled RAM. In J. Katz and H. Shacham, editors, Advances in Cryptology - CRYPTO 2017 - 37th Annual International Cryptology Conference, Santa Barbara, CA, USA, August 20-24, 2017, Proceedings, Part II, volume 10402 of Lecture Notes in Computer Science, pages 66 -- 92. Springer, 2017. [26] P. B. Miltersen. On the cell probe complexity of polynomial evaluation. Theoretical Computer Science, 143:167 -- 174, May 1995. [27] P. B. Miltersen, N. Nisan, S. Safra, and A. Wigderson. On data structures and asymmetric communi- cation complexity. Journal of Computer and System Sciences, 57(1):37 -- 49, 1998. [28] R. Panigrahy, K. Talwar, and U. Wieder. Lower bounds on near neighbor search via metric expansion. In 51th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2010, pages 805 -- 814, 2010. [29] S. Patel, G. Persiano, M. Raykova, and K. Yeo. PanORAMa: Oblivious RAM with logarithmic overhead. IACR Cryptology ePrint Archive, 2018:373, 2018. [30] M. Patra¸scu and E. D. Demaine. Tight bounds for the partial-sums problem. In Proceedings of the Fifteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2004, pages 20 -- 29, 2004. [31] M. Patra¸scu and M. Thorup. Time-space trade-offs for predecessor search. In Proc. 38th ACM Sympo- sium on Theory of Computation, pages 232 -- 240, 2006. [32] B. Pinkas and T. Reinman. Oblivious RAM revisited. In T. Rabin, editor, Advances in Cryptology - CRYPTO 2010, 30th Annual Cryptology Conference, Santa Barbara, CA, USA, August 15-19, 2010. Proceedings, volume 6223 of Lecture Notes in Computer Science, pages 502 -- 519. Springer, 2010. [33] M. Patra¸scu and E. D. Demaine. Logarithmic lower bounds in the cell-probe model. SIAM J. Comput., 35(4):932 -- 963, 2006. [34] M. Patra¸scu and M. Thorup. Don't rush into a union: take time to find your roots. In Proceedings of the 43rd ACM Symposium on Theory of Computing, STOC 2011, pages 559 -- 568, 2011. [35] Y. Rabani, editor. Proceedings of the Twenty-Third Annual ACM-SIAM Symposium on Discrete Algo- rithms, SODA 2012, Kyoto, Japan, January 17-19, 2012. SIAM, 2012. 10 [36] E. Stefanov and E. Shi. Oblivistore: High performance oblivious distributed cloud data store. In 20th Annual Network and Distributed System Security Symposium, NDSS 2013, San Diego, California, USA, February 24-27, 2013. The Internet Society, 2013. [37] E. Stefanov, M. van Dijk, E. Shi, C. W. Fletcher, L. Ren, X. Yu, and S. Devadas. Path ORAM: an extremely simple oblivious RAM protocol. In A. Sadeghi, V. D. Gligor, and M. Yung, editors, 2013 ACM SIGSAC Conference on Computer and Communications Security, CCS'13, Berlin, Germany, November 4-8, 2013, pages 299 -- 310. ACM, 2013. [38] M. Thorup. Equivalence between priority queues and sorting. Journal of the ACM (JACM), 54(6):28, 2007. [39] X. S. Wang, K. Nayak, C. Liu, T. H. Chan, E. Shi, E. Stefanov, and Y. Huang. Oblivious data structures. In G. Ahn, M. Yung, and N. Li, editors, Proceedings of the 2014 ACM SIGSAC Conference on Computer and Communications Security, Scottsdale, AZ, USA, November 3-7, 2014, pages 215 -- 226. ACM, 2014. [40] O. Weinstein and H. Yu. Amortized dynamic cell-probe lower bounds from four-party communication. In Proc. 57th IEEE Symposium on Foundations of Computer Science, pages 305 -- 314, 2016. [41] D. E. Willard. Log-logarithmic worst-case range queries are possible in space θ(n). Information Pro- cessing Letters, 17(2):81 -- 84, 1983. [42] P. Williams, R. Sion, and A. Tomescu. Privatefs: a parallel oblivious file system. In T. Yu, G. Danezis, and V. D. Gligor, editors, the ACM Conference on Computer and Communications Security, CCS'12, Raleigh, NC, USA, October 16-18, 2012, pages 977 -- 988. ACM, 2012. [43] A. C. Yao. Should tables be sorted? J. ACM, 28(3):615 -- 628, 1981. [44] H. Yu. Cell-probe lower bounds for dynamic problems via a new communication model. CoRR, abs/1512.01293, 2015. 11
1807.10531
1
1807
2018-07-27T10:54:15
Alternating Path and Coloured Clustering
[ "cs.DS" ]
In the Coloured Clustering problem, we wish to colour vertices of an edge coloured graph to produce as many stable edges as possible, i.e., edges with the same colour as their ends. In this paper, we reveal that the problem is in fact a maximum subgraph problem concerning monochromatic subgraphs and alternating paths, and demonstrate the usefulness of such connection in studying these problems. We obtain a faster algorithm to solve the problem for edge-bicoloured graphs by reducing the problem to a minimum cut problem. On the other hand, we push the NP-completeness of the problem to edge-tricoloured planar bipartite graphs of maximum degree four. Furthermore, we also give FPT algorithms for the problem when we take the numbers of stable edges and unstable edges, respectively, as parameters.
cs.DS
cs
Alternating Path and Coloured Clustering CAI Leizhen∗ and LEUNG On Yin† Department of Computer Science and Engineering The Chinese University of Hong Kong Shatin, New Territories, Hong Kong SAR, China March 23, 2021 Abstract In the Coloured Clustering problem, we wish to colour vertices of an edge coloured graph to produce as many stable edges as possible, i.e., edges with the same colour as their ends. In this paper, we reveal that the problem is in fact a maximum subgraph problem concerning monochro- matic subgraphs and alternating paths, and demonstrate the usefulness of such connection in studying these problems. We obtain a faster algorithm to solve the problem for edge-bicoloured graphs by reducing the problem to a minimum cut problem. On the other hand, we push the NP-completeness of the problem to edge-tricoloured planar bipartite graphs of maximum degree four. Furthermore, we also give FPT algorithms for the problem when we take the numbers of stable edges and unstable edges, respectively, as parameters. 1 Introduction The following Coloured Clustering problem has been proposed recently by Angel et al. [3] in connection with the classical correlation clustering prob- lem [5]: Compute a vertex colouring of an edge-coloured graph G to produce as many stable edges as possible, i.e., edges with the same colour as their ends. As observed by Ageev and Kononov [1], the problem contains the classical maxi- mum matching problem as a special case as the two problems coincide when all edges have different colours in G. In this paper we will reveal that Coloured Clustering, despite its defi- nition by vertex partition, is in fact the following maximum subgraph problem ∗Email: [email protected], Partially supported by CUHK Direct Grant 4055069 †Email: [email protected] 1 Alternating Path and Coloured Clustering 2 in disguise: find a largest subgraph where every vertex has one colour for its in- cident edges (Vertex-Monochromatic Subgraph), or, equivalently, delete fewest edges to destroy all alternating paths (Alternating Path Removal). This multiple points of view gives us a better understanding of these problems, and is quite useful in studying them. We are mainly interested in algorithmic issues of Coloured Clustering, and will consider polynomial-time algorithms, NP-completeness, and also FPT algorithms for the two natural parameters from the subgraph point of view: numbers of edges inside (stable edges) and outside (unstable edges), respectively, the solution subgraph. 1.1 Main results We now summarize our main results for Coloured Clustering, where m and n, respectively, are numbers of edges and vertices in G. These results can be translated directly into corresponding results for Vertex-Monochromatic Subgraph and Alternating Path Removal. • We obtain an O(m3/2 log n)-time algorithm for edge-bicoloured graphs G by a reduction to the classical minimum cut problem, which improves the O(m3/2n)-time algorithm of Angel et al. [3] based on independent sets in bipartite graphs. We also give linear-time algorithms for the special case when G is a complete graph (see §4). • We push the NP-completeness of the problem to edge-tricoloured planar bipartite graphs of maximum degree four (see §5). • We derive FPT algorithms for the problem when we take the numbers of stable edges and unstable edges, respectively, as parameter k, which is uncommon for most problems parameterized in this way. Furthermore, we obtain a kernel with at most 4k vertices and 2k2 + k edges for the latter problem (see §6). 1.2 Related work Both monochromatic subgraphs and alternating paths are at least half-century old, and there is a huge number of papers in the literature dealing with them graph theoretically [4, 10]. However, we are not aware of any work on these two subjects that is directly related to the algorithmic problems we study in this paper. In the literature, papers by Angel et al. [3] and Ageev and Kononov [1] seem to be the only work that directly study Coloured Clustering. Angel et al. obtain an LP-based 1/e2-approximation algorithm for the problem in Alternating Path and Coloured Clustering 3 general, which is improved to a 7/23-approximation algorithm by Ageev and Kononov. Angel et al. also give a polynomial-time algorithm for the problem on edge-bicoloured graphs by a reduction to the maximum independent set problem on bipartite graphs, but show the NP-completeness of the problem for edge-tricoloured bipartite graphs. 2 Definitions An edge-coloured graph G is a simple graph where each edge e has a unique colour ψ(e) ∈ {1, . . . , t} for some positive integer t. We say that G is edge- bicoloured if t = 2, and edge-tricoloured if t = 3. Unless specified otherwise, we use m and n, respectively, for the numbers of edges and vertices of G. A vertex v is colourful if its incident edges have at least two different colours, and monochromatic otherwise. A subgraph H of G is vertex-monochromatic if all vertices in H are monochromatic vertices of H, and edge-monochromatic if all edges in H have the same colour. A conflict pair is a pair of adjacent edges of different colours, and an al- ternating path is a simple path where every pair of consecutive edges forms a conflict pair. The edge-conflict graph of G, denoted X(G), is an uncoloured graph where each vertex represents an edge of G and each edge corresponds to a conflict pair in G. A vertex colouring f of G assigns to each vertex v of G a colour f (v) ∈ {1, . . . , t} for some positive integer t. For a vertex colouring f of G, an edge uv is stable if its colour ψ(uv) = f (u) = f (v), and unstable otherwise. Angel et al. [3] have recently proposed the following problem, which is in fact, as we will see shortly, the problem of finding the largest vertex-monochromatic subgraph in G in disguise (see Lemma 3.1). Coloured Clustering Input: Edge coloured graph G and positive integer k. Question: Is there a vertex colouring of G that produces at least k stable edges? The following problem is concerned with purging conflict-pairs (equiva- lently, alternating paths) by edge deletion, and is the complementary problem of Coloured Clustering (see Corollary 3.2). Conflict-Pair Removal Input: Edge coloured graph G and positive integer k. Question: Does G contain at most k edges E′ such that G − E′ contains no conflict pair? Alternating Path and Coloured Clustering 4 3 Basic properties Although Coloured Clustering is defined by vertex partition (i.e., vertex colouring), it is in fact a maximum subgraph problem in disguise. To see this, we first observe the following equivalent properties for edge-coloured graphs. Lemma 3.1 The following statements are equivalent for any edge-coloured graph G: (a). G is vertex-monochromatic. (b). Every component of G is edge-monochromatic. (c). G has no alternating path. (d). G has no conflict pair. Proof. The equivalence between (a) and (b) is obvious, and so is the equiv- alence between (c) and (d) as a conflict pair is itself an alternating path. Fur- thermore, it is again obvious that G contains a conflict pair if and only if G has a colourful vertex, and therefore (a) and (d) are equivalent. It follows that the four statements are indeed equivalent. Observe that for any vertex colouring of G, the subgraph formed by stable edges is vertex-monochromatic, and hence Coloured Clustering is actually equivalent to finding a largest vertex-monochromatic subgraph, which in turn is equivalent to deleting fewest edges to destroy all conflict pairs. This gives us the following complementary relation between Coloured Clustering and Conflict-Pair Removal. Corollary 3.2 There is vertex colouring for G that produces at least k stable edges if and only if G contains at most m− k edges E′ such that G− E′ has no conflict pair. The bilateral relation between Coloured Clustering and Conflict- Pair Removal is akin to that between the classical Independent Set and Vertex Cover. In fact, the former two problems become exactly the latter two in the edge-conflict graph X(G) of G (see Theorem 3.3). It is very useful to view Coloured Clustering as an edge deletion prob- lem, instead of a vertex partition problem, which often makes things easier. For instance, it becomes straightforward to obtain the following result of Angel et al. [3] for X(G). Theorem 3.3 [Angel et al.[3]] An edge-coloured graph G admits a vertex colour- ing that produces at least k stable edges if and only if the edge-conflict graph X(G) of G has an independent set of size at least k. Alternating Path and Coloured Clustering 5 Proof. By Corollary 3.2, the former statement is equivalent to deleting at most m − k edge to obtain a graph without conflict pair, which is the same as X(G) has a vertex cover of size at most m − k, and hence X(G) has an independent set of size at least k. 4 Algorithms for edge-bicoloured graphs Although Coloured Clustering is NP-complete for edge-tricoloured graphs [3], Angel et al. [3] have obtained an O(m3/2n)-time algorithm for the problem on edge-bicoloured graphs G by reducing it to the maximum independent set problem on bipartite graphs X(G). In this section, we will give a faster O(m3/2 log n)-time algorithm by considering Conflict-Pair Removal, which leads us to a simple reduction to a minimum cut problem. We also give a linear- time algorithm for the problem on edge-bicoloured complete graphs. 4.1 Faster algorithm One bottleneck of the algorithm of Angel et al. lies in the size of the edge- conflict graph X(G) which contains O(m) vertices and O(mn) edges. Here we use a different approach of reduction to construct a digraph G′ with only O(m) vertices and edges, and then solve an equivalent minimum cut problem on G′ to solve our problem. Let G = (V, E) be an edge-bicoloured graph with colours {1, 2}, and consider Conflict-Pair Removal. Our idea is to transform every conflict pair in G into an (s, t)-path in a digraph G′ with source s and sink t. For this purpose, we construct digraph G′ from G as follows (see Figure 1 for an example of the construction): 1. Take graph G and add two new vertices -- source s and sink t. 2. For each edge vivj of G, create a new vertex vij to represent edge vivj. If vivj has colour 1 then replace it by two edges vijvi and vijvj and add edge svij. Otherwise replace the edge by two edges vivij and vjvij and add edge vijt. An (s, t)-cut in G′ is a set of edges whose deletion disconnects sink t from source s. Let vivj and vivj′ be an arbitrary conflict pair of G. Without loss of generality, we may assume that vivj has colour 1 and vivj′ has colour 2. By the construction of G′, there is a unique (s, t)-path P (j, i, j′) = svij, vijvi, vivij′, vij′t in G′ that goes through vertices vij and vij′. For convenience, we refer to edges svij and vij′t as external edges and the other two edges as middle edges. Edges Alternating Path and Coloured Clustering 6 1 v1 s v1 1 2 1 2v 2 3v 1 5v 1 1 4v 2 2 2 (a) 2v 3v 5v 4v t (b) Figure 1: Digraph G′ from graph G, where shaded vertices in G′ correspond to edges in G and thick edges indicate corresponding solution edges. vivj and vivj′ of G correspond to external edges svij and vij′t, respectively, in G′. We also call an (s, t)-cut a normal cut if the cut contains no middle edge of any P (j, i, j′). Lemma 4.1 Let E′ be a set of edges in G. Then G − E′ contains no conflict pair if and only if corresponding edges of E′ in G′ form a normal (s, t)-cut of G′. Proof. There is a one-to-one correspondence between conflict pair vivj and vivj′ in G and external edges svij and vij′t in G′ in such a way that the conflict pair is destroyed if and only if the (s, t)-path P (j, i, j′) is disconnected. This clearly implies the lemma. The above lemma enables us to solve Conflict-Pair Removal on edge- bicoloured graphs by reducing it to the minimum cut problem, which yields a faster algorithm. Theorem 4.2 Conflict-Pair Removal for edge-bicoloured graphs G can be solved in O(m3/2 log n). Proof. By Lemma 4.1, we can reduce our problem on G to the minimum normal (s, t)-cut problem on digraph G′. Observe that for any (s, t)-cut, we can always replace a middle edge by an external edge without increasing the size of the cut. Therefore we need only solve the minimum (s, t)-cut problem on digraph G′, which can be accomplished by the maximum flow algorithm of Goldberg and Rao [9]. For the running time of the algorithm, we first note that G′ contains N = m + n + 2 vertices and M = 3m edges, and can be constructed in O(m + n) Alternating Path and Coloured Clustering 7 time. Since every edge of G′ has capacity 1, Goldberg and Rao's algorithm takes O(min(N 2/3, M 1/2)M log N 2/M ) time, which gives us O(m3/2 log n) time as M, N = O(m). Corollary 4.3 Coloured Clustering for edge-bicoloured graphs G can be solved in O(m3/2 log n) time. 4.2 Complete graphs We now turn to the special case of Coloured Clustering when G = (V, E) is an edge-bicoloured complete graph, and present a linear-time algorithm. Let f be a vertex-2-colouring of G that colours vertices V1 by colour 1 and vertices V2 by colour 2. For a vertex v, let d1(v) be the number of edges of colour 1 incident with v. Let m1 be the number of edges with colour 1. We can completely determine the number of stable edges produced by f as follows. Lemma 4.4 For a vertex-2-colouring f of an edge-bicoloured complete graph G, the number Sf of stable edges produced by f equals d1(v) + V2 2 ! − m1. Xv∈V1 Proof. Let A and B be numbers of edges of colour 1 in G[V1] and G[V2] respectively. By the definition of stable edges, we have Sf = A + ( V2 2 ! − B) as G[V2] is a complete graph. On the other hand, B = m1 − C, where C is the number of edges of colour 1 covered by vertices V1. Therefore Sf = A + V2 2 ! + C − m1, and the lemma follows from the fact that A + C = Pv∈V1 d1(v). With the formula in the above lemma, we can easily and efficiently solve Coloured Clustering for edge-bicoloured complete graphs. Corollary 4.5 Coloured Clustering can be solve in O(n2) for edge-bicoloured complete graphs. Proof. From Lemma 4.4, we see that once we fix the size of V1 to be k, Sf is maximized when we choose k vertices v with largest d1(v) as vertices in V1. Alternating Path and Coloured Clustering 8 Therefore we can compute the maximum value of Sf for each 0 ≤ k ≤ n, and find an optimal vertex-2-colouring for G. The whole process clearly takes O(n2) time as we can first sort vertices according to d1(v). We can also use a similar idea to solve Coloured Clustering in O(n2) time for edge-bicoloured complete bipartite graphs, which will appear in our full paper. 5 NP-completeness Angel et al. [3] have shown the NP-completeness of Coloured Cluster- ing for edge-tricoloured bipartite graphs. In this section, we further push the intractability of the problem to edge-tricoloured planar bipartite graphs of bounded degree. Recall that a vertex colouring is proper if the two ends of every edge receive different colours. Theorem 5.1 Coloured Clustering is NP-complete for edge-tricoloured planar bipartite graphs of maximum degree four. Garey, Johnson and Stockmeyer [8] proved the NP-completeness Proof. of Independent Set on cubic planar graphs, and we give a reduction from this restricted case of Independent Set to our problem. For an arbitrary cubic planar graph G = (V, E) with V = {v1, . . . , vn}, we construct an edge- tricoloured planar bipartite graph G′ = (V ′, E′) of maximum degree four as follows: 1. Compute a proper vertex 3-colouring ψ of G. 2. For each edge vivj ∈ E, subdivide it by a new vertex vij (i.e., replace edge vivj by two edges vivij and vijvj), and colour edges vivij and vijvj by ψ(vi) and ψ(vj) respectively. i and edge viv∗ i , and colour 3. For each vertex vi ∈ V , add a new vertex v∗ i by a colour in {1, 2, 3} different from ψ(vi). edge viv∗ It is clear that G′ is an edge-tricoloured planar bipartite graphs of maximum degree four. By Brooks' Theorem, every cubic graph except K4 admits a proper vertex 3-colouring, and we can use an algorithm of Lov´asz [11] to compute a proper vertex 3-colouring of a cubic graph in linear time. Therefore, the above construction of G′ takes polynomial time. We claim that G has an independent set of size k if and only if G′ admits a vertex colouring that produces k + E stable edges. Suppose that G contains an independent set I of size k. We define a vertex- 3-colouring f of G′ as follows: Alternating Path and Coloured Clustering 9 i ) to be the colour of edge viv∗ 1. For each vertex v∗ i . 2. For each vertex vi ∈ V , set f (vi) to be the colour of edge viv∗ i ∈ V ∗, set f (v∗ and f (vi) = ψ(vi) otherwise. i if vi ∈ I 3. For each vertex vij, set f (vij) to be ψ(vi) if vi 6∈ I and ψ(vj) otherwise. Clearly, f produces k stable edges viv∗ i after Step 2. For any vertex vij, since I contains at most one of vi and vj, exactly one of vivij and vijvj becomes a stable edge after Step 3. Therefore f produces k + E stable edges for G′. i an outside edge, and let f ′ be a vertex 3- colouring of G′ that produces k+E stable edges and also minimizes the number of outside edges among these stable edges. Let Conversely, call each edge viv∗ I = {vi : edge viv∗ i is stable}. For every vertex vij in G′, since edges vivij and vijvj have different colours, at most one of these two edges is a stable edge for any vertex colouring of G′. It follows that at least k stable edges are formed by outside edges and hence I contains at least k vertices. We claim that I is an independent set of G. Suppose to the contrary that for some vertices vi, vj ∈ I, vivj is an edge of G. First we note that amongst all is the only stable edge under f ′ as f ′(vi) 6= ψ(vi), edges incident with vi, viv∗ i and similar situation holds for all edges incident with vj. In particular, neither vivij nor vijvj is a stable edge. We now recolour both vertices vi and vij by the colour of edge vivij (note that vij may have received that colour already under f ′) to obtain a new vertex 3-colouring f ′′ (see Figure 2 for an example of the situation). 1 vi* 1 1 vi 2 3 2 2 2 ijv 2 (a) 2 vj * 1 vi* 2 2 vj 3 3 1 3 3 3 1 vi 2 2 2 2 2 vj * 2 2 vj 3 3 3 1 3 2 ijv 2 (b) Figure 2: (a) Situation under vertex colouring f ′. (b) Situation after recolouring vertices vi and vij. Stable edges are indicated by thick edges. Comparing with colouring f ′, this new colouring f ′′ reduces one stable edge (namely, edge viv∗ i (and probably also other new stable edges). Therefore f ′′ produces at least k + E stable edges i ), but produces a new stable edge viv∗ Alternating Path and Coloured Clustering 10 that contains one less outside edges than f ′, contradicting the choice of f ′. This contradiction implies that I is indeed an independent set of G with at least k vertices, and hence the theorem holds. Corollary 5.2 Conflict-Pair Removal is NP-complete for edge-tricoloured planar bipartite graphs of maximum degree four. 6 FPT algorithms We now turn to the parameterized complexity of Coloured Clustering, and give FPT algorithms for the problem with respect to both the number of stable edges and the number of unstable edges as parameter k. This is quite interesting as it is uncommon for a problem to admit FPT algorithms both ways when parameterized in this manner. 6.1 Stable edges First we take the number of stable edges produced by a vertex colouring of G as parameter k, and use Coloured Cluster[k] to denote this parameterized problem. We will give an FPT algorithm that uses random partition in the spirit of the colour coding method of Alon, Yuster and Zwick [2], which implies an FPT algorithm for Independent Set[k] in edge-conflict graphs. Note that if the number t of colours in G is a constant, then the problem is trivially solved in FPT time as it contains a trivial kernel with at most kt edges and hence 2kt vertices. Also note that the problem is not as easy as it looks, for it contains the maximum matching problem as a special case when all edges have different colours. Our idea is to randomly partition vertices of G into k parts V1, . . . , Vk in a i=1 ki = k, in each hope that a k-solution consists of ki stable edges, where Pk G[Vi]. Indeed we have a good chance to succeed in this way. Algorithm Coloured-Clustering[k] Randomly partition vertices V of G into V1,··· , Vk. Compute the most frequently used colour ci for each G[Vi]. Colour all vertices in Vi by ci. Lemma 6.1 For any yes-instance of Coloured Cluster[k], the vertex colour- ing constructed by Algorithm Coloured-Clustering[k] has probability at least k−2k to produce at least k stable edges. Alternating Path and Coloured Clustering 11 Proof. Consider a vertex colouring of G that produces at least k stable edges E′, which clearly have at most k different colours. Let E′ i be edges in E′ of colour ci and let ki = E′ i for 1 ≤ i ≤ k. We estimate the probability that all i lie in G[Vi]. A vertex has probability k−1 to be in Vi, and hence the edges of E′ above event happens with probability at least k−2ki as E′ i contains at most 2ki vertices. It follows that, with probability at least i=1 2ki = k−2k, k−Pk all edges of each E′ i lie entirely inside G[Vi]. Therefore each G[Vi] contains at least ki edges of same colour ci, which can be made stable by colouring all vertices in G[Vi] by colour ci. It follows that the algorithm produces at least k stable edges with probability k−2k. The algorithm runs in O(k2k(m + n)) expected time, and can be made into a deterministic FPT algorithm by standard derandomization with a family of perfect hashing functions. Theorem 6.2 Coloured Cluster[k] can be solved in FPT time. 6.2 Unstable edges Now we take the number of unstable edges in a vertex colouring as parameter k, and use Conflict-Pair Removal[k] to denote this parameterized problem. By a result of Angel et al. [3], the problem is equivalent to finding a vertex cover of size k in the edge-conflict graph X(G) of G, and hence admits an FPT algorithm by transforming it to the k-vertex cover problem in X(G). However the time for the transformation takes O(mn) time as X(G) contains O(m) vertices and O(mn) edges, and the total time for the algorithm takes O(mn + 1.2783k) time. Here we combine kernelization with weighted vertex cover to obtain an improved algorithm with running time O(m + n + 1.2783k). To start with, we construct in linear time the following edge-coloured weighted graph G∗, called condensed graph, by representing monochromatic vertices of one colour by a single vertex, and then parallel edges between two vertices by a single weighted edge. See Figure 3 for an example of the construction. Step 1. For each colour c, contract all monochromatic vertices of colour c into a single vertex vc. Step 2. For each pair of adjacent vertices, if there is only one edge between them, then set the weight of the edge to 1, otherwise replace all parallel edges between them by a single edge of the same colour1 and set its weight to be the number of replaced parallel edges. 1All such parallel edges have the same colour as they correspond to edges between a vertex and monochromatic vertices of the same colour. Alternating Path and Coloured Clustering 12 2 1 2 3 1 1 1 1 2 2 2 3 1 3 3 (a) 2 3 3 1 2 3 3 3 1 1 3 2 2 2 3 1 3 3 (b) 2 3 3 3 1 2 (a) Edge-coloured graph G where each dashed ellipse indicates Figure 3: (b) The condensed graph G∗ of G monochromatic vertices of same colour. where an edge of weight more than 1 has its weight as the superscript of its colour. It turns out that the clustering problem on G is equivalent to a weighted version of the problem on the condensed graph G∗. Lemma 6.3 Graph G has at most k unstable edges if and only if G∗ has un- stable edges of total weight at most k. Proof. By the construction of G∗, we have the following correspondence be- tween edges in G and G∗: every edge in G between two colourful vertices remains so in G∗, and for any colourful vertex v, all edges between v and monochro- matic vertices of colour c correspond to edge vvc in G∗. Also all monochromatic vertices in G∗ form an independent set. Now suppose that G has a vertex colouring f that produces k unstable edges. Without loss of generality, we may assume that every monochromatic vertex v in G has its own colour as f (v) since this will not increase unstable edges. For this f , we have a natural vertex colouring f ∗ for G∗: the colour It is obvious that an edge in G∗ of each vertex retains its colour under f . between two colourful vertices is an unstable edge under f ∗ if and only if it is an unstable edge in G under f . For edges Ec(v) in G between a colourful vertex v and monochromatic vertices with colour c, either all edges in Ec(v) are stable or all are unstable as f colours all these monochromatic vertices by colour c, implying that all edges in Ec(v) are unstable under f if and only if vvc is unstable under f ∗. Therefore f ∗ produces unstable edges of total weight k in G∗. Conversely, suppose that G∗ contains a set U of unstable edges of total weight k, and let U ′ be the corresponding k edges in G. Clearly G− U ′ contains no conflict pair, and hence G has at most k unstable edges. Alternating Path and Coloured Clustering 13 Further to the above lemma, G∗ can be regarded as a kernel as its size is bounded by a function of k whenever G has at most k unstable edges. Note that the bounds in the following lemma are tight. Lemma 6.4 If G has at most k unstable edges, then G∗ has at most 4k vertices and 2k2 + k edges. Proof. Let [C, M ] be the cut that partitions the vertices of G into colourful vertices C and monochromatic vertices M . Let A be the set of unstable edges inside G[C], and B the set of unstable edges across the cut. Observe that each edge of A is incident with at most two vertices of C, and each edge of B is incident with one vertex of C. Furthermore, every colourful vertex is incident with at least one unstable edge. Therefore C ≤ 2A + B ≤ 2k. Now consider the condensed graph G∗, and note that the cut [C, M ] corre- sponds to the cut [C, M ∗] for monochromatic vertices M ∗ of G∗. Furthermore, A consists of unstable edges inside G∗[C], and B corresponds to unstable edges B∗ across [C, M ∗] and B∗ ≤ B. In G∗, every vertex in C is incident with at most one stable edge in [C, M ∗]. Therefore [C, M ∗] contains at most C + B∗ ≤ (2A + B) + B∗ ≤ 2(A + B) = 2k edges, and hence M ∗ contains at most 2k vertices. It follows that G∗ contains at most 4k vertices, and at most(cid:0)2k 2(cid:1)+2k = 2k2 +k edges as G∗[M ∗] is edgeless. With Lemma 6.3 and Lemma 6.4 in hand, we obtain the following FPT algorithm for Conflict-Pair Removal[k] Algorithm Conflict-Pair-Removal[k] Construct the condensed graph G∗ from G; if G∗ contains more than 4k vertices or 2k2 + k edges then return "No" and halt; Construct the edge-conflict X(G∗) of G∗; if X(G∗) has a vertex cover of weight at most k then return "Yes" else return "No". Theorem 6.5 Conflict-Pair Removal[k] can be solved in O(m+n+1.2783k) time. Proof. The correctness of the algorithm follows from Lemma 6.3 and Lemma 6.4, and we analyze the running time of the algorithm. The construction of the Alternating Path and Coloured Clustering 14 condensed graph G∗ clearly takes O(m + n) time, and the construction of the edge-conflict graph X(G∗) takes O(k3) time as G∗ contains O(k) vertices and O(k2) edges. Note that X(G∗) contains O(k2) vertices and O(k3) edges. Since it takes O(kn + 1.2783k) to solve the weighted vertex cover problem [7, 12], it takes O(k3 + 1.2783k) = O(1.2783k) to solve the problem for G∗, and hence the overall time is O(m + n + 1.2783k). 7 Concluding remarks We have revealed that Coloured Clustering, a vertex partition problem, is in fact subgraph problems Vertex-Monochromatic Subgraph and Alter- nating Path Removal in disguise, and demonstrated the usefulness of this multiple points of view in studying these problems. Indeed, our improved algo- rithm for edge-bicoloured graphs and FPT algorithms for general edge-coloured graphs have benefited a lot from the perspective of Conflict-Pair Removal. We now briefly discuss a few open problems in the language of monochromatic subgraphs and alternating paths for readers to ponder. Question 1. For edge-bicoloured graphs, is there a faster algorithm for deleting fewest edges to obtain a vertex-monochromatic subgraph? There seems to be a good chance to solve the problem faster than our al- gorithm, and one possible approach is to reduce the number of vertices in the reduction to minimum cut from the current O(m) to O(n). Question 2. For Conflict-Pair Removal on general edge-coloured graphs, is there an r-approximation algorithm for some constant r < 2? The problem admits a simple 2-approximation algorithm through its con- nection with Vertex Cover, and seems easier than the latter problem. It is possible that we can do better for the problem, perhaps through ILP relaxation. Question 3. For edge-coloured graphs, does the problem of finding a vertex- monochromatic subgraph with at least k edges admit a polynomial kernel? The above problem is appealing for its connection with the classical max- imum matching problem. On one hand, we may use a maximum matching of G as a starting point for a polynomial kernel; and on the other hand if we can obtain a polynomial kernel of G in o(m√n) time, we may use the kernel to speed up maximum matching algorithms. Of course, it may be the case that the problem admits no polynomial kernel unless NP ⊆ coNP/poly. Question 4. For edge-coloured graphs, is there an FPT algorithm for the Alternating Path and Coloured Clustering 15 problem of destroying all alternating cycles by deleting at most k edges? Although the definition of the problem resembles that of Alternating Path Removal, the problem seems much more difficult as the problem does not have a finite forbidden structure like conflict pair for the latter problem. We note that the problem is NP-complete by a simple reduction from Vertex Cover. References [1] Ageev, A., and Kononov, A., Improved Approximations for the Max k- Colored Clustering Problem. In: International Workshop on Approximation and Online Algorithms 2014, LNCS 8952 (pp. 1-10), 2015. [2] Alon, N., Yuster, R., and Zwick, U., Color-coding, Journal of the ACM 42:844 -- 856, 1995 [3] Angel, E., Bampis, E., Kononov, A., Paparas, D., Pountourakis, E., and Zissimopoulos, V., Clustering on k-edge-colored graphs. Discrete Applied Mathematics, 211:15-22, 2016. [4] Bang-Jensen, J., and Gutin, G., Alternating cycles and paths in edge- coloured multigraphs: a survey. Discrete Mathematics, 165:39-60, 1997. [5] Bansal, N., Blum, A., and Chawla, S., Correlation clustering. Machine Learning, 56(1-3):89-113, 2004. [6] Cai, L., Fixed-parameter tractability of graph modification problems for hereditary properties. Information Processing Letters, 58(4):157 -- 206, 1996. [7] Chen, J., Kanj, I. A., and Xia, G., Improved upper bounds for vertex cover. Theoretical Computer Science, 411(40-42):3736-3756, 2010. [8] Garey, M. R., Johnson, D. S., and Stockmeyer, L., Some simplified NP- complete graph problems. Theoretical computer science, 1(3):237-267, 1976. [9] Goldberg, A. V., and Rao, S., Beyond the flow decomposition barrier. Jour- nal of the ACM (JACM), 45(5):783-797, 1998. [10] Kano, M., and Li, X., Monochromatic and heterochromatic subgraphs in edge-colored graphs-a survey. Graphs and Combinatorics, 24(4):237-263, 2008. [11] L. Lov´asz, Three short proofs in graph theory. J. Combin. Theory Ser. B, 19:269-271, 1975. [12] Niedermeier, R., and Rossmanith, P., On efficient fixed-parameter algo- rithms for weighted vertex cover. Journal of Algorithms, 47(2):63-77, 2003.
1204.5335
1
1204
2012-04-24T11:07:42
Approximate Counting of Matchings in Sparse Uniform Hypergraphs
[ "cs.DS", "cs.DM" ]
In this paper we give a fully polynomial randomized approximation scheme (FPRAS) for the number of matchings in k-uniform hypergraphs whose intersection graphs contain few claws. Our method gives a generalization of the canonical path method of Jerrum and Sinclair to hypergraphs satisfying a local restriction. Our proof method depends on an application of the Euler tour technique for the canonical paths of the underlying Markov chains. On the other hand, we prove that it is NP-hard to approximate the number of matchings even for the class of k-uniform, 2-regular and linear hypergraphs, for all k >= 6, without the above restriction.
cs.DS
cs
Approximate Counting of Matchings in Sparse Uniform Hypergraphs Marek Karpi´nski⋆1 and Andrzej Ruci´nski⋆⋆2 and Edyta Szyma´nska⋆ ⋆ ⋆2 1 Department of Computer Science, University of Bonn. Email: [email protected] 2 Faculty of Mathematics and Computer Science, Adam Mickiewicz University, Pozna´n. Email: rucinski,[email protected] Abstract. In this paper we give a fully polynomial randomized approx- imation scheme (FPRAS) for the number of matchings in k-uniform hy- pergraphs whose intersection graphs contain few claws. Our method gives a generalization of the canonical path method of Jerrum and Sinclair to hypergraphs satisfying a local restriction. Our proof method depends on an application of the Euler tour technique for the canonical paths of the underlying Markov chains. On the other hand, we prove that it is NP-hard to approximate the number of matchings even for the class of k-uniform, 2-regular and linear hypergraphs, for all k ≥ 6, without the above restriction. ⋆ Research supported partly by DFG grants and the Hausdorff Center grant EXC59-1. ⋆⋆ Research supported by the Polish NSC grant N201 604 940. ⋆ ⋆ ⋆ Research supported by the Polish NSC grant N206 565 740. 2 1 Introduction A hypergraph H = (V, E) is a finite set of vertices V together with a family E of distinct, nonempty subsets of vertices called edges. In this paper we consider k- uniform hypergraphs (called also k-graphs) in which, for a fixed k ≥ 2, each edge is of size k. A matching in a hypergraph is a set (possibly empty) of disjoint edges. We will often identify a matching M with the hypergraph H[M ] = (V (M ), M ) induced by M in H, where V (M ) = Se∈M e. We denote by ∆(H) the maximum vertex degree degH (v), that is, the maximum number of edges of H containing a vertex v. A hypergraph is called linear (a.k.a. simple) when no two edges share more than one vertex, that is, the maximum pair degree is one. The intersection graph of a hypergraph H is the graph L := L(H) with vertex set V (L) = E(H) and edge set E(L) consisting of all intersecting pairs of edges of H. When H is a graph, the intersection graph L(H) is called the line graph of H. Every graph G is the intersection graph of some hypergraph, in fact, of the dual hypergraph G∗ of G (obtained by interchanging the roles of the vertices and edges of G, equivalently, by taking the transpose of the incidence matrix of G). In a seminal paper [14], Jerrum and Sinclair constructed an FPRAS (see Section 1.4 for the definition) for counting the number of matchings in a graph (the monomer-dimer problem) based on an ingenious technique of canonical paths. The method was extended later in [15] to solve the permanent problem. Here we modify their method to address the corresponding problem for k- graphs, k ≥ 3. It turns out that for k-graphs H, one can adopt the proof of the graph case, whenever for every two matchings M, M ′ in H the intersection graph L = L(M ∪ M ′) between M and M ′ satisfies ∆(L) ≤ 2. This happens if and only if H contains no 3-comb, a k-graph consisting of a matching {e1, e2, e3} and one extra edge e4 such that e4 ∩ ei ≥ 1 for i = 1, 2, 3. Let us denote by Hk 0 the family of all k-graphs which do not contain a 3-comb, cf. [18]. In Section 3 we give a couple of examples of classes of k-graphs which belong to Hk 0 . By substantially modifying the canonical path method we are able to con- struct an FRPAS for a broader class Hk s , s ≥ 0, defined as follows. Call an edge e ∈ H wide if it intersects a matching in H of size at least three (so, every 3-comb contains a wide edge). The class Hk s consists of all k-graphs containing at most s wide edges. Our main result is the following hypergraph generalization of the Jerrum-Sinclair theorem. In fact, they, as well as many other contributors to the field, considered the edge weighted case (with intensity λ), while we, for clarity, assume that the hypergraphs are unweighted (λ = 1). However, the weighted case can be handled in a similar manner. Our proof method depends on an ap- plication of the Euler tour technique for the canonical paths of the underlying Markov chains. Theorem 1. For every k ≥ 3 and s ≥ 0 there exists an FPRAS for the problem of counting all matchings in a k-graph H ∈ Hk s . The proof of Theorem 1 is outlined in Section 2. We can characterize family s in terms of the intersection graph L(H). A claw in a graph G is an induced Hk 3 subgraph of G isomorphic to the star K1,3. The vertex of degree three in a claw will be called the center of that claw. A k-graph H ∈ Hk s if and only if the intersection graph L(H) of H contains at most s centers of claws. In particular, H ∈ Hk 0 if and only if L(H) is claw-free. Every 2-graph, i.e., every graph, is in H2 s is more restrictive and causes the hypergraph to be rather sparse (of size O(nk−1)). Nevertheless, as can be seen in the next subsection, the problem of (exactly) counting matchings in k-graphs belonging to Hk 0. For k ≥ 3, the requirement that H ∈ Hk 0 remains computationally hard. 1.1 Approximation Hardness In this section we demonstrate that the problem of counting matchings in k- graphs belonging to the family Hk 0 is still #P-complete, as well as that it is NP-hard to approximate the number of matchings already for 2-regular, linear 6-graphs if no restriction on the number of 3-combs is imposed. Proposition 2 The problem of counting matchings in a k-graph H ∈ Hk #P-complete for every k ≥ 3. 0 is Proof. We use a reduction from the problem of counting all matchings in bipar- tite graphs G = (V, E) of maximum degree at most four, which, by a result of Vadhan [22] is #P-complete. For a given bipartite graph G = (V, E) of maxi- mum degree at most four with a bipartition V = V1 ∪ V2 we construct a k-graph H = (V ′, E′) from the family Hk 0 as follows. For every edge e ∈ E we add to V additional k − 2 vertices, so V ′ = V ∪ Se∈E{ve k−2}. Now, every edge e = (u, v) ∈ E is replaced by the corresponding k-tuple (v, ve k−2, u). Thus V ′ = V + (k − 2)E, E = E′ and the resulting k-graph H ′ = (V ′, E′) is linear, k-partite, has maximum vertex degree at most four and, more im- portantly, does not contain a 3-comb. Moreover, there is a natural one-to-one ⊓⊔ correspondence between the matchings in G and the matchings in H. 2, . . . , ve 1, ve 1, ve 2, . . . , ve Proposition 3 For every k ≥ 6, unless NP=RP there is no FPRAS for the number of matchings in a 2-regular, linear k-graph. Proof. We use a reduction from the problem of approximating the number of independent sets in a k-regular graph, k ≥ 6, for which it has been recently proved (see [20],[10], and [21]) that, unless NP=RP, there is no FPRAS. Any k-regular graph G is the intersection graph of the dual hypergraph H = G∗, with vertex set V (H) = E(G) and the edges ev ∈ H being the sets of edges incident to the same vertex v ∈ V (G). Thus, the number of independent sets in G equals the number of matchings in H. Moreover, observe that by construction, H is ⊓⊔ k-uniform, 2-regular, and linear. The meaning of Proposition 3 is that for k ≥ 6 there is no hope for an FPRAS for the number of matchings even if the degrees and co-degrees of H are as small as they can get (1-regular k-graphs are matchings themselves and the problems become trivial). Instead one has to impose some additional structural restrictions. Inspired by the canonical method of Jerrum and Sinclair, we came 4 up with the restriction on the number of 3-combs. In turn, Proposition 2 tells us that even the assumption of no 3-combs at all preserves the computational hardness, as the problem of exact counting of matchings remains #P-complete in a quite narrow subclass of Hk 0 . 1.2 Motivation from Statistical Physics In 1972 Heilmann and Lieb [12] studied monomer-dimer systems, which in the graph theoretic language correspond to (weighted) matchings in graphs. In physi- cal applications these graphs are typically some (infinite) regular lattices. Dimers represent diatomic molecules which occupy disjoint pairs of adjacent vertices of the lattice and monomers are the remaining vertices. Heilmann and Lieb proved that the associated Gibbs measure is unique (in other words, there is no phase transition). They did it by proving that the roots of the generating matching polynomial of any graph are all real, equivalently that the roots of the hard core partition function (independence polynomial) of any line graph are all real. The latter result was later extended to all claw-free graphs by Chudnovsky and Seymour [7]. The uniqueness of Gibbs measure on d-dimensional lattices was reproved in a slightly stronger form and by a completely different method by van den Berg [23]. Hypergraphs may be at hand when instead of diatomic molecules bigger molecules (polymers) are considered which, again, can occupy "adjacent", dis- joint sets of vertices of a lattice. As long as the hypergraph lattice H belongs to the family Hk 0, the intersection graph L(H) is claw-free (because H contains no 3-comb) and, by the result of [7] combined with the proof from [12] there is no phase transition either. However, it is possible to have a phase transition for a monomer-trimer system (cf. [11]). Interestingly, the example given by Heilmann (the decorated, or subdivided, square lattice with hyperedges corresponding to the collinear triples with midpoints at the branching points of the original square lattice) is a 3-uniform hypergraph containing 3-combs, and thus its intersection graph is not claw-free. 1.3 Related Results Recently, an alternative approach to constructing counting schemes for graphs has been developed based on the concept of spatial correlation decay. This re- sulted in deterministic fully polynomial time approximation schemes (FPTAS) for counting independent sets in graphs with maximum degree at most five ([24]), counting matchings in graphs of bounded degree ([2]), and, very recently, count- ing independent sets in claw-free graphs of bounded degree ([9]). It is not clear to what extent these methods can be applied to hypergraphs. The above mentioned result of Weitz [24] has been recently complemented by the hardness result for graphs with maximum degree at most six, used in the proof of Proposition 3 above. It yields an FPTAS for counting matchings in hypergraphs whose intersection graphs have degree at most five. This is the case of the Heilmann lattice described in the previous subsection (the maximum 5 degree of its intersection graph is three), which, by the way, undermines our temptation to link the absence of phase transition for a hypergraph lattice with the absence of a 3-comb, that is with the claw-freeness of the intersection graph of the lattice. In turn, an FPTAS for counting independent sets in claw-free graphs of bounded degree implies and FPTAS for counting matchings in hypergraphs H ∈ H(k) 0 with bounded degree. As far as hypergraphs are concerned, the authors of [3] showed that, under certain conditions, the Glauber dynamics for independent sets in a hypergraph, as well as the Glauber dynamics for proper colorings of a hypergraph mix rapidly. It is doubtful, however, if the path coupling technique applied there can be of any use for the problem of counting matchings in hypergraphs. Nevertheless, paper [3] marks a new line of research, as there have been only few results ([5], [6]) on approximate counting in hypergraphs before. The only other paper devoted to counting matchings in hypergraphs we are aware of is [1], where Barvinok and Samorodnitsky compute the partition function for matchings in hypergraphs under some restrictions on the weights of edges. In particular they are able to distinguish in polynomial time between hypergraphs that have sufficiently many perfect matchings from hypergraphs that do not have nearly perfect matchings. 1.4 Approximate Counting and Uniform Sampling Given ǫ > 0 and δ > 0, we say that a random variable Y is an (ǫ, δ)-approximation of a constant C if P (Y − C ≥ ǫC) ≤ δ. Let f be a function over a set of input strings Σ∗. Definition 4 A randomized algorithm is called a fully polynomial randomized approximation scheme (FPRAS) for f if for every triple (ǫ, δ, x) with ǫ > 0, δ > 0, and x ∈ Σ∗, the algorithm returns an (ǫ, δ)-approximation Y of f (x) and runs in time polynomial in 1/ǫ, log(1/δ), and x. Consider a counting problem, that is, a problem of computing f (x) = Ω(x), where Ω(x) is a well defined finite set associated with x (think of the set of all matchings in a hypergraph). As it turns out (see below), to construct an FPRAS for such a problem it is sufficient to be able to efficiently sample an element of Ω(x) almost uniformly at random. To make it precise, given ǫ > 0, we say that a probability distribution P : 2Ω → [0, 1] over a finite sample space Ω is ǫ-uniform if for every S ⊆ Ω, (cid:12) P(S) − S ≤ ǫ, that is, if the total variation distance, (cid:12)(cid:12) Ω dT V (P, 1 Ω ), between the two distributions is bounded by ǫ. (cid:12) (cid:12)(cid:12) Definition 5 A randomized algorithm is called a fully polynomial almost uni- form sampler (FPAUS) for a counting problem Ω(x) if for every pair (ǫ, x) with ǫ > 0 and x ∈ Σ∗, the algorithm samples ω ∈ Ω according to an ǫ-uniform distribution P and runs in time polynomial in 1/ǫ and x. It has been proved by Jerrum, Valiant, and Vazirani [16] that for a broad class of counting problems, called self-reducible, including the matching problem, 6 knowing an FPAUS allows one to construct an FPRAS. For a proof in the graph case see Proposition 3.4 in [13]. The hypergraph case follows mutatis mutandis. Thus, the proof of Theorem 1 reduces to constructing an FPAUS for matchings in H. In fact, this approach has been used for perfect matchings in dense graphs already by Broder in [4], and later successfully executed by Jerrum and Sinclair in [14] by different means. In their version the main steps of finding an efficient FPAUS for matchings in a graph H were • a construction of an ergodic time-reversible, symmetric Markov chain MC(H) whose state space Ω consists of all matchings in H; • a proof that MC(H) is rapidly mixing. 1.5 Rapid Mixing Given an arbitrary probability distribution P0 on the state space Ω, let us define the mixing time tmix(ǫ) of a Markov chain MC as tmix(ǫ) = min{t : dT V (Pt, 1 Ω ) ≤ ǫ}, where Pt is the chain's state distribution after t steps, beginning from the initial distribution P0. Recall that if an ergodic time-reversible Markov chain is sym- metric, i.e., the transition probabilities satisfy pij = pji for all i, j ∈ Ω, then its unique stationary distribution is uniform (cf. [13]). In that case we define the transition graph GMC = G of MC as a graph on the vertex set V (G) = Ω and the edge set E(G) = {{i, j} : pij > 0}. Note that G is undirected but, possibly, with loops. The pivotal role in estimating the rate of convergence of MC to its uniform stationary distribution is played by an expansion parameter, called the conductance and denoted Φ(MC) which in the symmetric case is defined by a simplified formula Φ := Φ(MC) = minS P{pij : ij ∈ G, i ∈ S, j ∈ Ω \ S} S , (1) where here (and below) the minimum is taken over all S ⊆ Ω with 0 < S ≤ 2 Ω. Indeed, it follows from Theorem 2.2 in [14] that if pii ≥ 1 1 2 for all i ∈ Ω then dT V (Pt, 1 Ω ) ≤ Ω2 (cid:0)1 − Φ2/2(cid:1)t , regardless of the initial distribution P0, and consequently, tmix(ǫ) ≤ 2 Φ2 (cid:0)2 log Ω + log ǫ−1(cid:1) . Hence, it becomes crucial to estimate the conductance from below by the recip- rocal of a polynomial in the input size. To this end, observe that Φ(MC) ≥ minS pmincut(S) S , (4) (2) (3) 7 where cut(S) is the edge-cut of G defined by S, and pmin = min{pij : {i, j} ∈ G, i 6= j}. For Markov chains on matchings of an n-vertex k-graph H, denoted further by MC(H), to bound cut(S), Jerrum and Sinclair introduced their method of canonical paths which boils down to: • defining a canonical path in G for every pair of matchings (I, F ) in H; • bounding from above the number of canonical paths containing a prescribed transition (an edge of G) by poly(n)Ω. Since every canonical path between a matching in S and a matching in the complement of S must go through an edge of cut(S), we have, for S ≤ 1 2 Ω, cut(S) ≥ S(Ω − S) poly(n)Ω ≥ S 2poly(n) and, by (4), Φ(MC(H)) ≥ pmin poly(n) . 2 The Proof of Theorem 1 (5) (6) In this section we first outline a proof of Theorem 1 in its special case s = 0. This proof is similar to the proof from [14]. After that we discuss how this proof can be modified in order to yield the full generality of our main result. (The details are deferred to the full version of the paper.) We begin by defining a Metropolis Markov chain whose states are the match- ings of a k-graph H and then show that the chain is rapidly mixing to a uniform stationary distribution, yielding an FPAUS. 2.1 The Markov Chain Given a k-graph H = (V, E), V = n, let Ω(H) denote the set of all matchings in H. We define a Markov chain MC(H) = (Xt)∞ t=0 with state space Ω(H) as follows. Set X0 = ∅ and for t ≥ 0, let Xt be a matching M = {h1, h2, . . . , hs} in H, 0 ≤ s ≤ n/k. Choose an edge h ∈ H uniformly at random and consider the set Ih := {i : h ∩ hi 6= ∅, i = 1, . . . , s} of the edges of M intersected by h. The following transitions from Xt are allowed in MC(H): (-) if h ∈ M then M ′ := M − h, (+) if h /∈ M and Ih = 0 then M ′ := M + h, (+/-) if h /∈ M and Ih = {j} then M ′ := M + h − hj, (0) if h /∈ M and Ih ≥ 2 then M ′ := M . Finally, with probability 1/2 set Xt+1 := M ′, else Xt+1 := Xt. 8 Fact 6 The Markov chain MC(H) is ergodic and symmetric. The above fact implies that MC(H) converges to a stationary distribution that is uniform over Ω(H). Moreover, pmin = min{PM,M ′ : {M, M ′} ∈ G, M 6= M ′} = 1 2H ≥ n−k. (7) 2.2 Canonical Paths In this section we define canonical paths, a tool used for estimating the mixing time of the Markov chain MC(H) introduced in the previous subsection. For us, a path is a k-graph with edge set {e1, . . . , em}, m ≥ 1, where for every 1 ≤ i < j ≤ m, ei ∩ ej 6= ∅ if and only if j = i + 1. If m ≥ 3 and, in addition, e1 ∩ em 6= ∅, then such a k-graph will be called a cycle. (Note that a pair of edges sharing at least two vertices is a path, not a cycle.) Set V (H) = {1, 2, . . . , n} and min S = min{i : i ∈ S} for any S ⊆ V (H). Let (I, F ) be an ordered pair of matchings in Ω(H) (we might think of them as the initial and the final matching of the canonical path-to-be). The symmetric difference I ⊕ F is a hypergraph with ∆(I ⊕ F ) ≤ 2 and, due to the assumption that H ∈ Hk 0 , also ∆(L(I ⊕F )) ≤ 2, that is, in I ⊕F every edge intersects at most two other edges. Hence, each component of I ⊕ F is a path or a cycle, in which the edges of I alternate with the edges of F . In particular, each cycle-component has an even number of edges. Let us order the components Q1, . . . , Qq of I ⊕ F so that min V (Q1) < · · · < min V (Qq). We construct the canonical path γ(I, F ) = (M0, . . . , Mt) in the transition graph G by setting M0 = I and then modifying the current matching by transitions (+), (-), or (+/-), while traversing the components Q1, . . . , Qq as follows. For the sake of uniqueness of the canonical path, each component will be traversed from a well defined starting point (an edge e1) and in a well defined direction e1, e2, . . . es. Of, course, for a path there are just two starting points (which determine directions), while for a cycle there are s starting points and two directions from each. The particular rules for choosing the starting point and direction are quite arbitrary and do not really matter for us. Suppose that we have already constructed matchings M0, M1, . . . , Mj and traversed so far the components Q1, . . . , Qr−1. If Qr is an even path then we assume that e1 ∈ F (and so es ∈ I) and take Mj+1 = Mj +e1−e2, Mj+2 = Mj+1+e3−e4,..., Mj+s/2 = Mj+s/2−1+es−1−es. If Qr is an odd path then we assume that min(e1 ∩e2) < min(es−1 ∩es). If e1, es ∈ I then take Mj+1 = Mj − e1, Mj+2 = Mj+1 + e2 − e3, Mj+3 = Mj+2 + e4 − e5, ..., Mj+(s+1)/2 = Mj+(s−1)/2 + es−1 − es. If e1, es ∈ F , we apply the sequence of transitions Mj+1 = Mj + e1 − e2, Mj+2 = Mj+1 + e3 − e4,...,Mj+(s−1)/2 = Mj+(s−3)/2 + es−2 − es−1, and Mj+(s+1)/2 = Mj+(s−1)/2 + es. Finally, if Qr = (e1, . . . , es) is a cycle then we assume that min e1 = min(V (Qr) ∩ V (I)) and min(e2 ∩ e3) > min(es−1 ∩ es), and follow the sequence of transitions Mj+1 = Mj −e1, Mj+2 = Mj+1+e2−e3, Mj+3 = Mj+2+e4−e5, ...,Mj+s/2 = Mj+s/2−1+ es−2 − es−1, and Mj+s/2+1 = Mj+s/2 + es. 9 We call the component Qr of I ⊕ F the venue of the transition (Mj, Mj+1) (on the canonical path γ(I, F )) if Mj ⊕ Mj+1 ⊆ E(Qr). Note that the obtained sequence γ(I, F ) = (M0, . . . , Mt) is unique and satisfies the following properties: (a) M0 = I and Mt = F , (b) for every j = 0, . . . , t − 1, the pair {Mj, Mj+1} is an edge of the transition graph G, (c) for every j = 0, . . . , t, we have I ∩ F ⊆ Mj ⊆ I ∪ F , (d) for every j = 0, . . . , t, we have F ∩ Sr−1 i=1 Qi ⊆ Mj and I ∩ Sq where Qr is the venue of (Mj, Mj+1). i=r+1 Qi ⊆ Mj, 2.3 Bounding the Cuts Fix a transition edge (M, M ′) in G. Let ΠM,M ′ = {(I, F ) : (M, M ′) ∈ γ(I, F )} be the set of canonical paths passing through the transition edge (M, M ′). Our goal is to show that ΠM,M ′ ≤ Ω0(H), (8) where Ω0(H) = {H ′ ⊆ H : ∃e ∈ H ′ such that H ′ − e ∈ Ω(H)}. Note that : M ∈ Ω(H), e ∈ H} ≤ nkΩ(H) and log Ω(H) = Ω0(H) ≤ {(M, e) O(n log n). Thus, in view of the remarks at the end of Section 1, the estimates (3), (5), (6), (7), and (8) yield a polynomial bound on tmix(ǫ) and thus complete the proof of Theorem 1 for s = 0. We will prove (8) by defining a function ηM,M ′ : ΠM,M ′ → Ω0(H) and showing that ηM,M ′ is an injection. Fix (I, F ) ∈ ΠM,M ′ and define ηM,M ′ (I, F ) = (I ⊕ F ) ⊕ (M ∪ M ′). (9) Fact 7 For all I, F ∈ ΠM,M ′ we have ηM,M ′ (I, F ) ∈ Ω0(H). Fact 8 The mapping ηM,M ′ : ΠM,M ′ → Ω0(H) is injective. 2.4 The General Case When 3-combs, or wide edges to that matter, are possible, the structure of a union of two matchings I and F can be much more complex, as L(I ⊕ F ) may have vertices of degrees up to k. Nevertheless we are still able to apply a modification of the canonical path method. For the same Markov chain MC(H) as before, let us redefine the canonical path γ(I, F ) as follows. We again order the components of I ⊕ F and focus on a single component Qr. Now, we define a skeleton graph Sr by replacing each edge of Qr with a (graph) cycle Ck. Note that every vertex of Sr has degree two or four and therefore, by Euler's theorem, there is an Eulerian tour Er in Sr. We construct the canonical path γ(I, F ) in the transition graph G tracing the tours Er, r = 1, . . . , q. First, for every r we select a start vertex v0 in Er, which is determined by the smallest indicator. Next, we choose a direction of each tour in the following way. 10 (i) If degEr (v0) = 4 then there exist g ∈ I and f ∈ F such that v0 ∈ f ∩ g. Then the first edge of Er is (v0, w), where w is the smaller of the two neighbors of v0 on Sr which are in g . (ii) If degEr (v0) = 2 and there exists g ∈ I such that v0 ∈ g, then we choose (v0, w), as above. (iii) If degEr (v0) = 2 and there exists f ∈ F such that v0 ∈ f , then the first edge of Er is (v0, w), where w is the smaller of the two neighbors of v0 on Sr (which are in f ). The canonical path γ(I, F ) is now being constructed as we follow the edges of the Eulerian tours E1, . . . , Eq from the starting points and in the directions defined above. Let us fix Er = (e1, e2, . . . , es). Suppose that we have traversed already l − 1 edges of Er and let Mj−1 be the current state on the transition path γ(I, F ). We have two cases: 1) if el ⊆ g ∈ I then if g ∈ Mj−1 then Mj := Mj−1 − g, while if g /∈ Mj−1 then do nothing; 2) if el ⊆ f ∈ F then, setting If = {h1, . . . , hm}, if f ∈ Mj−1 then do nothing, while if f /∈ Mj−1 then Mj := Mj−1 − h1, Mj+1 := Mj − h2, . . . , Mj+m−2 = Mj+m−3 − hm−1, Mj+m−1 = Mj+m−2 + f − hm. So far we have not used the assumption on the bounded number of wide edges in H. But here it comes. In order to bound ΠM,M ′ ≤ poly(n)Ω(H) we define, as before, the function ηM,M ′ (I, F ). However, now ηM,M ′ (I, F ) is farther away from being a matching. Indeed, the presence of wide edges may lead to sit- uations where, e.g., e1, e2, e3 ∈ I, e4 ∈ F , and e4 ∩ei 6= ∅, i = 1, 2, 3. Then, in the process of creating the canonical path γ(I, F ), in order to put e4 on the current matching Mj we would need first to delete e1 and e2, and at least one of them, say e2, by a transition of type (-). As e2 might intersect two other (than e4) edges of F , this may create a path of length three in the set ηM,M ′ (I, F ). Fortu- nately, this scenario can repeat at most s times and, consequently, ηM,M ′ (I, F ) belongs to the set Ωs(H) = {H ′ ⊆ H : ∃e0, e1 . . . , es ∈ H ′ such that H ′ − {e0, e1, . . . , es} ∈ Ω(H)}. Finally, note that Ωs(H) ≤ {(M, e0, e1, . . . , es) : M ∈ Ω(H), e0, e1, . . . , es ∈ H} ≤ n(s+1)kΩ(H). Theorem 1 follows for any fixed s ≥ 0. 3 Hypergraphs with no 3-Combs In this section we give a couple of examples of classes of uniform hypergraphs which belong to family Hk 0 . We concentrate on hypergraphs whose intersection graphs have unbounded maximum degree, so that the result of [9] does not apply to them. 3.1 Subdivided 3-graphs The following operation generalizes the edge subdivision in graphs. For an arbi- trary 3-graph H = (V, E) construct the subdivided 3-graph H ′ = (V ′, E′) in the 11 following way. The vertex set is V ′ = V ∪VE, where VE = {ve : e ∈ E} is disjoint from V . The edge set E′ is obtained by replacing each hyperedge e = {v1, v2, v3} with all four triples of the form {vi, vj, ve}. It is easy to see that for every H the hypergraph H ′ contains no 3-comb. Observe that H ′ = Θ(V ′) and, depending on the structure of H, we might also have ∆(L(H ′)) = Θ(V ). Note that for a linear H, every matching M = {{u1, v1}, . . . , {ut, vt}} in the shadow graph Γ (H) of H (obtained by replacing each hyperedge with a graph triangle) deter- mines uniquely a matching M ′ = {e1, . . . , et} in H ′, where ei is the unique edge of H containing the pair {ui, vi}. Moreover, every matching of H ′ is determined this way. Thus, for linear H, the problem of counting matchings in H ′ reduces to counting matchings in graphs. 3.2 Rooted Blow-up Hypergraphs Partition an N -vertex set V into n nonempty sets V1, . . . , Vn, and fix one vertex vi ∈ Vi for each i = 1, . . . , n. Fix k ≥ 2 and for every pair 1 ≤ i < j ≤ n include to the edge set E the family Eij of all k-element subsets of Vi ∪ Vj containing both, vi and vj. Again, it is not hard to see that the obtained k-graph D = (V, E) has no 3-combs. Note that when Vi = O(1) for all i, the hypergraph D has Θ(n2) edges and ∆(L(D)) = Θ(n). 4 Further Research It remains an open question how to extend our result to larger classes of hyper- graphs. In particular, in view of Proposition 3, an intriguing open question is about the existence of an FPRAS for all k-uniform hypergraphs, k = 3, 4, 5. The success in the case of graphs (k = 2) relied mostly on the fact that every graph is free of 3-combs and thus I ⊕ F has a very simple structure. This is the case of the hypergraphs in the family Hk 0 as well. By a more complex argument we were able to prove the existence of an FPRAS for Hk s , s ≥ 0. For general hypergraphs, however, the unlimited presence of wide edges may cause the image of ηM,M ′ to become much larger than poly(n)Ω(H), and thus condition (5) might fail. Another direction of further research is to try to obtain an FPRAS for perfect matchings in dense k-uniform hypergraphs, where the density is measured as, e.g., in [17]. For k = 2 this was done in [14]. The corresponding decision problem for this class of hypergraphs as well as the problem of constructing a perfect matching was proven in [17] to be polynomial time solvable. The 3-combs are an obstacle here too, but in addition, we are facing the problem of the necessity of including into the state space of the Markov chain matchings much smaller than the perfect ones (in [14] the state space consisted only of perfect and near-perfect matchings, that is, matchings missing just two vertices). Acknowledgements We thank Martin Dyer, Mark Jerrum and Alex Samorodinsky for a number of stimulating discussions. 12 References 1. A. Barvinok, A. Samorodnitsky, Computing the partition function for perfect matchings in a hypergraph Combinatorics, Probability and Computing, 20 (2011), 815 -- 825. 2. M. Bayati, D. Gamarnik, D. Katz, C. Nair, and P. Tetali, Simple Deterministic Approximation Algorithms for Counting Matchings Proc. 39th ACM STOC, San Diego (2007) 122 -- 127. 3. M. Bordewich, M. Dyer, M. Karpinski, Path Coupling Using Stopping Times and Counting Independent Sets and Coloring in Hypergaphs, Random Struct. Algorithms 32 (2008), 375 -- 393. 4. A. Broder: How hard is it to marry at random? Proc. 18th ACM STOC, (1986) 50 -- 58. (Erratum in Proc. 20th ACM STOC, (1988), p. 551) 5. R. Bubley, M. Dyer, C. Greenhill, M. Jerrum: On Approximately Counting Colorings of Small Degree Graphs,SIAM J. Comput.,vol. 29(2), (1999), 387 -- 400. 6. R. Bubley, M. Dyer: Graph Orientations with No Sink and an Approximation for a Hard Case of #SAT, SODA (1997): 248 -- 257 7. M. Chudnovsky, P. Seymour, The roots of the independence polynomial of a claw-free graph, J. Combin. Th., B, 97 (2007) 350 -- 357. 8. M. Dyer, A. Frieze, M. Jerrum: On Counting Independent Sets in Sparse Graphs. SIAM J. Comput. 31(5): 1527 -- 1541 (2002). 9. S. Fadnavis, Approximating Independence Polynomials of Claw-Free Graphs, Preprint, Stanford Univ., 2012. 10. A. Galanis, Q. Ge, D. Stefankovic, E. Vigoda, L. Yang, Improved Inapprox- imability Results for Counting Independent Sets in the Hard-Core Model, In L. Goldberg, K. Jansen, R. Ravi, and J. Rolim, editors, Approximation, Ran- domization, and Combinatorial Optimization. Algorithms and Techniques, volume 6845 of Lecture Notes in Computer Science, pages 567578. Springer Berlin / Heidelberg, 2011. 10.1007/978-3-642-22935-0 48. 11. O. J. Heilmann, Existence of phase transitions in certain lattice gases with repulsive potential, Lettere al Nuovo Cimento 3 (1972), 95 -- 98. 12. O.J. Heilmann and E.H. Lieb, Theory of monomer-dimer systems, Commun. Math. Physics 25 (1972), 190 -- 232. 13. M. Jerrum: Counting, Sampling and Integrating: algorithms and complexity, Lectures in Mathematics -- ETH Zrich, Birkhuser, Basel, 2003. 14. M. Jerrum, A. Sinclair: Approximating the Permanent. SIAM J. Comput. 18(6): 1149 -- 1178 (1989). 15. M. Jerrum, A. Sinclair, E. Vigoda, A Polynomial-Time Approximation Algo- rithm for the Permanent of a Matrix with Nonnegative Entries, J. ACM 51 (2004), 671 -- 697. 16. M. Jerrum, L.G. Valiant, V.V. Vazirani, Random Generation of Combina- torial Structures from a Uniform Distributions, Theoret. Computer Sci. 43 (1986), 169 -- 188. 17. M. Karpinski, A. Rucinski, E. Szymanska: Computational Complexity of the Perfect Matching Problem in Hypergraphs with Subcritical Density. Int. J. Found. Comput. Sci. 21(6), (2010), 905 -- 924. 18. M. Karpinski, A. Rucinski, E. Szymanska, Approximate Counting of Match- ings in Sparse Hypergraphs, arXiv:1202.5885, Feb. 2012. 13 19. M. Luby, E. Vigoda: Fast convergence of the Glauber dynamics for sampling independent sets, Random Struct. Algorithms 15(3-4): 229 -- 241 (1999). 20. A. Sly, Computational Transition at the Uniqueness Threshold, IEEE 51st Annual Symposium on Foundations of Computer Science, FOCS 2010, pp.287-296, 2010. 21. A. Sly, N. Sun, The Computational Hardness of Counting in Two-Spin Models on Two-Spin Models on d-Regular Graphs, arXiv:1203.2602 v1, 12 March 2012. 22. S. Vadhan: The Complexity of Counting in Sparse, Regular, and Planar Graphs, SIAM J. Comput. 31(2): 398 -- 427 (2001). 23. J. van den Berg, On the Absence of Phase Transition in the Monomer-Dimer Model, Perplexing problems in Probability (Festschrift in honor of Harry Kesten) Progress in probability, 44 (1999) 185 -- 195. [ Book chapter ] 24. D. Weitz, Counting Independent Sets up to the Tree Threshold, Proc. 38th ACM STOC (2006), 140 -- 149.
1304.5971
1
1304
2013-04-22T14:49:39
A Competitive Strategy for Distance-Aware Online Shape Allocation
[ "cs.DS", "cs.CG" ]
We consider the following online allocation problem: Given a unit square S, and a sequence of numbers n_i between 0 and 1, with partial sum bounded by 1; at each step i, select a region C_i of previously unassigned area n_i in S. The objective is to make these regions compact in a distance-aware sense: minimize the maximum (normalized) average Manhattan distance between points from the same set C_i. Related location problems have received a considerable amount of attention; in particular, the problem of determining the "optimal shape of a city", i.e., allocating a single n_i has been studied. We present an online strategy, based on an analysis of space-filling curves; for continuous shapes, we prove a factor of 1.8092, and 1.7848 for discrete point sets.
cs.DS
cs
A Competitive Strategy for Distance-Aware Online Shape Allocation S´andor P. Feketea, Nils Schweera, Jan-Marc Reinhardta aDepartment of Computer Science, TU Braunschweig, Germany Abstract and a sequence of numbers ni ∈ {0, 1} with (cid:80)i We consider the following online allocation problem: Given a unit square S, j=0 nj ≤ 1; at each step i, select a region Ci of previously unassigned area ni in S. The objective is to make these regions compact in a distance-aware sense: minimize the maximum (normalized) average Manhattan distance between points from the same set Ci. Related location problems have received a considerable amount of attention; in particular, the problem of determining the "optimal shape of a city", i.e., allocating a single ni has been studied. We present an online strategy, based on an analysis of space-filling curves; for continuous shapes, we prove a factor of 1.8092, and 1.7848 for discrete point sets. Keywords: Clustering, average distance, online problems, optimal shape of a city, space-filling curves, competitive analysis. 1. Introduction Many optimization problems deal with allocating point sets to a given envi- ronment. Frequently, the problem is to find compact allocations, placing points from the same set closely together. One well-established measure is the average L1 distance between points. A practical example occurs in the context of grid computing, where one needs to assign a sequence of jobs i, each requiring an (appropriately normalized) number ni of processors, to a subset Ci of nodes of a large square grid, such that the average communication delay between nodes of the same job is minimized; this delay corresponds to the number of grid hops [10], so the task amounts to finding subsets with a small average L1, i.e., Manhattan distance. Karp et al. [7] studied the same problem in the context of memory allocation. Even in an offline setting without occupied nodes, finding an optimal allo- cation for one set of size ni is not an easy task; as shown in Fig. 1, the results are typically "round" shapes. If a whole sequence of sets have to be allocated, packing such shapes onto the grid will produce gaps, causing later sets to be- come disconnected, and thus leads to extremely bad average distances. Even restricting the shapes to be rectangular is not a remedy, as the resulting prob- lem of deciding whether a set of squares (which are minimal with respect to Email addresses: [email protected] (S´andor P. Fekete), [email protected] (Nils Schweer), [email protected] (Jan-Marc Reinhardt) Figure 1: Finding optimal individual shapes. (Left) An optimal shape composed of n=72 grid cells, according to [5]. (Right) The optimal limit curve w(x), according to [2]. L1 average distance among all rectangles) can be packed into a given square container is NP-hard [9]; moreover, disconnected allocations may still occur. In this paper, we give a first algorithmic analysis for the online problem. Us- ing an allocation scheme based on a space-filling curve, we establish competitive factors of 1.8092 and 1.7848 for minimizing the maximum average Manhattan distance within an allocated set. Related Work Compact location problems have received a considerable amount of atten- tion. Krumke et al. [8] have considered the offline problem of choosing a set of n vertices in a weighted graph, such that the average distance is minimized. They showed that the problem is NP-hard (even to approximate); for the scenario in which distances satisfy the triangle inequality, they gave algorithms that achieve asymptotic approximation factors of 2. For points in two-dimensional space and Manhattan distances, Bender et al. [2] gave a simple 1.75-approximation algo- rithm, and a polynomial-time approximation scheme for any fixed dimension. The problem of finding the "optimal shape of a city", i.e., a shape of given area that minimizes the average Manhattan distance, was first considered by Karp, McKellar, and Wong [7]; independently, Bender, Bender, Demaine, and Fekete [1] showed that this shape can be characterized by a differential equation for which no closed form is known. For the case of a finite set of n points that needs to be allocated to a grid, Demaine et al. [5] showed that there is an O(n7.5) dynamic-programming algorithm, which allowed them to compute all optimal shapes up to n = 80. Note that all these results are strictly offline, even though the original motivation (register or processor allocation) is online. Space-filling curves for processor allocation with our objective function have been used before, see Leung et al. [10]; however, no algorithmic results and no competitive factor was proven. Wattenberg [15] proposed an allocation scheme similar to ours, for purposes of minimizing the maximum Euclidean diameter of an allocated shape. Like other authors before (in particular, Niedermeier et al. [11] and Gotsman and Lindenbaum [6]), he considered a measure called for a sequence 1, . . . , i, . . . , j, . . . of points on a line, a space-filling c-locality: 6 ≈ 2.449 for the Hilbert curve, and 2 for the so-called H-curve. One can is use c-locality for establishing a constant competitive factor for our problems; mapping h(.) will guarantee L2(h(i), h(j)) < c(cid:112)j − i, for a constant c that √ 2 0.000.200.400.600.801.001.201.400.000.200.400.600.801.001.201.40w(x)xw(x)circle however, given that the focus is on bounding the worst-case distance ratio for an embedding instead of the average distance, it should come as no surprise that the resulting values are significantly worse than the ones we achieve. On a different note, de Berg, Speckmann, and van der Weele [4] consider treemaps with bounded aspect ratio. Other related work includes Dai and Su [3]. Our Results We give a first competitive analysis for the online shape allocation problem within a given bounding box, with the objective of minimizing the maximum average Manhattan distance. In particular, we give the following results. • We show that for the case of continuous shapes (in which numbers ni cor- respond to area), a strategy based on a space-filling Hilbert curve achieves a competitive ratio of 1.8092. • For the case of discrete point sets (in which numbers indicate the number of points that have to be chosen from an appropriate N × N orthogonal grid), we prove a competitive factor of 1.7848. • We sketch how these factors may be further improved, but point out that a Hilbert-based strategy is no better than a competitive factor of 1.3504, even with an improved analysis. • We establish a lower bound of 1.144866 for any online strategy in the case of discrete point sets, and argue the existence of a lower bound for the continuous case. The rest of this paper is organized as follows. In Section 2, we give some basic definitions and fundamental facts. In Section 3, we provide a brief description of an allocation scheme based on a space-filling curve. Section 4 gives a mathemat- ical study for the case of continuous allocations, proving that the analysis can be reduced to a limited number of shapes, and establishes a competitive factor of 1.8092. Section 5 sketches a similar analysis for the case of discrete allocations; as a result, we prove a competitive factor of 1.7848. Section 6 discusses lower bounds for online strategies. Final conclusions are presented in Section 7. 2. Preliminaries We examine the problem of selecting shapes from a square, such that the maximum average L1-distance of the shapes is minimized. We first formulate the problem more precisely. This covers both the continuous and the discrete case; the former arises as the limiting case of the latter, while the latter needs to be considered for allocations within a grid of limited size. Definition 1. A city is a (continuous) shape in the plane with fixed area. For a city C of area n, we call (cid:90)(cid:90)(cid:90)(cid:90) c(C) = 1 2 (x − u + y − v) dv du dy dx (1) (x,y),(u,v)∈C 3 the total Manhattan distance between all pairs of points in C and φ(C) = 2 c(C) n5/2 (2) the φ-value or average distance of C. An n-town T is a subset of n points in the integer grid. Its normalized average Manhattan distance is (cid:80) s∈T (cid:80) t∈T (cid:107)s − t(cid:107)1 n5/2 φ(T ) = 2c(T ) n5/2 = (3) The normalization with n2.5 yields a dimensionless measure that remains unchanged under scaling, and makes the continuous and the discrete case com- parable; see [1]. R+ with (cid:80)k Problem 2. In the continuous setting, we are given a sequence n1, n2, . . . , nk ∈ i=1 ni ≤ 1. Cities C1, C2, . . . , Ck of size n1, n2, . . . , nk are to be (cid:80)k In the discrete setting, we are given a sequence n1, n2, . . . , nk ∈ N+ with i=1 ni ≤ N 2. Towns C1, C2, . . . , Ck of size n1, n2, . . . , nk are to be chosen chosen from the unit square, such that max1≤i≤k φ(Ci) is minimized. from the N × N grid, such that max1≤i≤k φ(Ci) is minimized. Although it has not been formally proven, the offline problem is conjectured to be NP-hard, see [13]; if we restrict city shapes to be rectangles, there is an immediate reduction from deciding whether a set of squares can be packed into a larger square [9]. (A special case arises from considering integers, which cor- responds to choosing grid locations.) Our approximation works online, i.e., we choose the cities in a specified order, and no changes can be made to previously allocated cities; clearly, this implies approximation factors for the corresponding offline problems. There are lower bounds for max1≤i≤k φ(Ci) that generally cannot be achieved by any algorithm. One important result is the following theorem. Theorem 3. Let C be any city. Then φ(C) ≥ 0.650245. A proof can be found in [1]. For n1 = 1 any algorithm must select the whole unit square, thus 2/3, the φ-value of a square, is a lower bound for the achievable φ-value. We will discuss better lower bounds in the conclusions. 3. An Allocation Strategy While long and narrow shapes tend to have large φ-values, shapes that fill large parts of an enclosing rectangle with similar width and height usually have better average distances; however, one has to make sure that early choices with small average distance do not leave narrow pieces with high average distance, or even disconnected pieces, making the normalized φ-values potentially un- bounded. Our approach uses the recursive Hilbert family of curves in order to yield a provably constant competitive factor. That family is based on a recursive con- struction scheme and becomes space-filling for infinite repetition of said scheme [12]. For a finite number r of repetitions, the curve traverses all points of the used grid. For 1 ≤ r ≤ 3, the curve is shown in Fig. 2. Thus, the Hilbert curve 4 provides an order for the cells of the grid, which is then used for allocation, as illustrated in Fig. 3. More formal details of the recursive definition of the Hilbert family (e.g. with text-rewriting rules, such as the ones in [14]) are cited and sketched in the following Section 4. Figure 2: Hilbert curve with 1 ≤ r ≤ 3. More technically, the unit square is recursively subdivided into a grid con- sisting of 2r × 2r grid cells, for an appropriate refinement level r > 0, as shown in Fig. 2. For the sake of concise presentation, we assume that every input ni is an integral multiple of c = 4−R, for an appropriately large R > 0. (We will mention in the Conclusions how this assumption can be removed, based on Lemma 10.) Similar to the recursive structure of quad-trees, the actual subdi- vision can be performed in a self-refining manner, whenever a grid cell is not completely filled. This means that during the course of the online allocation, we may use different refinement levels in different parts of the layout; however, this will not affect the overall analysis, as further refinement of the grid does not change the quality of existing shapes. Definition 4. For a give refinement level r, an r-pixel P is a grid square of size 2−r × 2−r. For a given allocated shape Ci, a pixel is full if P ⊆ Ci; it is fractional, if P ∩ Ci (cid:54)= ∅ and P (cid:54)⊂ Ci. Now the description of the algorithm is simple: for every input ni, choose the next set of ni/2R R-pixels traversed by the Hilbert curve as the city Ci, starting in the upper left corner of the grid. For an illustration, see Fig. 3. The following lemma is a consequence of the recursive structure of the Hilbert family; see the following Section 4 for a formal argument. We use it in Section 5 for deriving upper bounds. Lemma 5. Let C be a city generated by our strategy with area at most n ≤ l 4j 4−R for j ∈ {0, 1, . . . , R}, l ∈ N. Then at any refinement level r, C contains at most two fractional r-pixels. Figure 3: A sample allocation according to our strategy. 5 4. Technical Details of Shape Allocation A technical different description of the Hilbert family can be based on the string representation given in [14]. There, the authors use the following recur- sion, based on the letters u, r, d, l for denoting "up", "right", "down", and "left". y1 = urd yn = h4(yn−1)uyn−1ryn−1dh5(yn−1) if n > 1 where h4 and h5 are defined as  if x = u, l r if x = d, d if x = r, u if x = l.  h4(x) = if x = u, r l if x = d, u if x = r, d if x = l. and h5(x) = and hi(x0x1x2 . . .) = hi(x0)hi(x1)hi(x2) . . ., i ∈ {4, 5}. We combine those characters to four sequences of length three and build an L-system, a special kind of formal grammar with parallel rewriting. Let A = urd, B = ldr, C = rul, and D = dlu, as shown in Figure 4 Using the production rules A → CAAB, B → DBBA, C → ACCD and D → BDDC and starting with A, you get the same string from [14] if you replace X0X1X2X3 by X0uX1rX2dX3, X0, X1, X2, X3 ∈ {A, B, C, D}, after each use of a produc- tion rule. A sequence of symbols produced by the L-system can be interpreted graph- r−1[j][k], j, k ∈ {1, . . . , 2r−1}, see Figure 4. ically as a sequence of sub-squares E2 The figure also shows that A is D rotated by 180◦. The same is true for B and C. We denote by X the symbol that is X rotated by 180◦. As we are only interested in the shape of cities, we identify symmetric cities. Consequently, we make no distinction between X and X when we look at a single symbol. We write X ≡ X. Similarly, we get equivalences for longer sequences of symbols: XY ≡ Y X, because the order of the successive sub-squares E2 r−1[j][k] does not change the shape. Furthermore, we have XX ≡ Y Y for each X and Y , as it is always the simple shape followed by the rotated shape, and XX ≡ XX for two occurrences of the same shape in succession. Lemma 6. After r > 1 uses of the production rules (where r = 1 means that we are still at the start symbol A), the resulting sequence contains all sub-sequences of length 2r−2 that can be created with the L-system, except for symmetry. Proof: We prove the claim via induction over r: r = 2 : CAAB contains C, B, and A ≡ A = D, i.e., all sequences of length 1. 6 r = 3 : ACCDCAABCAABDBBA contains • AA ≡ DD • AB ≡ BA ≡ DC ≡ CD • AC ≡ CA ≡ DB ≡ BD • BC ≡ CB ≡ AD ≡ DA • BB ≡ CC, i.e, all possible sequences of length 2. r → r + 1, r ≥ 3 : A sequence of length 2r−1 has been created from a sequence of length at most 2r−1/4 + 1 = 2r−3 + 1, because every symbol is replaced If the claim holds for r ≥ 3, then all sequences by exactly 4 symbols. of length 2r−2 have been created, i.e., all sequences of length 2r−3 + 1 have been created as well. Thus, in the next step the production rules are applied to all possible sequences of that length, yielding all sequences of (cid:3) length 2r−1 that can be created with the L-system. (cid:3) Lemma 7. A city Wn contains at most parts of (cid:100)n/4(cid:101)+1 sub-squares E2 j, k ∈ {1, . . . , 2r−1}, i.e., sub-squares that consist of exactly 4 cells. r−1[j][k], Proof: A city Wn consists of exactly n cells. Assume that these cells belong to at least (cid:100)n/4(cid:101) + 2 sub-squares E2 r−1[j][k]. Then at least three of those sub- squares cannot belong to Wn as a whole but only in part, because n cells cannot completely fill more than (cid:100)n/4(cid:101) of the sub-squares, and if two more are partially filled not even all those can be filled completely. Consider the sequence of sub- squares of Wn in the order given by the Hilbert curve. One of the sub-squares that is not the first or the last in the sequence cannot completely belong to Wn. This is a contradiction to the definition of the Hilbert curve, which recursively uses the same construction scheme for sub-squares on every level of refinement. (cid:3) Lemma 8. When the L-system has generated all sequences of length (cid:100)n/4(cid:101) + 1, the resulting Hilbert curve traverses a city Wn. Proof: Each symbol of the L-system corresponds to a sub-square E2 r−1[j][k]. Once all sequences of length (cid:100)n/4(cid:101) + 1 symbols have been generated, all possi- ble cities consisting of (cid:100)n/4(cid:101) + 1 sub-squares have been generated, too. With (cid:3) Lemma 7 the claim follows. Lemma 9. For r = (cid:100)log2((cid:100)n/4(cid:101) + 1)(cid:101) + 2 the Hilbert curve traverses a city Wn. Figure 4: A, B, C, and D 7 Proof: Using Lemmas 6 and 8 we know that the Hilbert curve traverses a city Wn, if the following holds: 2r−2 ≥ (cid:100)n/4(cid:101) + 1 r = (cid:100)log2((cid:100)n/4(cid:101) + 1)(cid:101) + 2. (cid:3) This is true for 5. Analysis For the analysis of our allocation scheme we will first make use of Lemma 5. As noted in Lemma 10, filling in the two fractional pixels of an allocated shape yields an estimate for the total distance at a coarser refinement level. In a sec- ond step, this will be used to derive global bounds by computing the worst-case bounds for shapes of at most refinement level 3; thus the presented computa- tional results for shapes of limited size are not merely experiments, but yield a general upper bound on the competitive factor. (As discussed in the Conclu- sions, carrying out the computations on a lower or higher refinement level gives looser or tighter results.) In the following, we denote by Wn the worst city consisting of n pixels that can be produced by our Hilbert strategy; because of the normalized nature of φ, this is independent on the size of the pixels, and only the shape matters. Lemma 10. Let C be a city generated by our strategy with area at most n ≤ l 4r 4−R for r ∈ {0, 1, . . . , R}, l ∈ N. Then we have c(C) ≤ c(Wl+1), where Wl+1 is a worst case among all cities produced by our allocation scheme that consists of (l + 1) r-pixels. Proof: By Lemma 5, we know that only the first and the last pixel of C may be fractional. Therefore C cannot intersect more than l + 1 r-pixels. By replacing the two fractional pixels by full pixels, we get a city W that consists of l + 1 full r-pixels, and c(C) ≤ c(W ). By definition, c(W ) ≤ c(Wl+1), and the claim holds. Therefore, we can give upper bounds for the worst case by considering the values of Wn at some moderate refinement level. The Wn can be found by enumeration; as described by the technical lemmas in preceding section, a speed- up can be achieved by making use of the recursive construction of the Wn. We determined the shapes and φ-values of the Wn for n ≤ 65; by Lemma 10, this suffices to provide upper bounds for all cities with area up to 64∗ 2−r, i.e., these computational results give an estimate for the round-up error using refinement level 3. The full table of average distances for this refinement level can be seen in Table 1; the worst cases among the examined ones are W56 and W14, which have the same shape, shown in Fig. 5. Theorem 11. Our strategy guarantees max1≤n≤k φ(Cn) ≤ 1.1764. 8 Figure 5: Worst cases Wn for 12 ≤ n ≤ 17. Table 1: Total and average distances for cities Wn allocated according to our strategy, as well as the optimal values ccity(n) according to [5]. n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 c∗(Wn) 0 1/3 2 6 13 1/3 24 38 50 2/3 74 2/3 102 134 2/3 162 210 2/3 262 2/3 322 371 2/3 434 2/3 512 2/3 602 1/3 685 768 870 992 2/3 1101 2/3 1216 1322 1/3 1432 1527 2/3 1672 1853 1/3 2046 2213 2393 1/3 2602 ccity(n) 0 1/3 2 5 2/3 10 2/3 19 2/3 30 44 61 1/3 81 106 1/3 135 2/3 165 1/3 203 244 290 2/3 338 2/3 396 1/3 457 1/3 522 1/3 591 2/3 663 749 1/3 839 1/3 933 1032 1/3 1134 1249 1365 1/3 1492 1622 2/3 1759 2/3 1898 2/3 2057 φ(Wn) 0.6667 0.7071 0.7698 0.8333 0.8587 0.8619 0.7816 0.8250 0.8395 0.8517 0.8074 0.8446 0.8621 0.8781 0.8530 0.8490 0.8605 0.8764 0.8706 0.8587 0.8610 0.8745 0.8685 0.8619 0.8463 0.8309 0.8066 0.8061 0.8184 0.8301 0.8272 0.8263 0.8319 Φ(Wn) 1.1764 1.1497 1.1174 1.1058 1.1098 1.0903 1.0713 1.0424 1.0150 0.9777 0.9701 0.9785 0.9864 0.9773 0.9710 0.9726 0.9791 0.9735 n 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 c∗(Wn) 2835 2/3 3045 3266 3519 1/3 3799 1/3 4049 2/3 4309 1/3 4545 4788 5009 5266 2/3 5641 1/3 6031 1/3 6379 2/3 6741 1/3 7147 1/3 7586 1/3 7993 8411 1/3 8878 9379 1/3 9835 10304 10733 11173 1/3 11583 2/3 12005 1/3 12391 12862 13415 13924 2/3 14452 2/3 ccity(n) 2216 2/3 2384 2554 2/3 2727 2/3 2921 2/3 3117 2/3 3322 3530 1/3 3749 3976 4205 1/3 4456 2/3 4712 4970 1/3 5234 5507 1/3 5788 6076 1/3 6368 6691 2/3 7017 1/3 7352 1/3 7690 8033 2/3 8384 2/3 8749 1/3 9117 1/3 9506 1/3 9904 2/3 10305 1/3 10719 1/3 11139 2/3 φ(Wn) 0.8414 0.8403 0.8400 0.8453 0.8536 0.8527 0.8517 0.8445 0.8376 0.8262 0.8202 0.8306 0.8405 0.8425 0.8446 0.8505 0.8583 0.8606 0.8628 0.8683 0.8754 0.8768 0.8781 0.8751 0.8723 0.8665 0.8610 0.8527 0.8499 0.8517 0.8499 0.8486 Φ(Wn) 0.9691 0.9712 0.9772 0.9726 0.9682 0.9570 0.9463 0.9307 0.9214 0.9306 0.9393 0.9393 0.9395 0.9439 0.9505 0.9512 0.9516 0.9559 0.9620 0.9619 0.9617 0.9569 0.9522 0.9445 0.9372 0.9268 0.9225 0.9232 0.9201 0.9175 Proof: Consider a city C of size n generated by our strategy. If n is sufficiently small, i.e., smaller than an R − r-pixel, r ≥ 0, C consists of at most 4r cells and its average distance can be bounded by the worst case for that particular number of cells. In the case that C has a larger, more complicated shape, an analysis of a finite number of shapes is still sufficient: We know that n > 4jc and can assume that n ≤ 4j+1c (or else we use the analysis on the less refined E2 r−(j+1)[p][q]). Thus, there must be an l such that l4jc < n ≤ (l + 1)4jc with l = 1, . . . , 3. Yet, we can get closer to n, as we r−j[p][q] consists of 4j cells. We get the inequality l4j−k < n ≤ know that E2 (l + 1)4j−kc, k ≤ j, l = 4k, . . . , 4k+1 − 1. Hence, a city of arbitrary size n corresponds to at most (l + 1) sub-squares 9 of a certain size (depending on the precision of the analysis), i.e., a city of size at most (l + 1)4j−kc. Now we can use Lemma 5 to bound the average distance of the city, yielding φ(C) ≤ 2 c(W ) (l 4j−kc)5/2 = φ(Wl+2)((l + 2) 4j−kc)5/2 (l 4j−kc)5/2 (cid:18) (cid:19)5/2 2 l = φ(Wl+2) 1 + =: Φ(Wl). (4) (5) The resulting bound is max({φ(Wi) : 1 ≤ i ≤ 4j}∪{Φ(Wl) : 4k ≤ l ≤ 4k+1−1}). Note that the number of shapes considered is at most 4k+1. We conducted the calculations for k = 2 and list the results in Table 1. As (cid:3) it turns out, the maximum is attained for Φ(W16) = 1.1764. Corollary 12. Our strategy achieves a competitive factor of 1.8092. Proof: According to Theorem 3, no algorithm can guarantee a better φ- value than 0.650245. Our strategy yields an upper bound of 1.1764. This results in a factor of 1.1764/0.650245 ≈ 1.8092. (cid:3) 6. Discrete Point Sets Our above analysis relies on continuous weight distributions, which imply the lower bound on φ-values stated in Theorem 1. This does not include the discrete scenario, in which the values ni indicate a number of integer grid points that have to be chosen from an appropriate N × N -grid. As discussed in the paper [5], considering discrete weight distributions may allow lower average distances; e.g., a single point yields a φ-value of 0. As a consequence, towns (subsets of the integer grid) have lower average distances than cities of the same total weight. However, we still get a competitive ratio for the case of online towns. Theorem 13. For n-towns, a Hilbert-curve strategy guarantees a competitive factor of at most 1.7848 for the φ-value. Proof: Lemma 5 still holds, so analogously to Theorem 11, we consider the values up to n = 64, and show that the worst case is attained for n = 16, which yields an upper bound of 1.123. See Table 2 for detailed numbers. For a lower bound, the general value of 0.650245 for φ-values cannot be applied, as discrete point sets may have lower average distance. Instead, we verify that the ratio ρ(n) of achieved φ to optimal φ, is less than 1.7848; this is the same as c(Tn)/ctown(n) for n ≤ 64, see Table 2. For 65 ≤ n ≤ 80, the optimal values in [5] allow us to verify that φ ≥ 0.6292; see our Table 3. Thus, we have to establish a lower bound for φ for n ≥ 81. We make use of equation (5), p. 89 of [5]; see Fig. 6: for a given number n of grid points, the difference between the optimal total Manhattan distance ccity(n) for a city consisting of n unit squares and the optimal total distance ctown(n) for a town consisting of n grid points is equal to Λ(n) := 1 , where ci is 6 the number of grid points in column i, and rj is the number of grid points in i +(cid:80) (cid:16)(cid:80) i c2 j r2 j (cid:17) 10 c1 = 5 c2 = 3 c3 = 2 c4 = 1 c5 = 0 √ 2 n + 5 r5 = 1 r4 = 1 r3 = 2 r2 = 3 r1 = 4 √ n n+5 2 Figure 6: Establishing a lower bound for φ: Defining Λ(n); an arrangement that maximizes Λ(n). row j. Because 2ccity(n) bound of ψ − 2Λ(n) n2.5 ≤ 2ctown(n) n2.5 n2.5 is bounded from below by ψ = 0.650245, we get a lower for the φ-value of an n-town. i c2 into 2 j r2 i ci = n and the function(cid:80) n + 5; as(cid:80) is superlinear in the ci, we conclude that(cid:80) n+5 points each, so(cid:80) we have (cid:80) A more refined analysis of Λ(n) considers maximizing(cid:80) once, instead of(cid:80) n+5 . For n ≥ 81, this yields 2Λ(n)/n2.5 ≤ 2 This leaves the task of providing an upper bound for 2Λ(n)/n2.5. According √ √ to Lemma 5 of [5], the bounding box of an optimal n-town does not exceed n + 5. Therefore, we have ci ≤ 2 i c2 2 i √ √ i is maximized by subdividing n i ≤ n(2 √ n i c2 n+5 columns of 2 n+5). Analogously, √ n + 5), so 2Λ(n)/n2.5 ≤ 2 n1.5 ). For n ≥ 81, this j ≤ n(2 3 ( 2 n + 5 implies 2Λ(n)/n2.5 ≤ 4 2187 = 0.0210333... or φ(n) ≥ 0.6292. This yields 243 + 10 (cid:3) an overall competitive ratio of not more than 1.123/0.6292, i.e., 1.7848. j r2 √ j all at n + j separately, for a maximum value of n(2 √ 5) + n2 621 = 0.0137373... 2 As the resulting competitive ratio of 1.7643 is only very slightly better, we omit further details. If instead we rely on the unproven conjecture in [5] that 2ctown n2.5 ≈ ψ − 0.410 n , we get φ ≥ 0.6451, which corresponds to experimental i and(cid:80) i +(cid:80) 243 + 5 2187 + 2 i c2 j r2 i c2 evidence; the resulting competitive factor is 1.7406. 7. Lower Bounds We demonstrate that there are non-trivial lower bounds for a competitive factor. We start by considering the discrete online scenario for towns. Theorem 14. No online strategy can guarantee a competitive factor below 64√ 1.144866.... 55 = Proof: Consider a 3 × 3 square, and let n1 = 4; see Fig. 7. If (a) the strategy allocates a 2 × 2 square (for a total distance of 8), then n2 = 5, and the resulting L-shape has a total distance of 20 and a φ-value of 40/52.5 = 0.715541... Allocating (b) the first town with an L-shape of total distance 10 results in φ = 20/32 = 0.625, and the second with a total distance of 16, or φ = 32/52.5 = 0.572433... 11 Table 2: Total distances for towns Tn allocated according to our strategy, and the correspond- ing optimal values ctown for n-towns. n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 c(Tn) 0 1 4 10 20 33 44 66 92 123 148 194 244 301 348 410 488 575 656 736 836 957 1064 1176 1280 1387 1480 1618 1796 1985 2148 2326 2532 ctown(n) 0 1 4 8 16 25 38 54 72 96 124 152 188 227 272 318 374 433 496 563 632 716 804 895 992 1091 1204 1318 1442 1570 1704 1840 1996 ρ(n) φ(Tn) − 0.0000 0.3536 0.5132 0.6250 0.7155 0.7485 0.6788 0.7292 0.7572 0.7779 0.7376 0.7778 0.8009 0.8209 0.7987 0.8008 0.8191 0.8366 0.8338 0.8229 0.8273 0.8431 0.8388 0.8335 0.8192 0.8048 0.7814 0.7800 0.7931 0.8054 0.8029 0.8031 0.8095 1.0000 1.0000 1.2500 1.2500 1.3200 1.1579 1.2222 1.2778 1.2812 1.1935 1.2763 1.2979 1.3260 1.2794 1.2893 1.3048 1.3279 1.3226 1.3073 1.3228 1.3366 1.3234 1.3140 1.2903 1.2713 1.2292 1.2276 1.2455 1.2643 1.2606 1.2641 1.2685 Φ(Tn) 1.1230 1.1001 1.0708 1.0626 1.0700 1.0530 1.0360 1.0091 0.9831 0.9472 0.9388 0.9483 0.9570 0.9486 0.9437 0.9464 0.9540 0.9489 n 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 c(Tn) 2763 2968 3186 3436 3713 3960 4216 4448 4687 4904 5154 5524 5909 6252 6610 7012 7447 7848 8262 8724 9221 9672 10136 10560 10995 11400 11816 12196 12669 13220 13724 14256 ctown(n) 2153 2318 2486 2656 2847 3040 3241 3446 3662 3886 4112 4360 4612 4868 5128 5398 5675 5960 6248 6568 6890 7222 7556 7896 8243 8604 8968 9354 9749 10146 10556 10972 ρ(n) 1.2833 1.2804 1.2816 1.2937 1.3042 1.3026 1.3008 1.2908 1.2799 1.2620 1.2534 1.2670 1.2812 1.2843 1.2890 1.2990 1.3122 1.3168 1.3223 1.3283 1.3383 1.3392 1.3415 1.3374 1.3339 1.3250 1.3176 1.3038 1.2995 1.3030 1.3001 1.2993 φ(Tn) 0.8198 0.8191 0.8194 0.8252 0.8342 0.8338 0.8333 0.8265 0.8200 0.8089 0.8027 0.8133 0.8235 0.8257 0.8282 0.8344 0.8425 0.8450 0.8474 0.8532 0.8606 0.8623 0.8638 0.8610 0.8583 0.8527 0.8475 0.8393 0.8371 0.8393 0.8376 0.8370 Φ(Tn) 0.9453 0.9482 0.9550 0.9511 0.9473 0.9366 0.9263 0.9112 0.9017 0.9112 0.9203 0.9205 0.9212 0.9260 0.9331 0.9339 0.9347 0.9393 0.9458 0.9459 0.9460 0.9414 0.9370 0.9295 0.9224 0.9123 0.9086 0.9098 0.9068 0.9051 Table 3: φ-values of optimal n-towns, calculated using Table 1 from [5]. n φopt(n) 0.645053 65 0.645234 66 0.645524 67 68 0.645595 φopt(n) 0.644217 0.644281 0.644240 0.644104 φopt(n) 0.643676 0.644399 0.645067 0.645317 n 77 78 79 80 n 69 70 71 72 n 73 74 75 76 φopt(n) 0.645275 0.645136 0.645072 0.644715 If instead, (c) the first town is allocated different from a square, the total distance is at least 10, and φ ≥ 20/32; then (d) n2 = n3 = n4 = n5 = n6 = 1, and an optimal strategy can allocate the first town as a 2x2 square, with φ = 0.5. (cid:3) This bounds the competitive ratio, as claimed. For the case of continuous allocations, we claim the following. Theorem 15. There is δ > 0, such that no online strategy can guarantee a competitive factor 1 + δ. Proof: Consider n1 = 1/2, in combination with the two possible scenarios (a) n2 = 1/2; (b) n2 = n3 = . . . = ε. In scenario (a), an adversary can assign two (1×1/2)-rectangles, for a φ-value of 0.707...; in scenario (b), an adversary can assign all shapes as squares, for a φ-value of 0.666... If the player chooses a square size 2/2 first, the adversary √ 12 Figure 7: The four cases considered in Theorem 14; the left column shows the choices by an algorithm, the right the corresponding optimal choices for the ensung sequence. Figure 8: The scenarios considered in Theorem 15, and a possible choice for the player. √ 3 (7 − 4 can choose scenario (a), causing the second allocation to be in L-shape with φ-value 2 2) = 0.895431..., as opposed to the optimal value of 0.707... If the player chooses a (1× 1/2)-rectangle first, the adversary chooses scenario (b), for a ratio of 1.06066... The existence of the claimed lower bound follows from continuity, as the φ-value changes continuously with continuous deformation of (cid:3) the involved shapes. The precise value arising from the scenarios in Theorem 15 is complicated. It can be obtained by computing the optimal intermediate value for the player that allows him to protect against both scenarios at once. For example, optimizing over the family of allocations shown in Figure 8 (c) yields a competitive ratio that is better than 1.06; however, the player may do even better by using curved boundaries. The involved computational effort for the resulting optimization problem promises to be at least as complicated as computing the "optimal shapes of a city", for which no closed-form solution is known, see [7, 1]. 8. Conclusions We have established a number of results for the online shape allocation problem. In principle, further improvement could be achieved by replacing the computational results for level 3 (i.e., n = 16, . . . , 64) by level 4 (i.e., n = 65, . . . , 256). (Conversely, a simplified analysis with level 2, i.e., n = 4, . . . , 16; yields a worse factor of 3.6525.) However, the highest known optimal φ-values are for n = 80, obtained by using the O(n7.5) algorithm of [5]. In any case, there is a threshold of 1.3504 for Hilbert-based strategies, which we believe to be tight: this is the ratio between the upper bound of 0.8768 for n = 14 (and for n = 56, 224, . . .) and the asymptotic lower bound of 0.650245; because asymptotically, continuous and discrete case converge, this also applies to the 13 (a)(b)(c)(d)(c)(a)(b) discrete case. Other open problems are to raise the lower bound of 1.144866 for the discrete case, and establish definitive values for the continuous case. As noted in Section 3, we can eliminate the assumption of all ni being multiples of some 2−R, by making use of Lemma 10, and allocating a small round-off fraction to a fractional pixel maintains the same bounds. However, the formal aspects of describing the resulting allocation scheme become somewhat tedious and would require more space than seems appropriate. The offline problem is interesting in itself: for given ni, allocate disjoint re- gions of area ni in a square, such that the maximum average Manhattan distance for each shape is minimized. As mentioned, there is some indication that this is an NP-hard problem; however, even relatively simple instances are prohibitively tricky to solve to optimality, making it hard to give a formal proof. Clearly, our online strategy provides a simple approximation algorithm; however, better factors should be possible by exploiting the a-priori information of knowing all ni, e.g., by sorting them appropriately. Figure 9: A possible worst-case scenario for the offline problem. Another interesting open question for the offline scenario is the maximum optimal φ-value for any set n1, . . . , ni. A simple lower bound is 2/3 = 0.666..., as that is the average distance of the whole square. A better lower bound is is provided by dividing the square into two or three equal-sized parts. For the case n1 = n2 = 1/2, we can use symmetry and convexity to argue that an optimum can be obtained by a vertical split, yielding φ = 2/2 = 0.707. We believe the global worst case is attained for n1 = n2 = n3 = 1/3. Unfortunately, it is no longer possible to exploit only symmetry for arguing global optimality. Figure 9 shows an allocation with φ = 0.718736... for all three regions1. We conjecture that this is the best solution for n1 = n2 = n3 = 1/3, as well as the worst case for any optimal partition of the unit square. √ Acknowledgments. A short abstract based on preliminary results of this paper appears in the in- formal, non-competitive Workshop EuroCG. (Standard disclaimer of that work- shop: "This is an extended abstract of a presentation given at EuroCG 2011. It has been made public for the benefit of the community only and should be considered a preprint rather than a formally reviewed paper. Thus, this work is expected to appear in a conference with formal proceedings and/or in a jour- nal.") (9602477−13416 √ the involved values can be expressed as a = 1 108 585705)θ+(202679+204 585705)ψ2+82133θ3 √ √ 77760 3θ (cid:0)55 − 791 θ + θ(cid:1) with θ := 1More precisely, and (cid:16)−16253 + 36 φ = √ 585705 (cid:17)1/3 . 14 a=0.390629b=0.057296 We thank Bettina Speckmann for pointing out references [15] and [4], and other colleagues for helpful hints to improve the presentation of this paper. References [1] C. M. Bender, M. A. Bender, E. D. Demaine, and S. P. Fekete. What is the optimal shape of a city? J. Physics A: Mathematical and General, 37(1):147 -- 159, 2004. [2] M. A. Bender, D. P. Bunde, E. D. Demaine, S. P. Fekete, V. J. Leung, H. Meijer, and C. A. Phillips. Communication-Aware Processor Allocation for Supercomput- ers: Finding Point Sets of Small Average Distance. Algorithmica, 50(2):279 -- 298, 2008. [3] H.-K. Dai and H.-C. Su. On the locality properties of space-filling curves. In 14th International Symposium on Algorithms and Computation, (ISAAC), pages 385 -- 394, 2003. [4] M. de Berg, B. Speckmann, and V. van der Weele. Treemaps with bounded aspect ratio. CoRR, abs/1012.1749, 2010. [5] E. D. Demaine, S. P. Fekete, G. Rote, N. Schweer, D. Schymura, and M. Zelke. Integer point sets minimizing average pairwise L1 distance: What is the optimal shape of a town? Comp. Geom., 40:82 -- 94, 2011. [6] C. Gotsman and M. Lindenbaum. On the metric properties of discrete space-filling curves. IEEE Transactions on Image Processing, 5(5):794 -- 797, 1996. [7] R. M. Karp, A. C. McKellar, and C. K. Wong. Near-Optimal Solutions to a 2-Dimensional Placement Problem. SIAM J. Computing, 4(3):271 -- 286, 1975. [8] S. Krumke, M. Marathe, H. Noltemeier, V. Radhakrishnan, S. Ravi, and D. Rosenkrantz. Compact location problems. Theor. Comput. Sci., 181(2):379 -- 404, 1997. [9] J. Y.-T. Leung, T. W. Tam, C. S. Wing, G. H. Young, and F. Y. Chin. Packing squares into a square. J. Parallel Distrib. Comput., 10(3):271 -- 275, 1990. [10] V. J. Leung, E. M. Arkin, M. A. Bender, D. P. Bunde, J. Johnston, A. Lal, J. S. B. Mitchell, C. A. Phillips, and S. S. Seiden. Processor Allocation on Cplant: Achiev- ing General Processor Locality Using One-Dimensional Allocation Strategies. In Proc. IEEE CLUSTER'02, pages 296 -- 304. 2002. [11] R. Niedermeier, K. Reinhardt, and P. Sanders. Towards optimal locality in mesh- indexings. Discrete Applied Mathematics, 117(1-3):211 -- 237, 2002. [12] H. Sagan. Space-Filling Curves. Springer, New York, 1994. [13] N. Schweer. Algorithms for Packing Problems. PhD thesis, Braunschweig, 2010. [14] R. Siromoney and K. Subramanian. Space-filling curves and infinite graphs. In Graph-Grammars and Their Application to Computer Science, volume 153 of LNCS, pages 380 -- 391, Berlin, 1983. Springer. [15] M. Wattenberg. A note on space-filling visualizations and space-filling curves. In Proceedings of the IEEE Symposium on Information Visualization (INFOVIS), pages 181 -- 186, 2005.
1902.07040
3
1902
2019-07-12T13:18:35
Travelling on Graphs with Small Highway Dimension
[ "cs.DS" ]
We study the Travelling Salesperson (TSP) and the Steiner Tree problem (STP) in graphs of low highway dimension. This graph parameter was introduced by Abraham et al. [SODA 2010] as a model for transportation networks, on which TSP and STP naturally occur for various applications in logistics. It was previously shown [Feldmann et al. ICALP 2015] that these problems admit a quasi-polynomial time approximation scheme (QPTAS) on graphs of constant highway dimension. We demonstrate that a significant improvement is possible in the special case when the highway dimension is 1, for which we present a fully-polynomial time approximation scheme (FPTAS). We also prove that STP is weakly NP-hard for these restricted graphs. For TSP we show NP-hardness for graphs of highway dimension 6, which answers an open problem posed in [Feldmann et al. ICALP 2015].
cs.DS
cs
Travelling on Graphs with Small Highway Dimension Yann Disser1,∗, Andreas Emil Feldmann2,†, Max Klimm3,‡, and Jochen Konemann4,§ 1 TU Darmstadt, Germany, [email protected] 2 Charles University in Prague, Czechia, [email protected] 3 Humboldt-Universitat zu Berlin, Germany, [email protected] 4 University of Waterloo, Canada, [email protected] 9 1 0 2 l u J 2 1 ] S D . s c [ 3 v 0 4 0 7 0 . 2 0 9 1 : v i X r a Abstract We study the Travelling Salesperson (TSP) and the Steiner Tree problem (STP) in graphs of low highway dimension. This graph parameter was introduced by Abraham et al. [SODA 2010] as a model for transportation networks, on which TSP and STP naturally occur for various applica- tions in logistics. It was previously shown [Feldmann et al. ICALP 2015] that these problems admit a quasi-polynomial time approximation scheme (QPTAS) on graphs of constant highway dimension. We demonstrate that a significant improvement is possible in the special case when the highway dimen- sion is 1, for which we present a fully-polynomial time approximation scheme (FPTAS). We also prove that STP is weakly NP-hard for these restricted graphs. For TSP we show NP-hardness for graphs of highway dimension 6, which answers an open problem posed in [Feldmann et al. ICALP 2015]. 1 Introduction Two fundamental optimization problems already included in Karp's initial list of 21 NP-complete prob- lems [Kar72] are the Travelling Salesperson problem (TSP) and the Steiner Tree problem (STP). Given an undirected graph G = (V, E) with non-negative edge weights w : E → R+, the TSP asks to find the shortest closed walk in G visiting all nodes of V . Besides its fundamental role in computational complexity and combinatorial optimization, this problem has a variety of applications ranging from circuit manufacturing [GH91; LR75] and scientific imaging [BS89] to vehicle routing problems [LND85] in trans- portation networks. For the STP, a subset R ⊆ V of nodes is marked as terminals. The task is to find a weight-minimal connected subgraph of G containing the terminals. It has plenty of fundamental applic- ations in network design including telecommunication networks [Lju+06], computer vision [CG18], circuit design [Hel+11], and computational biology [Cho+13; LAS16], but also lies at the heart of line planning in public transportation [BNP09]. Both TSP and STP are APX-hard in general [Aro+92; BP89; CC08; KLS15; Lam14; PV06] implying that, unless P = NP, none of these problems admit a polynomial-time approximation scheme (PTAS), i.e., an algorithm that computes a (1 + ε)-approximation in polynomial time for any given constant ε > 0. On the other hand, for restricted inputs PTASs do exist, e.g., for planar graphs [Aro+98; BKK07; GEP95; Kle08], Euclidean and Manhattan metrics [ARR98; Mit99], and more generally low doubling1 metrics [BGK12]. We study another class of graphs captured by the notion of highway dimension, which was proposed by Abraham et al. [Abr+10]. This graph parameter models transportation networks and is thus of particular importance in terms of applications for both TSP and STP. On a high level, the highway dimension is based on the empirical observation of Bast et al. [Bas+07; BFM09] that travelling from a point in a network to a sufficiently distant point on a shortest path always passes through a sparse set of "hubs". The following ∗Supported by the 'Excellence Initiative' of the German Federal and State Governments and the Graduate School CE at TU Darmstadt. †Supported by the Czech Science Foundation GA CR (grant #17-10090Y), and by the Center for Foundations of Modern Computer Science (Charles Univ. project UNCE/SCI/004). ‡Supported by the German Research Foundation (DFG) as part of Math+ (project AA3-4). §Supported by the Discovery Grant Program of the Natural Sciences and Engineering Research Council of Canada 1A metric is said to have doubling dimension d if for all r > 0 every ball of radius r can be covered by at most 2d balls of half the radius r/2. formal definition is taken from [Fel18] and follows the lines of Abraham et al. [Abr+10].2 Here the distance between two vertices is the length of the shortest path between them, according to the edge weights. The ball Bv(r) of radius r around a vertex v contains all vertices with distance at most r from v. Definition 1 For a scale r ∈ R>0, let P(r,2r] denote the set of all vertex sets of shortest paths with length in (r, 2r]. A shortest path cover for scale r is a hitting set for P(r,2r], i.e., a set spc(r) ⊆ V such that spc(r) ∩ P 6= ∅ for all P ∈ P(r,2r]. The vertices of spc(r) are the hubs for scale r. A shortest path cover spc(r) is locally h-sparse, if spc(r) ∩ Bv(2r) ≤ h for all vertices v ∈ V . The highway dimension of G is the smallest integer h such that there is a locally h-sparse shortest path cover spc(r) for every scale r ∈ R>0 in G. The algorithmic consequences of this graph parameter were originally studied in the context of road networks [Abr+10; Abr+11; Abr+16], which are conjectured to have fairly small highway dimension. Road networks are generally non-planar due to overpasses and tunnels, and are also not Euclidean due to different driving or transmission speeds. This is even more pronounced in public transportation networks, where large stations have many incoming connections and plenty of crossing links, making Euclidean (or more generally low doubling) and planar metrics unsuitable as models. Here the highway dimension is better suited, since longer connections are serviced by larger and sparser stations (such as train stations and airports) that can act as hubs. The main question posed in this paper is whether the structure of graphs with low highway dimension admits PTASs for problems such as TSP and STP, similar to Euclidean or planar instances. It was shown that quasi-polynomial time approximation schemes (QPTASs) exist for these problems [Fel+18], i.e., (1 + ε)-approximation algorithms with runtime 2polylog(n) assuming that ε and the highway dimension of the input graph are constants. However it was left open whether this can be improved to polynomial time. 1.1 Our results Our main result concerns graphs of the smallest possible highway dimension, and shows that for these fully polynomial time approximation schemes (FPTASs) exist, i.e., a (1 + ε)-approximation can be computed in time polynomial in both the input size and 1/ε. Thus at least for this restricted case we obtain a significant improvement over the previously known QPTAS [Fel+18]. Theorem 2 Both Travelling Salesperson and Steiner Tree admit an FPTAS on graphs with high- way dimension 1. From an application point of view, so-called hub-and-spoke networks that can typically be seen in air traffic networks can be argued to have very small highway dimension close to 1: their star-like structure implies that hubs are needed at the centers of stars only, where all shortest paths converge. From a more theoretical viewpoint, we show that surprisingly the STP problem is non-trivial on graphs highway dimension 1, since it is still NP-hard even on this very restricted case. Interestingly, together with Theorem 2 this implies [Vaz01] that STP is weakly NP-hard on graphs of highway dimension 1. This is in contrast to planar graphs or Euclidean metrics, for which the problem is strongly NP-hard. Theorem 3 The Steiner Tree problem is weakly NP-hard on graphs with highway dimension 1. It was in fact left as an open problem in [Fel+18] to determine the hardness of STP and also TSP on graphs of constant highway dimension. Theorem 3 settles this question for STP. We also answer the question for TSP, but in this case we are not able to bring down the highway dimension to 1 so that the following theorem does not complement Theorem 2 tightly. Theorem 4 The Travelling Salesperson problem is NP-hard on graphs with highway dimension 6. 2It is often assumed that all shortest paths are unique when defining the highway dimension, since this allows good polynomial approximations of this graph parameter [Abr+11]. In this work however, we do not rely on these approximations, and thus do not require uniqueness of shortest paths. 2 1.2 Techniques We present a step towards a better understanding of low highway dimension graphs by giving new structural insights on graphs of highway dimension 1. It is not hard to find examples of (weighted) complete graphs with highway dimension 1 (cf. [Fel+18]), and thus such graphs are not minor-closed. Nevertheless, it was suggested in [Fel+18] that the treewidth of low highway dimension graphs might be bounded polylogarithmically in terms of the aspect ratio α, which is the maximum distance divided by the minimum distance between any two vertices of the input graph. Definition 5 A tree decomposition of a graph G = (V, E) is a tree D where each node v is labelled with a bag Xv ⊆ V of vertices of G, such that the following holds: (a) Sv∈V (D) Xv = V , (b) for every edge {u, w} ∈ E there is a node v ∈ V (D) such that Xv contains both u and w, and (c) for every v ∈ V the set {u ∈ V (D) v ∈ Xu} induces a connected subtree of D. The width of the tree decomposition is max{Xv − 1 v ∈ V (D)}. The treewidth of a graph G is the minimum width among all tree decompositions for G. As suggested in [Fel+18], one may hope to prove that the treewidth of any graph of highway dimension h is, say, O(h polylog(α)). As argued in Section 6, it unfortunately is unlikely that such a bound is generally possible. In contrast to this, our main structural insight on graphs of highway dimension 1 is that they have treewidth O(log α). This implies FPTASs for TSP and STP, since we may reduce the aspect ratio of any graph with n vertices to O(n/ε) and then use algorithms by Bodlaender et al. [Bod+13] to compute optimum solutions to TSP and STP in graphs of treewidth t in 2O(t)n time. Since reducing the aspect ratio distorts the solution by a factor of 1 + ε, this results in an approximation scheme. Although these are fairly standard techniques for metrics (cf. [Fel+18]), in our case we need to take special care, since we need to bound the treewidth of the graphs resulting from this reduction, which the standard techniques do not guarantee. It remains an intriguing open problem to understand the complexity and structure of graphs of constant highway dimension larger than 1. 1.3 Related work The Travelling Salesperson problem (TSP) is among Karp's initial list of 21 NP-complete prob- lems [Kar72]. For general metric instances, the best known approximation algorithm is due to Christofides [Chr76] and computes a solution with cost at most 3/2 times the LP value. For unweighted instances, the best known approximation guarantee is 7/5 and is due to Seb and Vygen [SV14]. In general the problem is APX-hard [KLS15; Lam14; PV06]. For geometric instances where the nodes are points in Rd and distances are given by some lp-norm, there exists a PTAS [Aro98; Mit99] for fixed d. When d = log n, the problem is APX-hard [Tre00]. Krauthgamer and Lee [KL06] generalized the PTAS to hyperbolic space. Grigni et al. [GEP95] gave a PTAS for unweighted planar graphs which was later generalized by Arora et al. [Aro+98] to the weighted case. For improvements of the running time see Klein [Kle08]. The Steiner Tree problem (STP) is contained in Karp's list of NP-complete problems as well [Kar72]. The best approximation algorithm for general metric instances is due to Byrka et al. [Byr+10] and computes a solution with cost at most ln(4) + ǫ < 1.39 times that of an LP relaxation. Their algorithm improved upon previous results by, e.g., Robins and Zelikovsky [RZ05] and Hougardy and Prmel [HP99]. Also the STP is APX-hard [CC08] in general. For Euclidean distances and nodes in Rd with d constant there is a PTAS due to Arora [Aro98]. For d = log R/ log log R where R is the terminal set, the problem is APX-hard [Tre00]. For planar graphs, there is a PTAS for STP [BKK07], and even for the more general Steiner Forest problem for graphs with bounded genus [BHM11]. Note that STP remains NP-complete for planar graphs [GJ77]. It is worth mentioning that alternate definitions of the highway dimension exist.3 In particular, in a follow-up paper to [Abr+10], Abraham et al. [Abr+16] define a version of the highway dimension, which implies that the graphs also have bounded doubling dimension. A related model for transportation networks was given by Kosowski and Viennot [KV17] via the so-called skeleton dimension, which also implies bounded 3See [Fel+18, Section 9] and [Blu19] for detailed discussions on different definitions of the highway dimension. 3 doubling dimension. Hence for these definitions, Bartal et al. [BGK12] already provide a PTAS for TSP. The highway dimension definition used here (cf. Definition 1) on the other hand allows for metrics of large doubling dimension as noted by Abraham et al. [Abr+10]: a star has highway dimension 1 (by using the center vertex to hit all paths), but its doubling dimension is unbounded. While it may be reasonable to assume that road networks (which are the main concern in the works of Abraham et al. [Abr+10; Abr+11; Abr+16]) have low doubling dimension, there are metrics modelling transportation networks for which it can be argued that the doubling dimension is large, while the highway dimension should be small. These settings are better captured by Definition 1. For instance, the so-called hub-and-spoke networks that can typically be seen in air traffic networks are star-like networks and are unlikely to have small doubling dimension while still having very small highway dimension close to 1. Thus in these examples it is reasonable to assume that the doubling dimension is a lot larger than the highway dimension. Feldmann et al. [Fel+18] showed that graphs with low highway dimension can be embedded into graphs with low treewidth. This embedding gives rise to a QPTAS for both TSP and STP but also other prob- lems. However, the result in [Fel+18] is only valid for a less general definition of the highway dimension from [Abr+11], i.e., there are graphs which have constant highway dimension according to Definition 1 but for which the algorithm of [Fel+18] cannot be applied. For the less general definition from [Abr+11], Becker et al. [BKS18] give a PTAS for Bounded-Capacity Vehicle Routing in graphs of bounded highway dimension. Also the k-Center problem has been studied on graphs of bounded highway dimension, both for the less general definition [BKS18] and the more general one used here [Fel18; FM18]. 2 Structure of graphs with highway dimension 1 In this section, we analyse the structure of graphs with highway dimension 1. To this end, let us fix a graph G with highway dimension 1 and a shortest path cover spc(r) for each scale r ∈ R+. As a preprocessing, we remove edges that are longer than the shortest path between their endpoints, so that the triangle inequality holds. We begin by analysing the structure of the graph G≤2r, which is spanned by all edges of the input graph G of length at most 2r. If G has highway dimension 1 it exhibits the following key property. Lemma 6 Let G be a metric graph with highway dimension 1, r ∈ R+ a scale, and spc(r) a shortest path cover for scale r. Then, every connected component of G≤2r contains at most one hub. Proof. For the sake of contradiction, let r ∈ R+ and let x, y ∈ spc(r) be a closest pair of distinct hubs in some component of G≤2r. Let further P be a shortest path in G≤2r between x and y using only edges of length at most 2r. (Note that P need not be a shortest path between x and y in G.) In particular, there is no other hub from spc(r) \ {x, y} along P . This implies that every edge of P that is not incident to either x or y must be of length at most r, since otherwise the edge would be a shortest path of length (r, 2r] between its endpoints (using that G is metric) contradicting the fact that spc(r) is a shortest path cover for scale r. Since the highway dimension of G is 1, any ball Bw(2r) around a vertex w ∈ V (P ) contains at most one of the hubs x, y ∈ spc(r). Let x′, y′ ∈ P be the vertices indicent to x and y along P , respectively. Since the length of the edge {x, x′} is at most 2r, the ball Bx′(2r) must contain x and, by the observation above, it cannot contain y (in particular {x, y} is not an edge). Symmetrically, the ball By′(2r) contains y but not x. Consequently, x′ 6= y′ and neither of these two vertices can be a hub of scale r, i.e., the path P contains at least two vertices different from x and y. Let Vx = {w ∈ V : dist(x, w) < dist(y, w)} contain all vertices closer to x than to y, where dist(·, ·) refers to the distance in the original graph G. As all edge weights are strictly positive, we have that dist(x, y) > 0 and thus y /∈ Vx. Since P starts with vertex x ∈ Vx and ends with vertex y /∈ Vx we deduce that there is an edge {u, v} of P such that u ∈ Vx and v /∈ Vx. In particular, dist(x, u) < dist(y, u) and dist(y, v) ≤ dist(x, v). We must have {u, v} 6= {y′, y}, since otherwise dist(x, y′) < dist(y, y′) ≤ 2r and hence By′(2r) would contain x. Similarly, we have {u, v} 6= {x, x′}, since otherwise Bx′(2r) would contain y. Note that, by definition, u 6= y and v 6= x, and hence x, y /∈ {u, v}. Consequently, since every edge of P not incident to either x or y must have length at most r, we conclude that {u, v} has length at most r. 4 Finally, consider the scale r′ ∈ R+, defined such that 2r′ = dist(x, u) + dist(u, v). Let Q and Q′ denote shortest paths between x, u and v, y in G, respectively. Then the ball Bv(2r′) around v contains Q by definition of r′. From dist(y, v) ≤ dist(x, v) ≤ dist(x, u) + dist(u, v) = 2r′ it follows that Bv(2r′) contains Q′ as well. Also, dist(y, v) ≤ dist(x, v) means that Bv(2r) cannot contain x, and hence 2r′ = dist(x, u) + dist(u, v) ≥ dist(x, v) > 2r, which implies r′ > r. W.l.o.g., assume that dist(x, u) ≤ dist(v, y) (otherwise consider scale 2r′ = dist(y, v) + dist(u, v) and the ball Bu(2r′)). Our earlier observation that dist(u, v) ≤ r with r < r′ then yields dist(v, y) ≥ dist(x, u) = 2r′ − dist(u, v) > r′. In other words, the lengths of both paths Q and Q′ are in (r′, 2r′], and so they both need to contain a hub of spc(r′). However, by definition of u, v, the paths Q and Q′ are vertex disjoint, which means that the ball Bv(2r′), which contains Q and Q′, also contains at least two hubs from spc(r′). This is a contradiction with G having highway dimension 1. ⊓⊔ Given a graph G, we now consider graphs G≤2r for exponentially growing scales. In particular, for any integer i ≥ 0 we define the scale ri = 2i and call a connected component of G≤2ri a level-i component. Note that the level-i components partition the graph G, and that the level-i components are a refinement of the level-(i + 1) components, i.e., every level-i component is contained in some level-(i + 1) component. W.l.o.g., we scale the edge weights of the graph such that mine∈E w(e) = 3, so that there are no edges on level 0, and every level-0 component is a singleton. Let α = maxu6=v dist(u,v) be the aspect ratio of G. In our applications we may assume that G is connected, so that there is exactly one level-(1 + ⌈log2(α)⌉) component containing all of G. minu6=v dist(u,v) = maxu6=v dist(u,v) 3 Since every edge is a shortest path between its endpoints, every edge e = {u, v} that connects a vertex u of a level-i component C with a vertex v outside C is hit by a hub of spc(rj), where j is the level for which w(e) ∈ (rj, 2rj]. Moreover, since v lies outside C, we have w(e) > 2ri and, thus, j ≥ i + 1. The following definition captures the set of the hubs through which edges can possibly leave C. Definition 7 Let C be a level-i component of G. We define the set of interface points of C as IC := Sj≥i{u ∈ spc(rj ) : distC(u) ≤ 2rj}, where distC (u) denotes the minimum distance from u to a vertex in C (if u ∈ C, distC (u) = 0). Note that, for technical reasons, we explicitly add every hub at level i of a component to its set of interface points as well, even if such a hub does not connect the component with any vertex outside at distance more than 2ri. Lemma 8 If G has highway dimension 1, then each interface IC of a level-i component C contains at most one hub for each level j ≥ i. Proof. Assume that there are two hubs u, v ∈ spc(rj ) in IC , and recall that we preprocessed the graph so that the triangle inequality holds. Then u and v must be contained in the same level-j component C ′, since u and v are connected to C with edges of length at most 2rj (or are contained in C) and C ⊆ C ′. This ⊓⊔ contradicts Lemma 6. Using level-i components and their interface points we can prove that the treewidth of a graph with highway dimension 1 is bounded in terms of the aspect ratio. Lemma 9 If a graph G has highway dimension 1 and aspect ratio α, its treewidth is at most 1 + ⌈log2(α)⌉. Proof. The tree decomposition of G is given by the refinement property of level-i components. That is, let D be a tree that contains a node vC for every level-i component C for all levels 0 ≤ i ≤ 1 + ⌈log2(α)⌉. For every node vC we add an edge in D to node vC ′ , if C is a level-i component, C ′ is a level-(i + 1) component, and C ⊆ C ′. The bag XC for node vC contains the interface points IC . For a level-0 component C the bag XC additionally contains the single vertex u contained in C. Clearly, the tree decomposition has Property (a) of Definition 5, since the level-0 components partition the vertices of G and every vertex of G is contained in a bag XC corresponding to a level-0 component C. Also, Property (b) is given by the bags XC for level-0 components C, since for every edge e of G one of its 5 endpoints u is a hub of spc(ri) where i is such that w(e) ∈ (ri, 2ri], and the other endpoint w is contained in a level-0 component C, for which XC contains u and w. For Property (c), first consider a vertex u of G, which is not contained in any set of interface points for any level-i component and any 0 ≤ i ≤ log2(α). Such a vertex only appears in the bag XC for the level-0 component C containing u, and thus the node vC for which the bag contains u trivially induces a connected subtree of D. Any other vertex u of G is an interface point. Let i be the highest level for which u ∈ IC for some level-i component C. We claim that u ∈ C, which implies that C is the unique level-i component containing u in its interface. To show our claim, assume u /∈ C. Then, by definition, IC contains u because u ∈ spc(rj) for some j ≥ i and u has some neighbour at distance at most 2rj in C. Since we preprocessed the graph such that every edge is a shortest path between its endpoints, this means that there must be an edge e = {u, v} with w(e) ∈ (rj , 2rj] and v ∈ C. Since u /∈ C, we have i < j. Let C ′ be the unique level-j component with C ⊆ C ′. Then, by definition, u ∈ IC ′, which contradicts the maximality of i. This proves our claim and shows that the highest level component C with u ∈ XC is uniquely defined. Moreover, we obtain u ∈ spc(ri). Now consider a level-i′ component C ′ with i′ < i, such that u ∈ XC ′, and let C ′′ be the unique level- (i′ + 1) component containing C ′. We claim that u ∈ XC ′′. If u ∈ C ′ ⊆ C ′′, then u ∈ XC ′′, since u ∈ spc(ri), distC ′′ (u) = 0 ≤ 2ri and i′ +1 ≤ i. If u /∈ C ′, then u ∈ XC ′ implies u ∈ IC ′ , which means that there must be a vertex w ∈ C ′ with dist(u, w) ≤ 2ri. But then w ∈ C ′′ and thus distC ′′(u) ≤ 2ri. Together with u ∈ spc(ri), this implies u ∈ XC ′′ , as claimed. Since vC ′ is a child of vC ′′ in the tree D, it follows inductively that the nodes of D with bags containing u induce a subtree of D with root vC , which establishes Property (c). By Lemma 8 each set of interface points contains at most one hub of each level. Since all edges have length at least 3, there are no hubs in spc(r0) on level 0. This means that each bag of the tree decomposition contains at most 1 + ⌈log2(α)⌉ interface points. The bags for level-0 components contain one additional vertex. Thus the treewidth of G is at most 1 + ⌈log2(α)⌉, as claimed. ⊓⊔ An additional property that we will exploit for our algorithms is the following. A (µ, δ)-net N ⊆ V is a subset of vertices such that (a) the distance between any two distinct net points u, w ∈ N is more than µ, and (b) for every vertex v ∈ V there is some net point w ∈ N at distance at most δ. For graphs of highway dimension 1 however, we can obtain nets with additional favourable properties, as the next lemma shows. Lemma 10 For any graph G of highway dimension 1 and any r > 0, there is an (r, 3r)-net such that every connected component of G≤r contains exactly one net point. Moreover this net can be computed in polynomial time. Proof. We first derive an upper bound of 3r for the diameter of any connected component of G≤r. Lemma 6 implies that a connected component C contains at most one hub x of spc(r/2). By definition, any shortest path in C of length in (r/2, r] must pass through x. We also know that every edge of C has length at most r. Consequently, every edge in C not incident to x must have length at most r/2, since each edge constitutes a shortest path between its endpoints. This implies that any shortest path in C that is not hit by x must have length at most r/2: if C contains a shortest path P with length more than r/2 not containing x we could repeatedly remove edges of length at most r/2 from P until we obtain a shortest path of length in (r/2, r] not hit by x, a contradiction. Now consider a shortest path P in G of length more than r/2 from some vertex v ∈ C to x (note that this path may not be entirely contained in C). Let {u, w} be the unique edge of P such that dist(v, u) ≤ r/2 and dist(v, w) > r/2. If the length of the edge {u, w} is at most r/2 then dist(v, w) ≤ r, and thus w = x, since the part of the path from v to w is a shortest path of length in (r/2, r] and thus needs to pass through x. Otherwise the length of the edge {u, w} is in the interval (r/2, r], which again implies w = x, since the edge must contain x. In either case, dist(v, x) ≤ 3r/2. This implies that every vertex in C is at distance at most 3r/2 from x, and thus the diameter of C is at most 3r. To compute the (r, 3r)-net, we greedily pick an arbitrary vertex of each connected component of G≤r. As the distances between components of G≤r is greater than r, and every vertex lies in some component containing a net point, we get the desired distance bounds. Clearly this net can be computed in polynomial ⊓⊔ time. 6 3 Approximation schemes In general the aspect ratio of a graph may be exponential in the input size. A key ingredient of our algorithms is to reduce the aspect ratio α of the input graph G = (V, E) to a polynomial. For STP and TSP, standard techniques can be used to reduce the aspect ratio to O(n/ε) when aiming for a (1 + ε)-approximation. This was for instance also used in [Fel+18] for low highway dimension graphs, but here we need to take special care not to destroy the structural properties given by Lemma 9 in this process. In particular, we need to reduce the aspect ratio and maintain the fact that the treewidth is bounded. Therefore, we reduce the aspect ratio of our graphs by the following preprocessing. Both metric TSP and STP admit constant factor approximations in polynomial time using well-known algorithms [Byr+10; Chr76]. We first compute a solution of cost c using a β-approximation algorithm for the problem at hand (TSP or STP). For TSP, the diameter of the graph G clearly is at most c/2. For STP we remove every vertex of V that is at distance more than c from any terminal, since such a vertex cannot be part of the optimum solution. After having removed all such vertices in this way, we obtain a graph G of diameter at most 3c. Thus, in the following, we may assume that our graph G has diameter at most 3c. We then set r = εc 3n , εc n )-net N ⊆ V . As a consequence the metric induced by N (with εc/(3n) = O(n/ε), since the minimum distance between any two distances of G) has aspect ratio at most net points of N is at least εc 3n and the maximum distance is at most 3c. We will exploit this property in the following. 3n in Lemma 10 to obtain a ( εc 3c By Lemma 10, each connected component of G≤ εc 3n contains exactly one net point of N . Let η : V 7→ N 3n . We define a new map each vertex of G to the unique net point in the same connected component of G≤ εc graph G′ with vertex set N ⊆ V and edge set {{η(u), η(v)} : {u, v} ∈ E ∧ η(u) 6= η(v)}. The length of each edge {w, w′} of G′ is the shortest path distance between w and w′ in G. This new graph G′ may not have bounded highway dimension, but we claim that it has treewidth O(log(n/ε)). Lemma 11 If G has highway dimension 1, the graph G′ with vertex set N has treewidth O(log(n/ε)). Moreover, a tree decomposition for G′ of width O(log(n/ε)) can be computed in polynomial time. Proof. We construct a tree decomposition D′ of G′ as follows. Following Lemma 9 we can compute a tree decomposition D of width at most 1+⌈log2(α)⌉, where α is the aspect ratio of G: for this we need to compute a locally 1-sparse shortest path cover spc(ri) for each level i, which can be done in polynomial time via an XP algorithm [Fel+18] if the highway dimension is 1. We then find the level-i components and their interface points, from which the tree decomposition D and its bags can be constructed. Since there are O(log α) levels and α is at most exponential in the input size (which includes the encoding length of the edge weights), we can compute D in polynomial time. We construct D′ from D by replacing every bag X of D by a new bag X ′ = {η(v) : v ∈ X} containing the net points for the vertices in X. It is not hard to see that Properties (a) and (b) of Definition 5 are fulfilled by D′, since they are true for D. For Property (c), note that for any edge {u, v} of G, the set of all bags of D that contain u or v form a connected subtree of D. This is because the bags containing u form a connected subtree (Property (c)), the same is true for v, and both these subtrees share at least one node labelled by a bag containing the edge {u, v} (Property (b)). Consequently, the set of all bags containing vertices of any connected subgraph of G form a connected subtree. In particular, for any connected component A of G≤ εc 3n , the set of bags of D containing at least one vertex of A form a connected subtree. This implies Property (c) for D′. Thus, D′ is indeed a tree decomposition of G′ according to Definition 5. Note that D′ can be computed in polynomial time. To bound the width of D′, recall that a bag X of the tree decomposition D of G contains the interface points IC of a level-i component C, in addition to one more vertex of C on the lowest level i = 0. Each interface point is a hub from spc(rj ) at some level j ≥ i and is at distance at most 2rj from C. In particular, if 2ri ≤ εc 3n lie in 3n as C. These hubs are therefore all mapped to the same net point the same connected component A of G≤ εc w in A by η. In addition to w, the bag X ′ = {η(v) : v ∈ X} resulting from X and η contains at most one vertex for every level j such that 2rj > εc 3n ) − 1. As 3n . As rj = 2j, this condition is equivalent to j > log2( εc 3n , and all hubs of IC ∩ spc(rj ) for which 2rj ≤ εc 3n then C is a component of G≤2ri ⊆ G≤ εc 7 there are 1 + ⌈log2(α)⌉ levels in total, there are O(log( αn εc )) hubs in X ′. This bound is obviously also valid in case 2ri > εc 3n . We preprocessed the graph G so that its diameter is at most 3c and its minimum distance is 3, which implies an aspect ratio α of at most c for G. This means that every bag X ′ contains O(log(n/ε)) vertices, and thus the claimed treewidth bound for G′ follows. ⊓⊔ We are now ready to prove our main result. Proof (of Theorem 2). To solve TSP or STP on G we first use the above reduction to obtain G′ and its tree decomposition D′, and then compute an optimum solution for G′. For TSP, G′ is already a valid input instance, but for STP we need to define a terminal set, which simply is R′ = {η(v) v ∈ R} if R is the terminal set of G. Bodlaender et al. [Bod+13] proved that for both TSP and STP there are deterministic algorithms to solve these problems exactly in time 2O(t)n, given a tree decomposition of the input graph of width t. By Lemma 11 we can thus compute the optimum to G′ in time 2O(log(n/ε)) · n = (n/ε)O(1). Afterwards, we convert the solution for G′ back to a solution for G, as follows. For TSP we may greedily add vertices of V to the tour on N by connecting every vertex v ∈ V to the net point η(v). As the vertices N of G′ form a ( εc n )-net of V , this incurs an additional cost of at most 2 εc n per vertex, which sums up to at most 2εc. Let Opt and Opt′ denote the costs of the optimum tours in G and G′, respectively. We know that c ≤ β · Opt, since we used a β-approximation algorithm to compute c. Furthermore, the optimum tour in G can be converted to a tour in G′ of cost at most Opt by short-cutting, due to the triangle inequality. Thus Opt′ ≤ Opt, which means that the cost of the computed tour in G is at most Opt′ + 2εc ≤ (1 + 2βε)Opt. 3n , εc Similarly, for STP we may greedily connect a terminal v of G to the terminal η(v) of G′ in the computed Steiner tree in G′. This adds an additional cost of at most εc n , which sums up to at most εc. Let now Opt and Opt′ be the costs of the optimum Steiner trees in G and G′, respectively. We may convert a Steiner tree T in G into a tree T ′ in G′ by using edge {η(u), η(v)} for each edge {u, v} of T . Note that the resulting tree T ′ contains all terminals of G′, since R′ = {η(v) v ∈ R}. As the vertices N of G′ form a ( εc n )-net of V , the cost of T ′ is at most Opt + 2εc if the cost of T is Opt (by the same argument as used for the proof of Lemma 11). As before, we know that c ≤ β · Opt, and thus the cost of the computed Steiner tree in G is at most Opt′ + εc ≤ Opt + 3εc ≤ (1 + 3βε)Opt. 3n , εc Hence we obtain FPTASs for both TSP and STP, which compute (1+ε)-approximations within a runtime ⊓⊔ that is polynomial in the input size and 1/ε. We prove next that STP is NP-hard on graphs of highway dimension 1, which means that the problem is weakly NP-hard for these inputs (cf. [Vaz01]). Whether TSP is NP-hard for such small highway dimension remains open, but we prove that it is for highway dimension 6. 4 Hardness of Steiner Tree for highway dimension 1 We present a reduction from the NP-hard satisfiability problem (SAT) [GJ02], in which a Boolean formula ϕ in conjunctive normal form is given, and a satisfying assignment of its variables needs to be found. Proof (of Theorem 3). For a given SAT formula ϕ with k variables and ℓ clauses we construct a graph Gϕ as follows (cf. Fig. 1). For each variable x we introduce a path Px = (tx, ux, fx) with two edges of length 1 each. The vertex ux is a terminal. Additionally we introduce a terminal v0, which we call the root, and add the edges {v0, tx} and {v0, fx} for every variable x. Every edge incident to v0 has length 11. For each clause Ci, where i ∈ {1, . . . , ℓ}, we introduce a terminal vi and add the edge {vi, tx} for each variable x such that Ci contains x as a positive literal, and we add the edge {vi, fx} for each x for which Ci contains x as a negative literal. Every edge incident to vi has length 11i+1. Note that the edges incident to the root v0 also have length 11i+1 for i = 0. Lemma 12 The constructed graph Gϕ has highway dimension 1. 8 11 11 11 11 11 11 v0 tz ty tx 1 1 1 uz fz 1 1 1 fy fx uy ux 11i+1 11i+1 11i+1 vi Figure 1: Illustration of the part of the construction involving vertices x, y, z and a clause Ci = (x ∨ ¯y ∨ ¯z). Terminals are marked as boxes. Proof. Fix a scale r > 0. If r ≤ 5 then the shortest path cover spc(r) only needs to hit shortest paths of length at most 2r ≤ 10. Since all edges incident to terminals vj with j ∈ {0, . . . , ℓ} have length at least 11, any such path contains only edges of paths Px. Thus it suffices to include all vertices ux in spc(r). A ball Bw(2r) of radius 2r ≤ 10 can also only contain some subset of vertices of a single path Px, or a single vertex vj. In the former case the ball contains at most the vertex ux ∈ spc(r), and in the latter none of spc(r). If r > 5, let i = ⌊log11(r/5)⌋ ≥ 0 and spc(r) = {vi}. Since there is only one hub, this shortest path cover is locally 1-sparse. Note that any edge incident to a vertex vj with j ≥ i + 1 has length at least 11i+2 ≥ 11r/5 > 2r. Also, all paths that do not use any vj with j ≥ i have length at most 2 + Pi−1 j=0(2 · 11j+1 + 2), since such a path can contain at most two edges incident to a vertex vj with j ≤ i − 1 and the paths Px of length 2 are connected only through edges incident to vertices vj . The length of such a path is thus shorter than 2 + 2 11i+1 11 − 1 + 2i ≤ 3 · 11i + 2 · 11i ≤ 5 · 11i ≤ r, where the first inequality holds since i + 1 ≤ 11i whenever i ≥ 0. Hence the only paths that need to be hit ⊓⊔ by hubs on scale r are those passing through vi, which is a hub of spc(r). To finish the reduction, we claim that there is a satisfying assignment for ϕ if and only if there is a Steiner tree T for Gϕ with cost at most 12k + Pℓ i=1 11i+1. If there is a satisfying assignment for ϕ, then the tree T contains the edges {ux, tx} and {v0, tx} for variables x that are set to true, and the edges {ux, fx} and {v0, fx} for variables x that are set to false. This connects every terminal ux with the root v0, and the cost of these edges is 12k. For every terminal vi where i ≥ 1 we can now add the edge {vi, sx} for sx ∈ {tx, fx} that corresponds to a literal of Ci that is true in the satisfying assignment. Since this Steiner vertex sx is connected to the root v0, we obtain a Steiner tree T . The latter edges add another Pℓ i=1 11i+1 to the solution cost, and thus the total cost is as claimed. Conversely, consider a minimum cost Steiner tree T in Gϕ. Note that for any terminal ux the tree must contain an incident edge of cost 1, while for any terminal vi with i ≥ 1 the tree must contain an incident edge of cost 11i+1. This adds up to a cost of k + Pℓ i=1 11i+1. Assume that there is some variable x such that T contains neither {v0, tx} nor {v0, fx}. This means that in T the terminal ux is connected to the root v0 through an edge {vi, sx} for sx ∈ {tx, fx} and some i ≥ 1. The edge v0sx forms a fundamental cycle with the tree T , which however has a shorter length of 11 compared to the edge {vi, sx}, which has length 11i+1. Thus removing {v0, sx} and adding {vi, sx} instead, would yield a cheaper Steiner tree. As this would contradict that T has minimum cost, T contains at least one of the edges {v0, tx} and {v0, fx} for every variable x. This adds another 11k to the cost, so that T costs at least 12k + Pℓ i=1 11i+1. If we assume that 12k + Pℓ i=1 11i+1 is also an upper bound on the cost of T , by the above observations the tree T contains exactly one edge incident to every terminal ux and vi for i ≥ 1, and exactly k edges 9 incident to v0. Furthermore, for every variable x the latter edges contain exactly one of {v0, tx} and {v0, fx}. Thus T encodes a satisfying assignment for ϕ, as follows. For every edge v0tx we may set x to true, and for every edge {v0, fx} we may set x to false. For every clause Ci the corresponding terminal vi connects through one of the Steiner vertices sx ∈ {tx, fx} of a corresponding literal contained in Ci. The only incident vertices to sx in Gϕ are some terminals vj, the terminal ux, and the root v0. As each vj and also ux only has one incident edge contained in the tree T , the tree must contain the edge {v0, sx} so that the root can be reached from sx in T . Hence sx corresponds to a literal that is true in Ci. Using Lemma 12, which bounds ⊓⊔ the highway dimension of Gϕ, we obtain Theorem 3. 5 Hardness of Travelling Salesperson for highway dimension 6 We now show hardness of TSP for graphs of bounded highway dimension. We first introduce a simple lemma that will allow us to easily bound the highway dimension of our construction by adding edges incrementally. In the following we denote the highway dimension of a graph G by hd(G). Definition 13 A cost c⋆ ∈ R is safe w.r.t. a (multi-)set of costs C ⊆ R if c⋆ ≥ 2 Pc∈C c. Lemma 14 Let G = (V, E) be a graph, E′ ⊆ (cid:0)V w.r.t. the edge costs of G, then hd(G′) ≤ max{hd(G), E′}. 2(cid:1), and G′ = (V, E ∪ E′). If the edges in E′ have safe costs Proof. Let c⋆ be the smallest cost among the edges of E′ and consider a fixed scale r ∈ R+. If r < c⋆/2, then no path of length l ∈ (r, 2r] in G′ contains any of the edges in E′. By the definition of the highway dimension of G, there is a locally hd(G)-sparse shortest path cover spc(r) of G′ for this scale. Now if r ≥ c⋆/2, then every path of length l ∈ (r, 2r] in G′ must contain an edge of E′, since the costs of all edges in E sum up to at most r. Therefore, we can find a shortest path cover spc(r) of G′ simply by taking a minimum vertex cover of E′, which has size at most E′. ⊓⊔ We are now ready to prove hardness. Proof (of Theorem 4.). We reduce from (≤ 3, 3)-Sat [GJ02]. To that end, let a (≤ 3, 3)-Sat formula be given, with variables x1, . . . xn and clauses C1, . . . , Cm, where each literal appears at most twice (and each variable at most three times). We construct a graph G with edge costs taken from among the values a ≪ b ≪ c1 ≪ · · · ≪ cn−1 ≪ d ≪ e ≪ f1 ≪ · · · ≪ fm, where each cost value can be chosen arbitrarily such that it is safe with respect to the costs of all cheaper edges. For example, there will be 2n edges of cost a, hence we choose b ≥ 4an. Let T ⋆ be (any) TSP tour in G of minimum cost T ⋆. We consider T ⋆ to be oriented arbitrarily in one of its two possible orientations. For every variable xi, we introduce a gadget with four vertices vi1, vi2, vi3, vi4 and the edges {vi1, vi3} and {vi2, vi4}, both of cost a. We further add edges {vi1, vi2}, {vi2, vi3}, {vi3, vi4}, {vi4, vi1} of cost b each (cf. Fig. 2). We will enforce that T ⋆ uses both edges of cost a in every variable gadget, and we will interpret the variable as 'true', if the orientation of these edges along the tour is (vi1, vi3) and (vi4, vi2), or (vi3, vi1) and (vi2, vi4), and 'false' otherwise. Let Gb be the graph we have constructed so far. Each of the n components of Gb has highway dimension 2: For scales r < a, we can set spc(r) = Si{vi1, vi2}, and for scales r ≥ a, we can set spc(r) = Si{vi1, vi3}. Hence, hd(Gb) = 2. We connect the variable gadgets by adding edges {vi1, v(i+1)1} of cost ci for all i ∈ {1, . . . , n − 1} in this order. By definition, each new edge has a safe cost (w.r.t. all previous edges), and hence, by Lemma 14, the resulting graph Gc has highway dimension hd(G2) = 2. We will enforce that T ⋆ uses each of these edges exactly twice. For each clause Cj, we introduce a clause gadget with six vertices wj1, w′ j3 (cf. Fig. 3). We first add three edges {w′ j3, wj1} of cost d each. Since these edges are disconnected, the resulting graph Gd still has hd(Gd) = 2. Now, we add three edges {wj1, w′ j3} of cost e each. In the resulting graph Ge, clauses are still disconnected. Since we added three edges with safe costs for each clause, by Lemma 14, we have hd(Ge) ≤ 3. j1}, {wj2, w′ j1, wj2, w′ j2, wj3, w′ j1, wj2}, {w′ j2, wj3}, {w′ j2}, {wj3, w′ 10 v14 v13 v24 v23 v34 v33 vi4 vi3 vn4 vn3 b aa b b v11 b v12 c1 b aa b b v21 b v22 c2 b aa b b v32 b v31 b aa b b vi2 b vi1 b aa b b vn2 b vn1 Figure 2: Vertex gadgets. Finally, we connect each clause gadget for clause Cj to the three variable gadgets corresponding to the variables appearing in Cj (cf. Fig. 3). To this end, we add six edges per clause, step by step in the order of increasing clause indices. Let Cj = λj1 ∨λj2 ∨λj3 and consider k ∈ {1, 2, 3}. Assume λjk = xi, i.e., xi appears as a positive literal in Cj. Let δ = 0 if Cj is the first clause containing the literal xi, i.e., xi /∈ Cj′ for j′ < j, and δ = 2 otherwise. We add the edges {wjk, vi(2+δ)}, {w′ jk, vi(1+δ)} of cost fj. Now assume λjk = ¯xi and let again δ = 0 if ¯xi /∈ Cj′ for j′ < j, and δ = 2 otherwise. We add the edges {wjk, vi(3−δ)}, {w′ jk, vi(2+δ)} of cost fj. Since we add six edges of safe costs in each step, by Lemma 14, the final graph G = Gf has hd(G) ≤ 6. z b b aa b b fj w′ j2 e wj3 d d Cj = ¯x∨y ∨ ¯z e fj wj2 w′ j1 e fj d w′ j3 wj1 fj b aa b b b x fj fj b b aa b b y Figure 3: Clause gadget. Now let W = 2 Pm j=1 fj + 2me + 3md + 2 Pn−1 i=1 ci + (2n − m)b + 2na. We claim that T ⋆ ≤ W if and only if the (≤ 3, 3)-Sat formula is satisfiable. For the first part of the claim, assume the (≤ 3, 3)-Sat formula is satisfiable, and, for all j ∈ {1, . . . , m}, let yj be a unique variable that satisfies clause Cj in the corresponding assignment. We describe a tour of cost W by constructing a Eulerian graph consisting of edges of G (sometimes twice) that connect all vertices with a total cost of W . We start by including the cycle of cost 3e + 3d within each clause gadget, and each edge between different variable gadgets twice, for a total cost of 3me + 3md + 2 Pn−1 ci. For every variable xi that is set to true, we include the cycle vi1, vi3, vi4, vi2, vi1 of cost 2b + 2a. For every variable xi that is set to false, we include the cycle vi1, vi3, vi2, vi4, vi1 of cost 2b + 2a. The resulting graph T ′ is Eulerian, since we added only cycles, but not yet connected. Its cost is 3me + 3md + 2 Pn−1 i=1 ci + 2nb + 2na. i 11 Now take a clause Cj that is satisfied by variable xi = yj. We add the edges {wjk, vir}, {w′ jk, vi(r+3 mod 4)} that connect the corresponding clause and variable gadgets. Observe that the edge {wjk, w′ jk} is in T ′ and so is the edge {vir, vi(r+3 mod 4)}, because xi satisfies Cj. We can thus remove these two edges and obtain a Eulerian graph. This increases the cost of the graph by 2fj − e − b. The final graph T is connected, Eulerian, and has cost W as claimed. For the second part of the claim, consider any TSP tour T with T ≤ W . Observe that 3fm > W , 3fm−1 > W − 2fm, and so on. Since, for all j ∈ {1, . . . , m}, the edges of cost fj form a cut of G, we can conclude that T uses exactly 2 edges of cost fj (or one of them twice). Similarly, (2m + 1)e > W − Pn−1 j=1 fj, but T needs to use at least two edges of cost e (or one of them twice) to connect all vertices of a clause gadget for Cj to the two edges of cost fj that are part of the tour. We can again conclude that T uses exactly two edges of cost e in each clause gadget. And again (3m + 1)d > W − Pn−1 j=1 fj − 2me, but T needs to use at least three times an edge of cost d to connect all vertices of a clause gadget, provided that it uses only two edges of cost e. We conclude that T uses exactly three edges of cost d in each clause gadget. Finally, observe that the only way to connect all vertices of a clause gadget with two edges of cost e and three edges of cost d needs that the two edges of cost fj are distinct and connect to the same vertex gadget. We will rely on this observation in the following, and on the fact that costs are chosen to be safe with respect to all smaller costs (in particular, e is safe with respect to a, b, c, d, etc.). The first implication is that T needs to use every edge between vertex gadgets twice, since the vertex gadgets are not connected via clause gadgets. Our analysis so far implies that edges within variable gadgets that are used in T incur a cost of at most W ′ = (2n − m)b + 2na. Let k ∈ {0, . . . 4} be the number of clause gadgets in T connected to the variable gadget of xi. Clearly, T needs to use at least 4 − k edges within the variable gadget. The cost within a variable gadget depending on k is at least 2b + 2a (if k = 0), b + 2a (if k = 1), 2a (if k = 2), a (if k = 1), or 0 (if k = 4). Since each variable appears in at most four clauses and each clause has at most 3 literals, we have m ≤ 4n/3 < 2n. To obtain a cost of at most W ′, we must thus have k ≤ 2 in each variable gadget, since b ≫ a. Furthermore, if there are two clause gadgets connected to a variable gadget, they must connect to disjoint vertices of the clause to allow for a cost of at most 2a in the variable gadget. This means that the corresponding literals must either both be positive or both be negative. But if there is an assignment of clauses to variables such that at most two clauses are assigned to each variable and the corresponding literal of the assigned clauses must agree, this immediately yields a satisfying assignment of the (≤ 3, 3)-Sat-formula. ⊓⊔ 6 Conclusions We showed that, somewhat surprisingly, graphs of highway dimension 1 exhibit a rich combinatorial structure. On one hand, it was already known [Fel+18] that these graphs are not minor-closed and thus their treewidth is unbounded. Here we additionally showed that STP is weakly NP-hard on such graphs, further confirming that these graphs have non-trivial properties. On the other hand, we proved in Lemma 9 that the treewidth of a graph of highway dimension 1 is logarithmically bounded in the aspect ratio α. This in turn can be exploited to obtain a very efficient FPTAS for both STP and TSP. At this point one may wonder whether it is possible to generalize Lemma 9 to larger values of the highway dimension. In particular, in [Fel+18] it was suggested that the treewidth of a graph of highway dimension h might be bounded by, say, O(h polylog(α)). However such a bound is highly unlikely in general, since it would have the following consequence for the k-Center problem, for which k vertices (centers) need to be selected in a graph such that the maximum distance of any vertex to its closest center is minimized. It was shown in [Fel18] that it is NP-hard to compute a (2 − ε)-approximation for k-Center on graphs of highway dimension O(log2 n), for any ε > 0. Given such a graph, the same preprocessing of Section 3 could be used to derive an analogue of Lemma 11, i.e., a graph G′ of treewidth O(polylog(n/ε)) could be computed for the net N . Moreover, a 2-approximation for k-Center can be computed in polynomial time on any graph [HS86], and if the input has treewidth t a (1 + ε)-approximation can be computed in (t/ε)O(t)nO(1) time [KLP17]. Using the same arguments to prove Theorem 2 for STP and TSP, it would now be possible to compute a (1 + ε)-approximation for k-Center in quasi-polynomial time (cf. [FM18]). That is, we would 12 obtain a QPTAS for graphs of highway dimension O(log2 n), which is highly unlikely given that computing a (2 − ε)-approximation is NP-hard on such graphs. The above argument rules out any bound of (h log α)O(1) for graphs of highway dimension h and aspect ratio α, unless NP-hard problems admit quasi-polynomial time algorithms. In fact, we conjecture that the k- Center problem is NP-hard to approximate within a factor of 2−ε for graphs of constant highway dimension (for some constant larger than 1). If this is true, then the above argument even rules out a treewidth bound of f (h) polylog(α) for any function f . Thus, in order to answer the open problem of [Fel+18] and obtain a PTAS for graphs of constant highway dimension, a different approach seems to be needed. References [Abr+16] [Aro+92] [Abr+11] [Abr+10] I. Abraham, A. Fiat, A. V. Goldberg and R. F. Werneck. "Highway dimension, shortest paths, and provably efficient algorithms". In: Proc. 21st Annual ACM-SIAM Sympos. Discrete Algorithms (SODA). 2010, pp. 782 -- 793. I. Abraham, D. Delling, A. Fiat, A. V. Goldberg and R. F. Werneck. "VC-dimension and shortest path algorithms". In: Proc. 28th Internat. Colloquium on Automata, Languages, and Program- ming (ICALP). 2011, pp. 690 -- 699. I. Abraham, D. Delling, A. Fiat, A. V. Goldberg and R. F. Werneck. "Highway dimension and provably efficient shortest path algorithms". J. ACM 63.5 (2016). S. Arora, C. Lund, R. Motwani, M. Sudan and M. Szegedy. "Proof verification and hardness of approximation problems". In: Proc. 33rd Annual IEEE Sympos. Foundations Comput. Sci. (FOCS). 1992, pp. 14 -- 23. S. Arora, M. Grigni, D. R. Karger, P. N. Klein and A. Woloszyn. "A polynomial-time approx- imation scheme for weighted planar graph TSP". In: Proc. 9th Annual ACM-SIAM Sympos. Discrete Algorithms (SODA). 1998, pp. 33 -- 41. S. Arora. "Polynomial time approximation schemes for Euclidean traveling salesman and other geometric problems". J. ACM 45.5 (1998), pp. 753 -- 782. S. Arora, P. Raghavan and S. Rao. "Approximation schemes for Euclidean k-medians and related problems". In: Proc. 30th Annual ACM Sympos. Theory Comput. (STOC). 1998, pp. 106 -- 113. [Bas+07] H. Bast, S. Funke, D. Matijevic, P. Sanders and D. Schultes. "In transit to constant time shortest- path queries in road networks". In: Proc. 9th Workshop Algorithm Engineering and Experiments (ALENEX). 2007. [Aro+98] [Aro98] [ARR98] [BFM09] H. Bast, S. Funke and D. Matijevic. "Ultrafast shortest-path queries via transit nodes". The Shortest Path Problem: Ninth DIMACS Implementation Challenge 74 (2009), pp. 175 -- 192. [BGK12] Y. Bartal, L.-A. Gottlieb and R. Krauthgamer. "The traveling salesman problem: Low-dimensionality implies a polynomial time approximation scheme". In: Proc. 44th Annual ACM Sympos. Theory Comput. (STOC). 2012, pp. 663 -- 672. [BHM11] M. Bateni, M. T. Hajiaghayi and D. Marx. "Approximation schemes for Steiner forest on planar graphs and graphs of bounded treewidth". J. ACM 58 (5 2011), 21:1 -- 21:37. [BKS18] [BKK07] G. Borradaile, C. Kenyon-Mathieu and P. Klein. "A polynomial-time approximation scheme for Steiner tree in planar graphs". In: Proc. 18th Annual ACM-SIAM Sympos. Discrete Algorithms (SODA). 2007, pp. 1285 -- 1294. A. Becker, P. N. Klein and D. Saulpic. "Polynomial-time approximation schemes for k-center, k-median, and capacitated vehicle routing in bounded highway dimension". In: Proc. 26th. 2018, 8:1 -- 8:15. J. Blum. Hierarchy of transportation network parameters and hardness results. 2019. arXiv: 1905.11166 [cs.DM]. [Blu19] [BNP09] R. Borndrfer, M. Neumann and M. E. Pfetsch. "The line connectivity problem". In: Operations Research Proceedings. 2009, pp. 557 -- 562. 13 [BS89] [BP89] [Bod+13] H. L. Bodlaender, M. Cygan, S. Kratsch and J. Nederlof. "Deterministic single exponential time algorithms for connectivity problems parameterized by treewidth". In: Proc. 40th Internat. Colloquium on Automata, Languages, and Programming (ICALP). 2013, pp. 196 -- 207. M. Bern and P. Plassmann. "The Steiner problem with edge lengths 1 and 2". Inform. Process. Lett. 32 (1989), pp. 171 -- 176. R. Bland and D. Shallcross. "Large traveling salesman problems arising from experiments in X- ray crystallography: a preliminary report on computation". Oper. Res. Lett. 8 (3 1989), pp. 125 -- 128. J. Byrka, F. Grandoni, T. Rothvo and L. Sanit. "An improved LP-based approximation for Steiner tree". In: Proc. 42nd Annual ACM Sympos. Theory Comput. (STOC). 2010, pp. 583 -- 592. M. Chlebk and J. Chlebkov. "The Steiner tree problem on graphs: Inapproximability results". Theor. Comput. Sci. 406 (3 2008), pp. 207 -- 214. C. Y. Chen and K. Grauman. "Efficient activity detection in untrimmed video with max-subgraph search". IEEE Trans. Pattern Anal. Mach. Intell. 39 (5 2018), pp. 908 -- 921. [Byr+10] [CG18] [CC08] [Cho+13] S. A. Chowdhury, S. E. Shackney, K. Heselmeyer-Haddad, T. Ried, A. A. Schffer and R. Schwartz. "Phylogenetic analysis of multiprobe fluorescence in situ hybridization data from tumor cell populations". Bioinformatics 29 (13 2013), pp. i189 -- i198. N. Christofides. Worst-case analysis of a new heuristic for the travelling salesman problem. Tech- nical Report 388. Graduate School of Industrial Administration, Carnegie Mellon University, 1976. [Chr76] [Fel18] [Fel+18] A. E. Feldmann, W. S. Fung, J. Knemann and I. Post. "A (1 + ε)-embedding of low highway dimension graphs into bounded treewidth graphs". SIAM J. Comput. 41 (4 2018), pp. 1667 -- 1704. A. E. Feldmann. "Fixed parameter approximations for k-center problems in low highway dimen- sion graphs". Algorithmica (2018). A. E. Feldmann and D. Marx. "The parameterized hardness of the k-center problem in trans- portation networks". In: Proc. 16th Scandinavian Sympos. and Workshop Algorithm Theory (SWAT). 2018, 19:1 -- 19:13. [FM18] [GH91] [Hel+11] [GJ02] [GJ77] [GEP95] M. Grigni, E. Koutsoupias and C. H. Papadimitriou. "An approximation scheme for planar graph TSP". In: Proc. 36th Annual IEEE Sympos. Foundations Comput. Sci. (FOCS). 1995, pp. 640 -- 645. M. Grtschel and O. Holland. "Solution of large-scale symmetric travelling salesman problems". Math. Program. 51 (1991), pp. 141 -- 202. M. Garey and D. Johnson. Computers and intractability. Vol. 29. Freeman, 2002. M. R. Garey and D. S. Johnson. "The rectilinear Steiner tree problem is NP-complete". SIAM J. Appl. Math. 32 (4 1977), pp. 826 -- 834. S. Held, B. Korte, D. Rautenbach and J. Vygen. "Combinatorial optimization in VLSI design". In: Combinatorial Optimization: Methods and Applications. Ed. by V. Chvatal. Amsterdam: IOS Press, 2011, pp. 33 -- 96. S. Hougardy and H. J. Prmel. "A 1.598 approximation algorithm for the Steiner problem in graphs". In: Proc. 10th Annual ACM-SIAM Sympos. Discrete Algorithms (SODA). 1999, pp. 448 -- 453. D. S. Hochbaum and D. B. Shmoys. "A unified approach to approximation algorithms for bot- tleneck problems". J. ACM 33.3 (1986), pp. 533 -- 550. R. M. Karp. "Reducibility among combinatorial problems". Complexity of Computer Computa- tions (1972), pp. 85 -- 103. R. Krauthgamer and J. R. Lee. "Algorithms on negatively curved spaces". In: Proc. 47th Annual IEEE Sympos. Foundations Comput. Sci. (FOCS). 2006, pp. 119 -- 132. P. Klein. "A linear-time approximation scheme for TSP in undirected planar graphs with edge- weights". SIAM J. Comput. 37.6 (2008), pp. 1926 -- 1952. [Kar72] [Kle08] [HP99] [HS86] [KL06] 14 [KLP17] I. Katsikarelis, M. Lampis and V. T. Paschos. "Structural parameters, tight bounds, and ap- proximation for (k, r)-center". In: Proc. 28th Internat. Sympos. Algorithms Comput. (ISAAC). 2017, 50:1 -- 50:13. [KLS15] M. Karpinski, M. Lampis and R. Schmied. "New inapproximability bounds for TSP". J. Comput. [KV17] Syst. Sci. 81 (8 2015), pp. 1665 -- 1677. A. Kosowski and L. Viennot. "Beyond highway dimension: small distance labels using tree skelet- ons". In: Proc. 28th Annual ACM-SIAM Sympos. Discrete Algorithms (SODA). 2017, pp. 1462 -- 1478. [Lam14] M. Lampis. "Improved Inapproximability for TSP". Theory Comput. 10 (2014), pp. 217 -- 236. [LAS16] A. A. Loboda, M. N. Artyomov and A. A. Sergushichev. "Solving generalized maximum-weight connected subgraph problem for network enrichment analysis". In: Proc. 16th Workshop Al- gorithms in Bioinformatics (WABI). Ed. by M. Frith and C. S. Pedersen. 2016, pp. 210 -- 221. I. Ljubi, R. Weiskirchner, U. Pferschy, G. W. Klau, P. Mutzel and M. Fischetti. "An algorithmic framework for the exact solution of the prize-collecting Steiner tree problem". Math. Program. 105 (2 -- 3 2006), pp. 427 -- 449. [Lju+06] [LND85] G. Laporte, Y. Nobert and M. Desrochers. "Optimal routing under capacity and distance re- [LR75] [Mit99] [PV06] [RZ05] [SV14] [Tre00] [Vaz01] strictions". Oper. Res. 33 (5 1985), pp. 1050 -- 1073. J. Lenstra and A. Rinnooy Kan. "Some simple applications of the traveling salesman problem". Oper. Res. Quart. 26 (1975), pp. 717 -- 33. J. S. B. Mitchell. "Guillotine subdivisions approximate polygonal subdivisions: A simple polynomial- time approximation scheme for geometric TSP, k-MST, and related problems". SIAM J. Comput. 28.4 (1999), pp. 1298 -- 1309. C. H. Papadimitriou and S. Vempala. "On the approximability of the traveling salesman prob- lem". Combinatorica 26 (1 2006), pp. 101 -- 120. G. Robins and A. Zelikovsky. "Tighter bounds for graph Steiner tree approximation". SIAM J. Discrete Math. 19 (1 2005), pp. 122 -- 134. A. Seb and J. Vygen. "Shorter tours by nicer ears: 7/5-approximation for the graph-TSP, 3/2 for the path version, and 4/3 for two-edge-connected subgraphs". Combinatorica (2014), pp. 1 -- 34. L. Trevisan. "When Hamming meets Euclid: The approximability of geometric TSP and Steiner tree". SIAM J. Comput. 30 (2 2000), pp. 475 -- 485. V. V. Vazirani. Approximation Algorithms. New York, NY, USA: Springer-Verlag New York, Inc., 2001. 15
1703.07417
3
1703
2017-09-08T19:37:51
Distributed Distance-Bounded Network Design Through Distributed Convex Programming
[ "cs.DS", "cs.DC", "math.CO" ]
Solving linear programs is often a challenging task in distributed settings. While there are good algorithms for solving packing and covering linear programs in a distributed manner (Kuhn et al.~2006), this is essentially the only class of linear programs for which such an algorithm is known. In this work we provide a distributed algorithm for solving a different class of convex programs which we call "distance-bounded network design convex programs". These can be thought of as relaxations of network design problems in which the connectivity requirement includes a distance constraint (most notably, graph spanners). Our algorithm runs in $O( (D/\epsilon) \log n)$ rounds in the $\mathcal{LOCAL}$ model and finds a $(1+\epsilon)$-approximation to the optimal LP solution for any $0 < \epsilon \leq 1$, where $D$ is the largest distance constraint. While solving linear programs in a distributed setting is interesting in its own right, this class of convex programs is particularly important because solving them is often a crucial step when designing approximation algorithms. Hence we almost immediately obtain new and improved distributed approximation algorithms for a variety of network design problems, including Basic $3$- and $4$-Spanner, Directed $k$-Spanner, Lowest Degree $k$-Spanner, and Shallow-Light Steiner Network Design with a spanning demand graph. Our algorithms do not require any "heavy" computation and essentially match the best-known centralized approximation algorithms, while previous approaches which do not use heavy computation give approximations which are worse than the best-known centralized bounds.
cs.DS
cs
Distributed Distance-Bounded Network Design Through Distributed Convex Programming∗ Michael Dinitz Yasamin Nazari Johns Hopkins University Johns Hopkins University [email protected] [email protected] September 12, 2017 Abstract Solving linear programs is often a challenging task in distributed settings. While there are good algorithms for solving packing and covering linear programs in a distributed man- ner (Kuhn et al. 2006), this is essentially the only class of linear programs for which such an algorithm is known. In this work we provide a distributed algorithm for solving a different class of convex programs which we call "distance-bounded network design convex programs". These can be thought of as relaxations of network design problems in which the connectivity requirement includes a distance constraint (most notably, graph spanners). Our algorithm runs in O((D/ǫ) log n) rounds in the LOCAL model and finds a (1 + ǫ)-approximation to the optimal LP solution for any 0 < ǫ ≤ 1, where D is the largest distance constraint. While solving linear programs in a distributed setting is interesting in its own right, this class of convex programs is particularly important because solving them is often a crucial step when designing approximation algorithms. Hence we almost immediately obtain new and improved distributed approximation algorithms for a variety of network design problems, including Basic 3- and 4-Spanner, Directed k-Spanner, Lowest Degree k-Spanner, and Shallow-Light Steiner Network Design with a spanning demand graph. Our algorithms do not require any "heavy" computation and essentially match the best-known centralized approximation algorithms, while previous approaches which do not use heavy computation give approximations which are worse than the best-known centralized bounds. 1 Introduction Distributed network design is a classical type of distributed algorithmic problem, going back at least to the seminal work on distributed MST by Gallager, Humblet, and Spira [15]. By "network design", we mean the class of problems which can be phrased as "given input graph G, find a subgraph H which has some property P , and minimize the cost of H". Clearly different properties P , and different notions of cost, lead to very different problems. One important class of problems are distance-bounded network design problems, where the property P is that certain pairs of vertices are within some distance of each other in H (where distance refers to the shortest-path distance). The most well-known type of distance-bounded network design problems are problems involving graph spanners, in which the distance requirement is that the distance in H for all (or certain) pairs is within a certain factor (known as the stretch) of their original distance in H. But there are ∗Supported in part by NSF awards 1464239 and 1535887. 1 many other important versions of distance-bounded network design, such as the bounded diameter problem [12] and the shallow-light Steiner tree/network problems [18]. Many of these problems are NP-hard, so they cannot be solved optimally in polynomial time even in the centralized setting. Thus they have been studied extensively from an approximation algorithms point of view, where we design algorithms which approximate the optimal solution but which run in polynomial time. For many of these problems, a key step in the best-known centralized approximation algorithm is solving a linear programming relaxation of the problem, and then rounding the optimal fractional solution into a feasible integral solution. Interestingly, it is relatively common for the rounding to be "local": if we are in a distributed setting and happen to know the optimal fractional LP solution, then the algorithm used to round this to an integral solution can be accomplished with a tiny amount of extra time (either 0 or a small constant number of rounds). So the bottleneck when trying to make these algorithms distributed is solving the LP, not rounding it. Solving LPs in distributed settings has received only a small amount of attention, since it unfortunately turns out to be extremely challenging in general. Most notably, Kuhn, Moscibroda, and Wattenhofer [20] gave an efficient distributed algorithm (in the LOCAL model of distributed computation) for packing/covering LPs. Unfortunately, the LPs used for distance-bounded network design are not packing/covering LPs1, and hence we are not able to use their techniques. In this paper we show how to solve these LPs (and convex generalizations of them) in the LOCAL model of distributed computation, which almost immediately gives the best-known results for a variety of distance-bounded network design problems. In particular, for many network design problems (Directed k-Spanner, Basic 3-Spanner, Basic 4-Spanner, Lowest-Degree k-Spanner, Directed Steiner Network with Dis- tance Constraints with spanning demands, and Shallow-Light Steiner Network with spanning demands) we give approximation algorithms which run in O(D log n) rounds (where D is the maximum distance bound) and have the same approximation ratios as in the centralized set- ting. Previous distributed algorithms for these problems with similar round complexity have either used "heavy" computations (non-polynomial time algorithms) at the nodes (in which case they can often do better than the best computationally-bounded centralized algorithm), or give approxima- tion bounds which are asymptotically worse than the best centralized bounds. See Section 1.2 for more discussion of previous work. 1.1 Our Results We give two main types of results. First, we give a distributed algorithm that (approximately) solves distance-bounded network design convex programs with small round complexity. We then use this result to (almost immediately) get improved distributed approximation algorithms for a variety of network design problems. 1.1.1 Solving convex programs Stating our main technical result (distributed approximations of distance-bounded network design convex programs) in full generality requires significant technical setup, so we provide an informal description here. See Section 4 for the full definitions and theorem statements (Theorem 9 in particular). But informally, a distance-bounded network design convex program is the following. 1They can be turned into packing/covering LPs through a projection operation, but unfortunately this technique results in an exponential number of constraints, making [20] inapplicable. However, this technique has been used in the centralized setting for the fault-tolerant directed k-spanner problem [9] 2 We are given a graph G = (V, E), a set S ⊆ V × V , and for each (u, v) ∈ S there is a set of "allowed" u − v paths Pu,v. Informally, the integral problem is to find a subgraph H of G so that every (u, v) ∈ S is connected by at least one path from Pu,v in H, and the goal is to minimize some notion of "cost". If our notion of "cost" is captured by an objective function g : RE ≥0 → R (which is typically linear, but which can be more general convex functions as long as they satisfy a "partitionability" constraint – see Section 4 for the details), then the natural relaxation of this problem is the following convex program, which has a variable xe for every edge and a variable fP for every allowed path. min g(x) s.t. XP∈Pu,v:e∈P fP ≤ xe ∀(u, v) ∈ S,∀e ∈ E XP∈Pu,v xe ≥ 0 fP ≥ 0 fP ≥ 1 ∀(u, v) ∈ S ∀e ∈ E ∀(u, v) ∈ S,∀P ∈ Pu,v Informally, the first type of constraint says that an allowed path is included only if all edges in it are included, and the second type of constraint required us to include at least one allowed path for each (u, v) ∈ S. We call this type of convex program a distance-bounded network design convex program. It is clearly not a packing/covering LP due to the first type of constraint, and hence there is no known distributed algorithm to solve this kind of program. However, note that if the maximum length of any allowed path is constant, then there are only a polynomial number of such paths, and hence the size of the convex program is polynomial and so it can be solved in polynomial time in the centralized setting under reasonable assumptions on g (see [16] for details on solving convex programs in polynomial time). Our main technical result is that we can approximately solve these optimization problems even in a distributed setting. For any path P let ℓ(P ) denote the length of the path (the number of edges in it). Theorem 1. For any constant ǫ > 0, any distance-bounded network design convex program can be solved up to a (1 + ǫ)-approximation in O(D log n) rounds in the LOCAL model, where D = max(u,v)∈S maxP∈Pu,v ℓ(P ). Moreover, if the convex program can be solved in polynomial time in the centralized sequential setting, then the distributed algorithm uses only polynomial-time com- putations at every node the full statement. The dependence on ǫ in the above theorem is hidden in the O(·) notation – see Theorem 9 for Our main technique is to use a distributed construction of padded decompositions, a specific type of network decomposition which we explain in detail in Section 3. Padded decompositions have been very useful for metric embeddings and approximation algorithms (e.g., [17,19]), but to the best of our knowledge have not been used before in distributed algorithms (with the exception of [10], which used a special case of them to give a distributed algorithm for the fault-tolerant 2-spanner problem). Very similar decompositions, such as the famous Linial-Saks decomposition [21], have been used extensively in distributed settings, but the guarantees for padded decompositions are somewhat different (and we believe that these decompositions may prove useful in the future when designing distributed approximation algorithms). In Section 3 we give a distributed algorithm in 3 the LOCAL model to construct padded decompositions. These padded decompositions allow us to solve a collection of "local" convex programs with the guarantees that a) most of the demands in S are satisfied in one of the local programs, and b) the solutions of the local convex programs combine into a (possibly infeasible) global solution with cost at most the cost of the global optimum. Then by averaging over O(log n) of these decompositions we get a feasible global solution which is almost optimal. 1.1.2 Distributed approximation algorithms for network design Solving convex programming problems in distributed environments is interesting in its own right, and Theorem 1 is our main technical contribution, but the particular class of convex programs that we can solve are mostly interesting as convex relaxations of interesting combinatorial optimization problems. Many of the problems are NP-hard, but there has been significant work (some quite recent) on designing approximation algorithms for them (see, e.g., [5, 6, 9, 11]). Almost all of these approximations depend on convex relaxations which fall into our class of "distance-bounded network design convex programs". This means that as long as the rounding scheme can be computed locally, we can design distributed versions of these approximation algorithms by using Theorem 1 to solve the appropriate convex relaxation and then using the local rounding scheme. We are able to use this framework to give distributed approximation algorithms for several problems. Most of them are variations of graph spanners, which were introduced by Peleg and Ullman [25] and Peleg and Schaffer [24], and are defined as follows. Definition 1. Let G = (V, E) be a graph (possibly directed), and let k ∈ N. A subgraph H of G is a k-spanner of G if dH(u, v) ≤ k · dG(u, v) for all u, v ∈ V . The value k is called the stretch of the spanner. Before stating our results, we first define the problems. In the Basic k-Spanner problem we are given an undirected graph G and a value k ∈ N. A subgraph H of G is a feasible solution if it is a k-spanner of G, and the objective is to minimize the number of edges in H. For k = 3, 4, the best-known approximation algorithm for this problem is O(n1/3) [5, 11]. If the input graph G (and the solution H) are directed, then this is the Directed k-Spanner problem, for which the best-known approximation is O(√n) [5]. If the objective is instead to minimize the maximum degree in H then this is the Lowest-Degree k-Spanner problem, for which the best-known approximation is O(n(1−1/k)2 ) [6]. The following theorem contains our results on distributed approximations of graph spanners. Informally, it states that for we can give the same approximations in the the LOCAL model as are possible in the centralized model. Theorem 2. There are algorithms in the LOCAL model with the following guarantees. For Di- rected k-Spanner, the algorithm runs in O(k log n) rounds and gives an O(√n)-approximation. For Basic 3-Spanner and Basic 4-Spanner, the algorithms run in O(log n) rounds and gives an O(n1/3)-approximation. For Lowest-Degree k-Spanner, the algorithm runs in O(k log n) rounds and gives an O(n(1−1/k)2 )-approximation. All of these algorithms use only polynomial-time computations at each node. We emphasize that our algorithms for these spanner problems both match the best-known centralized approximations and only use polynomial-time computations at each node. There is significant previous work (see Section 1.2) on designing distributed approximation algorithms for these and related problems that has only one of these two properties, but all previous approaches which use only polynomial-time computations necessarily do worse than the best centralized bound 4 (or have much worse round complexity). At a high level, this is because previous approaches (most notably [2]) do not actually use the structure of the centralized algorithm: they only use the efficient centralized approximation as a black box. By going inside the black box and noticing that they all use a similar type of convex relaxation, we can simultaneously get low round complexity, best-known approximation ratios, and efficient local computation. It turns out that we can use our techniques for an even broader question: Directed Steiner Network with Distance Constraints with a spanning demand graph. In this problem there is a set S ⊆ V × V of demands, and for every demand (u, v) ∈ S there is a length bound L(u, v). The goal is to find a subgraph H so that dH(u, v) ≤ L(u, v) for all (u, v) ∈ S, and the objective is to minimize the number of edges in H. The state of the art centralized bound for this problem is a O(n3/5+ǫ)-approximation [7], but if we further assume that every vertex u ∈ V is the endpoint of at least one demand in S (which we will refer to as a spanning demand graph) then it is straightforward to see that the centralized algorithm of [5] for Directed k-Spanner can be generalized to give a O(√n)-approximation. Our distributed version of this algorithm also generalizes, giving the following result. Theorem 3. There is an approximation algorithm in the LOCAL model for Directed Steiner Network with Distance Constraints with a spanning demand graph with approximation ratio O(√n) which runs in O((max(u,v)∈S L(u, v)) log n) rounds and uses only polynomial-time compu- tations. Note that Directed k-Spanner and Basic k-Spanner are special cases of this problem, where there is a demand for every edge and the length bound is just k times the original distance. Interestingly, other network design problems which have proved important for distributed systems are also special cases, including the Distance Preserver problem (when L(u, v) = dG(u, v) for all (u, v) ∈ S), the Pairwise k-Spanner problem (where L(u, v) = k · dG(u, v) for all (u, v) ∈ S), and the Shallow-Light Steiner Network problem (where L(u, v) = D for all (u, v) ∈ S, for some global parameter D). Shallow-Light Steiner Network in particular is a key component in state of the art systems for reliable Internet transport [1], although in that particular application the demand graph is not spanning. Extending our techniques to handle totally general demands by giving a distributed version of [7] is an extremely interesting open question. 1.2 Related Work While distributed solving of convex programs is a natural question, there is little previous work in the LOCAL model. Possibly most related to our results is a line of work on solving positive linear programs (packing and covering LPs). This was introduced by [22], improved by [4], and then essentially optimal upper and lower bounds were given by [20]. Unfortunately, the convex programs we consider are not positive linear programs due to the "capacity" constraints in which some variables appear with positive coefficients while others have negative coefficients. A special case of our result was proved earlier in [10], who showed how to solve the LP relaxation of Basic 2-Spanner in the LOCAL model in O(log2 n) rounds (they actually show more than this, by giving a distributed algorithm for the fault-tolerant version of Basic 2-Spanner, but that is not germane to our results). Our techniques are heavily based on [10], which is itself based on the ideas from [20]. In particular, [20] uses a Linial-Saks decomposition [21] to solve "local" versions of the linear program in different parts of the graph, and then combines these appropriately. To make this work for the Basic 2-Spanner LP relaxation, [10] had to use padded decompositions, which can be thought of as a variant of Linial-Saks with slightly different guarantees which, for technical reasons, are more useful for network design LPs. In this paper we extend these techniques 5 further by giving a more general definition of padded decomposition which works for larger distance requirements, showing how to construct them in the LOCAL model, and then showing that the basic "combining" idea from [10] can be extended to handle these more general decompositions and far more general constraints and objective functions. The major type of combinatorial optimization problem which our techniques allow us to approxi- mate are various versions of graph spanners. There are an enormous number of papers on spanners in both centralized and distributed models, but fewer papers which attempt to find the "best" spanner for the particular given input graphs (most papers on spanners give existential results and algorithms to achieve them, rather than optimization results). These optimization questions (e.g., Basic k-Spanner, Directed k-Spanner, and Lowest-Degree k-Spanner) have been considered quite a bit in the context of centralized approximation algorithms and hardness of ap- proximation [5, 6, 8, 9, 11], but almost all of the known centralized results use linear programming relaxations, making them difficult to adapt to distributed settings. Hence there have been only two results on optimization bounds in distributed models: [10] and [2]. Barenboim et al. [2] provided a distributed algorithm using Linial-Saks decompositions that for any integer parameters k, α, gives an O(n1/α)-approximation for Directed k-Spanner in exp(O(α))+O(k) time. This is an extremely strong approximation bound, and in fact is better than even the best centralized bound. This is possible due to their use of very heavy (exponential time) local computation. Our algorithms, on the other hand, take polynomial time for local computations. Barenboim et al. [2] show that heavy local computations can be removed from their algorithm by using a centralized approximation algorithm for a variant of spanners known as client-server k- spanners, and in particular that an f (k)-approximation for client-server k-spanner can be turned into an O(n1/αf (k))-approximation algorithm running in exp(O(α)) + O(k) rounds in the LOCAL model for minimum k-spanner with only polynomial local computation. So in order to achieve the same asymptotic approximation ratio as the best-known centralized algorithm, the parameter α must be Ω(log n) and hence the running time is polynomial in n, even though k might be a constant. It is essentially known (though not written anywhere) that a variety of other results with slightly different tradeoffs can be achieved through similar uses of Linial-Saks [13] or refinements of Linial-Saks such as [14]. However, since all of these approaches treat the centralized approximation algorithm as a black box, none of them can achieve the same approximation ratio as the centralized algorithm without suffering a much worse (usually polynomial) round complexity that the O(k log n) that we achieve. 2 Preliminaries and Notation The distributed setting we will be considering is the LOCAL model [23], in which time passes in synchronous rounds and in each round every node can send an arbitrary message of unbounded size to each of its neighbors in the underlying graph G = (V, E) (as always, we will let n = V and m = E). We will assume that all nodes know n (or at least know a constant approximation of n). Usually in this model the communication graph is the same as the graph of computational interest; e.g., we will be trying to compute a spanner of the communication graph itself. But for some applications we will want the graph to be directed, in which case we make the standard assumption that communiocation is bidirectional: the graph for which we are trying to compute a convex relaxation / network design problem is directed, but messages can be sent in both directions across a link. In other words, the communication graph is just the undirected version of the given directed graph. For any pair of nodes u, v ∈ V we define d(u, v) to be the distance between u and v in the com- 6 If x is a vector then we use xi to denote the i'th component of x. Most of the time our vectors munication graph (i.e. the length of a shortest path between u and v regardless of edge directions). We define B(u, k) to be an undirected ball of radius k from u in the communication graph. More precisely, B(u, k) = {w ∈ V d(u, w) ≤ k}. will be indexed by edges in a graph, in which case we will also use the notation (xe)e∈E. Given a partition of the vertices V of a graph, we will refer to each part of the partition as a "cluster". For any graph G = (V, E) and set S ⊆ V , we let E(S) denote the set of edges in the subgraph induced by S, i.e., E(S) = {(u, v) ∈ E u, v ∈ S}. We will frequently need "restrictions" of vectors to induced subgraphs, so for any vector x ∈ Rm, we define xS = (xS e )e∈E to be the vector in Rm where xS e = 0 if e 6∈ E(S) and xS e = xe if e ∈ E(S). 3 Padded decompositions We will now define and give an algorithm to construct padded decompositions, which are one of the key technical tools that we will use when designing algorithm to solve distance-bounded network design convex programs. In this section all graphs are undirected and all distances are with respect to this undirected graphs (in fact, the definition and our algorithm work more generally for any metric space). Recall that B(u, k) denotes the undirected ball of radius k from node u (in the communication graph). Definition 2. Given an undirected graph G, a (k, ǫ)-padded decomposition, where 0 < ǫ ≤ 1, is a probability measure µ over the set of graph partitions (clusterings) that has the following properties: 1) For every P ∈ supp(µ), and every cluster C ∈ P , we have: diam(C) ≤ O((k/ǫ) log n). 2) For every u ∈ V , it holds that Pr(∃C ∈ P B(u, k) ⊆ C) ≥ 1 − ǫ. That is to say, the probability that all nodes in B(u, k) are in the same cluster is at least 1 − ǫ. This notion of padded decompositions is standard in metric embeddings and approximation algorithms [17,19], but to the best of our knowledge has not yet been used in distributed algorithms. We first use a centralized algorithm (Algorithm 1) to sample from a (k, ǫ)-padded decomposition, and then describe how it can be implemented in the LOCAL model. Algorithm 1 and its analysis are similar to a partitioning algorithm proposed in [3], which was shown to have a low probability of separating nodes in a close neighborhood. For any partition P constructed by Algorithm 1, each cluster is clearly C(v) for some v ∈ V . We call this special node v the center of cluster C(v). Later, we will use the center of each cluster for solving locally defined convex programs. Lemma 4. Algorithm 1 partitions a given undirected graph G = (V, E) into a partition P such that P is sampled from a (k, ǫ)-padded decomposition. Proof. The first property in Definition 2 is directly implied by the definition of rv for all nodes v ∈ V . For the second property we consider an arbitrary node u ∈ V , and compute the probability that the ball B(u, k) is not in any of the clusters in P . Consider an arbitrary value 1 ≤ t ≤ n, let v ∈ V be the node such that t = π(v), and let z = zv be the real number sampled by v. Also, for any x, y ∈ V , let d(x, y) = min(d(x, y), r ln n + k). Let us also order the clusters based on their center's position in the permutation, so that Ct is the cluster corresponding to t = π(v) (i.e. v is the cluster center of Ct). We define Xt to be the event that if B(u, k) is not in the first t − 1 clusters, then it 7 3 Sample zv independently from a distribution with probability density function Algorithm 1: Sampling from a (k, ǫ)-padded decomposition of G = (V, E). 1 Let π : V → [n] be an arbitrary bijection from V to [n], and let r = ( 2 ǫ )k. 2 for v ∈ V do p(zv) =(cid:16) n 5 for u ∈ V do Set the radius rv = min(zv, r ln n + k). n−1(cid:17) e−zv/r . r 4 6 Node u joins cluster C(v), such that d(v, u) ≤ rv ∧ (π(v) < π(w) ∀w 6= v s.t. d(w, u) ≤ rw). // Node u joins the cluster C(v), with cluster center v, which is the first node in the permutation where d(v, u) ≤ rv. is also not in any of the remaining clusters. We provide a recursive bound on Xt based on Xt+1. Then we will get the second property once we show Pr(X0) ≤ ǫ. We need to define the following events: t • At : B(u, k) does not intersect with any of the clusters C1, .., Ct−1. • M cut • M ex • Xt : (∄j ≥ t : B(u, k) ⊆ Cj At). : ( d(v, u) − k ≤ z < d(v, u) + k At). : (z < d(v, u) − k At). t In other words, conditional on the event that B(u, k) is not in any of the first t − 1 clusters, either B(u, k) ⊆ Ct, or else one the following two events will occur: M cut is the event that B(u, k) partially intersects Ct, and M ex is the event that B(u, k) does not intersect Ct. Now the event Xt occurs only when either M cut and Xt+1 occur (i.e. when B(u, k) is not in Ct or any of the next clusters). Hence we can write Pr(Xt) ≤ Pr(M cut t ) Pr(Xt+1). Recall that z is independently sampled from the density function p(zv) = (cid:16) n , and thus M cut can be occurs or both M ex written as follows: ) + Pr(M ex t t t t n−1(cid:17) e−zv/r n − 1(cid:19)(cid:16)1 − e−2k/r(cid:17) e−( d(v,u)−k)/r ≤(cid:18) n r n − 1(cid:19) 2k r e−( d(v,u)−k)/r. Pr(M cut t ) =Z d(v,u)+k d(v,u)−k p(z)dz =(cid:18) n Similarly, we can write, d(v,u)−k Pr(M ex t ) =Z 0 n − 1(cid:19)(cid:16)1 − e−( d(v,u)−k)/r(cid:17) . p(z)dz =(cid:18) n n−1 )( 2k We now inductively prove that Pr(Xt) ≤ (2 − t r ). If t < n is the last step, then Pr(Xt) = 0, and thus this bound clearly holds. Assume that the bound is true for Xt+1, we show that then it also holds for Xt. We have, t ) + Pr(M ex r (cid:19)(cid:18)1 + Pr(Xt) ≤ Pr(M cut Since e−( d(v,u)−k)/r ≥ e−(ln n) ≥ 1/n, we get that Pr(Xt) ≤ (cid:16)2 − t is then implied by the fact that Pr(X0) ≤ 2k t ) Pr(Xt+1) ≤(cid:18) n n − 1(cid:19)(cid:18) 2k 2k(1/ǫ) = ǫ. r = 2k n − 1 (cid:16)1 − e−( d(v,u)−k)/r(cid:17)(cid:19) . n − t − 2 n−1(cid:17)(cid:0) 2k r (cid:1). The second property 8 We will now use an idea similar to the one used in [10] to make Algorithm 1 distributed. In [10] they only considered the special case of k = 1 and ǫ = 1/2, which is why we cannot simply use their result as a black box. Lemma 5. There is an algorithm in the LOCAL model that runs in O( k from a (k, ǫ)-padded decomposition (so every node knows the cluster that it is in). ǫ ln n) rounds and samples Proof. Without loss of generality, we assume that all nodes have unique IDs2. The sequence of IDs in ascending order will determine the permutation π used in Algorithm 1, i.e. if IDu < IDv then π(u) < π(v). The algorithm proceeds as follows until all nodes have been assigned to a cluster: each node u ∈ V chooses a radius ru based on the distribution defined in Algorithm 1. Then every u ∈ V simultaneously sends a message containing IDu to all nodes in B(u, ru). After receiving all the messages, each node chooses the node with the smallest ID as the cluster center. Then Lemma 4 implies that the clusters satisfy the properties of a (k, ǫ)-padded decomposition. Since the radius that each node chooses is O((k/ǫ) log n), and each node only communicates with nodes within its radius, the running time in the LOCAL mode is O((k/ǫ) log n). 4 Distributed distance bounded network design convex program- ming In this section we prove Theorem 1, giving an algorithm similar to [10] which can almost optimally solve distance-bounded network design convex programs. We first make all definitions formal in Section 4.1, and in particular define formally the class of objective functions where our results hold. Then in Section 4.2 we give a distributed algorithm which solved these programs up to arbitrarily small error. 4.1 Distance bounded network design convex programs e = 0 if e 6∈ E(S) and xS We will first describe a general class of objective functions that our algorithm applies to. For a graph G = (V, E) and a set S ⊆ V , we let E(S) denote the set of edges in the subgraph of G induced by S. Recall that for a vector x ∈ Rm (where m = E), we define xS = (xS e )e∈E ∈ Rm to be the vector where xS Definition 3. Given a graph G = (V, E), a function g : Rm 7→ R is convex partitionable with respect to G if g is a non-decreasing3 and convex function with the following property: for all partitions σ = {σ1, ..., σℓ} of nodes in V , there exists a non-decreasing function hσ : Rℓ 7→ R, s.t. g(x) = hσ(g(xσ1 ), g(xσ2 ), ..., g(xσℓ )) for all x = (xe)e∈E where xe = 0 for any edge e with endpoints in different clusters of σ (equality does not need to hold for vectors x with nonzero values on edges between clusters). e = xe if e ∈ E(S). Convex partitionable functions for graphs are a natural class of functions for distributed com- puting purposes. Moreover, this class includes many types of objective functions that are of interest in network design problems, including p-norms and linear functions. For example, if the function g is the p-norm with p ∈ Z≥0, then it is easy to verify that by setting the function hσ to also 2We can make this assumption since nodes can each draw an ID from a suitably large space, so the probability of a collision is small enough that it does not affect the guarantees required by a (k, ǫ)-padded decomposition. In our model, we assume that nodes know the size of the network 3Let f (x1, ..., xk) be a multivariate function. We will say f is nondecreasing if the following holds: if xi ≤ x′ i for all 1 ≤ i ≤ k, then f (x1, ..., xk) ≤ f (x′ 1, ..., x′ k). 9 be the p-norm for any partition σ of V , the conditions of Definition 3 are satisfied. Note that an unweighted sum is the 1-norm, and the max function is the infinity norm, and hence they will also satisfy the conditions of Definition 3. Similarly, in case of linear functions, it is easy to see that conditions of Definition 3 are satisfied by setting hσ to be the unweighted sum. 4. There are also other, less trivial examples. For example, it is not hard to show the p-norm of the degree vector (rather than just the edge vector) is also convex partitionable with respect to G. An important special case of this is the ∞-norm of the degree vector, i.e., the maximum degree. Since we use this objective in some of our applications (i.e., for the Lowest-Degree k-Spanner problem), we give a short proof of this case in Lemma 6. For an integral vector x ∈ Rm we can write g(x) = maxv∈V deg(v). By generalizing this notation to all x ∈ Rm, we can define fractional node degrees as deg(v) =Pu:(v,u)∈E x(v,u) Lemma 6. Given a graph G = (V, E), the function g(x) = maxv∈V (Pu:(v,u)∈E x(v,u)) is convex partitionable w.r.t. G. Proof. Let σ = {σ1, ..., σℓ} be a partition of nodes in V . For all 1 ≤ i ≤ ℓ, we have g(xσi ) = maxv∈σi(Pu:(v,u)∈E xσi (v,u)). Then we can set hσ(y) = maxi∈[ℓ](yi), y ∈ Rℓ, where yi is the i-th coordinate of y. Let σ(v) ∈ σ be the cluster that node v belongs to. For all x = (x(u,v))(u,v)∈E , where x(u,v) = 0 for any (u, v) ∈ E s.t. σ(u) 6= σ(v) , we have, v∈V  v∈σi   Xu:(v,u)∈E max σi∈σ  = max  Xu:(v,u)∈E x(v,u) xσi (v,u)    (g (xσi)) = hσ(g(xσ1 ), g(xσ2 ), ..., g(xσℓ )). g(x) = max = max σi∈σ It is also easy to see that the function hσ is convex and non-decreasing. Hence hσ satisfies the conditions in Definition 3. Now that this class of functions has been defined, we can formally define the class of distance- bounded network design convex programs. Definition 4. Let S ⊆ V × V be a set of pairs in the graph G = (V, E), and for any pair (u, v) ∈ S let Pu,v be a set of paths from u to v, which we sometimes call the set of "allowed" paths. Let g be a non-decreasing convex-partitionable function of x = (xe)e∈E with g(~0) = 0. Then we call a convex program of the following form a distance bounded network design CP : min g(x) fP ≤ xe ∀(u, v) ∈ S,∀e ∈ E s.t XP∈Pu,v:e∈P XP∈Pu,v xe ≥ 0 fP ≥ 0 fP ≥ 1 ∀(u, v) ∈ S ∀e ∈ E ∀(u, v) ∈ S,∀P ∈ Pu,v As we will see in Section 5, many network design problems use linear (or convex) programming relaxations that satisfy the conditions of Definition 4. A key parameter of such a program is the length of the longest allowed path D = max(u,v)∈S maxp∈Pu,v ℓ(p) (where ℓ(p) is the length of path p). 4Here we are considering out-degree of nodes in a directed graph. It is easy to see that Lemma 6 also holds in cases of in-degree only or sum of out-degree and in-degree. The later is the case we are interested for Section 5. 10 4.2 Distributed Algorithm In order to solve these convex programs in a distributed manner, we will first use padded decompo- sitions to form a local problem using a simple distributed algorithm. Let P be a partition sampled from a (k, ǫ)-padded decomposition (in particular, obtained by Lemma 5), where 0 < ǫ ≤ 1. Recall that for each cluster C ∈ P , E(C) = {(u, v) ∈ E u, v ∈ C}. We define G(C) to be the subgraph induced by C. ǫ log n) rounds so that every cluster center knows G(C). Lemma 7. For each cluster C sampled from a (k, ǫ)-padded decomposition, there is a distributed algorithm running in O( k Proof. The first property of (k, ǫ)-padded decompositions implies that for all nodes u ∈ C, we have d(u, v) = O((k/ǫ) log n), where v is the center of cluster C. Each node u ∈ C that determines v as the center of the cluster it belongs to, will send the information of its incident edges to v. Since there is no bound on the size of the messages being forwarded, this can be done in O((k/ǫ) log n) time. Let CP(G) be a distance bounded network design CP defined on graph G = (V, E). We will define local convex programs based on a partition P of G that is sampled from a (D, λ)-padded decomposition. The value of 0 < λ ≤ 1 will be set later based on the parameters of our distributed algorithm. For each C ∈ P , let CP(C) be CP(G) defined on G(C), but where only demands corresponding to any pair (u, v) ∈ S in which B(u, D) is fully contained in C are included. We denote the set of these demands by N (C), more precisely, N (C) = {(u, v) ∈ S B(u, D) ⊆ C}. The objective will then be to minimize g(x) = g(cid:0)(xe)e∈E(C)(cid:1). In other words CP (C) is defined as follows: min g(x) fP ≤ xe ∀(u, v) ∈ N (C),∀e ∈ E(C) s.t XP∈Pu,v:e∈P XP∈Pu,v xe ≥ 0 fP ≥ 0 fP ≥ 1 ∀(u, v) ∈ N (C) ∀e ∈ E(C) ∀(u, v) ∈ N (C),∀P ∈ Pu,v There is a technical subtlety about computing the function g on each cluster, which is the fact that a solution hxC, f Ci of CP(C) is only defined on G(C). While in practice xC is a vector defined only on edges in E(C), in our analysis we will assume that xC is a vector in Rm (where E = m) and xC e = 0 for all e 6∈ E(C) (this is possible for all the functions we care about). It will become clear that this distinction is also needed when we try to compare the local solutions to the global solutions. The following lemma is similar to Lemma 3.8 in [10], and we show that it holds for our modified definition of local convex programs and for generalized objective functions that satisfy Definition 3. Lemma 8. Let hx∗, f∗i be an optimal solution of CP (G) and let x∗C = (x∗e)e∈E(C). For each cluster C ∈ P , let hxC, f Ci be an optimal solution of CP(C). Then g(xC ) ≤ g(x∗C). C = f∗p for all C = x∗e for all e ∈ E(C) and f∗p Proof. We argue that the vector hx∗C, f∗Ci, where x∗e p ∈ Pu,v, is a feasible solution to CP(C). By definition of N (C) we have that for any (u, v) ∈ N (C) all paths in Pu,v also appear in G(C), and therefore hx∗C, f∗Ci satisfies both capacity and flow constraints of CP(C) for pairs (u, v) ∈ E(C) since they were satisfied in CP(G). Since we assumed that hxC, f Ci is an optimal solution of CP(C), this implies that g(xC ) ≤ g(x∗C). 11 We now provide in Algorithm 2 a distributed algorithm for solving CP(G), by having cluster centers solve CP(C) of their cluster using a sequential algorithm in each iteration, and then aver- aging over the solutions for each edge. We assume that all nodes know the values of D and ǫ. Let Cu,i denote the cluster that node u belongs to in the i-th iteration, and let hxCu,i,i, f Cu,i,ii be the fractional CP solution of Cu,i, where hxCu,i,i i is the fractional CP value for e = (u, v), and p ∈ Pu,v. Since the objective is a function of edge vectors, what we mean by having a distributed solution to a distance bounded network design CP is that each node u will know the value xe for all the edges e incident to u. It is not hard to see that the algorithm could be modified so that every node u can also know the flow value fp for each path p. , f Cu,i,i p e Algorithm 2: Distributed algorithm for approximating distance bounded network design CPs. 1 Set λ = ǫ(1−ǫ) 2 Sample from (D, λ)-padded decompositions t times by Lemma 5, and let Pi be the partition (2−ǫ)(1+ǫ) and t =l 16(1− ǫ 2 )(1+ǫ) ln n m. ǫ2 obtained in the i'th run. 3 For each cluster C ∈ Pi, the center of cluster C computes G(C) (see Lemma 7). 4 The center of each cluster C ∈ Pi solves CP (C) and sends the solution hxC,i, f C,ii to all 5 for e = (u, v) ∈ E do nodes u ∈ C. Let Iu,v = {i ∃C ∈ Pi : u, v ∈ C}. // these are the iterations in which both endpoints are in same cluster xe ← min(1, 1+ǫ ). 6 7 t Pi∈Iu,v xCu,i,i e Theorem 9. Algorithm 2 takes O((D/ǫ) log n) rounds to terminate, and it will compute a solution of cost (1 + ǫ)CP ∗ to a bounded distance network design CP (Definition 4) with high probability, where CP ∗ is the optimal solution and 0 < ǫ ≤ 1. Moreover, if the convex program can be solved sequentially to arbitrary precision in polynomial time, then all of the node computations are also polynomial time. Proof. Correctness: We first show that with high probability the values xe, e ∈ E form a feasible solution. Here we only need to show that a feasible solution for the flow values exist, and do not require nodes to compute these values. Let Iu = {i : ∃C ∈ Pi, B(u, D) ⊆ C}, i.e. Iu is the set of iterations in which B(u, D) is contained in a cluster, and let Iu,v be the set of iterations in which both u and v are in the same cluster. Since we need to implement Algorithm 2 in a distributed manner, we use Iu,v in our implementation, while the analysis is based on Iu. We can do so since by definition we have Iu ⊆ Iu,v, for any (u, v) ∈ E. For any p ∈ Pu,v, we set the flow values to be fp = 1 gives a feasible flow. First we argue that enough flow is being sent. For all (u, v) ∈ S, we have, 1 1 f Cu,i,i p Xp∈Pu,v Iu Xi∈Iu fp = Xp∈Pu,v Iu Xi∈Iu Xp∈Pu,v We have used the fact that for each i ∈ Iu the solution corresponding to the CP of the cluster containing u satisfies the constraint that Pp∈Pu,v:e∈p f Cu,i,i ≥ 1, because for each such i we know that (u, v) ∈ N (C). Iu Xi∈Iu 1 ≥ 1. = p . We will show that this p IuPi∈Iu f Cu,i,i ≥ f Cu,i,i p 1 12 Next, we will argue that the capacity constraints are also satisfied. The second property of (D, λ)-padded decompositions implies that Pr(i ∈ Iu) ≥ 1 − λ = 1 − ǫ(1−ǫ) 2 )(1+ǫ) for each iteration 1 ≤ i ≤ t. By linearity of expectations we have E[Iu] ≥ t(1 − λ). Since each sampling is performed independently, by Chernoff bound for δ = ǫ/2, we get, (2−ǫ)(1+ǫ) = (1− ǫ 1 Pr(Iu ≤ t(1 − λ)(1 − δ)) = Pr(cid:18)Iu ≤ = Pr(cid:18)Iu ≤ t(1 − ǫ 2 ) 2 )(1 + ǫ)(cid:19) (1 − ǫ (1 + ǫ)(cid:19) ≤ e− (ǫ/2)2(1−λ)t t 2 ≤ e−2 ln n = 1 n2 . 1 1 1 1 xCu,i,i = 1 + ǫ Iu Xi∈Iu Xp∈Pu,v:e∈p  ≤ min e  1, t Pi∈Ie xCu,i,i e xCu,i,i xCu,i,i e f Cu,i,i p Hence by a union bound on all nodes we have that with high probability Iu > t/(1 + ǫ). Therefore, for all (u, v) ∈ S, e ∈ E, we have (w.h.p.), Iu Xi∈Iu Iu Xi∈Iu,v fp = Xp∈Pu,v:e∈p ≤ min 1, Iu Xi∈Iu  = xe. ≤ e  Xp∈Pu,v:e∈p t Xi∈Iu,v f Cu,i,i p e = xCu,i,i if i ∈ Ie, and xi solution to CP(G). We have xe = min(1, 1+ǫ we set xi Upper bound: We will now show that the upper bound holds. Let hx∗, f∗i be an optimal ), and for each e = (u, v) and 1 ≤ i ≤ t, e = 0 otherwise. Note that 0 < (1 + ǫ)/t < 1, and since g t g(x). Then for g(x) = g(cid:0)(xe)e∈E(cid:1) ≤ g t Xi∈Ie  g t e!e∈E! ≤ Xi=1 is a convex function and g(~0) = 0, by Jensen's inequality we have g(cid:0) 1+ǫ t x(cid:1) ≤ 1+ǫ x = (xe)e∈E we can write:   g ! ! Xi∈Ie  ≤   g t e(cid:1)e∈E! ≤ g(cid:16)(cid:0)xi e(cid:1)e∈E(cid:17) . Xi=1(cid:0)xi Xi=1 In the final inequality, since g is convex, we used Jensen's inequality to take the sum out of the e)e∈E) ≤ g(x∗). Let function. xi = ((xi e)e∈E), and let Pi = {C1, C2, ..., Cℓ} be the partition of V . Since g is a convex partitionable function w.r.t. G, there exists a nondecreasing and convex function h : Rm 7→ R for which we can write g(xi) = hPi(g(xi,C1 ), g(xi,C2 ), ..., g(xi,Cℓ )), since xi e = 0 by definition for edges which go between clusters (for simplicity we are denoting xiCj by xi,Cj ). It is now enough to show that in each iteration i, it holds g((xi xCu,i,i e xCu,i,i e t 1 + ǫ 1 + ǫ ≤ t 1 + ǫ t 1 + ǫ t e∈E e∈E t e 1 + ǫ xi Recall that x∗C is the vector in which x∗C e = 0 otherwise. By Lemma 8 we get that for all C ∈ Pi, g(xi,C ) ≤ g(x∗C). Now we consider a vector x, defined by setting xe = x∗e for all edge e with both endpoints in the same cluster, and xe = 0 otherwise. Since we assumed hPi to be nondecreasing, we get, e = x∗e for all e ∈ E(C) and x∗C g(xi) = hPi(g(xi,C1 ), g(xi,C2 ), ..., g(xi,Cℓ)) ≤ hPi(g(x∗C1), g(x∗ C2), ..., g(x∗ Cℓ)) = hPi(g(xC1 , xC2, ..., g(xCℓ )) = g(x) ≤ g(x∗). For the last inequality we have used the fact that g is non-decreasing, and that for all e ∈ E, xe ≤ x∗e (since either xe = x∗e or xe = 0). By plugging this into the above inequalities, we will get 13 t Pt g(x) ≤ 1+ǫ approximation to the optimal solution. i=1 g(xi) ≤ (1 + ǫ)g(x∗), which implies the claim that Algorithm 2 gives a (1 + ǫ)- Time Complexity: The decomposition step and sending the information within a cluster takes O((D/ǫ) log n) rounds since the diameter of each cluster is O((D/λ) log n) = O((D/ǫ) log n). Since each decomposition is independent, we can do all of them in parallel, so steps 1-4 of the algorithm only take O((D/ǫ) log n) rounds in total. Clearly the rest of the algorithm can be done in a constant number of rounds. Hence in total w.h.p. the algorithm will take O((D/ǫ) log n) rounds. 5 Distributed Approximation Algorithms for Network Design In this section, we will focus on several network design problems which can be approximated by first solving a convex relaxation using Algorithm 2 and then locally rounding the solution. For that purpose, we will describe how each problem has a distance bounded network design CP relaxation (Definition 4), and will then show that existing rounding schemes are local. 5.1 Directed k-Spanner Dinitz and Krauthgamer [9] introduced a linear programming relaxation for Directed k-Spanner which is just a distance-bounded network design CP with demands pairs S = E, allowed paths Pu,v which are the directed paths from u to v of length at most k, and objective function g(x) =Pe∈E xe. They showed that this LP can be solved in polynomial time (approximately if k is non-constant). We will denote this LP by LP (G). Clearly, LP(G) is a distance bounded network design CP with D = k. Hence, Theorem 9 implies that we can use Algorithm 2 to approximately solve this LP in O(k log n) rounds in the LOCAL model. We now provide in Algorithm 3 a distributed rounding scheme that gives an O(n1/2 log n)- approximation for Directed k-Spanner. This algorithm matches the best centralized approx- imation ratio known [5], and is just the obvious distributed version of the algorithm proposed in [5]. The difference is that here we truncate the shortest-path trees at depth k (as opposed to full shortest-path trees), and nodes choose whether to become a tree root independently (rather than chosen without replacement as in [5]. Algorithm 3: Distributed rounding algorithm for k-spanner. Input: Graph G = (V, E), fractional solution hx, fi to LP(G). 1 E′ = ∅,∀v ∈ V : T in 2 for e ∈ E do v = ∅, T out v = ∅. Add e to E′ with probability min(n1/2 · ln n · xe, 1). 4 for v ∈ V do // Random tree sampling Choose p uniformly at random from [0, 1]. if p < 3 ln n√n then 3 5 6 7 8 T in v ← shortest path in-arborescence rooted at v truncated at depth k. T out v ← shortest path out-arborescence rooted at v truncated at depth k. 9 Output E′ ∪ (∪v∈V (T in v ∪ T out v )). // Each node knows its portion of the output. The following lemma is essentially from [5], with the proof requiring only slight technical changes due to the slightly different algorithms. We sketch it for completeness. 14 Lemma 10. Given a directed graph G, LP(G) as defined, and a fractional solution LP ∗ to LP (G), the output of Algorithm 3 has size O(n1/2 · (n + LP ∗) log n). Proof. Let Ns,t be the subgraph of G induced by the nodes on paths in Ps,t. Edge e ∈ E is called a thick edge if Ns,t ≥ n1/2, and otherwise it is called a thin edge. The set E′ in Algorithm 3 satisfies the spanner property for all thin edges (as argued in [5]), and the random tree sampling phase satisfies the spanner property for the thick edges. Each thick edge (s, t) is spanned if at least one n1/2 )n1/2 ≥ node in Ns,t performs the random tree sampling. This probability is at least 1 − (1 − 3 ln n 1− 1/n3. Then a union bound on all the edges (of size at most O(n2)) implies that w.h.p. all thick edges are spanned. We now argue that the output is an O(n1/2 log n)-approximation algorithm: at most O(n1/2 log n) arborescences are chosen with high probability (each arborscence has O(n) edges), and we argued that E′ = O(n1/2 log n · LP ∗). Hence, the overall size of the output is O(n1/2 log n · (n + LP ∗)). It is also easy to see that this algorithm can be implemented in the LOCAL model. Lemma 11. Algorithm 3 runs in O(k) time in the LOCAL model. Proof. Each node v in G has received the fractional solutions xe corresponding to all edges e ∈ E incident to v. The randomized rounding step can be performed locally: the node with the smaller ID flips a coin, and exchanges the coin flip result with its corresponding neighbors. In order to form T in , v performs a distributed BFS algorithms by forming a shortest path tree while keeping track of the distance from v. When the distance counter reaches k, the tree construction terminates. i and T out i We now immediately get our main result for Directed k-Spanner. Corollary 12. Algorithm 2 with D = k along with the rounding scheme in Algorithm 3 yields an O(n1/2 ln n)-approximation w.h.p. to Directed k-Spanner that runs in O(k log n) time in the LOCAL model and uses only polynomial-time computations at each node. Proof. We first run Algorithm 2 to solve LP(G) up to a constant factor (by setting ǫ = 1/2), which takes time O(k log n) with high probability (Theorem 9). Since each cluster center can solve the local LP in polynomial time, all computations are polynomial time. We then use Algorithm 3 to round the fractional solutions of LP(G), which takes O(k) time. Since the size of a k-spanner is at least Ω(n), Algorithm 3 then outputs an O(n1/2 ln n)-approximation to the minimum (Lemma 10). 5.2 Basic 3-Spanner and Basic 4-Spanner If the input graph is undirected then stronger approximations are possible. In particular, for stretch 3 and 4, there are O(n1/3)-approximations due to [5] (for stretch 3) and [11] (for stretch 4). Without going into details, both of these algorithms use the same LP relaxation as in Di- rected k-Spanner, but round the LP differently. So in order to give distributed versions of these algorithms, we only need to modify Algorithm 3 to use the appropriate rounding algorithm (and change some of the other parameters in the shortest-path arborescence sampling). Fortunately, both of these algorithms use rounding schemes which are highly local. Informally, rather than sample each edge independently with probability proportional to the (inflated) fractional value as in Algorithm 3, these algorithms sample a value independently at each vertex and then include an edge if a particular function of the values of the two endpoints (different in each of the algorithms) 15 passes some threshold. Clearly this is a very local rounding algorithm: once we have solved the LP relaxation using Theorem 9, each node can draw its random value and then spend one more round to exchange a message with each of its neighbors to find out their values, and thus determine which of the edges have been included by the rounding. Thus the total running time is dominated by the time needed to solve the LP, which in these cases is O(log n) using Theorem 9. 5.3 Lowest-Degree k-Spanner We now turn our attention to Lowest-Degree k-Spanner: Given a graph G = (V, E) and a value k, we want to find a k-spanner that minimizes the maximum degree. We will use the relaxation and rounding scheme proposed by Chlamt´ac and Dinitz [6]. The linear programming relaxation used in [6] is very similar to the Directed and Basic k-spanner LP relaxation described earlier, with the difference being that a new variable λ is added to represent the maximum degree, and so the objective is to minimize λ and constraints are added to force λ to upper bound the maximum fractional degree. Theorem 13. Given a graph G = (V, E) (directed or undirected), and any integer k ≥ 1 there is a distributed algorithm that w.h.p. computes an O(∆(1−1/k)2 )-approximation to the Lowest-Degree k-Spanner problem, taking O(k log n) rounds of the LOCAL model and using only polynomial-time computations at each node. Proof. It is easy to see that the LP relaxation proposed in [6] can be written as a distance bounded network design CP where the objective is maxv∈V deg(v) = maxv∈V Pu:{v,u}∈E x{v,u} (we do not need to use their extra variable λ, since we can instead directly write the objective). Lemma 6 implies that this function is convex partitionable w.r.t. G, and hence the Lowest-Degree k- Spanner problem can be approximately solved (to within a constant factor) by using Algorithm 2 with ǫ = 1/2. Next, we use the following rounding scheme proposed in [6]: each edge e ∈ E is included in the spanner with probability x1/k . It is clear that this can be done in a constant number of rounds, and hence the overall algorithm takes O(k log n) rounds (by Theorem 9) in the LOCAL model. In [6], it was shown that this leads to a O(∆(1−1/k)2 )-approximation solution of the problem. e 5.4 Directed Steiner Network with Distance Constraints It is well-known that the centralized rounding of [5] for Directed k-Spanner is more general than is actually stated in their paper. In particular, the randomized rounding for "thin" edges gives the same guarantee even when each demand has a possibly different distance constraint. This fact was used, e.g., in [7] in their algorithms for Distance Preserver, Pairwise k-Spanner, and Directed Steiner Network with Distance Constraints. The difficulty in extending the algorithm of [5] is not in the LP rounding, but rather because the arborescence sampling technique used to handle thick edges in [5] (and in our Algorithm 3) assumes that n is a lower bound on the optimal cost. This assumption is true for Directed k-Spanner, but false for variants where there might be a tiny number of demands. However, it is easy to see that if we assume the demand graph is spanning (i.e., assume that every node is an endpoint of at least one demand) then the optimal solution must have at least n/2 edges, and hence we can again just use [5] to get a O(√n)- approximation for Directed Steiner Network with Distance Constraints as long as the demand graph is spanning. While this is in the centralized setting, since our algorithm for Directed k-Spanner is just a lightly modified distributed version of [5] (the only difficulty in the distributed setting is solving the 16 LP, which is why that is the main technical contribution of this paper), we can easily modify it to give the same approximation for Directed Steiner Network with Distance Constraints with spanning demand graphs. The only change is that we use D = max(u,v)∈S L(u, v) instead of k when solving the linear programming relaxation (using Theorem 9) and when truncating the shortest-path arborescences that we sample (note that we have to assume that D is global knowl- edge, which is reasonable for spanner problems and for Shallow-Light Steiner Network but may be less reasonable for other special cases of Directed Steiner Network with Distance Constraints). This implies Theorem 3, and all of the interesting special cases (Shallow-Light Steiner Network, Distance Preserver, Pairwise k-Spanner, etc.) which it includes. 6 Conclusion In this paper we presented a distributed algorithm for solving distance-bounded network design convex programs in the LOCAL model of distributed computation. This is one of the few classes of convex programs (along with positive linear programs and a few other special cases) for which we now have distributed algorithms. This class is particularly interesting since many state-of-the-art approximation algorithms for distance-bounded network design problems work by rounding one of these convex relaxations. So if we can solve the relaxation in a distributed fashion then it is often straightforward to give a distributed approximation algorithm which simply solves the re- laxation using our new distributed algorithm and then does the appropriate rounding. Using this framework, we provide distributed approximation algorithms for a variety of problems (e.g., for Di- rected k-Spanner, Lowest-Degree k-Spanner, Basic 3-Spanner, and Basic 4-Spanner) which use only polynomial-time computations at each node, achieve approximation ratios asymp- totically equal to the centralized algorithm, and have very low round complexity. Previous ap- proaches to these problems either use exponential-time computations at local nodes, or if they use only polynomial-time computations require either significantly larger round complexity or give asymptotically worse approximations. References [1] Amy Babay, Emily Wagner, Michael Dinitz, and Yair Amir. Timely, reliable, and cost-effective internet transport service using dissemination graphs. In 37th IEEE International Conference on Distributed Computing Systems, (ICDCS), pages 1–12, 2017. [2] Leonid Barenboim, Michael Elkin, and Cyril Gavoille. A fast network-decomposition algorithm and its applications to constant-time distributed computation. Theoretical Computer Science, 2016. [3] Yair Bartal. Probabilistic approximations of metric spaces and its algorithmic applications. In FOCS'96, pages 184–193, 1996. [4] Yair Bartal, John W. Byers, and Danny Raz. Global optimization using local information with applications to flow control. In FOCS, pages 303–312, 1997. [5] Piotr Berman, Arnab Bhattacharyya, Konstantin Makarychev, Sofya Raskhodnikova, and Grigory Yaroslavtsev. Improved approximation for the directed spanner problem. In ICALP Part I, pages 1–12, 2011. 17 [6] Eden Chlamt´ac and Michael Dinitz. Lowest-degree k-spanner: Approximation and hardness. Theory of Computing, 12(1):1–29, 2016. [7] Eden Chlamt´ac, Michael Dinitz, Guy Kortsarz, and Bundit Laekhanukit. Approximating spanners and directed steiner forest: Upper and lower bounds. In SODA, 2017. [8] Michael Dinitz, Guy Kortsarz, and Ran Raz. Label cover instances with large girth and the hardness of approximating basic k -spanner. ACM Trans. Algorithms, 12(2):1–16, 2016. [9] Michael Dinitz and Robert Krauthgamer. Directed spanners via flow-based linear programs. In STOC'11, pages 323–332, 2011. [10] Michael Dinitz and Robert Krauthgamer. Fault-tolerant spanners: better and simpler. In PODC'11, pages 169–178, 2011. [11] Michael Dinitz and Zeyu Zhang. Approximating low-stretch spanners. In Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA, 2016. [12] Yevgeniy Dodis and Sanjeev Khanna. Design networks with bounded pairwise distance. In STOC '99, pages 750–759, 1999. [13] Michael Elkin. Personal Communication, 2017. [14] Michael Elkin and Ofer Neiman. Distributed strong diameter network decomposition: Ex- tended abstract. In PODC '16, pages 211–216, 2016. [15] R. G. Gallager, P. A. Humblet, and P. M. Spira. A distributed algorithm for minimum-weight spanning trees. ACM Trans. Program. Lang. Syst., 5(1):66–77, January 1983. [16] Martin Grotschel, L´aszlo Lov´asz, and Alexander Schrijver. Geometric Algorithms and Com- binatorial Optimization, volume 2 of Algorithms and Combinatorics. Springer, 1988. [17] Anupam Gupta, Mohammad T. Hajiaghayi, and Harald Racke. Oblivious network design. In SODA '06, pages 970–979, 2006. [18] M. Reza Khani and Mohammad R. Salavatipour. Improved approximations for buy-at-bulk and shallow-light k-steiner trees and (k,2)-subgraph. Journal of Combinatorial Optimization, 31(2):669–685, Feb 2016. [19] Robert Krauthgamer, James R. Lee, Manor Mendel, and Assaf Naor. Measured descent: A new embedding method for finite metrics. In Proceedings of the 45th Annual IEEE Symposium on Foundations of Computer Science, FOCS, pages 434–443, 2004. [20] Fabian Kuhn, Thomas Moscibroda, and Roger Wattenhofer. The price of being near-sighted. In SODA '06, pages 980–989, 2006. [21] Nathan Linial and Michael Saks. Low diameter graph decompositions. Combinatorica, 13(4):441–454, Dec 1993. [22] Christos H. Papadimitriou and Mihalis Yannakakis. Linear programming without the matrix. In STOC '93, pages 121–129, 1993. [23] David Peleg. Distributed Computing: A Locality-Sensitive Approach. Society for Industrial and Applied Mathematics, 2000. 18 [24] David Peleg and Alejandro A. Schaffer. Graph spanners. Journal of Graph Theory, 13(1):99– 116, 1989. [25] David Peleg and Jeffrey D. Ullman. An optimal synchronizer for the hypercube. In PODC'87, pages 77–85, 1987. 19
1011.0108
11
1011
2011-05-17T11:38:44
An Active Learning Algorithm for Ranking from Pairwise Preferences with an Almost Optimal Query Complexity
[ "cs.DS" ]
We study the problem of learning to rank from pairwise preferences, and solve a long-standing open problem that has led to development of many heuristics but no provable results for our particular problem. Given a set $V$ of $n$ elements, we wish to linearly order them given pairwise preference labels. A pairwise preference label is obtained as a response, typically from a human, to the question "which if preferred, u or v?$ for two elements $u,v\in V$. We assume possible non-transitivity paradoxes which may arise naturally due to human mistakes or irrationality. The goal is to linearly order the elements from the most preferred to the least preferred, while disagreeing with as few pairwise preference labels as possible. Our performance is measured by two parameters: The loss and the query complexity (number of pairwise preference labels we obtain). This is a typical learning problem, with the exception that the space from which the pairwise preferences is drawn is finite, consisting of ${n\choose 2}$ possibilities only. We present an active learning algorithm for this problem, with query bounds significantly beating general (non active) bounds for the same error guarantee, while almost achieving the information theoretical lower bound. Our main construct is a decomposition of the input s.t. (i) each block incurs high loss at optimum, and (ii) the optimal solution respecting the decomposition is not much worse than the true opt. The decomposition is done by adapting a recent result by Kenyon and Schudy for a related combinatorial optimization problem to the query efficient setting. We thus settle an open problem posed by learning-to-rank theoreticians and practitioners: What is a provably correct way to sample preference labels? To further show the power and practicality of our solution, we show how to use it in concert with an SVM relaxation.
cs.DS
cs
arXiv:1011.0108v9 [cs.DS] 7 May 2011 An Active Learning Algorithm for Ranking from Pairwise Preferences with an Almost Optimal Query Complexity Nir Ailon May 10, 2011 Abstract We study the problem of learning to rank from pairwise preferences, and solve a long-standing open problem that has led to development of many heuristics but no provable results for our particular problem. The setting is as follows: We are given a set V of n elements from some universe, and we wish to linearly order them given pairwise preference labels. given two elements u, v V , a pairwise preference label is obtained as a response, typically from a human, to the question which if preferred, u or v? We assume no abstention, hence, either u is preferred to v (denoted u v) or the other way around. We also assume possible non-transitivity paradoxes which may arise naturally due to human mistakes or irrationality. The goal is to linearly order the elements from the most preferred to the least preferred, while disagreeing with as few pairwise preference labels as possible. Our performance is measured by two parameters: The loss (number of pairwise preference labes we disagree with) and the query complexity (number of pairwise preference labels we obtain). This is a typical learning problem, with the exception that the space from which the pairwise preferences is drawn is finite, consisting of n 2 possibilities only. Our algorithm reduces this problem to another problem, for which any standard learning black-box can be used. The advantage of the reduced problem compared to the original one is the fact that never more than O(n polylog(n, -1 )) labels are needed (including the query complexity of the reduction) in order to obtain the same risk that the same black-box would have incurred given access to all possible n 2 labels in the original problem, up to a multiplicative regret of (1 + ). The label sampling is adapative, hence, viewing our algorithm as a preconditioner for a learning black-box we arrive at an active learning algorithm with provable, almost optimal bounds. We also show that VC arguments give significantly worse query complexity bounds for the same regret in a non-adaptive sampling strategy. Our main result settles an open problem posed by learning-to-rank theoreticians and prac- titioners: What is a provably correct way to sample preference labels? To further show the power and practicality of our solution, we analyze a typical test case in which the learning black-box preconditioned by our algorithm is a regularized large margin linear classifier. Technion, [email protected] 1 Introduction We study the problem of learning to rank from pairwise preferences, and solve a long-standing open problem that has led to development of many heuristics but no provable results. The setting is as follows: We are given a set V of n elements from some universe, and we wish to linearly order them given pairwise preference labels. given two elements u, v V , a pairwise preference label is obtained as a response, typically from a human, to the question which if preferred, u or v? We assume no abstention, hence, either u is preferred to v (denoted u v) or the other way around. The goal is to linearly order the elements from the most preferred to the least preferred, while disagreeing with as few pairwise preference labels as possible. Our performance is measured by two parameters: The loss (number of pairwise preference labes we disagree with) and the query complexity (number of pairwise preference labels we obtain). This is a typical learning problem, with the exception that the sample space is finite, consisting of n 2 possibilities only. The loss minimization problem given the entire n × n preference matrix is a well known NP- hard problem called MFAST (minimum feedback arc-set in tournaments) [7]. Recently, Kenyon and Schudy [18] have devised a PTAS for it, namely, a polynomial (in n) -time algorithm computing a solution with loss at most (1 + ) the optimal, for and > 0 (the degree of the polynomial may depend on ). In our case each edge from the input graph is given for a unit cost. Our main algorithm is derived from Kenyon et al's algorithm. Our output, however, is not a solution to MFAST, but rather a reduction of the original learning problem to a different, simpler one. The reduced problem can be solved using any general ERM (empirical risk minimization) black-box. The sampling of preference labels from the original problem is adaptive, hence the combination of our algorithm and any ERM blackbox is an active learning one. We give examples with an SVM based ERM black-box toward the end, and show that our approach gives rise to a reduced SVM problem which provably approximates the original problem to within any arbitrarily small error relative to the original SVM optimal solution. The total number of pairwise preference labels acquired in the reduction and in the construction of the reduced SVM is significantly smaller than what a VC-dimension type argument would guarantee. Our setting defers from much of the learning to rank (LTR) literature. Usually, the labels used in LTR problems are responses to individual elements, and not to pairs of elements. A typical example is the 1..5 scale rating for restaurants, or 0, 1 rating (irrelevant/relevant) for candidate documents retrieved for a query (known as the binary ranking problem). The goal there is, as in ours, to order the elements while disagreeing with as little pairwise relations as possible, where a pairwise relation is derived from any two elements rated differently. Note that the underlying preference graph there is transitive, hence no combinatorial problem due to nontransitivity. In fact, some view the rating setting as an ordinal regression problem and not a ranking problem. Here the preference graph may contain cycles, and is hence agnostic with respect to the concept class we are allowed to output from, namely, permutations. We note that some LTR literature does consider the pairwise preference label approach, and there is much justification to it (see [8, 15] and reference therein). As far as we know, our work provides a sound solution to a problem addressed by machine learning practitioners (e.g. [8]) who use pairwise preferences as labels for the task of learning to rank items, but wish to avoid obtaining labels for the quadratically many preference pairs, without compromising low error bounds. We also show that the fear of quadraticity found in much work dealing with pairwise preference based learning to rank (e.g., from Crammer et. al [10] the [pairwise] approach is time consuming since it requires increasing the sample size ... to O(n 2 )) 1 is unfounded in the light of new advances in combinatorial optimization [1, 18]. It is important to note a significant difference between our work and Kenyon and Schudy's PTAS [18], which is also the difference between the combinatorial optimization problem and the learning counterpart. A good way to explain this to to compare two learners, Alice and Bob. On the first day, Bob queries all n 2 pairwise preference labels and sends them to a perfect solver for MFAST. Alice uses our work to query only O(n polylog(n, -1 )) preference labels amd obtains a decomposition of the original input V into an ordered list of sub-problems V 1 , . . . , V k where each V i is contained in V . Using the same optimizer for each part and concatenating the individual output permutations, Alice will incur a loss of at most (1 + ) that of Bob. So far Alice might not gain much, because the decomposition may consist of a single block, hence no reduction. The next day, Bob realizes that his MFAST solver cannot deal with large inputs because he is trying to solve an NP-Hard problem. Also, he seeks a multiplicative regret of (1 + ) with respect to the optimal solution (we also say a relative regret of ), and his sought is too small to use the PTAS. 1 To remedy this, he takes advantage of the fact that the set V does not merely consist of abstract elements, but rather each u V is endowed with a feature vector (u) and hence each pair of points u, v is endowed with the combined feature vector ((u), (v)). As in typical learning, he posits that the order relation between u, v can be deduced from a linear function of ((u), (v)), and invokes an optimizer (e.g. SVM) on the relaxed problem, with all pairs as input. Note that Bob may try to sample pairs uniformly to reduce the query complexity (and, perhaps, the running time of the relaxed solver), but as we show below, he will be discouraged from doing so because in certain realistic cases a relative regret of may entail sampling the entire pairwise preference space. Alice uses the same relaxed optimizer, say, SVM. The labels she sends to the solver consist of a uniform sample of pairs from each block V i , together with all pairs u, v residing in separate blocks from her aforementioned construction decomposition. From the former label type she would need only O(n polylog(n, -1 )) many, because (per our decomposition design) within the blocks the cost of any solution is high, and hence a relative error is tantamount to an absolute error of similar magnitude, for which simple VC bounds allow low query complexity. From the latter label type, she would generate a label for all pairs u, v in distinct V i , V j , using a "made up" label corresponding to the order of V i , V j (recall that the decomposition is ordered). Since both Bob and Alice used SVM with the same feature vectors (and the same regularization), there is no reason to believe that the additional cost incurred by the relaxation inaccuracies would hurt neither Bob nor Alice more than the other. The same statement applies to any relaxation (e.g. decision trees), though we will make a quantitative statement for the case of large margin linear classifiers below. Among other changes to Kenyon and Schudy's algorithm, a key technique is to convert a highly sensitive greedy improvement step into a robust approximate one, by careful sampling. The main difficulty stems from the fact that after a single greedy improvement step, the sample becomes stale and requires refereshing. We show a query efficient refreshing technique that allows iterated approximate greedy improvement steps. Interestingly, their original analysis is amenable to this change. It is also interesting to note that the sampling scheme used for identifying greedy improvement steps for a current solution are similar to ideas used by Ailon et. al [2, 3] and Halevy et. al [13] in the context of property testing and reconstruction, where elements are sampled from exponentially growing intervals in a linear order. Ailon et. al's 3-approximation algorithm for MFAST using QuickSort [1] is used in Kenyon et. al [18] as well as here as an initialization step. Note that this is a sublinear algorithm. In fact, it 1 The running time of the PTAS is exponential in - 1 . 2 samples only O(n log n) pairs from the n 2 possible, on expectation. Note also that the pairs from which we query the preference relation in QuickSort are chosen adaptively. 2 Notation and Basic Lemmata 2.1 The Learning Theoretical Problem Let V denote a finite set that we wish to rank. In a more general setting we are given a sequence V 1 , V 2 , . . . of sets, but there is enough structure and interest in the single set case, which we focus on in this work. Denote by n the cardinality of V . We assume there is an underlying preference function W on pairs of elements in V , which is unknown to us. For any ordered pair u, v V , the preference value W (u, v) takes the value of 1 if u is deemed preferred over v, and 0 otherwise. We enforce W (u, v) + W (v, u) = 1, hence, (V, W ) is a tournament. We assume that W is agnostic in the sense that it does not necessarily encode a transitive preference function, and may contain errors and inconsistencies. For convenience, for any two real numbers a, b we will let [a, b] denote the interval {x : a x b} if a b and {x : b x a} otherwise. Assume now that we wish to predict W using a hypothesis h from some concept class H. The hypothesis h will take an ordered pair (u, v) V as input, and will output label of 1 to assert that u precedes v and 0 otherwise. We want H to contain only consistent hypotheses, satisfying transitivity (i.e. if h(u, v) = h(v, w) = 1 then h(u, w) = 1). A typical way to do this is using a linear score function: Each u V is endowed with a feature vector (u) in some RKHS H, a weight vector w H is used for parametrizing each h w H, and the prediction is as follows: 2 h w (u, v) = 1 w, (u) > w, (v) 0 w, (u) < w, (v) 1 u<v otherwise . Our work is relevant, however, to nonlinear hypothesis classes as well. We denote by (V ) the set permutations on the set V , hence we always assume H (V ). (Permutations are naturally viewed as binary classifiers of pairs of elements via the preference predicate: The notation is, (u, v) = 1 if and only if u v, namely, if u precedes v in . Slightly abusing notation, we also view permutations as injective functions from [n] to V , so that the element (1) V is in the first, most preferred position and (n) is the least preferred one. We also define the function inverse to as the unique function satisfying ( (v)) = v for all v V . Hence, u v is equivalent to (u) < (v). ) As in standard ERM setting, we assume a non-negative risk function C u,v penalizing the error of h with respect to the pair u, v, namely, C u,v (h, V, W ) = 1 h(u,v)=W (u,v) . The total loss, C(h, V, W ) is defined as C u,v summed over all unordered u, v V . Our goal is to devise an active learning algorithm for the purpose of minimizing this loss. In this paper we find an almost optimal solution to the problem using important breakthroughs in combinatorial optimization of a related problem called minimum feedback arc-set in tournaments 2 We assume that V is endowed with an arbitrary linear order relation, so we can formally write u < v to arbitrarily yet consistently break ties. 3 (MFAST). The relation between this NP-Hard problem and our learning problem has been noted before [9], but no provable almost optimal active learning has been devised, as far as we know. 2.2 The Combinatorial Optimization Counterpart MFAST is defined as follows: Assume we are given V and W and its entirety, in other words, we pay no price for reading W . The goal is to order the elemtns of V in a full linear order, while minimizing the total pairwise violation. More precisely, we wish to find a permutation on the elements of V such that the total backward cost: C(, V, W ) = u v W (v, u) (2.1) is minimized. The expression in (2.1) will be referred to as the MFAST cost henceforth. When W is given as input, this problem is known as the minimum feedback arc-set in tour- naments (MFAST). A PTAS has been discovered for this NP-Hard very recently [18]. Though a major theoretical achievement from a combinatorial optimization point of view, the PTAS is not useful for the purpose of learning to rank from pairwise preferences because it is not query efficient. Indeed, it may require in some cases to read all quadratically many entries in W . In this work we fix this drawback, while using their main ideas for the purpose of machine learning to rank. We are not interested in MFAST per se, but use the algorithm in [18] to obtain a certain useful decomposition of the input (V, W ) from which our main active learning result easily follows. Definition 2.1. Given a set V of size n, an ordered decomposition is a list of pairwise disjoint subsets V 1 , . . . , V k V such that k i=1 V i = V . For a given decomposition, we let W V i denote the restriction of W to V i × V i for i = 1, . . . , k. Similarly, for a permutation (v) we let V i denote the restriction of the permutation to the elements of V i (hence, V i (V i )). We say that (V ) respects V 1 , . . . , V k if for all u V i , v V j , i < j, u v. We denote the set of permutations (V ) respecting the decomposition V 1 , . . . , V k by (V 1 , . . . , V k ). We say that a subset U of V is small in V if U log n/log log n, otherwise we say that U is big in V . A decomposition V 1 , . . . , V k is -good with respect to W if: 3 · Local chaos: min (V ) i:V i big in V C( V i , V i , W V i ) 2 i:V i big in V n i 2 . (2.2) · Approximate optimality: min (V 1 ,...,V k ) C(, V, W ) (1 + ) min (V ) C(, V, W ) . (2.3) Intuitively, an -good decomposition identifies a block-ranking of the data that is difficult to rank in accordance with W internally on average among big blocks (local chaos), yet possible to rank almost optimally while respecting the decomposition (approximate optimality). We show how to take advantage of an -good decomposition for learning in Section 2.3. The ultimate goal will be to find an -good decomposition of the input set V using O(polylog(n, -1 )) queries into W . 3 We will just say -good if W is clear from the context. 4 2.3 Basic Results from Statistical Learning Theory In statistical learning theory, one seeks to find a classifier minimizing an expected cost incurred on a random input by minimizing the empirical cost on a sample thereof. If we view pairs of elements in V as data points, then the MFAST cost can be cast, up to normalization, as an expected cost over a random draw of a data point. Recall our notation of (u, v) denoting the indicator function for the predicate u v. Thus is viewed as a binary hypothesis function over V 2 , and (V ) can be viewed as the concept class of all binary hypotheses satisfying transitivity: (u, v)+(v, y) (u,y) for all u, v, y. A sample E of unordered pairs gives rise to a partial cost, C E defined as follows: Definition 2.2. Let (V, E) denote an undirected graph over V , which may contain parallel edges (E is a multi-set). The partial MFAST cost C E () is defined as C E (, V, W ) = n 2 E-1 (u,v)E u< v W (v, u) . (The accounting of parallel edges in E is clear.) The function C E ( ·,·,·) can be viewed as an empirical unbiased estimator of C(, V, W ) if E V 2 is chosen uniformly at random among all (multi)subsets of a given size. The basic question in statistical learning theory is, how good is the minimizer of C E , in terms of C? The notion of VC dimension [19] gives us a nontrivial bound which is, albeit suboptimal (as we shall soon see), a good start for our purpose. Lemma 2.3. The VC dimension of the set of permutations on V , viewed as binary classifiers on pairs of elements, is n - 1. It is easy to show that the VC dimension is at most O(n log n). Indeed, the number of per- mutations is at most n!, and the VC dimension is always bounded by the log of the concept class cardinality. That the bound is linear was proven in [6]. We present the proof here in Appendix A for completeness. The implications of the VC bound are as follows. Proposition 2.4. Assume E is chosen uniformly at random (with repetitions) as a sample of m elements from V 2 , where m > n. Then with probability at least 1 - over the sample, all permutations satisfy: C E (, V, W ) - C(,V,W) = n 2 O n log m + log(1/) m . The consequence of Proposition 2.4 are as follows: If we want to minimize C(, V, W ) over to within an additive error of µn 2 , and succeed in doing so with probability at least 1 -, it is enough to choose a sample E of O(µ -2 (n log n + log -1 )) elements from V 2 uniformly at random (with repetitions), and optimize C E (, V, W ). Assume from now on that is at least e -n , so that we get a more manageable sample bound of O(µ -2 n log n). Before turning to optimizing C E (, V, W ), a hard problem in its own right [17, 12], we should first understand whether this bound is at all good for various scenarios. We need some basic notions of distance between permutations. For two permutations , , the Kendall-Tau distance d (, ) is defined as d (, ) = u=v 1 [(u v) (v u)] . 5 The Spearman Footrule distance d foot (, ) is defined as d foot (, ) = u (u) - (u) . The following is a well known inequality due to Graham and Diaconis [11] relating the two distance measures for all , : d (, ) d foot (, ) 2d (, ) . (2.4) Clearly d and d foot are metrics. It is also clear that C( ·,V,·) is an extension of d ( ·,·) to distances between permutations and binary tournaments, with the triangle inequality of the form d (, ) C(,V,W) + C(,V,W) satisfied for all W and , (V ). Assume now that we are able, using Proposition 2.4 and the ensuing comment, to find a solution for MFAST, with an additive regret of O(µn 2 ) with respect to an optimal solution for some µ > 0. The triangle inequality implies that the distance d (, ) between our solution and the true optimal is (µn 2 ). By (2.4), this means that d foot (, ) = (µn 2 ). By the definition of d foot , this means that the averege element v V is translated (µn) positions away from its position in . In a real life application (e.g. in information retrieval), one may want elements to be at most a constant positions away from their position in a correct permutation. This translates to a sought regret of O(n) in C(, V, W ), or, using the above notation, to µ = /n. Clearly, Proposition 2.4 cannot guarantee less than a quadratic sample size for such a regret, which is tantamount to querying W in its entirety. W e can do better: In this work, for any > 0 we will achieve a regret of O(C( , V, W )) using O(polylog(n, -1 )) queries into W , regardless of how small the optimal cost C( , V, W ) is. Hence, our regret is relative to the optimal loss. This is clearly not achievable using Proposition 2.4. Before continuing, we need need a slight generalization of Proposition 2.4. Proposition 2.5. Let V 1 , . . . , V k be an ordered decomposition of V . Let B denote the set of indices i [k] such that V i is big in V . Assume E is chosen uniformly at random (with repetitions) as a sample of m elements from iB V i 2 , where m > n. For each i = 1, . . . , k, let E i = E V i 2 . Define C E (, {V 1 , . . . , V k },W) to be C E (, {V 1 , . . . , V k },W) = iB n i 2 E-1 iB n i 2 -1 E i C E i ( V i , V i , W V i ) . (2.5) (The normalization is defined so that the expression is an unbiased estimator of iB C( V i , V i , W V i ). If E i = 0 for some i, formally define n i 2 -1 E i C E i ( V i , V i , W V i ) = 0.) Then with probability at least 1 - e -n over the sample, all permutations (V ) satisfy: C E (, {V 1 , . . . , V k },W) - iB C( V i , V i , W V i ) = iB n i 2 O n log m + log(1/) m . Proof. Consider the set of binary functions iB (V 1 ) on the domain iB V i × V i , defined as follows: If u, v V j × V j for some j B, then (( i ) iB ) (u, v) = j (u, v) . It is clear that the VC dimension of this function set is at most the sum of the VC dimensions of {(V i ) } iB , hence by Lemma 2.3 at most n. The result follows. 6 2.4 Using an -Good Partition The following lemma explains why an -good partition is good for our purpose. Lemma 2.6. Fix > 0 and assume we have an -good partition (Definition 2.1) V 1 , . . . , V k of V . Let B denote the set of i [k] such that V i is big in V , and let ¯ B = [k] \ B. Let n i = V i for i = 1, . . . , n, and let E denote a random sample of O( -6 n log n) elements from iB V i 2 , each element chosen uniformly at random with repetitions. Let E i denote E V i 2 . Let C E (, {V 1 , . . . , V k },W) be defined as in (2.5). For any (V 1 , . . . , V k ) define: C() := C E (, {V 1 , . . . , V k },W) + i ¯ B C( V i , V i , W V i ) + 1i<jk (u,v)V i ×V j 1 v u . Then the following event occurs with probability at least 1 - e -n : For all (V 1 , . . . , V k ), C() - C(,V,W) min (V ) C(, V, W ) . (2.6) Also, if is any minimizer of C( ·) over (V 1 , . . . , V k ), then C( , V, W ) (1 + 2) min (V ) C(, V, W ) . (2.7) Before we prove the lemma, let us discuss its consequences: Given an -good decomposition V 1 , . . . , V k of V , the theorem implies that if we could optimize C() over (V 1 , . . . , V k ), we would obtain a permutation with a relative regret of 2 with respect to the optimizer of C( ·,V,W) over (V ). Optimizing i B C( V i , V i , W V i ) is easy: Each V i is of size at most log n/ log log n, hence exhaustively searching its corresponding permutation space can be done in polynomial time. In order to compute the cost of each permutation inside the small sets V i , we would need to query W V i in its entirety. This incurs a query cost of at most i ¯ B n i 2 = O(n log n/ log log n), which is dominated by the cost of obtaining the -good partition in the first place (see next sect section). Optimizing C E (, {V 1 , . . . , V k },W) given E is a tougher nut to crack, and is known as the minimum feedback arc-set (MFAS) problem and considered much harder than to harder than MFAST [17, 12]. For now we focus on query and not computational complexity, and notice that the size E = O( -4 n log n) of the sample set is all we need. In Section 4 we show a counterpart of Lemma 2.6 which provides similar guarantees for practitioners who choose to relax it using SVM, for which fast solvers exist. If we assume, in addition, that the decomposition could be computed using O(n polylog(n, -1 )) labels (as we indeed show in the next section), then we would clearly beat the aforementioned VC bound whenever the optimal solution min (V ) C(, V, W ) is at most O(n 2- ), for any > 0. Proof. For any permutation (V 1 , . . . , V k ), it is clear that C() - C(,V,W) = C E (, {V 1 , . . . , V k },W) - iB C( V i , V i , W V i ) . By Proposition 2.5, with probability at least 1 - e -n the absolute value of the RHS is bounded by 3 iB n i 2 , which is at most min (V ) C(, V, W ) by (2.2). This establishes (2.6). Inequality (2.7) is obtained from (??) together with (2.3) and the triangle inequality. 7 3 A Query Efficient Algorithm for -Good Decomposing The section is dedicated to proving the following: Theorem 3.1. Given a set V of size n, a preference oracle W and an error tolerance parameter 0 < < 1, there exists a polynomial time algorithm which returns, with constant probabiliy, an -good partition of V , querying at most O( -6 n log 5 n) locations in W on expectation. The running time of the algorithm (counting computations) is O(polylog(n, -1 )). Before describing our algorithm, we need some definitions. Definition 3.2. Let denote a permutation over V . Let v V and i [n]. We define vi to be the permutation obtained by moving the rank of v to i in , and leaving the rest of the elements in the same order. For example, if V = {x,y,z} and ((1),(2),(3)) = (x,y,z), then ( x3 (1), x3 (2), x3 (3)) = (y, z, x). Definition 3.3. Fix a permutation over V , an element v V and an integer i [n]. We define the number TestMove(, V, W, v, i) as the decrease in the cost C( ·,V,W) achieved by moving from to vi . More precisely, TestMove(, V, W, v, i) = C(, V, W ) - C( vi , V, W ) . Equivalently, if i (v) then TestMove(, V, W, v, i) = u: (u)[ (v)+1,i] (W uv - W vu ) . A similar expression can be written for i < (v). Now assume that we have a multi-set E V 2 . We define TestMove E (, V, W, v, i), for i (v), as TestMove E (, V, W, v, i) = i - (v) E u:(u,v) E (W (u, v) - W(v,u)) , where the multiset E is defined as {(u,v) E : (u) [ (v) + 1, i] }. Similarly, for i < (v) we define TestMove E (, V, W, v, i) = i - (v) E u:(u,v) E (W (v, u) - W(u,v)) , (3.1) where the multiset E is now defined as {(u,v) E : (u) [i, (v) - 1]}. Lemma 3.4. Fix a permutation over V , an element v V , an integer i [n] and another integer N . Let E V 2 be a random (multi)-set of size N with elements (v, u 1 ), . . . , (v, u N ), drawn so that for each j [N] the element u j is chosen uniformly at random from among the elements lying between v (exclusive) and position i (inclusive) in . Then E[TestMove E (, V, W, v, i)] = TestMove(, V, W, v, i). Additionally, for any > 0, except with probability of failure , TestMove E (, V, W, v, i) - TestMove(,V,W,v,i) = O i - (v) log -1 N . The lemma is easily proven using e.g. Hoeffding tail bounds, using the fact that W(u,v) 1 for all u, v. 8 3.1 The Decomposition Algorithm Our decomposition algorithm SampleAndRank is detailed in Algorithm 1, with subroutines in Al- gorithms 2 and 3. It can be viewed as a query efficient improvement of the main algorithm in [18]. Another difference is that we are not interested in an approximation algorithm for MFAST: Whenever we reach a small block (line 3) or a big block with a probably approximately suffi- ciently high cost (line 8) in our recursion of Algorithm 2), we simply output it as a block in our partition. Denote the resulting outputted partition by V 1 , . . . , V k . Denote by the minimizer of C( ·,V,W) over (V 1 , . . . , V k ). Most of the analysis is dedicated to showing that C(, V, W ) (1 + ) min (V ) C(, V, W ), thus establishing (2.3). In order to achieve an efficient query complexity compared to [18], we use procedure ApproxLocalImprove (Algorithm 3) to replace a greedy local improvement step in [18] which is not query efficient. Aside from the aforementioned differences, we also raise here the reader's awareness to the query efficiency of QuickSort, which was established by Ailon et al. in [5] (note: an erroneous proof appears in [4]). SampleAndRank (Algorithm 1) takes the following arguments: The set V we want to rank, the preference matrix W and an accuracy argument . It is implicitly understood that the argument W passed to SampleAndRank is given as a query oracle, incurring a unit cost upon each access to a matrix element by the procedure and any nested calls. The first step in SampleAndRank is to obtain an expected constant factor approximation to MFAST on V, W , incurring an expected low query cost. More precisely, this step returns a random permutation with an expected cost of O(1) times that of the optimal solution to MFAST on V, W . The query complexity of this step is O(n log n) on expectation [5]. Before continuing, we make the following assumption, which holds with constant probability using Markov probability bounds. Assumption 3.5. The cost C(, V, W ) of the initial permutation computed line 2 of SampleAndRank is at most O(1) times that of the optimal solution to MFAST on (V, W ), and the query cost incurred in the computation is O(n log n). Following QuickSort, a recursive procedure SampleAndDecompose is called. It implements a divide-and-conquer algorithm. Before branching, it executes the following steps. Lines 5 to 9 are responsible for identifying local chaos, with sufficiently high probability. The following line 10 calls a procedure ApproxLocalImprove (Algorithm 3) which is responsible for performing query-efficient approximate greedy steps. We devote the next Sections 3.2-3.4 to describing this procedure. The establishment of the -goodness of SampleAndRank's output (establishing (2.3)) is deferred to Section 3.5. 3.2 Approximate local improvement steps The procedure ApproxLocalImprove takes as input a set V of size N , the preference oracle W , a permutation on V , two numbers C 0 , and an integer n. The number n is the size of the input in the root call to SampleAndDecompose, passed down in the recursion, and used for the purpose of controlling the success probability of each call to the procedure (there are a total of O(n log n) calls, and a union bound will be used to bound a failure probability, hence each call may fail with probability inversely polynomial in n). The goal of the procedure is to repeatedly identify, with high probability, single vertex moves that considerably decrease the cost. Note that in Mathieu et. al's PTAS [18], a crucial step in their algorithms entails identifying single vertex 9 moves that decrease the cost by a magnitude which, given our sought query complexity, would not be detectable. Hence, our algorithm requires altering this crucial part in their algorithm. The procedure starts by creating a sample ensemble S = {E v,i : v V,i [B,L]}, where B = log (N/log n) and L = log N. The size of each E v,i S is ( -2 log 2 n), and each element (v, x) E v,i was added (with possible multiplicity) by uniformly at random selecting, with repetitions, an element x V positioned at distance at most 2 i from the position of v in . Let D denote the distribution space from which S was drawn, and let Pr XD [X = S] denote the probability of obtaining a given sample ensemble S. We want S to enable us to approximate the improvement in cost obtained by moving a single element u to position j. Definition 3.6. Fix u V and j [n], and assume log j - (u) B. Let = log j - (u) . We say that S is successful at u,j if {x : (u,x) E u, } {x : (x) [ (u), j] } = ( -2 log 2 n) . In words, success of S at u,j means that sufficiently many samples x V such that (x) is between (u) and j are represented in E u, . Conditioned on S being successful at u,j, note that the denominator of TestMove E (defined in (3.1)) does not vanish, and we can thereby define: Definition 3.7. S is a good approximation at u,j if TestMove E u, (, V, W, u, j) - TestMove(,V,W,u,j) 1 2 j - (u) /log n , where is as in Definition 3.6. In words, S being a good approximation at u,j allows us to approximate a quantity of interest TestMove(, V, W, u, j), and to detect whether it is sufficiently large, and more precisely, at least ( j - (u) /log n). Definition 3.8. We say that S is a good approximation if it is succesful and a good approximation at all u V , j [n] satisfying log j - (u) [B,L]. Using Chernoff bounds to ensure that S is successful u,j as in Definition 3.8, then using Hoeffding to ensure that S is a good approximation at all such u,j and finally union bounding we get Lemma 3.9. Except with probability 1 - O(n -4 ), S is a good approximation. Algorithm 1 SampleAndRank(V, W, ) 1: n V 2: Expected O(1)-approx solution to MFAST using O(nlog n) W-queries on expectation using QuickSort [1] 3: return SampleAndDecompose(V, W, , n, ) 3.3 Mutating the Pair Sample To Reflect a Single Element Move Line 17 in ApproxLocalImprove requires elaboration. In lines 15-20, we check whether there exists an element u and position j, such that moving u to j (giving rise to uj ) would considerably 10 Algorithm 2 SampleAndDecompose(V, W, , n, ) 1: N V 2: if N log n/log log n then 3: return trivial partition {V } 4: end if 5: E random subset of O( -4 log n) elements from V 2 (with repetitions) 6: C C E (, V, W ) (C is an additive O( 2 N 2 ) approximation of C w.p. 1 - n -4 ) 7: if C = ( 2 N 2 ) then 8: return trivial partition {V } 9: end if 10: 1 ApproxLocalImprove(V,W,,,n) 11: k random integer in the range [N/3,2N/3] 12: V L {v V : (v) k}, L restriction of 1 to V L 13: V R V \ V L , R restriction of 1 to V R 14: return concatenation of decomposition SampleAndDecompose(V L , W, , n, L ) and decompo- sition SampleAndDecompose(V R , W, , n, R ) Algorithm 3 ApproxLocalImprove(V, W, , , n) (N ote: used as both input and output) 1: N V , B log((N/log n), L log N 2: if N = O( -3 log 3 n) then 3: return 4: end if 5: for v V do 6: r (v) 7: for i = B . . . L do 8: E v,i 9: for m = 1..( -2 log 2 n) do 10: j integer uniformly at random chosen from [max{1,r - 2 i },min{n,r + 2 i }] 11: E v,i E v,i {(v,(j))} 12: end for 13: end for 14: end for 15: while u V and j [n] s.t. (setting := log j - (u) ): [B,L] and TestMove E u, (, V, W, u, j) > j - (u) /log n do 16: for v V and i [B,L] do 17: refresh sample E v,i with respect to the move u j (see Section 3.3) 18: end for 19: uj 20: end while improve the MFAST cost of the procedure input, based on a high probability approximate calcu- lation. The approximation is done using the sample ensemble S. If such an element u exists, we 11 execute the exchange uj . With respect to the new value of the permutation , the sample ensemble S becomes stale. By this we mean, that if S was a good approximation with respect to , then it is no longer necessarily a good approximation with respecto to uj . We must refresh it. Before the next iteration of the while loop, we perform in line 17 a transformation uj to S, so that the resulting sample ensemble uj ( S) is distributed according to D uj . More precisely, we will define a transformation such that uj ( D ) = D uj , (3.2) where the left hand side denotes the distribution obtained by drawing from D and applying uj to the result. The transformation uj is performed as follows. Denoting uj ( S) = S = {E v,i : v V,i [B,L]}, we need to define each E v,i . Definition 3.10. We say that E v,i is interesting in the context of and uj if the two sets T 1 , T 2 defined as T 1 = {x V : (x) - (v) 2 i } (3.3) T 2 = {x V : uj (x) - uj (v) 2 i } (3.4) differ. We set E v,i = E v,i for all v, i for which E v,i is not interesting. Observation 3.11. There are at most O( (u) -jlog n) interesting choices of v,i. Additionally, if v = u, then for T 1 , T 2 as in Definition 3.10, T 1 T 2 = O(1), where denotes symmetric difference. Fix one interesting choice v, i. Let T 1 , T 2 be as in Defintion 3.10. By the last observation, each of T 1 and T 2 contains O(1) elements that are not contained in the other. Assume T 1 = T 2 , let X 1 = T 1 \ T 2 , and X 2 = T 2 \ T 1 . Fix any injection : X 1 X 2 , and extend : T 1 T 2 so that (x) = x for all x T 1 T 2 . Finally, define E v,i = {(v,(x)) : (v,x) E v,i } . (3.5) (The case T 1 = T 2 may occur due to the clipping of the ranges [ (v) - 2 i , (v) + 2 i ] and [ uj (v) - 2 i , uj (v) + 2 i ] to a smaller range. This is a simple technicality which may be taken care of by formally extending the set V by N additional elements v L 1 , . . . , v L N , extending the definition of for all permutation on V so that (v L a ) = -a + 1 for all a and similarly N = V additional elements ~v R 1 , . . . , v R N such that (v R a ) = N + a. Formally extend W so that W (v, v L a ) = W (v L a , v) = W (v, v R a ) = W (v R a , v) = 0 for all v V and a. This eliminates the need for clipping ranges in line 10 in ApproxLocalImprove.) Finally, for v = u we create E v,i from scratch by repeating the loop in line 7 for that v. It is easy to see that (3.2) holds. We need, however, something stronger that (3.2). Since our analysis assumes that S D is successful, we must be able to measure the distance (in total variation) between the random variable ( D success) defined by the process of drawing from D and conditioning on the result's success, and D uj . By Lemma 3.9, the total variation distance between ( D success) and D uj is O(n -4 ). Using a simple chain rule argument, we conclude the following: 12 Lemma 3.12. Fix 0 on V of size N , and fix u 1 , . . . , u k V and j 1 , . . . , j k [n]. Consider the following process. We draw S 0 from D 0 , and define S 1 = u 1 j 1 ( S 0 ), S 2 = u 2 j 2 ( S 1 ), ··· ,S k = u k j k ( S k-1 ) 1 = 0 u 1 j 1 , 2 = 1 u 2 j 2 , ··· , k = k-1 u k j k . Consider the random variable S k conditioned on S 0 , S 1 , . . . , S k-1 being successful for 0 , . . . , k-1 , respectively. Then the total variation distance between the distribution of S k and the distribution D k is at most O(kn -4 ). 3.4 Bounding the query complexity of computing uj ( S) We now need a notion of distance between S and S , measuring how many extra pairs were intro- duced ino the new sample family. These pairs may incur the cost of querying W . We denote this measure as dist( S,S ), and define it as dist( S,S ) := v,i E v,i E v,i . Lemma 3.13. Assume S D for some permutation , and S = uj . Then E[dist( S,S )] = O( -3 log 3 n). Proof. Denote S = {E v,i } and S = {E v,i }. Fix some v = u. By construction, the sets E v,i for which E v,i = E v,i must be interesting, and there are at most O( (u) - jlog n) such, using Observation 3.11. Fix such a choice of v, i. By (3.5), E v,i will indeed differ from E v,i only if it contains an element (v, x) for some x T 1 \ T 2 . But the probability of that is at most 1 - (1 - O(2 -i )) ( - 2 log 2 n) 1 - e -( - 2 2 - i log 2 n) = O( -2 2 -i log 2 n) (We used the fact that i B, where B is as defined in line 1 of ApproxLocalImprove, and N = ( -3 log 3 n) as guaranteed in line 3 of ApproxLocalImprove.) Therefore, the expected size of E v,i E v,i (counted with multiplicities) is O( -2 2 -i log 2 n). Now consider all the interesting sets E v 1 .i 1 , . . . , E v P ,i P . For each possible value i it is easy to see that there are at most 2 (u) - j p's for which i p = i. Therefore, E P p=1 E v p ,i p E v p ,i p = O -2 (u) - jlog 2 n L i=B 2 -i , where B, L are defined in line 1 in ApproxLocalImprove. Sum- ming over i [B,L], we get at most O( -3 (u) -jlog 3 n/N ). For v = u, the set {E v,i } is drawn from scratch, clearly contributing O( -2 log 3 n) to dist( S,S ). The claim follows. 3.5 Analysis of SampleAndDecompose Throughout the execution of the algorithm, various high probability events must occur in order for the algorithm guarantees to hold. Let S 1 , S 2 , . . . denote the sample families that are given rise to through the executions of ApproxLocalImprove, either between lines 5 and 14, or as a mutation done between lines 15 and 20. We will need the first (n 4 ) to be good approximations, based on Definition 3.8. Denote this favorable event E 1 . By Lemma 3.12, and using a union bound, with constant probability (say, 0.99) this happens. We also need the cost approximation C obtained in line 5 to be successful. Denote this favorable event E 2 . By Hoeffding tail bounds, this happens with probability 1 - O(n -4 ) for each execution of the line. This line is obviously executed at most O(n log n) times, and hence we can lower bound the probability of success of all executions by 0.99. From now throughout, we make the following assumption, which is true by the above with probability at least 0.97. 13 Assumption 3.14. Events E 1 and E 2 hold true. Note that by conditioning the remainder of our analysis on this assumption may bias some expectation upper bounds derived earlier and in what follows. This bias can multiply the estimates by at most 1/0.97, which can be absorbed in the O-notation of these bounds. Let denote the optimal permutation for the root call to SampleAndDecompose with V, W, . The permutation is, by Assumption 3.5, a constant factor approximation for MFAST on V, W . Using the triangle inequality, we conclude that d (, ) C(,V,W) + C( , V, W ) Hence, E[d (, )] = O(C( , V, W )) . From this we conclude, using (2.4), that E[d foot (, )] = O(C( , V, W )) . Now consider the recursion tree T of SampleAndDecompose. Denote I the set of internal nodes, and by L the set of leaves (i.e. executions exiting from line 8). For a call SampleAndDecompose corresponding to a node X in the recursion tree, denote the input arguments by (V X , W, , n, X ). Let L[X], R[X] denote the left and right children of X respectively. Let k X denote the integer k in 11 in the context of X I. Hence, by our definitions, V L[X] , V R[X] , L[X] and R[X] are precisely V L , V R , L , R from lines 12-13 in the context of node X. Take, as in line 1, N X = V X . Let X denote the optimal MFAST solution for instance (V X , W V X ). By E 1 we conclude that the first (n 4 ) times in which we iterate through the while loop in ApproxLocalImprove (counted over all calls to ApproxLocalImprove), the cost of X uj is an actual improvement compared to X (for the current value of X , u and j in iteration), and the improvement in cost is of magnitude at least ( X (u) - j/log n), which is ( 2 N X / log 2 n) due to the use of B defined in line 1. But this means that the number of iterations of the while loop in line 15 of ApproxLocalImprove is O( -2 C( X , V X , W V X ) log 2 n/N X ). Indeed, otherwise the true cost of the running solution would go below 0. Since C( X , V X , W V X ) is at most N X 2 , the number of iterations is hence at most O( -2 N X log 2 n). By Lemma 3.13 the expected query complexity incurred by the call to ApproxLocalImprove is therefore O( -5 N X log 5 n). Summing over the recursion tree, the total query complexity incurred by calls to ApproxLocalImprove is, on expectation, at most O( -5 n log 6 n). Now consider the moment at which the while loop of ApproxLocalImprove terminates. Let 1X denote the permutation obtained at that point, returned to SampleAndDecompose in line 10. We classify the elements v V X to two families: V short X denotes all u V X s.t. 1X (u) - X (u) = O(N X / log n), and V long X denotes V X \ V short X . We know, by assumption, that the last sample ensemble S used in ApproxLocalImprove was a good approximation, hence for all u V long X , TestMove( 1X , V X , W V X , u, X (u)) = O( 1X (u) - X (u) /log n). (3.6) Definition 3.15 (Kenyon and Schudy [18]). For u V X , we say that u crosses k X if the interval [ 1X (u), X (u)] contains the integer k X . Let V cross X denote the (random) set of elements u V X that cross k X as chosen in line 11. We define a key quantity T X as in [18] as follows: T X = uV cross X TestMove( 1X , V X , W V X , u, X (u)) . (3.7) 14 Following (3.6), the elements u V long X can contribute at most O uV long X 1X (u) - X (u) /log n to T X . Hence the total contribution from such elements is, by definition O(d foot ( 1X , X )/ log n) which is, using (2.4) at most O(d ( 1X , X )/ log n). Using the triangle inequality and the definition of X , the last expression, in turn, is at most O(C( 1X , V X , W V X )/ log n). We now bound the contribution of the elements u V short X to T X . The probability of each such element to cross k is O( 1X (u) - X (u) /N X ). Hence, the total expected contribution of these elements to T X is O uV short X 1X (u) - X (u) 2 /N X . (3.8) Under the constraints uV short X 1X (u) - X (u) d foot ( 1X , X ) and 1X (u) - X (u) = O(N X / log n), the maximal value of (3.8) is O(d foot ( 1X , X )N X /(N X log n)) = O(d foot ( 1X , X )/ log n) . Again using (2.4) and the triangle inequality, the last expression is O(C( 1X , V X , W V X )/ log n). Combining the accounting for V long and V short , we conclude E k X [T X ] = O(C( X , V X , W V X )/ log n) , (3.9) where the expectation is over the choice of k X in line 11 of SampleAndDecompose. We are now in a position to use a key Lemma from Kenyon et al's work [18]. First we need a definition: Consider the optimal solution X respecting V L[X] , V R [X] in lines 12 and 13. By this we mean that X must rank all of the elements in V X L before (to the left of) V RX . For the sake of brevity, let C X be shorthand for C( X , V X , W V X ) and C X for C( ; X , V X , W V X ). Lemma 3.16. [Kenyon and Schudy [18]] With respect to the distribution of the number k X in line 11 of SampleAndDecompose, E[C X ] O d foot ( 1X , X ) 3/2 N X + E[T X ] + C X . (3.10) Using (2.4), we can replace d foot ( 1X , X ) with d ( 1X , X ) in (3.10). Using the triangle in- equality, we can then, in turn, replace d ( 1X , X ) with C( 1X , V X , W V X ). 3.6 Summing Over the Recursion Tree Let us study the implication of (3.10) for our purpose. Recall that {V 1 , . . . , V k } is the decomposition returned by SampleAndRank, where each V i corresponds to a leaf in the recursion tree. Also recall that denotes the minimizer of C( ·,V,W) over all permutations in (V 1 , . . . , V k ) respecting the decomposition. Given Assumption 3.14 it suffices, for our purposes, to show that is a (relative) small approximation for MFAST on V, W . Our analysis of this account is basically that of [18], 15 with slight changes stemming from bounds we derive on E[T X ]. We present the proof in full detail for the sake of completeness. Let RT denote the root node. For X I, let X denote the contribution of the split L[X], R[X] to the LHS of (2.3). More precisely, X = uL[X],vR[X] 1 W (v,u)=1 , so we get 1i<jk (u,v)V i ×V j 1 W (v,u)=1 = XI X . For any X I, note also that by our definitions X = C X - C L[X] - C R[X] . Hence, using Lemma 3.16 and the ensuing comment, E[ X ] O E C( 1X , V X , W V X ) 3/2 N X + E[T X ] + E[C X ] - E[C L[X] ] - E[C R[X] ] , where the expectations are over the enitre space of random decisions made by the algorithm exe- cution. Summing the last inequality over X I, we get (minding the cancellations): E XI X O XI E C( 1X , V X , W V X ) 3/2 N X + E XI T X + C RT - XL E[C X ] . (3.11) The expression E[ XI T X ] is bounded by O E XI C X / log n using (3.9) (which depends on Assumption 3.14). Clearly the sum of C X for X ranging over nodes X I in a particular level is at most C( RT , V, W ) (again using Assumption 3.14 to assert that the cost of 1X is less than the cost of X at each node X). By taking Assumption 3.5 into account, C( RT , V, W ) is O(C RT ). Hence, summing over all O(log n) levels, E XI T X = O(C RT ) . (3.12) Let C 1X = C( 1X , V X , W V X ) for all x I. Denote by F the expression in the O-notation of the first summand in the RHS of (3.11), more precisely: F = XI E C 1 3/2 X N X , (3.13) where we remind the reader that N X = V X . It will suffice to show that under Assumption 3.14, the following inequality holds with probability 1: G ((C 1X ) XI , (N X ) XI ) := XI C 1 3/2 X /N X c 3 C 1RT , (3.14) where c 3 > 0 is some global constant. This turns out to require a bit of elementary calculus. A complete proof of this assertion is not included in [18], which is an extened abstract. We present a version of the proof here for the sake of completeness. Under assumption 3.14, the following two constraints hold uniformly for all X I with proba- bility 1: Letting C X = C( X , V X , W V X ), 16 (A1) If X is other than RT, let Y be its sibling and P their parent. In case Y I: C 1X + C 1Y C 1P . (3.15) (In case Y L, we simply have that C 1X C 1P . 4 ) To see this, notice that C 1X C X , and similarly, in case Y I, C 1Y C Y . Clearly C X + C Y C 1P , because X , Y are simply restrictions of 1P to disjoint blocks of V P . The required inequality (3.15) is proven. (A2) C 1X c 2 2 N 2 X for some global c 2 > 0. In order to show (3.14), we may increase the values C 1X for X = RT in the following manner: Start with the root node. If it has no children, there is nothing to do because then G = 0. If it has only one child X I, continuously increase C 1X until either C 1X = C 1RT (making (A1) tight) or C 1X = c 2 2 N 2 X (making (A2) above tight). Then recurse on the subtree rooted by X. In case RT has two children X, Y I (say, X on left), continuously increase C 1X until either C 1X + C 1Y = C 1RT ((A1) tight) or until C 1X = c 2 2 N 2 X ((A2) tight) . Then do the same for C 1Y , namely, increase it until (A1) is tight or until C 1Y = c 2 2 N 2 Y ((A2) tight). Recursively perform the same procedure for the subtrees rooted by X, Y . After performing the above procedure, let I 1 denote the set of internal nodes X for which (A1) is tight, namely, either the sibling Y of X is a leaf and C 1X = C 1P (where P is X's parent) or the sibling Y I and C 1X + C 1Y = C 1P (in which case also Y I 1 ). Let I 2 = I \ I 1 . By our construction, for all X I 2 , C 1X = c 2 2 N 2 X . Note that if X I 2 then its children (more precisely, those in I) cannot be in I 1 . Indeed, this would violate (A2) for at least one child, in virtue of the fact that N Y lies in the range [N X /3, 2N X /3] for any child Y of X. Hence, the set I 1 {RT} forms a connected subtree which we denote by T 1 . Let P T 1 be an internal node in T 1 . Assume it has one child in T 1 , call it X. Then C 1X = C 1P and in virtue of N X 2N P /3 we have C 1 3/2 P /N P (2/3) 3/2 C 1 3/2 X /N X . Now assume P has two children X, Y T 1 . Then C 1X + C 1Y = C 1P . Using elementary calculus, we also have that C 1 3/2 P /N P (C 1 3/2 X /N X + C 1 3/2 Y /N Y )/2 (indeed, the extreme case occurs for N X = N Y = N P /2 and C 1X = C 1Y = C 1P /2). We conclude that for any P internal in T 1 , the corresponding contribution C 1 3/2 P /N P to G is geometrically dominated by that of its children in I 1 . Hence the entire sum G 1 = XI 1 {RT} C 1 3/2 X /N X is bounded by c 4 XL 1 C 1 3/2 X /N X for some constant c 4 , where L 1 is the set of leaves of T 1 . For each such leaf X L 1 , we have that C 1 3/2 X /N X c 3/2 2 C 1X (using (A2)), hence XL 1 C 1 3/2 X /N X XL 1 c 3/2 2 C 1X c 3/2 2 C 1R (the rightmost inequality in the chain follows from {V X } XL 1 forming a disjoint cover of V = V RT , together with (A 1 )). We conclude that G 1 c 4 c 3/2 2 C 1R . To conclude (3.14), it remains to show that G 2 = G - G 1 = XI 2 . For P G 2 , clearly C 1 3/2 P /N P = c 3/2 2 3 N 3 P . Hence, if X, Y G 2 are children of P in I 2 then C 1 3/2 P /N P c 5 C 1 3/2 X /N X + C 1 3/2 Y /N Y and if X is the unique child of P in I 2 , then C 1 3/2 P /N P c 5 C 1 3/2 X /N X , for some global c 5 > 1. In other words, the contribution to G 2 corresponding to P geometrically dominates the sum of the corresponding contributions of its children. We conclude that G 2 is at most some constant c 6 times Xroot(I 2 ) C 1 3/2 X /N X , where root( I 2 ) is the set of roots of the forrest induced by I 2 . As before, it is clear that {V X } Xroot(I 2 ) is a disjoint collection, hence as before we conclude that G 2 c 7 C 1R for some global c 7 > 0. The assertion (3.14) follows, and hence (3.13). 4 We can say something stronger in this case, but we won't need it here. 17 Plugging our bounds in (3.11), we conclude that E XI X C RT (1 + O()) - XL E[C X ] . Clearly C(, V, W ) = XI X + XL C X . Hence E[C(, V, W )] = (1+O())C RT = (1+O())C . We conclude the desired assertion on expectation. A simple counting of accesses to W proves Theorem 3.1. 4 Using Our Decomposition as a Preconditioner for SVM We consider the following practical scenario, which is can be viewed as an improvement over a version of the well known SVMrank [16, 14] for the preference label scenario. Consider the setting developed in Section 2.1, where each element u in V is endowed with a feature vector (u) R d for some d (we can also use infinite dimensiona spaces via kernels, but the effective dimension is never more than n = V ). Assume, additionally, that (u) 2 1 for all u V (otherwise, normalize). Our hypothesis class H is parametrized by a weight vector w R d , and each associated permutation w is obtained by sorting the elements of V in decreasing order of a score given by score w (u) = (u), w . In other words, u w v if score w (u) > score w (v) (in case of ties, assume any arbitrary tie breaking scheme). The following SVM formulaion is a convex relaxation for the problem of optimizing C(h, V, W ) over our chosen concept class H: (SVM1) minimize F 1 (w, ) = u,v u,v s.t. u,v : W(u,v) = 1 score w (u) - score w (v) 1 - u,v u,v u,v 0 w c Instead of optimizing (SVM1) directly, we make the following observation. An -good decompo- sition V 1 , . . . , V k gives rise to a surrogate learning problem over (V 1 , . . . , V k ) (V ), such that optimizing over the restricted set does not compromise optimality over (V ) by more than a rela- tive regret of (property (2.3)). In turn, optimizing over (V 1 , . . . , V k ) can be done separately for each block V i . A natural underlying SVM corresponding to this idea is captured as follows: (SVM2) minimize F 2 (w, ) = u,v 1 2 u,v s.t. (u,v) 1 2 score w (u) - score w (v) 1 - u,v u,v u,v 0 w c , where 1 = 1i<jk V i × V j and 2 = k i=1 {(u,v) : u,v V i W(u,v) = 1}. 18 Abusing notation, for w R d s.t. w c, let F 1 (w) denote min F 1 (w, ), where the minimum is taken over all that satisfy the constraints of SVM1. Observe that F 1 (w) is simply F 1 (w, ), where is taken as: u,v = max {0,1 - score w (u) + score w (v) } W(u,v) = 1 0 otherwise . (4.1) Similarly define F 2 (w) as the minimizer of F 2 (w, ), which is obtained by setting: u,v = max {0,1 - score w (u) + score w (v) } (u,v) 1 2 0 otherwise . (4.2) Let denote the optimal solution to MFAST on V, W . We do not know how to directly relate the optimal solution to SVM1 and that of SVM2. However, we can showwe can replace SVM2 with a careful sampling of constraints thereof, such that (i) the solution to the subsampled SVM is optimal to within a relative error of as a solution to SVM2, and (ii) the sampling is such that only O(n polylog(n, -1 )) queries to W are necessary in order to construct it. This result, which we quantify in what follows, strongly relies on the local chaos property of the -good decomposition (2.2) and some combinatorics on permutations. Our subsampled SVM which we denote by SVM3, is obtained as follows. For ease of notation we assume that all blocks V 1 , . . . , V k are big in V , otherwise a simple accounting of small blocks needs to be taken care of, adding notational clutter. Let 3 be a subsample of size M (chosen shortly) of 2 , each element chosen uniformly at random from 2 (with repetitions - hence 3 is a multi-set). Define: (SVM3) minimize F 3 (w, ) = u,v 1 u,v + k i=1 n i 2 M u,v 3 u,v s.t. (u,v) 1 3 score w (u) - score w (v) 1 - u,v u,v u,v 0 w c As before, define F 3 (w) to be F 3 (w, ), where = (w) is the minimizer of F 3 (w, ·) and is taken as u,v = max {0,1 - score w (u) + score w (v) } (u,v) 1 3 0 otherwise . (4.3) Our ultimate goal is to show that for quite small M , SVM3 is a good approximation of SVM2. To that end we first need another lemma. Lemma 4.1. Any feasible solution (w, ) for SVM1 satisfies u,v u,v C( , V, W ). Proof. The following has been proven in [1]: Consider non-transitive triangles induced by W : These are triplets (u, v, y) of elements in V such that W (u, v) = W (v, y) = W (y, u) = 1. Note that any permutation must disagree with at least one pair of elements contained in a non-transitive triangle. Let T denote the set of non-transitive triangles. Now consider an assignment of non-negative 19 weights t for each t T. We say that the weight system { t } tT packs T if for all u, v V such that W (u, v) = 1, the sum (u,v) in t t is at most 1. (By u, v in t we mean that u, v are two of the three elements inducing t.) Let { t } tT be a weight system packing T with the maximum possible value of the sum of weights. Then tT t C( , V, W )/3 . (4.4) Now consider one non-transitive triangle t = (u, v, y) T. We lower bound u,v + v,y + y,u for any such that w, is a feasible solution to SVM1. Letting a = score w (u) - score w (v), b = score w (v) - score w (y), c = score w (y) - score w (u), we get from the constraints in SVM1 that u,v 1 - a, v,y 1 - b, y,u 1 - c. But clearly a + b + c = 0, hence u,v + v,y + y,u 3 . (4.5) Now notice that the objective function of SVM1 can be bounded from below as follows: u,v u,v t=(u,v,y)T t ( u,v + v,y + y,u ) t=(u,v,y)T t · 3 C( , V, W ) . (The first inequality was due to the fact that { t } tT is a packing of the non-transitive triangles, hence the total weight corresponding to each pair u, v is at most 1. The second inequality is from (4.5) and the third is from (4.4).) This concludes the proof. Theorem 4.2. Let (0,1) and M = O( -6 (1 + 2c) 2 d log(1/)). Then with high constant probability, for all w such that w c, F 3 (w) - F 2 (w) = O(F 2 (w)) . Proof. Let B d (c) = {z R d : z c}. Fix a vector w B d (c). Over the random choice of 3 , it is clear that E[F 3 (w)] = F 2 (w). We need a strong concentration bound. From the observation that u,v 1 + 2c for all u,v, we conclude (using Hoeffding bound) that for all µ > 0, Pr[ F 3 (w) - F 2 (w) µ] exp -µ 2 M k i=1 n i 2 (1 + 2c) 2 . (4.6) Let = 3 and consider an -net of vectors w in the ball B d (c). By this we mean a subset B d (c) such that for all z B d (c) there exists w s.t. z - w . Standard volumetric arguments imply that there exists such a set of cardinality at most (c/) d . Let z and w B d (c) such that w - z . From the definition of F 2 , F 3 , it is clear that F 2 (w) - F 2 (z) k i=1 n i 2 3 , F 3 (w) - F 3 (z) k i=1 n i 2 3 . (4.7) 20 Using (4.6), we conclude that for any µ > 0, by taking M = O(µ -2 ( n i 2 ) 2 (1+2c) 2 d log(c -1 )), with constant probability over the choice of 3 , uniformly for all z : F 3 (z) - F 2 (z) µ . Take µ = 3 k i=1 n i 2 . We conclude (plugging in our choice of µ and the definition of ) that by choosing M = O( -6 (1 + 2c) 2 d log(c/)) , with constant probability, uniformly for all z : F 3 (z) - F 2 (z) 3 k i=1 n i 2 . (4.8) Using (4.7) and the triangle inequality, we conclude that for all w B d (c), F 3 (w) - F 2 (w) 3 3 k i=1 n i 2 . (4.9) By property (2.2) of the -goodness definition, (4.9) imples F 3 (w) - F 2 (w) 3 min (V ) k i=1 C( V i , V i , W V i ) = 3 k i=1 min (V i ) C(, V i , W V i ) . By Lemma 4.1 applied separately in each block V i , this implies F 3 (w) - F 2 (w) 3 k i=1 u,vV i u,v = 3F 2 (w), (where = (w) is as defined in (4.2).) This concludes the proof. Acknowledgements The author gratefully acknowledges the help of Warren Schudy with derivation of some of the bounds in this work. References [1] Nir Ailon, Moses Charikar, and Alantha Newman, Aggregating inconsistent information: Rank- ing and clustering, J. ACM 55 (2008), no. 5. [2] Nir Ailon, Bernard Chazelle, Seshadhri Comandur, and Ding Liu, Estimating the distance to a monotone function, Random Struct. Algorithms 31 (2007), no. 3, 371­383. [3] , Property-preserving data reconstruction, Algorithmica 51 (2008), no. 2, 160­182. 21 [4] Nir Ailon and Mehryar Mohri, An efficient reduction of ranking to classification, COLT, 2008, pp. 87­98. [5] , Preference based learning to rank, vol. 80, 2010, pp. 189­212. [6] Nir Ailon and Kira Radinsky, Ranking from pairs and triplets: Information quality, evaluation methods and query complexity, WSDM (to appear), 2011. [7] Noga Alon, Ranking tournaments, SIAM J. Discret. Math. 20 (2006), no. 1, 137­142. [8] Ben Carterette, Paul N. Bennett, David Maxwell Chickering, and Susan T, Here or there: Preference judgments for relevance, In Proceedings of the European Conference on Information Retrieval (ECIR), 2008. [9] William W. Cohen, Robert E. Schapire, and Yoram Singer, Learning to order things, NIPS '97: Proceedings of the 1997 conference on Advances in neural information processing systems 10 (Cambridge, MA, USA), MIT Press, 1998, pp. 451­457. [10] Koby Crammer and Yoram Singer, Pranking with ranking, Advances in Neural Information Processing Systems 14, MIT Press, 2001, pp. 641­647. [11] Persi Diaconis and R. L. Graham, Spearman's footrule as a measure of disarray, Journal of the Royal Statistical Society. Series B (Methodological) 39 (1977), no. 2, pp. 262­268. [12] Irit Dinur and Shmuel Safra, On the importance of being biased, Proceedings of the 34th Annual Symposium on the Theory of Compututing (STOC), 2002, pp. 33­42. [13] Shirley Halevy and Eyal Kushilevitz, Distribution-free property-testing, SIAM J. Comput. 37 (2007), no. 4, 1107­1138. [14] R. Herbrich, T. Graepel, and K. Obermayer, Advances in large margin classifiers, MIT Press, 200. [15] Eyke Hullermeier, Johannes Furnkranz, Weiwei Cheng, and Klaus Brinker, Label ranking by learning pairwise preferences, Artif. Intell. 172 (2008), no. 16-17, 1897­1916. [16] Thorsten Joachims, Optimizing search engines using clickthrough data, Proceedings of the eighth ACM SIGKDD international conference on Knowledge discovery and data mining, KDD '02, 2002, pp. 133­142. [17] Richard M. Karp, Reducibility among combinatorial problems, Complexity of Computer Com- putations, Plenum Press, New York, 1972, pp. 85­104. [18] Claire Kenyon-Mathieu and Warren Schudy, How to rank with few errors, STOC, 2007, pp. 95­ 103. [19] V. N. Vapnik and A. Ya. Chervonenkis, On the uniform convergence of relative frequencies of events to their probabilities, Theory of Probability and its Applications 16 (1971), no. 2, 264­280. 22 A Linear VC Bound of Permutation Set To see why the VC dimension of the set of permutations viewed as binary function over the set of all possible n 2 preferences, it is enough to show that any collection of n pairs of elements cannot be shattered by the set of permutation. (Refer to the definition of VC dimension [19] for a definition of shattering). Indeed, any such collection must contain a cycle, and the set of permutations cannot direct a cycle cyclically. 23
1106.2263
1
1106
2011-06-11T22:32:32
A Library for Implementing the Multiple Hypothesis Tracking Algorithm
[ "cs.DS", "cs.MS" ]
The Multiple Hypothesis Tracking (MHT) algorithm is known to produce good results in difficult multi-target tracking situations. However, its implementation is not trivial, and is associated with a significant programming effort, code size and long implementation time. We propose a library which addresses these problems by providing a domain independent implementation of the most complex MHT operations. We also address the problem of applying clustering in domain independent manner.
cs.DS
cs
A Library for Implementing the Multiple Hypothesis Tracking Algorithm David Miguel Antunes1, David Martins de Matos2, and Jos´e Gaspar3 1 Institute for Systems and Robotics, L2F , davidmiguel [at] antunes.net 2 L2F - INESC-ID, david.matos [at] l2f.inesc-id.pt 3 Institute for Systems and Robotics, IST/UTL, jag [at] isr.ist.utl.pt Abstract. The Multiple Hypothesis Tracking (MHT) algorithm is known to produce good results in difficult multi-target tracking situations. How- ever, its implementation is not trivial, and is associated with a signifi- cant programming effort, code size and long implementation time. We propose a library which addresses these problems by providing a domain independent implementation of the most complex MHT operations. We also address the problem of applying clustering in domain independent manner. 1 Introduction The Multiple Hypothesis Tracking (MHT) algorithm, proposed by Reid [1] is fundamental in the multi-target tracking field with many applications in differ- ent areas. And, even though its significant computational complexity inhibited its utilization for some time, continuous increases in the processing power of computers accompanied by a reduction in their cost, along with some algorith- mic improvements [2], make the implementation of the MHT feasible nowadays [3]. The MHT is now the preferred method for difficult tracking problems [4]. Although the MHT presents advantages when compared to other methods its implementation is not trivial, and requires significant programming effort, extensive code size, and debugging effort [5]. To address the difficulty in im- plementing the MHT, we propose and describe a library which can be used to ease this task. Because the MHT is applied in multiple domains, with variations on the algorithm, such as group tracking [6], the library should not enforce a particular type of MHT implementation. Therefore, it only addresses the man- agement of the multiple hypotheses, and not the probability modeling, movement models, sensor models, and other aspects which may vary across different MHT implementations. Cybenko et al. [7] identify less usual tracking domains, such as computer se- curity, or social networks. Because the proposed library is not tied to a particular domain, it may be used to apply tracking to domains like the ones identified by these authors. 1 1 0 2 n u J 1 1 ] S D . s c [ 1 v 3 6 2 2 . 6 0 1 1 : v i X r a As noted in the seminal work of Reid [1], an efficient MHT implementation must perform clustering. Clustering consists in dividing the tracking problem into independent sub-problems which can be solved separately. Reid identified the necessary steps to implement clustering in the MHT. However, because the proposed library is independent of the specific domain of the application, and the clustering method described by Reid is specific for a particular domain, a dif- ferent, more general clustering method is required. We propose such a clustering method for the library. The work on Process Query Systems (PQS) [8] by various persons of the Dartmouth College is close in intent with this one. PQS allow the modeling of processes with states, dynamics, and observables in a domain independent man- ner. The PQS framework is then able to detect and track the evolution of several processes in the environment. However, the PQS framework does not seem to provide clustering, and is tied to the notion of process which may not be appro- priate for some multiple hypothesis applications, such as Multiple Hypothesis Situation Analysis [9]. Jean Roy et al. proposed a domain independent cluster- ing method for the MHT [10], however he does not provide any description of a domain independent MHT library. The main contribution of this paper is the description of a library which can be used to simplify and speed up the implementation of the MHT independently of the application’s domain, and a method to provide the ability of clustering in such a library. The proposed library was applied to several problems which are discussed, one of which is detailed in section 6. Section 2 gives an overview of the proposed library, section 3 details the clustering method, section 4 describes the modeling of information, and the library’s operations and data-structures are described in section 5. More information and resources on the proposed library are available at http://www.multiplehypothesis.com. 2 MHT Overview The usual flow diagram for the MHT is presented in figure 1. First, the applica- tion receives a new set of measurements from the sensor. Each measurement is either associated with an existing cluster or else a new cluster is created. When a measurement is associated with more than one cluster they are joined and the resulting cluster is pruned. Afterwards, new hypotheses are generated for each set of measurements associated with the same cluster, followed by cluster tree pruning. Finally, the clusters may be decomposed according to the rule: if two tracks share a common measurement, they must be on the same cluster. The operations of the library (shown in figure 2) are similar to the ones of the traditional MHT. There is, however, a clear separation of responsibilities between the application and the library. The main responsibility of the application is the hypothesis generation, as it is domain dependent. The library handles the complicated operations which must modify complex data-structures, freeing the Fig. 1. Traditional MHT. Fig. 2. Proposed library workflow, and an abstract example of how the operations affect the maintained data structures (right). library user from the most difficult and time consuming programming tasks. How the hypothesis generation is performed in detail, as well as other necessary operations, will be further discussed in the rest of the paper. 3 Clustering Method Before further detailing the library, the proposed clustering method will be in- troduced. Because the library is independent of the application domain it only sees generic information. To ease application development, this information is sepa- rated in history and state of the world. It is not necessary for the application to take advantage of this separation, however it has been found useful in structur- ing the development of tracking applications. For now, consider that the library maintains a set of information I, constituted of pieces of information i1, i2, ..., iI. The specific modeling of information and its separation in history and state of the world, will be discussed later, in section 4. Clustering on the library is based on two rules. The first one is the following: If i1 and i2 where generated at the same hypothesis generation, then they must remain in the same cluster. And the second rule is: If, to assert i1, one needs to know i2, then both must remain in the same cluster. The algorithm operations JoinclustersClusterdecompositionReceive newmeasurementsGenerateHypothesesPruningPruningRequesthypothesisgenerationApplicationLibraryGeneratehypothesesJoinclustersClusterdecompositionHypothesisgenerationPruningPruning... which concern clustering try to form the maximum number of clusters, while still respecting these two rules. The validity of the proposed clustering rules will now be discussed. Fig. 3. Tracking scenario (left), and an abstract rep- resentation of a possible hypothesis tree (right). Fig. 4. Applying the second clus- tering rule. 3.1 Validity of the First Rule In the MHT, in an hypothesis generation, no more than one hypothesis can be correct, and exactly one of the hypotheses will be considered correct, i.e. only one will survive pruning in the long run. Consider the scenario in figure 3, where target T is being tracked. Measurements are denoted by numbers 1 to 7. At the right there is an abstract representation of a possible hypothesis tree (or cluster). The first rule dictates that the information inside A, B, and C, cannot be separated to different clusters. A separation of this information could lead to inconsistent situations. For example, consider FA(6) (meaning measurement 6 is a false alarm) and T(6) (meaning measurement 6 is a detection of target T) on B are separated to different clusters. Then, there would be a global4 hypothesis where both would be true that is, a measurement could be both a false alarm and a detection of target T at the same time. And there would also be a global hypothesis where none would be present, resulting in any information related to measurement 6 disappearing, if only this hypothesis survived pruning. Thus, the rule first rule ensures that no more and no less than one of the pieces of information generated in one hypothesis generation will be present in each possible global hypothesis. From now on, the sets of information which must be on the same cluster, such as A, B, and C will be denoted as constraints. 4 Every cluster contains information only on a specific part of the world. A global hypothesis contains information on all of the world, and it is built by selecting an hypothesis from every cluster [4]. 5 4 3 2 16 7 FA(7) T(7)T(5) FA(6) T(6)FA(7) C B AFA(7) T(7)T(5) FA(6) T(6)FA(7) C B A E D 3.2 Validity of the Second Rule To apply the second rule, the library needs to know which information the appli- cation needs to generate a certain hypothesis. In practice, this is implemented in the following manner. Before generating new hypotheses, the application iden- tifies the information which will be required to generate those hypotheses (a subset of all the information the library is storing) and requests it from the li- brary. When the application generates new hypotheses for a leaf in a cluster’s hypothesis tree, the library provides it with the subset of the required informa- tion which is true in that leaf. According to the second rule, the information provided by the library and the information generated by the application must be kept on the same cluster. The constraints introduced by the first rule alone are not sufficient to cor- rectly split clusters. Consider the example in figure 3. Although the information in constraints A, B, and C cannot be separated, the hole constraints may be separated to different clusters. In which case, for example, the following global hypothesis would be possible: { T(5), FA(6), T(7) }. This hypothesis is incorrect as T(7) only makes sense with T(6). With only the first rule it is possible that in a global hypothesis there are two pieces of information incompatible with each other, or that there is a missing piece of information (such as T(6)). However, when generating hypotheses, the application must (and needs to) request any piece of information which would prevent the generated hypotheses from mak- ing sense, or any piece of information which it requires to know to generate the hypotheses (such as T(6)). Then, the constraints introduced by the second rule ensure that there are no incorrect global hypotheses. In the example of figure 3, the application would request the information on targets near measurement 7 (corresponding to T(6)) and, applying the second rule, constraint E would be introduced. The case for constraint D is similar. 4 Information Modeling As the library is generic and it is intended to be applicable in multiple domains the modeling of the information contained in the library is also generic. The library can store and manage two different types of information: events and facts. The library does not contain any predefined events nor facts, they are defined by the application in order to fit its needs. 4.1 Events An event corresponds to a piece of history of the world, and contains information about what (possibly) happened in the world at some point in time. For exam- ple “ship 9372 moved to (1232.2, 293.6) at 15:53AM”, or “sensor with id=173 produced a false alarm at 04:26PM”. 4.2 Facts In order to request the necessary information from the library, prior to an hy- pothesis generation, the application has to identify and find the events which will be relevant for that hypothesis generation. For example, following a detection at (x, y) by a ship’s radar, it is necessary to identity the events which place a ship near (x, y), as it might be the cause of that detection. And it may happen that a ship was detected in that area two minutes, half an hour, or even three hours ago. Thus, the application may need to search trough many events to find the ones it requires. The same happens if the application has to answer the question: “where is ship 9372?” or “how many ships are in the (x0, y0, x1, y1) area?”. To simplify the answer to these questions, the application may define facts. Whereas events are part of the history of the world, facts represent the current state of the world. For example, when the application generates the event “ship 9372 moved to (1232.2, 293.6) at 15:53AM”, it may also generate the fact “ship 9372 is in (1232.2, 293.6)”. Contrary to events, facts do not usually include a timestamp, as a fact is true as long as it exists. And, while events are never deleted (unless they are pruned), facts have a limited lifetime. In the example, when the ship moves a new fact should be created with the new position, and the old one deleted. In the example, if there is a fact per ship, answering the aforementioned questions becomes simpler as there is one, and only one, fact for each ship which contains the most up-to-date information on the ship position, velocity, etc. 5 The Library’s Operations The library’s main operations which will now be detailed are depicted in figure 2, and they are: cluster joining, hypothesis generation, cluster splitting, and pruning. However, before detailing these operations, the data structures upon which they operate will be described. 5.1 Data Structures Fig. 5. Example of the tree structure (or cluster). EGEGEGEGEGEGEGLLLLEEEEEEEFC C The fundamental data structure in the library is the hypothesis tree (or cluster). An example tree is depicted in figure 5. The events in a generated hypothesis can be treated in the same manner for most of the operations, so, they are aggregated in event groups. The nodes in the hypothesis tree are constituted of event groups (denoted by EG in figure 5), containing events (denoted by E). The tree also contains constraints (denoted by C) and, associated with each event group at the bottom of the tree, there is a structure denoted by leaf (denoted by L). Facts (denoted by F) are stored in the leaves. The library maintains several of these trees at the same time. Additionally there is a relation between each fact and an event group, not shown in the figure. For each generated hypothesis, its events are stored in a new event group and the facts added to a new leaf. Then, each of the facts is associated with the new event group. We say the fact “depends upon” the event group. This association dictates, for example, the fact’s probability, which is the same that the probability of its associated event group. In section 3, a simplification was made by considering that the library only keeps “information”. Now the clustering rules will be stated directly in terms of events, facts, event groups, and constraints. The first rule can be formulated as: In an hypothesis generation, a new constraint must be created containing all the new event groups. And the second rule corresponds to: When generating hypotheses for a leaf, a new constraint must be created with: the new event groups; the leaf ’s event groups containing requested events; and the leaf ’s event groups to which requested facts are associated. The event groups of a leaf are all the event groups which are in the path from the leaf up to the root of the hypothesis tree. 5.2 Operations An overview of the operations depicted in figure 2, and which will be detailed next is as follows. After receiving a new measurement, the application needs to generate hypotheses on the origin and implications of the new measurement. The application knows all the facts and events contained in the library, and selects the ones which are relevant for the hypothesis generation. The library receives the relevant events and facts for that hypothesis generation and joins all the clusters which contain them into one single cluster, then, requests the application to generate new hypotheses for each leaf of the cluster, providing the application with the subset of the requested events and facts which are true according to that leaf. Afterwards the cluster is pruned and, if it can now be divided into clusters containing subsets of the events, facts, and constraints in the original one, while still complying to the clustering rules, then splitting is applied. Procedure 5.1.1, JoinClusters, details the method for joining different clus- ters. Pruning is applied each time two clusters are joined (the representation in figure 2 simplifies this by showing pruning only once, after cluster joining). The procedure UnifyConstraints is called by the previous one to guarantee that, for every constraint c in cluster c2 (see procedure 5.1.1) containing the set of events e, a constraint C exists in the final cluster which contains the set E of all the events of the clones of constraint c. Thus, E = e×c1.leaves. If no events or facts are requested, a new cluster is created (cluster joining is not necessary). The procedure 5.1.3, HypGen, asks the application to generate hypotheses for each leaf of the cluster. When generating hypotheses for a leaf, it provides the application with the subset of the requested facts and events which are available in the leaf. The generation will result in the tree being augmented with new event groups and new leaves. The HypGen procedure also creates the appropriate new constraints and prunes the resulting tree. Several pruning strategies may be applied. The pruning operation can limit the number of leaves, the depth of the tree, or follow other application specific strategy. When a leaf is pruned, procedure 5.1.4, RemoveLeaf, is called to remove it from the cluster. When a brach of the tree is pruned, RemoveLeaf is called for every leaf coming from that branch. Cluster splitting can be performed if non-intersecting sets of constraints are found. If constraints c1 and c2 contain a common event group they intersect. For each set of independent constraints, C, a new cluster, nCluster, can be created by cloning the original cluster. In nCluster, the events in event groups which are not contained in any c ∈ C are deleted. Also, only facts associated with event groups in c ∈ C are kept, and nCluster only contains the constraints in C. Procedure 5.1.5, Split, details this operation. Procedure 1 Join clusters with required events or facts procedure JoinClusters(reqEvents, reqF acts) Find the clusters, clusters, containing required events or facts; Select a cluster c1 ∈ clusters; For each c2 (cid:54)= c1 in clusters: clones ← {}; newLeaves ← {}; For each leaf in c1.leaves: clone ← clone of c2; Add clone to clones; Add c2.rootEventGroup to leaf.eventGroup children; For each cLeaf in clone.leaves: Add cLeaf to newLeaves; Add leaf.f acts to cLeaf.f acts; cLeaf.prob ← cLeaf.prob × leaf.prob; Delete c2; c1.leaves ← newLeaves; UnifyConstraints (c1, clones); Prune c1; Return c1; Procedure 2 Connect constraints in cloned clusters procedure UnifyConstraints(c1, clones) For i ← 1 up to clones[1].constraints: Create constraint newC; For each clone in clones: Add all event groups in clone.constraints[i] to newC.eventGroups; Add newC to c1.constraints; Procedure 3 Generate hypotheses procedure HypGen(cluster, reqEvents, reqF acts) newEventGroups ← {} For each leaf in cluster: provF acts ← leaf.f acts ∩ reqF acts; provEvents ← leaf.events ∩ reqEvents; Create a new constraint, cstrnt, with the event groups containing provided events, and the event groups to which provided facts are associated; Request the application to generate hypotheses, providing it with provEvents and provF acts; For each generated hypothesis, hyp: Create a new event group, nEventGroup, with hyp.events; Create a new leaf, nLeaf , with hyp.f acts ∪ (leaf.f acts \ provF acts); Add nLeaf to cluster.leaves; Add nEventGroup to leaf.eventGroup children, to newEventGroups, Set nLeaf.probability to hyp.probability ∗ leaf.probability; Remove leaf from cluster; and to cstrnt; Create a new constraint with newEventGroups; Normalize leaves probabil- ity; Prune cluster; Procedure 4 Remove leaf from cluster procedure RemoveLeaf(cluster, leaf ) Remove leaf from cluster.leaves; parent ← leaf.eventGroup; While parent.children = 0 do: Remove parent.parent.children; parent ← parent.parent; Remove empty constraints in cluster.constraints; Normalize leaves probabil- ities; cluster.constraints, parent from all and from Procedure 5 Cluster splitting procedure Split(cluster) superConsts ← {}; Let map be a map from constraints to sets of constraints; For each c in cluster.constraints: Let sC be a clone of c; Add sC to superConsts; map[sC] ← { c }; For all sC1, sC2 ∈ superConsts : (sC1.eventGroups ∩ sC2.eventGroups) (cid:54)= {}: Create new constraint, newConstr; Add newConstr to superConsts. newConstr.eventGroups ← sC1.eventGroups ∪ sC2.eventGroups; Remove sC1 and sC2 from superConsts; map[newConstr] ← map[sC1] ∪ map[sC2]; Remove sC1 and sC2 from map; For each constraints in map keys: Create a new cluster by cloning cluster. Keep only constraints constraints, the events contained in event groups in constraints, and the facts associated with those event groups; Remove cluster; 5.3 Further Notes In order to request events and facts from the library for an hypothesis generation, the application may obtain all the events and facts the library contains and search for the ones of interest. However, a better approach is for the library to notify the application about changes to its available events and facts. Then the application can organize them in a way which speeds up searches. For example, the application may organize facts containing the position of ships so that it is efficient to find all the ships in a certain area. The library does not keep the events which have a probability of 1. These are the events at the root of the clusters for which there is no uncertainty. Therefore, after a cluster is pruned, they should be sent to the application and removed from the cluster. Then, the application decides what to do with them (storing them in persistent storage, for example). Facts can be seen as a special events. They have only two differences: contrary to events, facts are deleted after they are provided to the application in an hypothesis generation (but they may be generated again); when the event group associated with a fact reaches the root of the tree, with probability of 1, it is not sent to the application, instead, a new cluster is created with only that fact. It may happen that, due to cluster splitting, a cluster is created containing only facts and/or events which will never be requested by application. For ex- ample a cluster which only contains false alarm events. Because it will never be requested it is wasting memory space. Thus the application should provide a predicate function which accepts the facts and events of a cluster and asserts if that cluster can ever be required for hypothesis generation. If not, then best K hypothesis pruning is applied to the cluster, with K= 1. 6 Radar Tracking Application The proposed library was implemented in Java and applied to several tracking problems. One of the library applications is a radar tracker simulator, developed to illustrate the capabilities of the library in a self-contained manner, so that other members of the research community may become rapidly familiarized with the library work-flow by analyzing the application code. This simulator will now be described in detail. The simulated radar is stationary and detects ships in a circular region around it. Every time the radar beam ends a full 360◦turn the radar detec- tions are provided to the tracker. A Kalman Filter with a constant velocity model is used to predict the position of the targets, but the simulated targets have random velocity and direction changes. The problem was modeled with facts and events. Only one fact (named Tar- getPositionFact) was required to model the problem. This fact contains the target identifier number, the state of the target’s Kalman Filter, and the time of the target’s last detection (which is used to terminate the track if the target is not detected after a certain period of time). Fig. 6. Ground truth. Fig. 7. Radar. Fig. 8. Tracker output. To keep the tracking history four events were defined. A TrackInitiatedEvent containing the position and the identifier of the target which initiated the track. A TrackTerminatedEvent containing the identifier of the target whose track ter- minated. A TargetMovedEvent containing the initial and final positions of the target, and the target identifier. And a FalseAlarmEvent with the position of the detection which was considered a false alarm. All these events contain a timestamp. After the tracker receives a new set of measurements, when the radar com- pletes a full 360◦turn, it needs to generate hypotheses. Only facts are required from the library for hypothesis generation. For this reason, the tracker can func- tion with or without events. Without events it does not keep history, but is faster. When generating hypotheses for a measurement if a target, represented by a TargetPositionFact, contains the measurement in its validation gate then the fact must be required (the measurement may be a detection of that target). Furthermore, if the same TargetPositionFact must be required for two mea- surements, their hypothesis generation must be made at the same time. Each measurement either is a false alarm, a new target detection, or a detection of an existing target. Due to clustering the tracker is able to track many targets at the same time, while still taking an acceptable time to process each set of detections coming from the radar. Figure 9 shows the time to process the detections from the radar with different number of targets, it grows almost in a linear fashion. The proposed library was implemented in Java and made available on-line together with the demonstration of the radar tracking application. 7 Conclusions In this paper we address the problem of the complexity of implementing the MHT by proposing a library which implements much of the algorithm, leaving only the domain specific tasks to the application developer. And, even though the library is independent of the application domain, we provide a method for applying clustering, also domain independent, which is essential for an efficient imple- mentation of the MHT. Additionally, the library provides an explicit separation Fig. 9. Time to process new detections. Error bars show standard deviation. of the state and history of the world, which can be very useful in structuring tracking applications. In order to demonstrate the effectiveness of the library a radar tracking ap- plication was developed using the library. Simulations have shown successful tracking of the targets with a computation time growing in an approximately linear manner with the number of targets, due to the clustering ability of the library. References 1. Reid, D.B.: An algorithm for tracking multiple targets. IEEE Transactions on Automatic Control 24 (1979) 843–854 2. Danchick, R., Newnam, G.E.: Reformulating reid’s mht method with generalised murty k-best ranked linear assignment algorithm. Radar, Sonar and Navigation, IEE Proceedings - 153(1) (2006) 13–22 3. Cox, I.J., Hingorani, S.L.: An efficient implementation and evaluation of reid’s multiple hypothesis tracking algorithm for visual tracking. In: Pattern Recognition, 1994. Vol. 1 - Conference A: Computer Vision Image Processing., Proceedings of the 12th IAPR International Conference on. (1994) 437–442 4. Blackman, S.S.: Multiple hypothesis tracking for multiple target tracking. IEEE Aerospace and Electronic Systems Magazine 19 (2004) 5–18 5. Bar-Shalom, Y., Daum, F., Huang, J.: The probabilistic data association filter. Control Systems Magazine, IEEE 29(6) (2009) 82–100 6. Lau, B., Arras, K.O., Burgard, W.: Tracking groups of people with a multi-model hypothesis tracker. In: ICRA’09: Proceedings of the 2009 IEEE international con- ference on Robotics and Automation, Piscataway, NJ, USA, IEEE Press (2009) 3487–3492 7. George Cybenko, V.C., Jiang, G.: What is trackable? In: Sensors, and Command, Control, Communications, and Intelligence (C3I) Technologies for Homeland Se- curity and Homeland Defense V, Conference on. (2006) 8. Cybenko, G., Berk, V.H.: Process query systems. Computer 40(1) (2007) 62–70 9. Roy, J.: Towards multiple hypothesis situation analysis. In: Information Fusion, 2007 10th International Conference on, 10th International Conference on Informa- tion Fusion (2007) 1–8 050100150050100150200250300350Number of targetsTime to process (millis) 10. Roy, J., Duclos-Hindie, N., Dessureault, D.: Efficient cluster management algo- rithm for multiple-hypothesis tracking. Signal and Data Processing of Small Tar- gets 1997 3163(1) (1997) 301–313
1911.05676
1
1911
2019-11-13T17:55:06
Enumerative Data Compression with Non-Uniquely Decodable Codes
[ "cs.DS", "cs.DM", "cs.IR", "cs.IT", "cs.IT" ]
Non-uniquely decodable codes can be defined as the codes that cannot be uniquely decoded without additional disambiguation information. These are mainly the class of non-prefix-free codes, where a codeword can be a prefix of other(s), and thus, the codeword boundary information is essential for correct decoding. Although the codeword bit stream consumes significantly less space when compared to prefix--free codes, the additional disambiguation information makes it difficult to catch the performance of prefix-free codes in total. Previous studies considered compression with non-prefix-free codes by integrating rank/select dictionaries or wavelet trees to mark the code-word boundaries. In this study we focus on another dimension with a block--wise enumeration scheme that improves the compression ratios of the previous studies significantly. Experiments conducted on a known corpus showed that the proposed scheme successfully represents a source within its entropy, even performing better than the Huffman and arithmetic coding in some cases. The non-uniquely decodable codes also provides an intrinsic security feature due to lack of unique-decodability. We investigate this dimension as an opportunity to provide compressed data security without (or with less) encryption, and discuss various possible practical advantages supported by such codes.
cs.DS
cs
Enumerative Data Compression with Non-Uniquely Decodable Codes M. Oguzhan Kulekci∗, Yasin Ozturk∗, Elif Altunok∗, Can Yılmaz Altınigne∗ Informatics Institute, Istanbul Technical University Bili¸sim Enstitusu, IT U Ayazaga Kampusu, Maslak,34469, Istanbul, Turkey [email protected] Abstract Non-uniquely decodable codes can be defined as the codes that cannot be uniquely decoded without additional disambiguation information. These are mainly the class of non- prefix-free codes, where a codeword can be a prefix of other(s), and thus, the codeword boundary information is essential for correct decoding. Although the codeword bit stream consumes significantly less space when compared to prefix -- free codes, the additional dis- ambiguation information makes it difficult to catch the performance of prefix-free codes in total. Previous studies considered compression with non-prefix-free codes by integrating rank/select dictionaries or wavelet trees to mark the code-word boundaries. In this study we focus on another dimension with a block -- wise enumeration scheme that improves the compression ratios of the previous studies significantly. Experiments conducted on a known corpus showed that the proposed scheme successfully represents a source within its entropy, even performing better than the Huffman and arithmetic coding in some cases. The non- uniquely decodable codes also provides an intrinsic security feature due to lack of unique- decodability. We investigate this dimension as an opportunity to provide compressed data security without (or with less) encryption, and discuss various possible practical advantages supported by such codes. Introduction A coding scheme basically replaces the symbols of an input sequence with their cor- responding codewords. Such a scheme can be referred as non-uniquely decodable if it is not possible to uniquely decode the codewords back into the original data without using a disambiguation information. We consider non -- prefix -- free (NPF) codes in this study as the most simple representative of such codes. In NPF coding, a codeword can be a prefix of other(s), and the ambiguity arises since the codeword boundaries cannot be determined without explicit specification of the individual codeword lengths. Due to the lack of that unique decodability feature, NPF codes has received very limited attention [1 -- 3] in the data compression area. Although the codewords become smaller when compared to their prefix-free versions, they should be augmented with the disambiguation information for proper decoding, and the additional space con- sumption of that auxiliary data structures unfortunately eliminates the advantage of short codewords. Thus, the challenge here is to devise an efficient way of representing the codeword boundaries. The data structures to bring unique decodability for NPF codes was studied in [2]. More recently, the compression performance of NPF codes, which are augmented with wavelet trees [4] or rank/select dictionaries [5] to mark the code-word bound- aries, had been compared with Huffman and arithmetic coding in [3]. It should be noted that using succinct bit arrays to mark the code-word boundaries had also been independently mentioned in some previous studies as well [6, 7]. Although such NPF coding schemes are performing a bit worse in terms of compression, they support random-access on compressed data. In this work, we study improving the compression performance of non-uniquely decodable codes with the aim to close the gap with the prefix-free codes in terms of compression ratio. We propose an enumerative coding [8, 9] scheme to mark the codeword boundaries as an alternative of using wavelet trees or a rank/select dic- tionaries. Instead of representing the length of every codeword on the encoded bit stream, the codeword boundaries are specified in blocks of d consecutive symbols for a predetermined d value. Assume the codeword lengths of the symbols in a block are shown with a d -- dimensional vector. The sum of the d individual codeword lengths is denoted by p, and the vector can be specified by its rank q among all d -- dimensional vectors having an inner sum of p according to an enumeration scheme. Thus, a tuple (cid:104)p, q(cid:105), can specify the codeword boundaries in a d symbol long block. The method introduced in this study represents an input data by replacing every symbol with a NPF codeword and then compressing the corresponding (cid:104)p, q(cid:105) tuples efficiently. Experiments conducted on a known corpus 1 showed that the compression ratios achieved with the proposed method reaches the entropy bounds and improve the arithmetic and Huffman coding ratios. To the best of our knowledge, this is the first study revealing that non-prefix-free codes can catch compression ratios quite close to entropy of the data. In recent years, compressive data processing, which can be defined as operating directly on compressed data for some purpose, had been mentioned as a primary tool to keep pace with ever growing size in big data applications [10]. For instance, many database vendors are focusing on compressed databases [11] to cope with the mas- sive data management issues. On the other hand, it is becoming a daily practice to benefit from cloud services both for archival and processing of data. Obviously, the primary concern in using such a third-party remote service is the privacy and security of the data, which can be achieved simply by encryption. Encrypted compressed data is both space efficient and secure. However, the encryption level introduces several barriers in processing the underlying compressed data. Alternative solutions that investigate the privacy of the data without incorporating an encryption scheme have also been considered [12 -- 15]. Thus, new compression schemes respecting the data pri- vacy without damaging the operational capabilities on the compressed data may find sound applications in practice. For instance, similarity detection of documents with- out revealing their contents and privacy preserving storage with search capabilities are some potential applications based on those non-uniquely decodable codes. The outline of the paper is as follows. We start by defining the non-prefix-free codes from a compression perspective, and then proceed by introducing our enumera- 1Manzini's corpus available at http://people.unipmn.it/manzini/lightweight/corpus/ index.html. T = N ON P REF IXF REE Σ = {E, R, F, N, I, O, P, X} O = {3, 2, 2, 2, 1, 1, 1, 1} Σ → W Σ: W : E R 0 1 F 00 N 01 I 10 O 11 P 000 X 001 T = N F R E E T (cid:48) = 01 11 01 000 1 0 00 10 001 00 1 0 0 L = 2 2 1 1 1 R E 1 1 N 2 P 3 O 2 F 2 I 2 X 3 a) The T (cid:48) = N P F (T ) coding of a sample text T . T(cid:48) = 01110100010001000100100 B = 10101010011101010010111 b) Code-word boundaries in T (cid:48) = N P F (T ) marked on a bit array B. 0 ← {2}, {1,3}→ 1 0001110010111 t(cid:48) i = 2 0 ← {1}, {3}→ 1 1001000 t(cid:48) i = 3 c) Code-word lengths array L in T (cid:48) represented with a wavelet tree. t(cid:48) i = 1 Figure 1: The NPF coding and code-word boundary representation alternatives with bitmap and wavelet tree. tion scheme to represent the disambiguation information. The proposed compression method as a whole is described next, which is then followed by the experimental results and discussions addressing the opportunities and future work. The Non-Prefix-Free Coding T = t1t2 . . . tn is a sequence of symbols, where ti ∈ Σ = {1, 2, . . . , σ}. Each symbol i ∈ Σ requires (cid:100)log σ(cid:101) bits in fixed-length coding, and the total length of T then becomes n·(cid:100)log σ(cid:101) bits. Without loss of generality, assume the symbols of the alphabet Σ are ordered according to their number of occurrences on T such that 1 is the most and σ is the least frequent ones. Let's assume a code word set W = {w1, w2, . . . , wσ}, where each wi denotes the minimal binary representation of (i + 1) as wi = M BR(i + 1). The minimal binary representation of an integer i > 1 is the bit string M BR(i) = b1b2 . . . blog i such that a=1 ba · 2log i−a. For example, M BR(13) = 101, which is actually the binary representation of 13 omitting the leftmost 1 bit. This definition generates W = {0, 1, 00, 01, 10, 11, 000, 001, . . .}, where the code words wi ∈ W has varying bit lengths, and W is not prefix free as some code words appear as the prefixes of others. The Kraft's inequality [16], which states that a code- i=1 2−wi ≤ 1, does not hold on this W . For each code-word length (cid:96)k ∈ {1, 2, 3, . . . ,(cid:98)log(σ + 1)(cid:99)}, there are 2(cid:96)k code words except the last code-word length by which less symbols might be represented when σ (cid:54)= 2h−2 for i = 2log i +(cid:80)log i word set W is uniquely decodable if(cid:80)σ n, t(cid:48) some h. Thus, it is clear that 2−1+2−1+2−2+2−2+2−2+2−2+2−3 . . .+2−((cid:100)log(σ+2)(cid:101)−)1 ≥ 1 when σ > 2. The non-prefix-free coding of T is the transformation obtained by replacing each i = wj according to the Σ → W mapping for all 1 ≤ i ≤ n as shown ti = j with t(cid:48) i ∈ W . In T (cid:48), the most significant two symbols from 2 . . . t(cid:48) 1t(cid:48) by N P F (T ) = T (cid:48) = t(cid:48) Σ are shown by 1 bit, and the following four symbols are denoted by 2 bits, and so on. The total number of bits in the non-prefix-free coded sequence T is N P F (T ) = 1 · (o1 + o2) + 2 · (o3 + . . . + o6) + . . . + ((cid:100)log(σ + 2)(cid:101) − 1) · (o2(cid:100)log(σ+2)(cid:101)−1−1 + . . . + oσ), where oi is the number of appearances of i in T . The code word boundaries on T (cid:48) are not self-delimiting and cannot be determined without additional information. Previous approaches [2, 3] used wavelet trees and rank/select dictionaries to mark the boundaries are shown in Figure 1. Although these compressed data structures are very useful to support random access on the compressed sequence, it had been observed in [3] that the compression ratios achieved by these methods are a bit worse than the Huffman and arithmetic coding. In this study, we incorporate an enumerative coding to specify the codeword boundaries. Assume a list of items are ordered according to some definition, and it is possible to reconstruct any of the items from its rank in the list. In such a case, transmitting the index instead of the original data makes sense, and provides compression once representing the rank takes less space than the original data. That is actually the main idea behind enumerative coding [17]. We apply this scheme to represent the code-word boundaries in a sequence of NPF codewords. Empirical observations, as can be followed in the experimental results section, revealed that the usage of the proposed enumerative scheme can compress data down to its entropy. Enumerative Coding to Mark Codeword Boundaries One simple thing that can be achieved to mark the codeword boundaries is to store the codeword lengths of individual symbols on the input text T . These lengths vary from minimum codeword length 1 to a maximum of (cid:96)max = (cid:98)log(σ + 1)(cid:99) bits. The sequence of n codeword length information can then be compressed via a Huffman or arithmetic codec. However, our initial experiments showed that this coding does not provide a satisfactory compression ratio, where the total compression ratio cannot reach the entropy of the source sequence. With the motivation of marking the bound- aries of multiple symbols instead of single individuals may improve the compression performance, we decided to test whether such a block-wise approach would help. A block is defined as consecutive d symbols, and thus, there are r = (cid:100) n d(cid:101) blocks on T . When n is not divisible by d, we pad the sequence with the most frequent symbol. We maintain a list of r tuples as R = {(cid:104)p1, q1(cid:105),(cid:104)p2, q2(cid:105), . . .(cid:104)pr, qr(cid:105)} such that • pi = t(cid:48) (i−1)d+1 + t(cid:48) (i−1)d+2 + . . . + t(cid:48) i·d for 1 ≤ i ≤ r, where t(cid:48) j denotes the bit length of the codeword corresponding to symbol tj, and • qi represents the rank of the vector (cid:104)t(cid:48) (i−1)d+1,t(cid:48) (i−1)d+2, . . . ,t(cid:48) i·d(cid:105) among all possible d-dimensional vectors whose elements sum up to pi. For example on the example shown in Figure 1, if we assume a block size of d = 3, then p1 = 2 + 2 + 2 = 6 since the codeword lengths of the first three symbols (NON) are all 2 bits. All possible 3-dimensional vectors whose elements are in range [1 . . . 3] and sum up to 6 can be listed in lexicographic order as (cid:104)1, 2, 3(cid:105), (cid:104)1, 3, 2(cid:105), (cid:104)2, 1, 3(cid:105), (cid:104)2, 2, 2(cid:105), (cid:104)2, 3, 1(cid:105), (cid:104)3, 1, 2(cid:105), and (cid:104)3, 2, 1(cid:105). We observe that (cid:104)2, 2, 2(cid:105) is the fourth item in this list, and thus q1 = 4. Similarly the lengths of the next block (cid:104)3, 1, 1(cid:105) can be shown by (cid:104)5, 6(cid:105) since 3 + 1 + 1 = 5 and (cid:104)3, 1, 1(cid:105) is the sixth item in the lexicographically sorted possibilities list (cid:104)1, 1, 3(cid:105), (cid:104)1, 2, 2(cid:105), (cid:104)1, 3, 1(cid:105), (cid:104)2, 1, 2(cid:105), (cid:104)2, 2, 1(cid:105), and (cid:104)3, 1, 1(cid:105). In such a block-wise approach we need to devise an enumeration strategy to con- vert an input vector to an index and vice versa. We explain the building blocks in the following subsections. Number of Distinct Vectors Let ψ(k, d, v) return the number of distinct d dimensional vectors, in which each dimension can take values from 1 to k, and they sum up to v in total. The total sum v should satisfy d ≤ v ≤ (k · d) since each dimension is at least 1 and at most k. If v = d or d = 1, then there can be only one possible vector in which all dimensions are set to 1 in the former case and to k in the later case as there is only one dimension. The ψ(k, d, v) function can be computed with a recursion such that i=α ψ(k, d − 1, v − i). This is based on setting one, say first, dimension to one of the possible value i and then counting the remaining (d − 1) dimensional vectors whose elements sum up to (v− i). The pseudo code of this calculation is given in Algorithm 1. ψ(k, d, v) =(cid:80)β Vector to Index Assume we are given a d dimensional vector as (cid:104)v1, v2, . . . , vd(cid:105), where each 1 ≤ vi ≤ k for a known k. We would like to find the lexicographical rank of this vector among all possible d -- dimensional vectors with an inner sum of v = v1 + v2 + . . . + vd. First we can count how many of the d-dimensional vectors have a smaller number than v1 in their first dimension. Next step is to count the number of vectors that have the same v1 in the first dimension, but less than v2 in the second position. We repeat the same procedure on remaining dimensions, and the sum of the computed vectors return the rank of our vector. This can be achieved via a recursion, which is shown in Algorithm 2, that uses the ψ() function described above. As an example, for d = 3, and k = 3, assume we want to find the rank of 2, 2, 2. First we count the number of vectors that has a 1 in its first position with an inner sum of 6 via the ψ(k = 3, d = 2, v = 5) function, which returns us 2. Next, we count the vectors that has a 2 in first position and a value less than 2, which can take value only 1, in its second position. This can also be computed via ψ(k = 3, d = 1, v = 3) function, which returns 1 since we have only one dimension to set. Now we know that there are 3 vectors that are enumerated before our input on the possibilities list. We do not need to search for the last dimension since it is not free and its value is already determined. Index to Vector In this case we are given a number I representing the rank of a d dimensional vector in a set of d dimensional vectors with a known inner sum v, and we aim to generate this vector. We start by setting the first dimension to the minimum value 1, and count how many possibilities exits by the ψ(k, d − 1, s − 1). If this number is less than I, we decrease I by this value, set 2 for the first position and keep counting the possibilities in the same way until detecting the first value at which I is no longer larger. Thus, we have found the first dimension of the vector, we repeat the same procedure to detect the other dimensions. The pseudo code of this calculation is given at Algorithm 3. Algorithm 1: ψ(k, d, v) Algorithm 2: VectorToIndex((cid:104)v1, v2, . . . , vd(cid:105), d, k) Input: k: Maximum value of a dimension. d: The number of dimensions. v: The inner sum of the vectors. Output: Number of distinct d dimensional vectors with an inner sum of v . 1 if (v > k · d)(v < d) then 2 if (d = 1)(v = d) then return 0 ; return 1 ; 3 if (v = d + 1) then return d; 4 if (1 < v + k − k · d) then α = v + k − k · d 5 6 else 7 8 if (k < v − d + 1) then α = 1 9 β = k β = v − d + 1 10 else 11 12 sum = 0; 13 for (i = α; i ≤ β; i+ = 1) do sum+ = ψ(k, d − 1, v − i); 14 15 end 16 return sum; Input: k: Maximum value of a dimension. d: The number of Output: Rank of the input vector among lexicographically sorted dimensions. v1 . . . vd: Input vector. vectors with the same inner sum of(cid:80) i vi . 1 v = v1 + v2 + . . . + vd ; 2 if (d = 1)(v = d) then return 0 ; 3 index = 0; 4 for (i = 1; i < v1; i+ = 1) do 5 6 end 7 index+ = VectorToIndex((cid:104)v2, v3, . . . , vd(cid:105), d − 1, k); 8 return index; index+ = ψ(k, d − 1, v − i); Algorithm 3: IndexT oV ector(k, d, v, index) Input: k: Maximum value of a dimension d: The number of dimensions. v: The inner sum of the vectors. index: The rank of the vector among all possible vectors. Output: The (cid:104)v1, v2, . . . , vd(cid:105) vector with v1 + v2 + . . . + vd = v, and rank index among all possible vectors with inner sum v. 1 for (i = 1; i < d; i+ = 1) do 2 vi = 1; while (z = ψ(k, d − i, v − vi) < index) do index− = z; vi = vi + 1; 3 4 5 6 end v = v − vi; 7 8 end 9 vd = v; The Complete Method The pseudo-codes of the proposed encoding and decoding with the Non-uniquely decodable codes are given in Algorithms 4 and 5. In the encoding phase, the NPF codeword stream B is simply the concatenation of the NPF codewords. At each d symbols long block, the total length of the codewords is the corresponding pi value, which can take values from d to k · d. This pi value is encoded to the P stream by an adaptive compressor. The index corresponding to the vector of the latest d codeword lengths is computed with the V ectorT oIndex function as described in the enumeration section by using the pi value as the inner sum. This qi is then encoded into the Qstream with pi assumed to be the context in this compression. Notice that according to the pi value, the number of possible vectors change, where there appears relatively small candidates for small pi. When all the codewords in the block are 1 bit long, which means pi = d, then there is no need to encode qi since there is only one possibility. Similarly, pi = k · d implies all codeword are maximum length k, and again nothing is required to add into the compressed Qstream. The decoding phase is performed accordingly, where first the pi value is extracted from P stream. If the extracted pi is equal to d or k · d, this implies nothing has been added to the Qstream in the coding phase since the target vectors are determined with single options. Otherwise, by using the pi value as the context, the corresponding qi is extracted from Qstream followed by the IndexT oV ector operation. Algorithm 4: Encode(T, d) Algorithm 5: Decode(B, P stream, Qstream, d, n, W ) Input: T = t1t2 . . . tn is the input data, where ti ∈ Σ = {1, 2, . . . , σ}. d is the chosen block length. Output: The codeword bit-stream and the compressed (cid:104)pi, qi(cid:105) list. 1 r = (cid:100) n d (cid:101) ; 2 B = ∅ ; 3 Generate the NPF codeword set 4 k = (cid:98)log(σ + 1)(cid:99); 5 for (i = 0; i < r; i+ = 1) do 6 W = {w1, w2, . . . , wσ}; pi = 0; for (j = 0; j < d; j+ = 1) do h = T [i · d + j + 1]; B ← Bwh; vec[j + 1] = wh; pi+ = vec[j + 1]; 7 8 9 10 11 12 13 14 15 16 17 end end Encode pi into P stream with an adaptive coder; if (pi (cid:54)= d)&&(pi (cid:54)= k · d) then qi = V ectorT oIndex(vec[], d, k) ; Encode qi into Qstream with an adaptive coder by using the sum value as the context; Input: B is the NPF codeword bit stream. P stream is the compressed pi values. Qstream is the compressed qi values. W = {w1, w2, . . . , wσ} is the NPF codeword set. Output: The original data sequence T = t1t2 . . . tn d (cid:101) ; 1 r = (cid:100) n 2 k = (cid:98)log(σ + 1)(cid:99); 3 for (i = 0; i < r; i+ = 1) do 4 5 6 7 8 9 10 11 12 13 14 15 Decode pi from the P stream; if pi = d then else if pi = k · d then (cid:104)v1, v2, . . . , vd(cid:105) = (cid:104)1, 1, . . . , 1(cid:105); (cid:104)v1, v2, . . . , vd(cid:105) = (cid:104)k, k, . . . , k(cid:105); else Decode qi from the Qstream by using pi as the context ; (cid:104)v1, v2, . . . vd(cid:105) ← IndexT oV ector(k, d, pi, qi) ; end for (j = 1; j ≤ d; j+ = 1) do wh ← Read next vj bits from B; ti·d+j = h; end 16 17 end Implementation and Experimental Results Being directly proportional to the imbalance of the symbol frequencies in the source, the codewords with short lengths are expected to appear more, and thus, the d -- dimensional vectors are in general filled with small numbers with small pi values as a consequence. Figure 2 shows the distribution of block lengths and their corresponding number of distinct vectors by assuming d = 6 and k = 7. On the same figure also the observed frequencies of possible block bit lengths on a 100 megabyte English text are depicted, where the most frequent bit block length seems 15 here. We present the distribution of qi values in the context of p = 15 on Figure 3 to give an idea about the imbalance that increases the success of representing codeword boundaries over a) b) Figure 2: Assuming a block size of d = 6 symbols, and a maximum codeword length k = 7, a) presents possible bit block lengths and corresponding number of distinct vectors per each, b) presents the observed bit block lengths and their number of occurrences on 100MB of English text (etext file from the Manzini's corpus). Figure 3: The distribution are 1875 distinct 6 -- dimensional vectors, where each dimension can take values from 1 to k = 7 with an inner sum of 15 on 100MB of English text according to our enumeration scheme. the non -- prefix -- free codeword stream. We have implemented the proposed scheme and compared compression ratio against both static and adaptive versions of the Huffman and arithmetic codes (AC) on the test corpus. While compressing the P stream and Qstream, we have used the adaptive arithmetic encoder of [18], and tested our scheme with different block sizes of d = 2, d = 4, and d = 6. Table 1 shows the compression performance of each scheme on various files in terms of bits spent per each symbol in total. The experiments showed that for d = 6, the compression ratio of the Non-uniquely decodable codes generally improves the others. However, AC seems achieving better ratios on three files. On howto file the difference in between the AC and Non-uniquely decodable codes are very small as being in thousands decimal, which is not found to be meaningful. On howto.bwt, which is the same howto file after Burrows-Wheeler transform, the difference is sharper. This is mainly due to the fact that the runs in the BWT string may introduce an advantage for the adaptive codes. Notice that both files are around 40 megabytes and shorter than the other files except the chr22.dna file, on File sprot34.dat chr22.dna etext99 howto howto.bwt jdk13c rctail96 rfc w3c2 Size 109MB 34MB Symbols 66 (k=6) 5 (k=2) 105MB 146 (k=7) 39MB 197 (k=7) 39MB 198 (k=7) 69MB 113 (k=6) 114MB 93 (k=6) 116MB 120 (k=6) 104MB 256 (k=8) Entropy 4.762 2.137 4.596 4.834 4.834 5.531 5.154 4.623 5.954 Huffman Stat. Adapt. 4.785 4.797 2.195 2.263 4.595 4.645 4.779 4.891 4.891 3.650 5.486 5.563 5.172 5.187 4.573 4.656 5.984 5.700 Arithmetic Stat. Adapt. 4.749 4.764 1.960 2.137 4.558 4.604 4.731 4.845 4.845 3.471 5.450 5.535 5.139 5.156 4.529 4.626 5.960 5.659 NPF RS 5.434 2.957 5.140 5.300 5.300 6.404 5.766 5.094 6.648 WT 5.178 2,616 4,553 4.215 4.215 5.658 5.408 4.853 5.820 Non-uniquely decodable d=2 4.869 2.468 4.632 4.856 4.143 5.577 5.164 4.685 5.826 d=6 4.698 2.462 4.553 4.736 3.949 5.275 4.818 4.463 5.617 d=4 4.790 2.466 4.570 4.759 3.950 5.460 5.020 4.555 5.686 Table 1: Compression ratio comparison between the proposed scheme, NPF rank/select and wavelet tree [3], arithmetic, and Huffman coding in terms of bits/symbol. Codeword Pstream Qstream File sprot34.dat chr22.dna etext99 howto howto.bwt jdk13c rctail96 rfc w3c2 Stream 2.686 1.494 2.516 2.618 2.618 3.263 2.878 2.516 3.436 d=2 1.476 0.718 1.316 1.451 1.183 1.449 1.462 1.472 1.548 d=4 0.909 0.504 0.789 0.885 0.781 0.871 0.893 0.911 0.949 d=6 0.659 0.399 0.580 0.655 0.604 0.642 0.659 0.677 0.706 d=2 0.707 0.256 0.800 0.787 0.342 0.866 0.824 0.697 0.841 d=4 1.196 0.468 1.265 1.256 0.552 1.327 1.250 1.128 1.301 d=6 1.353 0.568 1.457 1.464 0.726 1.370 1.281 1.271 1.475 Table 2: The diffraction of the codeword stream, Pstream, and Qstream on the number of bits used per symbol for different d values. which our method performs clearly worse. In the current experimental observations it is thought that the performance of the proposed coding becomes better on large files with larger alphabets. It is possible to increase the block size, particularly on larger volumes. However, when d becomes larger current implementation suffers from the slow down due to the recursive function implementations to find the enumerative index of a vector, and vice versa. Considering that our compression scheme is composed of three main components as the base non-prefix-free code stream, and over that the P stream and Qstream, we would like to monitor their respective space occupation on the final compressed size. Table 2 includes the diffraction of these three components for different d values tested. There appears a trade off such that the P stream gets better compressed with increased block size, where the reverse works for Qstream. Discussions and Conclusions This study has shown that non-prefix-free codes with an efficient representation of the codeword boundaries can reach the entropy bounds in compression as is the case for prefix -- free codes. The incentive to choose Non-uniquely decodable codes as an alternative to Huffman or arithmetic coding might be their intrinsic security features. It is not possible to decode the codeword stream without the codeword boundary information encoded in P stream and Qstream. Thus, there is no need to encrypt the codeword stream when one would like to secure the compressed data. More than that, it is still possible to make some operations such as search and similarity computations on the codeword stream. Yet another opportunity might appear in the distributed storage of the data, where keeping the NPF codewords and codeword boundary informations in different sites can help in providing the security. Same idea may also apply in content delivery networks. Besides the compression ratio, where this study mainly concentrated, the mem- ory usage and the speed of compression are surely important parameters in practice. Current implementation is slow due to two main facts as NPF codewords are not byte -- aligned, and the vector to/from index enumerations are consuming additional time. The former problem is common to all variable length codes, which can be over- come by benefiting from the Huffman coding tables idea [19]. The enumeration time consumption can also be decreased by using tables which include the precomputed vector to/from index calculations by sacrificing a bit more memory. The algorithm engineering of the proposed scheme along with the possible applications in data secu- rity area are possible venues of research as a next step. Surely, better data structures to encode the codeword boundaries is open for improvement. References [1] M. Dalai and R. Leonardi, "Non prefix-free codes for constrained sequences," in Infor- IEEE, mation Theory, 2005. ISIT 2005. Proceedings. International Symposium on. 2005, pp. 1534 -- 1538. [2] M. O. Kulekci, "Uniquely decodable and directly accessible non-prefix-free codes via wavelet trees," in Information Theory Proceedings (ISIT), 2013 IEEE International Symposium on. IEEE, 2013, pp. 1969 -- 1973. [3] B. Ada¸s, E. Bayraktar, and M. O. Kulekci, "Huffman codes versus augmented non- prefix-free codes," in Experimental Algorithms. Springer, 2015, pp. 315 -- 326. [4] G. Navarro, "Wavelet trees for all," Journal of Discrete Algorithms, vol. 25, pp. 2 -- 20, 2014. [5] D. Okanohara and K. Sadakane, "Practical entropy-compressed rank/select dictio- nary," in Proceedings of the Meeting on Algorithm Engineering & Expermiments. So- ciety for Industrial and Applied Mathematics, 2007, pp. 60 -- 70. [6] P. Ferragina and R. Venturini, "A simple storage scheme for strings achieving entropy bounds," in Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms. Society for Industrial and Applied Mathematics, 2007, pp. 690 -- 696. [7] K. Fredriksson and F. Nikitin, "Simple compression code supporting random access and fast string matching," in Experimental Algorithms. Springer, 2007, pp. 203 -- 216. [8] J. Cleary and I. Witten, "A comparison of enumerative and adaptive codes," IEEE Transactions on Information Theory, vol. 30, no. 2, pp. 306 -- 315, 1984. [9] M. O. Kulekci, "Enumeration of sequences with large alphabets," arXiv preprint arXiv:1211.2926, 2012. [10] P.-R. Loh, M. Baym, and B. Berger, "Compressive genomics," Nature biotechnology, vol. 30, no. 7, pp. 627 -- 630, 2012. [11] T. Westmann, D. Kossmann, S. Helmer, and G. Moerkotte, "The implementation and performance of compressed databases," ACM Sigmod Record, vol. 29, no. 3, pp. 55 -- 67, 2000. [12] M. O. Kulekci, "On scrambling the burrows -- wheeler transform to provide privacy in lossless compression," Computers & Security, vol. 31, no. 1, pp. 26 -- 32, 2012. [13] J. Kelley and R. Tamassia, "Secure compression: Theory\ & practice." IACR Cryp- tology ePrint Archive, vol. 2014, p. 113, 2014. [14] D. W. Gillman, M. Mohtashemi, and R. L. Rivest, "On breaking a huffman code," IEEE Transactions on Information theory, vol. 42, no. 3, pp. 972 -- 976, 1996. [15] R. B. Muralidhar, "Substitution cipher with non-prefix-free codes," Master's thesis, San Jose State University, 2011. [16] L. Kraft, "A device for quantizing, grouping, and coding amplitude-modulated pulses," Master's thesis, Massachusetts Institute of Technology. Dept. of Electrical Engineering, 1946. [17] T. Cover, "Enumerative source encoding," IEEE Transactions on Information Theory, vol. 19, no. 1, pp. 73 -- 77, 1973. [18] A. Said, "Introduction to arithmetic coding-theory and practice," Hewlett Packard Laboratories, Palo Alto, CA, Tech. Rep. HPL -- 2004 -- 76, April 2004. [19] A. Siemi´nski, "Fast decoding of the huffman codes," Information Processing Letters, vol. 26, no. 5, pp. 237 -- 241, 1988.
1711.00821
1
1711
2017-11-02T17:04:58
Minor-free graphs have light spanners
[ "cs.DS" ]
We show that every $H$-minor-free graph has a light $(1+\epsilon)$-spanner, resolving an open problem of Grigni and Sissokho and proving a conjecture of Grigni and Hung. Our lightness bound is \[O\left(\frac{\sigma_H}{\epsilon^3}\log \frac{1}{\epsilon}\right)\] where $\sigma_H = |V(H)|\sqrt{\log |V(H)|}$ is the sparsity coefficient of $H$-minor-free graphs. That is, it has a practical dependency on the size of the minor $H$. Our result also implies that the polynomial time approximation scheme (PTAS) for the Travelling Salesperson Problem (TSP) in $H$-minor-free graphs by Demaine, Hajiaghayi and Kawarabayashi is an efficient PTAS whose running time is $2^{O_H\left(\frac{1}{\epsilon^4}\log \frac{1}{\epsilon}\right)}n^{O(1)}$ where $O_H$ ignores dependencies on the size of $H$. Our techniques significantly deviate from existing lines of research on spanners for $H$-minor-free graphs, but build upon the work of Chechik and Wulff-Nilsen for spanners of general graphs.
cs.DS
cs
Minor-free graphs have light spanners Glencora Borradaile Oregon State University Hung Le Oregon State University [email protected] [email protected] Christian Wulff-Nilsen University of Copenhagen [email protected] Abstract We show that every H-minor-free graph has a light (1+)-spanner, resolving an open problem of Grigni and Sissokho [13] and proving a conjecture of Grigni and Hung [12]. Our lightness bound is where σH = V (H)(cid:112)log V (H) is the sparsity coefficient of H-minor-free graphs. That is, (cid:18) σH 3 log O (cid:19) 1  it has a practical dependency on the size of the minor H. Our result also implies that the polynomial time approximation scheme (PTAS) for the Travelling Salesperson Problem (TSP) in H-minor-free graphs by Demaine, Hajiaghayi and Kawarabayashi [7] is an efficient PTAS whose running time is 2OH( 1  )nO(1) where OH ignores dependencies on the size of H. Our techniques significantly deviate from existing lines of research on spanners for H-minor-free graphs, but build upon the work of Chechik and Wulff-Nilsen for spanners of general graphs [6]. 4 log 1 1 Introduction Peleg and Schaffer [18] introduced t-spanners of graphs as a way to sparsify graphs while approxi- mately preserving pairwise distances between vertices. A t-spanner of a graph G is a subgraph S of G such that dS(x, y) ≤ t· dG(x, y) for all vertices x, y 1. Two parameters of t-spanners that are of interest are their sparsity and lightness. The sparsity of S is the ratio of the number of edges to the number of vertices of S. The lightness of S is the ratio of the total weight of the edges of S to the weight of an MST of G; generally, we assume that MST(G) ⊆ S (and so MST(S) = MST(G)). Here, we are concerned with the lightness of (1 + )-spanners, where  < 1, and so we refer to (1 + )-spanners simply as spanners. 7 1 0 2 v o N 2 ] S D . s c [ 1 v 1 2 8 0 0 . 1 1 7 1 : v i X r a We say that a spanner is light if the lightness does not depend on the number of vertices in the graph. Grigni and Sissokho [13] showed that H-minor-free graphs have spanners of lightness where σH = V (H)(cid:112)log V (H) is the sparsity coefficient of H-minor-free graphs; namely that an H-minor-free graph of n vertices has O(V (H)(cid:112)log V (H)n) edges2 [17]. Later Grigni and (1) O(cid:0) 1  σH log n(cid:1) . 1We use standard graph terminology, which can be found in Appendix A. 2This bound is tight [21]. 1 Hung [12], in showing that graphs of bounded pathwidth have light spanners, conjectured that H-minor-free graphs also have light spanners; that is, that the dependence on n can be removed from the lightness above. In this paper, we resolve this conjecture positively, proving: Theorem 1. Every H-minor-free graph G has a (1 + )-spanner of lightness (cid:18) σH O (cid:19) 3 log 1  . (2) Our algorithm consists of a reduction phase and a greedy phase. In the reduction phase, we adopt a technique of Chechik and Wulff-Nilsen [6]: edges of the graph are subdivided and their weights are rounded and scaled to guarantee that every MST-edge has unit weight and we include all very low weight edges in the spanner (Appendix C). In the greedy phase, we use the standard greedy algorithm for constructing a spanner to select edges from edges of the graph not included in the reduction phase (Appendix B). As a result of the reduction phase, our spanner is not the ubiquitous greedy spanner. How- ever, since Filtser and Solomon have shown that greedy spanners are (nearly) optimal in their lightness [10], our result implies that the greedy spanner for H-minor-free graphs is also light. 1.1 Implication: Approximating TSP Light spanners have been used to give PTASes, and in some cases efficient PTASes, for the traveling salesperson problem (TSP) on various classes of graphs. A PTAS, or polynomial-time approxima- tion scheme, is an algorithm which, for a fixed error parameter , finds a solution whose value is within 1 ±  of optimal in polynomial time. A PTAS is efficient if its running time is f ()nO(1) where f () is a function of . Rao and Smith [19] used light spanners of Euclidean graphs to give an EPTAS for Euclidean TSP. Arora, Grigni, Karger, Klein and Woloszyn [2] used light spanners of planar graphs, given by Althofer, Das, Dobkin, Joseph and Soares [1], to design a PTAS for TSP in planar graphs with running time nO( 1 2 )n by modifying the PTAS framework, using the same light spanner. Borradaile, Demaine and Tazari generalized Klein's EPTAS to bounded genus graphs [4]. 2 ). Klein [15] improved upon this running time to 2O( 1 In fact, it was in pursuit of a PTAS for TSP in H-minor-free graphs that Grigni and Sissokho discovered the logarithmic bound on lightness (Equation (1)); however, the logarithmic bound implies only a quasi-polynomial time approximation scheme (QPTAS) for TSP [13]. Demaine, Hajiaghayi and Kawarabayashi [7] used Grigni and Sissokho's spanner to give a PTAS for TSP in H-minor-free graphs with running time nO(poly( 1  )); that is, not an efficient PTAS. However, Demaine, Hajiaghayi and Kawarabayashi's PTAS is efficient if the spanner used is light. Thus, the main result of this paper implies an efficient PTAS for TSP in H-minor-free graphs. 1.2 Techniques In proving the lightness of spanners in planar graphs [1] and bounded genus graphs [11], the embedding of the graph was heavily used. Thus, it is natural to expect that showing minor- free graphs have light spanners would rely on the decomposition theorem of minor-free graphs by Robertson and Seymour [20], which shows that graphs excluding a fixed minor can be decomposed into the clique-sum of graphs nearly embedded on surfaces of fixed genus. Borradaile and Le [5] use this decomposition theorem to show that if graphs of bounded treewidth have light spanners, 2 then H-minor-free graphs also have light spanners. As graphs of bounded treewidth are generally regarded as easy instances of H-minor-free graphs, it may be possible to give a simpler proof of lightness of spanners for H-minor-free graphs using this implication. However, relying on the Robertson and Seymour decomposition theorem generally results in constants which are galactic in the size of the the minor [16, 14]. In this work, we take a different approach which avoids this problem. Our method is inspired from the recent work of Chechik and Wulff-Nilsen [6] on spanners for general graphs which uses an iterative super-clustering technique [3, 8]. Using the same technique in combination with amortized analysis, we show that H-minor-free graphs not only have light spanners, but also that the dependency of the lightness on  and V (H) is practical (Equation (2)). At a high level, our proof shares several ideas with the work of Chechik and Wulff-Nilsen [6] who prove that (general) graphs have (2k − 1) · (1 + )-spanners with lightness O(n1/k), removing a factor of k/ log k from the previous best-known bound and matching Erdos's girth conjecture [9] up to a 1 +  factor. Our work differs from Chechik and Wulff-Nilsen in two major aspects. First, Chechik and Wulff-Nilsen reduce their problem down to a single hard case where the edges of the graph have weight at most gk for some constant g. In our problem, we must partition the edges according to their weight along a logarithmic scale and deal with each class of edges separately. Second, we must employ the fact that H-minor-free graphs (and their minors) are sparse in order to get a lightness bound that does not depend on n. 1.3 Future directions Since we avoid relying on Robertson and Seymour's decomposition theorem and derive bounds using only the sparsity of graphs excluding a fixed minor, it is possible this technique could be extended to related spanner-like constructions that are used in the design of PTASes for connectivity problems. Except for TSP, many connectivity problems [4] have PTASes for bounded genus graphs but are not known to have PTASes for H-minor-free graphs – for example, subset TSP and Steiner tree. The PTASes for these problems rely on having a light subgraph that approximates the optimal solution within 1 +  (and hence is spanner-like). The construction of these subgraphs, though, rely heavily on the embedding of the graph on a surface and since the Robertson and Seymour decomposition gives only a weak notion of embedding for H-minor-free graphs, pushing these PTASes beyond surface embedded-graphs does not seem likely. The work of this paper may be regarded as a first step toward designing spanner-like graphs for problems such as subset TSP and Steiner tree that do not rely on the embedding. 2 Bounding the lightness of a (1 + )-spanner As we already indicated, we start with a reduction that allows us to assume that the edges of the MST of the graph each have unit weight. (For details, see Appendix C.) For simplicity of presentation, we will also assume that the spanner is a greedy (1 + s · ))-spanner for a sufficiently large constant s; this does not change the asymptotics of our lightness bound. Herein, we let S be the edges of a greedy (1 + s · )-spanner of graph G with an MST having edges all of unit weight. We simply refer to S as the spanner. The greedy spanner considers the edges in non-decreasing order of weights and adds an edge xy if (1 + s · )w(xy) is at most the x-to-y distance in the current spanner (see Appendix B for a review). 3 w(J0) = O(σH n/) = O j be the edges of S of weight in the range [ 2j i , 2j+1 Let Πi Let Jj = ∪iΠi j. We will prove that Lemma 2. There exists a set of spanner edges B such that w(B) = O( 1 j ∈ {0, . . . ,(cid:100)log 1 (cid:101)}, w (MST∪(Jj \ B)) = O  (3) w(MST)  ); note that MST ⊆ J0 and, (cid:17) (cid:16) σH i ) for every i ∈ Z+ and j ∈ {0, 1, . . . ,(cid:100)log 1 (cid:17) (cid:16) σH (cid:18) σH 2 w(MST)) and for every w(MST). (cid:101)}. (cid:19) 3 3 log 1  w(MST) We partition the edges of S according to their weight as it will be simpler to bound the weight of subsets of S. Let J0 be the edges of S of weight in the range [1, 1 since G has O(σH n) edges and w(MST) = n − 1, Combined with Equation (3), Lemma 2 gives us w(S) = w(B) + w(Jj \ B) = O  (cid:101)(cid:88) (cid:100)log 1 j=0 which, combined with the reduction to unit-weight MST-edges, proves Theorem 1 (noting that the stretch condition of S is satisfied since S is a greedy spanner of G). In the remainder, we prove Lemma 2 for a fixed j ≥ 0. Let Ei = Πi i ∈ Z+. Let (cid:96)i = 2j+1 We refer to the indices 0, 1, 2, . . . of the edge partition as levels. j for this fixed j and some ; then, the weight of the edges in Ei are in the range [(cid:96)i/2, (cid:96)i). Let E0 = MST. i 3 2.1 Proof overview To prove Lemma 2, we use an amortized analysis, initially assigning each edge of E0 = MST a (cid:1). For each level, we partition the vertices of the spanner into clusters where credit of c = O(cid:0) σH each cluster is defined by a subgraph of the graph formed by the edges in levels 0 through i. (Note that not every edge of level 0 through i may belong to a cluster; some edges may go between clusters.) Level i − 1 clusters are a refinements of level i clusters. We prove (by induction over the levels), that the clusters for each level satisfy the following diameter-credit invariants: DC1 A cluster in level i of diameter k has at least c · max{k, (cid:96)i 2 } credits. DC2 A cluster in level i has diameter at most g(cid:96)i for some constant g > 2 (specified later). We achieve the diameter-credit invariants for the base case (level 0) as follows. Although a simpler proof could be given, the following method we use will be revisited in later, more complex, constructions. Recall that E0 = MST and that, in a greedy spanner, the shortest path between endpoints of any edge is the edge itself. If the diameter of E0 is < (cid:96)0/2 = O(1), edges in the spanner have length at most (cid:96)0/2. Thus, it is trivial to bound the weight of all the spanner edges across all levels using the sparsity of H-minor-free graphs. Assuming a higher diameter, let T be a maximal collection of vertex-disjoint subtrees of E0, each having diameter (cid:100)(cid:96)0/2(cid:101) (chosen, for example, greedily). Delete T from E0. What is left is a set of trees T (cid:48), each of diameter < (cid:96)0/2. 4 For each tree T ∈ T , let CT be the union of T with any neighboring trees in T (cid:48) (connected to T by a single edge of E0). By construction, CT has diameter at most 3(cid:96)0/2 + 1 ≤ 2(cid:96)0 (giving DC2). CT is assigned the credits of all the edges in the cluster each of which have credit c (giving DC1). We build the clusters for level i from the clusters of level i − 1 in a series of four phases (Section 3). We call the clusters of level i − 1 -clusters, since the diameter of clusters in level i − 1 are an -fraction of the diameters of clusters in level i. A cluster in level i is induced by a group of -clusters. We try to group the -clusters so that the diameter of the group is smaller than the sum of the diameters of the -clusters in the group (Phases 1 to 3). This diameter reduction will give us an excess of credit beyond what is needed to maintain DC1 which allows us to pay for the edges of Ei. We will use the sparsity of H-minor free graphs to argue that each -cluster needs to pay for, on average, a constant number of edges of Ei. In Phase 4, we further grow existing clusters via MST edges and unpaid edges of Ei. Showing that the clusters for level i satisfy invariant DC2 will be seen directly from the con- struction. However, satisfying invariant DC1 is trickier. Consider a path D witnessing the diameter of a level-i cluster B. Let D be the graph obtained from D by contracting -clusters; we call D the cluster-diameter path. The edges of D are a subset of MST∪Ei. If D does not contain an edge of Ei, the credits from the -clusters and MST edges of D are sufficient for satisfying invariant DC1 for B. However, since edges of Ei are not initialized with any credit, when D contains an edge of Ei, we must use credits of the -clusters of B outside D to satisfy DC1 as well as pay for Ei. Finally, we need to pay for edges of Ei that go between clusters. We do so in two ways. First, some edges of Ei will be paid for by this level by using credit leftover after satisfying DC1. Second, the remaining edges will be paid for at the end of the entire process (over all levels); we show that there are few such edges over all levels (the edges B of Lemma 2). In our proof below, the fixed constant g required in DC2 is roughly 100 and  is sufficiently smaller than 1 g . For simplicity of presentation, we make no attempt to optimize g. We note that a (1 + )-spanner is also a (1 + 2)-spanner for any constant  and the asymptotic dependency of the lightness on  remains unchanged. That is, requiring that  is sufficiently small is not a limitation on the range of the parameter . 3 Achieving diameter-credit invariants In this section, we construct clusters for level i that satisfy DC2 using the induction hypothesis that -clusters (clusters of level i − 1) satisfy the diameter-credit invariants (DC1 and DC2). Since (cid:96)i−1 = (cid:96)i, we let (cid:96) = (cid:96)i, and drop the subscript in the remainder. For DC2, we need to group -clusters into clusters of diameter Θ((cid:96)). Let C be the collection of -clusters and C be the set Initially, C = ∅. We define a cluster graph K(C, Ei) of clusters that we construct for level i. whose vertices are the -clusters and edges are the edges of Ei. K(C, Ei) can be obtained from the subgraph of G formed by the edges of the -clusters and Ei by contracting each -cluster to a single vertex. Recall each -cluster is a subgraph of the graph formed by the edges in levels 0 through i − 1. Observation 3. K(C, Ei) is a simple graph. Proof. Since g(cid:96) ≤ (cid:96) g , there are no self-loops in K(C, Ei). Suppose that there are parallel edges x1y1 and x2y2 where x1, x2 ∈ X ∈ C and y1, y2 ∈ Y ∈ C. 2 when  is sufficiently smaller than 1 5 Let w(x2y2) ≤ w(x1y1), w.l.o.g.. Then, the path P consisting of the shortest x1-to-x2 path in X, edge x2y2 and the shortest y1-to-y2 path in Y has length at most w(x2y2) + 2g(cid:96) by DC2. Since w(x2y2) ≤ w(x1y1) and w(x1y1) ≥ (cid:96)/2, P has length at most (1 + 4g)w(x1y1). Therefore, if our spanner is a greedy (1 + 4g)-spanner, x1y1 would not be added to the spanner. We call an -cluster X high-degree if its degree in the cluster graph is at least 20  , and low-degree otherwise. For each -cluster X, we use C(X) to denote the cluster in C that contains X. To both maintaining diameter-credit invariants and buying edges of Ei, we use credits of -clusters in C(X) and MST edges connecting -clusters in C(X). We save credits of a subset S(X) of -clusters of C(X) and MST-edges connecting -clusters in S(X) for maintaining invariant DC1. We then reserve credits of another subset R(X) of -clusters to pay for edges of of Ei incident to -clusters in S(X) ∪ R(X). We let other -clusters in C(X) \ (S(X) ∪ R(X)) release their credits to pay for their incident edges of Ei; we call such -clusters releasing -clusters. We designate an -cluster in C(X) to be its center and let the center collect the credits of -clusters in R(X). The credits collected by the center are used to pay for edges of Ei incident to non-releasing -clusters. 3.1 Phase 1: High-degree -clusters In this phase, we group high-degree -clusters. The goal is to ensure that any edge of Ei not incident to a low-degree -cluster has both endpoints in the new clusters formed (possibly in distinct clusters). Then we can use sparsity of the subgraph of K(C, Ei) induced by the -clusters that were clustered to argue that the clusters can pay for all such edges; this is possible since this subgraph is a minor of G. The remaining edges that have not been paid for are all incident to low-degree -clusters which we deal with in later phases. With all -clusters initially unmarked, we apply Step 1 until it no longer applies and then apply Step 2 to all remaining high-degree -clusters at once and breaking ties arbitrarily: Step 1 If there is a high-degree -cluster X such that all of its neighbor -clusters in K are unmarked, we group X, edges in Ei incident to X and its neighboring -cluster into a new cluster C(X). We then mark all -clusters in C(X). We call X the center -cluster of C(X). Step 2 After Step 1, any unmarked high-degree -cluster, say Y , must have at least one marked neighboring -cluster, say Z. We add Y and the edge of Ei between Y and Z to C(Z) and mark Y . In the following, the upper bound is used to guarantee DC2 and the lower bound will be used to guarantee DC1. Claim 4. The diameter of each cluster added in Phase 1 is at least (cid:96) and at most (4 + 5g)(cid:96). Proof. Since the clusters formed are trees each containing at least two edges of Ei and since each edge of Ei has weight at least (cid:96)/2, the resulting clusters have diameter at least (cid:96). Consider an -cluster X that is the center of a cluster C in Step 1 that is augmented to (cid:98)C in Step 2 (where, possibly C = (cid:98)C). The upper bound on the diameter of (cid:98)C comes from observing that any two vertices in (cid:98)C are connected via at most 5 -clusters and via at most 4 edges of Ei -clusters have diameter at most g(cid:96) and edges of Ei have weight at most (cid:96), the diameter of (cid:98)C is (each -cluster that is clustered in Step 2 is the neighbor of a marked -cluster from Step 1). Since at most (4 + 5g)(cid:96). 6 Figure 1: A cluster C(X) formed in Phase 1 is enclosed in the dotted blue curve. The set S(X) consists of five gray -clusters inside the dotted blue closed curve and S(X) consists of green-shaded -clusters. Remaining hollow -clusters are releasing. Cluster C(X) will be augmented further in Phase 4 and augmenting -clusters are outside the dotted blue curve. Solid blue edges are in Ei and thin black edges are in MST. The diameter path D is highlighted by the dashed red curve and -clusters in D are gray-shaded. Let C(X) be a cluster in Phase 1 with the center X. Let N (X) be the set of X's neighbors in the cluster graph K(C, Ei). By construction, C(X) is a tree of -clusters. Thus, at most five -clusters in C(X) would be in the cluster-diameter path D while at most three of them are in N (X) ∪ {X}. We use the credit of X and of two -clusters in N (X) for maintaining DC1. Let this set of three -clusters be S(X). Since X is high-degree and  < 1, N (X) \ S(X) has at least  − 2 ≥ 18  -clusters in N (X) \ S(X). The center X collects the credits of -clusters in R(X). We let other -clusters in C \ (R(X) ∪ S(X)) release their own credits; we call such -clusters releasing -clusters. By diameter-credit invariants for level i − 1, each -cluster has at least c(cid:96) Observation 5. The center X of C(X) collects at least 9c(cid:96) credits.  -clusters. Let R(X) be any subset of 18 2 credits. Thus, we have: 20 Claim 6. If c = Ω(cid:0) σH Let A1 be the set of edges of Ei that have both endpoints in marked -clusters. (cid:1), we can buy edges of A1 using c(cid:96) credits deposited in the centers and credit  of releasing -clusters. Proof. Since the subgraph of K induced by marked -clusters and edges of A1 is H-minor-free, each marked -cluster, on average, is incident to at most O(σH ) edges of A1. Thus, each -cluster must be responsible for buying Ω(σH ) edges of A1. Consider a cluster C(X). The total credits of each releasing -clusters is at least c(cid:96) Ω(σH )(cid:96) when c = Ω( σH for incident edges of A1. Recall that non-releasing -clusters are in R(X) ∪ S(X) and: 2 , which is  ). For non-releasing -clusters, we use c(cid:96) credits from their center X to pay R(X) ∪ S(X) ≤ 5 + 18  7 (4) Step 1Phase 1Phase 4aXN(X)ediam <4ℓStep 2Phase 1Phase 4bStep 1Phase 4bStep 2S(X)R(X)ReleasingC(X) Figure 2: A cluster C(X) formed in Phase 2 is enclosed in the dotted blue curve. C(X) will be augmented further in Phase 4 and augmenting -clusters are outside the dotted blue curve. Edges connecting -clusters are MST edges. Thus, non-releasing -cluster are responsible for paying at most O( σH  ) edges of A1 and c(cid:96) credits suffice if c = Ω( σH  ). By Claim 6, each center -cluster has at least 8c(cid:96) credits remaining after paying for A1. We note that clusters in Phase 1 could be augmented further in Phase 4. We will use these remaining credits at the centers to pay for edges of Ei in Phase 4. 3.2 Phase 2: Low-degree, branching -clusters Let F be a maximal forest whose nodes are the -clusters that remain unmarked after Phase 1 and whose edges are MST edges between pairs of such -clusters. Let diam(P) be the diameter of a path P in F, which is the diameter of the subgraph of G formed by edges inside -clusters and MST edges connecting -clusters of P. We define the effective diameter ediam(P) to be the sum of the diameters of the -clusters in P. Since the edges of F have unit weight (since they are MST edges), the true diameter of a path in F is bounded by the effective diameter of P plus the number of MST edges in the path. Since each -cluster has diameter at least 1 (by construction of the base case), we have: Observation 7. diam(P) ≤ 2ediam(P). We define the effective diameter of a tree (in F) to be the maximum effective diameter over all paths of the tree. Let T be a tree in F that is not a path and such that ediam(T ) ≥ 2(cid:96). Let X be a branching vertex of T , i.e., a vertex of T of degree is at least 3, and let C(X) be a minimal subtree of T that contains X and X's neighbors and such that ediam(C(X)) ≥ 2(cid:96). We add C(X) to C and delete C(X) from T ; this process is repeated until no such tree exists in F. We refer to X as the center -cluster of C(X). Claim 8. The diameter of each cluster added in Phase 2 is at most (4 + 2g)(cid:96). Proof. Since C(X) is minimal, its effective diameter is at most 2(cid:96) + g(cid:96). The claim follows from Observation 7. 8 Phase 2ediam~ℓXPhase 4aediam <4ℓPhase 4bStep 1 Let X be a set of -clusters. We define a subset of X as follows: (cid:40)X any subset of 2g/ of X otherwise if X ≤ 2g/ (cid:98)X(cid:99)2g/ = By definition, we have: (cid:98)X(cid:99)2g/ ≤ 2g  (5) Let S(X) = (cid:98)C(X) ∩ D(cid:99)2g/ where D is the diameter path of C(X). We save credits of -clusters in S(X) for maintaining DC1 and we use credits of -clusters in C\S(X) to buy edges of Ei incident to -clusters in C(X). Since X is branching, at least one neighbor -cluster of X, say Y , is not in S(X). Let R(X) = {Y }. The center collects credits of clusters in R(X); other -clusters in C(X) \ {S(X) ∪ R(X)} release their credits. Let A2 be the set of unpaid edges of Ei incident to -clusters grouped in Phase 2. 3 ), we can buy edges of A2 using c(cid:96) 6 credits from the center -clusters and half Claim 9. If c = Ω( g the credit from releasing -clusters. Proof. Consider a cluster C(X) formed in Phase 2. Recall -clusters in Phase 2 are low-degree. Thus, each -cluster in C(X) is incident to at most 20  edges of A2. We need to argue that each  ) credits to pay for edges of A2. By invariant DC1 for level i − 1, -cluster has at least 20(cid:96) half credits of releasing -clusters are at least c(cid:96) 2 credits by invariant DC1 for level i − 1. Recall non-releasing -clusters are all in S(X). Thus, by Equation 5, the total number of edges of A2 incident to -clusters in S(X) ∪ R(X) is at most: (cid:16) g Since R(X) = 1, the center X collects at least c(cid:96) (cid:19) 20 4 , which is Ω( 1  )(cid:96) when c = Ω( 1 2 ). (cid:18) 2g  = Ω( (cid:96) (cid:17) + 1   = O 2 Since c = Ω( g 3 ), c(cid:96) 6 credits of the center X is at least Ω( g(cid:96) A2 incident to -clusters in S(X) ∪ R(X). 2 ) which suffices to buy all edges of We use remaining half the credit of releasing -clusters to achieve invariant DC1. More details will be given later when we show diameter-credit invariants of C(X). 3.3 Phase 3: Grouping -clusters in high-diameter paths In this phase, we consider components of F that are paths with high effective diameter. To that end, we partition the components of F into HD-components (equiv. HD-paths), those with (high) effective diameter at least 4(cid:96) (which are all paths) and LD-components, those with (low) effective diameter less that 4(cid:96) (which may be paths or trees). Phase 3a: Edges of Ei within an HD-path Consider an HD-path P that has an edge e ∈ Ei with endpoints in -clusters X and Y of P such that the two disjoint affices ending at X and Y both have effective diameter at least 2(cid:96). We choose e such that there is no other edge with the same property on the X-to-Y subpath of P (By Observation 3, there is no edge of Ei parallel to e). Let PX,Y be the X-to-Y subpath of P. By the 9 Figure 3: (a) A cluster of C in Case 1 of Phase 3a and (b) a cluster of C in Case 2 of Phase 3a. Thin edges are edges of MST, solid blue edges are edges of Ei and vertices are -clusters. Edges and vertices inside the dashed red curves are grouped into a new cluster. stretch guarantee of the spanner, diam(PX,Y ) ≥ (1 + s)w(e). Let PX and PY be minimal subpaths of the disjoint affices of P that end at X and Y , respectively, such that the effective diameters of PX and PY are at least 2(cid:96). PX and PY exist by the way we choose e. Case 1: ediam(PX,Y ) ≤ 2(cid:96) We construct a new cluster consisting of (the -clusters and MST edges of) PX,Y , PX , PY and edge e (see Figure 3(a)). We refer to, w.l.o.g, X as the center -cluster of the new cluster. Claim 10. The diameter of each cluster added in Case 1 of Phase 3a is at least (cid:96) (12 + 4g)(cid:96). 2 and at most Proof. Since the new cluster contains edge e of Ei and, in spanner S, the shortest path between endpoints of any edge is the edge itself, we get the lower bound of the claim. The effective diameters of PX and PY are each at most (2 + g)(cid:96) since they are minimal. By Observation 7, we get that the diameter is at most: 2(ediam(PX ) + ediam(PY ) + ediam(PX,Y )) ≤ 4(2 + g)(cid:96) + 4(cid:96) = (12 + 4g)(cid:96) Claim 11. Let x, y be any two vertices of G in a cluster C(X) added in Case 1 of Phase 3a. Let Px,y be the shortest x-to-y path in C(X) as a subgraph of G. Let Px,y be obtained from Px,y by contracting -clusters into a single vertex. Then, Px,y is a simple path. Proof. By construction, the only cycle of -clusters in C(X) is PX,Y ∪{e} (see Figure 3(a)). There- fore, if Px,y is not simple, e ∈ Px,y and Px,y must enter and leave PX,Y at some -cluster Z. In this case, D could be short-cut through Z, reducing the weight of the path by at least w(e) ≥ (cid:96)/2 and increasing its weight by at most diam(Z) ≤ g(cid:96). This contradicts the shortness of Px,y for  sufficiently smaller than 1 g (g < 1 2 ). Since PX,Y ∪ {e} is the only cycle of -clusters, by Claim 11, -clusters in D ∩ C(X) form a simple subpath of D where D is the diameter path of C(X). We have: Observation 12. PX,Y (cid:54)⊆ D. Proof. For otherwise, D could be shortcut through e at a cost of ≤ diam(X) + diam(Y ) + w(e) − (diam(PX,Y ) − diam(X) − diam(Y )) cost of shortcut ≤ +w(e) + 4g(cid:96) − (1 + s)w(e) ≤ 4g(cid:96) − s(cid:96)/2 (since w(e) ≥ (cid:96)/2) lower bound on diameter (by the stretch condition for e) (cid:123)(cid:122) (cid:125) (cid:124) (cid:123)(cid:122) (cid:125) (cid:124) 10 XYPX,YPXPYXYPXQXQYPY(a)(b) This change in cost is negative for s ≥ 8g + 1. Let S(X) = (cid:98)D ∩ C(X)(cid:99)2g/ and R(X) = (cid:98)C(X) \ D(cid:99)2g/. The center X collects the credits of -clusters in R(X) and MST edges outside D connecting -clusters of C(X). We let other -clusters in C(X) \ (R(X) ∪ S(X)) release their credits. Claim 13. If D does not contain e, then X has at least c(cid:96) cw(e) + c(cid:96) Proof. If C(X) \ D contains at least 2g level i − 1, the total credit of -clusters in R(X) is at least:  -clusters, then R(X) = 2g 2 credits. Otherwise, X has at least  . Thus, by invariant DC1 for 2 credits. 2g  · c(cid:96) 2 = gc(cid:96) ≥ c(cid:96) + c(cid:96) 2 ≥ cw(e) + (for g ≥ 2 and  < 1) c(cid:96) 2 (since w(e) ≤ (cid:96))  -clusters. In this case, R(X) = C(X)\D. Thus, we can assume that C(X)\D contains less than 2g Since PX,Y (cid:54)⊆ D by Observation 12, D does not contain, w.l.o.g., PX . Thus, R(X) contains at least one -cluster and the claim holds for the case that e (cid:54)∈ D. Suppose that D contains e and an internal -clusters of PX,Y , then w.l.o.g., D does not contain PX \ X. PX \ X has credit 2c(cid:96) − gc(cid:96). Since (cid:96) ≥ w(e) and (cid:96) − g(cid:96) ≥ (cid:96) 2 when  is sufficiently small ( ≤ 2 1+2g ), the claim holds. If D contains e but no internal -clusters of PX,Y , then diam(PX,Y \ {X, Y }) ≥ diam(PX,Y ) − diam(X) − diam(Y ) ≥ (1 + s)w(e) − diam(X) − diam(Y ) ≥ we + s(cid:96)/2 − 2g(cid:96) (by bounds on w(e) and DC2) ≥ we + (cid:96)/2 (for s ≥ 8g + 1, as previously required) The credit of the MST edges and -clusters of PX,Y \ {X, Y } is at least: c · (MST(PX,Y \ {X, Y }) + ediam(PX,Y \ {X, Y })) ≥ c · diam(PX,Y \ {X, Y }) ≥ c(we + (cid:96)/2) (by the stretch condition) (6) 3 ), we can buy edges of A3 using c(cid:96) Let A3 be the set of unpaid edges of Ei incident to -clusters of clusters in Case 1 of Phase 3a. 6 credits from each center and credits of Claim 14. If c = Ω( g releasing -clusters. Proof. Consider a cluster C(X) in Phase 3. Similar to Claim 9, releasing -clusters can pay for 2 ). By construction, non-releasing clusters of C(X) are in their incident edges in A3 when c = Ω( 1 S(X) ∪ R(X). Since R(X) ≤ 2g  by Equation (5) and since clusters now we are considering have low degree, there are at most · 20   and S(X) ≤ 2g (cid:16) g 4g  (cid:17) = O 2 edges of A3 incident to non-releasing -clusters. Thus, if c = Ω( g credits of X suffice to pay for all edges of A3 incident to non-releasing -clusters. 3 ), c(cid:96) 6 ≥ Ω( g 2 )(cid:96). That implies c(cid:96) 4 11 Case 2: ediam(PX,Y ) > 2(cid:96) Refer to Figure 3(b). Let QX and QY be minimal affices of PX,Y such that each has effective diameter at least (cid:96). We construct a new cluster consisting of (the -clusters and MST edges of) PX , PY , QX and QY and edge e. We refer to X as the center of the new cluster. We apply Case 1 to all edges of Ei satisfying the condition of Case 1 until no such edges exist. We then apply Case 2 to all remaining edges of Ei satisfying the conditions of Case 2. After each new cluster is created (by Case 1 or 2), we delete the -clusters in the new cluster from P, reassign the resulting components of P to the sets of HD- and LD-components. At the end, any edge of Ei with both endpoints in the same HD-path have both endpoints in two disjoint affixes of effective diameter less than 2(cid:96). We bound the diameter and credit of the centers of clusters in Case 2 of Phase 3a in Phase 3b. Phase 3b: Edges of Ei between HD-paths Let e be an edge of Ei that connects -cluster X of HD-path P to -cluster Y of different HD-path Q such that none affix of effective diameter less than 2(cid:96) of P contains X and none affix of effective diameter less than 2(cid:96) of Q contains Y . Such edge e is said to have both endpoints far from endpoint -clusters of P and Q. Let PX and QX be minimal edge-disjoint subpaths of P that end at X and each having effective diameter at least 2(cid:96). (PX and QX exist by the way we choose edge e.) Similarly, define PY and QY . We construct a new cluster consisting of (the -clusters and MST edges of) PX ,PY ,QX ,QY and edge e (see Figure 4). We refer to X as the center of the new cluster. We then delete the -clusters in the new cluster from P and Q, reassign the resulting components of P and Q to the sets of HD- and LD-components. We continue to create such new clusters until there are no edges of Ei connecting HD-paths with far endpoints. We now bound the diameter and credits of the center of a cluster, say C(X), that is formed in Case 2 of Phase 3a or in Phase 3b. By construction in both cases, C(X) consists of two paths PX ∪ QX and PY ∩ QY connected by an edge e. Claim 15. The diameter of each cluster in Case 2 of Phase 3a and Phase 3b is at least (cid:96) most (9 + 4g)(cid:96). 2 and at Proof. The lower bound follows from the same argument as in the proof of Claim 10. Since the effective diameters of QX and QY are smaller than the effective diameters of PX and PY , the diameter of the new cluster is bounded by the sum of the diameters of PX and PY and w(e). The upper bound follows from the upper bounds on these diameters as given in the proof of Claim 10. We show how to pay for unpaid edges of Ei incident to -clusters in Case 2 of Phase 3a and Phase 3b. W.l.o.g, we refer to X as the center -cluster of C(X). Let S(X) = (cid:98)D ∩ C(X)(cid:99)2g/ and R(X) = (cid:98)C(X) \ D(cid:99)2g/ where D is the cluster-diameter path of C(X). We save credits of -clusters in S(X) for maintaining invariant DC1. The center X collects credits of -clusters in R(X). We let other -clusters in C(X) \ (S(X) ∪ R(X)) to release their credits. Claim 16. The center of a cluster in Case 2 of Phase 3a or in Phase 3b has at least 2c(1 − g)(cid:96) credits. Proof. If C(X) \ D ≥ 2g  -clusters which have at least gc(cid:96) total credits by invariant DC1 for level i − 1. Since gc(cid:96) > 2c(1 − g)(cid:96) when g > 2, the claim holds. Thus, we assume that  , R(X) has 2g 12 Figure 4: A cluster of C in Phase 4a. Thin edges are edges of MST, solid blue edges are edges of Ei and vertices are -clusters. Edges and vertices inside the dashed red curves are grouped into a new cluster. C(X) \ D < 2g  which implies R(X) = C(X) \ D. By construction, S(X) contains -clusters of at most two of four paths PX ,PY ,QX ,QY . Since each path has effective diameter at least (cid:96), the -clusters of each path in R(X) have total diameter at least (cid:96) − g(cid:96). By invariant DC1 for level i − 1, each path in R(X) has at least c(1 − g)(cid:96) credits that implies the claim. Let A4 be the set of unpaid edges of Ei incident to -clusters of clusters in Case 2 of Phase 3a and clusters in Phase 3b. 2 ), we can buy edges of A4 using c(1 − 3g)(cid:96) credits of the centers of clusters Claim 17. If c = Ω( g in Case 2 of Phase 3a and Phase 3b and credits of releasing -clusters. Proof. Similar to the proof of Claim 9, releasing -clusters of C(X) can buy their incident edges in A4 2 ). By construction, non-releasing -clusters are in S(X) ∪ R(X). Since R(X) ≤ 2g when c = Ω( 1  and S(X) ≤ 2g  , there are at most O( g 2 ) edges of A4 incident to non-releasing -clusters. When  2 )(cid:96) and hence, c(1−3g)(cid:96) is sufficiently small ( < 1 credits suffice to pay for all edges of A4 incident to non-releasing -clusters of C(X). 6g ), c(1−3g)(cid:96) > c(cid:96) 2 . Thus, if c = Ω( g 2 ), c(cid:96) 2 = Ω( g 3.4 Phase 4: Remaining HD-paths and LD-components We assume that C (cid:54)= ∅ after Phase 3. The case when C = ∅ will be handled at the end of this section. Phase 4a: LD-components Consider a LD-component T , that has effective diameter less than 4(cid:96). By construction, T must have an MST edge to a cluster, say C(X), in C formed in a previous phase. We include T and an MST edge connecting T and C(X) to C(X). Let A5 be the set of unpaid edges of Ei that incident to -clusters merged into new clusters in this phase. We use credit of the center X and -clusters in this phase to pay for A5. More details will be given in Phase 4b. Phase 4b: Remaining HD-paths Let P be a HD-path. By construction, there is at least one MST edge connecting P to an existing cluster in C. Let e be one of them. Greedily break P into subpaths such that each subpath has effective diameter at least 2(cid:96) and at most 4(cid:96). We call a subpath of P a long subpath if it contains 13 XYPXQXPYYQ  + 1 -clusters and short subpath otherwise. We process subpaths of P in two steps. In at least 2g Step 1, we process affixes of P, long subpaths of P and the subpath of P containing an endpoint -cluster of e. In Step 2, we process remaining subpaths of P. Step 1 If a subpath P(cid:48) of P contain an -cluster that is incident to e, we merge P(cid:48) to the cluster in C that contains another endpoint -cluster of e. We call P(cid:48) the augmenting subpath of P. We form a new cluster from each long subpath of P and each affix of P. It could be that one of two affixes of P is augmenting. We repeatedly apply Step 1 for all HD-paths. The remaining cluster paths which are short subpaths of HD-paths would be handled in Step 2. We then pay for every unpaid edges of Ei incident to -clusters in this step. We call a cluster a long cluster if it is a long subpath of P and a short cluster if it is a short subpath of P. Let A6 be the set of unpaid edges of Ei incident to -clusters of long clusters. We show below that each long cluster can both maintain diameter-credit invariant and pay for its incident edges in A6 using credits of its -clusters. Let A7 be the set of unpaid edges of Ei incident to remaining -clusters involved in this step; those belong to augmenting subpaths and short affices of HD-paths. We can pay for edges of A7 incident to -clusters in augmenting subpaths using the similar argument in previous phases. However, we must be careful when paying for other edges of A7 that are incident to -clusters in short affices of P. Since short affices of P spend all credits of their children -clusters to maintain invariant DC1, we need to use credits of -clusters in P(cid:48) to pay for edges of A7 incident to short affices of P. Step 2 Let P(cid:48) be a short subpath of P. If edges of Ei incident to -clusters of P(cid:48) are all paid, we let P(cid:48) become a new cluster. Suppose that -clusters in P(cid:48) are incident to at least one unpaid edge of Ei, say e. We have: Observation 18. Edge e must be incident to an -cluster merged in Phase 1. Proof. Recall that edges of Ei incident to -clusters of clusters initially formed in previous phases except Phase 1 are in A2 ∪ . . . ∪ A7; thus, they are all paid. By construction, edges of Ei between two -clusters in the same cluster initially formed in Phase 1 are in A1∪A5∪A7 which are also paid. Since P(cid:48) is not an affix of P, there is no unpaid edge between two -clusters of P(cid:48) since otherwise P(cid:48) would become a new cluster in Phase 3a; that implies the observation. We merge -clusters, MST edges of P(cid:48) and e to the cluster in C that contains another endpoint of e. This completes the clustering process. Let A8 be the set of remaining unpaid edges of Ei incident to -clusters involved in Step 2. We now analyze clusters of C which are formed or modified in Phase 4. Claim 19. Let B be a short cluster. Then, diam(B) ≤ 8(cid:96) and credits of -clusters and MST edges connecting -clusters in B suffice to maintain invariant DC1 for B. Proof. Since ediam(B) ≤ 4(cid:96), by Observation 7, diam(B) ≤ 8(cid:96). The total credit of -clusters and MST edges in B is at least: c( MST(B) + ediam(B)) ≥ c · diam(B)) Since ediam(B)) ≥ 2(cid:96), B has at least 2c(cid:96) credits. Thus, B has at least c · max(diam(B), (cid:96)/2) credits. 14 We show how to pay for edges of Ei in A6 and maintain diameter-credit invariants of long clusters. We use cr(X ) to denote the total credit of -clusters of a set of -clusters X . Claim 20. Let B be a long cluster. If c = Ω( g 3 ) and g ≥ 8, we can maintain diameter-credit invariants of B and pay for edges in A6 incident to -clusters in B using credits of -clusters in B. Proof. By construction, B has effective diameter at most 4(cid:96). By Observation 7, B has diameter at most 8(cid:96). Thus, B satisfies invariant DC2 if g ≥ 8. Since B is a long cluster, it has at least 2g  + 1 -clusters. Let S be a set of 2g  -clusters in B and X be an -cluster in B \ S. Let R = {X}. We save credits of S for maintaining invariant DC1 of B and use credits of R to pay for edges of A6 incident to -clusters in S ∪R. Since S ∪R = 2g  + 1 and -clusters in S ∪R are low-degree, there 2 ) edges of A6 incident to -clusters in S ∪ R. By invariant DC1 for level i − 1, R are at most O( g has at least c(cid:96) 3 ). We let other -clusters in B \ (S ∪ R) pay for their incident edges of A6 using their credits. This is sufficient when c = Ω( 1 2 credits which is sufficient to pay for O( g 2 ) edges of A6 when c = Ω( g We use credits of S to maintain invariant DC1. Since S = 2g  and each -clusters has at 2 credits, cr(S) ≥ g(cid:96). Since diam(B) ≤ g(cid:96) by DC2, cr(S) ≥ cdiam(B). Thus, cr(S) ≥ least c(cid:96) c max(diam(B), (cid:96)/2); invariant DC1 is satisfied. 2 ) since each -cluster is incident to at most 20  edges and has at least c(cid:96) 2 credits. Let C(X) be a cluster in C before Phase 4. Let C(cid:48)(X),C(cid:48)(cid:48)(X) and C(cid:48)(cid:48)(cid:48)(X) be the corresponding clusters that are augmented from C(X) in Phase 4a, Step 1 of Phase 4b and Step 2 of Phase 4b, respectively. It could be that any two of three clusters are the same. By construction in Phase 4a, LD-components are attached to C(X) via MST edges. Recall each LD-component has effective diameter at most 4(cid:96) and hence, diameter at most 8(cid:96) by Observation 7. Thus, diam(C(cid:48)(X)) − diam(C(X)) ≤ 16(cid:96) + 2. By construction in Step 1 of Phase 4b, subpaths of effective diameter at most 4b(cid:96) are attached to C(cid:48)(X) via MST edges. Thus, diam(C(cid:48)(cid:48)(X)) − diam(C(cid:48)(X)) ≤ 16(cid:96) + 2. We have: Claim 21. diam(C(cid:48)(cid:48)(X)) − diam(C(X)) ≤ 32(cid:96) + 4. By construction in Step 2 of Phase 4b, subpaths of HD-paths are attached to C(cid:48)(cid:48)(X) via edges of Ei. Since attached subpaths have effective diameter at most 4(cid:96), by Observation 7, we have: Claim 22. diam(C(cid:48)(cid:48)(cid:48)(X)) − diam(C(cid:48)(cid:48)(X)) ≤ 18(cid:96) We are now ready to show invariant DC2 for C(cid:48)(cid:48)(cid:48)(X). Claim 23. diam(C(cid:48)(cid:48)(cid:48)(X)) ≤ g(cid:96) when g ≥ 70. Proof. From Claim 4, Claim 8, Claim 10 and Claim 15, C(X) has diameter at most: max((4 + 5g)(cid:96), (4 + 2g)(cid:96), (12 + 4g)(cid:96), (9 + 4g)(cid:96)) = (12 + 4g)(cid:96) which is at most 16(cid:96) when  is sufficiently small ( < 1/g). By Claim 21 and Claim 22, C(cid:48)(cid:48)(cid:48)(X) has diameter at most: 16(cid:96) + 32(cid:96) + 4 + 18(cid:96) = 66(cid:96) + 4 ≤ 70(cid:96) since (cid:96) ≥ 1. 15 Recall we show how to pay for edges in A1, A2, A3, A4, A6 before. It remains to show how to pay for edges in A5 ∪ A7 ∪ A8. We first consider edges in A5 ∪ A7. Recall S(X) = (cid:98)(D ∩ C(X))(cid:99)2g/ where D is the cluster-diameter path. We call -clusters in C(cid:48)(cid:48)(X)\C(X) augmenting -clusters. Let S(cid:48)(cid:48)(X) = (cid:98)(D ∩ (C(cid:48)(cid:48)(X) \ C(X))(cid:99)2g/ be the set of augmenting -clusters that are in the diameter path D. We save credits of -clusters in S(cid:48)(cid:48)(X) for maintaining DC1 and let other augmenting -clusters release their credits. Claim 24. If c = Ω( g credits of releasing augmenting -clusters. 2 ), we can buy edges in A5 ∪ A7 using c(cid:96) 3 credits of the cluster centers and 2 ) edges of A5 ∪ A7. Hence, c(cid:96) 6 credits of X to pay for edges of A5 ∪ A7 incident to -clusters in S(cid:48)(cid:48)(X). Recall Proof. We use c(cid:96)  edges of Ei since it is low-degree. Thus, -clusters in S(cid:48)(cid:48)(X) each -cluster is incident to at most 20 are incident to most O( g 2 ). We let releasing augmenting -clusters of LD-components to pay for their incident edges of A5. This is sufficient when c = Ω( 1 Let P1,P2,P3 be three segments of a HD-path P in Step 1 where P1,P2 are affixes of P and It could be that P1 = P3 or P2 = P3. Since edges of Ei P3 is the augmenting subpath of P. incident to long clusters are paid in Claim 20, -clusters of Pi, 1 ≤ i ≤ 2, are incident to unpaid edges of Ei only when Pi is a short cluster and thus, incident to at most O( g 2 ) edges of A7. Note that in Claim 19, we use all credits of -clusters and MST edges of Pi to maintain diameter-credit invariants and we need to pay for edges of A7 incident to Pi. We consider two cases: 2 ). Thus, all edges of A5 are paid. We now turn to edges of A7. 6 credits suffice when c = Ω( g 1. If P3 ∩ S(cid:48)(cid:48)(X) = ∅, then -clusters in P3 are releasing. Recall P3 has effective diameter at least 2(cid:96). We let each -cluster in P3 pay for its incident edges of A7 using half of its credits, 4 by invariant DC1 for level i − 1. This amount of credits is enough when which is at least c(cid:96) 2 ). The total remaining credit from -clusters of P3 is at least c(cid:96), that is sufficient to c = Ω( 1 pay for O( g 2 ) edges of A7 incident to -clusters of P1 ∪ P2 when c = Ω( g 2 ). 2. If P3∩S(cid:48)(cid:48)(X) (cid:54)= ∅, we use c(cid:96)/6 credits of the center X of C(cid:48)(cid:48)(X) to pay for edges of A7 incident  -clusters, X has to -clusters in X = (P1 ∩ S(cid:48)(cid:48)(X)) ∪ P2 ∪ P3. Recall S(cid:48)(cid:48)(X) has at most 2g  -clusters. Thus, -clusters in X are incident to at most 120g at most 6g edges in A7. Since there are at most two augmenting subpaths that contain -clusters of the cluster diameter path D, X only need to pay for at most 240g 6 credits are sufficient if 2 ). Other -clusters of P3 \ S(cid:48)(cid:48)(X) are releasing and we can use their released credits c = Ω( g to pay for their incident edges of A7. 2 ) edges. Thus, c(cid:96) 2 = O( g 2 We now show how to pay for edges of A8 which consists of edges of Ei incident to -clusters in Step 2 of Phase 4b. By Observation 18, C(X) is formed in Phase 1. Let S(cid:48)(cid:48)(cid:48)(X) be augmenting -clusters in D of C(cid:48)(cid:48)(cid:48)(X) that are not in S(X) ∪ S(cid:48)(cid:48)(X). We save credit of S(cid:48)(cid:48)(cid:48)(X) for maintaining DC1 and let other augmenting -clusters release their credits. Claim 25. If c = Ω( g of releasing -clusters and c(cid:96) credits of the center X. 2 ), we can pay for edges of A8 incident to -clusters in C(cid:48)(cid:48)(cid:48)(X) using credits Proof. Since augmenting -clusters are low-degree, each augmenting -cluster is incident to at most  edges of A8. When c = Ω( 1 20 2 credits of each releasing -cluster suffice to buy their incident edges of A8. 2 ), c(cid:96) 16 By construction, the augmenting subpath P(cid:48) in Step 1 of Phase 4b is a short path. Since the cluster-diameter path D contains -clusters of at most two short subpaths of HD-paths, S(cid:48)(cid:48)(cid:48)(X) ≤ 4g  . Thus, there are at most O( g 2 ) edges of A8 incident to non-releasing -clusters. Hence, c(cid:96) credits of X suffice to pay for such edges when c = Ω( g 2 ). It remains to maintain invariant DC1 for clusters in C. We have: Claim 26. If any of the sets S(X),S(cid:48)(cid:48)(X) and S(cid:48)(cid:48)(cid:48)(X) has at least 2g satisfies invariant DC1. Proof. Suppose, w.l.o.g, say S(X) has at least 2g credits of -clusters in S(X) is at least:   -clusters. Then, by DC1 for level i − 1, the total -clusters, then C(cid:48)(cid:48)(cid:48)(X) 2g  · c(cid:96) 2 = gc(cid:96) 3 ), we can maintain invariant DC1 of C(cid:48)(cid:48)(cid:48)(X) using credits of -clusters and which is at least c · max(diam(C(cid:48)(cid:48)(cid:48)(X)), (cid:96)/2) since diam(C(cid:48)(cid:48)(cid:48)(X)) ≤ g(cid:96) by Claim 23 and g > 1. Claim 27. If c = Ω( g MST edges in D and the credits of the cluster center X. Proof. By Claim 26, credits of all -clusters and MST edges of D are saved for maintaining DC1. We prove the claim by case analysis. Case 1: C(X) is formed in Phase 1. Recall D contains at most six edges of Ei where four edges of Ei are in C(X) and two more edges of Ei are by the augmentation in Step 2 of Phase 4b. We use 6c(cid:96) credits from X and credits of -clusters and MST edges in D. The total credit is: 6c(cid:96) + c( MST(D) + ediam(D)) ≥ c · diam(D) = c · diam(C(cid:48)(cid:48)(cid:48)(X))) Since C(cid:48)(cid:48)(cid:48)(X) contains an edge in Ei, diam(C(cid:48)(cid:48)(cid:48)(X)) ≥ (cid:96)/2. Thus, c · diam(C(cid:48)(cid:48)(cid:48)(X))) ≥ c(cid:96)/2. To complete the proof, we need to argue that X has non-negative credits after paying for edges of Ei and maintaining invariant DC1 of C(cid:48)(cid:48)(cid:48)(X). Recall X initially has 9c(cid:96) credits by Observation 5 and loses: • c(cid:96) credits in Claim 6. • c(cid:96) • c(cid:96) credits to pay for the edges of A8 incident to non-releasing augmenting -clusters in Step 3 credits in Claim 24. 2 of Phase 4b. • 6c(cid:96) credits for maintaining DC1 of C(cid:48)(cid:48)(cid:48)(X). Thus, X still has: 9c(cid:96) − 8c(cid:96) − c(cid:96) 3 = c(1 −  3 )(cid:96) which is non-negative since  < 1. Case 2: C(X) is formed in Phase 2. Recall the center X collects at least (cid:96) Y of X (R(X) = {Y }). We observe that credits in X is taken totally by at most (cid:96) 2 from a neighbor 2 in Claim 9 17 and Claim 24. Thus, the center still has non-negative credits after buying incident edges Ei when c = Ω( g Since credits of -clusters and MST edges in D are reserved and D does not contain any edge 3 ). of Ei, the total reserved credit is: c( MST(D) + ediam(D)) ≥ c · diam(D) = c · diam(C(cid:48)(cid:48)(X))) (7) It remains to argue that C(cid:48)(cid:48)(X) has at least c(cid:96) 2 credits. Note that we do not have lower bound on the diameter of C(cid:48)(cid:48)(X) as in other cases. Let X be the set of releasing -clusters of C(X) and cr(X ) be the total credits of -clusters in X . Since ediam(C(X)) ≥ 2(cid:96), we have: cr(X ) + cr(S(X)) ≥ 2c(cid:96) (8) Recall half credit of X is taken in Claim 9. We use the remaining half to guarantee that the credit of C(cid:48)(cid:48)(X) is at least c(cid:96)/2. Case 3: C(X) is formed in Case 1 of Phase 3a. Recall (in Claim 13) the center X collects 2 credits if D does not contain e (we are using notation in Case 1 Phase 3a) and at at least (cid:96) 2 credits if D contains e. We observe that credits in X is taken totally by at most least cw(e) + (cid:96) 2 in Claim 14 and Claim 21. By construction, D contains at most one edge of Ei which is e (cid:96) (in this case X has at least c · w(e) + (cid:96) 2 credits). Thus, the remaining credits of X and credits from reserved -clusters and MST edges in D are sufficient for maintaining invariant DC1. Since diam(C(cid:48)(cid:48)(X)) ≥ (cid:96)/2 by Claim 10, c · diam(C(cid:48)(cid:48)(X)) ≥ c(cid:96)/2. Case 4: C(X) is formed in Case 2 of Phase 3a or in Phase 3b. Recall in Claim 16, we argue that the center of cluster X collects at least 2c(1 − g)(cid:96) credits. By construction, D can contain at most one edge of Ei, which connects two cluster paths in Case 2 of Phase 3a or Phase 3b. We observe that credits in X is taken totally by at most c(1 − 3g − /3)(cid:96) in Claim 17 and Claim 24. Thus, X has at least: c(2 − 2g)(cid:96) − c(1 − 3g − /3)(cid:96) > c(cid:96) remaining credits. That implies the remaining credits of X and credits from reserved -clusters and MST edges in D are sufficient for maintaining invariant DC1. Since diam(C(cid:48)(cid:48)(X)) ≥ (cid:96)/2 by Claim 15, c · diam(C(cid:48)(cid:48)(X)) ≥ c(cid:96)/2. Proof of Lemma 2. Recall in the beginning of Phase 4, we assume that C (cid:54)= ∅ after Phase 3 and in this case, we already paid for every edges of Ei with: c = max( Θ(g) 3 , Θ(σH )  ) = O( σH 3 ) and  sufficiently small. We only need to consider the case when C = ∅ after Phase 3. We have: Observation 28. The case when C = ∅ after Phase 3 only happens when: (i) there is a single cluster-path P that contains all -clusters, (ii) every edge of Ei is incident to an -cluster in an affix of P of effective diameter at most 2(cid:96) and (iii) -clusters of P are low-degree in K(C, Ei). 18 We greedily break P into subpath of -clusters of effective diameter at least 2(cid:96) and at most 4(cid:96) as in Phase 4b and form a new cluster from each subpath. Recall a long cluster is formed from  + 1 -clusters. Let P(cid:48) be a subpath of P. If P(cid:48) is long, we can a subpath containing at least 2g both buy edges of Ei incident to -clusters of P(cid:48) and maintain two diameter-credit invariants as in Claim 20. If P(cid:48) is short, we use credits of  and MST edges of P(cid:48) to maintain DC1. Recall P(cid:48) has effective diameter at least (cid:96), thus, has at least c(cid:96) credits by DC1 for level i − 1. That implies c · diam(P(cid:48)) ≥ c max( (cid:96) We put remaining unpaid edges of Ei to the holding bag B. Recall unpaid edges of Ei must be incident to -clusters of short clusters, which are affixes of P. By Observation 28, B holds at most O( g 2 ) edges of Ei. Thus, the total weight of edges of B in all levels is at most: 2 , diam(P(cid:48))). 2 ) = O( 1 i, where (cid:96)max = maxe∈S{w(e)} (cid:88) i (cid:18) 1 (cid:19) 2 w(MST) (9) i 1 1 −  = O (cid:18) 1 (cid:19)(cid:88) 2 i O (cid:19) (cid:19) (cid:19) 2 (cid:18) 1 (cid:18) 1 (cid:18) 1 2 2 (cid:88) (cid:96)max i w(MST) w(MST) (cid:96)i ≤ O ≤ O ≤ O Acknowledgments: References [1] I. Althofer, G. Das, D. Dobkin, D. Joseph, and J. Soares. On sparse spanners of weighted graphs. Discrete Computational Geometry, 9(1):81–100, 1993. [2] S. Arora, M. Grigni, D. R. Karger, P. N. Klein, and A. Woloszyn. A polynomial-time approxi- mation scheme for weighted planar graph TSP. In Proceedings of the 9th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '98, pages 33–41, 1998. [3] B. Awerbuch, M. Luby, A. V. Goldberg, and S. A. Plotkin. Network decomposition and locality in distributed computation. In Proceedings of the 30th Annual Symposium on Foundations of Computer Science, FOCS '89, pages 364–369, 1989. [4] G. Borradaile, E. D. Demaine, and S. Tazari. Polynomial-time approximation schemes for subset-connectivity problems in bounded-genus graphs. Algorithmica, 68(2):287–311, 2014. [5] G. Borradaile and H. Le. Light spanners for bounded treewidth graphs imply light spanners for h-minor-free graphs. CoRR, abs/1703.10633, 2017. [6] S. Chechik and C. Wulff-Nilsen. Near-optimal light spanners. In Proceedings of the 27th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA'16, pages 883–892, 2016. [7] E. D. Demaine, M. Hajiaghayi, and K. Kawarabayashi. Contraction decomposition in H-minor- free graphs and algorithmic applications. In Proceedings of the 43rd Annual ACM Symposium on Theory of Computing, STOC ' 11, pages 441–450, 2011. 19 [8] M. Elkin and D. Peleg. (1 + , β)-spanner constructions for general graphs. SIAM Journal on Computing, 33(3):608–631, 2004. [9] P. Erdos. Extremal problems in graph theory. Theory of Graphs and Its Applications (Proc. Sympos. Smolenice), pages 29–36, 1964. [10] A. Filtser and S. Solomon. The greedy spanner is existentially optimal. In Proceedings of the 2016 ACM Symposium on Principles of Distributed Computing, PODC '16, pages 9–17, 2016. [11] M. Grigni. Approximate TSP in graphs with forbidden minors. In Proceedings of the 27th International Colloquium on Automata, Languages and Programming, ICALP '00, pages 869– 877, 2000. [12] M. Grigni and H. Hung. Light spanners in bounded pathwidth graphs. In Proceedings of the 37th International Conference on Mathematical Foundations of Computer Science, MFCS'12, pages 467–477, 2012. [13] M. Grigni and P. Sissokho. Light spanners and approximate TSP in weighted graphs with In Proceedings of the 13th Annual ACM-SIAM Symposium on Discrete forbidden minors. Algorithms, SODA '02, pages 852–857, 2002. [14] D. S. Johnson. The NP-completeness column: An ongoing guide (column 19). Journal of Algorithms, 8(3):438–448, 1987. [15] P. N. Klein. A linear-time approximation scheme for planar weighted TSP. In Proceedings of the 46th Annual IEEE Symposium on Foundations of Computer Science, FOCS '05, pages 647–657, 2005. [16] R. J. Lipton and K. W. Regan. People, Problems, and Proofs: Essays from Godel's Lost Letter: 2010, chapter David Johnson: Galactic Algorithms, pages 109–112. Springer Berlin Heidelberg, 2013. [17] W. Mader. Homomorphiesatze fur graphen. Mathematische Annalen, 178(2):154–168, 1968. [18] D. Peleg and A. A. Schaffer. Graph spanners. Journal of Graph Theory, 13(1):99–116, 1989. [19] S. B. Rao and W. D. Smith. Approximating geometrical graphs via "spanners" and "banyans". In Proceedings of the 30th Annual ACM Symposium on Theory of Computing, STOC '98, pages 540–550, 1998. [20] N. Robertson and P. D. Seymour. Graph minors. XVI. Excluding a non-planar graph. Journal of Combinatoral Theory Series B, 89(1):43–76, 2003. [21] A. Thomason. The extremal function for complete minors. Journal of Combinatorial Theory Series B, 82(2):318–338, 2001. 20 A Notation and definitions Let G(V (G), E(G)) be a connected and undirected graph with a positive edge weight function w : E(G) → (cid:60)+ \ {0}. We denote V (G) and E(G) by n and m, respectively. Let MST(G) be a minimum spanning tree of G; when the graph is clear from the context, we simply write MST. A walk of length p is a sequence of alternating vertices and edges {v0, e0, v1, e1, . . . , ep−1, vp} such that ei = vivi+1 for every i such that 1 ≤ 0 ≤ p − 1. A path is a simple walk where every vertex appears exactly once in the walk. For two vertices x, y of G, we use dG(x, y) to denote the shortest distance between x and y. Let S be a subgraph of G. We define w(S) =(cid:80) e∈E(S) w(e). Let X ⊆ V (G) be a set of vertices. We use G[X] to denote the subgraph of G induced by X. Let Y ⊆ E(G) be a subset of edges of G. We denote the graph with vertex set V (G) and edge set Y by G[Y ]. We call a graph K a minor of G if K can be obtained from G from a sequences of edge contraction, edge deletion and vertex deletion operations. A graph G is H-minor-free if it excludes a fixed graph H as a minor. If G excludes a fixed graph H as a minor, it also excludes the complete h-vertex graph Kh as a minor where h = V (H). Observation 29. If a graph G excludes Kh as a minor for h ≥ 3, then any graph obtained from G by subdividing an edge of G also excludes Kh as a minor. Proof. We can assume that G is connected. If h = 3, G is acyclic and the observation follows easily. Let K be the graph obtained from G by subdividing an arbitrary edge, say e, of G. Let v be the subdividing vertex. Suppose that K contains Kh as a minor. Then there are h vertex-disjoint trees {T1, T2, . . . , Th} that are subgraphs of K such that each Ti corresponds to a vertex of the minor Kh and there is an edge connecting every two trees. We say {T1, . . . , Th} witnesses the minor Kh in K. If v (cid:54)∈ V (T1 ∪ . . .∪ Th), then {T1, . . . , Th} witnesses Kh in G, contradicts that G excludes Kh as a minor. Thus, we can assume, w.l.o.g, v ∈ T1. Since h ≥ 4 and v has degree 2, T1 \ {v} (cid:54)= ∅. By contracting v to any of its neighbors in T1, we get a set of h trees witnessing the minor Kh in G, contradicting that G is Kh minor-free. B Greedy spanners A subgraph S of G is a (1 + )-spanner of G if V (S) = V (G) and dS(x, y) ≤ (1 + )dG(x, y) for all x, y ∈ V (G). The following greedy algorithm by Althofer et al. [1] finds a (1 + )-spanner of G: GreedySpanner(G(V, E), ) S ← (V,∅). Sort edges of E in non-decreasing order of weights. For each edge xy ∈ E in sorted order if (1 + )w(xy) < dS(x, y) E(S) ← E(S) ∪ {e} return S Observe that as algorithm GreedySpanner is a relaxation of Kruskal's algorithm, MST(G) = MST(S). Since we only consider (1 + )-spanners in this work, we simply call an (1 + )-spanners w(MST(G)) . We call S light if its a spanner. We define the lightness of a spanner S to be the ratio lightness is independent of the number of vertices or edges of G. w(S) 21 C Reduction to unit-weight MST edges We adapt the reduction technique of Chechik and Wulff-Nilsen [6] to analyze the increase in lightness due to this simplification for H-minor-free graphs. Let G be the input graph and let w : E(G) → (cid:60)+ be the edge weight function for G. Let ¯w = w(MST) be the average weight of the MST edges. We do the following: n−1 1. Round up the weight of each edge of E(G) to an integral multiple of ¯w. 2. Subdivide each MST edge so that each resulting edge has weight exactly ¯w. Let G(cid:48) be the resulting graph. 3. Scale down the weight of every edge by ¯w. Let w(cid:48) be the resulting edge weights of G(cid:48). G(cid:48) is minor-free by Observation 29. 4. Find a (1 + )-spanner S(cid:48) of G(cid:48). 5. Let S be a graph on V (G) with edge set equal to the union of E(S(cid:48)) ∩ E(G), the edges of MST(G), and every edge e in G of weight w(e) ≤ ¯w  . Lemma 30. If S(cid:48) is a (1 + )-spanner of G(cid:48) with lightness f (), then S is a (1 + O())-spanner of G with lightness 2f () + O(σH /). Proof. We adapt the proof of Chechik and Wulff-Nilsen [6]. We first bound w(S). For an edge e in E(S(cid:48))∩ E(G), w(e) ≤ ¯w· w(cid:48)(e) since weights are rounded up before scaling down. Since G is H-minor-free, G has O(σH n) edges and so has O(σH n) edges of weight at most ¯w  . Thus, the weight of the edges returned in Step 5 is: · O(σH n) w(S) ≤ ¯w · w(cid:48)(S(cid:48)) + w(MST(G)) + ¯w  Since S(cid:48) has lightness f () and since w(MST(G)) = (n − 1) ¯w, we get w(S) ≤ ¯w · f ()w(cid:48)(MST(G(cid:48))) + O(σH /) · w(MST(G)) The MST of G(cid:48) is comprised of the subdivided edges (Step 2) of the MST of G. Since the weight of each edge of MST(G) is rounded up to an integral multiple of ¯w, at most (n − 1) ¯w = w(MST(G)) is added to the weight of the MST of G. Therefore w(cid:48)(MST(G(cid:48))) ≤ 2w(MST(G))/ ¯w, giving w(S) ≤ 2f () · w(MST(G)) + O(σH /) · w(MST(G)) This proves the bound on the lightness of S. We next show that S is a (1 + O())-spanner of G. It is sufficient to show that for any edge e /∈ E(S) there is a path in S of weight at most (1 + O())w(e). Since S contains all edges of weight e be a path in S(cid:48) between e's endpoints of length at most ¯w at most (1 + )w(cid:48)(e). Let Se be the path in S that naturally corresponds to the path S(cid:48) e. As above, e). Therefore w(Se) ≤ (1 + ) ¯w · w(cid:48)(e). Since edge weights are rounded we have w(Se) ≤ ¯w · w(cid:48)(S(cid:48) up by at most ¯w, ¯w · w(cid:48)(e) ≤ w(e) + ¯w which in turn is ≤ w(e) + w(e) since w(e) > ¯w  , we may assume that w(e) > ¯w  . Let S(cid:48)  . We get w(Se) ≤ (1 + )2w(e) = (1 + O())w(e). By Lemma 30, we may assume that all edges of MST(G) have weight 1. We find the (1 + )- spanner S of G by using the greedy algorithm. Thus, the stretch condition of S is satisfied. 22
1908.00351
2
1908
2019-12-30T16:59:38
Sparse Regression via Range Counting
[ "cs.DS", "cs.CG" ]
The sparse regression problem, also known as best subset selection problem, can be cast as follows: Given a set $S$ of $n$ points in $\mathbb{R}^d$, a point $y\in \mathbb{R}^d$, and an integer $2 \leq k \leq d$, find an affine combination of at most $k$ points of $S$ that is nearest to $y$. We describe a $O(n^{k-1} \log^{d-k+2} n)$-time randomized $(1+\varepsilon)$-approximation algorithm for this problem with \(d\) and \(\varepsilon\) constant. This is the first algorithm for this problem running in time $o(n^k)$. Its running time is similar to the query time of a data structure recently proposed by Har-Peled, Indyk, and Mahabadi (ICALP'18), while not requiring any preprocessing. Up to polylogarithmic factors, it matches a conditional lower bound relying on a conjecture about affine degeneracy testing. In the special case where $k = d = O(1)$, we also provide a simple $O_\delta(n^{d-1+\delta})$-time deterministic exact algorithm, for any \(\delta > 0\). Finally, we show how to adapt the approximation algorithm for the sparse linear regression and sparse convex regression problems with the same running time, up to polylogarithmic factors.
cs.DS
cs
Sparse Regression via Range Counting Jean Cardinal∗† Aur´elien Ooms‡§ January 1, 2020 Abstract The sparse regression problem, also known as best subset selection problem, can be cast as follows: Given a set S of n points in Rd, a point y ∈ Rd, and an integer 2 ≤ k ≤ d, find an affine combination of at most k points of S that is nearest to y. We describe a O(nk−1 logd−k+2 n)-time randomized (1 + ε)-approximation algorithm for this problem with d and ε constant. This is the first algorithm for this problem running in time o(nk). Its running time is similar to the query time of a data structure recently proposed by Har-Peled, Indyk, and Mahabadi (ICALP'18), while not requiring any preprocessing. Up to polylogarithmic factors, it matches a conditional lower bound relying on a conjecture about affine degeneracy testing. In the special case where k = d = O(1), we also provide a simple Oδ(nd−1+δ)-time deterministic exact algorithm, for any δ > 0. Finally, we show how to adapt the approximation algorithm for the sparse linear regres- sion and sparse convex regression problems with the same running time, up to polylogarithmic factors. 1 Introduction Searching for a point in a set that is the closest to a given query point is certainly among the most fundamental problems in computational geometry. It motivated the study of crucial concepts such as multidimensional search data structures, Voronoi diagrams, dimensionality reduction, and has immediate applications in the fields of databases and machine learning. A natural generalization of this problem is to search not only for a single nearest neighbor, but rather for the nearest combination of a bounded number of points. More precisely, given an integer k and a query point y, we may wish to find an affine combination of k points of the set that is the nearest to y, among all possible such combinations. This problem has a natural interpretation in terms of sparse approximate solutions to linear systems, and is known as the sparse regression, or sparse approximation problem in the statistics and machine learning literature. Sparsity is defined here in terms of the (cid:96)0 pseudonorm (cid:107).(cid:107)0, the number of nonzero components. The sparse affine regression problem can be cast as follows: Problem 1 (Sparse affine regression). Given a matrix A ∈ Rd×n, a vector y ∈ Rd, and an integer 2 ≤ k ≤ d, find x ∈ Rn minimizing (cid:107)Ax − y(cid:107)2, and such that (cid:107)x(cid:107)0 ≤ k, and(cid:80)n i=1 xi = 1. ∗Universit´e libre de Bruxelles (ULB), Brussels, Belgium. Email: [email protected] †Supported by the Fonds de la Recherche Scientifique-FNRS under CDR Grant J.0146.18. ‡BARC, University of Copenhagen, Denmark. Email: [email protected] §Supported by the VILLUM Foundation grant 16582. Part of this research was accomplished while the author was a PhD student at ULB under FRIA Grant 5203818F (FNRS). 1 By interpreting the columns of A as a set of n points in Rd, the problem can be reformulated in geometric terms as the nearest induced flat problem. Problem 2 (Nearest induced flat). Given a set S of n points in Rd, an additional point y ∈ Rd, and an integer k such that 2 ≤ k ≤ d, find k points of S such that the distance from y to their affine hull is the smallest. Here the distance from a point to a flat is the distance to the closest point on the flat. Note that if we allow k = 1 in the above definition, we have the nearest neighbor problem as a special case. We consider the setting in which the dimension d of the ambient space as well as the number k of points in the sought combination are constant, and study the asymptotic complexity of the problem with respect to n. As observed recently by Har-Peled, Indyk, and Mahabadi [25], the problem is closely related to the classical affine degeneracy testing problem, defined as follows. Problem 3 (Affine degeneracy testing). Given a set S of n points in Rd, decide whether there exists d + 1 distinct points of S lying on an affine hyperplane. The latter can be cast as deciding whether a point set is in so-called general position, as is often assumed in computational geometry problems. In the special case d = 2, the problem is known to be 3SUM-hard [6, 24]. In general, it is not known whether it can be solved in time O(nd−δ) for some positive δ [3, 21]. Supposing it cannot, we directly obtain a conditional lower bound on the complexity of the nearest induced flat problem. This holds even for approximation algorithms, which return an induced flat whose distance is within some bounded factor of the distance of the actual nearest flat. Lemma 1 (Har-Peled, Indyk, and Mahabadi [25]). If the nearest induced flat problem can be approximated within any multiplicative factor in time O(nk−1−δ) for some positive δ, then affine degeneracy testing can be solved in time O(nd−δ). Proof. Suppose we have an approximation algorithm for the nearest induced flat problem. Then given an instance of affine degeneracy testing, we can go through every point y ∈ S and run this algorithm on an instance composed of the set S \ {y}, the point y, and k = d. The answer to the degeneracy testing instance is positive if and only if for at least one of these instances, the distance to the approximate nearest flat is zero. The running time is O(nd−δ). Motivations and previous works Sparse regression is a cornerstone computational task in statistics and machine learning, and comes in a number of flavors. It is also referred to as best subset selection or, more generally, as feature selection problems [8, 31]. In practice, it is often useful to allow for the sparsity constraint by including a penalty term in the objective function, hence writing the problem in a Lagrangian form. If the (cid:96)1 norm is used instead of the (cid:96)0 norm, this method is known as the LASSO method [32], to which a tremendous amount of research has been dedicated in the past twenty years. In the celebrated k-SVD algorithm for sparse dictionaries design [2], the sparse coding stage consists of a number of sparse regression steps. In this context, they are typically carried out using greedy methods such as the matching pursuit algorithm [29]. Efficient sparse regression is also at the heart of compressed sensing techniques [10, 18]. Aiming at an exhaustive survey of the variants and applications of sparse regression is futile; instead, we refer to Hastie, Tibshirani, and Friedman [26] (Chapter 3), Miller [30], and references 2 therein. We also point to Bertsimas, Pauphilet, and Van Parys [9] for a recent survey on practical aspects of sparse regression methods. The computational complexity of sparse regression problems is also well-studied [17, 22, 23, 31]. In general, when a solution x is sought that minimizes the number of nonzero components while being at bounded distance from y, the problem is known to be NP-hard [31]. However, the complexity of the sparse regression problem when the sparsity constraint k is taken as a fixed parameter has not been thoroughly characterized. In particular, no algorithm with running time o(nk) is known. Recently, Har-Peled, Indyk, and Mahabadi [25] showed how to use approximate nearest neighbor data structures for finding approximate solutions to the sparse affine regression problem. They mostly consider the online version of the problem, in which we allow some preprocessing time, given the input point set S, to construct a data structure, which is then used to answer queries with input y. They also restrict to approximate solutions, in the sense that the returned solution has distance at most (1 + ε) times larger than the true nearest neighbor distance for any fixed constant ε. They show that if there exists a (1 + ε)-approximate nearest neighbor data structure with preprocessing time S(n, d, ε) and query time Q(n, d, ε), then we can preprocess the set S in time nk−1S(n, d, ε) and answer regression queries in time nk−1Q(n, d, ε). Plugging in state of the art results on approximate nearest neighbor searching in fixed dimension [5], we obtain a preprocessing time of O(nk log n) with query time O(nk−1 log n) for fixed constants d and ε. Har-Peled et al. [25] also consider the sparse convex regression problem, in which the coefficients of the combination are not only required to sum to one, but must also be nonnegative. In geometric terms, this is equivalent to searching for the nearest induced simplex. They describe a data structure for the sparse convex regression problem having the same performance as in the affine case, up to a O(logk n) factor. For k = 2, they also give a (2 + ε)-approximation subquadratic-time offline algorithm. When d = O(1), the running time of this algorithm can be made close to linear. A closely related problem is that of searching for the nearest flat in a set [7, 27, 28]. This was also studied recently by Agarwal, Rubin, and Sharir [1], who resort to polyhedral approximations of the Euclidean distance to design data structures for finding an approximate nearest flat in a set. They prove that given a collection of n (k−1)-dimensional flats in Rd, they can construct a data structure in time O(nk polylog(n)) time and space that can be used to answer (1 + ε)-approximate nearest flat queries in time O(polylog(n)). They also consider the achievable space-time tradeoffs. Clearly, such a data structure can be used for online sparse affine regression: We build the structure with (cid:1) flats induced by the points of S. This solution has a very large space requirement all possible(cid:0)n k and does not help in the offline version stated as Problem 2. In the following, we give an efficient algorithm for Problem 2, and bridge the gap between the trivial upper bound of O(nk) and the lower bound given by the affine degeneracy testing problem, without requiring any preprocessing. Our results Nearest induced line, flat, or hyperplane. We prove that the nearest induced flat problem (Problem 2), can be solved within a (1 + ε) approximation factor for constant d and ε in time O(nk−1 logd−k+2 n), which matches the lower bound on affine degeneracy testing, up to polyloga- rithmic factors. This is a near-linear improvement on all previous methods. The running time of our algorithm is also comparable to the query time of the data structure proposed by Har-Peled et al. [25]. The two main tools that are used in our algorithms are on one hand the approximation of 3 the Euclidean distance by a polyhedral distance, as is done in Agarwal, Rubin, and Sharir [1], and on the other hand a reduction of the decision version of the problem to orthogonal range queries. Note that orthogonal range searching data structures are also used in Har-Peled et al. [25], albeit in a significantly distinct fashion. In Section 2, as warm-up, we focus on the special case of Problem 2 in which d = 3 and k = 2. Problem 4 (Nearest induced line in R3). Given a set S of n points in R3, and an additional point y, find two points a, b ∈ S such that the distance from y to the line going through a and b is the smallest. Our algorithm for this special case already uses all the tools that are subsequently generalized for arbitrary values of k and d. The general algorithm for the nearest induced flat problem is described in Section 3. In Section 4, we consider the special case of Problem 2 in which k = d, which can be cast as the nearest induced hyperplane problem. Problem 5 (Nearest induced hyperplane). Given a set S of n points in Rd, and an additional point y, find d points of S such that the distance from y to the affine hyperplane spanned by the d points is the smallest. For this case, we design an exact algorithm with running time O(nd−1+δ), for any δ > 0. The solution solely relies on classical computational geometry tools, namely point-hyperplane duality and cuttings [15, 16]. Our algorithms can be adapted to perform sparse linear regression, instead of sparse affine regression. In the former, we drop the condition that the sum of the coefficients must be equal to one. This is equivalent to the nearest linear induced k-flat problem. It can be solved in the same time as in the affine case. To see this, realize that the problem is similar to the nearest induced flat problem where the first vertex is always the origin. The obtained complexity is the same as the one for the nearest induced flat problem. Nearest induced simplex. Adapting our algorithm to sparse convex regression, in which x is also required to be positive, is a bit more involved. Har-Peled et al. [25] augment their data structure for the nearest induced flat with orthogonal range searching data structures in (k + 1)- dimensional space to solve this problem with an extra O(logk n) factor in both the preprocessing and query time. We show we can perform a similar modification. The sparse convex regression problem can be cast as the problem of finding the nearest simplex induced by k points of S. Problem 6 (Nearest induced simplex). Given a set S of n points in Rd, an additional point y, and an integer k such that 2 ≤ k ≤ d, find k points of S such that the distance from y to their convex hull is the smallest. We prove that this problem can also be approximated within a (1 + ε) approximation factor for constant d and ε in time O(nk−1 logd n), hence with an extra O(logk−2 n) factor in the running time compared to the affine case. This is described in Section 5. Our results and the corresponding sections are summarized in Table 1. 4 Table 1: Results. Problem Problem 4: Nearest induced line in R3 Problem 2: Nearest induced flat Problem 5: Nearest induced hyperplane Problem 6: Nearest induced simplex Section Approximation Running Time § 2 § 3 § 4 § 5 Oε(n log3 n) Od,ε(nk−1 logd−k+2 n) Od,δ(nd−1+δ), ∀δ > 0 Od,ε(nk−1 logd n) 1 + ε 1 + ε 1 + ε 1 2 A (1 + ε)-approximation algorithm for the nearest induced line problem in R3 We first consider the nearest induced line problem (Problem 4). We describe a near-linear time algorithm that returns a (1 + ε)-approximation to the nearest induced line in R3, that is, a line at distance at most (1 + ε) times larger than the distance to the nearest line. Theorem 1. For any positive constant ε, there is a randomized (1 + ε)-approximation algorithm for the nearest induced line problem in R3 running in time Oε(n log3 n) with high probability. (1 + ε)-approximation via polyhedral distances. The proof uses the following result due to Dudley [19], that is also a major ingredient in the design of the data structure described by Agarwal, Rubin, and Sharir [1]. The polyhedral distance dQ(y, v) between two points y and v with respect to a polyhedron Q centered on the origin is the smallest λ such that the dilation λQ of Q centered on y contains v, hence such that v ∈ y + λQ. Lemma 2 (Dudley [19]). For any positive integer d and positive real ε, there exists a d-dimensional polyhedron Q of size O(1/ε(d−1)/2) such that for every y, v ∈ Rd: (cid:107)y − v(cid:107)2 ≤ dQ(y, v) ≤ (1 + ε) · (cid:107)y − v(cid:107)2 . Proof of Theorem 1. We reduce the problem to a simpler counting problem in two steps. Edge-shooting. We use Lemma 2 for d = 3. We give an exact algorithm for computing the nearest induced line with respect to a polyhedral distance dQ, where Q is defined from ε as in Lemma 2. Given a polyhedron Q, one can turn it into a simplicial polyhedron by triangulating it. Therefore, for constant values of ε, this reduces the problem to a constant number of instances of the edge-shooting problem, defined as follows: Given an edge e of Q, find the smallest value λ such that y + λe intersects a line through two points of S. We iterate this for all edges of Q, and pick the minimum value. This is exactly the polyhedral distance from y to its nearest induced line. Binary search. Using a randomized binary search procedure, we reduce the edge-shooting prob- lem to a simpler counting problem, defined as follows: given the triangle ∆ defined as the convex hull of y and y + λe, count how many pairs of points a, b ∈ S are such that the line (cid:96)(a, b) through them intersects ∆. Suppose there exists a procedure for solving this problem. We can use this procedure to solve the edge-shooting problem as follows. First initialize λ to some upper bound on the distance (for instance, initialize λ to the distance to the closest data point p ∈ S: λ = minp∈S (cid:107)p − y(cid:107)2). Then count how many lines (cid:96)(a, b) intersects 5 Figure 1: The cone Ca. ∆, using the procedure. If there is only one, then return this value of λ. Otherwise, pick one such line uniformly at random, compute the value λ such that this line intersects y + λe. Then iterate the previous steps starting with this new value of λ. Since we picked the line at random, and since there are O(n2) such lines at the beginning of the search, the number of iterations of this binary search is O(log n) with high probability. We therefore reduced the nearest induced line problem to O(ε−1 log n) instances of the counting problem. Orthogonal range counting queries. Data structures for orthogonal range counting queries store a set of points in Rg in such a way that the number of points in a given g-rectangle (cartesian product of g intervals) can be returned quickly. Known data structures for orthogonal range count- ing queries in Rg require O(n logg−1 n) preprocessing time and can answer queries in O(logg−1 n) time [14, 34]. Note that the actual coordinates of the points do not matter: We only need to know the order of their projections on each axis. We now show how to solve the counting problem using a data structure for orthogonal range queries in R3. Let us fix the triangle ∆ and a point a ∈ R3, and consider the locus of points b ∈ R3 such that the line (cid:96)(a, b) intersects ∆. This is a double simplicial cone with apex a and whose boundary contains the boundary of ∆. This double cone is bounded by three planes, one for each edge of ∆. In fact, we will only consider one of the two cones, because (cid:96)(a, b) intersects ∆ if and only if either b is contained in the cone of apex a, or a is contained in the cone of apex b. Let us call Ca the cone of apex a. This is illustrated on Figure 1. Let us consider one edge f of ∆ and all the planes containing f . These planes induce a circular order on the points of S, which is the order in which they are met by a plane rotating around the supporting line of f . This is illustrated on Figure 2. Now let us denote by Hf the plane containing a and f and by H + f the halfspace bounded by Hf and containing ∆. The set of points of S contained in H + f is an interval in the circular order mentioned above. Hence the set of points contained in Ca is the intersection of three intervals in the three circular orders defined by the three edges of ∆. Now we can use an orthogonal range counting data structure for storing the points of S with coordinates corresponding to their ranks in each of the three orders induced by the three edges of 6 ab∆Ca Figure 2: The order of the points defined by the planes containing an edge f of ∆. ∆. This requires sorting them three times, in time O(n log n). Then for each point a ∈ S, we count the number of points b in the cone Ca by querying the data structure. Note that the circularity of the order can be easily handled by doubling every point. We preprocess S in time O(n log n) and answer each of the n queries in time O(log2 n). Hence overall, this takes time O(n log2 n). This can be combined with the previous reductions provided we can choose a line intersecting ∆ uniformly at random within that time bound. This is achieved by first choosing a with probability proportional to the number of points b such that (cid:96)(a, b) ∩ ∆ (cid:54)= ∅. Then we can pick a point b uniformly at random in this set in linear time. Combining with the previous reductions, we therefore obtain an approximation algorithm run- ning in time Oε(n log3 n) for the nearest induced line problem in R3. This completes the proof of Theorem 1. 3 A (1 + ε)-approximation algorithm for the nearest induced flat problem This section is dedicated to proving our main result in full generality. We provide an efficient approximation algorithm for the nearest induced flat problem (Problem 2). its convex hull. The set { 1, 2, . . . , n} is denoted by [n]. We use the following notations: aff(X) denotes the affine hull of the set X and conv(X) denotes Theorem 2. For any constant positive real ε > 0 and constant positive integers d and k, there is a randomized (1 + ε)-approximation algorithm for the nearest induced flat problem in Rd running in time Oε(nk−1 logd−k+2 n) with high probability. Proof. The algorithm is a generalization of the one in the previous section, in which the point a is replaced by a set composed of k − 1 points a1, a2, . . . , ak−1, and the edge e is now a (simplicial) (d − k)-face of Q. Given a k − 1-tuple of points a1, a2, . . . , ak−1, we characterize the locus of points ak such that the affine hull of the points a1, a2, . . . , ak intersects the convex hull of y and y + λe. These hyperplanes are again such that counting all such points can be done using orthogonal range queries. More precisely, we perform the following steps. 7 a∆f (1 + ε)-approximation and binary search. From Dudley's result, there exists a polyhedron of size O(1/ε(d−1)/2) such that the induced polyhedral distance dQ(., .) is a (1 + ε)-approximation of the Euclidean distance. We know that the distance dQ from the point y to the nearest induced flat is attained at a point lying on a (d − k)-face of y + λQ. We can therefore perform the same procedure as in the previous case, except that we now shoot a (d − k)-face e of Q, instead of an edge, in the same way as is done in Agarwal, Rubin, Sharir [1]. ∆ still denotes the convex hull of y and y + λe, which generalizes to a (d − k + 1)-simplex. The binary search procedure generalizes easily: start with a large enough λ, if there is more than one flat aff({ a1, a2, . . . , ak }) intersecting ∆ = conv({ y, y + λe}), pick one such flat uniformly at random, and compute the value λ such that this flat intersects ∆. There are only O(nk) such flats at the beginning of the search, hence a search takes O(log n) steps with high probability. We can therefore reduce the problem to O(ε(1−d)/2 log n) instances of the following counting problem: given a (d − k + 1)-simplex ∆, count the number of k-tuples of points a1, a2, . . . , ak ∈ S whose affine hull aff(a1, a2, . . . , ak) intersects ∆. An intersection condition. We first make a simple observation that characterizes such k-tuples. Let A be a set of k points {a1, a2, . . . , ak}, and let B = {b1, b2, . . . , bd−k+2} be the set of vertices of ∆. We assume without loss of generality that the points of A together with the vertices of ∆ are in general position. We define d − k + 2 hyperplanes Hi = aff(A ∪ B \ { bi, ak }), i ∈ [d − k + 2]. We then let H + the halfspace that does not contain bi. i be the halfspace supported by Hi that contains bi, and H− i (cid:32)(cid:32)d−k+2(cid:92) (cid:33) (cid:32)d−k+2(cid:92) H + i ∪ i=1 i=1 (cid:33)(cid:33) H− i . Lemma 3. aff(A) ∩ ∆ (cid:54)= ∅ ⇐⇒ ak ∈ Proof. (⇒) Suppose that ak (cid:54)∈ ((cid:84) i ) ∪ ((cid:84) i H + i , or in H− i ∩ aff(A) = H + i , and j ∈ [d − k + 2] such that ak ∈ H + j . In both cases, it is separated from ∆ by a hyperplane, and p (cid:54)∈ ∆. i H− i ). Hence there exists i ∈ [d − k + 2] such that ak ∈ H− i , and j ∈ [d − k + 2] such that ak ∈ H + j . We show that aff(A) ∩ ∆ = ∅. Let us consider the intersection of the two halfspaces H− j with the (k − 1)-dimensional subspace aff(A). i and H + In this subspace, both halfspaces have the points a1, a2, . . . , ak−1 on their boundary, and contain ak. Hence it must be the case that H− j ∩ aff(A). Therefore, every point p ∈ aff(A) either lies in H− (⇐) Suppose that aff(A) ∩ ∆ = ∅. We now show that there exists i ∈ [d − k + 2] such that ak ∈ H− j . Since both aff(A) and ∆ are convex sets, if aff(A)∩ ∆ = ∅ then there exists a hyperplane H containing aff(A) and having ∆ on one side. Since the points of A are affinely independent, it can then be rotated to contain all points of A except ak, and separate ak from ∆. After this, it has d − (k − 1) degrees of freedom left, and can be further rotated to contain a whole (d − k)-face of ∆, while still separating ∆ from ak. For some i ∈ [d − k + 2], this is now the hyperplane Hi that separates some vertex bi from ak, and ak ∈ H− i . Similarly, the same hyperplane H can instead be rotated in order to contain all points of A except ak, and have ak and ∆ this time on the same side. It can then be further rotated to contain a (d − k)-face of ∆, while still having ∆ and ak on the same side. Now for some j ∈ [d − k + 2], this is now the hyperplane Hj that has bj and ak on the same side, and ak ∈ H + j . Note that for the case k = 2 and d = 3 the set ((cid:84) the lower part ((cid:84) i )∪ ((cid:84) i H + i ) is the double cone of apex a; i ) is the cone Ca in Figure 1. The case where k = 3 and d = 3 is illustrated i H + i H− on Figure 3. 8 Figure 3: Illustration of Lemma 3 in the case k = d = 3. The plane through a1, a2, a3 intersects the line segment ∆ if and only if a3 is located either above or below the two planes H1, H2. Reduction to orthogonal range queries. We now show that in perfect analogy with the previous section, we can solve the counting problem efficiently using an orthogonal range counting data structure. Consider a vertex bi of ∆ and a (k−2)-subset T of points of S, denoted by T = {a1, a2, . . . , ak−2}. Let us denote by f the facet of ∆ that is induced by the vertices bj such that j (cid:54)= i. Now consider the hyperplane containing f together with T , and one additional point p of S. These hyperplanes all contain aff(f ∪ T ), which is a (d − 2)-flat. Let us consider the unit normal vectors to these hyperplanes centered on some point contained in this (d−2)-flat. These vectors lie in the orthogonal flat of dimension d − (d − 2) = 2, hence in a plane. Therefore, they induce a circular order on the points of S. Hence for a fixed set of k − 2 points of S and a fixed facet f of ∆, we can assign a rank to each other point of S. These will play the role of the coordinates of the points in the range counting data structure. We now observe that counting the number of k-tuples whose affine hull intersects ∆ amounts to orthogonal range counting with respect to these coordinates. Indeed, fix the first (k − 2)-subset of points T = {a1, a2, . . . , ak−2}, and compute the rank of each other point of S with respect to the circular order of the hyperplanes defined above, around each facet f of ∆. Now consider a (k− 1)th i ) are such that aff(a1, a2, . . . , ak) intersects ∆. But this range is the union of two (d− k + 2)-rectangles in the space of coordinates that we defined. The coordinates of these two (d − k + 2)-rectangles are defined by the coordinates of ak−1. We can therefore set up a new orthogonal range counting data structure for each (k − 2)-subset T , and perform 2n queries in it, two for each additional point ak−1 ∈ S. point ak−1. From Lemma 3, all points ak contained in the range ((cid:84) i ) ∪ ((cid:84) i H− i H + We can now outline our algorithm for solving the counting problem: 1. For each (k − 2)-subset T of points a1, a2, . . . , ak−2 in(cid:0) S (cid:1): k−2 (a) For each vertex bi of ∆, compute the rank of each point of S with respect to the hyper- planes containing f = conv({bj : j (cid:54)= i}) and T . (b) Build a (d− k + 2)-dimensional range counting data structure on S using these ranks as coordinates. (c) For each other point ak−1 ∈ S: 9 a1a2∆b1b2H2H1 (cid:84) i and(cid:84) i H + i H− i , respectively. i. Perform two range counting queries using the rectangular ranges corresponding to (d) Return the sum of the values returned by the range counting queries. Note that there are a few additional technicalities which we have to take care of. First, the orders defined by the hyperplanes are circular, hence we are really performing range queries on a torus. This can be easily fixed, as mentioned previously, by doubling each point. Then we have to make sure to avoid double counting, since any permutation of the ai in the enumeration of k-tuples yields the same set A, and hence, the same flat aff(A). (Note that in § 2 we avoided double counting by observing that only one of a ∈ Cb and b ∈ Ca can be true.) This only affects the counting problem and is not problematic if we consider ordered subsets T ; it causes each intersecting flat to be counted exactly k! times.1 The termination condition for the binary search can be changed to when the range count is k! and the sampling method for finding a uniform random binary search pivot is unaffected since each candidate flat is represented an equal number of times. and is repeated n− k + 2 times, hence costs O(n logd−k+1 n) overall as well [14, 34]. These are mul- tiplied by the number of iterations of the main loop, yielding a complexity of O(nk−1 logd−k+1 n) for the counting procedure. As for the running time analysis, step 1b costs O(n logd−k+1 n), while step 1(c)i costs O(logd−k+1 n) first choosing a set prefix { a1, a2, . . . , ak−1 } ∈(cid:0) S Finally, this counting procedure can be combined with the binary search procedure provided we can choose a flat intersecting ∆ uniformly at random within that time bound. This is achieved by of points ak ∈ S such that aff({ a1, a2, . . . , ak })∩ ∆ (cid:54)= ∅. Then we can pick a point ak uniformly at random in this set in linear time. Multiplying by the number of edge-shooting problems we have to solve, the counting procedure is invoked O(ε(1−d)/2 log n) times, yielding the announced running time. (cid:1) with probability proportional to the number k−1 4 An exact algorithm for the nearest induced hyperplane problem In this section we consider the special case k = d, the nearest induced hyperplane problem (Prob- lem 5). The previous result gives us a randomized (1 + ε)-approximation algorithm running in time Oε(nd−1 log2 n) for this problem. We describe a simple deterministic O(nd−1+δ)-time exact algorithm using only standard tools from computational geometry. Theorem 3. The nearest induced hyperplane problem can be solved in deterministic time O(nd−1+δ) for any δ > 0. The first tool we need is point-hyperplane duality. Let ¯H be the hyperplane arrangement that is dual to S, in which each point of S is now a hyperplane. Note that every vertex of this arrangement is the dual of a hyperplane induced by d points of S. Unfortunately, while some dualities preserve vertical distances, there does not exist a duality that preserves euclidean distances. To overcome this obstacle, we make a topological observation. Recall that the zone of a hyperplane h in an arrangement ¯H (not including h) is the union of the d- cells of ¯H intersected by h. Similarily, we define the refined zone of a hyperplane h in an arrangement 1Enumerating each subset T exactly once as (k − 2)-tuples in lexicographic order and only constructing the orthogonal range searching data structure on the points of S that come after ak−2 reduces this overcounting to 2 times per flat. In our case, this is unnecessary since k is constant. 10 Figure 4: The candidate nearest hyperplanes. Proof. Consider the arrangement of all(cid:0)n k ¯H (not including h) to be the union of the d-simplices of the bottom-vertex decomposition of ¯H intersected by h. Lemma 4. Let ¯H be the hyperplane arrangement that is dual to S, and ¯y the hyperplane dual to the point y. The induced hyperplane that is nearest to y corresponds to a vertex of the refined zone of ¯y in the arrangement ¯H. (cid:1) hyperplanes induced by subsets of k points in S. Then clearly, the induced hyperplane nearest to y must be one of the hyperplanes bounding the cell of this arrangement that contains y (see Figure 4 for an illustration with d = 2). Consider a rectilinear motion of y towards this nearest hyperplane. In the dual arrangement ¯H, this corresponds to a continuous motion of the hyperplane ¯y that at some point hits a vertex of the arrangement. Because it is the first vertex that is hit, it must belong to a cell of the bottom vertex decomposition of ¯H that ¯y intersects, hence to the refined zone of ¯y. We refer to chapter 28 of the Handbook of Discrete and Computational Geometry [33] for background on hyperplane arrangements and their decompositions. The second tool is an upper bound on the complexity of a zone in an arrangement [20]. The complexity of a zone is the sum of the complexities of its cells, and the complexity of a cell is the number of faces of the cell (vertices, edges, . . . ). The upper bound is as follows: Theorem 4 (Zone Theorem [20]). The complexity of a zone in an arrangement of n hyperplanes in Rd is O(nd−1). In particular, this result gives an upper bound of O(nd−1) vertices for a given zone. Since the complexity of a refined zone is not more than the complexity of the corresponding zone, this bound also holds for the complexity of a given refined zone. The third tool is Chazelle's efficient construction of cuttings [15]. A cutting of Rd is a partition of Rd into disjoint regions. Given a set of hyperplanes H in Rd, a 1 r -cutting for H is a cutting H of Rd such that each region is intersected by no more than r hyperplanes in H. In particular, we are interested in Chazelle's construction when r is constant. In that case, only a single step of his construction is necessary and yields regions that are the simplices of the bottom-vertex decomposition of some subset of H. 11 y Theorem 5 (Chazelle [15, Theorem 3.3]). Given a set H of n hyperplanes in Rd, for any real constant parameter r > 1, we can construct a 1 r -cutting for those hyperplanes consisting of the O(rd) simplices of the bottom-vertex decomposition of some subset of H in O(n) time. More details on cuttings can be found in chapters 40 and 44 of the Handbook [33]. Lemma 5. For any positive constant δ, given a hyperplane h and an arrangement of hyperplanes ¯H in Rd, the vertices of the refined zone of h in ¯H can be computed in time O(nd−1+δ). Proof. Using Theorem 5 with some constant r, we construct, in linear time, a 1 r -cutting of the arrangement consisting of O(rd) simplicial cells whose vertices are vertices of ¯H. To find the vertices of the refined zone, we only need to look at those cells that are intersected by ¯y. If such a cell is not intersected by any hyperplane of ¯H then its vertices are part of the refined zone of ¯y. Otherwise, we recurse on the hyperplanes intersecting that cell. From Theorem 4, there are at most O(rd−1) such cells. The overall running time for the construction is therefore: (cid:16) rd−1(cid:17) (cid:16) n (cid:17) T (n) ≤ O T r + O(n). For all constant δ > 0, we can choose a sufficiently large constant r, such that T (n) = O(nd−1+δ), as claimed. Proof of Theorem 3. From Lemma 5, we find the vertices of the refined zone of ¯y in the arrangement ¯H in time O(nd−1+δ). Then we compute the distance from y to each of the induced hyperplanes corresponding to vertices of the refined zone in time O(nd−1). From Lemma 4, one of them must be the nearest. 5 A (1 + ε)-approximation algorithm for the nearest induced sim- plex problem We now consider the nearest induced simplex problem (Problem 6). The algorithm described in §2 for the case k = 2 and d = 3 can be adapted to work for this problem. As in §2, consider the computation of the nearest induced segment under some polyhedral distance dQ approximating the Euclidean distance. The reduction from this computation to edge- shooting still works with some minor tweak: if we shoot edges to find the nearest induced segment under dQ, we may miss some of the segments. Fortunately, the points of these missed segments that are nearest to our query point under dQ must be endpoints of those segments. We can take those into account by comparing the nearest segment found by edge-shooting to the nearest neighbor, found in linear time. As before, edge-shooting is reduced to a counting problem. Referring to the proof of Theorem 1 and Figure 1, the analogue of the counting problem in §2 for the nearest induced segment problem amounts to searching for the points b lying in the intersection of the cone Ca with the halfspace bounded by aff(∆) that does not contain a. In dimension d, the affine hull of ∆ is a hyperplane, and we restrict b to lie on one side of this hyperplane. We therefore get a (1 + ε)-approximation O(n logd n)-time algorithm for the nearest induced segment problem in any fixed dimension d. This compares again favorably with the (2 + ε)- approximation O(n log n)-time algorithm proposed by Har-Peled et al. [25]. We generalize this to arbitrary values of k and prove the following result. 12 Theorem 6. For any constant positive real ε > 0 and constant positive integers d and k, there is a randomized (1 + ε)-approximation algorithm for the nearest induced simplex problem in Rd running in time O(nk−1 logd n) with high probability. Again, we compute the nearest induced simplex under some polyhedral distance dQ. As in the case k = 2, (d − k)-face-shooting can be adapted to take care of missed simplices: for each 2 ≤ k(cid:48) ≤ k, shoot (d− k(cid:48))-faces of Q to find the nearest (k(cid:48)− 1)-simplex. For k(cid:48) = 1, find the nearest neighbor in linear time. For any (k − 1)-simplex, let 0 ≤ k(cid:48) ≤ k be the smallest natural number such that no (d− k(cid:48))-face of Q hits the simplex when shot from the query point. It is obvious that, for all t < k(cid:48), some (d − t)-face of Q hits the simplex, and that, for all t ≥ k(cid:48), no (d − t)-face of Q hits the simplex. For the sake of simplicity, we hereafter focus on solving the face-shooting problem when k(cid:48) = k, thus ignoring the fact a simplex can be missed. Because the obtained running time will be of the order of O(nk(cid:48)−1), the running time will be dominated by this case. In order to reduce face-shooting to range counting queries, we need an analogue of Lemma 3 for convex combinations. Let A be a set of k points {a1, a2, . . . , ak}, and let ∆ be a (d− k + 1)-simplex with vertices in B = {b1, b2, . . . , bd−k+2}. We suppose that these points are in general position. We define the hyperplanes Hi = aff(A∪ B\{ bi, ak }), for i ∈ [d− k + 2], and Gj = aff(A∪ B\{ aj, ak }), for j ∈ [k − 1]. We let H + j the halfspace supported by Gj that does not contain aj. i be the halfspace supported by Hi that contains bi, and G− Lemma 6. (cid:32)d−k+2(cid:92) (cid:33) k−1(cid:92)  . conv(A) ∩ ∆ (cid:54)= ∅ ⇐⇒ ak ∈ H + i ∩ G− j j G− i ) ∩ ((cid:84) i H + i=1 j=1 Proof. (⇐) Suppose that ak ∈ ((cid:84) We first prove that ((cid:84) j ). We have that conv(A) ∩ ∆ (cid:54)= ∅ if and only if both aff(A)∩∆ (cid:54)= ∅ and conv(A)∩aff(∆) (cid:54)= ∅ hold. From Lemma 3, we already have aff(A)∩∆ (cid:54)= ∅. It therefore remains to show that conv(A) ∩ aff(∆) (cid:54)= ∅. j Gj) ∩ conv(A) (cid:54)= ∅. We proceed by induction on k. It can easily be shown to hold for k = 2. Let us suppose it holds for k− 1, and prove it for k. The hyperplane Gk−1 separates ak−1 from ak. Consider the point a(cid:48) k−1 of the segment between ak−1 and ak that lies on Gk−1. Let A(cid:48) = {a1, a2, . . . , ak−2, a(cid:48) j of all hyperplanes Gj for j ∈ [k− 2] with the subspace aff(A(cid:48)). In the subspace aff(A(cid:48)), The hyperplanes G(cid:48) j for j ∈ [k− 2] all k−1. Hence we can apply induction on A(cid:48) and the hyperplanes G(cid:48) in dimension separate aj from a(cid:48) k−1 ∈ conv({ak−1, ak}), we k − 2, and we have that (∩j∈[k−2]G(cid:48) also have that (∩j∈[k−1]Gj) ∩ conv(A) (cid:54)= ∅. k−1}. Consider the intersection G(cid:48) j) ∩ conv(A(cid:48)) (cid:54)= ∅. Now because a(cid:48) j Gj = aff(∆). The fact that aff(∆) ⊆ (cid:84) j Gj is immediate since j Gj cannot contain more than aff(∆) it suffices to show that those flats are of the same dimensions. Since the set A ∪ B is in general position, aj (and ak) cannot lie on Gj. Then we claim that the Gj are in general position. Indeed if they are not, then there must be some 1 ≤ k(cid:48) ≤ k − 1 where ∩j≤k(cid:48)−1Gj = ∩j≤k(cid:48)Gj. However, this is not possible since ak(cid:48) ∈ ∩j≤k(cid:48)−1Gj but ak(cid:48) j Gj is thus d − k + 1, the same as the dimension of aff(∆). Now we also observe that (cid:84) each Gj contains aff(∆). To prove that(cid:84) (cid:54)∈ ∩j≤k(cid:48)Gj. The dimension of (cid:84) i ) ∩ ((cid:84) j G− i H + Therefore, conv(A) ∩ aff(∆) (cid:54)= ∅, as needed. (⇒) Suppose that ak (cid:54)∈ ((cid:84) be of the form H + i or G− j ). Then one of the halfspace does not contain ak. It can j . In both cases, all points of A are either contained in the hyperplane Hi 13 Figure 5: Illustration of Lemma 6 in the case d = 3 and k = 2. The segment a1a2 intersects ∆ if and only if a2 is located in the colored region below ∆. or Gj, or lie in H− hulls. From the general position assumption, it also separates the convex hulls. j . Hence the hyperplane Hi or Gj separates the interiors of the convex i or G− The Lemma is illustrated on Figures 5 and 6 in the cases d = 3, k = 2, and d = k = 3. Proof of Theorem 6. The algorithm follows the same steps as the algorithm described in the proof of Theorem 2, except that the ranges used in the orthogonal range counting data structure are different, and involve a higher-dimensional space. We reduce the problem to that of counting the number of k-subsets A of S whose convex hull intersects a given (d − k + 1)-simplex ∆. We already argued that when fixing the first k − 2 points a1, a2, . . . , ak−2, the hyperplanes Hi induce a circular order on the points of S. Similarly, when the points a1, a2, . . . , ak−2 are fixed, the hyperplanes Gj all contain the (d − 2)-flat aff(A ∪ B \ {aj, ak−1, ak}), hence also induce a circular order on the points of S. Thus for each (k − 2)-subset of S, we can assign (d− k + 2) + (k − 1) = d + 1 coordinates to each point of S, one for each family of hyperplanes. We then build an orthogonal range query data structure using these coordinates. For each point ak−1, we query this data structure and count the number of points ak such that j ). From Lemma 6, we can deduce the number of subsets A whose convex i ) ∩ ((cid:84) ak ∈ ((cid:84) k−1 is unique as it does not depend on ak−1, only the orientation of G− hull intersects ∆. We can decrease by one the dimensionality of the ranges by realizing that the supporting hyperplane of G− k−1 does. To only output points ak such that ak ∈ G− k−1 we construct two data structures: one with the points above Gk−1 and one with the points below Gk−1. We query the relevant data structure depending whether ak−1 is above or below Gk−1. This spares a logarithmic factor and yields an overall running time of O(nk−1 logd−1 n) for the counting problem. Multiplying by the O(log n) rounds of binary search yields the claimed result. i H + j G− 14 a1a2∆G1H1b1H2b2b3 Figure 6: Illustration of Lemma 6 in the case k = d = 3. The triangle a1a2a3 intersects ∆ if and only if a3 is located in the colored region. 6 Discussion We put the complexity of sparse regression on par with that of degeneracy testing in the fixed- dimensional setting, and proposed the first o(nk) algorithm for this problem. A clear practical advantage of the structure proposed by Har-Peled et al. [25] is that one can reuse approximate nearest neighbor data structures that circumvent the curse of dimensionality, such as those based on locality-sensitive hashing [4]. Our technique based on approximating the Euclidean distance by a polyhedral distance, on the other hand, incurs an exponential dependence on d. Some marginal improvements can probably be obtained by exploiting the structure of the prob- lem further. For instance, we really only need orthogonal range emptiness queries in order to solve the decision version of our problem Also, we do not harness the power of the Word RAM model for speeding up the search [12, 13]. For other relevant techniques, we refer to the excellent presentation by Timothy Chan at WADS'13 on "the art of shaving logs"[11]. Acknowledgments The authors wish to thank the reviewers of a preliminary version of this manuscript, who provided useful comments, as well as John Iacono and Stefan Langerman for insightful discussions. References [1] P. K. Agarwal, N. Rubin, and M. Sharir. Approximate nearest neighbor search amid higher- dimensional flats. In 25th Annual European Symposium on Algorithms, ESA 2017, September 4-6, 2017, Vienna, Austria, pages 4:1 -- 4:13, 2017. [2] M. Aharon, M. Elad, and A. Bruckstein. K-SVD: An algorithm for designing overcomplete 15 a1a2∆H1b1b2G2 dictionaries for sparse representation. IEEE Transactions on Signal Processing, 54(11):4311 -- 4322, Nov 2006. [3] N. Ailon and B. Chazelle. Lower bounds for linear degeneracy testing. J. ACM, 52(2):157 -- 171, 2005. [4] A. Andoni and P. Indyk. Near-optimal hashing algorithms for approximate nearest neighbor in high dimensions. Commun. ACM, 51(1):117 -- 122, 2008. [5] S. Arya, D. M. Mount, N. S. Netanyahu, R. Silverman, and A. Y. Wu. An optimal algorithm for approximate nearest neighbor searching fixed dimensions. J. ACM, 45(6):891 -- 923, 1998. [6] L. Barba, J. Cardinal, J. Iacono, S. Langerman, A. Ooms, and N. Solomon. Subquadratic algorithms for algebraic 3SUM. Discrete & Computational Geometry, 61(4):698 -- 734, 2019. [7] R. Basri, T. Hassner, and L. Zelnik-Manor. Approximate nearest subspace search. IEEE Trans. Pattern Anal. Mach. Intell., 33(2):266 -- 278, 2011. [8] D. Bertsimas, A. King, and R. Mazumder. Best subset selection via a modern optimization lens. Ann. Statist., 44(2):813 -- 852, 04 2016. [9] D. Bertsimas, J. Pauphilet, and B. Van Parys. Sparse Regression: Scalable algorithms and empirical performance. arXiv e-prints, Feb 2019. [10] E. J. Cand`es, J. K. Romberg, and T. Tao. Robust uncertainty principles: exact signal recon- struction from highly incomplete frequency information. IEEE Trans. Information Theory, 52(2):489 -- 509, 2006. [11] T. M. Chan. The art of shaving logs. https://web.archive.org/web/20191224144646/ http://tmc.web.engr.illinois.edu/talks/wads13_talk.pdf, August 2013. [12] T. M. Chan, K. G. Larsen, and M. Patrascu. Orthogonal range searching on the RAM, revisited. In Proceedings of the 27th ACM Symposium on Computational Geometry, Paris, France, June 13-15, 2011, pages 1 -- 10, 2011. [13] T. M. Chan and B. T. Wilkinson. Adaptive and approximate orthogonal range counting. ACM Trans. Algorithms, 12(4):45:1 -- 45:15, 2016. [14] B. Chazelle. A functional approach to data structures and its use in multidimensional searching. SIAM J. Comput., 17(3):427 -- 462, 1988. [15] B. Chazelle. Cutting hyperplanes for divide-and-conquer. Discrete & Computational Geometry, 9:145 -- 158, 1993. [16] B. Chazelle and J. Friedman. A deterministic view of random sampling and its use in geometry. Combinatorica, 10(3):229 -- 249, 1990. [17] G. Davis, S. Mallat, and M. Avellaneda. Adaptive greedy approximations. Constructive Approximation, 13(1):57 -- 98, Mar 1997. [18] D. L. Donoho. Compressed sensing. IEEE Trans. Information Theory, 52(4):1289 -- 1306, 2006. 16 [19] R. M. Dudley. Metric entropy of some classes of sets with differentiable boundaries. Journal of Approximation Theory, 10(3):227 -- 236, 1974. [20] H. Edelsbrunner, R. Seidel, and M. Sharir. On the zone theorem for hyperplane arrangements. SIAM J. Comput., 22(2):418 -- 429, 1993. [21] J. Erickson and R. Seidel. Better lower bounds on detecting affine and spherical degeneracies. Discrete & Computational Geometry, 13:41 -- 57, 1995. [22] D. P. Foster, S. Kale, and H. J. Karloff. Online sparse linear regression. In Proceedings of the 29th Conference on Learning Theory, COLT 2016, New York, USA, June 23-26, 2016, pages 960 -- 970, 2016. [23] D. P. Foster, H. J. Karloff, and J. Thaler. Variable selection is hard. In Proceedings of The 28th Conference on Learning Theory, COLT 2015, Paris, France, July 3-6, 2015, pages 696 -- 709, 2015. [24] A. Gajentaan and M. H. Overmars. On a class of o(n2) problems in computational geometry. Comput. Geom., 5:165 -- 185, 1995. [25] S. Har-Peled, P. Indyk, and S. Mahabadi. Approximate sparse linear regression. In 45th International Colloquium on Automata, Languages, and Programming, ICALP 2018, July 9- 13, 2018, Prague, Czech Republic, pages 77:1 -- 77:14, 2018. [26] T. Hastie, R. Tibshirani, and J. H. Friedman. The elements of statistical learning: data mining, inference, and prediction, 2nd Edition. Springer series in statistics. Springer, 2009. [27] A. Magen. Dimensionality reductions in (cid:96)2 that preserve volumes and distance to affine spaces. Discrete & Computational Geometry, 38(1):139 -- 153, 2007. [28] S. Mahabadi. Approximate nearest line search in high dimensions. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015, pages 337 -- 354, 2015. [29] S. Mallat and Z. Zhang. Matching pursuits with time-frequency dictionaries. IEEE Trans. Signal Processing, 41(12):3397 -- 3415, 1993. [30] A. Miller. Subset Selection in Regression. Chapman and Hall/CRC, 2002. [31] B. K. Natarajan. Sparse approximate solutions to linear systems. SIAM J. Comput., 24(2):227 -- 234, 1995. [32] R. Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society. Series B (Methodological), 58(1):267 -- 288, 1996. [33] C. D. T´oth, J. O'Rourke, and J. E. Goodman, editors. Handbook of Discrete and Computational Geometry. Chapman and Hall/CRC, 3rd edition, 2017. [34] D. E. Willard. New data structures for orthogonal range queries. SIAM J. Comput., 14(1):232 -- 253, 1985. 17
1811.08811
3
1811
2019-01-02T23:46:57
$k$-Cut: A Simple Approximately-Uniform Method for Sampling Ballots in Post-Election Audits
[ "cs.DS" ]
We present an approximate sampling framework and discuss how risk-limiting audits can compensate for these approximations, while maintaining their "risk-limiting" properties. Our framework is general and can compensate for counting mistakes made during audits. Moreover, we present and analyze a simple approximate sampling method,"$k$-cut", for picking a ballot randomly from a stack, without counting. Our method involves doing $k$ "cuts", each involving moving a random portion of ballots from the top to the bottom of the stack, and then picking the ballot on top. Unlike conventional methods of picking a ballot at random, $k$-cut does not require identification numbers on the ballots or counting many ballots per draw. We analyze how close the distribution of chosen ballots is to the uniform distribution, and design different mitigation procedures. We show that $k=6$ cuts is enough for an risk-limiting election audit, based on empirical data, which would provide a significant increase in efficiency.
cs.DS
cs
k-Cut: A Simple Approximately-Uniform Method for Sampling Ballots in Post-Election Audits(cid:63) Mayuri Sridhar and Ronald L. Rivest Massachusetts Institute of Technology, Cambridge MA 02139, USA [email protected] [email protected] Abstract. We present an approximate sampling framework and discuss how risk-limiting audits can compensate for these approximations, while maintaining their "risk-limiting" properties. Our framework is general and can compensate for counting mistakes made during audits. Moreover, we present and analyze a simple approximate sampling method, "k-cut", for picking a ballot randomly from a stack, without counting. Our method involves doing k "cuts," each involving moving a random portion of ballots from the top to the bottom of the stack, and then pick- ing the ballot on top. Unlike conventional methods of picking a ballot at random, k-cut does not require identification numbers on the ballots or counting many ballots per draw. We analyze how close the distribu- tion of chosen ballots is to the uniform distribution, and design different mitigation procedures. We show that k = 6 cuts is enough for an risk- limiting election audit, based on empirical data, which would provide a significant increase in efficiency. Keywords: sampling · elections · auditing · post-election audits · risk- limiting audit · Bayesian audit. 1 Introduction The goal of post-election tabulation audits are to provide assurance that the reported results of the contest are correct; that is, they agree with the results that a full hand-count would reveal. To do this, the auditor draws ballots uniformly at random one at a time from the set of all cast paper ballots, until the sample of ballots provides enough assurance that the reported outcomes are correct. The most popular post-election audit method is known as a "risk-limiting audit" (or RLA), invented by Stark (see his web page [12]). See also [3,4,5,6,10,11] for explanations, details, and related papers. An RLA takes as input a "risk- limit" α (like 0.05), and ensures that if a reported contest outcome is incorrect, then this error will be detected and corrected with probability at least 1 − α. (cid:63) Supported by Center for Science of Information (CSoI), an NSF Science and Tech- nology Center, under grant agreement CCF-0939370. 2 M. Sridhar and R.Rivest This paper provides a novel method for drawing a sample of the cast pa- per ballots. The new method may often be more efficient than standard meth- ods. However, it has a cost: ballots are drawn in a way that is only "approxi- mately uniform". This paper also provides ways of compensating for such non- uniformity. There are two standard approaches for drawing a random sample of cast paper ballots: 1. [ID-based sampling] Print on each scanned cast paper ballot a unique identifying number (ballot ID numbers). Draw a random sample of ballot ID numbers, and retrieve the corresponding ballots. 2. [Position-based sampling] Give each ballot an implicit ballot ID equal to its position in a canonical listing of all ballot positions. Then proceed as with method (1). These methods work well, and are guaranteed to produce random samples. In practice, auditors use software, like [13], which takes in a ballot manifest as input and produces the random sample of ballot ID numbers. In this software, it is typically assumed that sampling is done without replacement. However, finding even a single ballot using these sampling methods can be tedious and awkward in practice. For example, given a random sample of ID numbers, one may need to count or search through a stack of ballots to find the desired ballot with the right ID or at the right position. Moreover, typical auditing procedures assume that there are no mistakes when finding the ballots for the sample. Yet, this seems to be an unreasonable assumption - if we require a sample size of 1,000 ballots, for instance, it is likely that there are a few "in- correctly" chosen ballots along the way, due to counting errors. In the literature about RLAs, there is no way to correct for these mistakes. Our goal is to simplify the sampling process. In particular, we define a general framework for compensating for "approxi- mate sampling" in RLAs. Our framework of approximate sampling can be used to measure and compensate for human error rate while using the counting meth- ods outlined above. Moreover, we also define a simpler approach for drawing a random sample of ballots, which does not rely on counting at all. Our technique is simple and easy to iterate on and may be of particular interest when the stack of ballots to be drawn from is large. We define mitigation procedures to account for the fact that the sampling technique is no longer uniformly random. Overview of this paper. Section 2 introduces the relevant notation that we use throughout the paper. Section 3 presents our proposed sampling method, called "k-cut." Section 4 studies the distribution of single cut sizes, and provides experimen- tal data. We then show how iterating a single cut provides improved uniformity for ballot selection. Section 5 discusses the major questions that are brought up when using "approximate" sampling in a post-election audit. k-Cut: Simple Approximate Sampling 3 Section 6 proves a very general result: that any general statistical auditing procedure for an arbitrary election can be adapted to work with approximate sampling, with simple mitigation procedures. Section 7 discusses how to adapt the k-cut method for sampling when the ballots are organized into multiple stacks or boxes. Section 8 provides some guidance for using k-cut in practice. Section 9 gives some further discussion, lists some open problems, and makes some suggestions for further research. Section 10 summarizes our contributions. 2 Notation and Election Terminology Notation. We let [n] denote the set {0, 1, . . . , n− 1}, and we let [a, b] denote the set {a, a + 1, . . . , b − 1}. We let U[n] denote the uniform distribution over the set [n]. In U[n], the "[n]" may be omitted when it is understood to be [n], where n is the number of ballots in the stack. We let U[a, b] denote the uniform distribution over the set [a, b]. If X ∼ U[n], then P r[X = i] = U[n](i) = 1/n for i ∈ [n] . Thus, U denotes the uniform distribution on [n]. For the continuous versions of the uniform distribution: we let U(0, 1) denote the uniform distribution over the real interval (0, 1), and let U(a, b) denote the uniform distribution over the interval (a, b). These are understood to be probability densities, not discrete distributions. The "(0, 1)" may be omitted when it is understood to be (0, 1). Thus, U denotes the uniform distribution on (0, 1). We let V D(p, q) denote the variation distance between probability distribu- tions p and q; this is the maximum, over all events E, of P rp[E] − P rq[E]. Election Terminology. The term "ballot" here means to a single piece of paper on which the voter has recorded a choice for each contest for which the voter is eligible to vote. One may refer to a ballot as a "card." Multi-card ballots are not discussed in this paper. Audit types. There are two kinds of post-election audits: ballot-polling audits, and ballot-comparison audits, as described in [6]. For our purposes, these types of audits are equivalent, since they both need to sample paper ballots at random, and can make use of the k-cut method proposed here. However, if one wishes to use k-cut sampling in a comparison audit, one would need to ensure that each paper ballot contains a printed ID number that could be used to locate the associated electronic CVR. 4 M. Sridhar and R.Rivest 3 The k-Cut Method The problem to be solved is: How can one select a single ballot (approximately) at random from a given stack of n ballots? This section presents the "k-cut" sampling procedure for doing such sam- pling. The k-cut procedure does not need to know the size n of the stack, nor does it need any auxiliary random number generators or technology. We assume that the collection of ballots to be sampled from is in the form of a stack. These may be ballots stored in a single box or envelope after scanning. One may think of the stack of ballots as being similar to a deck of cards. When the ballots are organized into multiple stacks, sampling is slightly more complex -- see Section 7. For now we concentrate on the single-stack case. We imagine that the size n of the stack is 25 -- 800 or so. The basic operation for drawing a single ballot is called "k-cut and pick," or just "k-cut." This method does k cuts then draws the ballot at the top of the stack. To make a single cut of a given stack of n paper ballots: -- Cut the stack into two parts: a "top" part and a "bottom" part. -- Switch the order of the parts, so what was the bottom part now sits above the top part. The relative order of the ballots within each part is preserved. We let t denote the size of the top part. The size t of the top part should be chosen "fairly randomly" from the set [n] = {0, 1, 2, . . . , n− 1}1. In practice, cut sizes are probably not chosen so uniformly; so in this paper we study ways to compensate for non-uniformity. We can also view the cut operation as one that "rotates" the stack of ballots by t positions. An example of a single cut. As a simple example, if the given stack has n = 5 ballots: A B C D E , where ballot A is on top and ballot E is at the bottom, then a cut of size t = 2 separates the stack into a top part of size 2 and a bottom part of size 3: whose order is then switched: A B C D E C D E A B . Finally, the two parts are then placed together to form the final stack: C D E A B . having ballot C on top. 1 A cut of size n is excluded, as it is equivalent to a cut of size 0. k-Cut: Simple Approximate Sampling 5 Relative sizes We also think of cut sizes in relative manner, as a fraction of n. We let τ = t/n denote a cut size t viewed as a fraction of the stack size n. Thus 0 ≤ τ < 1. Iteration for k cuts. The k-cut procedure makes k successive cuts then picks the ballot at the top of the stack. If we let ti denote the size of the i-th cut, then the net rotation amount after k cuts is rk = t1 + t2 + ··· + tk (mod n) . (1) The ballot originally in position rk (where the top ballot position is position 0) is now at the top of the stack. We show that even for small values of k (like k = 6) the distribution of rk is close to U. In relative terms, if we define and we have that τi = ti/n ρk = rk/n , ρk = rk/n = τ1 + τ2 + ··· + τk (mod 1) . (2) Drawing a sample of multiple ballots. To draw a sample of s ballots, our k-cut procedure repeats s times the operation of drawing without replacement a single ballot "at random." The s ballots so drawn form the desired sample. Efficiency. Suppose a person can make six ("fairly random") cuts in approx- imately 15 seconds, and can count 2.5 ballots per second2. Then k-cut (with k = 6) is more efficient when the number of ballots that needs to be counted is 37.5 or more. Since batch sizes in audits are often large, k-cut has the potential to increase sampling speed. For instance, assume that ballots are organized into boxes, each of which contains at least 500 ballots. Then, when the counting method is used, 85% of the time a ballot between ballot #38 and ballot #462 will be chosen. In such cases, one must count at least 38 ballots from the bottom or from the top to retrieve a single ballot. This implies that k-cut is more efficient 85% of the time. This analysis assumes that each time we retrieve a ballot, we start from the top of the stack and count downwards. In fact, if we have to retrieve a single ballot from each box, this is the best technique that we know of. However, let's instead assume that we would like to retrieve t ballots in each box of n ballots These ballots are chosen uniformly at random from the box; thus, in expectation, the largest ballot position (the ballot closest to the bottom of the stack) will be nt t+1 . One possible way to retrieve these t ballots is to sort the required ballot 2 These assumptions are based on empirical observations during the Indiana pilot audits. 6 M. Sridhar and R.Rivest IDs, by position, and retrieve them in order, by making a single pass through the stack. This requires only counting nt t+1 ballots in total, to find all t ballots. Using our estimate that a person can count 2.5 ballots per second, this implies that if we sample t ballots per box, each box will require 2.5(t+1) seconds. Using k-cut, we will require 15 seconds per draw, and thus, 15t seconds in total. nt This implies that k-cut is more efficient when nt 2.5(t + 1) > 15t n > 37.5(t + 1) . Thus, if we require 2 ballots per box (t = 2), k-cut is more efficient, in expectation, when there are at least 113 ballots per box. When t = 3, then k-cut is more efficient, in expectation, when there are at least 150 ballots per box. Since the batch sizes in audits are large, and the number of ballots sampled per box is typically quite small, we expect k-cut to show an increase in efficiency, in practice. Moreover, as the number of ballots per box increases, the expected time taken by standard methods to retrieve a single ballot increases. With k-cut, the time it takes to select a ballot is constant, independent of the number of ballots in the box, assuming that each cut takes constant time. Security We assume that the value of k is fixed in advance; you can not allow the cutter to stop cutting once a "ballot they like" is sitting on top. 4 (Non)-Uniformity of Single Ballot Selection We begin by observing that if an auditor could perform "perfect" cuts, we would be done. That is, if the auditor could pick the size t of a cut in a perfectly uni- form manner from [n], then one cut would suffice to provide a perfectly uniform distribution of the ballot selected from the stack of size n. However, there is no a priori reason to believe that, even with sincere effort, an auditor could pick t in a perfectly uniform manner. An auditor could pick a t randomly from [n] (or pseudorandomly from [n]), and then count down in the stack until he reach ballot t. But this "counting down" procedure is precisely what we are trying to eliminate! So, we start by studying the properties of the k-cut procedure for single- ballot selection, beginning with a study of the non-uniformity of selection for the case k = 1 and extending our analysis to multiple cuts. 4.1 Empirical Data for Single Cuts This section presents our experimental data on single-cut sizes. We find that in practice, single cut sizes (that is, for k = 1) are "somewhat uniform." We then show that the approximation to uniformity improves dramatically as k increases. We had two subjects (the authors). Each author had a stack of 150 sequen- tially numbered ballots to cut. Marion County, Indiana, kindly provided surplus k-Cut: Simple Approximate Sampling 7 ballots for us to work with. The authors made 1680 cuts in total. Table 1 shows the observed cut size frequency distribution. 0 0 1 2 3 4 5 6 7 8 9 Row Sum 0 0 0 2 3 5 5 6 10 7 38 120 10 10 6 11 12 16 10 11 16 12 16 188 20 21 22 7 18 25 15 25 21 18 16 183 30 16 23 15 20 19 19 15 16 20 20 200 40 18 17 22 24 12 17 17 20 25 28 50 16 13 17 17 17 20 14 16 27 13 170 146 60 15 17 14 13 14 14 13 13 17 16 138 70 10 9 8 10 14 16 14 21 25 11 117 80 13 11 11 5 14 14 14 8 15 12 90 13 9 17 19 10 6 14 6 2 4 100 88 100 12 8 10 8 5 10 6 11 9 9 74 110 4 9 9 8 4 9 6 9 7 9 60 120 10 7 6 5 4 6 8 5 6 3 130 4 4 8 4 6 0 4 6 2 4 42 16 1 3 2 4 0 2 3 0 0 1 140 Table 1. Empirical distribution of sizes of single cuts, using combined data from both authors, with 1680 cuts total. For example, ballot 3 was on top twice after one cut. (Note that the initial top ballot is ballot 0.) If the cuts were truly random, we would expect a uniform distribution of the number of cuts observed as a function of cut size. In practice, the frequency of cuts was not evenly distributed; there were few or no very large or very small cuts, and smaller cuts were more common than larger cuts. 4.2 Models of Single-Cut Selection Given the evident non-uniformity of the single-cut sizes in our experimental data, it is of interest to model their distribution. Such models allow generalization to other stack sizes, and support the study of convergence to uniformity with iterated cuts. In Figure 1, we can observe the probability density of the empirical distribution, compared to different models. We let E denote the observed empirical distribution on [n] of single-cut sizes, and let E denote the corresponding induced continuous density function on (0, 1), of relative cut sizes. We consider two models of the probability distribution of cut sizes for a single cut. The reference case (the ideal case) is the uniform model, where t is chosen uniformly at random from [n] for the discrete case, or when τ is chosen uniformly at random from the real interval (0, 1) for the continuous case. We denote these cases as t ∼ U[n] or τ ∼ U(0, 1), respectively. 8 M. Sridhar and R.Rivest Fig. 1. Two models for cut sizes for a single cut, based on the data of Table 1. The horizontal axis is the size of the cut τ as a fraction of the size of the stack of ballots. The vertical axis is the probability density at that point. For reference the uniform density U (shown in green) has a constant value of 1. The red dots show the empirical distribution being modeled, which is clearly not uniform. The purple line shows our first model: the truncated uniform density U(0.533, 0.813) on the interval 8/150 ≤ τ < 122/150. This density has a mean absolute error of 0.384 compared to the empirical density, and a mean squared error of 0.224. The blue line shows our second model: the density function from the model F of equation (4), which fits a bit better, giving a mean absolute error of 0.265 and a mean squared error of 0.114. k-Cut: Simple Approximate Sampling 9 We can define two different non-uniform models to reflect the observed data. -- The truncated uniform model. This model has two parameters: w (the least cut size possible in the model) and b (the number of different possible cut sizes). The cut size t is chosen uniformly at random from the set [w, w + b] = {w, w + 1, . . . , w + b − 1}. We denote this case as t ∼ U[w, w + b] (for the discrete version) or τ ∼ U(w/n, (w + b)/n) (for the continuous version). -- An exponential family model. Here the density of relative cut sizes is modeled as F(τ ) = exp(f (τ )), where τ is the relative cut size and f is a polynomial (of degree three in our case). Fitting models to data. We used standard methods to find least-squares best- fits for the experimental data of Table 1 to models from the truncated uniform family and from the exponential family based on cubic polynomials. Fitted model - truncated uniform distribution. We find that choosing w = 8 and b = 114 provides the best least-squares fit to our data. This corresponds to a uniform distribution t ∼ U[8, 122] or τ ∼ U(0.00667, 0.813). Fitted model - exponential family. Using least-squares methods, we found a model from the exponential family for the probability density of relative cut sizes for a single cut, based on an exponential of a cubic polynomial of the relative cut size τ . The model defines f (τ ) = −0.631 + 8.587τ − 18.446τ 2 + 9.428τ 3 and then uses F(τ ) = exp(f (τ )) (3) (4) as the density function of the exponential family function defined by f . We can see in Figure 1 that this seems to fit our empirical observations quite well. 4.3 Making k successive cuts to select a single ballot As noted, the distribution of cut sizes for a single cut is noticeably non-uniform. Our proposed k-cut procedure addresses this by iterating the single-cut operation k times, for some small fixed integer k. This section discusses the iteration process and its consequences. In later sections, we discuss applying further mitigation methods to handle any residual non-uniformity. We assume for now that successive cuts are independent. Moreover, we as- sume that sampling is done with replacement, for simplicity. Using these as- sumptions, we provide computational results showing that as the number of cuts increases, the k-cut procedure selects ballots with a distribution that ap- proaches the uniform distribution, for our empirical data, as well as our fitted models. We compare by computing the variation distance of the k-cut distri- bution from U for various k. We also computed , the maximum ratio of the 10 M. Sridhar and R.Rivest probability of any single ballot under the empirical distribution, to the proba- bility of that ballot under the uniform distribution, minus one3. Our results are summarized in Table 2. Variation Distance Uk[w, w + b] 0.24 0.0576 0.0158 0.00444 0.00126 Uk[w, w + b] 0.206 0.0687 0.0224 0.00699 0.316 0.316 0.0315 0.0177 0.00311 Fk 0.212 0.0688 0.0226 0.00743 0.00244 Ek 0.247 0.0669 0.0215 0.0069 0.00223 Max Ratio minus one Ek Fk k 0.707 1.5 1 0.212 2 0.0706 3 0.0233 4 5 0.00767 6 0.000719 0.000357 0.000802 0.00225 0.00128 0.00252 0.000232 7 0.000828 0.000272 7.49e-05 8 8.95e-05 9 2.42e-05 2.94e-05 10 7.79e-06 9.67e-06 11 2.52e-06 12 8.12e-07 3.18e-06 1.04e-06 13 2.62e-07 3.43e-07 14 8.45e-08 1.13e-07 15 2.73e-08 16 8.8e-09 3.71e-08 0.000264 0.000729 8.67e-05 0.000235 7.59e-05 2.85e-05 2.45e-05 9.36e-06 7.9e-06 3.08e-06 1.01e-06 2.55e-06 8.23e-07 3.32e-07 2.66e-07 1.09e-07 8.57e-08 3.59e-08 1.18e-08 2.77e-08 0.000284 9.87e-05 2.47e-05 7.83e-06 2.09e-06 6.32e-07 1.74e-07 5.14e-08 1.44e-08 4.2e-09 0.000102 2.92e-05 8.35e-06 2.39e-06 6.86e-07 1.97e-07 5.64e-08 1.62e-08 4.63e-09 1.33e-09 Table 2. Convergence of k-cut to uniform with increasing k. Variation distance from uniform and -values for k cuts, as a function of k, for n = 150, where  is one less than the maximum ratio of the probability of selecting a ballot under the assumed distribution to the probability of selecting that ballot under the uniform distribution. The second through seventh column headings describe probability distribution of single- cut sizes convolved with themselves k times to obtain the k-th row. Columns two and five give results for the distribution Ek equal to the k-fold iteration of single cuts that have the distribution of the empirical data of Table 1. Columns three and six gives results for the distribution Uk[w, b] equal to the k-fold iteration of single cuts that have the distribution U[8, 122] that is the best fit of this class to the empirical distribution E. Columns four and seven gives results for the distribution Fk equal to the k-fold iteration of single cuts that have the distribution described in equations (3) and (4). The row for k = 6 is bolded, since we will show that with our mitigation procedures, 6 cuts is "close enough" to random. We can see that, after six cuts, we get a variation distance of about 7.19 × 10−4, for the empirical distribution, which is often small enough to justify our recommendation that six cuts being "close enough" in practice, for any RLA. 3 In Section 6.4, we discuss why this value of  is relevant k-Cut: Simple Approximate Sampling 11 4.4 Asymptotic Convergence to Uniform with k As k increases, the distribution of cut sizes provably approaches the uniform distribution, under mild assumptions about the distribution of cut sizes for a single cut and the assumption of independence of successive cuts. This claim is plausible, given the analysis of similar situations for contin- uous random variables. For example, Miller and Nigrini [8] have analyzed the summation of independent random variables modulo 1, and given necessary and sufficient conditions for this sum to converge to the uniform distribution. For the discrete case, one can show that if once k is large enough that every ballot is selected by k-cut with some positive probability, then as k increases the distribution of cut sizes for k-cut approaches U. Furthermore, the rate of convergence is exponential. The proof details are omitted here; however, the second claim uses Markov-chain arguments, where each rotation amount is a state, and the fact that the transition matrix is doubly stochastic. 5 Approximate Sampling We have shown in the previous section that as we iterate our k-cut procedure, our distribution becomes quite close to the uniform distribution. However, our sampling still is not exactly uniform. The literature on post-election audits generally assumes that sampling is perfect. One exception is the paper by Banuelos and Stark [2], which suggests dealing conservatively with the situation when one can not find a ballot in an audit, by treating the missing ballot as if it were a vote for the runner-up. Our proposed mitigation procedures are similar in flavor. In practice, sampling for election audits is often done using software such as that by Stark [13] or Rivest [9]. Given a random seed and a number n of ballots to sample from, they can generate a pseudo-random sequence of integers from [n], indexing into a list of ballot positions or ballot IDs. It is reasonable to treat such cryptographic sampling methods as "indistinguishable from sampling uniformly," given the strength of the underlying cryptographic primitives. However, in this paper we deal with sampling that is not perfect; the k-cut method with k = 1 is obviously non-uniform, and even with modest k values, as one might use in practice, there will be some small deviations from uniformity. Thus, we address the following question: How can one effectively use an approximate sampling procedure in a post-election audit? We let G denote the actual ("approximate") probability distribution over [n] from the sampling method chosen for the audit. Our analyses assume that we have some bound on how close G is to U, like variation distance. Furthermore, the quality of the approximation may be controllable, as it is with k-cut: one can improve the closeness to uniform by increasing k. We let Gs denote the distribution on s-tuples of ballots from [n] chosen with replacement according to the distribution G for each draw. 12 M. Sridhar and R.Rivest 6 Auditing Arbitrary Contests This section proves a general result: for auditing an arbitrary contest, we show that any risk-limiting audit can be adapted to work with approximate sampling, if the approximate sampling is close enough to uniform. In particular, any RLA can work with the k-cut method, if k is large enough. We show that if k is sufficiently large, the resulting distribution of k-cut sizes will be so close to uniform that any statistical procedure cannot efficiently distinguish between the two. That is, we want to choose k to guarantee that U and G are close enough, so that any statistical procedure behaves similarly on samples from each. Previous work done by Baign`eres in [1] shows that, there is an optimal dis- tinguisher between two finite probability distributions, which depends on the KL-Divergence between the two distributions. on the variation distance between U and G. We follow a similar model to this work, however, we develop a bound based 6.1 General Statistical Audit Model We construct the following model, summarized in Figure 2. Fig. 2. Overview of uniform vs. approximate sampling effects, for any statistical au- diting procedure. The audit procedure can be viewed as a distinguisher between the two underlying distributions. If it gives significantly different results for the two distri- butions, it can thereby distinguish between them. However, if p and p(cid:48) are extremely close, then the audit cannot be used as a distinguisher. We define δ to be the variation distance between G and U. We can find an upper bound for δ empirically, as seen in Table 2. If G is the distribution of k-cut, then by increasing k we can make δ arbitrarily small. k-Cut: Simple Approximate Sampling 13 The audit procedure requires a sample of some given size s, from U s or Gs. We assume that all audits behave deterministically. We do not assume that suc- cessive draws are independent, although we assume that each cut is independent. Given the size s sample, the audit procedure can make a decision on whether to accept the reported contest result, escalate the audit, or declare an upset. 6.2 Mitigation Strategy When we use approximate sampling, instead of uniform sampling, we need to ensure that the "risk-limiting" properties of the RLAs are maintained. In par- ticular, as described in [6], an RLA with a risk limit of α guarantees that with probability at least (1 − α) the audit will find and correct the reported outcome if it is incorrect. We want to show that we can maintain this property, while introducing approximate sampling. Without loss of generality, we focus on the probability that the audit accepts the reported contest result, since it is the case where approximate sampling may affect the risk-limiting properties. We show that G and U are sufficiently close when k is large enough, that the difference between p and p(cid:48), as seen in Figure 2, is small. We show a simple mitigation procedure, for RLA plurality elections, to com- pensate for this non-uniformity, that we denote as risk-limit adjustment. For RLAs, we can simply decrease the risk limit α by p(cid:48) − p (or an upper bound on this) to account for the difference. This decrease in the risk limit can accommo- date the risk that the audit behaves incorrectly due to approximate sampling. 6.3 How much adjustment is required? We assume we have an auditing procedure A, which accepts samples and outputs "accept" or "reject". We model approximate sampling with providing A samples from a distribution G. For our analysis, we look at the empirical distribution of cuts in Table 2. For uniform sampling, we provide A samples from U. We would like to show that the probability that A accepts an outcome in- correctly, given samples from G is not much higher than the probability that A accepts an incorrect outcome, given samples from U. We denote B as the set of ballots that we are sampling from. Theorem 1. Given a fixed sample size s and the variation distance δ, the max- imum change in probability that A returns "accept" due to approximate sampling is at most 1 + (1 + nδ)s(cid:48) − 1, where s(cid:48) is the maximum number of "successes" seen in s Bernoulli trials, where each has a success probability of δ, with probability at least 1 − 1. Proof. We define s as the number of ballots that we pull from the set of cast ballots, before deciding whether or not to accept the outcome of the election. 14 M. Sridhar and R.Rivest Given a sample size s, based on our sampling technique, we draw s ballots, one at a time, from G or from U. We model drawing a ballot from G as first drawing a ballot from U; however, with probability δ, we replace the ballot we draw from U with a new ballot from B following a distribution F. We make no further assumptions about the distri- bution F, which aligns with our definition of variation distance. When drawing from G, for any ballot b ∈ B, we have probability at most 1 When we sample sequentially, we get a length-s sequence of ballot IDs, S, for each of G and U. Throughout this model, we assume that we sample with replacement, although similar bounds should hold for sampling without replace- ment, as well. We define X as the list of indices in the sequence S where both G and U draw the same ballot, in order. We define Z as the list of indices where G has "switched" a ballot after the initial draw. That is, for a fixed draw, U might produce the sample sequence [1, 5, 29]. Meanwhile, G might produce the sample sequence sequence [1, 5, 30]. For this example, X = [0, 1] and Z = [2]. We define the set of possible size-s samples as the set D. We choose s(cid:48) such that for any given value 1, the probability that Z is larger than s(cid:48) is at most 1. Using this set up, we can calculate an upper bound on the probability that A returns "accept". In particular, given the empirical distribution, the probability that A returns "accept" for a deterministic auditing procedure becomes n + δ of drawing b. Pr[A accepts G] = Pr[A accepts S] ∗ Pr[draw S G] . (cid:88) S∈D Now, we note that we can split up the probability that we can draw a specific sample S from the distribution G. We know that with high probability, there are at most s(cid:48) ballots being "switched". Thus, Pr[A accepts G] Pr[A accepts S]∗Pr[draw S G, S has ≤ s(cid:48) "switched" ballots]∗Pr[S has ≤ s(cid:48) "switched" ballots] Pr[A accepts S]∗Pr[draw S G, S has > s(cid:48) "switched" ballots]∗Pr[S has > s(cid:48) "switched" ballots] . (cid:88) (cid:88) S∈D S∈D = + Now, we note that the second term is upper bounded by Pr[any size-s sample has more than s(cid:48) switched ballots] . We define the probability that any size-s sample contains more than s(cid:48) switched ballots as 1. We note that, although the draws aren't independent, from the definition of variation distance, this is upper bounded by the probability that a binomial distribution, with s draws and δ probability of success. Now, we can focus on bounding the first term. We know that Pr[A accepts G, any sample has at most s(cid:48) switched ballots] (cid:88) S∈D = k-Cut: Simple Approximate Sampling 15 Pr[A accepts S] ∗ Pr[draw S G, S has ≤ s(cid:48) "switched" ballots] Meanwhile, for the uniform distribution, we know that the probability of accept- ing becomes Pr[A accepts U] = Pr[A accepts S] ∗ Pr[draw S U] . (cid:88) S∈D Thus, we know that the change in probability becomes Pr[A accepts G] − Pr[A accepts U] Pr[A accepts S](Pr[draw S G, S has ≤ s(cid:48) "switched" ballots]−Pr[draw S U]) . (cid:88) S∈D ≤ 1+ that X =(cid:0) s However, for any fixed sample S, we know that we can produce S from E in many possible ways. That is, we know that we have to draw at least s−s(cid:48) ballots that are from U. Then, we have to draw the compatible s(cid:48) ballots from G. In general, we define the possible length s − s(cid:48) compatible shared list of indices as the set X. That is, by conditioning on X, we are now defining the exact indices in the sample tally where the uniform and empirical sampling can differ. We note any specific x ∈ X, we can define z as the remaining indices, which are allowed to differ from uniform and approximate sampling. That is, if there are 3 ballots in the sample, and x = [0, 1], then z = [2]. S, given the empirical distribution, and a fixed value of s(cid:48). (cid:1) and each possible set happens with equal probability. Then, for We can now calculate the probability that we draw some specific size-s sample s(cid:48) Pr[draw S G] = Pr[draw x U]∗Pr[draw z G]∗Pr[switched ballots are at indices in z] (cid:88) x∈X n + δ, or 1+nδ However, we know that for each ballot b in z, we draw ballot b with probability at most 1 n . That is, for any ballot in x, we know that we draw it with uniform probability exactly. However, for a ballot b in z, we know that this a ballot that may have been "switched". In particular, with probability 1 n , we draw the correct ballot from U. However, in addition to this, with probability δ, we replace it with a new ballot - we assume that we replace it with the correct ballot with probability 1. Thus, with probability at most 1 n + δ, we draw the correct ballot for this particular slot. Thus, we get x∈X Pr[draw S G] = (cid:88) ≤(cid:88) ≤ (1 + nδ)s(cid:48)(cid:88) x∈X x∈X Pr[draw x U] ∗ Pr[draw z G] ∗ Pr[switched ballots are at indices in z] Pr[draw x U] ∗ ( 1 + nδ n )s(cid:48) ∗ Pr[switched ballots are at indices in z] Pr[draw x U] ∗ Pr[draw z U] ∗ Pr[switched ballots are at indices in z] . (cid:1) possible sequences x ∈ X, where the "switched" ballots could be. Each of these possible sequences occurs with equal probability, this becomes Pr[draw S G] Pr[draw x U] ∗ Pr[draw z U] ∗ Pr[switched ballots are at indices in z] . 16 s(cid:48) M. Sridhar and R.Rivest Now, we note that there are (cid:0) s ≤ (1 + nδ)s(cid:48)(cid:88) = (1 + nδ)s(cid:48)(cid:88) x∈X = (1 + nδ)s(cid:48) x∈X Pr[draw S U] . Pr[draw x U] ∗ Pr[draw z U] ∗ 1(cid:0) s (cid:1) s(cid:48) For an example, we can consider the sequence of ballots S =[1, 5, 29]. For simplicity, we assume that s(cid:48) = 1. Now, we would like to bound the probability that G draws S. We can split this up into cases: 1. G produces [1, 5, 29] by drawing 1 and 5 from the uniform distribution, then drawing a "switched ballot" at slot 3, and drawing ballot 29, given the switched ballot at position 3. 2. G produces [1, 5, 29] by drawing 1 and 29 from the uniform distribution, then drawing a "switched ballot" at slot 2, and drawing ballot 5, given the switched ballot at position 2. 3. G produces [1, 5, 29] by drawing 5 and 29 from the uniform distribution, then drawing a "switched ballot" at slot 1, and drawing ballot 1, given the switched ballot at position 1. Thus, we define the possible compatible shared list of indices X as X = {[0, 1], [1, 2], [0, 2]}. For each possible list x ∈ X, we can define z as the remaining possible positions where we sample from G instead of U. That is, if x = [0, 1], then z = [2]. In this case, we must first draw ballots 1 and 5 from the uniform distribution. Then, assuming that the ballot at slot 2 can be switched, we know that with probability at most δ, it is switched to take the value 29. With probability 1 n , it takes the value 29 regardless. Thus, the probability of generating the appropriate sample tally, given a possible switched ballot at slot 2, becomes (1+nδ) , as desired. Using this bound we can calculate our total change in acceptance probability. n3 Pr[A accepts G] − Pr[A accepts U] This becomes: (cid:88) S∈D (cid:88) S∈D ≤ 1 + Pr[A accepts S](Pr[draw S G, S has ≤ s(cid:48) "switched" ballots] − Pr[draw S U]) ≤ 1 + ((1 + nδ)s(cid:48) − 1) Pr[A accepts S] Pr[draw S U] ≤ 1 + (1 + nδ)s(cid:48) − 1 , which provides us the required bound. k-Cut: Simple Approximate Sampling 17 6.4 Empirical Support Our previous theorem gives us a total bound of our change in risk limit, which depends on our value of s(cid:48) and δ. We note that, for each ballot b, we provide a general bound of a multiplicative factor increase of (1 + nδ), which is based off the variation distance of δ. However, we note that in practice, the exact bound we are looking for depends on the multiplicative increase in probability of a single ballot being chosen. That is, we can calculate the max increase in multiplicative ratio for a single ballot, compared to the uniform distribution. Thus, if a ballot is chosen with probability at most (1+2) , then our bound on the change in probability becomes n 1 + (1 + 2)s(cid:48) − 1. The values of 2 are recorded, for varying number of cuts in Table 2. We can calculate the maximum change in probability for a varying number of cuts using this bound. Here, we analyze the case of 6 cuts. To get a bound on s(cid:48), we can model how often we switch ballots. In particular, this follows a binomial distribution, with s independent trials, where each trial has a δ6 probability of success. Using the binomial survival function, we see at most 4 "switched ballots" in 1,000 draws, with probability (1- 8.78 × 10−4). From our previous argument, we know that our change in acceptance probability is at most (1+2)4−1. Using our value of 2 for k = 6, this causes a change in probability of at most 0.0090. Thus, the maximum possible change in probability of incorrectly accepting this outcome is 0.0090 + 8.78 × 10−4, which is approximately 9.88 × 10−3. We can compensate for this by adjusting our risk limit by less than 1%. 7 Multi-stack Sampling Our discussion so far presumes that all cast paper ballots constitute a single "stack," and suggest using our proposed k-cut procedure is used to sample ballots from that stack. In practice, however, stacks have limited size, since large stacks are physically awkward to deal with. The collection of cast paper ballots is therefore often arranged into multiple stacks of some limited size. The ballot manifest describes this arrangement of ballots into stacks, giving the number of such stacks and the number of ballots contained in each one. We assume that the ballot manifest is accurate. A tool like Stark's Tools for Risk- Limiting Audits 4 takes the ballot manifest (together with a random seed and the desired sample size) as input and produces a sampling plan. A sampling plan describes exactly which ballots to pick from which stacks. That is, the sampling plan consists of a sequence of pairs, each of the form: (stack-number, ballot-id), where ballot-id may be either an id imprinted on the ballot or the position of the ballot in the stack (if imprinted was not done). Modifying the sampling procedure to use k-cut is straightforward. We ignore the ballot-ids, and note only how many ballots are to be sampled from each 4 https://www.stat.berkeley.edu/~stark/Vote/auditTools.htm 18 M. Sridhar and R.Rivest stack. That number of ballots are then selected using k-cut rather than using the provided ballot-ids. For example, if the sampling plan says that 2 ballots are to be drawn from stack 5, then we ignore the ballot-ids for those specific 2 ballots, and return 2 ballots drawn approximately uniformly at random using k-cut. Thus, the fact that cast paper ballots may be arranged into multiple stacks (or boxes) does not affect the usability of k-cut for performing audits. 8 Approximate Sampling in Practice The major question when using the approximate sampling procedure is how to choose k. Choosing a small value of k makes the overall auditing procedure more efficient, since you save more time in each sample you choose. However, it requires more risk limit adjustment. The risk limit mitigation procedure requires knowledge of the maximum sam- ple size, which we denote as s∗, beforehand. We assume that the auditors have a reasonable procedure for estimating s∗ for a given contest. One simple procedure to estimate s∗ is to get an initial small sample size, s, using uniform random sampling. Then, we can use a statistical procedure to approximate how many ballots we would need to finish the audit, assuming the rest of the ballots in the pool are similar to the sample. Possible statistical procedures which can be used here include: -- Replicate the votes on the ballots, -- Sample from the multinomial distribution, using the sample voteshares as hyperparameters, -- Use the Polya's Urn model to extend the sample, -- Use the workload estimate as defined in [7], for a contest with risk limit α and margin m to predict the number of samples required. Let us assume that we use one of these techniques and calculate that the audit is complete after an extension of size d. To be safe, we suggest assuming that the required additional sample size for the audit is at most 2d or 3d, to choose the value of k. Thus, our final bound on s∗ would be s + 3d. Given this upper bound, we can perform our approximate sampling proce- dures and mitigation procedures, assuming that we are drawing a sample of size s∗. If the sample size required is greater than s∗, then the ballots which are sampled after the first s∗ ballots should be sampled uniformly at random. Use in Indiana pilot audit. On May 29 -- 30, 2018, the county of Marion, Indiana held a pilot audit of election results from the November 2016 general election. This audit was held by the Marion County Election Board with assistance from the Voting System Technology Oversight Project (VSTOP) Ball State Univer- sity, the Election Assistance Commission, and the current authors. For some of the sampling performed in this audit, the "Three-Cut" sampling method of this paper was used instead of the "counting to a given position" k-Cut: Simple Approximate Sampling 19 method. The Three-Cut method was modified so that three different people made each of the three cuts; the stack of ballots was passed from one person to the next after a cut. Although the experimentation was informal and timings were not measured, the Three-Cut method did provide a speed-up in the sampling process. The experiment was judged to be sufficiently successful that further devel- opment and experimentation was deemed to be justified. (Hence this paper.) 9 Discussion and Open Problems We would like to do more experimentation on the variation between individuals on their cut-size distributions. The current empirical results in this paper are based off of the cut distributions of just the two authors in the paper. We would like to test a larger group of people to better understand what distributions should be used in practice. After investigating the empirical distributions of cuts, we would like to de- velop "best practices" for using the k-cut procedure. That is, we'd like to develop a set of techniques that auditors can use to produce nearly-uniform single-cut- size distributions. This will make using the k-cut procedure much more efficient. Finally, we note that our analysis makes some assumptions about how k-cut is run in practice. For instance, we assume that each cut is made independently. We would like to run some empirical experiments to test our assumptions. 10 Conclusions We have presented an approximate sampling procedure, k-cut, for use in post- election audits. We expect the use of k-cut may save time since it eliminates the need to count many ballots in a stack to find the desired one. We showed that as k gets larger, our procedure provides a sample that is arbitrarily close to a uniform random sample. Moreover, we showed that even for small values of k, our procedure provides a sample that is close to being chosen uniformly at random. We designed a simple mitigation procedure for RLAs that accounts for any remnant non-uniformity, by adjusting the risk limit. Finally, we provided a recommendation of k = 6 cuts to use in practice, for sample sizes up to 1,000 ballots, based on our empirical data. References 1. Baign`eres, T., Vaudenay, S.: The complexity of distinguishing distributions (2008), results also in Baigne`eres' PhD thesis. 2. Banuelos, J.H., Stark, P.B.: Limiting risk by turning manifest phantoms into evil zombies. https://arxiv.org/abs/1207.3413 (2012) 3. Bretschneider, J., Flaherty, S., Goodman, S., Halvorson, M., Johnston, R., Lin- deman, M., Rivest, R., Smith, P., Stark, P.: Risk-limiting post-election audits: Why and how? (Oct 2012), (ver. 1.1) http://people.csail.mit.edu/rivest/ pubs.html#RLAWG12 20 M. Sridhar and R.Rivest 4. Johnson, K.: Election verification by statistical audit of voter-verified paper ballots. http://ssrn.com/abstract=640943 (Oct 31 2004) 5. Lindeman, M., Halvorseon, M., Smith, P., Garland, L., Addona, V., McCrea, D.: Principle and best practices for post-election audits. www.electionaudits.org/ files/best%20practices%20final_0.pdf (2008) 6. Lindeman, M., Stark, P.B.: A gentle introduction to risk-limiting audits. IEEE Security and Privacy 10, 42 -- 49 (2012) 7. Lindeman, M., Stark, P.B., Yates, V.S.: BRAVO: Ballot-polling risk-limiting au- dits to verify outcomes. In: Halderman, A., Pereira, O. (eds.) Proceedings 2012 EVT/WOTE Conference (2012) 8. Miller, S.J., Nigrini, M.J.: The modulo 1 Central Limit Theorem and Benford's law for products. International Journal of Algebra 2 no. 3, 119 -- 130 (2008) 9. Rivest, R.L.: Reference implementation code for pseudo-random sampler. http: //people.csail.mit.edu/rivest/sampler.py (2011) 10. Rivest, R.L.: Bayesian tabulation audits: Explained and extended. https://arxiv. org/abs/1801.00528 (January 1, 2018) 11. Rivest, R.L., Shen, E.: A Bayesian method for auditing elections. In: Halderman, J.A., Pereira, O. (eds.) Proceedings 2012 EVT/WOTE Conference (2012), https://www.usenix.org/system/files/conference/evtwote12/rivest_ bayes_rev_073112.pdf, workshop-program/presentation/rivest https://www.usenix.org/conference/evtwote12/ 12. Stark, P.B.: Papers, talks, video, legislation, software, and other documents on vot- ing and election auditing. https://www.stat.berkeley.edu/~stark/Vote/index. htm 13. Stark, P.B.: Tools for ballot-polling risk-limiting election audits. https://www. stat.berkeley.edu/~stark/Vote/ballotPollTools.htm (2017)
1606.01275
3
1606
2017-06-09T15:06:49
Predicting with Distributions
[ "cs.DS", "cs.LG" ]
We consider a new learning model in which a joint distribution over vector pairs $(x,y)$ is determined by an unknown function $c(x)$ that maps input vectors $x$ not to individual outputs, but to entire {\em distributions\/} over output vectors $y$. Our main results take the form of rather general reductions from our model to algorithms for PAC learning the function class and the distribution class separately, and show that virtually every such combination yields an efficient algorithm in our model. Our methods include a randomized reduction to classification noise and an application of Le Cam's method to obtain robust learning algorithms.
cs.DS
cs
Predicting with Distributions Michael Kearns* Zhiwei Steven Wu† June 12, 2017 Abstract We consider a new learning model in which a joint distribution over vector pairs (x, y) is determined by an unknown function c(x) that maps input vectors x not to individual outputs, but to entire distributions over output vectors y. Our main results take the form of rather general reductions from our model to algorithms for PAC learning the function class and the distribution class separately, and show that virtually every such combination yields an efficient algorithm in our model. Our methods include a randomized reduction to classification noise and an application of Le Cam's method to obtain robust learning algorithms. 1 Introduction We consider a new variant of the Probably Approximately Correct (PAC) learning framework. In our model, a joint distribution over vector pairs (x, y) is determined by an unknown target function c(x) that maps input vectors x not to individual outputs, but to entire distributions over output vectors y in some large space. This model generalizes settings such as learning with classification noise or errors, probablistic concepts (where y is a probabilistic but scalar function of x), multi- class learning (where y is a multi- or vector-valued but deterministic function of x), and settings in which the output space associated with a classification may be large and complex. It is an in- stance of a more general framework in which the distribution of multiple hidden variables - with unknown but parametric structural dependencies on observable inputs - determines the distri- bution of observable outputs. For the special case of a single binary hidden variable, we provide the first formal learning guarantees in a PAC framework. As in the standard PAC model, we begin with an unknown binary function or concept c cho- sen from a known class C,1 whose inputs x are distributed according to an unknown and arbitrary distribution. Now, however, the value c(x) determines which of two unknown probability dis- tributions Pc(x) govern the distribution of y, where P0 and P1 are chosen from a known class of distributions P . Thus y is distributed according to a mixture model, but the mixture component is given by a hidden classifier c. The learner does not see explicit labels c(x), but only the re- sulting (x, y) pairs. The goal is to learn a hypothesis model that consists of a hypothesis h that is a {0, 1}-valued function, and two probability distributions P0 and P1 from the class P . Given any input x, the model will predict the vector y to be drawn from the distribution Ph(x) (and hence *Dept. of Computer and Information Sciences, University of Pennsylvania. Email: [email protected] †Dept. of Computer and Information Sciences, University of Pennsylvania. Email: [email protected] 1We leave the consideration of multi- or real-valued functions c(x) to future work. 1 predict with distribution Ph(x)). Our objective is to minimize the conditional Kullback-Leibler (KL) divergence ExhKL(Pc(x) Ph(x))i, rather than simply the KL divergence to the mixture. We thus refer to our model as Predicting with Distributions (PwD). One of our primary motivations is composition and reducibility across different learning mod- els - in this case, models for classification and models for distribution learning. Within the standard PAC (classification) model, there is a rich theory of reducibility between specific learn- ing problems (Pitt and Warmuth, 1990; Kearns and Valiant, 1994), between classes of learning problems (Schapire, 1990; Kearns, 1998), as well as composition theorems allowing the creation of more complex learning algorithm from simpler ones (Kearns et al., 1994). Less common are results allowing one to assemble algorithms with provable performance guarantees from con- stituents that are solving different types of learning problems. A natural starting point for such an investigation is with the standard PAC supervised learning model, and its distributional ana- logue (Kearns et al., 1994), since these models are each already populated with a number of algo- rithms with strong theoretical guarantees. Our main technical interest is thus in conditions permitting computationally efficient learning algorithms composed of extant classification and distribution learning algorithms. Informally, our results imply that for every concept class C known to be PAC learnable with classification noise (Angluin and Laird, 1987), and almost every class P known to be PAC learnable in the distributional sense of Kearns et al. (1994), PwD problems given by (C,P ) are learnable in our framework. 1.1 Our Results and Techniques Our results take the form of reductions from our model to algorithms for PAC learning the concept class C and the distribution class P separately.2 The primary conceptual step is in identifying the natural technical conditions that connect these two different classes of learning problems. The centerpiece in this "bridge" is the notion of a distinguishing event for two probability distributions P0, P1 ∈ P , which is an event whose probability is "signficantly" (inverse polynomially) different under P0 and P1, provided these distributions are themselves sufficiently different. Our first result shows that a distinguishing event can be used, via a particular randomized mapping, to turn the observed y into a noisy binary label for the unknown concept c. This will serve as a building block for us to combine efficient PAC learners from classification and distribu- tion learning. We then use distinguishing events to provide two different reductions of our model to PAC classification and distribution learning algorithms. In the "forward" reduction, we assume the distribution class P admits a small set of candidate distinguishing events. We show that such candidate events exist and can be efficiently constructed for the class of spherical Gaussians and product distributions over any discrete domain. By searching and verifying this set for such an event, we first PAC learn c from noisy examples, then use the resulting hypothesis to "separate" P0 and P1 for a distributional PAC algorithm for the class P . This gives: 2Throughout the paper, all PAC learning algorithms (for both concept class C and distribution class P ) in our reduc- tion runs in polynomial time, since we are primarily concerned with computational efficiency (as opposed to sample complexity). 2 Theorem 1 (Informal Statement, Forward Reduction). Suppose that the concept class C is PAC learnable under classification noise, and the distribution class P is PAC learnable and admits a polynomial-sized set of distinguishing events. Then the joint class (C,P ) is PwD-learnable. In the "reverse" reduction, we instead first separate the distributions, then use their approxi- mations to learn c. Here we need a stronger distribution-learning assumption, but no assumption on distinguishing events. More precisely, we assume that mixtures of two distributions from P (which is exactly what the unconditioned y is) are PAC learnable. Once we have identified the (approximate) mixture components, we show they can be used to explicitly construct a specialized distinguishing event, which in turn lets us create a noisy label for c. This leads our result in the reverse reduction: Theorem 2 (Informal Statement, Reverse Reduction). Suppose that the concept class C is PAC learnable under classification noise, and any mixture of two distributions from P is PAC learnable. Then the joint class (C,P ) is PwD-learnable. In both reductions, we make central use of Le Cam's method to show that any PAC concept or distribution learning algorithm must have a certain "robustness" to corrupted data. Thus in both the forward and reverse directions, by controlling the accuracy of the model learned in the first step, we ensure the second step of learning will succeed. Since practically every C known to be PAC learnable can also be learned with classification noise (either directly or via the statistical query framework (Kearns, 1998), with parity-based constructions being the only known exceptions), and the distribution classes P known to be PAC learnable have small sets of distinguishing events (such as product distributions), and/or have mixture learning algorithms (such as Gaussians), our results yield efficient PwD algorithms for almost all combinations of PAC classification and distribution learning algorithms known to date. 1.2 Related Works At the highest level, our model falls under the framework of Haussler (1992), which gives a decision-theoretic treatment of PAC-style learning (Valiant, 1984) for very general loss functions; our model can be viewed as a special case in which the loss function is conditional log-loss given the value of a classifier. Whereas Haussler (1992) is primarily concerned with sample complexity, our focus here is on computational complexity and composition of learning models. At a more technical level, our results nicely connect two well-studied models under the PAC learning literature. First, our work is related to the results in PAC learning under classifica- tion noise (Angluin and Laird, 1987; Decatur, 1997; Kearns, 1998), and makes use of a result by Ralaivola et al. (2006) that established the equivalence of learning under (standard) classi- fication noise (CN) and under class-conditional classification noise (CCCN). Our work also re- lies on the PAC model for distribution learning (Kearns et al., 1994), including a long line of works on learning mixtures of distributions (see e.g. Dasgupta (1999); Arora and Kannan (2001); Vempala and Wang (2004); Feldman et al. (2008)). Our new model of PwD learning, in particular, can be viewed as a composition of these two models. Our model is also technically related to the one of co-training (Blum and Mitchell, 1998) in that the input x and the output y give two different views on the data, and they are conditionally independent given the unknown label z = c(x), which is also a crucial assumption for co-training (as well as various other latent variable models for inference and learning). However, our model 3 is also fundamentally different from co-training in two ways. First, in our model, there is not a natural target Boolean function that maps y to the label z. For example, any outcome y can be generated from both distributions P0 and P1. In other words, just using y is not sufficient for identifying the label z. Second, our learning goal is to predict what distribution the outcome y is drawn from given the input x, as opposed to predicting the unknown label z. 2 Preliminaries 2.1 Model: PwD-Learning Let X denote the space of all possible contexts, and Y denote the space of all possible outcomes. We assume that all contexts x ∈ X are of some common length n, and all outcomes y ∈ Y are of some common length k. Here the lengths are typically measured by the dimension; the most common examples for X are the boolean hypercube {0, 1}n and subsets of Rn ({0, 1}k and Rk for Y ). Let C be a class of {0, 1}-valued functions (also called concepts) over the context space X , and P be a class of probability distributions over the outcome space Y . We assume an underlying distribution D over X , a target concept c ∈ C, and target distributions P0 and P1 in P . Together, we will call the tuple (c, P0, P1) the target model. Given any target model (c, P0, P1) and underlying distribution D, our learning algorithm is then given sample access to the following generative example oracle Gen(D, c, P0, P1) (or simply Gen). On each call, the oracle does the following (see Figure 1 for an illustration): 1. Draws a context x randomly according to D; 2. Evaluates the concept c on x, and draws an outcome y randomly from Pc(x); 3. Returns the context-outcome pair (x, y). A hypothesis model is a triple T = (h, P0, P1) that consists of a hypothesis h ∈ C and two hypothesis distributions P0 and P1 ∈ P . Given any context x, the hypothesis model predicts the outcome y to be drawn from the distribution Ph(x) (or simply predicts with distribution Ph(x)). The goal of our learning algorithm is to output a hypothesis model with high accuracy with respect to the target model, and the error of any model T is defined as err(T ) = E x∼DhKL(Pc(x) Ph(x))i where KL denotes Kullback-Leibler divergence (KL divergence). Our model of Predicting with Distributions learning (PwD-learning) is thus defined as follows. Definition 1 (PwD-Learnable). Let C be a concept class over X , and P be a class of distributions over Y . We say that the joint class (C,P ) is PwD-learnable if there exists an algorithm L such that for any target concept c ∈ C, any distribution D over X , and target distributions P0, P1 ∈ P over Y , and for any ε > 0 and 0 < δ ≤ 1, the following holds: if L is given inputs ε, δ as inputs and sample access from Gen(D, c, P0, P1), then L will halt in time bounded by poly(1/ε, 1/δ, n, k) and output a triple T = (h, P0, P1) ∈ C ×P ×P that with probability at least 1− δ satisfies err(T ) ≤ ε. Observe that the unconditional distribution over y is a mixture of the target distributions P0 and P1. In our model, it is not enough to learn the mixture distribution (which is a standard 4 problem in learning mixtures of distributions). Our learning objective is to minimize the expected conditional KL divergence, which is more demanding and in general requires a good approximation to the target concept c over X . Also note that we have stated the definition for the "proper" learning case in which the hy- pothesis models lie in the target classes C and P . However, all of our results hold for the more general case in which they lie in potentially richer classes C′ and P ′. x ∼ D c(x) = 0 c(x) = 1 y ∼ P0 y ∼ P1 Figure 1: The generative model Gen: (1) first draw a context x from the underlying distribution D, (2) then evaluate the concept c on x and (3) draw the outcome y from distribution Pc(x). 2.2 Related Learning Models We now discuss two learning models related to our setting (see the appendix for formal defini- tions). CN Learning We first introduce PAC learning under classification noise (CN) (Angluin and Laird, 1987). For any noise rate 0 ≤ η < 1/2, consider the example oracle EX CN(c,D) that on each call draws an example (x, c(x)) randomly according to D, then with probability 1− η returns the uncor- rupted example (x, c(x)), and with probability η returns the erroneous example (x,¬c(x)). The concept class C is CN learnable if there exists a polynomial-time algorithm that given sample η CN finds a hypothesis h ∈ C that approximately minimizes the classification error: access to EX err(h) = Prx∼D[c(x) , h(x)]. η CCCN Learning In a more general noise model called Class-Conditional Classification Noise (CCCN) η proposed by Ralaivola et al. (2006), the example oracle EX CCCN has class-dependent noise rates - that is, the noise rate η0 for the negative examples (c(x) = 0) and the noise rate η1 for the positive examples (c(x) = 1) may be different, and both below 1/2. Moreover, Ralaivola et al. (2006) show that any class that is learnable under CN is also learnable under CCCN. (See the appendix for a formal statement). Distribution Learning We also make use of results from for PAC learning probability distribu- tions (Kearns et al., 1994). A distribution class P is efficiently learnable if there exists a polynomial- time algorithm that, given sample access to an unknown target distribution P, outputs an accurate distribution P such that KL(P P) ≤ ε for some target accuracy ε. For any distribution P ∈ P and any point y ∈ Y , we assume that we can evaluate the probability (density) of y assigned by P (referred to as learning with an evaluator in Kearns et al. (1994); see the appendix for the formal 5 definition). We will write P(y) to denote the probability (or density) of point y, and write P(E) to denote Pry∼P[y ∈ E] for any measurable set E ⊂ Y . To simplify our analysis, for the remainder of the paper we will make the following assumption on the class P to ensure that the log-likelihood loss (or log-loss) is bounded in the domain Y . While this condition may not hold for some natural classes of distributions (e.g. Gaussians), it can be obtained using standard procedures (for instance, by truncating, or mixing with a small amount of the uniform distribution; see Feldman et al. (2006) for an example). Assumption 1 (Boundedness Assumption). There exists a quantity M that is upper bounded by poly(k) such that for any distribution P ∈ P and any point y ∈ Y , we have log(1/P(y)) ≤ M. 3 CN Learning with Identified Distinguishing Events In this section, we will introduce a central concept to our framework-distinguishing events. In- formally, an event E ⊂ Y is distinguishing for distributions P0 and P1 if it occurs with different probabilities under the measures of P0 and P1. As a consequence, these events are informative about target concept c that determines which distribution the outcome y is drawn from. We will rely on such events to create a CCCN learning instance for the target concept c. Thus, whenever the class C is learnable under CN (and hence learnable under CCCN by Ralaivola et al. (2006)), we can learn the target concept c under the PwD model using a distinguishing event. Definition 2 (Distinguishing Event). Let P and Q be distributions over the outcome space Y , and let ξ > 0. An event E ⊆ Y is ξ-distinguishing for distributions P and Q if P(E)− Q(E) ≥ ξ. We will call ξ the separation parameter for such an event. We will now show that the knowledge of a distinguishing event between P0 and P1 allows us η CCCN, and therefore we can learn the concept c with a CCCN to simulate an example oracle EX learner. The main technical problem here is to assign noisy labels based on the distinguishing event so that noise rates η0 and η1 of the oracle are strictly less than 1/2. Our solution is to construct a randomized mapping from the event to the labels.3 Let us first introduce some parameters. Let E ⊆ Y be a ξ-distinguishing event for the distributions P0 and P1 for some ξ ∈ (0, 1]. We will write p = P0(E) and q = P1(E). Consider the following algorithm Lab( p, q, ξ) that takes parameters p, q that are estimates for p and q, and the separation parameter ξ as inputs, and randomly creates noisy labels for (x, y) pair drawn from Gen: • Draw an example (x, y) from the oracle Gen. • If y ∈ E, assign label ℓ = 1 with probability a1 and ℓ = 0 with probability a0 = 1 − a1; Other- wise, assign label ℓ = 1 with probability b1 and ℓ = 0 with probability b0 = 1− b1, where a0 = 1/2 + ξ( p + q − 2) 4( q − p) and b0 = 1/2 + ξ( p + q) 4( q − p) (1) • Output the labeled example (x, ℓ). 3In the work of Blum and Mitchell (1998), the authors showed that any CN learnable class is also learnable when the class-conditional noise rates satisfy η0 + η1 < 1. Our construction here will imply a more general result-the class remains learnable when the noise rates satisfy η0 + η1 , 1. 6 the appendix for a proof). It's easy to check that both vectors (a0, a1) and (b0, b1) form valid probabilities over {0, 1} (see As mentioned, we need to ensure the class-conditional noise rates to be below 1/2. As a first step, we work out the noise rates of Lab in terms of the true probabilities p and q, and show that the "estimated" noise rates based on p and q are below (1/2− ξ/4). Lemma 1. Given a fixed ξ-distinguishing event E, the class-conditional noise rates of Lab are η1 = Pr[ℓ = 0 c(x) = 1] = qa0 + (1− q)b0 and η0 = Pr[ℓ = 1 c(x) = 0] = pa1 + (1− p)b1. Moreover, given any input estimates ( p, q) for (p, q), the parameters a0, a1, b0 and b1 satisfy: qa0 + (1− q)b0 = pa1 + (1− p)b1 ≤ 1/2− ξ/4. By Lemma 1, we know that as long as the input estimates p and q are sufficiently close to p and q, the noise rates will be less than 1/2. To obtain such estimates, we will guess the values of p and q on a grid of size ⌈1/ ∆⌉2 in the range of [0, 1]2, where ∆ ∈ [0, 1] is some discretization parameter. Note that for some pair of values i, j ∈ [⌈1/ ∆⌉] and i , j such that the guesses ( p, q) = (i∆, j ∆) satisfies p ∈ [p − ∆, p + ∆] and q ∈ [q − ∆, q + ∆] Given such accurate guesses p and q, we can then guarantee low noise rates as derived below: Lemma 2. Fix any ∆ ∈ [0, 1]. Suppose that the estimates p and q satisfy p− p ≤ ∆ and q− q ≤ ∆, then the class-conditional noise rates η0 and η1 for Lab( p, q, ξ) are upper bounded by 1/2− ξ/4 + ∆. Thus, if we choose the discretization parameter ∆ to be below ξ/4, then the algorithm Lab( p, q) η is a valid example oracle EX CCCN for some pair of guess estimates. Furthermore, if we apply the corresponding CCCN learning algorithm to the instantiations of Lab( p, q) over all guesses ( p, q), the output list of hypotheses is then guaranteed to contain an accurate one. Lemma 3. Let ε, δ ∈ (0, 1). Suppose that the concept class C is CN learnable, and there exists an identi- fied ξ-distinguishing event E for the two target distributions P0 and P1. Then there exists an algorithm L1 such that when given ε, δ, ξ and E as inputs, it will halt in time bounded by poly(1/ε, 1/δ, 1/ξ, n), and with probability at least 1− δ, output a list of hypotheses that contains some h such that err(h) ≤ ε. In the next two sections, we will use the algorithm in Lemma 3 as a subroutine for learning the target concept c in the PwD framework. 4 Forward Reduction Now we will give our forward algorithmic reduction: first use a CN learner to approximate the target concept c sufficiently well to separate the distributions P0 and P1, then learn each distri- bution using a distribution learner.4 We will rely on the result in Section 3 to learn c with a CCCN learner, but we do not assume the learner has a priori identified a distinguishing event. Instead, we will assume that the distribution class P admits a parametric class of distinguishing events of polynomial size, which allows us to distinguish any two distributions in P with large KL-divergence. 4We use the term "forward" to indicate that the reduction decomposes the learning process into the steps suggested by the generative model depicted in Figure 1. 7 Assumption 2 (Parametric Class of Distinguishing Events). There exists a parametric class of events E(·) for the distribution class P such that for any γ > 0 and for any two probability distributions P and Q in P with KL(PQ) ≥ γ , the class of events E(γ ) contains a ξ-distinguishing event E for P and Q, where ξ ≥ 1/ poly(k, 1/γ ). Furthermore, E(γ ) can be computed in time poly(k, 1/γ ) and the cardinality E(γ ) ≤ poly(k, 1/γ ). To illustrate the intuition of how to construct such class of distinguishing events, we will give a simple example here. In the appendix, we will extend the construction to work for the class of spherical Gaussian distributions and product distributions over discrete domains. Simple Example Consider the outcome space Y = {0, 1}k and the class of full-support product distributions P over Y . Let P, Q ∈ P be two distribution such that KL(PQ) ≥ γ . Under the boundedness condition in Assumption 1, it can be shown that there exists some coordinate l such that P l − Ql ≥ 1/ poly(k, 1/γ ), where Pl = Pry∼P[yl = 1] and Ql = Pry∼Q[yl = 1]. Therefore, for each coordinate l, the event that the coordinate yj is 1 is a candidate distinguishing event, so the class of events is simply E = {1[yl = 1] l ∈ [k]}. Here is our main result in the forward reduction. Theorem 3 ((Formal version of Theorem 1)). Under the Assumption 2 that P admits a parametric class of events E, the joint class (C,P ) is PwD-learnable as long as the concept class C is CN learnable, and the distribution class P is efficiently learnable. We will present our reduction in three key steps. 1. First, as a simple extension to Section 3, we can learn a hypothesis h with sufficiently small error assuming the class of events E contains a distinguishing event for the distributions P0 and P1. 2. Suppose we have learned an accurate hypothesis h from the first step, we can then use h to separate outcomes y drawn from P0 and P1, and apply the distribution learner to learn accurate distributions P0 and P1. This creates an accurate hypothesis model T = (h, P0, P1). 3. Finally, we need to handle the case where the distributions P0 and P1 are arbitrarily close, and there is no distinguishing event for us to learn the concept c. We will show in this case it is not necessary to learn the target concept, and we can directly learn the distributions without relying on an accurate hypothesis h. The main technical challenge lies in the second and third steps, where we will apply the dis- tribution learner (for single distributions in P ) on samples drawn from a mixture of P0 and P1. To tackle this issue, we will prove a robustness result for any distribution learner - as long as the input distribution is sufficiently close to the target distribution, the output distribution by the learner remains accurate. 5 4.1 CN Learning with a Class of Events As a first step in our reduction, we will simply extend Lemma 3: for each event E in the event class E, run the CCCN learner using E as a candidate distinguishing event. If the two target 5Our result actually extends to any PAC learning algorithm, and we omit the simple details. 8 distributions P0 and P1 have large KL divergence, then one of the output hypotheses h will be accurate with respect to c: Lemma 4. Let ε, δ ∈ (0, 1) and γ > 0. Suppose that the class C is CN learnable, the class P ad- mits a parametric class of events E (as in Assumption 2). If the two distributions P0 and P1 satisfy max{KL(P0P1), KL(P1P0)} ≥ γ , then there exists an algorithm L2 that given sample access to Gen and ε, δ, γ as inputs, runs in time poly(1/ε, 1/δ, 1/γ , n), and with probability at least 1 − δ outputs a list of hypotheses H that contains a hypothesis h with error err(h) ≤ ε. 4.2 Robustness of Distribution Learner Before we proceed to the next two steps of the reduction, we will briefly digress to give a useful robustness result showing that the class P remains efficiently learnable even if the input distri- bution is slightly perturbed. Our result relies on the well-known Le Cam's method, which is a powerful tool for giving lower bounds in hypothesis testing. We state the following version for our purpose.6 Lemma 5. [Le Cam's method (see e.g. Le Cam (1986); Yu (1997))] Let Q0 and Q1 be two probability distributions over Y , and let A : Y m → {0, 1} be a mapping from m observations in Y to either 0 or 1. Then Pr A,Y m∼Qm 0 [A(Y m) , 0] + Pr A,Y m∼Qm 1 [A(Y m) , 1] ≥ 1−pmKL(Q0Q1)/2 where Y m ∼ Qm θ denotes an i.i.d. sample of size m drawn from the distribution Qθ. The lemma above shows that any statistical procedure that determines whether the underlying distribution is Q0 or Q1 based on m independent observations must have high error if the two distributions are too close. In particular, if their KL divergence satisfies KL(Q0Q1) ≤ 1/m, then the procedure has at least constant error probability under measure Q0 or Q1. Now let's construct such a procedure A using any distribution learner L for the class P . Suppose the learner is ε- accurate with high probability when given sample of size m, and the distribution Q0 is in the class P . Consider the following procedure A: If the algorithm fails to output a • Run the learning algorithm L on sample S of size m. hypothesis distribution, output 1. Otherwise, let Q be the output distribution by L. • If KL(Q0 Q) ≤ ε, output 0; otherwise output 1. Note that if the sample S is drawn from the distribution Q0, then A will correctly output 0 with high probability based on the accuracy guarantee of L. This means the procedure has to err when S is drawn from the slightly perturbed distribution Q1, and so the learner will with constant probability output an accurate distribution Q such that KL(Q0 Q) ≤ ε. More formally: Lemma 6. Let ε > 0, δ ∈ (0, 1/2) and m ∈ N. Suppose there exists a distribution learner L such that for any unknown target distribution P ∈ P , when L inputs m random draws from P, it with probability at least 1 − δ outputs a distribution P such that KL(P P) ≤ ε. Then for any Q0 ∈ P and any distribution Q1 over the same range Y , if the learner L inputs a sample of size m drawn independently from Q1, it will with probability at least 1 − δ′ output a distribution Q such that KL(Q0 Q) ≤ ε, where δ′ = δ +pmKL(Q0Q1)/2. 6In the usual statement of Le Cam's method, the right-hand side of the inequality is in fact 1−kQm k·ktv denotes total variation distance. We obtain the current bound by a simple application of Pinsker inequality. 0 − Qm 1 ktv , where 9 Proof. Consider the procedure A constructed above that uses the learner L as a subroutine. By the guarantee of the algorithm, we know that PrL,Y m∼Qm [KL(Q0 Q) ≤ ε] ≥ 1− δ. This means 0 By Lemma 5, we have Pr A,Y m∼Qm 0 [A(Y m) , Q0] ≤ δ. Pr [A(Y m) , Q1] ≥ 1−r m This in turn implies that with probability at least (1−δ−p m and the internal randomness of L, the output distribution Q satisfies KL(P Q) ≤ ε. KL(Q0Q1)− δ. A,Y m∼Qm 2 KL(Q0Q1)) over the draws of Y m ∼ Qm 1 1 2 Therefore, if the KL divergence between the target distribution and the input distribution is smaller than inverse of the (polynomial) sample size, the output distribution by the learner is accurate with constant probability. By using a standard amplification technique, we can guarantee the accuracy with high probability: Lemma 7. Suppose that the distribution class P is PAC learnable. There exist an algorithm L2 and a polynomial mP (·,·,·) such that that for any target unknown distribution P, when given any ε > 0 and 0 < δ ≤ 1/4 as inputs and sample access from a distribution Q such that KL(PQ) ≤ 1/(2mP (1/ε, 1/δ, k)), runs in time poly(1/ε, 1/δ, k) and outputs a list of distributions P ′ that with probability at least 1 − δ contains some P ∈ P ′ with KL(P P) ≤ ε. As a consequence, even when input sample distribution is slightly "polluted", we can still learn the target distribution accurately with a small blow-up in the computational and sample complexity. 4.3 Learning the Distributions with an Accurate Hypothesis Now we will return to the second step of our reduction: use an accurate hypothesis h and dis- tribution learner for P to learn the two distributions P0 and P1. For any observation (x, y) drawn from the example oracle Gen, we can use the hypothesis h to determine whether the outcome y is drawn from P0 or P1, which allows us to create independent samples from both distributions. However, because of the small error of h with respect to the target concept c, the input sample is in fact drawn from a mixture between P0 and P1. To remedy this problem, we will choose a sufficiently small error rate for hypothesis h (but still an inverse polynomial in the learning parameters), which guarantees that the mixture is close enough to either one of single target dis- tributions. We can then apply the result in Lemma 7 to learn each distribution, which together gives us a hypothesis model (h, P0, P1). Lemma 8. Suppose that the distribution class P is efficiently learnable. Let ε > 0, 0 < δ ≤ 1 and h ∈ C be an hypothesis. Then there exists an algorithm L3 and a polynomial r(·,·,·) such that when given ε, δ and h as inputs, L3 runs in time bounded by poly(1/ε, 1/δ, k), and outputs a list of probability models T such that with probability at least 1 − δ there exists some T ∈ T such that err( T ) ≤ ε, as long as the hypothesis h satisfies err(h) ≤ 1/r(1/ε, 1/δ, k). 10 4.4 Directly Applying the Distribution Learner In the last step of our forward reduction, we will consider the case where the two target distribu- tions P0 and P1 are too close to admit a distinguishing event, and so we will not be able to learn the target concept c as in the first step. We show that in this case learning c is not necessary for obtaining an accurate probability model - we can simply run the robust distribution learner developed in Lemma 7 over the samples drawn from the mixture to learn single distribution. We will first define the following notion of healthy mixture, which captures the mixture distri- butions with non-trivial weights on two sufficiently different components. This will also facilitate our discussion in the reverse reduction. Definition 3 (Healthy Mixture). Let Q be mixture of two distributions Q0 and Q1 from the class P , and let w0 and w1 be the weights on the two components respectively. Then Q is an η-healthy mixture if both min{w0, w1} ≥ η and max{KL(P0P1), KL(P1P0)} ≥ η hold. If one of the two conditions does not hold, we will call Q an η-unhealthy mixture. We now show that whenever the mixture distribution P is unhealthy, we can use the robust learner in Lemma 7 to directly learn a distribution P for our prediction purpose (simply always predict with P regardless of the context x). Note that this not only includes the case where P0 and P1 are arbitrarily close, but also the one where the weight on one component is close to 0, which will be useful in Section 5. Lemma 9. Suppose that the distribution class P is PAC learnable. Let P be the unconditional mixture distribution over the outcomes Y under the distribution Gen. Let ε > 0 and δ ∈ (0, 1). Then there exists an algorithm L4 and a polynomial g(·,·,·) such that when L4 is given sample access to Gen and ε, δ as inputs, it runs in time bounded by poly(1/ε, 1/δ, k) and it will with probability at least 1 − δ, output a list of distributions P ′ that contains P with Ex∼DhKL(Pc(x) P)i ≤ ε, as long as P is an η-unhealthy mixture for some η ≤ 1/g(k, 1/ε, 1/δ). We will now combine the all the tools to provide a proof sketch for Theorem 3 (see the ap- pendix for details). Proof Sketch for Theorem 3. Our algorithm for PwD learning the joint class (C,P ) is roughly the following. First, we will make use of Assumption 2 and obtain a set of candidate distinguishing events for the target distributions P0 and P1. We will run the CCCN learner to learn c using each candidate event E to generate noisy labels. This generates a list of hypotheses. We will use the hypotheses h to separate the two distributions P0 and P1 and apply the algorithm in Lemma 8 to learn each distribution individually. This will give polynomially many hypothesis models T = (h, P0, P1). By Lemma 4 and Lemma 8, we know at least one of the models is accurate when P0 and P1 are sufficiently different. To cover the case where the two distributions are too close, we will use the algorithm in In particular, the model (h′, P, P) is accurate Lemma 9 to learn a list of distributions over Y . for at least one of the output distribution P. Together, the two procedures above will give a list of polynomially many hypothesis models, at least one of which is guaranteed to be accurate. We will use the standard maximum likehood method to output the model that minimizes empirical log-loss, and with high probability, this will be an accurate model.7 7See the appendix for the details and analysis of the maximum likelihood method in the PwD model. 11 We previously gave examples (such as product distributions and special cases of multivariate Gaussians) that admit small classes of distinguishing events, and to which Theorem 3 can be applied. There are other important cases - such as general multivariate Gaussians - for which we do not know such classes.8 However, we now describe a different, "reverse" reduction that instead assumes learnability of mixtures, and thus is applicable to more general Gaussians via known mixture learning algorithms (Dasgupta, 1999; Arora and Kannan, 2001; Feldman et al., 2006). 5 Reverse Reduction In our reverse reduction, our strategy is to first learn the two distributions P0 and P1 sufficiently well, and then construct a specialized distinguishing event to learn the target concept c with a CCCN learner.9 We will make a stronger learnability assumption on the distribution class P - we assume a parametrically correct learner for any healthy mixture of two distributions in P . Assumption 3 (Parametrically Correct Mixture Learning). There exists a mixture learner LM and a polynomial ρ such that for any ε > 0, 0 < δ ≤ 1, and for any Z that is an η-healthy mixture of two distributions Y0 and Y1 from P , the following holds: if LM is given sample access to Z and ε, δ > 0 as inputs, LM runs in time poly(k, 1/ε, 1/δ) and with probability at least 1 − δ, outputs a mixture Z of distributions Y0 and Y1 such that max{KL(Y0 Y0), KL(Y1 Y1)} ≤ ε. We remark that the assumption of parametric correctness is a mild condition, and is satisfied by almost all mixture learning algorithms in the literature (see e.g. Dasgupta (1999); Feldman et al. (2006, 2008); Hsu and Kakade (2013)). Also note that we only require this condition when the healthy mixture condition in Definition 3 is met. If the two either the two distributions Y0 and Y1 are arbitrarily close or the mixture is extremely unbalanced, we are not supposed to learn both components correctly. Theorem 4 (Formal Version of Theorem 2). Suppose the class C is CN learnable, the distribution class P is efficiently learnable and satisfies the parametrically correct mixture learning assumption (Assump- tion 3). Then the joint class (C,P ) is PwD-learnable. With the tools we develop for the forward reduction, the proof for reverse reduction is straight- forward. There are essentially two cases we need to deal with. In the first case where the mixture distribution over Y is healthy, we can use the parametrically correct mixture learner to learn the two target distributions, we can then use the accurate approximations P0 and P1 to find a distin- guishing event for P0 and P1, which allows us to learn the concept c with a CCCN learner. In the case where the mixture distribution is unhealthy and we cannot learn the components accurately, we can again appeal to the robustness result we show using Le Cam's method - we can directly apply the learner for single distributions and learn P0 or P1. 8We conjecture that Gaussians do indeed have a small set of distinguishing events, but have not been able to prove it. 9We use the term "reverse" to indicate that the reduction decomposes the learning process into the steps suggested by the inverted generative model depicted in Figure 2. 12 l ∼ (w0, w1) Draw x x ∼ Dl Draw y y ∼ Pl Figure 2: An alternative view of the generative model Gen: first draw a Bernoulli label l with bias w1 = PrD[c(x) = 1], then draw a context x from the conditional distribution Dl on c(x) = l, and an outcome y from the distribution Pl. In the forward reduction, we first learn the concept c over X (which determines the label l), so we can separate the data and learn each distribution using a (single) distribution learner. In the reverse reduction, we will first use the mixture learner to learn both P0 and P1, and then use such information to obtain estimates for the label l for learning the concept c. 5.1 CN Learning with a Mixture Learner Given any two distributions P, Q over Y and a parameter τ, consider the event (or subset) E(P, Q, τ) = {y ∈ Y P(y) ≥ 2τ Q(y)} We will first show that such subset is a distinguishing event for the input distributions P and Q as long as the distributions P and Q are sufficiently different. Lemma 10. Fix any γ ∈ (0, 1]. Suppose that KL(PQ) ≥ γ , then E(P, Q, γ /2) is a (γ 2/(8M))-distinguishing event for the distributions P and Q. Next, we show that even if we only have access to the approximate distributions P and Q, we can still identify a distinguishing event for P and Q, as long as the approximations are accurate. Lemma 11. Suppose that the distributions P, P, Q, Q over Y satisfy that KL(P P) ≤ α, KL(Q Q) ≤ α, and KL(PQ) ≥ γ for some α, γ ∈ (0, 1]. Then the event E( P, Q, (γ 2/(8M)−√2α)2) is a ξ-distinguishing event with ξ ≥ 1/ poly(1/γ , 1/α, k) as long as γ > 8M(√2α + (8M 2α)1/8). Given these structural lemmas, we now know a way to construct a distinguishing event based on approximations to the target distributions P0 and P1. We can then create a and use the algo- rithm in Lemma 3 to learn the concept c, and in turn compute a list of hypothesis models, one of which is guaranteed to be accurate when the mixture distribution is healthy. Lemma 12. Suppose the class P satisfies the parametric mixture learning assumption (Assumption 3), the class C is CN learnable, and mixture distribution over Y is γ -healthy for some γ > 0. Then there exists an algorithm L that given ε, δ and γ as inputs and sample access from Gen, halts in time bounded by poly(1/ε, 1/δ, 1/γ , n, k), and with probability at least 1−δ, outputs a list of probability models T that contains some T with err( T ) ≤ ε. 13 Finally, to wrap up and prove Theorem 4, we also need to handle the case where healthy mixture condition in Definition 3 does not hold. We will again appeal to the robust distribution learner in Lemma 9 to learn the distributions directly, and construct hypothesis models based on the output distributions. To guarantee that the output hypothesis model is accurate, we will again use the maximum likelihood method to select the model with the minimum empirical log-loss (formal proof deferred to the appendix). 6 Future Work Despite the generality of our results and reductions, there remain some appealing directions for further research. These include allowing the conditioning event to be richer than a simple binary function c(x), for instance multi- or even real-valued. This might first entail the development of theories for noisy learning in such models, which is well-understood primarily in the binary setting. We also note that our study has suggested an interesting problem in pure probability theory, namely whether general Gaussians permit a small class of distinguishing events. Acknowledgments We thank We thank Akshay Krishnamurthy and Shahin Jabbari for helpful discussions. References Angluin, D. and Laird, P. D. 1987. Learning from noisy examples. Machine Learning 2, 4, 343– 370. Arora, S. and Kannan, R. 2001. Learning mixtures of arbitrary gaussians. In Proceedings of the Thirty-third Annual ACM Symposium on Theory of Computing. STOC '01. ACM, New York, NY, USA, 247–257. Blum, A. and Mitchell, T. M. 1998. Combining labeled and unlabeled data with co-training. In Proceedings of the Eleventh Annual Conference on Computational Learning Theory, COLT 1998, Madison, Wisconsin, USA, July 24-26, 1998. 92–100. Dasgupta, S. 1999. Learning mixtures of gaussians. In 40th Annual Symposium on Foundations of Computer Science, FOCS '99, 17-18 October, 1999, New York, NY, USA. 634–644. Decatur, S. E. 1997. PAC learning with constant-partition classification noise and applications to decision tree induction. In Proceedings of the Fourteenth International Conference on Machine Learning. ICML '97. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 83–91. Feldman, J., O'Donnell, R., and Servedio, R. A. 2008. Learning mixtures of product distributions over discrete domains. SIAM J. Comput. 37, 5, 1536–1564. Feldman, J., Servedio, R. A., and O'Donnell, R. 2006. PAC learning axis-aligned mixtures of Gaussians with no separation assumption. In Learning Theory, 19th Annual Conference on Learn- ing Theory, COLT 2006, Pittsburgh, PA, USA, June 22-25, 2006, Proceedings. 20–34. 14 Haussler, D. 1992. Decision theoretic generalizations of the PAC model for neural net and other learning applications. Inf. Comput. 100, 1, 78–150. Hsu, D. J. and Kakade, S. M. 2013. Learning mixtures of spherical gaussians: moment methods and spectral decompositions. In Innovations in Theoretical Computer Science, ITCS '13, Berkeley, CA, USA, January 9-12, 2013. 11–20. Kearns, M., Li, M., and Valiant, L. 1994. Learning boolean formulas. J. ACM 41, 6 (Nov.), 1298– 1328. Kearns, M. and Valiant, L. 1994. Cryptographic limitations on learning boolean formulae and finite automata. J. ACM 41, 1 (Jan.), 67–95. Kearns, M. J. 1998. Efficient noise-tolerant learning from statistical queries. J. ACM 45, 6, 983– 1006. Kearns, M. J., Mansour, Y., Ron, D., Rubinfeld, R., Schapire, R. E., and Sellie, L. 1994. On the learnability of discrete distributions. In Proceedings of the Twenty-Sixth Annual ACM Symposium on Theory of Computing, 23-25 May 1994, Montr´eal, Qu´ebec, Canada. 273–282. Le Cam, L. M. 1986. Asymptotic methods in statistical decision theory. Springer series in statistics. Springer-Verlag, New York. Pitt, L. and Warmuth, M. K. 1990. Prediction-preserving reducibility. J. Comput. Syst. Sci. 41, 3 (Dec.), 430–467. Ralaivola, L., Denis, F., and Magnan, C. N. 2006. CN = CPCN. In Machine Learning, Proceedings of the Twenty-Third International Conference (ICML 2006), Pittsburgh, Pennsylvania, USA, June 25-29, 2006. 721–728. Schapire, R. E. 1990. The strength of weak learnability. Mach. Learn. 5, 2 (July), 197–227. Valiant, L. G. 1984. A theory of the learnable. In Proceedings of the 16th Annual ACM Symposium on Theory of Computing, April 30 - May 2, 1984, Washington, DC, USA. 436–445. Vempala, S. and Wang, G. 2004. A spectral algorithm for learning mixture models. J. Comput. Syst. Sci. 68, 4, 841–860. Yu, B. 1997. Assouad, fano, and le cam. In Festschrift for Lucien Le Cam. Springer New York, 423–435. 15 A Missing Details and Proofs A.1 Missing Details in Section 2 Definition 4 (CN Learnability (Angluin and Laird, 1987)). Let C be a concept class over X . We say that C is efficiently learnable with noise (CN learnable) if there exists a learning algorithm L such that for any c ∈ C, any distribution D over X , any noise rate 0 ≤ η < 1/2, and for any 0 < ε ≤ 1 and 0 < δ ≤ 1, the following holds: if L is given inputs ηb (where 1/2 > ηb ≥ η), ε, δ, n, and is given access to η CN(c,D), then L will halt in time bounded by poly(1/(1 − 2ηb), 1/ε, 1/δ, n) and output a hypothesis EX h ∈ C that with probability at least 1− δ satisfies err(h) ≤ ε. Lemma 13 (CN = CCCN (Ralaivola et al., 2006)). Suppose that the concept class C is CN learn- able. Then there exists an algorithm LC and a polynomial mC(·,·,·,·) such that for every target concept c ∈ C, any ε, δ ∈ (0, 1], for any noise rates η0, η1 ≤ ηb < 1/2, if L is given inputs ε, δ, ηb and access to η CCCN(c,D), then L will halt in time bounded by mC(1/(1 − 2ηb), 1/ε, 1/δ, n), and output with prob- EX ability at least 1 − δ a hypothesis h with error err(h) ≤ ε. We will say that LC is an (efficient) CCCN learner for C with sample complexity mC. Definition 5 (Evaluator (Kearns et al., 1994)). Let P be a class of distributions over the outcome space Y . We say that P has a efficient evaluator if there exists a polynomial p such that for any n ≥ 1, and for any distribution P ∈ P , there exists an algorithm EP with runtime bounded by poly(k) that given an input y ∈ Y outputs the probability (density) assigned to y by P. Thus, if y ∈ Y , then EP (y) is the weight of y under P. We call EP an evaluator for P. A.2 Missing Proofs in Section 3 Claim 1. The values of a0 and b0 satisfy a0, b0 ∈ [0, 1]. Proof. Without loss of generality, let's assume that q ≥ p + ξ. Since p + q ∈ [0, 2], we know that a0 ≤ 1/2 and we can write a0 = 1/2 + ξ(p + q − 2) 4(q − p) ≥ 1/2− Similarly, we know that b0 ≥ 1/2 and we can write ξ(p + q) ξ 2(q − p) ≥ 1/2− 1/2 ≥ 0 b0 = 1/2 + 4(q − p) ≤ 1/2 + ξ/2 ξ = 1 This proves our claim. Lemma 1. Given a fixed ξ-distinguishing event E, the class-conditional noise rates of Lab are η1 = Pr[ℓ = 0 c(x) = 1] = qa0 + (1− q)b0 and η0 = Pr[ℓ = 1 c(x) = 0] = pa1 + (1− p)b1. Moreover, given any input estimates ( p, q) for (p, q), the parameters a0, a1, b0 and b1 satisfy: qa0 + (1− q)b0 = pa1 + (1− p)b1 ≤ 1/2− ξ/4. 16 Proof. We can derive the probabilities as follows Pr[ℓ = 0 c(x) = 1] = Pr[(ℓ = 0)∧ (y ∈ E) c(x) = 1] + Pr[(ℓ = 0)∧ (y < E) c(x) = 1] = Pr Gen + Pr Gen = Pr Gen Lab [y ∈ E c(x) = 1] Pr [y < E c(x) = 1] Pr [y ∈ E c(x) = 1]a0 + Pr Lab [ℓ = 0 (y ∈ E)∧ (c(x) = 1)] [ℓ = 0 (y < E)∧ (c(x) = 1)] [y < E c(x) = 1]b0 Gen = q a0 + (1− q)b0 Similarly, we can also show that Pr[ℓ = 1 c(x) = 0] = pa1 + (1 − p)b1. For the second part of the statement, we can show qa0 + (1− q)b0 = pa1 + (1− p)b1 = + q 2 p 2 − which recovers our claim. ξ( p + q − 2) q 4( q − p) ξ( p + q − 2) p 4( q − p) + + (1− q) 2 (1− p) 2 + − ξ( p + q)(1− q) 4( q − p) ξ( p + q)(1− p) 4( q − p) = 1/2− ξ/4 = 1/2− ξ/4 Lemma 2. Fix any ∆ ∈ [0, 1]. Suppose that the estimates p and q satisfy p− p ≤ ∆ and q− q ≤ ∆, then the class-conditional noise rates η0 and η1 for Lab( p, q, ξ) are upper bounded by 1/2− ξ/4 + ∆. Proof. Since a0, a1, b0, b1 ∈ [0, 1], and by our assumption on the accuracy of p and q, we have η1 − ( qa0 + (1− q)b0) = (qa0 + (1− q)b0)− ( qa0 + (1− q)b0) = (q − q)(a0 − b0) ≤ ∆ η0 − ( qa1 + (1− q)b1) = (qa1 + (1− q)b1)− ( qa1 + (1− q)b1) = (q − q)(a1 − b1) ≤ ∆ The result of Lemma 1 tells us that qa0 + (1− q)b0 = pa1 + (1− p)b1 ≤ 1/2− ξ/4 Therefore, we must also have η0, η1 ≤ 1/2− ξ/4 + ∆. Lemma 3. Let ε, δ ∈ (0, 1). Suppose that the concept class C is CN learnable, and there exists an identi- fied ξ-distinguishing event E for the two target distributions P0 and P1. Then there exists an algorithm L1 such that when given ε, δ, ξ and E as inputs, it will halt in time bounded by poly(1/ε, 1/δ, 1/ξ, n), and with probability at least 1− δ, output a list of hypotheses that contains some h such that err(h) ≤ ε. Proof. Since the concept class C is CN learnable, by the result of Ralaivola et al. (2006) we know η there exists an efficient algorithm A that when given access to some example oracle EX CCCN with η0, η1 ≤ 1/2− ξ/8, outputs a hypothesis h with error bounded ε with probability at least 1− δ, halts in time poly(1/ε, 1/δ, 1/ξ, n). Now let parameter ∆ = ξ/8, and consider the algorithm: for each pair of values ( p, q) = (i∆, j ∆) such that i, j ∈ [⌈1/ ∆⌉] and i , j, use the Lab( p, q, ξ) to generate labeled examples, and run the algorithm A with sample access to Lab; if the algorithm halts in time p and outputs an hypothesis h, store the hypothesis in a the list H. In the end, output the hypothesis list. By Lemma 2, we know for some guessed values of p′ and q′, the algorithm Lab(p′, q′, ξ) is an CCCN oracle with noise rates η0, η1 ≤ 1/2− ξ/8. Then by the guarantee of the learning algorithm, we know with probability at least 1− δ, the algorithm will output an ε-accurate hypothesis under these guesses. 17 A.3 Missing Proofs in Section 4 Lemma 4. Let ε, δ ∈ (0, 1) and γ > 0. Suppose that the class C is CN learnable, the class P ad- mits a parametric class of events E (as in Assumption 2). If the two distributions P0 and P1 satisfy max{KL(P0P1), KL(P1P0)} ≥ γ , then there exists an algorithm L2 that given sample access to Gen and ε, δ, γ as inputs, runs in time poly(1/ε, 1/δ, 1/γ , n), and with probability at least 1 − δ outputs a list of hypotheses H that contains a hypothesis h with error err(h) ≤ ε. Proof. Consider the following algorithm. We will first use the oracle E with input parameter γ to obtain a class of events E(γ ) that contains a ξ-distinguishing event E∗ with ξ ≥ poly(γ , 1/n). Then for each event E ∈ E(γ ), we will run the algorithm A in Lemma 3 with accuracy parameters ε, δ, separation parameter ξ, and E as an hypothetical distinguishing event as input. For each event, the instantiation of algorithm A will halt in polynomial time. Furthermore, when the input event is E∗ it will with probability at least 1− δ outputs a list of hypotheses H that contains a hypothesis h such that err(h) ≤ ε by the guarantee of Lemma 3. Lemma 7. Suppose that the distribution class P is PAC learnable. There exist an algorithm L2 and a polynomial mP (·,·,·) such that that for any target unknown distribution P, when given any ε > 0 and 0 < δ ≤ 1/4 as inputs and sample access from a distribution Q such that KL(PQ) ≤ 1/(2mP (1/ε, 1/δ, k)), runs in time poly(1/ε, 1/δ, k) and outputs a list of distributions P ′ that with probability at least 1 − δ contains some P ∈ P ′ with KL(P P) ≤ ε. Proof. Let L be a distribution learner that given a independent sample of size m drawn from the unknown target distribution P, runs in time bounded by poly(1/ε, 1/δ, n) with probability at least 1−δ, outputs a distribution P′ such that KL(PP′) ≤ ε. By Lemma 6, we know that with probability at least (1/2 − δ) ≥ 1/4, the algorithm can also output a distribution P′′ such that KL(PP′′) ≤ ε if the algorithm is given a sample of size m drawn from the distribution Q. Let r = log3/4(1/δ). Now we will run the algorithm r times on r independent samples, each of size m. Let P ′ be the list of output hypothesis distributions in these runs. We know that with probability at least 1−(1−1/4)r = 1−δ, there exists a distribution P ∈ P ′ such that KL(P P) ≤ ε. The following is a technical lemma that allows us to bound the KL divergence between be- tween a mixture distribution and one of its component. Lemma 14. Let P and Q be two distributions over Y and R be a mixture of P and Q with weights wp and wq respectively. Then we have KL(PR) ≤ wqKL(PQ). Proof. Let wp and wq be the weights associated with P and Q respectively in the mixture R. KL(PR) =Zy =Zy R(y)! dy P(y) log P(y) (wpP(y) + wqP(y)) log wpP(y) + wqP(y) wpP(y) + wqQ(y)! dy (by the log-sum inequality) ≤Zy wpP(y) log wpP(y) wpP(y)!! dy +Zy wqP(y) log wqP(y) wqQ(y)!! dy which proves our claim. = wqKL(PQ) 18 Lemma 8. Suppose that the distribution class P is efficiently learnable. Let ε > 0, 0 < δ ≤ 1 and h ∈ C be an hypothesis. Then there exists an algorithm L3 and a polynomial r(·,·,·) such that when given ε, δ and h as inputs, L3 runs in time bounded by poly(1/ε, 1/δ, k), and outputs a list of probability models T such that with probability at least 1 − δ there exists some T ∈ T such that err( T ) ≤ ε, as long as the hypothesis h satisfies err(h) ≤ 1/r(1/ε, 1/δ, k). Proof. Our algorithm will first call the oracle Gen for N = C m2(2/ε, 4/δ, k)(cid:16) M 2 where C is some constant (to be determined in the following analysis) and m2 is the polynomial upper bound for the runtime of the algorithm defined in Lemma 7. Then the algorithm will separate these data points (x, y)'s into two samples, one for h(x) = 0 and the other for h(x) = 1. For each sample corresponding to h(x) = j, if the sample size is at least m = m2(2/ε, 4/δ), the run the learning algorithm L2 in Lemma 7 to the sample with target accuracy ε/2 and failure probability δ/4 and obtain a polynomial list of distributions Pj ; otherwise, simply output a singleton list containing any arbitrary distribution in P . Let j ∈ {0, 1} and πj = Prx∼D[h(x) = j]. Let us first consider the case where πj ≥ ε/(2M). In order to invoke Lemma 14, we will upper bound the quantity wj KL(Pj Pj ), where wj = Prx∼D[c(x) = j]. We know that for some large enough constant C, we can guarantee with probability at least 1−δ/4, we will collect at least m observations with h(x) = j. Let εh = err(h), note that when we instantiate the learner L2 on the sample with h(x) = j, the input distribution Ij is a (εh, 1 − εh)-mixture of the distributions P1−j and Pj. Then there exists a polynomial r such that if err(h) ≤ 1/r(1/ε, 1/δ, k), we can have the following based on Lemma 14 ε2 log(1/δ)(cid:17) times, KL(PjIj ) ≤ εhKL(PQ) ≤ 1/mP (2/ε, 4/δ, k) where mP is the polynomial defined in Lemma 7. This means, the learning algorithm L2 will with probability at least 1−δ/4, returns some distribution Pj in the output list such that KL(Pj Pj ) ≤ ε/2, which implies that wj KL(Pj Pj) ≤ ε/2. Suppose that πj < ε/(2M), then we know that no matter what the distribution Pj is, we have wj KL(Pj Pj ) ≤ ε such that with probability at least 1− δ, there exists some model T = (h, P0, P1) ∈ T such that Finally, our algorithm will output a list of probability models T = {(h, P0, P1) P0 ∈ P0, P1 ∈ P1}, 2M M = ε/2 by Assumption 1. which recovers our claim. err(T ) = w0KL(P0 P0) + w1KL(P1 P1) ≤ ε, Lemma 9. Suppose that the distribution class P is PAC learnable. Let P be the unconditional mixture distribution over the outcomes Y under the distribution Gen. Let ε > 0 and δ ∈ (0, 1). Then there exists an algorithm L4 and a polynomial g(·,·,·) such that when L4 is given sample access to Gen and ε, δ as inputs, it runs in time bounded by poly(1/ε, 1/δ, k) and it will with probability at least 1 − δ, output a list of distributions P ′ that contains P with Ex∼DhKL(Pc(x) P)i ≤ ε, as long as P is an η-unhealthy mixture for some η ≤ 1/g(k, 1/ε, 1/δ). Proof. We first consider the case where the weight on one component is small, and without loss of generality assume that w1 ≤ ε/(4M m). By Lemma 14 and Assumption 1, we know that KL(P0R) ≤ w1KL(P0P1) ≤ 19 ε 2M m M ≤ 1/(2m). By instantiating the algorithm in Lemma 7 with parameters (ε/2, δ), we know with probability 1− δ, there exists a hypothesis distribution P in the output list such that KL(P0 P) ≤ ε/2. Again by our Assumption 1, we know KL(P1 P) ≤ M, so it follows that x∼DhKL(Pc(x) P)i = w0KL(P0 P) + w1KL(P1 P) ≤ 2M m ≤ ε. ε 2 E ε KL(P1 P) + Next suppose that we are in the second case where KL(P0P1), KL(P1P0) ≤ 1/(2m). We know from Lemma 14 that KL(P0R) ≤ w1KL(P0P1) ≤ 1/(2m) and, KL(P1R) ≤ w0KL(P1P0) ≤ 1/(2m) We will also apply the algorithm in Lemma 7 which guarantees with probability at least 1 − δ that there exists a hypothesis distribution P in the output list P ′ such that KL(P0 P), KL(P1 P) ≤ ε/2, which implies that E x∼DhKL(Pc(x) P)i = w0KL(P0 P) + w1KL(P1 P) ≤ ε. Therefore, there exists a distribution P in the output list that satisfies our claim as long as we choose the polynomial g such that g(1/ε, 1/δ, k) ≥ max{2Mm/ε, 2m} for all ε, δ and m. Proof of Theorem 3 We will now combine the all the tools to prove Theorem 3. First, con- sider the class of events E(γ ) with γ = 1/g(1/ε, 1/δ, k) (specified in Lemma 9). Then we will apply the CN algorithm L2 in Lemma 4 to obtain a list H of polynomially many hypotheses. For each h ∈ H, run the algorithm L3 with h as a candidate hypothesis. This will generate a list of a list of probability models T . If max{KL(P0P1), KL(P1P0)} ≥ γ , then T is guaranteed to contain an ε-accurate model with high probability (based on Lemma 4 and Lemma 8). Next, apply the dis- tribution learner in Lemma 9 over the mixture distribution over Y . If the algorithm outputs a distribution P, create a model T ′ = (h0, P, P), where hypothesis h0 labels every example as nega- tive. If max{KL(P0P1), KL(P1P0)} < γ , we know T ′ is ε-accurate with high probability (based on Lemma 9). Finally, apply the maximum likelihood method to the list of models T ∪ {T ′}: draw a sample of polynomial size from Gen, then for each model T ∈ T ∪{T ′}, compute the empirical log- loss over the sample, and output the model with the minimum log loss. By standard argument, we can show that the output model is accurate with high probability. A.4 Missing Proofs in Section 5 Lemma 10. Fix any γ ∈ (0, 1]. Suppose that KL(PQ) ≥ γ , then E(P, Q, γ /2) is a (γ 2/(8M))-distinguishing event for the distributions P and Q. Proof. Note that for any y ∈ E such that P(E) > 0, we have log P(y) any y < E, we also have log(cid:16) P(y) Q(y)(cid:17) < γ /2. Q(y) ≤ M by Assumption 1, and for 20 dy P(y) log P(y) Q(y) KL(PQ) =Zy∈Y =Zy∈E P(y) Q(y) γ < P(E)M + (1− P(E)) 2 + (M − γ /2)P(E) < = P(y) log γ 2 dy +Zy<E P(y) log P(y) Q(y) dy γ 2 + M P(E) Since we know that KL(PQ) ≥ γ , it follows that P(E) > γ 2M . Furthermore, P(E)! P(E)− Q(E) = P(E) 1− P(y) ≥ P(E) 1− sup y∈E ≥ P(E)(cid:16)1− 2−γ /2(cid:17) ≥ γ P(E) Q(E) Q(y) 4 where the last step follows from the fact that 1− 2−a ≥ a/2 for any a ∈ [0, 1]. It follows that P(E)− Q(E) > γ P(E) 4 > γ 2M γ 4 = γ 2 8M , which proves our statement. Lemma 11. Suppose that the distributions P, P, Q, Q over Y satisfy that KL(P P) ≤ α, KL(Q Q) ≤ α, and KL(PQ) ≥ γ for some α, γ ∈ (0, 1]. Then the event E( P, Q, (γ 2/(8M)−√2α)2) is a ξ-distinguishing event with ξ ≥ 1/ poly(1/γ , 1/α, k) as long as γ > 8M(√2α + (8M 2α)1/8). Proof. Since we have both KL(P P), KL(Q Q) ≤ α, by Pinsker's inequality, we can bound the total variation distances kP − Pktv ≤ √α/2 and, kQ − Qktv ≤ √α/2. By Lemma 10 and the definition of total variation distance, we know that kP − Qktv = sup E⊂Y P(E)− Q(E) ≥ γ 2/(8M) By triangle inequality, the above implies k P − Qktv ≥ γ 2 8M − √2α ≡ b By Pinsker's inequality, we know that k P − Qktv ≤ qKL( P Q)/2. It follows that KL( P Q) ≥ 2b2. Consider the event E = E( P, Q, b2). We know by Lemma 10 that E is a (b4/(2M))-distinguishing event for distributions P and Q. Since both KL(P P), KL(Q Q) ≤ α, we have P(E)− P(E) ≤ kP(E′)− P(E′)ktv ≤ √α/2 Q(E)− Q(E) ≤ kQ(E′)− P(E′)ktv ≤ √α/2. and, 21 Since E is a (b4/(2M))-distinguishing event for the distributions P and Q, this means P(E)− Q(E) ≥ (b4/(2M)), and by triangle inequality, we have P(E)− Q(E) = (P(E)− P(E)) + ( P(E)− Q(E)) + ( Q(E)− Q(E)) ≥ P(E)− Q(E)−P(E)− P(E)− Q(E)− Q(E) ≥ (b4/(2M))− √2α Note that if we have γ > 8M(√2α + (8M 2α)1/8), then we can guarantee both b > 0 and (b4/(2M))− √2α > 0. Lemma 12. Suppose the class P satisfies the parametric mixture learning assumption (Assumption 3), the class C is CN learnable, and mixture distribution over Y is γ -healthy for some γ > 0. Then there exists an algorithm L that given ε, δ and γ as inputs and sample access from Gen, halts in time bounded by poly(1/ε, 1/δ, 1/γ , n, k), and with probability at least 1−δ, outputs a list of probability models T that contains some T with err( T ) ≤ ε. Proof. We will first invoke the algorithm LM in Assumption 3 so that with probability at least 1−δ/2, the output approximations for the two components satisfy KL(P0 P0) ≤ α and KL(P1 P1) ≤ α for some α that satisfies γ > 8M(√2α+(8M 2α)1/8). This process will halt in time poly(1/α, 1/δ, 1/γ , k). By Lemma 10, we know that the either event E( P0, P1, γ /2) is a ξ-distinguishing event for P0 and P1 for some ξ ≥ 1/ poly(1/γ , n, k). Then we can use the CN learning algorithm L1 in Lemma 3 with the distinguishing event E to learn a list of hypotheses H under polynomial time, and there exists some h ∈ H that is ε1 accurate, with ε1 = 1/r(1/ε, 1/δ, k) (specified in Lemma 8). For each hypothesis h′ ∈ H, run the algorithm L3 with h′ as the candidate hypothesis and ε as the target ac- curacy parameter. By Lemma 8, this will halt in polynomial time, and outputs a list of probability models T such that one of which has error err( T ) ≤ ε. Proof of Theorem 4 The algorithm consists of three steps. First, we will run the algorithm in Lemma 12 by setting γ = 1/g(1/ε, δ, k) (specified in Lemma 8) and other parameters in a way to guarantee that whenever max{KL(P0 P0), KL(P1 P1)} ≥ γ and min{w0, w1} ≥ γ both hold, the output list of models T contains some T that has error at most ε. Next, we will directly apply the distribution learner in Lemma 9 so that when the healthy mixture condition is not met, the algorithm outputs a distribution P such that Ex∼DhKL(Pc(x) P)i. Lastly, similar to the final step in the forward reduction, we run the maximum likelihood algorithm to output the model in T ∪ {(h0, P, P)} with the smallest empirical log-loss. B Maximum Likelihood Algorithm In this section, we will formally define the maximum likelihood algorithm, which is a useful subroutine to select an accurate probability model from a list of candidate models. First, to give some intuition, we show that the objective of minimizing Ex∼DhKL(Pc(x) Ph(x))i is equivalent to minimizing the expected log-losses. For any distribution P over Y and a point r ∈ Y , the log likelihood loss (or simply log-loss) is defined as loss(y, P) = − log P(y). The entropy of a distribution P over range Y , denoted H(P), is defined as H(P) =Zy∈Y P(y) log dy 1 P(y) 22 For any two distributions P and P over Y , we could write KL-divergence as KL(P P) =Zy∈Y P(y) log 1 P(y) dy − H(P) = E y∼Ph− log P(y)i − H(P) (2) which will be useful for proving the next lemma. Lemma 15. Given any hypothesis h : X → {0, 1}, and hypothesis distributions P0 and P1, we have E x∼DhKL(Pc(x) Ph(x))i = E x∼DhH(Pc(x))i − E (x,y)∼Genhlog( Ph(x)(y))i Proof. We can write the following E x∼Dh KL(Pc(x)Ph(x))i = Pr D + Pr D (apply Equation (2)) = E [c(x) = 1, h(x) = 1] KL(P1 P1) + Pr D [c(x) = 0, h(x) = 1] KL(P0 P1) + Pr D x∼DhH(Pc(x))i − X(i,j)∈{0,1}2 x∼DhH(Pc(x))i − (x,y)∼Genhlog( Ph(x)(y))i Pr D E = E [c(x) = 1, h(x) = 0] KL(P1 P0) [c(x) = 0, h(x) = 0] KL(P0 P0) [c(x) = i, h(x) = j] E y∼Pihlog( Pj(y))i which proves our claim. Therefore, we could write err(T ) = Ex∼DhH(Pc(x))i − E(x,y)∼Genhlog( Ph(x)(y))i for any model T = (h, P0, P1). Observe that Ex∼DhH(Pc(x))i is independent of the choices of (h, P0, P1), so our goal can also be formulated as minimizing the expected log-loss E(x,y)∼Genhlog( Ph(x)(y))i. To do that, we will use the following maximum likelihood algorithm: given a list of probability models T as input, draw a set of S of samples (x, y)'s from Gen, and for each T = (h, P0, P1) ∈ T , compute the log-loss on the sample loss(S, T ) = X(x,y)∈S loss(y, Ph(x)), Our goal is to show that if the list of models T contains an accurate model T , the maximum and lastly output the probability model T ∈ T with the smallest loss(S, T ). likelihood algorithm will then output an accurate model with high probability. Theorem 5. Let ε > 0. Let T be a set of probability models such that at least one model T ∗ ∈ T has error err(T ∗) ≤ ε. Suppose that the class P also satisfies bounded assumption (in Assumption 1). If we run the maximum likelihood algorithm on the list T using a set S of independent samples drawn from Gen. Then, with probability at least 1 − δ, the algorithm outputs some model T ∈ T such that err( T ) ≤ 4ε with δ ≤ (T + 1) exp −2mε2 M 2 ! . To prove this result, we rely on the Hoeffding concentration bound. 23 Theorem 6. Let x1, . . . , xn be independent bounded random variables such that each xi falls into the interval [a, b] almost surely. Let X =Pi xi. Then for any t > 0 we have Pr[X − E [X] ≥ t] ≤ exp −2t2 n(b − a)2! and Pr[X − E [X] ≤ −t] ≤ exp −2t2 n(b − a)2! Proof. Our proof essentially follows from the same analysis of Feldman et al. (2008) (Theorem 17). We say that a probability model T is good if err(T ) ≤ 4ε, and bad otherwise. We know that T is guaranteed to contain at least one good model. In the following, we will write H(Gen) to denote Ex∼DhH(Pc(x))i. The probability δ that the algorithm fails to output some good model is at most the proba- bility the best model T ∗ has loss(S, T ) ≥ m (H(Gen) + 2ε) or some bad model T ′ has loss(S, T ′) ≤ m (H(Gen) + 3ε). Applying union bound, we get δ ≤ T Pr[loss(S, T ′) ≤ m (H(Gen) + 3ε) err(T ) ≥ 4ε] + Pr[loss(S, T ∗) ≥ m (H(Gen) + 2ε)] For each bad model T ′ with err(T ′) > 4ε, we can write (because err(T ′) ≥ 0) Pr[loss(S, T ′) ≤ m(H(Gen) + 3ε)] = Pr[loss(S, T ′) ≤ m(H(Gen) + 4ε)− εm] S∼Genm(cid:2)loss(S, T ′)− ε(cid:3)] ≤ Pr[loss(S, T ′) ≤ m(H(Gen) + err(T ′))− εm] = Pr[loss(S, T ′) ≤ E ≤ exp −2mε2 M 2 ! where the last step follows from Theorem 6. Similarly, for the best model T ∗ with err(T ∗) ≤ ε, we have the following derivation: Pr[loss(S, T ∗) ≥ m (H(Gen) + 2ε)] = Pr[loss(S, T ∗) ≥ m (H(Gen) + ε) + mε] ≤ Pr[loss(S, T ∗) ≥ m (H(Gen) + err(T ∗) + mε)] [loss(S, T ∗)] + mε] = Pr[loss(S, T ∗) ≥ E ≤ exp −2mε2 S∼Genm M 2 ! Combining these two probabilities recovers the stated bound. In other words, as long as we have an ε-accurate model in the list, we can guarantee with probability at least 1− δ that the output model has error O(ε) using a sample of size no more than poly(k/ε)· log(1/δ). C Examples of Distinguishing Events In this section, we give two distribution classes that admit distinguishing event class of polyno- mial size. 24 C.1 Spherical Gaussian We consider the class of spherical Gaussian in Rk with fixed covariance and bounded means. In particular, let P = {N (µ, Σ) µ ∈ [0, 1]k} j ≤ σ 2 for some constant σ > 1. where Σ is some diagonal covariance matrix in Rk×k such that the variance in each coordinate satisfy 0 < σ 2 Theorem 7. There exists a parametric class of events E(·) for the distribution class P of k-dimensional Spherical Gaussian such that for any γ > 0 and for any two probability distributions P and Q in the class P such that KL(PQ) ≥ γ , the class of events E(γ ) contains an event E that is an ξ-distinguishing event, where max{1/ξ,E(γ )} ≤ poly(k, 1/γ ). Proof. Recall that the KL divergence of two multivariate Gaussian distributions P and Q with means µ, µ′ and covariance matrices Σp, Σq can be written as KL(PQ) = 1 2 tr(Σ−1 q Σ p) + (µ′ − µ)⊺Σ q(µ′ − µ)− k + log det Σq det Σ p!! . For any two distributions P and Q in our class P , we can simplify the KL divergence as KL(PQ) ≤ σ 2 2 kµ− µ′k2 2. Then KL(PQ) ≥ γ implies that there exists some coordinate j ∈ [k] such that µj − µ′j ≥p2γ /(kσ 2). Note that the marginal distributions of Pj and Qj over the j-the coordinate are N (µj , σ 2 j ) and N (µ′j , σ 2 j ) respectively. Without loss of generality, assume that µ′j < µj . Then for any value t ∈ [µ′j , µj ], we have Pj [y ≥ t]− Qj [y ≥ t] ≥ Pj [y ∈ [t, µj ]]. (3) Let ∆ =p2γ /(kσ 2), and consider the discretized set L(γ ) = {0, ∆, . . . ,⌊1/ ∆⌋∆}. Then we know there exists a value t′ ∈ L such that t′ ∈ L(γ ) such that t′ ∈ [µ′j , µj ] and µj − t′ ≥ ∆. By Equation (3), we can write erf(∆/(√2σj)) ≥ where erf denotes the Gauss error function with erf(x) = 2√πR x Pj [y ≥ t′]− Qj [y ≥ t′] ≥ expansion of the function is 1 2 erf(∆/(√2σ)) 1 2 0 e−a2 da for every x ∈ R. The Taylor erf(x) = 2 √π ∞ Xi=0 (−1)ix2i+1 n!(2i + 1) = 2 √π x − x3 3 + x5 10 − x7 42 . . .! Therefore, for any x ∈ [0, 1), there exists a constant C such that erf(x/(√2σ))/2 ≥ C x. It follows that Pj [y ≥ t′]− Qj [y ≥ t′] ≥ C∆. This means that the event of (yj ≥ t′) is a (C∆)-distinguishing event for the two distributions P and Q. Therefore, for any γ > 0, we can construct the following class of distinguishing events Note that both 1/(C∆) and E(γ ) is upper bounded by poly(1/γ , k), which recovers our claim. E(γ ) = {1[yj ≥ t′] j ∈ [k], t′ ∈ L(γ )}. 25 C.2 Product Distributions over Discrete Domains Consider the space of b-ary cube Y = {0, . . . , b − 1}k, and the class of full-support product distri- butions P over Y : distributions whose k coordinates are mutually independent distributions over {0, . . . , b − 1}. In particular, we assume that there exists some quantity M ≤ poly(k, b) such that for each P ∈ P and each coordinate j and yj ∈ {0, 1, . . . b− 1}, we have log(1/Pj(yj )) ≤ M. Now let's show that this class of distributions admits a small class of distinguishing events as well. Theorem 8. There exists a parametric class of events E(·) for the production distribution class over the b-ary cube such that for any γ > 0 and for any two probability distributions P and Q in the class P such that KL(PQ) ≥ γ , the class of events E(γ ) contains an event E that is an ξ-distinguishing event, where max{1/ξ,E(γ )} ≤ poly(k, b, 1/γ ). Proof. In the following, we will write P = P1 × . . .× Pk and Q = Q1 × . . .× Qk. Note that KL(PQ) = Xj′∈[k] KL(Pj′Qj′ ). Therefore KL(PQ) ≥ γ implies that there exists some coordinate j such that KL(PjQj ) ≥ γ /k. This means Xy′j∈{0,...,b−1} Pj(y′j ) log Pj(y′j ) Qj (y′j ) ≥ γ /k. Pj(t)− Qj(t) ≥ Pj (t) 1− Pj(t) ! ≥ kbM (cid:16)1− 2−γ /(kb)(cid:17) ≥ γ 2kb = kbM 2(kb)2M This means there exists some t ∈ {0, . . . , b − 1} such that Pj (t) log(Pj (t)/Qj(t)) ≥ γ /(kb). Recall that log(cid:16)Pj(t)/Qj (t)(cid:17) ≤ M, then we must have Pj(t) ≥ γ /(kbM). Furthermore, since Pj (t) ≤ 1, we must also have log(Pj(t)/Qj (t)) ≥ γ /(kb). It follows that γ Qj (t) γ 2 γ where the last inequality follows from the fact that 1 − 2−z ≥ z/2 for any z ∈ [0, 1]. Therefore, for any γ > 0, the following class of events E(γ ) = {1[yj = t] t ∈ {0, 1, . . . , b − 1}, j ∈ [k]} would contain a ξ-distinguishing event, and max{1/ξ,E(γ )} ≤ poly(k, b, 1/γ ). 26
1902.08384
1
1902
2019-02-22T07:20:07
Preconditioning for the Geometric Transportation Problem
[ "cs.DS", "cs.CG" ]
In the geometric transportation problem, we are given a collection of points $P$ in $d$-dimensional Euclidean space, and each point is given a supply of $\mu(p)$ units of mass, where $\mu(p)$ could be a positive or a negative integer, and the total sum of the supplies is $0$. The goal is to find a flow (called a transportation map) that transports $\mu(p)$ units from any point $p$ with $\mu(p) > 0$, and transports $-\mu(p)$ units into any point $p$ with $\mu(p) < 0$. Moreover, the flow should minimize the total distance traveled by the transported mass. The optimal value is known as the transportation cost, or the Earth Mover's Distance (from the points with positive supply to those with negative supply). This problem has been widely studied in many fields of computer science: from theoretical work in computational geometry, to applications in computer vision, graphics, and machine learning. In this work we study approximation algorithms for the geometric transportation problem. We give an algorithm which, for any fixed dimension $d$, finds a $(1+\varepsilon)$-approximate transportation map in time nearly-linear in $n$, and polynomial in $\varepsilon^{-1}$ and in the logarithm of the total supply. This is the first approximation scheme for the problem whose running time depends on $n$ as $n\cdot \mathrm{polylog}(n)$. Our techniques combine the generalized preconditioning framework of Sherman, which is grounded in continuous optimization, with simple geometric arguments to first reduce the problem to a minimum cost flow problem on a sparse graph, and then to design a good preconditioner for this latter problem.
cs.DS
cs
Preconditioning for the Geometric Transportation Problem Andrey Boris Khesin University of Toronto Aleksandar Nikolov∗ University of Toronto [email protected] [email protected] Dmitry Paramonov University of Toronto [email protected] Abstract In the geometric transportation problem, we are given a collection of points P in d-dimensional Euclidean space, and each point is given a supply of µ(p) units of mass, where µ(p) could be a positive or a negative integer, and the total sum of the supplies is 0. The goal is to find a flow (called a transportation map) that transports µ(p) units from any point p with µ(p) > 0, and transports −µ(p) units into any point p with µ(p) < 0. Moreover, the flow should minimize the total distance traveled by the transported mass. The optimal value is known as the transportation cost, or the Earth Mover's Distance (from the points with positive supply to those with negative supply). This problem has been widely studied in many fields of computer science: from theoretical work in computational geometry, to applications in computer vision, graphics, and machine learning. In this work we study approximation algorithms for the geometric transportation problem. We give an algorithm which, for any fixed dimension d, finds a (1+ε)-approximate transportation map in time nearly- linear in n, and polynomial in ε−1 and in the logarithm of the total supply. This is the first approximation scheme for the problem whose running time depends on n as n · polylog(n). Our techniques combine the generalized preconditioning framework of Sherman, which is grounded in continuous optimization, with simple geometric arguments to first reduce the problem to a minimum cost flow problem on a sparse graph, and then to design a good preconditioner for this latter problem. 1 Introduction (cid:80) In the Geometric Transportation problem, we are given a set P of n points in d-dimensional Euclidean space, and a function µ : P → Z that assigns a (positive or negative integer) weight to each point, so that p∈P µ(p) = 0. We call µ the supply function. We can think of each point p ∈ P as either a pile of earth, or a hole, and µ(p) gives, respectively, the amount of earth (if positive) or the size of the hole (if negative). The constraint on µ means that the total space in the holes equals the total amount of earth in the piles. Our goal is to find the most efficient way to transport the earth to the holes, where the cost of transporting a unit of mass from p to q equals the distance (cid:107)p − q(cid:107)2 it must travel, measured in the Euclidean norm. More formally, let P+ = {p ∈ P : µ(p) ≥ 0} be the "piles" and P− = {q ∈ P : µ(q) < 0} be the "holes". We ∗Supported by an NSERC Discovery Grant (RGPIN-2016-06333). Part of this work was done while this author was visiting the Simons Institute for the Theory of Computing semester on Bridging Continuous and Discrete Optimization, partially supported through NSF grant #CCF-1740425 9 1 0 2 b e F 2 2 ] S D . s c [ 1 v 4 8 3 8 0 . 2 0 9 1 : v i X r a 1 p∈P+,q∈P− (cid:88) (cid:88) (cid:88) q∈P− p∈P+ Minimize subject to ∀p ∈ P+ : ∀q ∈ P− : fpq(cid:107)p − q(cid:107)2 fpq = µ(p), fpq = µ(q), want to solve the minimum cost flow problem given by the following linear program ∀p ∈ P+, q ∈ P− :fpq ≥ 0. Above, the constraints enforce that all demands are satisfied, i.e. all the earth goes into holes, and no hole is overfilled. A vector f ∈ RP+×P− that satisfies these constraints is called a transportation map for (P, µ). The cost of an optimal transportation map is called the transportation cost of (P, µ), or also the Earth Mover's Distance, or 1-Wasserstein distance between the measures φ = µP+ and ψ = −µP−, and is denoted cost(P, µ). exactly using the algorithm of Lee and Sidford would take time O(n2.5 polylog(U )),1 where U =(cid:80) The geometric transportation problem is a discretized version of the continuous optimal mass trans- portation problem of Monge and Kantorovich. This is a classical problem in mathematics, with many beau- tiful connections to partial differential equations, geometry, and probability theory, among others [Vil03]. The discrete problem above has also found a large number of applications, for example to shape match- ing [GV02, GD04] and image retrieval [RTG00, LCL04] in computer vision, and interpolation between distributions in graphics [BvdPPH11]. It is also of intrinsic interest as a natural problem in computational geometry. The geometric transportation problem can be modeled as a minimum cost flow problem in the complete bipartite graph with bi-partition P+ ∪ P−. This graph is dense, and solving the minimum cost flow problem µ(p). If instead we settle for an (1 + ε)-approximation, then the recent algorithm of Sherman [She17] gives running time O(n2+o(1)ε−2). However, there exist faster (in certain parameter regimes) approximation algorithms which exploit the geometric structure of the problem: after a long line of work, Sharathkumar and Agar- wal [SA12a] gave an algorithm that computes a (1 + ε)-approximation in time O(n U polylog(U, ε, n)), and, recently, Agarwal et al. [AFP+17] gave several algorithms with different trade-offs, among them an (1 + ε)-approximation algorithm running in time O(n3/2ε−d polylog(U, n)). A nearly linear time (1 + ε)- approximation algorithm was given by Sharathkumar and Agarwal [SA12b] in the special case of unit supplies; their algorithm runs in time O(nε−O(d) polylog(n)). Until now, no such algorithm was known for general supply functions. p∈P+ √ A related line of work focuses on estimating the transportation cost, without necessarily computing a transportation map. An influential paper in this direction was that of Indyk [Ind07], whose algorithm gives a constant factor approximation to the transportation cost in the case of unit supplies, in time O(n polylog(n)). This result was extended to arbitrary supplies and to approximation factor 1 + ε by Andoni et al. [ANOY14], whose algorithm runs in time O(n1+o(1)), with the o(1) factor in the exponent hiding dependence on ε. The result of Sherman [She17], mentioned above, together with the existence of sparse Euclidean spanners, implies an O(n1+o(1)ε−O(d)) time algorithm to estimate the transportation cost.2 Indeed, using the well- separated pair decompositions of Callahan and Kosaraju [CK93] (see also Chapter 3 of [HP11]), one can construct in time O(n log n + nε−d) a graph G on P with O(nε−d) edges, so that the shortest path in G between any p, q ∈ P has total length at most (1 + ε)(cid:107)p − q(cid:107)2. It is then simple to construct a minimum cost flow problem on G whose optimal value equals the transportation cost of (P, µ) up to a factor of 1 + ε. This minimum cost flow problem in G can then be solved with Sherman's algorithm to achieve the claimed running time. It is not immediately clear, however, how to use the flow in G to construct a transportation map of comparable cost in nearly linear time. 1We allow the implicit constants in the asymptotic notation to depend on the dimension d, except when the asymptotic notation is used in an exponent. 2We are indebted to an anonymous reviewer for this observation. 2 There is a related line of work [PA06, AS14, ABRW18] that studies the transportation problem when 2, giving the r-Wasserstein distance. This appears to be the cost of transporting mass from p to q is (cid:107)p − q(cid:107)r a more challenging problem, and we do not address it further. 1.1 Our Results and Methods Let us recall that the aspect ratio (or spread) of a pointset P is defined as the ratio of its diameter to the smallest distance between two distinct points. Our main result is a nearly linear time (1 + ε)-approximation algorithm for the geometric transportation problem, as captured by the following theorem. Theorem 1. There exists a randomized algorithm that on input an n-point set P ⊂ Qd with aspect ratio ∆, and supply function µ : P → Z, runs in time O(nε−O(d) log(∆)O(d) log n), and with probability at least 1/2 finds a transportation map with cost at most (1 + ε) · cost(P, µ). There also exists a randomized algorithm that on input an n-point set P ⊂ Qd and supply function µ(p), runs in time O(nε−O(d) log(U )O(d) log(n)2), and with probability at µ : P → Z such that U =(cid:80) least 1/2 finds a transportation map with cost at most (1 + ε) · cost(P, µ). p∈P+ In constant dimension, the dependence of the running time on the aspect ratio ∆ or total supply U is polylogarithmic, and the dependence on the approximation ε is polynomial. The dependence on n is just O(n log n) (respectively O(n log(n)2)). This is in contrast with prior work which either had a much larger dependence on n, or a polynomial dependence on U . In the proof of this result, we employ a combination of geometric tools, and tools from continuous opti- mization developed for the general minimum cost flow problem. As a first step, we reduce the transportation problem to an (uncapacitated) minimum cost flow problem on a random sparse graph. This construction is closely related to the prior work of Sharathkumar and Agarwal in the case of unit capacities [SA12b], and also to the estimation algorithm for the transportation cost in [ANOY14]. In particular, the sparse graph and minimum cost flow instance we construct are a simplification of the minimum cost flow instance in [ANOY14]. Together with the recent work of Sherman [She17], this reduction is enough to get a O(n1+o(1)ε−O(d)) time algorithm to estimate the transportation cost. As mentioned above, this running time can also be achieved using a Euclidean spanner, and the random sparse graph we use can, in fact, be seen as a randomized span- ner. Our graph, however, has a nice hierarchical structure not shared by other spanner constructions. In particular, there is a quadtree of the input point set such that any edge leaving a cell of the quadtree goes to either a sibling cell or a parent cell. This property is useful both for improving the running time further, and for computing a transportation map. To further improve the running time, we open up Sherman's elegant framework, and combine it with classical geometric constructions. Sherman's framework is based on repeatedly finding a flow which is approximately optimal, and approximately feasible. This can be achieved quickly, for example using the multiplicative weights update method [AHK12]. Once an approximately feasible flow is found, the supplies and demands are updated to equal the still-unrouted part of the original supplies and demands, and the problem is solved again. Finally, all the flows computed so far are added up; if the resulting flow is very close to being feasible, it can be "rounded off" to a truly feasible one with a small loss in the cost. Sherman showed that, if the problem being solved is sufficiently well conditioned in the appropriate way, then this process of repeatedly finding approximately feasible flows converges very fast to a feasible one. Unfortunately, most minimum cost flow problems are not well-conditioned in their natural formulations. For this reason, we need to find a preconditioner, i.e. a linear transformation, to be applied to the constraints of the minimum cost flow problem, which makes the problem well-conditioned. This is where we can further exploit the structure of the geometric transportation problem. Constructing a preconditioner in our random sparse graph is closely related to estimating the transportation cost by an embedding into (cid:96)1. We exploit ideas from the known embeddings of transportation cost into (cid:96)1 [Cha02, IT03] to construct a preconditioner with condition number that depends polynomially on the approximation factor and the logarithm of the aspect ratio. The insight that these simple and well-known techniques can be repurposed to give high-quality preconditioners is one of our main conceptual contributions. The final algorithm does not require any specialized data structures and is relatively simple: once the sparse graph is constructed, and the preconditioner is applied, we iteratively run the multiplicative weights method several times, and, once we are close enough to a feasible flow, greedily round off the errors. This 3 is sufficient for estimating the transportation cost, but does not yet give us a transportation map, because we transformed the original problem into a different minimum cost flow problem on a sparse graph. In the final section of our paper we show a simple way to efficiently transform a flow on this sparse graph into a transportation map, without increasing its cost. i=1 xip(cid:17)1/p (cid:16)(cid:80)d 2 Notation and Basic Notions We use the notation (cid:107)x(cid:107)p for the (cid:96)p norm of a vector x ∈ Rd: (cid:107)x(cid:107)p = . We will assume that the input P ⊂ Qd to our problem lies in [0, ∆]d, and that the smallest Euclidean distance between any two points is at least 1. Since any shifts, rotations, or dilations of the points do not change the problem, this assumption is equivalent to assuming that the aspect ratio of P , i.e. the ratio between the diameter of P and the smallest distance between two distinct points, is bounded between ∆ and In fact, at the cost of a small increase in the approximation factor, we can reduce to this case of bounded aspect ratio. The reduction produces a point set P for which ∆ is bounded by a factor that depends on U =(cid:80) exists an algorithm that takes any input P ⊂ Rd of size n and µ : P → Z such that U =(cid:80) Lemma 1 ([Ind07, ANOY14]). Suppose that there exists a function T , increasing in all its parameters, and an algorithm which, for any ε, δ < 1, on input of size n in [0, ∆]d ∩ Zd, runs in time O(nT (∆, ε, δ)), and with probability 1 − δ computes a 1 + ε approximation to the geometric transportation problem. Then there µ(p), runs in time O(nT (cdU/ε2, ε, δn)) for an absolute constant c, and, with probability 1− δ, achieves an approximation of 1 + O(ε) for the geometric transportation problem on P and µ. p∈P+ µ(p). √ d∆. p∈P+ focus our presentation on the case of bounded aspect ratio. With this lemma, the second algorithm in Theorem 1 follows from the first one. For this reason, we can For a set V , we call f ∈ RV ×V a flow if it is anti-symmetric, i.e. fuv = −fvu for every u, v ∈ V . Intuitively, we think of fuv > 0 as flow going in the direction from u to v. For a graph G = (V, E), we define a flow on G to be a flow f supported on E, i.e. one such that fuv = 0 for any (u, v) (cid:54)∈ E. The divergence of v∈V fuv, i.e. the excess of the flow leaving u over the flow entering u. When a flow f at u is the quantity(cid:80) the divergence at u is 0, we say that flow conservation is satisfied at u. In general, we assume that our graphs are stored in the adjacency list representation, and that flow values are stored with the adjacency list. 3 Reduction to Minimum Cost Flow on a Sparse Graph The first step in our algorithm is to reduce the geometric transportation problem, which is naturally modeled as a minimum cost flow problem on a complete bipartite graph, to another minimum cost flow on a sparse random graph. The following construction is a simplified version of one used in [ANOY14]. 3.1 Graph Construction Recall that P ⊂ [0, ∆d]. We start by constructing a grid containing all the points in P as follows. We sample a uniformly random point x ∈ [0, ∆]d, and define the cell C0 = [−∆, ∆]d + x. Note that all points in P are in C0. We say that C0 is on level 0. The set of cells on level (cid:96) is labelled C(cid:96) and is constructed by taking each cell C in C(cid:96)−1 and dividing it into 2d equally-sized cubes of side length half the side length of C, and retaining those that contain points in P . We say that C is the parent of the cells into which it was divided. Conversely, those 2d cells are called the children of C. This division is continued until level L, where all points in P lie in different cells in CL. With probability 1, no point of P lands on the boundary of any cell, so we will ignore this event. Since the side length of any cell on level (cid:96) is half of the side length of a cell on level (cid:96) − 1, any cell in C(cid:96) has side length 21−(cid:96)∆, and we refer to this length as ∆l. Also note that, since the closest two points in P d∆), so L = O(log ∆). Moreover, any point p ∈ P lies in are at least distance 1 apart, we have L ≤ log2(2 √ 4 Figure 1: A cell C(cid:96)−1 on level (cid:96) − 1 and the four cells on level (cid:96) contained in it. The subcells of C(cid:96)−1 are shown with dashed lines, and the corresponding net points in N(cid:96)−1 with black dots. The subcells of one of the cells on level (cid:96) are shown with dotted lines, and the corresponding net point in N(cid:96) with crosses. at most L + 1 cells, one per level, and, since in C(cid:96) we only retain cells that contain points in P , we have that C0 ∪ . . . ∪ CL ≤ n(L + 1) = O(n log ∆). Let ε0 be a small number such that ε−1 0 is an even integer. This ε0 is not the same as the value used when we speak of a (1 + ε)-approximation, although the two are related, as we will see. Next, for each (cid:96) ∈ {0, . . . , L, we take each cell C ∈ C(cid:96), and we divide it into ε−d subcells, each of side length ε0∆l. The set denote the set of all net points on level (cid:96) as N(cid:96). See Figure 1 for an illustration. Note that N(cid:96) = C(cid:96)ε−d 0 , so N0 ∪ . . . ∪ NL ≤ n(L + 1)ε−d of all such subcells of all C ∈ C(cid:96) is denoted (cid:101)C(cid:96). To each subcell we associate a net point at its centre and we If p is a point in C0, let C(cid:96)(p) ∈ (cid:101)C(cid:96) be the unique subcell on level (cid:96) that contains p. Similarly, let N(cid:96)(p) 0 = O(nε−d log ∆). 0 0 be the net point on level (cid:96) closest to p. Equivalently, N(cid:96)(p) is the center of C(cid:96)(p). We say that N(cid:96)(p) and N(cid:96)−1(p) are each other's child and parent, respectively. We are now ready to construct our graph G = (V, E). We set V = P ∪ N0 ∪ N1 ∪···∪ NL, the set of all of the points in the original problem and all of the netpoints we have constructed. By the previous discussion, V = O(nε−d log ∆). We build our graph using three types of edges. The first set, E1, connects points p in P to their closest net point on level L, i.e. E1 = {(p, NL(p)) : p ∈ P}. The size of this set is E1 = n. The second set of edges, E2, connects all net points of subcells of a given cell pairwise. Thus, 0 E2 = {(u, v) : (cid:96) ∈ {0, 1, . . . , L}, C ∈ C(cid:96), u, v ∈ N(cid:96) ∩ C s.t. u (cid:54)= v}. 0 = O(nε−2d 0 , we have that E2 ≤ (L + 1)nε−2d Since C(cid:96) ≤ n, and, for any C ∈ C(cid:96), N(cid:96) ∩ C = ε−d The last set of edges, E3, connects net points to their parent net points, i.e. E3 = {(N(cid:96)−1(u), u) : (cid:96) ∈ {1, 2, . . . , L}, u ∈ N(cid:96)}. The size of E3 is less than the total number of net points, so E3 = O(nε−d log ∆). Then, the set of edges is defined as E = E1 ∪ E2 ∪ E3, and this completes the description of G = (V, E). The number of edges is dominated by the size of E2, and is in O(nε−2d log ∆). We will be calculating distances between points along paths in this graph, and we define the distance/cost of any edge to equal the Euclidean distance between the two endpoints of the edge. For the rest of the paper we will use G to refer to the random graph constructed above. Having stored the random shift of C0, we can enumerate the vertices in time O(nε−d log ∆) by going through each point in P and checking which cells it lies in. We can then store the vertices in a static dictionary [FKS84]. Similarly, we can construct the adjacency lists of the vertices in time O(nε−2d log ∆). log ∆). 0 0 0 0 0 3.2 Embedding Euclidean Distance into a Sparse Graph Let distG(u, v) be the shortest path distance between two nodes u and v of G, i.e. distG(u, v) = min (cid:107)ui − ui−1(cid:107)2, k(cid:88) i=1 5 C(cid:96)−1C(cid:96) with the minimum taken over paths u = u0, . . . , uk = v connecting u and v in G. Our goal for this section is to show that, for any two p and q in P , the expected value of distG(u, v) is close to the Euclidean distance between them. In other words, we want to show that our random graph construction provides a randomized embedding of Euclidean distance into the shortest path metric of a sparse graph. This is similar to the embeddings used in [ANOY14] and [SA12a, SA12b], and can be seen as a randomized spanner construction, in which the graph G only needs to have low stretch in expectation. For two points p and q in P , we define (cid:96)(p, q) to be the level of the smallest cell containing both p and q, which can depend on the random shift of the grid. This means that C(cid:96)(p,q)(p) = C(cid:96)(p,q)(q), but C(cid:96)(p,q)+1(p) (cid:54)= C(cid:96)(p,q)+1(q). The following definition will be useful. Definition 1. Given two points p, q ∈ P , the canonical path between p and q in the random graph G consists of the edges {(N(cid:96)(p), N(cid:96)−1(p) : (cid:96)(p, q) + 1 ≤ (cid:96) ≤ L} ∪ {(N(cid:96)(p,q)(p), N(cid:96)(p,q)(q))} ∪ {(N(cid:96)(q), N(cid:96)−1(q) : (cid:96)(p, q) + 1 ≤ (cid:96) ≤ L} ∪ {(NL(p), p), (NL(q), q)}. The canonical path could be much longer than (cid:107)p − q(cid:107)2 because, if p and q are two nearby points that are separated by a grid line, the canonical path will be much larger than the Euclidean distance. However, when p and q are very close together, the likelihood that such a grid line will fall between them is low. To formalize this intuition, we need the following well-known bound on the probability that p and q will be split at a certain level of the tree, which is elementary, and goes back at least to Arora's work on Euclidean TSP [Aro98]. Lemma 2. Over the random shift of C0, ∀p, q ∈ P , P(C(cid:96)(p) (cid:54)= C(cid:96)(q)) ≤ (cid:107)p − q(cid:107)1 ∆(cid:96) ≤ d(cid:107)p − q(cid:107)2 ∆(cid:96) . √ Using this standard lemma, we can prove the bound on the distortion between Euclidean distance and the expected shortest path distance in G. The proof, which is standard, is deferred to the appendix. Lemma 3. Let p, q ∈ P . Then, for any shift of C0, (cid:107)p− q(cid:107)2 ≤ distG(p, q). Moreover, over the random shift of C0, E[distG(p, q)] ≤ (1 + O(ε0L))(cid:107)p − q(cid:107)2. 3.3 Approximating the Transportation Cost with Minimum Cost Flow We are now ready to translate the transportation problem to a minimum cost flow problem in G, captured by the following linear program. (1) (2) (3) (4) Minimize fuv(cid:107)u − v(cid:107)2 subject to ∀u, v ∈ V :fuv = −fvu ∀p ∈ P : ∀u ∈ V \ P : fpu = µ(p), fuv = 0. (cid:88) (u,v)∈E (cid:88) (cid:88) u∈V v∈v Let us denote by cost(G, µ) the value of the optimal solution to the problem (1) -- (4). Note that, since G is a random graph, cost(G, µ) is also a random variable. The next theorem shows that that cost(G, µ) approximates the transportation cost cost(P, µ). Theorem 2. For any shift of C0, cost(P, µ) ≤ cost(G, µ). Moreover, over the random shift of C0, E[cost(G, µ)] ≤ (1 + O(ε0L))cost(P, µ). 6 into a sum of paths as f =(cid:80)k of f is at least(cid:80)k Proof of Theorem 2. To prove the first claim, we show that a flow f satisfying (3) -- (4) can be transformed into a transportation map f(cid:48) for P and µ without increasing its cost. Towards this goal, let us decompose f i=1 aifπi, where πi is a path from some point pi in P+ to some point qi in P−, fπi is the unit flow traveling on edges of πi in the direction from pi to qi, and a1, . . . , ak are non-negative integers. The existence of such a decomposition is a standard fact, see e.g. Chapter 10 of [Sch03]. The cost i:pi=p,qi=q ai. The constraints i=1 aidistG(pi, qi). We can construct f(cid:48) by defining f(cid:48) pq =(cid:80) on f imply that f(cid:48) is a feasible transportation map; its cost is k(cid:88) ai(cid:107)pi − qi(cid:107)2 ≤ k(cid:88) i=1 i=1 aidistG(pi, qi), where the inequality follows from Lemma 3, and the right hand side is, as already observed, at most the cost of f . The first claim then follows since we can take f to be an optimal solution to (1) -- (4). For the second claim, we need to go in reverse. Let f(cid:48) be an optimal transportation map, i.e. one achieving cost(P, µ). Let (p1, q1), . . . , (pk, qk) be the edges in the support of f(cid:48), where, for every i, pi ∈ P+ fπi, where fπi is, as before, a unit flow from pi to qi supported on the edges of πi. The feasibility of f follows distG(pi, qi). We and qi ∈ P−. Let πi be a shortest path in G between pi and qi. We define a flow f in G by f =(cid:80)k from the fact that f(cid:48) is a feasible transportation map. Moreover, the cost of f is(cid:80)k i=1 f(cid:48) pi,qi i=1 f(cid:48) pi,qi then have E[cost(G, µ)] ≤ k(cid:88) f(cid:48) pi,qi E[distG(pi, qi)] i=1 ≤ (1 + O(ε0L)) k(cid:88) f(cid:48) pi,qi (cid:107)pi − qi(cid:107)2 where the final inequality follows from Lemma 3. i=1 = (1 + O(ε0L))cost(P, µ), 4 Solving the Minimum Cost Flow Problem In this section we describe the generalized preconditioning framework of Sherman [She17], and describe how to use it to solve the minimum cost flow problem (1) -- (4) in nearly linear time. 4.1 Generalized Preconditioning Framework We take a short detour to describe the generalized preconditioning framework of Sherman. Suppose that (cid:107) · (cid:107) is a norm on Rm, and we are given inputs A ∈ Rn×m and b ∈ Rn. The framework is concerned with solving the following optimization problem over the variables f ∈ Rm: Minimize (cid:107)f(cid:107) subject to Af = b, . (5) (6) This formulation can capture many important problems, including, crucially for us, the uncapacitated min- imum cost flow problem,3 as we explain later. A central definition in the framework is that of the nonlinear condition number. Before we state it, let us recall that the norm of a linear map T : X → Y , where (X,(cid:107) · (cid:107)X ) and (Y,(cid:107) · (cid:107)Y ) are two finite dimensional normed vector spaces, is defined as (cid:107)T(cid:107) = sup x(cid:54)=0 (cid:107)T (x)(cid:107)Y (cid:107)x(cid:107)X . 3Uncapacitated minimum cost flow is commonly known as the transportation problem. We do not use this terminology, in order to avoid confusion with the geometric transportation problem. 7 We adopt the same definition for non-linear maps, as well. For an n × m matrix A, and norms (cid:107) · (cid:107)X on X = Rn and (cid:107) · (cid:107)Y on the column span Y of A, we use the notation (cid:107)A(cid:107)(cid:107)·(cid:107)X→(cid:107)·(cid:107)Y to refer to the norm of the linear map from X to Y represented by A. Having recalled these notions, we proceed to define the condition number. Definition 2. Let (X,(cid:107)·(cid:107)X ) and (Y,(cid:107)·(cid:107)Y ) be two finite dimensional normed vector spaces. The non-linear condition number κ of a linear map T : X → Y is defined by κ(T ) = inf S (cid:107)T(cid:107)(cid:107)S(cid:107), where S : Y → X ranges over all (not necessarily linear) maps such that for all x ∈ X we have T (S(T x)) = T x. For an n × m matrix A, and norms (cid:107) · (cid:107)X on X = Rm and (cid:107) · (cid:107)Y on the column span Y of A, we define κ(cid:107)·(cid:107)X→(cid:107)·(cid:107)Y (A) as κ(T ), where T : X → Y is the linear map represented by the matrix A. This definition generalizes the standard condition number, which is the special case in which both norms are taken to be Euclidean. The generalized preconditioning framework is based on composing rough approximation algorithms to get a high-quality approximation. The rough approximation algorithms are further allowed to violate the constraints of the problem slightly. Thus, they achieve a bi-criteria approximation, captured by the following definition. Definition 3. Let (cid:107) · (cid:107)Y be a norm defined on the range of the matrix A in (6). Let f∗ be an optimal solution to the problem (5) -- (6). Then f ∈ Rm is called an (α, β)-solution (with respect to (cid:107) · (cid:107)Y ) to (5) -- (6) if (cid:107)f(cid:107) ≤ α(cid:107)f∗(cid:107) and, moreover, (cid:107)Af − b(cid:107)Y ≤ β(cid:107)A(cid:107)(cid:107)·(cid:107)→(cid:107)·(cid:107)Y (cid:107)f∗(cid:107). An algorithm that, when given inputs A and b, outputs an (α, β)-solution f is called an (α, β)-solver (with respect to (cid:107) · (cid:107)Y ) for (5) -- (6). We use the next result of Sherman, which gives a solver for (5) -- (6) with running time controlled by condition number of the constraint matrix. Theorem 3 ([She17]). Let ε, β > 0, and suppose that the norm in (5) is the (cid:96)m 1 norm. Let κ = κ(cid:107)·(cid:107)1→(cid:107)·(cid:107)1(A), and let M be an upper bound on the time necessary to compute matrix-vector products with A and A(cid:62). Then there exists a (1 + ε, β)-solver with respect to (cid:107) · (cid:107)1 for the problem (5) -- (6) with running time bounded by O(cid:0)κ2(m + n + M ) log(m)(ε−2 + log(1/β))(cid:1) . This algorithm is based on repeatedly applying an (α, β) solver with much worse dependence on β; in fact, at the cost of a slightly worse dependence on κ, for the latter one can use a simple solver based on the multiplicative weights update method. To make our paper more self-contained, we sketch this latter algorithm in the appendix. Rescaling f coordinatewise gives us the following easy corollary. Corollary 1. Let ε, β > 0, and let c ∈ Rm i=1 cifi. Let κ = κ(cid:107)·(cid:107)c→(cid:107)·(cid:107)1(A), and let M be the time necessary to compute matrix-vector products with A and A(cid:62). Then there exists a (1 + ε, β)-solver with respect to (cid:107) · (cid:107)1 for the problem (5) -- (6) with running time bounded by O(cid:0)κ2(m + n + M ) log(m)(ε−2 + log(1/β))(cid:1) . >0. Suppose that the norm in (5) is given by (cid:107)f(cid:107)c =(cid:80)m Proof. Define the diagonal matrix C by cii = ci. The problem (5) -- (6) with norm (cid:107) · (cid:107) = (cid:107) · (cid:107)c can be reformulated, after the change of variables g = Cf , as Minimize (cid:107)g(cid:107)1 subject to AC−1g = b, Then the corollary follows from Theorem 3 since κ(cid:107)·(cid:107)c→(cid:107)·(cid:107)1 (A) = κ(cid:107)·(cid:107)1→(cid:107)·(cid:107)1 (AC−1). The latter follows from two observations: first, (cid:107)AC−1(cid:107)(cid:107)·(cid:107)1→(cid:107)·(cid:107)1 = (cid:107)A(cid:107)(cid:107)·(cid:107)c→(cid:107)·(cid:107)1; second, the map G from the column span Y of A to Rm satisfies AGAf = Af for all f if and only if AC−1(CG(AC−1g)) for all g, and (cid:107)CG(cid:107)(cid:107)·(cid:107)1→(cid:107)·(cid:107)1 = (cid:107)G(cid:107)(cid:107)·(cid:107)1→(cid:107)·(cid:107)c. 8 While Theorem 3 and Corollary 1 allow us to find solutions which are very close to being feasible, they do not give an exactly feasible solution. The final result we use from Sherman allows us to use a solver which exactly satisfies the constraints, but only achieves a large approximation ratio, to round an approximately feasible solution to an exactly feasible one. To state the result, we need to define the composition of two solvers F and F(cid:48). The composed algorithm F(cid:48) ◦F first calls F on A and b to get f ; then it calls F(cid:48) on A and the residual vector b− Af to get a solution f(cid:48); finally it outputs f + f(cid:48). Theorem 4 ([She17]). Let C ≥ 1, and ε, β > 0. Let κ = κ(cid:107)·(cid:107)→(cid:107)·(cid:107)Y (A), where (cid:107) · (cid:107) is the norm in (5), and (cid:107)·(cid:107)Y is some norm on the column span of A. Then, if F is a (1 + ε, εβ/κ)-solver, and F(cid:48) is a (C, 0)-solver, the composition F(cid:48) ◦ F is a (1 + ε + Cεβ, 0)-solver. 4.2 Preconditioner Construction The formulation (5) -- (6) captures the (uncapacitated) minimum cost flow problem with arbitrary demands. We will explain this for the graph G = (V, E) defined in Section 3.2 and the minimum cost flow problem (1) -- (4). Let us pick an arbitrary orientation on the edges E, and call the directed edges (cid:126)E. Then take A to be the directed vertex by edge incidence matrix of G: it is indexed by V × (cid:126)E, and for any node u, and any directed edge e = (v, w), set Au,e = 1 if u = v, Au,e = −1 if u = w, and Au,e = 0 otherwise. We represent a flow f by its restriction to (cid:126)E, seen as a vector in R (cid:126)E. Slightly abusing notation, we will use the letter f both for this vector, and for the flow, which is defined both for (u, v) ∈ (cid:126)E, and for (v, u), with fvu = −fuv. For a flow vector f , the product Af gives us the vector of divergences, i.e. for any u ∈ V (cid:88) fuv − (cid:88) (cid:88) (Af )u = fvu = fuv. v:(u,v)∈ (cid:126)E v:(v,u)∈ (cid:126)E v:(u,v)∈E e = (u, v) ∈ (cid:126)E by c(e) = (cid:107)u − v(cid:107)2. Then, for the norm in the objective (5), we choose (cid:107)f(cid:107)c =(cid:80) We define the vector b ∈ RV to encode the supplies, i.e. for p ∈ P we set bp = µ(p), and for u ∈ V \ P we set bu = 0. It follows that the constraint Af = b encodes (3) -- (4). Finally, let us denote the cost of an edge e∈E c(e)fe. With these choices of A, b, and (cid:107) · (cid:107) = (cid:107) · (cid:107)c, an optimal solution to (5) -- (6) gives an optimal solution to (1) -- (4). For the rest of this section we will fix A, b, c, and (cid:107) · (cid:107)c to be as just defined. Unfortunately, we cannot directly use Corollary 1 to get the running time we are aiming for, since the condition number of the matrix A could be large. We address this by designing a preconditioner: another matrix B, of full column rank, which can be applied quickly, and has the property that BA has small condition number. This allows us to apply Corollary 1 to the problem (5) -- (6) with the modified, but equivalent, constraint BAf = Bb, and get a fast algorithm for the minimum cost flow problem in G. In our construction of the preconditioner B we will use the following lemma, which was implicit in [She17]. Lemma 4. Let (cid:107) · (cid:107)X be a norm on Rn, and let H be an n × m matrix. Suppose that there exists a γ > 0 such that for any h in the column span Y of H, the norm (cid:107) · (cid:107)Y satisfies (cid:107)h(cid:107)Y ≤ min{(cid:107)f(cid:107)X : f ∈ Rn, Hf = h} ≤ γ(cid:107)h(cid:107)Y . Then κ(cid:107)·(cid:107)X→(cid:107)·(cid:107)Y (H) ≤ γ. Proof. Let us identify H with the linear map from X = Rn to Y represented by it. Define S(h) = arg min{(cid:107)f(cid:107)X : Hf = h}, with ties between minimizers broken arbitrarily. It is clear that for any f , HS(Hf ) = Hf . By assumption, we have the inequalities which are equivalent to (cid:107)H(cid:107) ≤ 1 and (cid:107)S(cid:107) ≤ γ. (cid:107)Hf(cid:107)Y ≤ (cid:107)f(cid:107)X , (cid:107)S(h)(cid:107)X ≤ γ(cid:107)h(cid:107)Y , 9 We will design a preconditioner matrix B such that (cid:107)b(cid:107)1 approximates the cost of the minimum cost flow with supply vector b. Then the fact that BA has small condition number will follow from Lemma 4. The following lemma captures the construction of B, which is inspired by embedding of the Earth Mover Distance in (cid:96)1 [Cha02, IT03]. Lemma 5. There exists a matrix B ∈ RV ×V of full column rank with at most O(V log ∆) nonzero entries, such that the following holds. For any b ∈ RV such that(cid:80) bu = 0, we have (cid:107)Bb(cid:107)1 ≤ min{(cid:107)f(cid:107)c : f ∈ R (cid:126)E, Af = b} ≤ γ(cid:107)Bb(cid:107)1, u∈V 0 log ∆) given Bb. for γ = O(log(∆)/ε0). Moreover, a flow f satisfying Af = b of cost at most γ(cid:107)Bb(cid:107)1 can be constructed in time O(nε−d Proof. The matrix B has one row associated with each vertex u ∈ V . For p ∈ P , we let Bp,p = (cid:107)p− NL(p)(cid:107)2 and Bp,u = 0 for any u (cid:54)= p. Every other vertex u ∈ V \ P is a net point. Suppose that u is in N(cid:96); then for any v ∈ V such that N(cid:96)(v) = u, Bu,v = ε0∆(cid:96) 4(L+1) , and for all other v, Bu,v = 0. This defines the matrix B. Notice that each vertex u ∈ V contributes to at most L + 2 nonzero entries of B: one for each (cid:96) ∈ {0, . . . , L} corresponding to N(cid:96)(u), and one more when u ∈ P . It is easy to verify directly that B has full column rank. (cid:88) The definition of B guarantees that (cid:88) (cid:101)C∈(cid:101)C(cid:96) The remainder of the proof is broken down into several claims. For the first claim, let us extend the definition of cost(G,·) to supplies which can be non-zero on net points as well by bp(cid:107)p − NL(p)(cid:107)2 + (cid:88) u∈(cid:101)C∩V (cid:107)Bb(cid:107)1 = L(cid:88) L + 1 ε0∆(cid:96) p∈P (7) bu (cid:96)=0 1 4 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) . (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) cost(G, b) = min{(cid:107)f(cid:107)c : f ∈ R (cid:126)E, Af = b}. Claim 1. (cid:107)Bb(cid:107)1 ≤ cost(G, b). Proof. In any feasible flow f , the total cost of the flow on edges incident to points p ∈ P must equal the first term in (7). Then, we just need to show that the remaining terms are a lower bound on the total cost of the flow on the remaining edges. In fact we will show that, for each (cid:96), (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ cost(G, b) −(cid:88) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12) must enter or leave each (cid:101)C ∈ (cid:101)C(cid:96), and every edge e from a vertex in (cid:101)C to a vertex outside of (cid:101)C (cid:12)(cid:12)(cid:12). Adding up these terms over all (cid:101)C ∈ (cid:101)C(cid:96) accounts for the cost of any edge of It follows that the average of the term on the left over all (cid:96) is also a lower bound on the right hand side, which proves the claim. To establish inequality (8) notice that, in any feasible f , flow of value at least has cost at least c(e) ≥ ε0∆(cid:96)/2 by the definition of G. Therefore, the total cost of flow leaving or entering (cid:12)(cid:12)(cid:12)(cid:80) u∈(cid:101)C∩V (cid:101)C is at least ε0∆(cid:96) (cid:12)(cid:12)(cid:12)(cid:80) u∈(cid:101)C∩V (cid:88) u∈(cid:101)C∩V bp(cid:107)p − NL(p)(cid:107)2. (cid:88) (cid:101)C∈(cid:101)C(cid:96) ε0∆(cid:96) p∈P (8) bu bu bu 4 2 G at most twice, and (8) follows. Claim 2. cost(G, b) ≤ γ(cid:107)Bb(cid:107)1 for γ = O(L/ε0) = O(log(∆)/ε0). Proof. We prove the claim by constructing an appropriate feasible flow f . We proceed to construct f by levels, from the bottom up. The construction will be efficient, also proving the claim after "moreover" in the statement of the lemma. On level L, for any p ∈ P , we set fpu = bp, where u = NL(p). Then, for levels (cid:96) = L − 1, L − 2, . . . , 1, we execute the following procedure in every subcell (cid:101)C ∈ (cid:101)C(cid:96)−1. Let us define, for any (cid:4) node u and the current flow f , the surplus (cid:88) fvu − bu = fuv − bu. v:(u,v)∈E δ(u, f ) = (cid:88) fuv − (cid:88) v:(u,v)∈ (cid:126)E v:(v,u)∈ (cid:126)E 10 such that δ(u, f ) > 0 > δ(v, f ), and add min{δ(u, f ),δ(v, f )} units of flow to fvu. Continue until we have I.e. this is how much more flow leaves u than should, as prescribed by b. Pick any two u and v in N(cid:96) ∩ (cid:101)C that for all u ∈ N(cid:96) ∩ (cid:101)C the surpluses δ(u, f ) have the same sign. Since at every step of this procedure we node, we will stop after at most N(cid:96) ∩ (cid:101)C steps. Finally, for the node u ∈ N(cid:96)−1 which is the center of (cid:101)C, and for all nodes v ∈ N(cid:96) ∩ (cid:101)C for which δ(v, f ) (cid:54)= 0, we set fuv = δ(v, f ). After this final step, every node u ∈ N(cid:96) ∩ (cid:101)C has surplus 0. make the surplus of at least one node 0, and we always decrease the absolute value of the surplus at any δ(u, f ) = − (cid:88) v∈(cid:101)C∩V For (cid:96) = 0, we perform essentially the same procedure, but in the entire cell C0. I.e. we pick any two u and v in N(cid:96) ∩ C0 such that δ(u, f ) > 0 > δ(v, f ), and add min{δ(u, f ),δ(v, f )} units of flow to fvu. Once again, after at most N0 steps all surpluses will have the same sign, and, as we show below, will in fact be 0, so f will be feasible. An easy induction argument shows that, once we have processed levels L, L − 1, . . . , (cid:96), for any (cid:96) > 0, the surplus at any node u ∈ NL ∪ . . . ∪ N(cid:96) is 0, and the same is true for the surplus at any p ∈ P . To show that u∈V ∩(cid:101)C δ(u, f ). This the flow f is feasible, it is enough to show that after processing the cell C0 on level 0, all nodes have surplus 0. Notice that, while processing any subcell (cid:101)C, we do not change the total surplus (cid:80) means that, for any (cid:96) > 0, after having processed a subcell (cid:101)C ∈ (cid:101)C(cid:96)−1 with center u, we have bv = − (cid:88) In particular, we have that before we start processing C0, (cid:80) bu = 0. Since, once again, every step we make during the processing of C0 preserves the total surplus, and we stop when all surpluses have the same sign, then at the time we are done it must be the case that every node has surplus 0, and, therefore, f is a feasible flow. Next we bound the cost of the flow f constructed above. The first term on the right hand side of (7) accounts exactly for the cost of the flow on edges incident on points p ∈ P , as we already observed. Let 0 < (cid:96) ≤ L. During each step executed while processing the subcell (cid:101)C ∈ (cid:101)C(cid:96)−1, we pick some u ∈ (cid:101)C ∩ N(cid:96), and add flow of value δ(u, f ) along an edge of cost at most the diameter of (cid:101)C, which is the absolute value of δ(u, f ) never increases while processing (cid:101)C, and by (9) it is bounded from above by (cid:12)(cid:12)(cid:12) before (cid:101)C is processed. Therefore, the cost added to the flow while processing (cid:101)C is bounded (cid:12)(cid:12)(cid:12)(cid:80) δ(u, f ) = −(cid:80) dε0∆(cid:96). Moreover, v:N(cid:96)−1(v)=u u∈N0 v:N(cid:96)(v)=u bu u∈V bv. √ (9) by Adding up these upper bounds on the cost over all subcells in (cid:101)C(cid:96)−1 gives us that the total cost incurred while v:N(cid:96)(v)=u processing subcells on level (cid:96) − 1 is at most √ dε0∆(cid:96) (cid:88) u∈(cid:101)C∩N(cid:96) (cid:88) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:88) (cid:101)C∈(cid:101)C(cid:96) (cid:88) (cid:101)C∈(cid:101)C0 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) bu bu (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) . (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) . (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) . bu (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:88) u∈(cid:101)C∩V (cid:88) u∈(cid:101)C∩V √ Z(cid:96) = dε0∆(cid:96) √ d∆0 Z0 = An analogous argument shows that the total cost incurred while processing C0 is at most Therefore, the cost of f is bounded by (cid:88) p∈P bp(cid:107)p − NL(p)(cid:107)2 + ZL + . . . + Z0 ≤ 4 √ d(L + 1) ε0 (cid:107)Bb(cid:107)1, where the inequality follows by a term by term comparison with (7). (cid:4) 11 The two claims finish the proof of the lemma, together with the observation that the construction of the flow f can be implemented recursively in time O(nε−d log ∆). 0 Our main result for solving the minimum cost flow problem in G follows. Theorem 5. A flow f feasible for the problem (1) -- (4), with cost at most 1 + O(ε) factor larger than the optimal cost, can be computed in time (cid:32) (cid:16) log(∆) (cid:17)(cid:33)(cid:33) . 1 ε2 + log ε0 (cid:32) O log(∆)2 ε2 0 (E + V log(∆)) log(E) Proof. We reformulate the problem as minimizing (cid:107)f(cid:107)c over f ∈ R (cid:126)E satisfying BAf = Bb. Since B has full column rank, the constraint is equivalent to the original constraint Af = b. Moreover, the time for applying BA is bounded by the total number of nonzeros of B and A, which is O(E + V log ∆). By Lemma 5 the assumption of Lemma 4 is satisfied with H = BA, h = Bb, (cid:107) · (cid:107)X = (cid:107) · (cid:107)c and (cid:107) · (cid:107)Y = (cid:107) · (cid:107)1. Therefore, κ(cid:107)·(cid:107)c→(cid:107)·(cid:107)1(H) ≤ γ = O(log(∆)/ε0). This allows us to apply Corollary 1 and get a (1 + ε, εγ−2)- solver with respect to (cid:107) · (cid:107)1 with the running time claimed in the theorem. To get a truly feasible flow f , we compose this solver with the algorithm in Lemma 5 which, for a supplies vector b, computes a feasible flow with cost bounded by γ(cid:107)Bb(cid:107)1 ≤ γ · cost(G, b), and is, therefore, a (γ, 0)-solver. By Theorem 4, this composed algorithm is a (1 + 2ε, 0)-solver. The total running time is dominated by the solver guaranteed by Corollary 1. 5 Generating a Transportation Map Theorem 5 guarantees we can obtain an approximately optimal flow in our graph G in nearly linear time. We wish to turn this flow into a transportation map on P . To accomplish this, we will repeatedly transform our flow into other flows, without increasing the cost, and ending at a flow which is also a transportation map. We will no longer keep the flow supported on the edges of E, and will instead allow positive flow between arbitrary pairs of points. We will gradually make sure that there is positive flow only between points in P (as opposed to net points). We first begin by defining a notion we call uniform flow parity. Definition 4. Given a flow f ∈ RV ×V , and a vertex u ∈ V , f is said to satisfy, or have uniform flow parity at u if for all remaining v ∈ V , fuv has the same sign. In other words, either there is flow going out of v or there is flow going into v, but there is no flow passing through v. The flow f is said to satisfy uniform flow parity if f has uniform flow parity on every v ∈ V . The next easy lemma shows that a flow that satisfies uniform flow parity is supported on edges between contradicts uniform flow parity. vertices with non-zero divergence. Lemma 6. Suppose that a flow f ∈ RV ×V satisfies uniform flow parity at a vertex u ∈ V , and that Proof. Assume, towards contradiction, that f has 0 divergence at u but fuv (cid:54)= 0 for some v ∈ V . Then there v∈V fuv = 0 would not hold. This (cid:80) v∈V fuv = 0. Then fuv = 0 for all v ∈ V . must be some w ∈ V such that fuw has the opposite sign to fuv, or (cid:80) Corollary 2. Let f be a flow on V × V . Suppose that for any u ∈ V \ P ,(cid:80) (cid:80) Proof. By Lemma 6, f is supported on P ×P . Moreover, since for any p ∈ P+ we have(cid:80) We apply Lemma 6 through the following corollary of it. v∈V fpv = µ(p). Then, if f satisfies uniform flow parity, it is a transportation map for P and µ. q∈P fpq = µ(p) > 0, and f satisfies uniform flow parity, it must be the case that fpq ≥ 0 for all q ∈ P . Similarly, for any p ∈ P− it must be the case that fpq ≤ 0 for all q ∈ P , or, equivalently, fqp ≥ 0 for all q ∈ P . It follows that f is in fact supported on P+ × P−, and is, therefore, a transportation map. v∈V fuv = 0 and for any p ∈ P , 12 Let us take a flow f which is an approximately optimal solution to (1) -- (4). We can extend f to V × V by setting fuv = 0 for (u, v) (cid:54)∈ E. If we can transform f into another flow f(cid:48) without increasing its cost, so that f(cid:48) satisfies uniform flow parity, then we can use f(cid:48) as an approximately optimal transportation map. Towards this goal, we define the Cancellation Procedure Cancel-Vertex(f, u), given in Algorithm 1, and analyzed in the following lemma. Algorithm 1 The Cancellation Procedure 1: procedure Cancel-Vertex(f, u) while ∃v, w : fvu > 0 > fwu do 2: 3: 4: x = min{fvu, fuw} fvu ← fvu − x fuw ← fuw − x fvw ← fvw + x 5: 6: 7: 8: end procedure end while Lemma 7. Let f be a flow on V × V , and u ∈ V . The while loop in Cancel-Vertex(f, u) makes at most {v : fuv (cid:54)= 0} many iterations, and, letting f(cid:48) be the flow after the procedure is called, we have the following properties: 1. All divergences are preserved, i.e. for all v ∈ V . w∈V (cid:88) (cid:88) w∈V f(cid:48) vw = fvw 2. The flow f(cid:48) satisfies uniform flow parity at u. 3. If f satisfies uniform flow parity at some vertex v ∈ V , then so does f(cid:48). 4. The size of the support of f is at most that of f(cid:48). 5. The cost of f(cid:48) with respect to the cost function c(u, v) = (cid:107)u − v(cid:107)2 is at most the cost of f . Proof. To bound the number of iterations of the while loop, observe that every iteration sets the flow of at least one edge incident on u to 0, and that the flow on an edge incident on u is modified only if it nonzero. We proceed to prove the other claims. (cid:80) The first claim follows because every iteration of the while loop of the procedure preserves the divergence w∈V fzw at every node z ∈ V : if z = u, then we remove x units of flow going into u, and x units of flow leaving u; otherwise, if z = v or z = w we just redirect x units of flow entering or leaving v to another vertex; finally, if z is any other vertex, then the flow through it is unaffected. The fact that f(cid:48) satisfies uniform flow parity on u follows from the termination condition of the loop. To prove that uniform flow parity is preserved, again we show that this is the case for any iteration of the while loop. For u, we observe that the the flow is unchanged if u already satisfies uniform flow parity. The only other vertices for which the flow on incident edges can be modified during an iteration are v and w. For v, we have that fvu > 0, so, if v has uniform flow parity, then the flow on every edge leaving v must be non-negative. We decrease the value of fvu without making it negative (by the definition of x), and we increase the value of fvw, which was non-negative to begin with. Therefore, uniform flow parity is preserved for v. The argument for w is analogous. To see that that the number of edges in the support of f does not increase, notice that every iteration of the while loop removes at least one edge from the support of f , and adds flow to at most one edge which previously had flow of 0, namely (v, w). Finally, to show that the cost of the flow does not increase, observe that every iteration of the while loop replaces x units of flow of total cost x((cid:107)v − u(cid:107)2 +(cid:107)w − u(cid:107)2) by x units of flow of total cost x(cid:107)w − v(cid:107)2, which is no larger than the original cost by the triangle inequality. 13 Suppose that we maintain f in a sparse representation; namely, we keep an adjacency list of the edges on which f is not zero, with the corresponding flow values. Then, after preprocessing the adjacency list of u in linear time to find the edges with positive and negative flow, every iteration of the while loop in the Cancellation Procedure can be executed in constant time, and the total running time, by Lemma 7, is bounded by O(degf (u)), where degf (u) = {v : fuv (cid:54)= 0}. Corollary 2 and Lemma 7 imply that if we apply the Cancellation Procedure to the flow f and every vertex of the graph G, then the resulting flow has cost no greater than that of f , is supported on a set of edges of size bounded by E, and is a transportation map. In the next theorem, which is our main result for constructing a transportation map from a flow f in G, we show that if we apply the procedure first to netpoints in NL, then to NL−1, etc., then the total running time is nearly linear. Theorem 6. There exists an algorithm running in time O(cid:0)nε−d log(∆) + ε−2dlog(∆)(cid:1) that, given as input a flow f which is feasible for the minimum cost flow problem defined in Section 3.3, outputs a transportation map for P and µ of cost no larger than that of f . Proof. As discussed above, we (mentally) extend f to all of V × V by defining fuv = 0 if (u, v) (cid:54)∈ E. We call Cancel-Vertex(f, u) on f and every net point u ∈ NL in arbitrary order; then we call it on every net point u ∈ NL−1, and so on, finally calling it on every net point in N0. By Lemma 7, after these calls uniform flow parity must hold at all net points. Moreover, it also holds at points in P , since in G they only have a single edge incident on them, so initially uniform flow parity holds trivially, and by Lemma 7 it is not destroyed by later calls to the Cancellation Procedure. Thus, the flow at termination has uniform flow parity at all vertices, and, by Corollary 2, is a transportation map. Since calls to the Cancellation Procedure do not increase the cost of f , the cost of the transportation map is at most the cost of the initial flow. Let us then consider a time step when the Cancellation Procedure has been applied to all net points in N(cid:96)+1 ∪ . . . ∪ NL and some points of N(cid:96), but no points in N0 ∪ . . . ∪ N(cid:96)−1. By Lemma 6, the flow f at such a step is supported on edges incident on N0 ∪ . . . ∪ N(cid:96) ∪ P . Recall that in G net points on level (cid:96) only connect to other net points on the same level and in the same cell, and to parent net points on level (cid:96) − 1. Then we have that for any C ∈ C(cid:96) and the cell C(cid:48) ∈ C(cid:96)−1 containing it, and for any point u ∈ N(cid:96) ∩ C, fuv can be nonzero only for v ∈ (N(cid:96) ∩ C) ∪ (P ∩ C) ∪ (N(cid:96)−1 ∩ C(cid:48))}. Let nbelow(C) = P ∩ C, and recall the notation degf (u) = {v ∈ V : fuv (cid:54)= 0}. We then have that degf (u) ≤ nbelow(C)+2ε−d, which, by Lemma 7, also dominates the running time of the Cancellation Procedure on u. The total complexity of running the Cancellation Procedure on all points in N(cid:96) is then dominated by (cid:88) C∈C(cid:96) 1 εd (nbelow(C) + 2 εd ) = O(ε−dn + ε−2d). Summing the running times over the L + 1 = O(log ∆) levels finishes the proof. Combining Theorem 2, used with ε0 set to a sufficiently small multiple of ε/L, and Theorems 5 and 6 gives the first claim of Theorem 1, but with the approximation holding in expectation. At the cost of increasing ε by a factor of 2, Markov's inequality shows that the approximation also holds with probability at least 1/2. Then the second statement in Theorem 1 follows from the first one, and Lemma 1. References [ABRW18] Jason Altschuler, Francis Bach, Alessandro Rudi, and Jonathan Weed. Approximating the quadratic transportation metric in near-linear time. CoRR, abs/1810.10046, 2018. [AFP+17] Pankaj K. Agarwal, Kyle Fox, Debmalya Panigrahi, Kasturi R. Varadarajan, and Allen Xiao. Faster algorithms for the geometric transportation problem. In Symposium on Computational Geometry, volume 77 of LIPIcs, pages 7:1 -- 7:16. Schloss Dagstuhl - Leibniz-Zentrum fuer In- formatik, 2017. [AHK12] Sanjeev Arora, Elad Hazan, and Satyen Kale. The multiplicative weights update method: a meta-algorithm and applications. Theory of Computing, 8(1):121 -- 164, 2012. 14 [ANOY14] Alexandr Andoni, Aleksandar Nikolov, Krzysztof Onak, and Grigory Yaroslavtsev. Parallel algorithms for geometric graph problems. In STOC, pages 574 -- 583. ACM, 2014. [Aro98] [AS14] Sanjeev Arora. Polynomial time approximation schemes for euclidean traveling salesman and other geometric problems. J. ACM, 45(5):753 -- 782, 1998. Pankaj K. Agarwal and R. Sharathkumar. Approximation algorithms for bipartite matching with metric and geometric costs. In STOC, pages 555 -- 564. ACM, 2014. [BvdPPH11] Nicolas Bonneel, Michiel van de Panne, Sylvain Paris, and Wolfgang Heidrich. Displacement interpolation using lagrangian mass transport. ACM Trans. Graph., 30(6):158:1 -- 158:12, De- cember 2011. [Cha02] [CK93] [FKS84] [GD04] [GV02] [HP11] [Ind07] [IT03] [LCL04] [PA06] [RTG00] [SA12a] [SA12b] [Sch03] [She17] [Vil03] Moses Charikar. Similarity estimation techniques from rounding algorithms. In STOC, pages 380 -- 388. ACM, 2002. Paul B. Callahan and S. Rao Kosaraju. Faster algorithms for some geometric graph problems in higher dimensions. In SODA, pages 291 -- 300. ACM/SIAM, 1993. Michael L. Fredman, J´anos Koml´os, and Endre Szemer´edi. Storing a sparse table with O(1) worst case access time. J. Assoc. Comput. Mach., 31(3):538 -- 544, 1984. Kristen Grauman and Trevor Darrell. Fast contour matching using approximate earth mover's distance. In Computer Vision and Pattern Recognition, 2004. CVPR 2004. Proceedings of the 2004 IEEE Computer Society Conference on, volume 1, pages I -- I. IEEE, 2004. Panos Giannopoulos and Remco C Veltkamp. A pseudo-metric for weighted point sets. European Conference on Computer Vision, pages 715 -- 730. Springer, 2002. In Sariel Har-Peled. Geometric approximation algorithms, volume 173 of Mathematical Surveys and Monographs. American Mathematical Society, Providence, RI, 2011. Piotr Indyk. A near linear time constant factor approximation for euclidean bichromatic match- ing (cost). In SODA, pages 39 -- 42. SIAM, 2007. Piotr Indyk and Nitin Thaper. Fast Image Retrieval via Embeddings. In 3rd International Workshop on Statistical and Computational Theories of Vision, 2003. Qin Lv, Moses Charikar, and Kai Li. Image similarity search with compact data structures. In Proceedings of the Thirteenth ACM International Conference on Information and Knowledge Management, CIKM '04, pages 208 -- 217, New York, NY, USA, 2004. ACM. Jeff M. Phillips and Pankaj K. Agarwal. On bipartite matching under the RMS distance. In CCCG, 2006. Yossi Rubner, Carlo Tomasi, and Leonidas J Guibas. The earth mover's distance as a metric for image retrieval. International journal of computer vision, 40(2):99 -- 121, 2000. R. Sharathkumar and Pankaj K. Agarwal. Algorithms for the transportation problem in geo- metric settings. In SODA, pages 306 -- 317. SIAM, 2012. R. Sharathkumar and Pankaj K. Agarwal. A near-linear time -approximation algorithm for geometric bipartite matching. In STOC, pages 385 -- 394. ACM, 2012. Alexander Schrijver. Combinatorial optimization. Polyhedra and efficiency. Vol. A, volume 24 of Algorithms and Combinatorics. Springer-Verlag, Berlin, 2003. Paths, flows, matchings, Chapters 1 -- 38. Jonah Sherman. Generalized preconditioning and undirected minimum-cost flow. In SODA, pages 772 -- 780. SIAM, 2017. C´edric Villani. Topics in optimal transportation, volume 58 of Graduate Studies in Mathemat- ics. American Mathematical Society, Providence, RI, 2003. 15 A Proof of Lemma 3 The first claim follows from the triangle inequality, since distG(p, q) is the length of a polygonal path between p and q, and (cid:107)p − q(cid:107)2 is the length of the straightline segment between them. length. Observe first that, if u = N(cid:96)−1(v) is the parent net point of some v ∈ N(cid:96), then (cid:107)u − v(cid:107)2 = Similarly, if r ∈ P , then (cid:107)r − N(cid:96)(r)(cid:107)2 ≤ √ For the second claim, it is enough to show that the canonical path between p and q has the required dε0∆(cid:96) . . This shows that dε0∆(cid:96) √ 2 2 (cid:107)N(cid:96)(p,q)(p) − N(cid:96)(p,q)(q)(cid:107)2 ≤ (cid:107)N(cid:96)(p,q)(p) − p(cid:107)2 + (cid:107)p − q(cid:107)2 + (cid:107)q − N(cid:96)(p,q)(q)(cid:107) ≤ (cid:107)p − q(cid:107)2 + dε0∆(cid:96)(p,q). √ Using the canonical path to bound the shortest path distance between p and q in G, we see that distG(p, q) ≤ (cid:107)p − NL(p)(cid:107)2 + (cid:107)N(cid:96)(p) − N(cid:96)−1(p)(cid:107)2 L(cid:88) + (cid:107)N(cid:96)(p,q)(p) − N(cid:96)(p,q)(q)(cid:107)2 + (cid:107)N(cid:96)−1(q) − N(cid:96)(q)(cid:107)2 + (cid:107)NL(q) − q(cid:107)2 (cid:96)=(cid:96)(p,q)+1 (cid:96)=(cid:96)(p,q)+1 L(cid:88) ∆(cid:96)(p,q) + ∆L + L(cid:88) 21−(cid:96)(p,q)∆ + 21−L∆ + (cid:96)=(cid:96)(p,q)+1  L(cid:88) ∆(cid:96)  21−(cid:96)∆ ≤ (cid:107)p − q(cid:107)2 + = (cid:107)p − q(cid:107)2 + √ √ dε0 dε0 √ ≤ (cid:107)p − q(cid:107)2 + dε0∆(21−(cid:96)(p,q) + 21−L + 21−(cid:96)(p,q)) √ ≤ (cid:107)p − q(cid:107)2 + 3 dε0∆(cid:96)(p,q) (cid:96)=(cid:96)(p,q)+1 This shows that, conditional on (cid:96)(p, q), distG(p, q) = (cid:107)p − q(cid:107)2 + O(ε0∆(cid:96)(p,q)). All that remains is to find the expected value of distG(p, q) by taking expectations over the distribution of (cid:96)(p, q). We get that the expected value of distG(p, q) is E[distG(p, q)] ≤ (cid:107)p − q(cid:107)2 + 3 = (cid:107)p − q(cid:107)2 + 3 √ √ dε0E[∆(cid:96)(p,q)] dε0 dε0 dε0 dε0 (cid:96)=0 (cid:96)=0 L−1(cid:88) L−1(cid:88) L−1(cid:88) L(cid:88) L(cid:88) (cid:96)=1 (cid:96)=0 = (cid:107)p − q(cid:107)2 + 3 ≤ (cid:107)p − q(cid:107)2 + 3 = (cid:107)p − q(cid:107)2 + 3 √ √ √ √ ≤ (cid:107)p − q(cid:107)2 + 3 = (1 + 3dε0L)(cid:107)p − q(cid:107)2. dε0 (cid:96)=1 P((cid:96)(p, q) = (cid:96))∆(cid:96) P(C(cid:96)(p) = C(cid:96)(q) ∧ C(cid:96)+1(p) (cid:54)= C(cid:96)+1(q))∆(cid:96) P(C(cid:96)+1(p) (cid:54)= C(cid:96)+1(q))∆(cid:96) P(C(cid:96)(p) (cid:54)= C(cid:96)(q))∆(cid:96) √ d(cid:107)p − q(cid:107)2 ∆(cid:96) ∆(cid:96) The final inequality above follows from Lemma 2. This completes the proof of the lemma. 16 B Sherman's Algorithms To make our paper more self-contained, in this section we briefly sketch a version of the algorithm from Theorem 3 which uses the multiplicative weight update method [AHK12] in a simple way, but achieves a slightly worse running time than the one stated in the theorem. We do not claim any novelty, and everything in this section is due to Sherman. One of Sherman's main results is an analysis of how composing rough solvers affects the error in the In particular, suppose that F is a (1 + ε, ε 2κ )-solver, G is (2, 1 2κ )-solver, and Gt is G κ linear constraints. composed with itself t times. (The notion of composition here is the same one used in Theorem 4.) Then, the composition Gt ◦ F is a (1 + O(ε), ε2−t−1 )-solver. This reduces designing the solver from Theorem 3 to designing a (1 + ε, ε)-solver that performs O(ε−2 log(m)) multiplications with A or A(cid:62) (and possibly lower- order operations). We will sketch how to get a solver whose complexity is instead O(ε−2 log(m) log1+ε(κ)) multiplications with A or A(cid:62). By scaling, we can assume that (cid:107)A(cid:107)(cid:107)·(cid:107)1→(cid:107)·(cid:107)1 ≤ 1, i.e. every column of the matrix A has (cid:96)1-norm bounded by 1. It then follows that for any f that satisfies the constraint Af = b, we have (cid:107)f(cid:107)1 ≥ (cid:107)b(cid:107)1, i.e. the optimal value of the optimization problem (5) -- (6) is at least (cid:107)b(cid:107)1. Moreover, if the condition number of A is κ, then there exists a map S from the span of A, equipped with (cid:96)1, to Rm, equipped with (cid:96)1, such that (cid:107)S(cid:107) ≤ κ and AS(b) = b. It follows that (cid:107)S(b)(cid:107)1 ≤ κ(cid:107)b(cid:107)1, so the optimal value lies in [(cid:107)b(cid:107)1, κ(cid:107)b(cid:107)1]. We can then guess a value in this range (up to a factor of 1 + ε), and reduce the problem to making O(log1+ε κ) calls to an algorithm solving the feasibility problem {f : (cid:107)f(cid:107)1 ≤ t, Ax = b} (cid:54)= ∅. This is the feasibility problem that we will approximately solve using the multiplicative weights framework. In fact, it will be convenient to reformulate the above feasibility problem as {f : (cid:107)f(cid:107)1 ≤ 1, Ax = b/t} (cid:54)= ∅. t b(cid:107)1 ≤ ε In order to get a (1 + ε, O(ε))-solver, it is enough to output an f such that (cid:107)f(cid:107)1 ≤ 1 and (cid:107)Af − 1 whenever the problem is feasible. We will write f = f + − f−, where both f + and f− have non-negative m for all i, and we update them iteratively using the multiplicative weights update method. In each step of the algorithm, we either have (cid:107)Af − 1 t b(cid:107)1 ≤ ε and we are done, or we can find a vector y ∈ {−1, 1}n such that y(cid:62)(Af − b) > ε. We update coordinates and(cid:80)m i = 1. We initialize f + and f− to f + i =(cid:80)m i = f− i=1 f− i=1 f + i = 1 f + i = e−η(A(cid:62)y)i j=1 e−η(A(cid:62)y)j where η is a parameter. If we choose η = ε 2 , a standard analysis of the multiplicative weights method [AHK12] shows that, after O(ε−2 log m) iterations, we would either have (cid:107)A(f + − f−) − 1 t b(cid:107)1 ≤ ε, as desired, or the average ¯y of all vectors y computed so far satisfies ±¯y(cid:62)ai > ¯y(cid:62)b for every column ai of A, certifying that the problem is infeasible. eη(A(cid:62)y)i j=1 eη(A(cid:62)y)j f− i = , , (cid:80)m (cid:80)m 17
0911.1419
2
0911
2010-05-02T15:58:46
Belief Propagation and Loop Calculus for the Permanent of a Non-Negative Matrix
[ "cs.DS", "cond-mat.stat-mech", "cs.DM", "cs.LG", "math.NA", "math.OC" ]
We consider computation of permanent of a positive $(N\times N)$ non-negative matrix, $P=(P_i^j|i,j=1,\cdots,N)$, or equivalently the problem of weighted counting of the perfect matchings over the complete bipartite graph $K_{N,N}$. The problem is known to be of likely exponential complexity. Stated as the partition function $Z$ of a graphical model, the problem allows exact Loop Calculus representation [Chertkov, Chernyak '06] in terms of an interior minimum of the Bethe Free Energy functional over non-integer doubly stochastic matrix of marginal beliefs, $\beta=(\beta_i^j|i,j=1,\cdots,N)$, also correspondent to a fixed point of the iterative message-passing algorithm of the Belief Propagation (BP) type. Our main result is an explicit expression of the exact partition function (permanent) in terms of the matrix of BP marginals, $\beta$, as $Z=\mbox{Perm}(P)=Z_{BP} \mbox{Perm}(\beta_i^j(1-\beta_i^j))/\prod_{i,j}(1-\beta_i^j)$, where $Z_{BP}$ is the BP expression for the permanent stated explicitly in terms if $\beta$. We give two derivations of the formula, a direct one based on the Bethe Free Energy and an alternative one combining the Ihara graph-$\zeta$ function and the Loop Calculus approaches. Assuming that the matrix $\beta$ of the Belief Propagation marginals is calculated, we provide two lower bounds and one upper-bound to estimate the multiplicative term. Two complementary lower bounds are based on the Gurvits-van der Waerden theorem and on a relation between the modified permanent and determinant respectively.
cs.DS
cs
Belief propagation and loop calculus for the permanent of a non-negative matrix Yusuke Watanabe1 and Michael Chertkov2 1 Institute of Statistical Mathematics, 10-3 Midori-cho, Tachikawa, Tokyo 190-8562 Japan. 2 Center for Nonlinear Studies and Theoretical Division, LANL, NM, 87545 also New Mexico Consortium, Los Alamos, NM 87544. E-mail: [email protected], [email protected] Abstract. We consider computation of permanent of a positive (N × N ) non- negative matrix, P = (P j i i, j = 1, · · · , N ), or equivalently the problem of weighted counting of the perfect matchings over the complete bipartite graph KN,N . The problem is known to be of likely exponential complexity. Stated as the partition function Z of a graphical model, the problem allows exact Loop Calculus representation [Chertkov, Chernyak '06] in terms of an interior minimum of the Bethe Free Energy functional over non-integer doubly stochastic matrix of marginal beliefs, β = (βj i i, j = 1, · · · , N ), also correspondent to a fixed point of the iterative message-passing algorithm of the Belief Propagation (BP) type. Our main result is an explicit expression of the exact partition function (permanent) in terms of the matrix of BP marginals, β, as Z = Perm(P ) = ZBP Perm(βj i ), where ZBP is the BP expression for the permanent stated explicitly in terms of β. We give two derivations of the formula, a direct one based on the Bethe Free Energy and an alternative one combining the Ihara graph-ζ function and the Loop Calculus approaches. Assuming that the matrix β of the Belief Propagation marginals is calculated, we provide two lower bounds and one upper-bound to estimate the multiplicative term. Two complementary lower bounds are based on the Gurvits-van der Waerden theorem and on a relation between the modified permanent and determinant respectively. i ))/ Qi,j (1 − βj i (1 − βj Submitted to: J. Phys. A: Math. Gen. 1. Introduction The problem of calculating the permanent of a non-negative matrix arises in many contexts in statistics, data analysis and physics. For example, it is intrinsic to the parameter learning of a flow used to follow particles in turbulence and to cross-correlate two subsequent images [1]. However, the problem is #P -hard [2], meaning that solving it in a time polynomial in the system size, N , is unlikely. Therefore, when size of the matrix is sufficiently large, one naturally looks for ways to approximate the permanent. A very significant breakthrough was achieved with invention of a so-called Fully- Polynomial-Randomized Algorithmic Schemes (FPRAS) for the permanent problem [3]: the permanent is approximated in a polynomial time, with high probability and within an arbitrarily small relative error. However, the complexity of this FPRAS Belief propagation and loop calculus for the permanent of a non-negative matrix 2 is O(N 11), making it impractical for the majority of realistic applications. This motivates the task of finding a lighter deterministic or probabilistic algorithm capable of evaluating the permanent more efficiently. This paper continues the thread of [1, 4] and [5], where the Belief Propagation (BP) algorithm was suggested as an efficient heuristic of good (but not absolute) quality to approximate the permanent. The BP family of algorithms, originally introduced in the context of error-correction codes [6] and artificial intelligence [7], can generally be stated for any graphical model [8]. The exactness of the BP on any graph without loops suggests that the algorithm can be an efficient heuristic for evaluating the partition function or for finding a Maximum Likelihood (ML) solution for the Graphical Model (GM) defined on sparse graphs. However, in the general loopy cases one would normally not expect BP to work well, thus making the heuristic results of [1, 4, 5] somehow surprising, even though not completely unexpected in view of existence of polynomially efficient algorithms for the ML version of the problem [9, 10], also realized in [11] via an iterative BP algorithm. This raises the questions of understanding the performance of BP: what it does well and what it misses? It also motivates the challenge of improving the BP heuristics. An approach potentially capable of handling the question and the challenge was recently suggested in the general framework of GM. The Loop Series/Calculus (LS) of [12, 13] expresses the ratio between the Partition Function (PF) of a binary GM and its BP estimate in terms of a finite series, in which each term is associated with the so-called generalized loop (a subgraph with all vertices of degree larger than one) of the graph. Each term in the series, as well as the BP estimate of the partition function, is expressed in terms of a doubly stochastic matrix of marginal probabilities, β = (βj i i, j = 1, · · · , N ), for matching pairs to contribute a perfect matching. This matrix β describes a minimum of the so-called Bethe free energy, and it can also be understood as a fixed point of an iterative BP algorithm. The first term in the resulting LS is equal to one. Accounting for all the loop-corrections, one recovers the exact expression for the PF. In other words, the LS holds the key to understanding the gap between the approximate BP estimate for the PF and the exact result. In section 2 and section 4, we will give a technical introduction to the variational Bethe Free Energy (BFE) formulation of BP and a brief overview of the LS approach for the permanent problem respectively. Our results. In this paper, we develop an LS-based approach to describe the quality of the BP approximation for the permanent of a non-negative matrix. (i) Our natural starting point is the analysis of the BP solution itself conducted in section 3. Evaluating the permanent of the non-negative matrix, P = ((pj i )1/T i, j = 1, · · · , N ), dependent on the temperature parameter, T ∈ [0, ∞], we find that a non-integer BP solution is observed only at T > Tc, where Tc is defined by (15). (ii) At T > Tc, we derive an alternative representation for the LS in section 5. The entire LS is collapsed to a product of two terms: the first term is an easy-to-calculate function of β, and the second term is the permanent of the matrix, β. ∗ (1 − β) = (βj i )). (The binary operator .∗ denotes the element-wise multiplication of matrices.) This is our main result stated in theorem 3, and the majority of the consecutive statements of our paper follows from it. We also present yet another, alternative, derivation of the theorem 3 using the multivariate Ihara-Bass formula for the graph zeta-function in subsection 5.2. (iii) Section 6 presents two easy-to-calculate lower bounds for the LS. The lower bound stated in the corollary 7 is based on the Gurvits-van der Waerden theorem applied to Perm(β. ∗ (1 − β)). Interestingly enough this lower bound is i (1 − βj Belief propagation and loop calculus for the permanent of a non-negative matrix 3 invariant with respect to the BP transformation, i.e. it is exactly equivalent to the lower bound derived via application of the van der Waerden-Gurvits theorem to the original permanent. Another lower bound is stated in theorem 8. Note, that as follows from an example discussed in the text, the two lower bounds are complementary: the latter is stronger at sufficiently small temperatures, while the former dominates the large T region. (iv) Section 7 discusses an upper bound on the transformed permanent based on the application of the Godzil-Gutman formula and the Hadamard inequality. Possible future extensions of the approach are discussed in section 8. 2. Background (I): Graphical Models, Bethe Free energy and Belief Propagation. Permanent of a non-negative matrix, P = ((pj i , 0 ≤ T ≤ ∞), is a sum over the set of permutations on {1, . . . , N }, which can be parameterized via binary-component vectors, σ, corresponding to perfect matchings (PM) on the complete bipartite graph KN,N : i )1/T i, j = 1, · · · , N ) (0 ≤ pj   σ = (σj i ) ∈ {0, 1}N ×N(cid:12)(cid:12)(cid:12) ∀i : N Xj=1 σj i = 1, ∀j : N Xi=1 . (1) σj i = 1  This binary interpretation allows us to represent the permanent as the partition function (PF), Z, of a probabilistic model over the set of perfect matchings. Each perfect matching, σ, is realized with the probability P(σ) = 1 Z P σ; P σ ≡ Y(i,j)∈E (pj i )σj i /T , Z ≡ Xσ:P M (pj i )σj i /T = Perm(P ), (2) In the zero-temperature where E = {(i, j) i, j = 1, . . . , N } is the edges of KN,N . limit, T → 0, (2) selects one special ML solution, σ∗ = arg maxσ P σ. (Here and below we assume that P is non-degenerate, in the sense that at T → 0, P(σ) → 0 for ∀ σ 6= σ∗.) For a generic GM, assigning (un-normalized) weight P σ to a state σ, one defines exact variational (called Gibbs, in statistical physics, and Kullback-Leibler in statistics) functional F{b(σ)} ≡ T Xσ b(σ) ln b(σ) P σ . (3) One finds that under condition that the belief, b(σ), understood as a proxy to the probability P(σ), is normalized to unity, Pσ∈P M b(σ) = 1, the Gibbs functional is convex and it achieves its only minimum at b(σ) = P(σ) and F{P} = −T ln Z. BP method offers an approximation which is exact when the underlying GM is a tree. As shown in [8], the BP approach can also be stated for a general GM as a relaxation of the Gibbs functional (3). In this paragraph we briefly review the concept of [8] with application to the permanent problem. For the GM (2), the BP approximation for the state beliefs becomes b(σ) ≈ bBP (σ) = Qi bi(σi)Qj bj(σj ) i ∈ {0, 1}j = 1, · · · , N ) s.t. Pj σj Q(i,j)∈E bj i (σj i ) , i ∈ {0, 1}i = i = 1, i.e. σi and σj each has only N allowed states corresponding i = 1 and σj = (σj (4) where ∀i, j: σi = (σj 1, · · · , N ) s.t. Pi σj Belief propagation and loop calculus for the permanent of a non-negative matrix 4 to allowed local perfect matchings for the vertices i and j respectively. The vertex and edge beliefs are related to each other according to ∀(i, j) ∈ E : bj i (σj i ) = Xσi\σj i bi(σi) = Xσj \σj i bj(σj), and the beliefs, as probabilities, should also satisfy the normalization conditions: ∀(i, j) ∈ E : i (1) + bj bj i (0) = 1. (5) (6) Note, that our notations for beliefs are not identical to ones used in [8]: the multi- variable beliefs, bi, are associated with vertexes of KN,N , and the single-variable beliefs, bj i are associated with edges of the graph. Substituting (4) into (3) and i ) etc, one arrives at the BFE i )f (σj bj i (σj approximating Pσ∈P M b(σ)f (σj i ) with Pσj i functional FBP {bj i (σj i ); bi(σi); bj(σj )} ≡ E − T S, E ≡ X(i,j) bj i (1) log(pj i ), (7) (8) S ≡ X(i,j)Xσj i i (σj bj i ) ln bj i (σj i ) −Xi Xσi bi(σi) ln bi(σi) −Xj Xσj bj(σj ) ln bj(σj ). Note that the BFE functional is bounded from below and generally non-convex, and thus finding the absolute minimum of the BFE is the main task of the BFE approximation. The BP approximation ZBP of the partition function is given by FBP = −T ln ZBP at a minimum of the BFE. Moreover, the variational formulation of (5,6,7,8) can be significantly simplified i ) solely in terms in our case; one can utilize (5,6) and express bi(σi), bj(σj) and bj of the βj i (σj i (1) variables, satisfying doubly-stochastic constraints i ≡ bj ∀(i, j) ∈ E : 0 ≤ βj i ≤ 1; The entropy (8) becomes S{βj i log βj i } = X(i,j)(cid:16)βj = X(i,j)(cid:16)(1 − βj i + (1 − βj i ) log(1 − βj i ) ln(1 − βj i ) − βj i ln βj βj i = 1; ∀i :Xj i )(cid:17) −Xi Xj i(cid:17) . βj i = 1. (9) ∀j :Xi βj i log βj i −Xj Xi βj i log βj i (10) Therefore, the Bethe-Free energy approach applied to the GM (2) results in minimization of the following Bethe-Free Energy (BFE) functional FBP {β} = T X(i,j)∈E βj i ln βj i i )1/T (pj − (1 − βj i ) ln(1 − βj i )! , (11) over β = (βj i ) under the constraints (9). To analyze the minima of the BFE, we incorporate Lagrange multipliers µi, µj enforcing the constraints in (9). Looking for a stationary point of the Lagrange function over the β variables, one arrives at the following set of quadratic equations for each (of N 2) variables, βj i ∀(i, j) ∈ E : i (1 − βj βj i ) = (pj (12) One observes that any solution of (9,12) at T > 0, that contains at least one βj is not integer, does not contain any integers among all βj i which i . In fact, our main focus i )1/T exp(cid:0)µi + µj(cid:1) . Belief propagation and loop calculus for the permanent of a non-negative matrix 5 Figure 1. This figure contains a set of illustrations based on the homogeneous example 1 discussed in the text. N = 10 and W = 2 are chosen for these illustrations. Figure 1b shows T ln Z for the homogeneous model (red) and respective BP expression, T ln ZBP (blue) as functions of the temperature, T . Green dash line mark Tc. figure 1c shows comparison of different estimations of ln(Perm(β. ∗ (1 − β))/ Q(i,j)(1 − βj i )) vs the temperature parameter T , where β is the matrix of marginal beliefs evaluated at a fixed point of BP equations. Red, Blue, Purple, Green and Dashed-Gray lines show the exact expression, the lower bound of the corollary 7, the lower bound of the theorem 8, the upper bound of the proposition 9 and the BP expression, respectively. −4 −8 0 T=Tc T=1.5*Tc T=2*Tc 7.3 7.2 7.1 7.0 5 0 -5 0.04 0.08 6.9 0.0 0.1 0.2 0.3 0.4 0.35 0.40 0.45 0.50 (a) FBP vs ǫ. (b) T ln Z vs T . (c) ln(Z/ZBP ) vs T for differ- ent estimators. will be on these non-integer (interior) solutions of (9,12). To find a solution of BP (9,12) one relies on an iterative procedure. For a description of a set of iterative BP algorithms convergent to a minimum of the BFE for the perfect matching problem we refer the interested reader to [1, 4, 5]. Remark 1 Note that just derived BP approximation differs from the so-called Mean- Field (MF) approximation corresponding to the following ansatz b(σ) ≈ bMF (σ) = Y(i,j)∈E bj i (σj i ), (13) enforcing statistical independence of the edge beliefs. If one substitutes b(σ) by bMF (σ) in (3) and also accounts for the normalization condition (6), which may be understood here as one enforcing the "Fermi exclusion principle" for an edge (i, j) to contribute a perfect matching, σj i = 1, the resulting expression for the MF free energy will turn into BP expression (11) with the first term there changing sign to −. One expects that BP approximation outperforms MF approximation in accuracy. Consider, for example, N = 10 and βj i = 1/N , then the exact, BP and MF entropies are ln(10!) ≈ 15.10, 100(.9 ln(.9) − .1 ln(.1)) ≈ 13.54 and 100(−.9 ln(.9) − .1 ln(.1)) ≈ 32.50, respectively. An intuitive explanation for MF overestimating the entropy term is related to the fact that MF ignores correlations related to competitions between neighboring edges for contributing a perfect matching. 3. Threshold Behavior of BP at Low Temperatures As discovered in [11], at T = 0, properly scheduled iterative version of BP converges efficiently to the ML solution of the problem. In this context it is natural to ask the question of how a non-integer solution of BP emerges with a temperature increase. To address this question, we first consider the following homogeneous example. Belief propagation and loop calculus for the permanent of a non-negative matrix 6 Example 1 Define a homogeneous weight model biased toward a perfect matching solution, σj i = δj i = W (W > 1). Looking for β in the homogeneous form i = 1 if i 6= j and pi : pj i βj i (T ) =(cid:26) 1 − ǫ(N − 1) ǫ :if i = j :otherwise, (14) 6= 0, 1 for all (i, j) ∈ E, turns exactly into the isolated/trivial ML one, βj one observes that this ansatz for β solves the BP (9,12) at ǫ equal to ǫmin = (N − 1 − W 1/T )/((N − 1)2 − W 1/T ). At T = ∞, the probabilities are uniform, i.e. β from (14) with ǫ = ǫmin is βj i = 1/N for all (i, j) ∈ E. Now consider lowering the temperature and observe that at Tc = ln W/ ln(N −1) the nontrivial solution, with βj i = δj i . i Obviously one finds that the BFE, FBF , considered as a function of ǫ, achieves its minimum at ǫ = ǫmin if T > Tc. Exactly at T = Tc this ǫmin = 0 and the nontrivial solution merges into the isolated ML solution. The dependence of the BFE on ǫ for different T (at some exemplary values of N and W ) is shown in figure 1a. The partition function can be calculated efficiently. Counting the configurations straightforwardly (in a brute force combinatorial manner), one derives Z = PN The following recursion is used to evaluate the number of permutations coefficient, Dk: ∀ k ≥ 2, Dk = (k − 1)(Dk−1 + Dk−2), D0 = 1, D1 = 0. A comparison of T ln Z and T ln ZBP as functions of T is shown in figure 1b. k=0 W (N −k)/T(cid:0)N k(cid:1)Dk. Returning to the case of an arbitrary nonnegative P , we discover that this phenomenon of the nontrivial solution splitting at some finite nonzero (!!) temperature from the ML configuration is generic. Proposition 1 For any non-negative matrix P = ((pj i )1/T i, j = 1, · · · , N ) one finds a special (we call it critical) temperature, Tc, such that for T > Tc + ε a nontrivial solution of BP, corresponding to a local non-saturated minimum of FBP , dominating the respective value corresponding to the maximum likelihood solution, is realized for at least a sufficiently small positive ε. This special solution coincides with the best perfect matching solution at T = Tc and it does not exist for T < Tc. The critical temperature Tc solves ∗i P j where σ∗ is the ML configuration. i − 2σ j det(P j i ) = 0, (15) i = βj ∗i = δj i (1 − βj i )[1 − 4vj i . We introduce vj Proof: Our proof of the proposition is constructive. Let us look for a solution of the BP equations weakly deviating from the ML configuration σ∗. Without loss of generality we assume that σ j i ) ≪ 1 and observe that a nontrivial solution, approaching the ML one at v → 0, is βj i = (1 − (1 − 2δj i ]1/2)/2. Linearizing the normalization condition, over v one derives, ∀i : vi i On the other hand, the BP equation (12), complemented by the set of linear constraints on v, translates into, ∀i : P i i Ui, where Ui = exp(µi) and U j = exp(µj). Requiring that the later equations have a nontrivial solution (with nonzero v), one arrives at the critical temperature condition, (15). It is then straightforward to verify that the extension of the nontrivial solution into the T < Tc domain is unphysical (as some elements of the respective small v solution are negative), while the BFE associated with the nontrivial solution for T > Tc is smaller than the one corresponding to the ML perfect matching. j = Pi6=j vj j Uj = Pi6=j P j i U i = Pj6=i P j i = Pj6=i vj ∀j : P j i U j; i ; ∀j : vj Belief propagation and loop calculus for the permanent of a non-negative matrix 7 Conjecture 2 We conjecture that the non-integer solution of BP equations discussed in proposition 1 extends beyond the small Tc + ε vicinity of Tc, and this solution transitions smoothly at T → ∞ into the obvious fully homogeneous solution, βj i = 1/N for all (i, j) ∈ E. Another plausible conjecture is that no other non-integer solutions exist at T < Tc; therefore when the non-integer solution discussed in the proposition emerges at T = Tc it, in fact, gives a global minimum of the BFE. 4. Background (II): Loop Calculus and Series Here we consider T > Tc where, according to the main result of the previous section, there exists a solution of (9,12) lying in the interior of the doubly-stochastic-matrix polytope. We assume that such a nontrivial solution of the BP equations is found. As shown in [12, 13], the exact partition function of a generic GM can be expressed in terms of a LS, where each term is computed explicitly using the BP solution. Adapting this general result to the permanent, bulky yet straightforward algebra leads to the following exact expression for the partition function Z from (2): Z/ZBP = zLS; rC ≡ Yi∈C rC , zLS ≡ 1 + XC6=∅ (1 − qi)! (1 − qj) Yj∈C  Y(i,j)∈C βj i 1 − βj i . (16) The variables β are in accordance with (9,12) and C stands for an arbitrary generalized loop, defined as a subgraph of the complete bipartite graph with all its vertices having a degree larger than 1. The qi (or qj) in (16) are the C-dependent degrees, i.e. qi = Pj(i,j)∈C 1 and qj = Pi(i,j)∈C 1. According to (16), those loops with an even/odd number of vertices give positive/negative contributions rC . 5. Loop Series as a Permanent This section, explaining the main result of the paper, is split in two parts. In subsection 5.1 we give a simple derivation of a very compact representation for the LS (16) following directly from the BFE formulation. Subsection 5.2 contains an alternative derivation of this main formula from LS using the concept of the Ihara-Bass graph ζ-function [14, 15]. We also find it appropriate here to make the following general remark. Even though discussion of the manuscript is limited to permanents, counting perfect matchings over KN,N , all the results reported in this section allows straightforward generalizations to weighted counting of perfect matchings over arbitrary (and not necessarily bipartite) graphs. 5.1. Permanent representation for Z/ZBP Theorem 3 For any non-integer solution of the BP equations, (9,12), the following is true: Perm(P )/ZBP = Perm(β. ∗ (1 − β)) Y(i,j)∈E (1 − βj i )−1, (17) where A. ∗ B is the element-by-element multiplication of the A and B matrices. Belief propagation and loop calculus for the permanent of a non-negative matrix 8 Proof: From the definition of the BFE, FBP = −T ln ZBP , and (9,12) one derives i )(cid:16) (pj i )1/T βj i (1 − βj i )(cid:17)βj ZBP = Y(i,j)∈E"(1 − βj Qi exp(−µi)Qj exp(−µj). Combining the two formulas we arrive at (17). i# = Y(i,j)∈E On the other hand (12) e−µiYj i )Yi (1 − βj e−µj . Remark 2 Note that if one considers expanding the permanent on the rhs of (17) over the elements of the matrix β. ∗ (1 − β), each element of the expansion will be positive, in the contrast with the LS of (16). Moreover, the number of terms in the Perm-expansion is significantly smaller than in the original LS. results in, Perm(P ) = Perm(β. ∗ (1 − β)) 5.2. From LS to the permanent representations for Z/ZBP Here we discuss the relation between the two complementary representations of Z/ZBP , i.e. between the LS expression (16) and the permanent formula (17). We do this in two steps, stated in the two theorems presented consequently, one relating the LS to an average of a determinant, and another one expressing it via the permanent of β. ∗ (1 − β). Theorem 4 (LS as Average of Determinant) Let ~E be the set of directed edges obtained by duplicating undirected edges E of KN,N . Define the edge-adjacency matrix M of the complete bipartite graph KN,N according to Mi→j,k→l = δl,i(1 − δj,k). Let x = (xi→j )(i→j)∈ ~E be the set of random variables that satisfies hxi→j i = 0, hxi→j xj→ii = 1 and hxi→j xk→li = 0 ({i, j} 6= {k, l}). (Here and below h· · ·ix stands for the mathematical expectation over the random variables x.) Then the following relation holds: zLS = hdet[I − iBM]ix, where B = diag(qβj i /(1 − βj i )xi→j ). Proof: For a general undirected graph G, the Ihara-Bass formula [14, 15] states that ζ−1 G (u) = det[I − uM] = (1 − u)E−V det[I + u2(D − I) − uA], (18) where A is the adjacency matrix and D = diag(qi; i ∈ V ) is the degree matrix of G. If we take the limit u → ∞, this formula implies det M = (−1)EQi∈V (1 − qi). Expanding the determinant, one derives n det[I − iBM] = X{e1,...,en}⊂ ~E det M{e1,...,en}(−i)k (B)el,el. (19) Yl=1 Evaluating the expectation of each summand in (19), one observes that it is nonzero only if (i → j) ∈ {e1, . . . , en} implies (j → i) ∈ {e1, . . . , en}, thus arriving at hdet[I − iBM]ix = XC⊂E (−1)C det MC Y(i,j)∈C βj i 1 − βj i = 1 + X∅6=C⊂E rC . Theorem 5 (From LS to Permanent) For the doubly stochastic matrix of BP beliefs, β, and LS defined in (16), one derives zLS = Perm(β. ∗ (1 − β)) Y(i,j)∈E (1 − βj i )−1. Belief propagation and loop calculus for the permanent of a non-negative matrix 9 Proof: We use theorem 4, choosing the random variables xj i = xi→j = xj→i that take ±1 values with probability 1/2. We also utilize a multivariate version of the Ihara-Bass formula from [16] to derive the following expression for zLS proving the theorem 0 det[I − iBM] = det(cid:20) zLS = hdet(pβ. ∗ (1 − β). ∗ x)2ix Y(i,j) (pβ. ∗ (1 − β). ∗ x)T pβ. ∗ (1 − β). ∗ x 0 (cid:21) Y(i,j)∈E (1 − βj i )−1, (1 − βj i )−1 = Perm(β. ∗ (1 − β))Y(i,j) (1 − βj i )−1. 6. Invariance of the Gurvits-van der Waerden lower bound and new Lower Bounds for the Permanent Van der Waerden [17] conjectured that the minimum of the permanent over the doubly stochastic matrices is N N /N !, and it is only attained when all entries of the matrix are 1/N . Though the conjecture appears to be simple, it remained open for over fifty years before Falikman [18] and Egorychev [19] finally proved it. Recently Gurvits [20] found an alternative, surprisingly short and elegant proof, that also allowed a number of unexpected extensions of the Van der Waerden conjecture. We call it the Gurvits- van der Waerden theorem. (See e.g. [21].) A simplified form of this theorem is as follows. Theorem 6 (Gurvits-van der Waerden theorem [20, 21]) For an arbitrary non- negative N × N matrix A, Perm(A) ≥ cap(pA) N N N ! , where pA(x) ≡Yi Xj ai,jxj, cap(pA) ≡ inf x∈RN >0 We have found that the lower bound of the theorem 6 has a "good" property with respect to the BP transformation. As stated in theorem 3, BP transforms the permanent to another permanent. Therefore, applying theorem 6 to both sides of (17), one naturally asks how do the two lower bounds compare? A somewhat surprising result is that the Gurvits-van der Waerden theorem is invariant with respect to the i )−1. The BP transformation. Namely, cap(pP ) = ZBP ∗ cap(pβ.∗(1−β))Q(i,j)∈E(1 − βj lower bound for Perm(β. ∗ (1 − β)) based on the theorem 6 is . pA(x) Qj xj Corollary 7 Perm(β. ∗ (1 − β)) ≥ N ! N N Y(i,j)∈E (1 − βj i )βj i βj Proof: This bound is the result of a direct application of the inequality, Pj βj i )xj ≥Qjh(1 − βj We also obtain another lower bound which improves the bound of corollary 7 at i )xjiβj , to theorem 6. i (1 − i sufficiently low values of the temperature. See figure 1c for an illustration. Theorem 8 For an arbitrary perfect matching Π (permutation of {1, . . . , N }), Perm(β. ∗ (1 − β)) ≥ 2Yi βΠ(i) i (1 − βΠ(i) i ) Belief propagation and loop calculus for the permanent of a non-negative matrix 10 where Xij = δi,j + (1 − 2δi,j)βj Proof: Without loss of generality, we assume that Π is the identity permutation. i Perm(X), i . Since β is a stochastic matrix, det X = 0, and thus From the positivity of entries and (9), we have Perm(β. ∗ (1 − β)) ≥ Qi βi Perm(X) ≥ 2Qi(1 − βi Note, for the sake of completeness, that a comprehensive review of other bounds on permanents of specialized matrices (for example 0, 1 matrices) can be found in [22]. i ). 7. New Upper Bound for Permanent Proposition 9 Perm(β. ∗ (1 − β)) ≤Yj (1 −Xi (βj i )2). Proof: We use the Godzil-Gutman representation for permanents [23] (20) where σj i = ±1, with i, j = 1, . . . , N are independent random variables taking values Perm(β. ∗ (1 − β)) = hdet(pβ. ∗ (1 − β). ∗ σ)2iσ, i ) = 1 −Pi(βj ±1 equal probability. Each row of the matrixpβ. ∗ (1 − β).∗σ has the squared Euclid normPi βj i )2. Therefore, the upper bound is obtained from the Hadamard inequality, det(a1, . . . , an) ≤k a1 k · · · k an k. i (1 − βj 8. Path Forward We consider this study to be the beginning of further research along the following lines: (1) More detailed analysis of the BP solution. In particular, study of Tc, e.g. concerning its dependence on the matrix size; analysis of the BP solution dependence on temperature; and the construction of an iterative algorithm provably convergent to a nontrivial BP solution for T > Tc. (2) Explanation of the BP invariance with respect to the Gurvits-van der Warden lower bound. (3) Development of a deterministic and/or randomized polynomial algorithm for estimating the permanent with provable guarantees based on the loop calculus expression. (4) Numerical tests of the lower and upper bounds for realistic large scale problems. Acknowledgments We are thankful to Leonid Gurvits for educating us, through his course of Lectures given at CNLS/LANL, about existing approaches in the "mathematics of the permanent". YW acknowledges support of the Students Visit Abroad Program of the Graduate University for Advanced Studies which allowed him to spend two months at LANL and he is also grateful to CNLS at LANL for its hospitality. Research at LANL was carried out under the auspices of the National Nuclear Security Administration of the U.S. Department of Energy at Los Alamos National Laboratory under Contract No. DE C52-06NA25396. MC also acknowledges partial support of NMC via the NSF collaborative grant, CCF-0829945, on "Harnessing Statistical Physics for Computing and Communications". Belief propagation and loop calculus for the permanent of a non-negative matrix 11 References [1] Chertkov M, Kroc L, Krzakala F, Vergassola M and Zdeborova L 2010 Proceedings of National Academy of Sciences 107(17) 7663 -- 7668 (Preprint arxiv:0909.4256) [2] Valiant L 1979 Theoretical Computer Science 8 189201 [3] Jerrum M, Sinclair A and Vigoda E 2004 J. ACM 51 671 -- 697 ISSN 0004-5411 [4] Chertkov M, Kroc L and Vergassola M 2008 Belief propagation and beyond for particle tracking, arxiv:0806.1199 (Preprint arxiv:0806.1199) [5] Huang B and Jebara T 2009 Approximating the permanent with belief propagation, arxiv:0908.1769 (Preprint arxiv:0908.1769) [6] Gallager R 1963 Low density parity check codes (MIT Press, Cambridge, MA) [7] Pearl J 1988 Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference (San Francisco: Morgan Kaufmann Publishers, Inc.) [8] Yedidia J S, Freeman W T and Weiss Y 2005 Information Theory, IEEE Transactions on Information Theory 51 2282 -- 2312 [9] Kuhn H W Naval Research Logistics Quarterly [10] Bertsekas D 1992 Comput. Optimiz. Applic. 1 7 -- 66 [11] Bayati M, Shah D and Sharma M 2008 IEEE Transactions on Information Theory 54 1241 -- 1251 proc. IEEE Int. Symp. Information Theory, 2006 [12] Chertkov M and Chernyak V 2006 Physical Review E 73 065102(R) [13] Chertkov M and Chernyak V Y 2006 Journal of Statistical Mechanics: Theory and Experiment P06009 (Preprint arXiv:cond-mat/0603189) [14] Ihara Y 1966 Journal of the Mathematical Society of Japan 18 219 -- 235 [15] Bass H 1992 Internat. J. Math 3 717 -- 797 [16] Watanabe Y and Fukumizu K 2009 Advances in Neural Information Processing Systems 23 2017 -- 2025 [17] van der Waerden B 1926 [Aufgabe] 45, Jahresbericht der Deutschen Mathematiker-Vereinigung 35 117 [18] Falikman D 1981 Mathematical Notes 29 475 -- 479 URL http://www.springerlink.com/ content/h41162g677317110/ [19] Egorychev G 1981 Siberian Mathematical Journal 22 854 -- 859 URL http://www.springerlink. com/content/k692377516k1x778/ [20] Gurvits L 2008 Electronic Journal of Combinatorics 15 R66 URL http://www.emis.ams.org/ journals/EJC/Volume_15/PDF/v15i1r66.pdf [21] Laurent M and Schrijver A 2009 On Leonid Gurvits' proof for permanents, URL http: //homepages.cwi.nl/~lex/files/perma5.pdf [22] Lov´asz L and Plummer M 1986 Matching theory (North-Holland Mathematics Studies vol 121) (Elsevier) Annals of Discrete Mathematics 29 [23] Godsil C D and Gutman I 1981 Journal of Graph Theory 5 137 -- 144
1205.4363
1
1205
2012-05-19T22:00:51
Detours in Scope-Based Route Planning
[ "cs.DS" ]
We study a dynamic scenario of the static route planning problem in road networks. Particularly, we put accent on the most practical dynamic case - increased edge weights (up to infinity). We show how to enhance the scope-based route planning approach presented at ESA'11 to intuitively by-pass closures by detours. Three variants of a detour "admissibility" are presented - from a simple one with straightforward implementation through its enhanced version to a full and very complex variant variant which always returns an optimal detour.
cs.DS
cs
Detours in Scope-Based Route Planning⋆ Petr Hlinen´y and Ondrej Moris Faculty of Informatics, Masaryk University Botanick´a 68a, 602 00 Brno, Czech Republic [email protected], [email protected] Abstract. We study a dynamic scenario of the static route planning problem in road networks. Particularly, we put accent on the most prac- tical dynamic case -- increased edge weights (up to infinity). We show how to enhance the scope-based route planning approach presented at ESA'11, [16] to intuitively by-pass closures by detours. Three variants of a detour "admissibility" are presented -- from a simple one with straight- forward implementation through its enhanced version to a full and very complex variant variant which always returns an optimal detour. 1 Introduction Route planning has many important everyday applications. In fact, it is a single pair shortest path (SPSP) problem in real-world road networks. There are several specific variations of this problem. Particularly, there are two route planning variants and two scenarios. First, in a time-independent variant which is studied in our paper, chosen cost function does not depend on time while in a more challenging time-dependent variant it does -- i.e., costs of a route depends on departure time. Secondly, a route planning scenario is static if a road network is fixed while in a dynamic scenario costs or even an overall is changing predictably (traffic jams, turn-angle limits) or unexpectedly (car accidents). Complexity of the problem depends varies in different combinations of a vari- ant and a scenario. The very basic static time-independent route planning re- ceived a lot of attention during the last decades and hence we focus on dynamic time-independent route planning which is more complicated but also more real- istic. Furthermore, we believe it has one of the best practical motivations among all route planning variations. Unfortunately, neither classical graph algorithms for SPSP problem such as Dijkstra's [1], A* [3] algorithm nor their dynamic adaptions [2] are well suitable even for time-independent route planning. It is mainly because graphs representing real-world road network are very huge. Clearly, a feasible solution lies in splitting algorithms in two phases since route planning problem instances are mostly solved on a single road network. First, in a preprocessing phase, we invest some time to exploit auxiliary data from a road network. Secondly, these auxiliary data are utilized to improve both time and space complexity of subsequent instances of the problem -- queries. ⋆ Research supported by the Czech Science Foundation, grant P202/11/0196. Related Work. This technique led to several very interesting static approaches in the last decade, we refer our reader to surveys [13,14]. Unfortunately, most of the recently developed techniques require a rather unrealistic assumption -- static road networks. Modifying static approaches for dynamic road networks is much harder than one might expect because dynamic changes invalidate prepro- cessed data. Nevertheless, there are modifications already proven to work in a dynamic scenario such as, for instance, highway-hierarchies [10,12], ALT [9,11] or geometric containers [6,8]. Even though this paper does not deal with time- dependent route planning, we refer to [14] for more details on this complicated topic. Recently, in order to fill a gap between a variety of exact route planning approaches, we have published [16] a different novel approach aimed at "reason- able" routes. It is based on a concept of scope, whose core idea can be informally outlined as follows: The edges of a road network are associated with a scope map such that an edge e assigned scope se is admissible on a route R if, before or after reaching e, such R travels distance less than a value associated with se on edges with scope higher than se. The desired effect is that low-level roads are fine near the start or target positions, while only roads of the highest scope are admissible in the long middle sections of distant routing queries. Overall, this nicely corresponds with human thinking of intuitive routes, and allows for a very space-efficient preprocessing, too. New Contribution. We present a dynamic adjustement of aforementioned ad- missibility concept along with a simple modification of scope-based Dijkstra's algorithm. We allow a reasonably small number of road closures in a road net- work and out approach can be straightforwardly generalized also for slowed- down roads. We present three definition of admissile detours -- from the simple one with efficient implementation with time and space complexity of the orig- inal scope-based Dijkstra's algorithm, though its enhanced version to the full and most complex one which always ensures the existence of a detour. We have briefly experimentally evalueted implementation of the first and second defini- tions with very promising results and have also incorporated these algorithms into scope-based route planning approach. 2 Fundamentals Graphs and Walks. A directed graph G is a pair of a finite set V (G) of vertices and a finite multi-set E(G) ⊆ V (G) × V (G) of edges. A walk P ⊆ G is an alternating sequence (u0, e1, u1, . . . , ek, uk) of vertices and edges of G such that ei = (ui−1, ui) for i = 1, . . . , k. To point out the start vertex u = u0 and the end v = uk, we say P is a u-v walk. A subwalk Q ⊆ P is Q = (x = ui, ei+1, . . . , uj = y) for some 0 ≤ i ≤ j ≤ k, and it is referred to as Q = P xy (for simplicity, possible ambiguity with exact reference to the position of x, y in P is neglected). The weight of a walk P ⊆ G w.r.t. a weighting w : E(G) 7→ R of G is defined as P w = w(e1) + w(e2) + · · · + w(ek) where P = (u0, e1, . . . , ek, uk). An optimal walk between two vertices achieves the minimum weight over all walks. 2 Road Networks. A road network is referred to as a pair (G, w). Naturally, G is a directed graph G such that the junctions are represented by V (G) and the roads by E(G)). Moreover, G is assigned a non-negative edge weighting w representing chosen cost function (or a suitable combination of cost functions). Problem Formulation. Given a road network (G, w) and start and target vertices s, t ∈ V (G), find a walk from s to t optimal with respect to given optimality criteria. Regarding a weighting function, there are two variants of the problem -- in a time-independent one, w : E(G) 7→ R+ 0 , while in time-dependent, w : E(G)× N0 7→ R+ 0 depends on discrete departure time slots (or their linear interpolation, see [14]). Moreover, there are two route planning scenarios -- in a static one, both G and w are fixed during all queries. On the other hand, G and w may change either predictably (e.g. rush hours) or unexpectedly (e.g. car accidents) in a dynamic scenario; the updated road network is denoted by (G∗, w∗). In this paper, we study a specific version of the time-independent dynamic route planning problem: the underlying graph G remains static and w is only allowed to increase. Formally, G∗ = G and w∗ : E(G) 7→ R+ 0 ∪{∞}, w∗(e) ≥ w(e) for all e ∈ E(G) (particularly, w∗(e) = ∞ implies that e is "closed"). The choice of this version is driven by typical real-world situations. To advocate this simply and informally, occasions on which a road is improved or a new one built are much less frequent than temporary road closures. We thus for simplicity omit the possibility of adding new edges to G in this paper, though we keep in mind that locally adding an edge may be necessary, e.g., to designate a detour. We note again that we do not deal with the full power of time dependent planning as [14], mainly due to a totally different conceptual view of the latter and also due to the fact that it is not well understood yet. Still, our dynamic sce- nario can incorporate some aspects of time-dependent weghting function, namely on-demand reflection of rush hours on selected edges (i.e., busy roads). Finally, we assume familiarity with classical Dijkstra's algorithm and its bidi- rectional variants (otherwise see Appendix A) for shortest paths. 2.1 Scope-Based Route Planning in a Nutshell A simplified version of the recently introduced scope concept [16] is very briefly recapitulated here. We strongly recommend reading the original paper [16] for better understanding and more detailed treatment. Due to lack of space, many details are omitted here. The purpose of introducing scope has been twofold: to capture in a mathematically rigorous way a vague meaning of "comfort and intuitivness" of a route, and at the same time allow for more memory efficient preprocessing of the static road network data for very fast subsequent queries. It works best with a cost function correlated with travel time. Definition 2.1 (Scope [16]). Let (G, w) be a road network. A scope mapping is defined as S : E(G) 7→ N0 ∪ {∞} such that 0, ∞ ∈ Im(S). Elements of the image Im(S) are called scope levels. Each scope level i ∈ Im(S) is assigned a constant value of scope ν S ∞ = ∞. i ∈ R0 ∪ {∞} such that 0 = ν S 0 < ν S 1 < · · · < ν S 3 In practice there are only a few scope levels in Im(S) (say, 5). The desired effect, as formalized next, is in clever using low-level roads only near the start or target positions until higher level roads become widely available. For that one has to count how much has been travelled along a given walk on edges of higher level (Def. 2.2), and do not admit lower-level edges further on (Def. 2.3, iii.). Definition 2.2 (Scope S-draw). Let (G, w) be a road network and a scope mapping S. The S-draw value of a walk P ⊆ G is a vector drawS (P ) = σ indexed by Im(S) such that σℓ = Pf ∈E(P ), S(f )>ℓ w(f ) for ℓ ∈ Im(S). For practical applications, the formula for drawS (P ) is expanded with a so called turn-scope handicap [16] penalizing for missed higher-level edges. Definition 2.3 (Admissibility [16]). Let (G, w) be a road network. Consider a walk P = (s = u0, e1, . . . ek, uk = t) ⊆ G from the start s to the end t. a) An edge e = (v1, v2) ∈ E(G) is x-admissible in G for a scope mapping S if, and only if, there exists a walk Q ⊆ G − e from x ∈ V (G) to v1 such that i. each edge of Q is recursively x-admissible in G − e for S, ii. Q is optimal subject to (1), and iii. for ℓ = S(e) and σ = drawS (Q), it is σℓ ≤ ν S ℓ . b) Whole P is s-admissible in G if every ei ∈ E(P ) is s-admissible in G; c) and P is S-admissible (with implicit respect to s, t) if there exists 0 ≤ j ≤ k such that every em ∈ E(P ), m ≤ j, is s-admissible in G, and the reverse of every em ∈ E(P ), m > j, is t-admissible in reverse GR. Note the last part c) of Definition 2.3 -- there and further on we often use a simplificating term "in reverse" to refer to the network (GR, w) obtained by reversing all edges of G, and to exchanged start and end t, s. This is to make our definitions symmetric from the viewpoint of s as from t. Remark 2.4. A vertex v ∈ V (G) is s-saturated (for s ∈ V (G)) if [drawS (P )]ℓ > ν S for ℓ < ∞ where P is an optimal s-admissible s − v walk. In other words, ℓ a vertex is s-saturated if any s-admissible edge leaving the last vertex of P has the scope level ∞. Static S-Dijkstra's Algorithm of [16] (see Appendix B). Having a defi- nition of admissible walks, one needs also a corresponding route planning algo- rithm. The seemingly complicated Def. 2.3 can actually be smoothly and simply integrated into traditional Dijkstra's or A* algorithms and their bidirectional variants. -- For each scanned vertex v, a track of the best value σ[v] of S-draw is kept. -- An edge e leaving v is relaxed only if σS(e)[v] ≤ ν S S(e) (cf. Def. 2.3, iii.). Theorem 2.5 ([16]). S-Dijkstra's algorithm (uni-directional), for a road net- work (G, w), a scope mapping S, and a start vertex s ∈ V (G), computes an op- timal s-admissible walk from s to every v ∈ V (G) in time O(cid:0)E(G) · Im(S) + V (G) · log V (G)(cid:1). 4 An optimal S-admissible s-t walk in (G, w) is then found by a natural bidi- rectional application of Theorem 2.5, which also allows for a very efficient pre- processing of the road network, as detailed in [16]. 3 Detours -- on the Price of Admissibility In the dynamic scenario a static S-Dijkstra's algorithm may badly fail. Imagine a driver approaching a restricted tunnel (e.g. by a car accident) such that it can be bypassed on low-level mountain roads only. What would a driver do? She could drive through this restrictions according to her original route plan and accept increased cost (if possible). However, there might be a better route. Notice that a re-planning her route from scratch might not be possible due to temporarily invalidated preprocessed data. The best intuitive solution for her is to slip off the original route (even ahead of the restricted tunnel) and use a detour by re-allowing the use of low-level (i.e., inadmissible in the ordinary setting) mountain road nearby this restriction. She still wants to minimize costs of such detour and drive comfortably within the margins of such adjusted scope admissibility view. On the other hand, static Def. 2.3 would not allow the afore- mentioned detour for natural reasons (unless the closure is near the start or target position); the static scope mapping simply cannot account for such unex- pected closures in advance. Yet there is a good solution which extends the very nice properties of static scope to the considered dynamic scenario. 3.1 General Strategy for Avoiding Closures As mentioned in Section 2, a formal view of this dynamic scenario is that the original static road network (G, w) with S is replaced by (G, w∗) where w∗ increases the weight of some edges (up to ∞), while S and G stay the same. Let C = {e ∈ E(G) : w∗(e) > w(e)}. For simplicity, we further assume w∗(e) = ∞ for e ∈ C and call C the set of (road) closures, but a generalization to arbitrary weight increase w∗(e) > w(e) is straightforward. Hence, from now on, we focus only on w∗ and the closure set C ⊆ E(G) which is assumed relatively small. The mathematical task is to relax the meaning of scope admissibility close to the edges of C. For that we slightly extend the definitions of Section 2.1: We say ω is an S-vector if ω is indexed by Im(S). As in Definition 2.3 b), a walk P = (s = u0, e1, . . . uk = t) is called (s, ω)-admissible if the condition (iii) newly reads σℓ + ωℓ ≤ ν S ℓ . Similarly, as in Def. 2.3 b), this P is S-admissible when amended with the initial and/or final S-vectors ωs, ωt, if there exists 0 ≤ j ≤ k such that every ei ∈ E(P ), i ≤ j, is (s, ωs)-admissible in G, and the reverse of every ei ∈ E(P ), i > j, is (t, ωt)-admissible in reverse GR. This definition simply captures a possibility that some of the S-draw value has already been used (exhausted) before entering P . As mentioned at the beginning of this section, we would like to allow limited use of inadmissible (either for s or t) edges near the closures. The crucial question is to decide which inadmissible edges should be additionally allowed. The first step is to specify at which vertices a closure affects an s-t route. 5 Definition 3.1 (C-obstructed vertex). Let (G, w) be a road network with a scope mapping S, C ⊆ E(G) a set of closures and s, t ∈ V (G). i. A vertex d ∈ V (G) is C-obstructed for the initial S-vector ωs and target t if there exists a d-t walk Q ⊆ G which is optimal S-admissible when amended with initial ωs, such that Q contains some (any) edge (z, v) ∈ C. ii. A C-obstruction state of d is the S-vector σ such that, for each scope level ℓ ∈ Im(S), σℓ is the minimum of (cid:2)drawS (Qdz)(cid:3)ℓ over all walks Q and z as from (i.), where Qdz is the (shortest) d-z subwalk of Q. iii. Moreover, a C-obstruction level of d (again for initial ωs and target t) is the minimum scope level ℓ ∈ Im(S) such that σℓ ≤ ν S ℓ . If ωs = (∞, . . . , ∞) (the most restrictive case), then we shortly say that d is C-obstructed for the target t. Analogously, d is C-obstructed for the start s and final S-vector ωt if (i. -- iii.) holds in reverse. Note that typically only one optimal d-t walk Q exists in (i.), but for formal correctness of the definition we have to range over all possible ones in (ii.). For an informal explanation, d is C-obstructed when an edge e ∈ C (a closure) affects an optimal S-admissible walk from d to the target t, and e is not "far away" from d wrt. the S-draw value on level ℓ; or this symmetrically happens in reverse GR. The role of ωs, ωt in Def. 3.1 is purely technical (to capture S-draw value travelled prior to approaching d in certain situations), and one may simply ignore it for getting the general informal picture. 3.2 Simple Detours In this section, we can finally define the simplest version of C-detour admissibil- ity -- i.e., the relaxation of traditional S-admissibility in the presence of closures. Informally, an s-t walk is simple C-detour S-admissible if it avoids all the closed roads in C; and, in addition to ordinary S-admissibility (Def. 2.3), certain "de- tour permits" are issued near those edges of C which (potentially) obstruct an optimal s-t walk. A simple detour permit just allows limited local use of edges of low scope-level (which would not be permitted otherwise by Def. 2.3), until non-closed higher level edges become available again. These permits (and subse- quent detours) can be repeated along an admissible walk, as needed by further closures. The formal definition is as follows. Definition 3.2 (Simple C-detour S-admissibility). Let (G, w) be a road network, S a scope mapping on it, and C ⊆ E(G) a set of road closures. An s-t walk P = (s = u0, e1, . . . ek, uk = t) ⊆ G is simple C-detour S-admissible if E(P ) ∩ C = ∅ and there exists 0 ≤ j ≤ k such that, for each em ∈ E(P ), (at least) one of the following holds: i. m ≤ j and em is s-admissible in G for S. ii. m > j and em is t-admissible in reverse GR for S. iii. S(em) = ℓ < ∞ and there exists 0 ≤ i < m such that; 6 -- the vertex d = ui of P is C-obstructed for the target t -- optionally also for initial drawS (Q) where Q is an optimal s-admissible s-d walk1, and -- the level of obstruction of d is ℓ < ∞ and no vertex among ui+1, . . . , um−1 is left by an edge f 6∈ C in G of S(f ) > ℓ. iv. Or, stating briefly, (iii) holds in reverse for some m ≤ i < t. In this definition, points (i.), (ii.) refer to ordinary S-admissibility. Point (iii.) then permits use of lower-level edges since an obstructed vertex d till higher-level becomes available. Actually, there is a minor issue of aforementioned Def. 3.2 left for discussion (and resolution) to Section 3.3. Simple C-Detour S-Dijkstra's Algorithm. Even though Def. 3.2 might seem complicated, it can be implemented straightforwardly by running just a single bidirectional S-Dijkstra's algorithm. Due to lack of space we present the idea of our algorithm and omit implementation details in this paper. Let (G, w) be an original road network with a scope mapping S, s, t ∈ V (G) start and target vertices, w∗ a changed weighing and C a set of closures. 1. Static initialization Static S-Dijkstra's algorithm is executed in (G, w) bidirectionally to find optimal S-admissible s − t walk P . If w(P ) = w∗(P ) then our algorithm terminates since no detour is needed. Otherwise an optimal simple C-detour S-admissible s − t walk Q is to be found. If w∗(Q) < w∗(P ) then Q is returned, otherwise P . 2. Identifying C-obstructed vertices In order to find Q, we must identify C-obstructed for both s and t and (possibly) their corresponding ωt, ωs (for obstructions close the the start or target). This is done again by running static S-Dijkstra's algorithm executed bidirectionally from s and t, but now in updated (G, w∗) and (G, w∗)R, respectively. Moreover, the algorithm does not terminate until both search queues are empty. Consider the forward search, the reverse is analogous. When S-Dijkstra's algorithm scans a vertex u such that an edge (π[u], u) from its predecessor π[u] is a closure, u is C-obstructed Def. 3.1. All suc- cessors of u are C-obstructed as well. For such vertices v a reference to the end vertex of the nearest closure on their s-admissible s − v walk is stored. Using this reference we can easily determine an obstruction state in constant time. Using this process we identify all C-obstructed vertices for s with fi- nal ωt = (∞, ..., ∞). To get the other C-obstructed vertices for s we must combine forward and reverse searches as follows. When there is a vertex w scanned in both direction such that there is a closure c = (x, y) on w − t t-admissible walk then all non-t-saturated vertices on y − t t-admissible walk are C-obstructed s with final final ωt given by their S-draw values in the reverse search. 1 This part with Q actually applies only when d is not s-saturated, i.e., nearby s. 7 3. Permitting not S-admissibile edges Now we have identified C-obstructed vertices for both s and t together with their C-obstruction states and for those close enough to s or t we also know initial and final vectors ωt and ωs. From obstruction states we can easily determine obstruction levels of these vertices, S-draw values, predecessors and distance estimates from s (or to t, respectively). Again, consider the forward direction. If a C-obstructed vertex v for t has obstruction level ℓ smaller than ∞, gets a permit for relaxing any of its outgoing edges e = (v, w) of level S(e) = ℓ without updating S-draw value of w and v is pushed to the search queue with updated distance estimate and parent. The same holds for all edges of w and next successors. Once there is an edge of scope higher than ℓ outgoing w, permitting stops. This is done for all C-obstructed vertices for both s and t. 4. Completing simple C-detour S-admissible s − t walk Finally, we keep static S-Dijkstra's algorithm running with all auxiliary data structures computed so far in (G, w∗), the resulting s − t walk is Q. We would like to emphasize that all aforementioned steps can be done in a single bidirectional execution of S-Dijsktra's algorithm. Hence running time of aforementioned algorithm remains in O(cid:0)E(G) · Im(S) + V (G) · log V (G)(cid:1). 3.3 Enhanced Detours Unfortunately, aforementioned Definition 3.2 has a minor practical drawback which can cause that in some very specific cases there is no simple C-detour S-admissible s-t walk even though a C-avoiding s-t walk exists: -- Imagine a one-directional road segment f ′ = (d, d′) just preceding f ∈ C (more generally, a local map area which can be left only through f ). Then one cannot take a detour from d′, and a lower-scope detour edge from d may not be allowed by Def. 3.1.iii. -- Hence in such situation this f ′ is effectively closed as well, and we can capture this in a supplementary definition which consequently resolves the issue: Definition 3.3 (Quasi-Closure). Let (G, w) be a road network, C ⊆ E(G) a set of closures and t ∈ V (G) the target vertex. An edge (u, v) ∈ E(G) \ C is C-quasi-closed for t if there is no S-admissible u-t walk starting with (u, v) in the subnetwork (G − C, w). A C-quasi-closed edge for the start s is defined analogously in reverse. For a set C of closures, we denote by C ∗ its qc-closure, i.e., the least fixed point of the operation of adding C-quasi-closed edges for t or s to C. We then easily amend the definition of simple detour admissibility as follows. Definition 3.4 (Enhanced C-detour S-admissibility). Let (G, w) be a road network, S a scope mapping on it, and C ⊆ E(G) a set of road closures. An s-t walk P is enhanced C-detour S-admissible if P is simply C ∗-detour S- admissible, where C ∗ is the qc-closure of C. 8 With that, and using also the definition of a proper scope mapping from [16], we can now state technical Proposition 3.5. In a standard connectivity setting, a graph (road network) G is routing- connected if, for every pair of edges e, f ∈ E(G), there exists a walk in G starting with e and ending with f . A scope mapping S of a routing-connected graph G is proper if, for all i ∈ Im(S), the subgraph G[i] induced by those edges e ∈ E(G) such that S(e) ≥ i is routing-connected. Proposition 3.5. Let (G, w) be a road network, S a proper scope mapping on it, and C ⊆ E(G) a set of road closures. Assume s, t ∈ V (G). If there exists a C-avoiding s-t walk in (G, w), i.e., one not containing any edge of C, then there also exists an enhanced C-detour S-admissible s-t walk there. Enhanced C-Detour S-Dijkstra's Algorithm. The only difference between this algorithm and the simple one is that we have to compute the qc-closure set of C. This must be done between step 1 and step 2 of the simple C-detour S-Dijkstra's algorithm as follows: 1.1 Construction of qc-closure of C In order to get qc-closure of C we have to run a set of bidirectional S- Dijkstra algorithms from s to t with a minor modification -- we are relaxing all S-admissible edges (i.e., not only those improving distance estimates). In the next run, all edges from C are removed in G and the same algorithm is executed again. Edges which cannot be reached from t by S-admissible walk (in reversed road network) are quasi-closures. They will be removed from the road network in the next run. This process continues until all qc-closure set C ∗ is found. By a clever implementation, one can even identify qc-closure set in a single run of bidirectional S-Dijkstra's algorithm. Due to lack of space we omit further details in this paper and claim that even the implementation of the naive process above requires only a small number of iterations in practice. 3.4 Full Detour Admissibility In addition to the simple approach of Definition 3.2 (and its enhanced version), we briefly outline a deeper approach which better fits into the overall idea of scope and comfortable routes, but is technically complicated and not suited for introductory explanation. That is why give here an informal outline, while the bare formal definition is left for the appendix. • In static S-admissibility, we informally count the S-draw value of the trav- elled subwalk, and use this information to decide admissibility of edges of restricted scope. The same is naturally extended to obstructed vertices and their detours: Each time a C-obstructed vertex d is reached, this lowers the current S-draw value (a better variant of a detour permit) to one depending on how far d is from the actual closure (again measured in terms of S-draw). 9 • This lowered S-draw value then allows exceptional use of low-level edges for a limited extent since d (in the exactly same way as low-level edges are allowed near the start s). The same, of course, happens in reverse. • A complication comes from a fact that the whole concept has to be consid- ered recursively. This is because lowered S-draw value affects C-obstructed vertices further on (there are more of them then, cf. also secondary detours) and adds more possibilities of "detours on detours". Altogether, the outlined ideas lead to a smooth, though complicated, def- inition which nicely incorporates into S-Dijkstra's algorithm. There is also a possibility of a simplified version considering detour permits only on primary closures -- the advantage being in a simple implementation, virtually almost the same as in Section 3.2. 3.5 Experimental Work We have implemented a very simple prototype in order to prove good practical performance of both simple and enhanced C-detour S-Dijkstra's algorithms. Algorithms were implemented in C and compiled using gcc-4.5.1 without any optimization flags running in a single thread on a machine with Intel Core i3 CPU 2.40 GHz with 4 GB RAM. We have used two road networks constructed from publicly available TIGER/Line 2010 US roads data. Both road network had 10 000 edges and were assigned a scope mapping simply according to (corrected) road categories and then it was artificially balanced to be proper. First road network contains a very small city and its rural area, the second contains a bigger urban area. We did a set of 500 queries for pairs of randomly distant vertices and we placed a few (50) closures randomly on unbounded edges and edge nearby middle of the optimal S-admissible walk between a pair so that at least one closure hits the walk. First, we were looking how many quasi-closures will be needed in enhanced detour algorithm. The number was very low2 -- in average there were only 19 quasi-closures and the maximum number of iterations needed to find a qc-closure set was 3. Interestingly, there was no significant difference between rural and urban testing instance. In average, detour algorithm increased the number of scanned vertices just by approx. 8% and we claim that this number can improved a lot by a better implementation. Of course, in case of enhanced algorithm there are more obstructed vertices given by quasi-closures, but the difference between running time of both algorithms is neglectable -- 9.2ms and 11.2ms in average. 3.6 A Note on Detours in Multi-Staging Scope-Based Approach The most important computational aspect of scope lies in the fact that only the edges of unbounded scope level ∞ matter for global preprocessing (an idea 2 Originally, our testing instances contained a lot of degree 2 vertices which was causing a lot of "fake" quasi-closures, this problem was solved by merging long chains of such edges into a single edge. 10 related to better known reach [5]). Informally, the query algorithm of [16] works in stages: In the opening cellular phase, the road network is locally searched (uni- directional S-Dijkstra) from both start and target vertices until only edges of unbounded scope are admissible. Then a small preprocessed "boundary graph" is searched by another algorithm (e.g. hub-based labeling [15]) in the boundary phase. Finally, in the closing cellular phase, the scope-unbounded long middle section of the route is "unrolled" in the whole network. We remark that the boundary graph will remain static even in the dynamic scenario (due to expensive preprocessing), and dynamic changes are mainly dealt with in the closing cellular phase. We first remark on the "only negative change" assumption of our approach (Sec. 2). This well corresponds with a real-world sit- uation in which just "bad things happen on the road", and the driver thus usually has to find an available detour, instead of looking for unlikely road improvements. Therefore, we are content if our query algorithm finds that an optimal route of the original network (wrt. w) is admissible, though not perfectly optimal,3 in the changed network (with w∗). However, when things go worse with w∗, then our algorithm works efficiently. 4 Conclusion We have outlined the current state of our work on dynamization of the scope- base route planning technique [16] for both unexpected and predictable (to some extend) negative road network changes (closures). Our approach is aimed at a proper relaxation of scope admissibility when a driver approaches changed road segment, by locally re-allowing nearby roads of lower scope level. At the same time we claim that the computed detour minimizes costs and still remains reasonable in terms of scope admissibility. In a summary, we have shown that a scope-based route planning approach with cellular preprocessing [16] can be used not only in static but also in dynamic road networks and briefly demonstrated that proof of concept works well in practice. Our immediate future work in this direction will include the following points: -- an efficient implementation of full C-detour algorithm, -- incorporation of route restrictions and possibly other aspects, and -- more extensive experimental evaluation of the final implementation. References 1. Edsger Dijkstra. A note on two problems in connection with graphs. Numerische Mathematik, 1:269 -- 271, 1959. 3 Note that a designated detour of a road construction may perhaps turn out faster than another previously optimal route. 11 2. Kenneth L Cooke and Eric Halsey. The shortest route through a network with time-dependent internodal transit times. Journal of Mathematical Analysis and Applications, 14(3):493 -- 498, 1966. 3. Peter E. Hart, Nils J. Nilsson, and Bertram Raphael. Correction to "a formal basis for the heuristic determination of minimum cost paths". SIGART Bull., 1(37):28 -- 29, 1972. 4. Valerie King. Fully dynamic algorithms for maintaining all-pairs shortest paths and transitive closure in digraphs. In Proceedings of the 40th Annual Symposium on Foundations of Computer Science, FOCS '99, pages 81 -- , Washington, DC, USA, 1999. IEEE Computer Society. 5. Ron Gutman. Reach-based routing: A new approach to shortest path algorithms optimized for road networks. In Proceedings 6th Workshop on Algorithm Engineer- ing and Experiments (ALENEX), pages 100 -- 111, 2004. 6. Dorothea Wagner, Thomas Willhalm, and Christos D. Zaroliagis. Dynamic shortest paths containers. Electr. Notes Theor. Comput. Sci., 92:65 -- 84, 2004. 7. Ingrid C. M. Flinsenberg. Route planning algorithms for car navigation. PhD thesis, Technische Universiteit Eindhoven, 2004. 8. Dorothea Wagner, Thomas Willhalm, and Christos Zaroliagis. Geometric contain- ers for efficient shortest-path computation. J. Exp. Algorithmics, 10, December 2005. 9. Andrew V. Goldberg and Chris Harrelson. Computing the shortest path: A* search meets graph theory. In In Proc. 16th ACM-SIAM Symposium on Discrete Algo- rithms, pages 156 -- 165, 2005. 10. Peter Sanders and Dominik Schultes. Engineering highway hierarchies. In ESA'06: Proceedings of the 14th conference on Annual European Symposium, pages 804 -- 816, London, UK, 2006. Springer-Verlag. 11. Daniel Delling and Dorothea Wagner. Landmark-based routing in dynamic graphs. In Proceedings of the 6th international conference on Experimental algorithms, WEA'07, pages 52 -- 65, Berlin, Heidelberg, 2007. Springer-Verlag. 12. Dominik Schultes and Peter Sanders. Dynamic highway-node routing. In WEA'07: Proceedings of the 6th international conference on Experimental algorithms, pages 66 -- 79, Berlin, Heidelberg, 2007. Springer-Verlag. 13. Dominik Schultes. Route Planning in Road Networks. PhD thesis, Karlsruhe University, Karlsruhe, Germany, 2008. 14. Daniel Delling and Peter S and Dominik Schultes and Dorothea Wagner. Engineer- ing Route Planning Algorithms. In Algorithmics of Large and Complex Networks. Lecture Notes in Computer Science, pages 117 -- 139. Springer, Berlin, Heidelberg. 2009. 15. Ittai Abraham, Daniel Delling, Andrew V. Goldberg, and Renato F. Werneck. A hub-based labeling algorithm for shortest paths in road networks. In Proceedings of the 10th international conference on Experimental algorithms, SEA'11, pages 230 -- 241, Berlin, Heidelberg, 2011. Springer-Verlag. 16. Petr Hlinen´y and Ondrej Moris. Scope-Based Route Planning. In ESA'11: Pro- ceedings of the 19th conference on Annual European Symposium, pages 445 -- 456, Berlin Heidelberg, 2011. Springer-Verlag. arXiv:1101.3182 (preprint). 12 A Classical Dijkstra's Algorithm Classical Dijkstra's algorithm solves the single source shortest paths problem4 in a graph G with a non-negative weighting w. Let s ∈ V (G) be the start vertex (and, optionally, let t ∈ V (G) be the target vertex). -- The algorithm maintains, for all v ∈ V (G), a (temporary) distance estimate of the shortest path from s to v found so far in d[v], and a predecessor of v on that path in π[v]. -- The scanned vertices, i.e. those with d[v] = δw(s, v) confirmed, are stored in the set T ; and the discovered but not yet scanned vertices, i.e. those with ∞ > d[v] ≥ δw(s, v), are stored in the set Q. -- The algorithm work as follows: it iteratively picks a vertex u ∈ Q with minimum value d[u] and relaxes all the edges (u, v) leaving u. Then u is removed from Q and added to T . Relaxing an edge (u, v) means to check if a shortest path estimate from s to v may be improved via u; if so, then d[v] and π[v] are updated. Finally, v is added into Q if is not there already. -- The algorithm terminates when Q is empty (or if t is scanned). Time complexity depends on the implementation of Q; such as it is O(E(G) + V (G) log V (G)) with the Fibonacci heap. Dijkstra's algorithm can be used "bidirectionally" to solve SPSP problem. Infor- mally, one (forward) algorithm is executed from the start vertex in the original graph and another (reverse) algorithm is executed from the target in the reversed graph. Forward and reverse algorithms can alternate in any way and algorithm terminates, for instance, when there is a vertex scanned in both directions. Algorithm A.1 Unidirectional Dijkstra's Algorithm Input: A road network (G, w) and a start vertex s ∈ V (G). Output: For every v ∈ V (G), an optimal s − v walk in G (or ∞). 1: for ∀v ∈ V (G) do d[v] ← ∞; π[v] ← ⊥; done 2: d[s] ← 0; Q ← {s}; T ← ∅ 3: while Q 6= ∅ ∨ t /∈ T do 4: 5: u ← mind[](Q); Q ← Q \ {u} for all (u, v) ∈ E(G) do // Initialization // Main loop // Relaxation of (u, v) 6: if d[v] ≥ d[u] + w(u, v) then d[v] ← d[u] + w(u, v); π[v] ← u fi done T ← T ∪ {u} 7: 8: 9: done 10: ConstructWalk (G, d, π) // Vertex u is now scanned // Postprocessing -- generating output. 4 Given a graph and a start vertex find the shortest paths from it to the other vertices. 13 B S-Dijkstra's Algorithm Full pseudocode of S-Dijkstra's algorithm as presented in [16] follows. For better un- derstanding a concept of S-reach and its effect is removed from the Algorithm B.1. Algorithm B.1 Unidirectional S-Dijkstra's Algorithm Input: A road network (G, w), a scope S and a start vertex s ∈ V (G). Output: For every v ∈ V (G), an optimal s-admissible walk from s to v in G (or ∞). // Temporary distance estimate updated. // Scope admissibility vector updated. Q ← Q ∪ {v} d[v] ← d[u] + w(u, v); π[v] ← u Relax(u, v, γ) 1: if d[u] + w(u, v) < d[v] then 2: 3: 4: fi 5: if d[u] + w(u, v) ≤ d[v] then 6: 7: 8: 9: fi 10: return for all i ∈ Im(S) do done σi[v] ← min{σi[v], σi[u] + γi} S -Dijkstra(G, w, S, s) d[v] ← ∞; π[v] ← ⊥; σ[v] ← (∞, . . . , ∞) u ← mind[](Q); Q ← Q \ {u} for all f = (u, v) ∈ E(G) do S(f ) then 1: for all v ∈ V (G) do 2: 3: 4: done 5: d[s] ← 0; Q ← {s}; σ[s] ← (0, . . . , 0) 6: while Q 6= ∅ do 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: done 17: ConstructWalk (G, d, π) done Relax(u, v, γ) fi done if σS(f )[u] ≤ ν S for all i ∈ Im(S) do if S(f ) > i then γi ← w(f ) else γi ← 0 fi // Initialization. // Distance estimate and predecessor. // Scope admissibility vector. // Main loop processing all vertices. // Pick a vertex u with the minimum d[u]. // All edges from u; subject to // s-admissibility check. // Adjustment to scope admissibility. // Relaxation of f = (u, v). // Postprocessing -- generating output. Bidirectional version of S-Dijkstra's algorithm is analogous to the bidirectional version of classical algorithm -- two searches are execetued, one from the start and another from the target in the reverse road network. The algorithm terminates when there is a vertex scanned in both directions. 14 C Enhanced C-Detour S-admissibility In a standard connectivity setting, a graph (road network) G is routing-connected if, for every pair of edges e, f ∈ E(G), there exists a walk in G starting with e and ending with f . This obviously important property can naturally be extended to our scope concept as follows. Definition C.1 (Proper Scope). A scope mapping S of a routing-connected graph G is proper if, for all i ∈ Im(S), the subgraph G[i] induced by those edges e ∈ E(G) such that S(e) ≥ i is routing-connected, too. Theorem C.2 ([16]). Let (G, w) be a routing-connected road network and let S be a proper scope mapping of it. Then, for every two edges e = (s, x), f = (y, t) ∈ E(G), there exists an S-admissible s-t walk P ⊆ G such that P starts with the edge e and ends with f (i.e., an e-f walk). Proof (of Proposition 3.5). Let C ∗ denote the qc-closure of C (cf. Def. 3.4). By definition, an s-t walk is C-avoiding iff it is C ∗-avoiding. By Theorem C.2, there is an S-admissible s-t walk P ⊆ G, and we take an optimal such P . Let f = (u, v) ∈ E(P ) be the first edge of P such that f ∈ C ∗ (if such one does not exist, then we are done with P ). Observe that there is another edge f ′ = (u, v′) 6∈ C ∗ from which t can be reached on a C ∗-avoiding walk: If u = s, then this follows from the assumption of existence of a C-avoiding s-t walk. Otherwise, let f1 = (u1, u) be the edge preceding f on P . Since f1 6∈ C ∗ by our choice of f , there must be a C ∗-avoiding u1-t walk starting with f1, and f ′ can be chosen as the second edge on it. Symmetric claim holds, of course, in reverse from t. Now, the vertex u is C ∗-obstructed for initial drawS(P su) and target t, with ob- struction level 0 (cf. Def. 3.1). Hence f ′ will be in accordance with point (iii.) of Def. 3.2. We take a new s-t walk P ′ with prefix P su.f ′ -- this walk continues from f ′ to t with an optimal S-admissible u-t walk that additionally never decreases the scope level at the start (such a walk exists thanks to proper scope mapping, analogically to the proof of Theorem C.2). If, again, P ′ intersects C ∗, then we repeat the above argument. In a finite number of steps, we reach the conclusion. Obviously, the constructed walk may ⊓⊔ be far away from optimality, but that is not the objective of this claim. D Full Detour Admissibility: the Definition Definition D.1 (Full C-detour S-admissibility). Let (G, w) be a road network, S a scope mapping on it, and C ⊆ E(G) a set of road closures. An s-t walk P = (s = u0, e1, . . . ek, uk = t) ⊆ G is fully C-detour S-admissible if E(P ) ∩ C = ∅ and the following are true: i. There exist indices a0 = 0 < a1 < · · · < ap < k, and c0 = k > c1 > · · · > cq > 0 in reverse; here to avoid nested indexing, we shortly write di = uai and d′ i = uci . Moreover, there is a set5 B ⊆ V (P ) such that, between every two succeeding di and d′ j on P , there is one selected vertex between them in B. 5 The meaning of B is technical: This set presents the "breakpoints" on P at which we switch from considering S-admissibility straight to considering it in reverse (i.e., from valueing S-draw from the last obstructed vertex to borrowing it till the next obstructed vertex in reverse). Switch back happens automatically after finishing the detour. 15 ii. π[d0] = 0 is the zero S-vector. iii. For each i > 0, this di is C-obstructed for the target t, and π[di] shortly denotes the corresponding C-obstruction state of di. Specially, if P di−1di (the short subwalk from di−1 to di) avoids B, then di is C-obstructed for the initial S-vector ω[di] and t (otherwise, ω[di] = ∞): ω[di] = π[di−1] + drawS(Q) where Q is an optimal (di−1, π[di−1])-admissible di−1- di walk. iv. (ii.) and (iii.) are analogously formulated for d′ v. For each em+1 = (um, um+1) ∈ E(P ), (at least) one of the following holds: i in reverse. -- S(em+1) = ∞. -- S(em+1) = ℓ < ∞, and there exists 0 ≤ j ≤ m such that j = ai, the sub- q}, and for some optimal walk P dium from di to (including) um is disjoint from B ∪ {d′ the following is fulfilled: It is πℓ[di] + (cid:2)drawS(Q)(cid:3)ℓ ≤ ν S (di, π[di])-admissible di-um walk Q. 1, . . . , d′ ℓ -- The previous holds in reverse for some m + 1 ≤ j ≤ k such that j = ci. 16
1907.06786
1
1907
2019-07-15T23:17:48
Some Black-box Reductions for Objective-robust Discrete Optimization Problems Based on their LP-Relaxations
[ "cs.DS", "math.OC" ]
We consider robust discrete minimization problems where uncertainty is defined by a convex set in the objective. We show how an integrality gap verifier for the linear programming relaxation of the non-robust version of the problem can be used to derive approximation algorithms for the robust version.
cs.DS
cs
Some Black-box Reductions for Objective-robust Discrete Optimization Problems Based on their LP-Relaxations Khaled Elbassioni∗ Abstract 9 1 0 2 l u J 5 1 ] S D . s c [ 1 v 6 8 7 6 0 . 7 0 9 1 : v i X r a We consider robust discrete minimization problems where uncertainty is defined by a convex set in the objective. We show how an integrality gap verifier for the linear programming relaxation of the non-robust version of the problem can be used to derive approximation algorithms for the robust version. 1 Introduction Standard optimization algorithms assume precise knowledge of their inputs, and find optimal or near-optimal solutions under this assumption. However, in real-life applications, the input data may be known up to a limited precision with errors introduced possibly due to inaccuracy in measurements or lack of exact information about the precise value of the input parameters. Clearly, an optimization algorithm designed based on such distorted data to optimize a certain objective function would not yield reliable results, if no special consideration of such uncertainty is taken. Several approaches to deal with uncertainty in data have been introduced, including stochastic optimization (see e.g., [11]), where certain probabilistic assumptions are made on the uncertainty and the objective is optimize the average-case or the probability of a certain desirable event, and robust optimization (see, .eg., [4]), where some deterministic assumptions are made on the uncertain parameters, and the objective is to optimize over the worst-case these parameters can assume1. In this paper, we consider a class of robust discrete optimization (DO) problems, where uncertainty is assumed to be only in the objective (called sometimes cost-robust optimization problems). Given a discrete set of solutions, on is interested in maximizing/minimizing a linear objective function over this set; it is assumed that the objective function is not explicitly given, but is known to belong to a convex an uncertainty set. The requirement is to solve the optimization problem in the worst-case scenario that the objective assumes in the uncertainty set. Our goal is to show how an approximation algorithm, based on the linear programming (LP) relaxation for the nominal version of a discrete optimization problem, can be used to derive an approximation algorithm for the robust version. We will focus on minimization problems, even though some of the results can be extended to maximization problems. 1.1 Integrality Gap Verifiers More formally, we consider a minimization problem over a discrete set S ⊆ Zn and a corresponding LP-relaxation over Q ⊆ Rn +: OPT = min cT x (1) z∗ = min cT x (2) s.t. x ∈ S where c ∈ Rn +. We will be mainly working with discrete optimization problems for which there is an approximation algorithm that rounds any feasible LP solution to a discrete one with a bounded approximation ratio. This is formulated in the following definition. s.t. x ∈ Q, Definition 1. For α ≥ 1, a (deterministic) α-integrality gap verifier A = A(c, x) for (1)-(2), w.r.t. a class C ⊆ Rn + of integrality gap verifier A is said to be oblivious (see, e.g., [18]) if A(c, x) = A(x) does not depend on the objective c. When the the class of objectives is C = Rn objectives is a polytime algorithm that, given any c ∈ C and any x ∈ Q returns an bx ∈ S such that cT x ≤ α · cT x. An A randomized α-integrality gap verifier is the same as in Definition 1 except that it returns a randombx ∈ S such that E[cTbx] ≤ αcT x. We will consider a special class of randomized integrality gap verifiers that are given by the following +, we simply call A an (oblivious) integrality gap verifier. ∗Khalifa University of Science and Technology, Masdar City Campus, P.O. Box 54224, Abu Dhabi, UAE; ([email protected]) 1Yet, there is a third (intermediate) approach, namely, distributionally robust optimization (see, e.g., [14]), in which one optimizes the expectation over definition. the worst-case choice from a set of distributions on the uncertain parameters. 1 Definition 2. For α ≥ 1 and x ∈ Q, an α-approximate (semi-) negatively correlated randomized rounding, denoted α- ANCRR, of x is anbx ∈ S such that: (i) E[cTbx] ≤ αcT x; (ii) For any S ⊆ [n]: Prh^i∈S (bxi = 1)i ≤Yi∈S Pr[bxi = 1]. (3) An α-ANCRR integrality gap verifier is a polytime algorithm that, given any x ∈ Q, returns an α-ANCRR. Remark 1. Consider a minimization problem (1) and its LP relaxation (2). By Markov's inequality, given an α-randomized intergality gap verifier A, x ∈ Q, c ∈ Rn holds with probability 1 − o(1). ǫ ) calls to A anbx ∈ S such that cTbx ≤ (1+ǫ)α·cT x + and ǫ > 0, we can get in poly(n, 1 1.2 Example: SETCOVER Let V be a finite set of m elements. Given sets S1, . . . , Sn ⊆ V , with non-negative costs c1, . . . , cn, the objective is to find a minimum-cost selection of sets that covers all the elements of V . The problem and its standard LP relaxation are given as follows: cixi nXi=1 xi ≥ 1, ∀j ∈ V OPT = min s.t. Xi: j∈Si cixi nXi=1 xi ≥ 1, ∀j ∈ V z∗ = min s.t. Xi: j∈Si xi ∈ {0, 1}, ∀i ∈ [n] xi ≥ 0, ∀i ∈ [n] It is well-known that the greedy algorithm that repeatedly picks a set with minimum cost to number of newly covered elements-ratio (deterministically) verifies an integrality gap of O(log m) for the standard LP relaxation of SETCOVER. More- over, let x∗ be the fractional optimal solution (to the LP relaxation). Then it is also well-known that the algorithm that picks each set Si independently with probability min(cid:8)6x∗ i log m, 1(cid:9) is an O(log m) -- ANCRR integrality gap verifier. 1.3 Robust Discrete Optimization Problems In the framework of robust optimization (see, .e.g. [4, 6]), we assume that the objective vector c is not known exactly. Instead, it is given by a convex uncertainty set C ⊆ Rn +. It is required to find a (near)-optimal solution for the DO problem under the worst-case choice of objective c ∈ C. Typical examples of uncertainty sets C include: • Polyhedral uncertainty: C := P(A, b, c0) := {c ∈ Rn + : A(c − c0) ≤ b}, for given matrix A ∈ Rm×n + , vector b ∈ Rm + and (nominal) vector c0 ∈ Rn +. • Ellipsoidal uncertainty: C := E(c0, D) := {c ∈ Rn + : (c − c0)T D−2(c − c0) ≤ 1}, for given positive definite matrix D ∈ Rm×n and vector c0 ∈ Rn +. More generally, we will consider a class of uncertainty sets defined by affine perturbations around a nominal vector c0 ∈ Rn (see,. e.g., [4]): + C = C(c0, c1, . . . , cr;D) :=(c := c0 + kXr=1 + and D ⊆ Rk is a convex perturbation set: where c0, c1, . . . , ck ∈ Rn δrcr : δ = (δ1, . . . , δk) ∈ D) , (4) • Polyhedral perturbation D = P(A, b, 0) := {δ ∈ Rk • Ellipsoidal perturbation: D = E(0, D) := {δ ∈ Rk + : Aδ ≤ b}, for given matrix A ∈ Rm×k + : δT D−2δ ≤ 1}, for a given positive definite matrix D ∈ Rk×k. and vector b ∈ Rm + . + The vectors c1, . . . , ck ∈ Rn P(A, b, c0) can be described in the form (4) by setting C := C(c0, 11 P(A, b, 0), where 1j the form (4) by setting C := C(c0, 11 + are called the generators of the perturbation set D. Note that a polyhedral uncertainty set n;D) for the polyhedral perturbation set D := n denotes the jth unit vector in Rn. Similarly, an ellipsoidal uncertainty set E(c0, D) can be described in n;D) for the ellipsoidal perturbation set D := E(0, D). n, . . . , 1n n, . . . , 1n 2 1.4 Convex Relaxation for the Robust DO Problem We can model the robust DO problem and its convex relaxation as follows: OPTR = min x∈S max c∈C cT x, Equivalenlty, we can write (5)-(6) as s.t. z ∀c ∈ C OPTR = min cT x ≤ z x ∈ S. (5) (7) (8) z∗ R = min x∈Q max c∈C cT x. s.t. z∗ R = min cT x ≤ z x ∈ Q. z ∀c ∈ C (6) (9) (10) Note that (6) amounts to a convex programming problem that can be solved (almost to optimality) in polynomial time (see, e.g., [21]). Near-optimal solutions can also be found more efficiently, based on the semi-infinite LP formulation (9), using the multiplicative weight updates method [17]. 1.5 Guarantees for a Robust DO problem We consider both deterministic and randomized algorithms for the robust optimization problem (see, e.g., [8, 23]): Definition 3. For α ≥ 1, a randomized approximation algorithm B for the robust DO problem (5) is said to be: • α-robust-in-expectation (w.r.t. the uncertainty set C), if the expected objective in the uncertainty set C, w.r.t. the output solution, over the random choices of the algorithm, is within a factor of α from the optimum solution: • α-robust-with-high-probability, if with probability approaching 1, all objectives in the uncertainty set C, w.r.t. output solution, are within a factor of α from the optimum solution: Ebx∈B[cTbx] ≤ α · OPTR ∀c ∈ C; the • α-deterministically robust if it is α-robust with probability 1, i.e., it outputs a vectorbx ∈ S such that: Pr bx∈B [cTbx ≤ α · OPTR ∀c ∈ C] = 1 − o(1); cTbx ≤ α · OPTR ∀c ∈ C. Clearly, the notion of α-deterministically robust is stronger than that of α-robust-with-high-probability, which is, in turn, (more or less) stronger than that of α-robust-in-expectation. 1.6 Summary of Main Results To describe the results we obtain in this paper, let us consider the polyhedral/ellipsoidal uncertainty sets: C1 :=(cid:8)c := c0 + u u ∈ Rn C2 :=(c := c0 + C3 :=(cid:8)c := c0 + u (cid:12)(cid:12) u ∈ Rn C4 :=(c := c0 + +, u ≤ d, Au ≤ b(cid:9) +, Aδ ≤ b) δrcr (cid:12)(cid:12)(cid:12) δ ∈ Rk +, kD−1uk2 ≤ 1(cid:9) +, kD−1δk2 ≤ 1) δrcr (cid:12)(cid:12)(cid:12) δ ∈ Rk kXr=1 kXr=1 (11) (12) (13) (14) Assume A, b, d, C are non-negative and D is positive definite, where C ∈ Rn×k is the matrix whose columns are c1, . . . , ck. j and cmax := maxr6=0,j cr Let m be the number of rows of A, β := minj maxi aij and γ := maxi,j aij , cmin := minr6=0,j: cr j . Our results are summarized in Table 1.6. The first column describes the restrictions on the discrete set S (if any): S is binary if S ⊆ {0, 1}n and covering if x ∈ S and y ≥ x implies y ∈ S. In the second column, we describe the type of uncertainty set considered, and the conditions on it (if any). The third column gives the type of approximation algorithm which we assume available for the nominal problem, while the fourth column gives the guarantee for the corresponding robust version. As can be seen from the table, except for the first two results, the approximation factors we obtain depend on the "width" of the uncertainty set as described by the ratios γ λmin(D) for ellipsoidal uncertainty. The approximation ratio is also proportional to the square root of the number of generators in the perturbation set. Whether these bounds can be significantly improved remains an interesting open question. for polyhedral uncertainty, and λmax(D) β and cmax cmin j >0 cr + 3 S General general convex set Uncertainty set Available black-box Approximation guarantee general α-integrality gap verifier general α-approx. Alg. O(α)-deterministically robust α-robust-in-expectation C1; m = O(1) Binary Binary & C1 covering Binary C2 General C4; DC ≥ 0 Binary & C3; D−1 > 0 covering Binary C4; D−1 > 0 general α-integrality gap verifier α-ANCRR integrality gap verifier general α-integrality gap verifier general α-integrality gap verifier α-ANCRR integrality gap verifier robust-with-high-probability cmax β deterministically robust O(cid:0)α +q αγn β (cid:1)- O(cid:0)αqk log(k) γ cmin(cid:1)- O(cid:0)α√k(cid:1)- O(cid:0)α +q αλmax(D)n λmin(D) (cid:1)- O(cid:0)αqk log(k) λmax(D) deterministically robust deterministically robust- robust-with-high-probability λmin(D) cmax cmin(cid:1)- Table 1: Summary of the reductions. 1.7 Some Related Work While there is an extensive body of work on robust continuous optimization problems (see, e.g., [4, 5, 6, 7, 10, 16, 25]), much less is known in the discrete case, where most work has considered special uncertainty sets or specific discrete problems. In [8], Bertsimas and Sim consider the minimization problem (5) with budget uncertainly, where at most k components of the objective are allowed to increase; for binary optimization problems they gave an α-deterministically robust approximation algorithm for the robust version which is obtained by making n + 1 calls to any α-approximation algorithm for the non- robust version. Some generalizations of this result to the non-binary case were obtained in [20], and other improvements and generalizations were obtained in [2]. In Section 2.1 below, we show that the number of calls to the approximation algorithm can be made significantly smaller and also extend the result to any constant number of budget constraints. For uncorrelated ellipsoidal uncertainty (where the uncertainty set is an axis-aligned ellipsoid), Bertsimas and Sim [9] also gave a pseudo polynomial-time reduction from solving a robust version problem over a binary set S to a linear optimization problem over the same set. As observed in [22, Chapter 2], when specialized to ball uncertainty, this yields a polynomial time algorithm for solving the robust problem, whenever the nominal version can be solved in polynomial time. This should be contrasted with our result in Theorem 16, where an O(α√n)-approximation for the robust problem with ellipsoidal uncertainty, satisfying D > 0, over an arbitrary discrete set, can be obtained from any α-integrailty gap verifier for the nominal problem. More recently, Kawase and Sumita (2018) gave robust-in-expectation algorithms for special problems such as the knap- sack problem and the maximum independent set problem in the intersection of r matroids, among others. We note, however, that their results are not of the black-box type, that is, they provide algorithms that are specific to each problem. We note also that some of these results can be derived from our reduction in Section 2. Finally, it is worth noting that there is a number of results on special problems, such as SHORTESTPATH [3], MINCOSTFLOW [8], MACHINESCHEDULING [12], VEHICLEROUTING [1], two-stage robust optimization [15, 19], mostly under a class of budget uncertainty. In general, this seems to be a growing area of research, see, e.g., the theses by Poss [25] and Ilyina [22]. Outline of the techniques. All the results in Table 1.6 are based on solving the convex relaxation for the robust optimization problem (in some form or th other), then rounding the obtained fractional solution. A useful tool that we rely on, first proved by Carr and Vempala [13], allows one to use a given integrality gap verifier for the LP-relaxation to round the fractional solution without losing much in the objective. Another ingredient of our proofs is the use of strong LP-duality to go from a maxmin-optimization problem to a purely minimization problem; this was the approach used by Bertsimas and Sim in [8], which we push further by combining it with randomized rounding techniques, and using a dual -fitting argument to bound the approximation guarantee on the rounded solution. First we describe this approach for polyhedral uncertainty, then it would not be hard to extend the results to ellipsoidal uncertainty, by envisioning an ellipsoid as a polytope with infinitely many linear inequalities. 2 A Robust-in-Expectation Approximation Algorithm We first observe simply that an oblivious intergality gap verifier for the nominal problem implies an α-robust-in-expectation algorithm for the robust version. Lemma 1. Consider a combinatorial minimization problem (1) and its LP relaxation (2), admitting an oblivious α-integrality gap verifier A w.r.t. a class C of objectives. Then there is a polytime α-robust-in-expectation algorithm for the robust version (7) w.r.t. to the any convex uncertainty set C ⊆ C . 4 Proof. We solve the robust convex relaxation (9) to find z∗ oblivious α-integrality gap verifier, we have for all c ∈ C, R and a corresponding optimal solution x∗ ∈ Q. Since A is an where the second inequality follows by (10). Ebx∼A(x∗)[cTbx] ≤ α · cT x∗ ≤ α · z∗ R ≤ α · OPTR, Carr and Vempala [13] gave a decomposition theorem that allows one to use an α-integrality gap verifier for a given LP-relaxation of a combinatorial minimization problem, to decompose a given fractional solution to the LP into a convex combination of integer solutions that is dominated by α times the fractional solution. We can restate their result as follows. Theorem 2 ([13]). Consider a discrete minimization problem (1) and its LP relaxation (2), admitting an α-integrality gap verifier A. Then there is a polytime algorithm that, for any given x∗ ∈ Q, finds a set X ⊆ S, of polynomial size, and a set of convex multipliers {µx ∈ R+ : x ∈ X},Px∈X µx = 1, such that αx∗ ≥ Xx∈X µxx. (15) We obtain the following (known) corollary of Theorem 2, whose proof is included for completeness. Corollary 1. Consider a discrete minimization problem (1) and its LP relaxation (2), admitting an α-integrality gap verifier A. Then (2) admits an oblivious α-integrality gap verifier A′. Proof. Given a (non-oblivious) α-integrality gap verifier A for (2), we can construct a randomized oblivious α-integrality gap verifier A′ as follows. By Theorem 2, for any given x∗ ∈ Q we can get a dominated convex combination as in (15), with a polynomially sized set X := {x ∈ S : µx > 0}. AsPx∈X µx = 1, these convex multipliers define a probability distribution over X . Letbx ∈ X be selected according to this distribution. Then E[bx] =Px∈X µxx ≤ αx∗ by (15). It follows, by linearity of expectation, that for any c ∈ Rn +, we have E[cTbx] = cT E[x] ≤ αcT x∗. From Lemma 1 and Corollary 1, we obtain an α-robust-in-expectation algorithm for (5) from an α-integrality gap verifier for (1)-(2). Theorem 3. Consider a discrete minimization problem (1) and its LP relaxation (2), admitting an α-integrality gap verifier A. Then there is a polytime α-robust-in-expectation algorithm for the robust version (7) w.r.t. to the any convex uncertainty set C ⊆ Rn +. We emphasize that, in Theorem 3, the integrality gap verifier must be defined with w.r.t. the whole class C = Rn objectives. Finally, we note that the results in this section can be extended, with no difficulty, to maximization problems. + of 2.1 A Deterministically Robust Algorithm for a Class of Polyhedral Uncertainty In [8], Bertsimas and Sim considered the minimization version of the DO problem (1), when the set S ⊆ {0, 1}n and the (budget) uncertainty set C is given by (16) (17) (18) C =(c := c0 + d ◦ u (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) u ∈ Rn +, ui ≤ 1,∀i ∈ [n], nXi=1 ui ≤ k) , where c0, d ∈ Rn + are given non-negative vectors, k ∈ Z+ is a given positive integer, and d ◦ y is the n-dimensional vector with components (d◦ u)i := diui, for i = 1, . . . , n. The constraints in (16) describe the situation when the uncertainty in each component of the objective vector c is described by an interval [c0 j + dj ] and at most k components are allowed to change. It was shown in [8] that an α-deterministically robust approximation algorithm for the minimization version of (5) with the uncertainty set given in (16), can be obtained from n + 1 calls to an α-approximation algorithm for the nominal problem (1). j , c0 In this section, we extend this result as follows. Consider a polyhedral uncertainty set given by +, u ≤ d, Au ≤ b(cid:9) , where d ∈ Rn set C in (16) can be written in the form (17) by replacing d ◦ u by u and setting A :=h 1 C =(cid:8)c := c0 + u u ∈ Rn + are given non-negative vectors and A ∈ Rm×n (assuming w.l.o.g. that di > 0 for all i). +, b ∈ Rm + is given non-negative matrix. Note that the uncertainty d1 ··· 1 dn i ∈ R1×n + , b :=h ki ∈ R1 + Fix an ǫ > 0. As we shall see below, we may assume, w.l.o.g., that bi > 0 for all i ∈ [m]. Define maxj dj (m + n) L(A, c0, d) := n · max(cid:26) maxj c0 j minj c0 j , · maxn maxi,j aij/bi minj maxi aij/bi , minj djo(cid:27) . ǫ 5 Theorem 4. Consider the DO problem (1), when the set S ⊆ {0, 1}n and the uncertainty set C is given by (17). Then, for any given ǫ > 0, there is an α-deterministically robust approximation algorithm for the cost-robust version (5), which can be obtained from O( log L(A,c0,d) )m) calls to an α-integrality gap verifier for the nominal problem (1). (log (1+ǫ)m ǫ ǫ Proof. Assume the availability of an α-integrality gap verifier for the nominal problem (1). We assume w.l.o.g. that 0 6∈ S. Note that the robust DO problem (5) in this case takes the form: xT u) . Let us consider the inner maximization problem in (19) and its dual (for a given x ∈ Rn +): x∈S((c0)T x + OPTR = min +: u≤d, Au≤b max u∈Rn z∗(x) = max xT u s.t. Au ≤ b, u ≤ d, u ∈ Rn + (20) (21) bT θ + dT y z∗(x) = min s.t. AT θ + y ≥ x, θ ∈ Rm + , y ∈ Rn +. Following [8], we write (19) using the dual (22) to obtain OPTR = min (c0)T x + bT θ + dT y s.t. AT θ + y ≥ x, + , y ∈ Rn +, θ ∈ Rm x ∈ S. (22) (23) (24) (19) (25) (26) Let aj ∈ Rm we know the minimizer θ∗ in (25). Then by (23) and (24), yj = max{x∗ aj ≥ 0, for any x ∈ S, it holds that + denote the jth column of A. The high-level idea of the approximation algorithm for (19) is as follows. Suppose j − (aj)T θ∗, 0}, for j = 1, . . . , n. As S ⊆ {0, 1}n and Thus, we may write (25) as max{xj − (aj)T θ∗, 0} = max{1 − (aj)T θ∗, 0}xj . OPTR = OPTR(θ∗) := min x∈S c(θ∗)T x + bT θ∗, (27) (28) where, for any θ ∈ Rm consider now the relaxation of (28): + , c(θ) is the vector with components cj (θ∗) := c0 j + dj · max{1 − (aj)T θ∗, 0}, for j = 1, . . . , n. Let us z∗ 2 = z∗ 2 (θ∗) := min x∈Q c(θ∗)T x + bT θ∗, (29) and let x∗ be an optimum solution to this relaxation. (Note that this relaxation is not the same as (9), and in general, one has z∗ 2 > z∗ also an α-approximate solution to the robust optimization problem (5), as R.) By the existence of an α-integrality gap verifier, there exists anbx ∈ S such that c(θ∗)Tbx ≤ α · c(θ∗)T x∗. Thenbx is Let y∗ be the vector with components y∗ c(θ∗)Tbx + bT θ∗ ≤ α · c(θ∗)T x∗ + bT θ∗ ≤ α(cid:0)c(θ∗)T x∗ + bT θ∗(cid:1) = α · z∗ 2 ≤ α · OPTR. (30) and hence (by weak duality),bxT u ≤ z∗(bx) ≤ bT θ∗ + dT y∗, for all u ∈ Rn given by (17), j := max{xj − (aj )T θ∗, 0}, for j = 1, . . . , n. Then the tuple (bx, θ∗, y∗) satisfies (23), + satisfying (21). It follows that for any c = c0 + u ∈ C cTbx = (c0)Tbx + uTbx ≤ (c0)Tbx + bT θ∗ + dT y∗ = c(θ∗)Tbx + bT θ∗ ≤ α · OPTR. Note that the function f (θ, x) := c(θ)T x+bT θ is quasi-convex in θ. Hence, even though we can evaluate f (θ) := minx∈S f (θ, x) at any point θ > 0, within a factor of α (using the α-integrality gap verifier), finding θ∗ ∈ argminθ≥0 f (θ) is generally a hard problem. The rest of the proof is an approximate version of the above argument in which we approximately "guess" the value of θ∗; this is done in 3 steps: rounding, discretization, and finally calling the integrality gap verifier for each enumerated value of θ∗. We describe these steps in more details below. (31) Rounding and discretization. Let the columns of A be a1, . . . , an ∈ Rm max(cid:8) maxi∈[m] aij, 1 := dj }. Note that, we may assume, w.l.o.g., that 0 < βj < +∞ for all j; otherwise, we may replace c0 j by c0 j + dj and remove uj from the set of variables in (20), and the corresponding dual constraints in (22). Similarly, if bi = 0 for some i ∈ [m], we may remove {uj : aij > 0} from the set of variables in (20) and the corresponding dual constrains in (22). Thus, we may assume in the following that bi > 0 for all i, and hence (by scaling) b = 1m, the m-dimensional vector of all ones, and that dj > 0 for all j. Let β := minj βj and γ := maxj βj. + , and for j = 1, . . . , n, denote by βj 6 Claim 5. For any x ∈ {0, 1}n \ {0}, 1 β d−1), where d−1 is the vector whose jth component is Proof. The upper bound follows from the fact that (θ = 1 β 1/dj , is a feasible solution for the dual problem (22). To see the lower bound, let (θ∗, y∗) be an optimal solution to the dual problem (22). Then for any j such that xj = 1, we have γ ≤ z∗(x) ≤ m+n β . 1m, y = 1 1 ≤ (aj )T θ∗ + y∗ j ≤ βj (1T mθ∗ + dj y∗ j ) ≤ γ(1T mθ∗ + dT y∗). For j ∈ [n], let j :=( ǫ c0 if c0 j < ǫ γn , γn , c0 j , otherwise, and, for θ ∈ Rm further + , defineec(θ) to be the vector with componentsecj (θ) := c0 j + dj · max{1 − (aj)T θ, 0}, for j = 1, . . . , n. Define (32) ǫ γ (by Claim 5) x∈Sn(c0)T x + z∗(x)o . gOPTR = min Claim 6. OPTR ≤ gOPTR ≤ (1 + ǫ)OPTR. Proof. Let x∗ andex be optimal solutions for (19) and (32), respectively. Then OPTR ≤ (c0)Tex + z∗(ex) ≤ (c0)Tex + z∗(ex) = gOPTR ≤ (c0)T x∗ + z∗(x∗) = (c0)T x∗ + z∗(x∗) + (c0 − c0)T x∗ ≤ OPTR + ≤ OPTR + ǫ · z∗(x∗) ≤ (1 + ǫ)OPTR. Claim 7. gOPTR ∈ [z, z], where z := max(cid:8) minj c0 Proof. Let ex be optimal solution for (32), and j ∈ [n] be an index such that exj = 1 (recall that we assume 0 6∈ S). Then, γn(cid:9), and z := n · max(cid:8) maxj c0 γn(cid:9) + m+n using Claim 5, j , ǫ j , ǫ β . max(cid:8) min j c0 j , ǫ γn(cid:9) ≤ c0 j ≤ gOPTR = (c0)Tex + z∗(ex) ≤ n · max(cid:8) max j c0 j , ǫ γn(cid:9) + m + n . β where For any h ∈ R+, let hǫ denote a "(1 + ǫ)-approximation" of h, that is, a numbereh ∈ R+, such that h <eh ≤ (1 + ǫ)h. By Claim 7, we can "guess" a "(1 + ǫ)-approximationezǫ := (gOPTR)ǫ by considering the powers z(1 + ǫ)k, for k = 0, 1, . . . ,⌈L⌉, L := log1+ǫ (z/z) = log1+ǫ n · max(cid:8) maxj c0 max(cid:8) minj c0 ≤ log1+ǫ(cid:18)2n · maxn maxj c0 ! ≤ log1+ǫ o(cid:19) = O(cid:18) log L(A, c0, d) (cid:19) . n · max(cid:8) maxj c0 2(cid:16)minj c0 γn(cid:9) + m+n γn(cid:9) γn(cid:9) + m+n γn(cid:17)  ≤ j , ǫ j + ǫ j minj c0 j (m + n)γ j , ǫ j , ǫ (33) (34) ǫβ ǫ β β , 1 + we denote by θǫ the vector in Rm For θ ∈ Rm Claim 8. There existseθ such that + , whose ith component is (θi)ǫ. Define gOPTR(θ) := minx∈S ǫ · (gOPTR)ǫ m ec(θ)T x + bT θ. (35) ≤eθi < (gOPTR)ǫ, for all i ∈ [m], and gOPTR(eθǫ) is a 5ǫ-approximation of OPTR. Proof. Let (bx, y∗, θ∗) be a minimizer of (25), where c0 is replaced by c0. Defineeθ as eθi :=( ǫ·(gOPTR)ǫ if θ∗ otherwise, i < ǫ·(gOPTR)ǫ θ∗ i , m m , , for i = 1, . . . , m. 7 Since we assume b = 1m, and c0, d ≥ 0, we have θ∗ eθǫ >eθ ≥ θ∗ and A ≥ 0, (bx, y∗,eθǫ) satisfies (26). Moreover, 1T meθǫ ≤ (1 + ǫ)1T It follows by Claim 6 that mθ∗ + 1T meθ = (1 + ǫ)(cid:0)1T gOPTR(eθǫ) ≤ (c0)Tbx + 1T m(eθ − θ∗)(cid:1) ≤ (1 + ǫ)(cid:0)1T meθǫ + dT y∗ ≤ (c0)Tbx + (1 + ǫ)1T ≤ (1 + ǫ + ǫ(1 + ǫ)2)gOPTR ≤ (1 + 5ǫ)OPTR. i ≤ gOPTR(θ∗) = gOPTR < (gOPTR)ǫ, and hence, eθ satisfies (35). Since mθ∗ + ǫ · (gOPTR)ǫ(cid:1) ≤ (1 + ǫ)1T mθ∗ + ǫ(1 + ǫ)2gOPTR. mθ∗ + ǫ(1 + ǫ)2gOPTR + dT y∗ Calling the integrality gap verifier. It follows from Claim 8 that we can guess an ǫ-approximation θ := θǫ of eθ by con- (1 + ǫ)ℓ, for ℓ = 0, 1, . . . ,⌈L′⌉ and a guessed value of gOPTR, where sidering, for each component θi, the powers ǫ·(gOPTR)ǫ L′ := log (1+ǫ)m . By Claim 7, the total number of possible guesses is m ǫ O(cid:18) log L(A, c0, d) ǫ . ǫ (1 + ǫ)m (cid:19) ×(cid:18)log (cid:19)m R(θ) := minx∈Qec(θ)T x + 1T For each such guess θ, we solve the convex relaxation z∗ mθ to find a minimizer x∗(θ), and then ec(bθ)Tbx + 1T mbθ ≤ec(eθǫ)Tbx(eθǫ) + 1T mθ over all guesses θ, and writebx := x(bθ). Then, similar to (30), it follows that call the integrality gap verifier on (ec(θ), x∗(θ)) to get an integral vectorbx(θ) ∈ S such thatec(θ)Tbx(θ) ≤ α ·ec(θ)T x∗(θ). Letbθ be a minimizer ofec(θ)Tbx(θ) + 1T where the last inequality follows by Claim 8. Letby be the vector with componentsbyj := max{bxj−(aj)Tbθ, 0}, for j = 1, . . . , n. Then (bx,bθ,by) satisfies (23), and hence,bxT u ≤ z∗(bx) ≤ 1T cTbx = (c0)Tbx + uTbx ≤ (c0)Tbx + 1T meθǫ) = α · z∗ mbθ + dTby, for all u ∈ Rn mbθ + dTby =ec(bθ)Tbx + 1T R(eθǫ) ≤ α · gOPTR(eθǫ) ≤ α(1 + 5ǫ)OPTR, meθǫ ≤ α(ec(eθǫ)T x∗(eθǫ) + 1T mbθ ≤ α(1 + 5ǫ)OPTR. for any c = c0 + u ∈ C, given by (17), + satisfying (21). It follows, as in (31), that (36) We remark that any α-approximation algorithm can be used instead of an α-integrality gap verifier in Theorem 4. Note also that, if both maxj c0 j minj c0 j and maxj dj minj dj are bounded by poly(n), then Theorem 4 requires only polylog(n) number of calls to the the integraliy gap verifier, which is an exponential improvement over the result in [8] in such a case. A set S ⊆ {0, 1}n is said to be covering if x ∈ S implies that y ∈ S for any y ≥ x. For instance, if the set S represents subgraphs (say, as edge sets) of a given graph satisfying a certain monotone property (such as connectivity or containment), then S is covering. Theorem 4 gives a reduction from an α-integrality gap verifier to (1 + ǫ)α-deterministically robust approximation algorithm assuming m = O(1). When m is not a constant, and the set S is of the covering type, we have the following result. Theorem 9. Consider the DO problem (1), when the set S ⊆ {0, 1}n is a covering set and the uncertainty set C is given by β (cid:1)-deterministically robust approximation algorithm for the robust version (5), which can (17). Then, there is an(cid:0)α + 2q αγn be obtained by a polynomial number of calls to an α-integrality gap verifier for the nominal problem (1). Proof. We use a dual-fitting argument [26, Chapter 13]. Let z∗ R be the value of the relaxation for (19), that is, z∗ R = min x∈Q((c0)T x + u∈Rn max +: Au≤1m xT u) , (37) where we assume (w.l.o.g.), for ease of presentation, that the constraint u ≤ d has already been included in the set of constraints given by Au ≤ b, and that b := 1m. As in (25), we can rewrite (6) as z∗ R = min (c0)T x + bT θ s.t. AT θ ≥ x, θ ∈ Rm + , x ∈ Q. (38) (39) Let (x∗, θ∗) be an optimal solution for the LP (38). We first call the algorithm in Theorem 2 to get a dominated convex combination as in (15), with a polynomially sized set X := {x ∈ S : µx > 0}. Let τ ∈ (0, 1) be a number to be chosen later, and define J := {j ∈ [n] : x∗ j ≥ τ}. 8 1, j x∗ j x∗ j + 1 j + α j xj + 1 j . The claim follows. if j 6∈ J, if j ∈ J. βPj6∈J x∗ j(cid:1). βPj6∈J x∗ βPj6∈J xj ≤ α(cid:0)Pj6∈J c0 Claim 10. There exists x ∈ X such thatPj6∈J c0 Proof. As Px∈X µx = 1, these convex multipliers define a probability distribution over X . Let bx ∈ X be selected ac- cording to this distribution. Then E[bx] = Px∈X µxx ≤ αx∗, and by linearity of expectation, E[Pj6∈J c0 βPj6∈Jbxj] ≤ jbxj + 1 αPj6∈J c0 Let x ∈ X be a vector chosen to satisfy the condition in Claim 10. We define the rounded vectorbx as follows: bxj :=( xj, Note that bx ∈ S since S is covering. Now, we define the corresponding dual solution bθ. For j 6∈ J, define i(j) to be the smallest i ∈ [m] such that i ∈ argmaxi′ ai′j . Next, definebθ ∈ Rm β Xj6∈J : i=i(j) β (cid:17) OPTR. mbθ ≤(cid:16)α + 1 Claim 11. (bx,bθ) is feasible for (38) and (c0)Tbx + 1T Proof. First, we show feasibility of (bx,bθ) for (38). If j ∈ J, then (aj)T θ∗ ≥ x∗ On the other hand, if j 6∈ J andbxj = xj = 1, then (aj)Tbθ ≥ 1 By definition ofbx,bθ and J, (c0)Tbx + 1T j ≥ τ , and hence, (aj)Tbθ ≥ 1 β aijPj ′6∈J : i=i(j ′) xj ′ ≥ xj = 1, where i := i(j). τ (aj)T θ∗ ≥ 1 =bxj. bθi := for i = 1, . . . , m. + as follows: τ + αγτ n mθ∗ + 1T c0 j xj + θ∗ i + 1 τ 1 τ xj xj 1 c0 j xj + mθ∗ + 1T 1 τ 1 βXi Xj6∈J : i=i(j) βXj6∈J xj 1 j +Xj6∈J j +Xj6∈J c0 j x∗ c0 mbθ ≤Xj∈J =Xj∈J τ Xj∈J ≤ c0 1 α β Xj6∈J 1 τ 1T mθ∗ + mθ∗i + ατ n β j + c0 j x∗ j + αXj6∈J , α}h(c0)T x∗ + 1T , α}z∗ 1 τ , α} + αγτ n αγτ n R + β 1 τ 1 τ OPTR ≤ max{ ≤ max{ ≤(cid:18)max{ β (cid:19) OPTR ≤(cid:18)α + 1 τ + αγτ n β (cid:19) OPTR. x∗ j (by the choice of x) (by the definition of J) (by Claim 5) It follows that for any c = c0 + u ∈ C, given by (17), cTbx = (c0)Tbx + uTbx ≤ (c0)Tbx + z∗(bx) ≤ (c0)Tbx + 1T The theorem finally follows by choosing τ :=q β αγn . mbθ ≤(cid:18)α + 1 τ + αγτ n β (cid:19) OPTR. (40) Remark 2. Note in the proof of Theorem 9 that we use strong LP duality in deriving (38), while only weak duality is used in (40). We also note that one does not actually need to compute the dual solution θ∗, but it is only used to obtain a proof of approximate optimality of the integral solutionbx. 2.2 Robust-with-high-probability Approximation Algorithm for Polyhedral Uncertainty Next, we consider the case when the uncertainty set C is given by (4) and D = {δ ∈ Rk and γ := maxi,j aij, cmin := minr6=0,j: cr max. j and cmax := maxr6=0 cr max := maxj cr j ,cr + : Aδ ≤ b}. Let β := minj maxi aij j >0 cr Rk Theorem 12. Consider the DO problem (1), when S ⊆ {0.1}n and the uncertainty set C is given by (4) and D = {δ ∈ cmin(cid:1)-robust-with-high-probability approximation algorithm for the robust + : Aδ ≤ b}. Then, there is an O(cid:0)αqk log(k) γ version (5), which can be obtained by a polynomial number of calls to an α-ANCRR integrality gap verifier for the nominal problem (1). cmax β 9 Proof. Assume the availability of an α-ANCRR integrality gap verifier for the nominal problem (1). We assume w.l.o.g. that b = 1m. Note that the robust DO problem (5) in this case takes the form: OPTR = min x∈S((c0)T x + max +: Aδ≤1m δ∈Rk xT Cδ) , (41) where C ∈ Rn×k dual (for a given x ∈ {0, 1}n): + is the matrix whose columns are c1, . . . , ck. Let us consider the inner maximization problem in (41) and its z∗(x) = max xT Cδ s.t. Aδ ≤ 1m, δ ∈ Rk + (42) (43) 1T mθ z∗(x) = min s.t. AT θ ≥ CT x, θ ∈ Rm + . (44) (45) (46) Note that if CT x = 0 for x ∈ {0, 1}n, then z∗(x) = 0 and xj = 0 for all j ∈ J := {j ∈ [n] ∃r ∈ [k] : cr j > 0}. Thus, by considering the relaxation (2) with c = c0 and Q replaced by Q′ := {x ∈ Q : xj = 0 ∀j ∈ J}, and calling the integrality gap (or discover that none exist if the relaxation is infeasible). In view of Remark 1, this expectation guarantee can be turned into verifier on the obtained optimal fractional solution x∗, we can find an integral solutionbx ∈ S such that E[(c0)Tbx] ≤ α(c0)T x∗ a high-probability guarantee without sacrificing much the approximation ratio, that is, we can get a solutionbx0 ∈ S such that, with probability 1 − o(1), we have (c0)Tbx0 ≤ (1 + ǫ)(c0)T x∗, for any given ǫ > 0. We will assume therefore in the following that CT x 6= 0 for all x ∈ S, as we will return the minimum of the solution obtained under this assumption and (c0)Tbx0. Claim 13. For any x ∈ {0, 1}n such that CT x 6= 0, we have z∗(x) ≥ cmin γ . Proof. Let (θ∗, y∗) be an optimal solution to the dual problem (44). Since CT x 6= 0, there exist r, j such that cr xj = 1. Then, j > 0 and cmin ≤ cr j ≤ (cr)T x ≤ (ar)T θ∗ ≤ γ1T mθ∗. The claim follows. Let z∗ R be the value of the relaxation for (41), that is, As in (25), we may rewrite (47) as z∗ R = min x∈Q((c0)T x + max +: Aδ≤1m δ∈Rk xT Cδ) . z∗ R = min (c0)T x + 1T mθ s.t. AT θ ≥ CT x, θ ∈ Rm + , x ∈ Q. (47) (48) (49) Let (x∗, θ∗) be an optimal solution for the LP (48). We call the α-ANCRR integrality gap verifier on x∗ to get an α-ANCRR Proof. We will use the following extension of Chernoff bound: bx ∈ S. Let τ ∈ (0, 1) be a number to be chosen later, and define R := {r ∈ [k] : (cr)T x∗ ≥ τ cr Claim 14. For ρ ≥ 1, Pr(cid:2)∀r ∈ R : (cr)Tbx ≤ (1 + ρ)α(ar)T θ∗(cid:3) ≥ 1 − ke−ρατ /3. Fact 1 ([24]). Let w ∈ [0, 1]n be a given vector of numbers andbx ∈ {0, 1}n be a vector of random variables. Suppose that (3) holds for all S ⊆ [n], and E[wTbx] ≤ µ. Then for any ρ ≥ 1, we have Pr[wTbx ≥ (1 + ρ)µ] ≤ e−µρ/3. Fix r ∈ R. Applying Fact 1 with w := cr for (45) that E[(cr)Tbx] ≤ α(cr)T x∗ ≤ α(ar)T θ∗, we obtain, for ρ ≥ 1, max ∈ [0, 1]n and noting by property (i) of an α-ANCRR and the feasibility of x∗ − ρα(cr )T x∗ max}. 3cr cr Pr[(cr)Tbx ≥ (1 + ρ)α(ar)T θ∗] ≤ Pr(cid:2)(cr)Tbx ≥ (1 + ρ)α(cr)T x∗(cid:3) ≤ e The claim follows by applying a union bound over all r ∈ R. max ≤ e−ρατ /3. For r 6∈ R, define i(r) to be the smallest i ∈ [m] such that i ∈ argmaxi′ ai′r. Let us next choose ρ := 6 ln(2k) define the dual solutionbθ ∈ Rm + as follows: τ for i = 1, . . . , m. > 1 and Let us fix an arbitrary constant ǫ ∈ (0, 1). bθi := (1 + ρ)αθ∗ i + 1 β Xr6∈R: i=i(r) (cr)Tbx, 10 Claim 15. With probability 1 − o(1), (bx,bθ) is feasible for (48) and (c0)Tbx + 1T Proof. First, we show feasibility of (bx,bθ). By Claim 14, with probability 1 − ke−ρατ /3 ≥ 1 − 1 ρ)α(ar)T θ∗ ≥ (cr)Tbx, and hence, (ar)Tbθ ≥ (cr)Tbx. On the other hand, if r 6∈ R, then (ar)Tbθ ≥ aij )Tbx ≥ (cr)Tbx, where i := i(r). By property (i) of an α-ANCRR, we have E[(c0)Tbx] ≤ α(c0)T x∗, and by definition of R, we have E[PiPr6∈R: i=i(r)(cr)Tbx] ≤ αPiPr6∈R: i=i(r)(cr)T x∗ ≤ kατ cmax. Thus, in view of Remark 1, with prob. 1 − o(1), for any ǫ ∈ (0, 1), we have (c0)Tbx + 1 (cid:1). It follows that, with prob. 1 − o(1), we have (cid:17) αOPTR. β Pr′6∈R: i=i(r′)(cr′ mbθ ≤(cid:16)(1 + ρ) + (1+ǫ)γτ cmaxk 4k , for all r ∈ R, we have (1 + βPiPr6∈R: i=i(r)(cr)Tbx ≤ (1 + ǫ)(cid:0)α(c0)T x∗ + kατ cmax mbθ = (c0)Tbx + (1 + ρ)α1T (c0)Tbx + 1T βXi Xr6∈R: i=i(r) (cr)Tbx kατ cmax mθ∗ + βcmin 1 β mθ∗ + (1 + ǫ) β ≤ (1 + ǫ)α(c0)T x∗ + (1 + ρ)α1T (1 + ǫ)αγτ cmaxk ≤ (1 + ρ)αz∗ ≤(cid:18)(1 + ρ) + (1 + ǫ)γτ cmaxk βcmin βcmin R + (cid:19) αOPTR. OPTR (by Claim 13) we have It follows from Claim 15 that, With probability 1−o(1), for any c = c0 +Cδ ∈ C, given by (4) with D = {δ ∈ Rk (cid:19) αOPTR. cTbx = (c0)Tbx + (Cδ)Tbx ≤ (c0)Tbx + z∗(bx) ≤ (c0)Tbx + 1T mbθ ≤(cid:18)(1 + ρ) + (1 + ǫ)γτ cmaxk βcmin The theorem follows by choosing τ :=q 6β ln(2k)cmin (1+ǫ)αγcmax k . 2.3 A Deterministic Robust Approximation Algorithm for Ellipsoidal Uncertainty + : Aδ ≤ b}, Consider the DO problem (1) and its LP-relaxation (2), when the uncertainty set C is given by the ellipsoid: (50) (51) C =(c := c0 + kXr=1 δrcr(cid:12)(cid:12)(cid:12) δ ∈ Rk, kD−1δk2 ≤ 1) , + are given non-negative vectors, and D ∈ Rk×k where c0, c1, . . . , ck ∈ Rn Theorem 16. Consider the DO problem (1) and its relaxation (6), when the uncertainty set C is given by (51), such that DC ≥ 0. Then, there is an O(cid:0)α√k(cid:1)-deterministically robust approximation algorithm for the robust minimization problem (5), which can be obtained by a polynomial number of calls to an α-integrality gap verifier for the nominal problem (1). is a given positive definite matrix. + Proof. Let x∗ be an optimal solution for the convex relaxation (6): z∗ R = min x∈Q(cid:26)(c0)T x + max w∈Rn: kwk2≤1 xT CDw(cid:27) = min x∈Qn(c0)T x + kDCT xk2o . (52) Call the algorithm in Theorem 2 to get a dominated convex combination as in (15), with a polynomially sized set X := {x ∈ S : µx > 0}. Choosebx ∈ argminx∈X(cid:0)cT cT 0 x + kDC T xk2(cid:1). Then µx(c0)T x +Xx∈X 0bx + kDCTbxk ≤ Xx∈X µx(c0)T x +Xx∈X = Xx∈X ≤ α(c0)T x∗ + αXj ≤ α(c0)T x∗ + α√nkDCT x∗k2 ≤ α√k · z∗ µxkDCT xk2 ≤ Xx∈X µxXj (DCT x)j = Xx∈X (DCT x∗)j = α(c0)T x∗ + αkDCT x∗k1 R ≤ α√k · OPTR. µx(c0)T x +Xx∈X µx(c0)T x +Xj Xx∈X µxkDCT xk1 µx(DCT x)j (∵ DC ≥ 0) It follows that for any c = c0 + Cδ ∈ C, given by (51), cTbx = (c0)Tbx + (Cδ)Tbx = (c0)Tbx + (D−1δ)T (DCTbx) ≤ (c0)Tbx + kD−1δk2 · kDCTbxk2 ≤ (c0)Tbx + kDCTbxk2 ≤ α√k · OPTR. 11 Next, let us consider the case when the set S ⊆ {0, 1}n and the uncertainty set C is given by C =(cid:8)c := c0 + u (cid:12)(cid:12) u ∈ Rn +, kD−1uk2 ≤ 1(cid:9) , for a given a given positive definite matrix D ∈ Rn×n. Theorem 17. Consider the DO problem (1) and its relaxation (6), when the set S ⊆ {0, 1}n is a covering set and the λmin(D) (cid:1)-deterministically robust uncertainty set C is given by (53), such that D−1 > 0. Then, there is an O(cid:0)α +q αλmax(D)n approximation algorithm for the robust version (5), which can be obtained by a polynomial number of calls to an α-integrality gap verifier for the nominal problem (1). Proof. Note that the robust DO problem (5) in this case takes the form: OPTR = min x∈S((c0)T x + max u∈Rn +: kD−1uk2≤1 xT u) . (54) Let us consider the inner maximization problem in (19), which can be written as the following semi-infinite LP (as D−1 > 0), and its dual (for a given x ∈ Rn +): xT u z∗(x) = max vT u ≤ 1, ∀v ∈ E+(0, D−1) := {v ∈ Rn u ≥ 0, u ∈ Rn (55) + : vT D2v ≤ 1}, s.t. Zv∈E+(0,D−1) z∗(x) = min Zv∈E+(0,D−1) θ : E+(0, D−1) → R+. θ(v)vdv ≥ x, θ(v)dv (56) (57) (58) It was shown in [17] that, for any given x ∈ Rn +, a near-optimal solution for (55) can be obtained in polynomial time, using multiplicative weight updates, which also produces a near-optimal solution to (56). More precisely, for any ǫ > 0, we can find in poly(n, m, log λmax(D) , 1 ǫ ) time, where λmin(D) and λmax(D) are the minimum and maximum eigenvalues of D λmin(D) + and a (implicitly described) function θ∗ : E(0, D−1) → R+, satisfying (57) and respectively, and vectors θ∗ ∈ Rm (53) (59) (60) Zv∈E+(0,D−1) θ∗(v)dv ≤ (1 + ǫ)z∗(x). Note that (59) implies that strong duality holds, as we can set ǫ → 0. Thus, we may write (54) as follows: OPTR = min (c0)T x +Zv∈E+(0,D−1) Zv∈E+(0,D−1) θ : E+(0, D−1) → R+, x ∈ S. vθ(v)dv ≥ x, s.t. θ(v)dv We will make use of the lower bound in the following claim. Claim 18. For any x ∈ {0, 1}n \ {0}, λmin(D) ≤ z∗(x) ≤ λmax(D)√n. Proof. First we show the upper bound: z∗(x) = max u≥0: vT u≤1, ∀v∈E+(0,D−1) xT u = max u≥0: kD−1uk2≤1 xT u ≤ max u≥0: kD−1uk2≤1 1T n u ≤ kD1nk2 ≤ λmax(D)√n. (61) To see the lower bound, let θ∗ be an optimal solution to the dual problem (56). Then for any j such that xj = 1, we have 1 ≤Zv∈E+(0,D−1) vj θ∗(v)dv ≤ λmax(D−1)Zv∈E+(0,D−1) θ∗(v)dv = λmax(D−1)z∗(x). The claim follows. Let x∗ ∈ Q be an optimal solution for the convex relaxation (6): z∗ R = min x∈Q((c0)T x + max w∈Rn + : kD−1uk2≤1 uT x) , (62) and θ∗ be a corresponding dual solution. (As in Remark 2, we do not actually need to compute the dual solution, but we use its existence to bound the rounded integral solution.) We first call the algorithm in Theorem 2 to get a dominated convex combination as in (15), with a polynomially sized set X := {x ∈ S : µx > 0}. Let τ ∈ (0, 1) be a number to be chosen later, and define J := {j ∈ [n] : x∗ j ≥ τ}. Similar to Claim 10, we can prove the following. 12 Claim 19. There exists x ∈ X such thatPj6∈J c0 Let x ∈ X be a vector chosen to satisfy the condition in Claim 19. We define the rounded vectorbx as follows: j(cid:1). j + λmax(D)Pj6∈J x∗ j x∗ j xj + λmax(D)Pj6∈J xj ≤ α(cid:0)Pj6∈J c0 bxj :=( xj, θ∗(v) + λmax(D) Xv′∈T if j 6∈ J, if j ∈ J. δn(v − v′), 1 τ 1, bθ(v) := Note thatbx ∈ S since S is covering. We next definebθ : E+(0, D−1) → R+ as follows: where T := {v ∈ E+(0, D−1) : ∃j 6∈ J s.t. xj = 1 and vj = maxv′∈E+(0,D−1) v′ Dirac delta function satisfying δn(v) = 0 for all v 6= 0 andRv∈Rn δn(v)dv = 1. Claim 20. (bx,bθ) is feasible for (60) and (c0)Tbx +Rv∈E+(0,D−1)bθ(v)dv ≤(cid:16)α + 1 Proof. First, we show feasibility of (bx,bθ). If j ∈ J, thenRv∈E+(0,D−1) vj θ∗(v)dv ≥ x∗ τ (Rv∈E+(0,D−1) vj θ∗(v)dv) ≥ 1 =bxj . On the other hand, if j 6∈ J andbxj = xj = 1, then τ + 1 vjbθ(v)dv ≥ λmax(D) Xv′∈TZv∈E+(0,D−1) = λmax(D) max (1j kwk≤1, D−1w≥0 vj δn(v − v′)dv ≥ λmax(D) n)T D−1w ≥ λmax(D)(1j Zv∈E+(0,D−1) j} and δn : Rn → R is the n-dimensional αλmax(D) τ n λmin(D) (cid:17) OPTR. j ≥ τ , and hence,Rv∈E+(0,D−1) vjbθ(v)dv ≥ max vj v∈E+(0,D−1) n)T D−11j n ≥ λmax(D)λmin(D−1) = 1, where 1n c0 j is the j unit vector of dimension n. Also, by definition ofbx,bθ and J, (c0)Tbx +Zv∈E+(0,D−1)bθ(v)dv ≤Xj∈J (c0)Tbx +Zv∈E+(0,D−1)bθ(v)dv ≤Xj∈J τ Xj∈J τ Zv∈E+(0,D−1) τ Zv∈E+(0,D−1) τ Zv∈E+(0,D−1) j +Xj6∈J j +Xj6∈J c0 j xj + c0 j xj + c0 j x∗ c0 j x∗ ≤ c0 1 1 1 θ∗(v)dv + λmax(D) Xv′∈TZv∈E+(0,D−1) θ∗(v)dv + λmax(D)Xj6∈J xj δn(v − v′)dv x∗ j (by Claim 19) 1 j + θ∗(v)dv + αλmax(D)Xj6∈J j + αXj6∈J , α}"(c0)T x∗ +Zv∈E+(0,D−1) , α}"(c0)T x∗ +Zv∈E+(0,D−1) θ∗(v)dv# + ατ nλmax(D) θ∗(v)dv# + λmin(D) (cid:19) OPTR ≤(cid:18)α + 1 τ , α} + αλmax(D)τ n αλmax(D)τ n αλmax(D)τ n λmin(D) 1 τ + λmin(D) (cid:19) OPTR. ≤ max{ ≤ max{ 1 τ 1 τ ≤(cid:18)max{ OPTR (by Claim 18) It follows that for any c = c0 + u ∈ C, given by (53), cTbx = (c0)Tbx + uTbx ≤ (c0)Tbx +Zv∈E+(0,D−1)bθ(v)dv+ ≤(cid:18)α + 1 τ + αλmax(D)τ n λmin(D) (cid:19) OPTR. (63) The theorem follows by choosing τ :=r λmin(D) αλmax(D) n . 2.4 Robust-with-high-probability Approximation Algorithm for Ellipsoidal Uncertainty By arguments similar to the ones used to prove Theorems 12 and 17 we obtain the following result. Theorem 21. Consider the DO problem (1), when S ⊆ {0.1}n and the uncertainty set C is given by (4) and D = {δ ∈ Rk + : cmin(cid:1)-robust-with-high-probability approximation algorithm for the kD−1δk2 ≤ 1}. Then, there is an O(cid:0)αrk log(k) robust version (5), which can be obtained by a polynomial number of calls to an α-ANCRR integrality gap verifier for the nominal problem (1). Remark 3. We may also consider the case when the set S ⊆ {0, 1}n and the uncertainty set C is given by λmax(D) λmin(D) cmax C =(cid:8)c := c0 + u (cid:12)(cid:12) u ∈ Rn + +, kD−1uk2 ≤ 1, u ≤ d, Au ≤ 1m(cid:9) , . Using similar techniques, a bound generalizing the results of Theorems 9 and (64) for a given non-negative matrix A ∈ Rm×n 17 can be obtained. 13 References [1] A. Agra, M. Santos, D. Nace, and M. Poss. A dynamic programming approach for a class of robust optimization problems. SIAM Journal on Optimization, 26(3):1799 -- 1823, 2016. [2] Eduardo ´Alvarez-Miranda, Ivana Ljubi´c, and Paolo Toth. A note on the bertsimas & sim algorithm for robust combi- natorial optimization problems. 4OR, 11(4):349 -- 360, Dec 2013. [3] Artur Alves Pessoa, Luigi Di Puglia Pugliese, Francesca Guerriero, and Michael Poss. Robust constrained shortest path problems under budgeted uncertainty. Networks, 66(2):98 -- 111. [4] A. Ben-Tal, L. El Ghaoui, and A.S. Nemirovski. Robust Optimization. Princeton Series in Applied Mathematics. Princeton University Press, October 2009. [5] A. Ben-Tal and A. Nemirovski. Robust convex optimization. Mathematics of Operations Research, 23(4):769 -- 805, 1998. [6] A. Ben-Tal and A. Nemirovski. Robust optimization - methodology and applications. Math. Program., 92(3):453 -- 480, 2002. [7] Dimitris Bertsimas, David B. Brown, and Constantine Caramanis. Theory and applications of robust optimization. SIAM Review, 53(3):464 -- 501, 2011. [8] Dimitris Bertsimas and Melvyn Sim. Robust discrete optimization and network flows. Mathematical Programming, 98(1):49 -- 71, Sep 2003. [9] Dimitris Bertsimas and Melvyn Sim. Robust discrete optimization under ellipsoidal uncertainty sets. Technical report, Technical report, MIT, 2004. [10] Dimitris Bertsimas and Melvyn Sim. Tractable approximations to robust conic optimization problems. Math. Program., 107(1-2):5 -- 36, June 2006. [11] John R. Birge and Franois Louveaux. Introduction to Stochastic Programming. Springer Publishing Company, Incor- porated, 2nd edition, 2011. [12] Marin Bougeret, Artur Alves Pessoa, and Michael Poss. Robust scheduling with budgeted uncertainty. Discrete Applied Mathematics, 261:93 -- 107, 2019. GO X Meeting, Rigi Kaltbad (CH), July 10 -- 14, 2016. [13] R. D. Carr and S. Vempala. Randomized metarounding. Random Struct. Algorithms, 20(3):343 -- 352, 2002. [14] Erick Delage and Yinyu Ye. Distributionally robust optimization under moment uncertainty with application to data- driven problems. Operations Research, 58(3):595 -- 612, 2010. [15] Kedar Dhamdhere, Vineet Goyal, R. Ravi, and Mohit Singh. How to pay, come what may: Approximation algorithms for demand-robust covering problems. In 46th Annual IEEE Symposium on Foundations of Computer Science (FOCS 2005), 23-25 October 2005, Pittsburgh, PA, USA, Proceedings, pages 367 -- 378, 2005. [16] L. El Ghaoui, F. Oustry, and H. Lebret. Robust solutions to uncertain semidefinite programs. SIAM Journal on Optimization, 9(1):33 -- 52, 1998. [17] Khaled Elbassioni, Kazuhisa Makino, and Waleed Najy. A multiplicative weight updates rithm for packing and covering semi-infinite https://doi.org/10.1007/s00453-018-00539-4. linear programs. Algorithmica, Jan 2019. algo- URL: [18] Uriel Feige, Michal Feldman, and Inbal Talgam-Cohen. Oblivious Rounding and the Integrality Gap. In Klaus Jansen, Claire Mathieu, Jos´e D. P. Rolim, and Chris Umans, editors, Approximation, Randomization, and Combinatorial Opti- mization. Algorithms and Techniques (APPROX/RANDOM 2016), volume 60 of Leibniz International Proceedings in Informatics (LIPIcs), pages 8:1 -- 8:23, Dagstuhl, Germany, 2016. Schloss Dagstuhl -- Leibniz-Zentrum fuer Informatik. [19] Uriel Feige, Kamal Jain, Mohammad Mahdian, and Vahab Mirrokni. Robust combinatorial optimization with ex- ponential scenarios. In Matteo Fischetti and David P. Williamson, editors, Integer Programming and Combinatorial Optimization, pages 439 -- 453, Berlin, Heidelberg, 2007. Springer Berlin Heidelberg. [20] Kai-Simon Goetzmann, Sebastian Stiller, and Claudio Telha. Optimization over integers with robustness in cost and few constraints. In Roberto Solis-Oba and Giuseppe Persiano, editors, Approximation and Online Algorithms, pages 89 -- 101, Berlin, Heidelberg, 2012. Springer Berlin Heidelberg. [21] M. Grotschel, L. Lov´asz, and A. Schrijver. Geometric Algorithms and Combinatorial Optimization, volume 2 of Algorithms and Combinatorics. Springer, second corrected edition, 1993. 14 [22] Anna Ilyina. Combinatorial optimization under ellipsoidal uncertainty. Technischen Universitat Dortmund. Ph.D. Thesis, 2017. [23] Yasushi Kawase and Hanna Sumita. Randomized strategies for robust combinatorial optimization. CoRR, abs/1805.07809, 2018. URL: http://arxiv.org/abs/1805.07809. [24] A. Panconesi and A. Srinivasan. Randomized distributed edge coloring via an extension of the chernoff -- hoeffding bounds. SIAM Journal on Computing, 26(2):350 -- 368, 1997. [25] Michael Poss. Contributions to robust combinatorial optimization with budgeted uncertainty. Universit´e de Montpellier. Oper- ations Research [cs.RO], 2016. tel-01421260. [26] Vijay V. Vazirani. Approximation Algorithms. Springer-Verlag, Berlin, Heidelberg, 2001. 15
1312.6724
3
1312
2015-03-19T23:45:54
Local algorithms for interactive clustering
[ "cs.DS", "cs.LG" ]
We study the design of interactive clustering algorithms for data sets satisfying natural stability assumptions. Our algorithms start with any initial clustering and only make local changes in each step; both are desirable features in many applications. We show that in this constrained setting one can still design provably efficient algorithms that produce accurate clusterings. We also show that our algorithms perform well on real-world data.
cs.DS
cs
Local algorithms for interactive clustering Pranjal Awasthi Department of Computer Science Princeton University Maria Florina Balcan School of Computer Science Carnegie Mellon University Konstantin Voevodski Google, NY, USA Editor: [email protected] [email protected] [email protected] Abstract We study the design of interactive clustering algorithms for data sets satisfying natural stability assumptions. Our algorithms start with any initial clustering and only make local changes in each step; both are desirable features in many applications. We show that in this constrained setting one can still design provably efficient algorithms that produce accurate clusterings. We also show that our algorithms perform well on real-world data. 1. Introduction Clustering is usually studied in an unsupervised learning scenario where the goal is to partition the data given pairwise similarity information. Designing provably-good clustering algorithms is challenging because given a similarity function there may be multiple plausible clusterings of the data. Traditional approaches resolve this ambiguity by making assumptions on the data-generation process. For example, there is a large body of work that focuses on clustering data that is generated by a mixture of Gaussians Achlioptas and McSherry (2005); Kannan et al. (2005); Dasgupta (1999); Arora and Kannan (2001); Brubaker and Vempala (2008); Kalai et al. (2010); Moitra and Valiant (2010); Belkin and Sinha (2010). Although this helps define the "right" clustering one should be looking for, real-world data rarely comes from such well-behaved probabilistic models. An alternative approach is to use limited user supervision to help the algorithm reach the desired answer. This approach has been facilitated by the availability of cheap crowd-sourcing tools in recent years. In certain applications such as search and document classification, where users are willing to help a clustering algorithm arrive at their own desired answer with a small amount of additional prodding, interactive algorithms are very useful. Hence, the study of interactive clustering algorithms has become an exciting new area of research. In many practical settings we already start with a fairly good clustering computed with semi- automated techniques. For example, consider an online news portal that maintains a large collection of news articles. The news articles are clustered on the "back-end," and are used to serve several "front-end" applications such as recommendations and article profiles. For such a system, we do not have the freedom to compute arbitrary clusterings and present them to the user, which has been proposed in prior work. But it is still feasible to get limited feedback and locally edit the clustering. 1 In particular, we may only want to change the "bad" portion revealed by the feedback without changing the rest of the clustering. Motivated by these observations, in this paper we study the problem of designing local algorithms for interactive clustering. We propose a theoretical interactive model and provide strong experimental evidence supporting the practical applicability our algorithms. In our model we start with an initial clustering of the data. The algorithm then interacts with the user in stages. In each stage the user provides limited feedback on the current clustering in the form of split and merge requests. The algorithm then makes a local edit to the clustering that is consistent with user feedback. Such edits are aimed at improving the problematic part of the clustering pointed out by the user. The goal of the algorithm is to quickly converge (using as few requests as possible) to a clustering that the user is happy with - we call this clustering the target clustering. In our model the user may request a certain cluster to be split if it is overclustered (intersects two or more clusters in the target clustering). The user may also request to merge two given clusters if they are underclustered (both intersect the same target cluster). Note that the user may not tell the algorithm how to perform the split or the merge; such input is infeasible because it requires a manual analysis of all the objects in the corresponding clusters. We also restrict the algorithm to only make local changes at each step, i.e., in response we may change only the cluster assignments of the points in the corresponding clusters. If the user requests to split a cluster Ci, we may change only the cluster assignments of points in Ci, and if the user requests to merge Ci and Cj , we may only reassign the points in Ci and Cj. The split and merge requests described above are a natural form of feedback. It is easy for users to spot over/underclustering issues and request the corresponding splits/merges (without having to provide any additional information about how to perform the edit). For our model to be practically applicable, we also need to account for noise in the user requests. In particular, if the user requests a merge, only a fraction or a constant number of the points in the two clusters may belong to the same target cluster. Our model (See Section 2) allows for such noisy user responses. We study the complexity of algorithms in the above model (the number of edits requests needed to find the target clustering) as a function of the error of the initial clustering. The initial error may be evaluated in terms of underclustering error δu and overclustering error δo (See Section 2). Because the initial error may be fairly small,1 we would like to develop algorithms whose com- plexity depends polynomially on δu, δo and only logarithmically on n, the number of data points. We show that this is indeed possible given that the target clustering satisfies a natural stability prop- erty (see Section 2). We also develop algorithms for the well-known correlation-clustering objective function Bansal et al. (2004), which considers pairs of points that are clustered inconsistently with respect to the target clustering (See Section 2). As a pre-processing step, our algorithms compute the average-linkage tree of all the points in the data set. Note that if the target clustering C∗ satisfies our stability assumption, then the average- linkage tree must be consistent with C∗ (see Section 3). However, in practice this average-linkage tree is much too large to be directly interpreted by the users. Still, given that the edit requests are somewhat consistent with C∗, we can use this tree to efficiently compute local edits that are consistent with the target clustering. Our analysis then shows that after a limited number of edit requests we must converge to the target clustering. 1. Given 2 different k clusterings, δu and δo is atmost k2. 2 Our Results In Section 3 we study the η-merge model. Here we assume that the user may request to split a cluster Ci only if Ci contains points from several ground-truth clusters. The user may request to merge Ci and Cj only if an η-fraction of points in each Ci and Cj are from the same ground-truth cluster. For this model for η > 0.5, given an initial clustering with overclustering error δo and under- clustering error δu, we present an algorithm that requires δo split requests and 2(δu + k) log 1 n 1−η merge requests to find the target clustering, where n is the number of points in the dataset. For η > 2/3, given an initial clustering with correlation-clustering error δcc, we present an algorithm that requires at most δcc edit requests to find the target clustering. In Section 4 we relax the condition on the merges and allow the user to request a merge even if Ci and Cj only have a single point from the same target cluster. We call this the unrestricted-merge model. Here the requirement on the accuracy of the user response is much weaker and we need to make further assumptions on the nature of the requests. More specifically, we assume that each merge request is chosen uniformly at random from the set of feasible merges. Under this assumption we present an algorithm that with probability at least 1−  requires δo split requests and O(log k  δ2 u) merge requests to find the target clustering. We develop several algorithms for performing the split and merge requests under different as- sumptions. Each algorithm uses the global average-linkage tree Tglob to compute a local clustering edit. Our splitting procedure finds the node in Tglob where the corresponding points are first split in two. It is more challenging to develop a correct merge procedure, given that we allow "impure" merges, where one or both clusters have points from another target cluster (other than the one that they both intersect). To perform such merges, in the η-merge model we develop a procedure to extract the "pure" subsets of the two clusters, which must only contain points from the same target cluster. Our procedure searches for the deepest node in Tglob that has enough points from both clus- ters. In the unrestricted-merge model, we develop another merge procedure that either merges the two clusters or merges them and splits them. This algorithm always makes progress if the proposed merge is "impure," and makes progress on average if it is "pure" (both clusters are subset of the same target cluster). When the data satisfies stronger assumptions, we present more-scalable split and merge algo- rithms that do not require any global information. These procedures compute the edit by only considering the points in the user request and the similarities between them. In Section 5 we demonstrate the effectiveness of our algorithms on real data. We show that for the purposes of splitting known over-clusters, the splitting procedure proposed here computes the best splits, when compared to other well-known techniques. We also test the entire proposed framework on newsgroup documents data, which is quite challenging for traditional unsupervised clustering methods Telgarsky and Dasgupta (2012); Heller and Ghahramani (2005); Dasgupta and Hsu (2008); Dai et al. (2010); Boulis and Ostendorf (2004); Zhong (2005). Still, we find that our algorithms perform fairly well; for larger settings of η we are able find the target clustering after a limited number of edit requests. Related work Interactive models for clustering studied in previous works Balcan and Blum (2008); Awasthi and Zadeh (2010) were inspired by an analogous model for learning under feedback Angluin (1998). In this model, the algorithm can propose a hypothesis to the user (in this case, a clustering of the data) and get some feedback regarding the correctness of the current hypothesis. As in our model, the 3 feedback considered is split and merge queries. The goal is to design efficient algorithms which use very few queries to the user. A critical limitation in prior work is that the algorithm has the freedom to choose any arbitrary clustering as the starting point and can make arbitrary changes at each step. Hence these algorithms may propose a series of "bad" clusterings to the user to quickly prune the search space and reach the target clustering. Our interactive clustering model is in the context of an initial clustering; we are restricted to only making local changes to this clustering to correct the errors pointed out by the user. This model is well-motivated by several applications, including the Google application described in the experimental section. Basu et al. Basu et al. (2004) study the problem of minimizing the k-means objective in the pres- ence of limited supervision. This supervision is in the form of pairwise must-link and cannot-link constraints. They propose a variation of the Lloyd's method for this problem and show promising experimental results. The split/merge requests that we study are a more natural form of interaction because they capture macroscopic properties of a cluster. Getting pairwise constraints among data points involves much more effort on the part of the user and is unrealistic in many scenarios. The stability property that we consider is a natural generalization of the "stable marriage" prop- erty (see Definition 2) that has been studied in a variety of previous works Balcan et al. (2008); Bryant and Berry (2001). It is the weakest among the stability properties that have been studied recently such as strict separation and strict threshold separation Balcan et al. (2008); Krishnamurthy et al. (2012). This property is known to hold for real-world data. In particular, Voevodski et al. (2012) observed that this property holds for protein sequence data, where similarities are computed with sequence alignment and ground truth clusters correspond to evolutionary-related proteins. 2. Notation and Preliminaries Given a data set X of n points we define C = {C1, C2, . . . Ck} to be a k-clustering of X where the Ci's represent the individual clusters. Given two clusterings C and C(cid:48), we define the distance between a cluster Ci ∈ C and the clustering C(cid:48) as: dist(Ci,C(cid:48)) = {C(cid:48) j ∈ C(cid:48) : C(cid:48) j ∩ Ci (cid:54)= ∅} − 1. the distance between C and C(cid:48) as: dist(C,C(cid:48)) = (cid:80) This distance is the number of additional clusters in C(cid:48) that contain points from Ci; it evaluates to 0 when all points in Ci are contained in a single cluster in C(cid:48). Naturally, we can then define Ci∈C dist(Ci,C(cid:48)). Notice that this notion of clustering distance is asymmetric: dist(C,C(cid:48)) (cid:54)= dist(C(cid:48),C). Also note that dist(C,C(cid:48)) = 0 if and only if C refines C(cid:48). Observe that if C is the ground-truth clustering, and C(cid:48) is a proposed clustering, then dist(C,C(cid:48)) can be considered an underclustering error, and dist(C(cid:48),C) an overclustering error. An underclustering error is an instance of several clusters in a proposed clustering containing points from the same ground-truth cluster; this ground-truth cluster is said to be underclustered. Conversely, an overclustering error is an instance of points from several ground-truth clusters con- tained in the same cluster in a proposed clustering; this proposed cluster is said to be overclustered. In the following sections we use C∗ = {C∗ k} to refer to the ground-truth clustering, and use C to refer to a proposed clustering. We use δu to refer to the underclustering error of a proposed clustering, and δo to refer to the overclustering error. In other words, we have δu = dist(C∗,C) and δo = dist(C,C∗). We also use δ to denote the sum of the two errors: δ = δu + δo. We call δ the under/overclustering error, and use the δ(C,C∗) to refer to the error of C with respect to C∗. 1 , C∗ 2 , . . . C∗ 4 We also observe that we can define the distance between two clusterings using the correlation- clustering objective function. Given a proposed clustering C, and a ground-truth clustering C∗, we define the correlation-clustering error δcc as the number of (ordered) pairs of points that are clustered inconsistently with C∗: δcc = {(u, v) ∈ X × X : c(u, v) (cid:54)= c∗(u, v)}, where c(u, v) = 1 if u and v are in the same cluster in C, and 0 otherwise; c∗(u, v) = 1 if u and v are in the same cluster in C∗, and 0 otherwise. Note that we may divide the correlation-clustering error δcc into overclustering component δcco and underclustering component δccu: δcco = {(u, v) ∈ X × X : c(u, v) = 1 and c∗(u, v) = 0} δccu = {(u, v) ∈ X × X : c(u, v) = 0 and c∗(u, v) = 1} In our formal analysis we model the user as an oracle that provides edit requests. Definition 1 (Local algorithm) We say that an interactive clustering algorithm is local if in each iteration only the cluster assignments of points involved in the oracle request may be changed. If the oracle requests to split Ci, the algorithm may only reassign the points in Ci. If the oracle requests to merge Ci and Cj, the algorithm may only reassign the points in Ci ∪ Cj. We next formally define the properties of a clustering that we study in this work. Definition 2 (Stability) Given a clustering C = {C1, C2,··· Ck} over a domain X and a similarly function S : X × X (cid:55)→ (cid:60), we say that C satisfies stability with respect to S if for all i (cid:54)= j, and for all A ⊂ Ci and A(cid:48) ⊆ Cj, S(A, Ci \ A) > S(A, A(cid:48)), where for any two sets A, A(cid:48), S(A, A(cid:48)) = Ex∈A,y∈A(cid:48)S(x, y). In our analysis, we assume that the ground-truth clustering satisfies stability, and we have access to the corresponding similarity function. In addition, we also study the following stronger properties of a clustering, which were first introduced in Balcan et al. (2008). Definition 3 (Strict separation) Given a clustering C = {C1, C2,··· Ck} over a domain X and a similarly function S : X × X (cid:55)→ (cid:60), we say that C satisfies strict separation with respect to S if for all i (cid:54)= j, x, y ∈ Ci and z ∈ Cj, S(x, y) > S(x, z). Definition 4 (Strict threshold separation) Given a clustering C = {C1, C2,··· Ck} over a do- main X and a similarly function S : X ×X (cid:55)→ (cid:60), we say that C satisfies strict threshold separation with respect to S if there exists a threshold t such that, for all i, x, y ∈ Ci, S(x, y) > t, and, for all i (cid:54)= j, x ∈ Ci, y ∈ Cj, S(x, y) ≤ t. Clearly, strict separation and strict threshold separation imply stability. In order for our algorithms to make progress, the oracle requests must be somewhat consistent with the target clustering. 5 Definition 5 (η-merge model) In the η-merge model the oracle requests have the following prop- erties split(Ci): Ci contains points from two or more target clusters. merge(Ci, Cj): At least an η-fraction of the points in each Ci and Cj belong to the same target cluster. Definition 6 (Unrestricted-merge model) In the unrestricted-merge model the oracle requests have the following properties split(Ci): Ci contains points from two or more target clusters. merge(Ci, Cj): At least 1 point in each Ci and Cj belongs to the same target cluster. Note that the assumptions about the nature of the split requests are the same in both models. In the η-merge model, the oracle may request to merge two clusters if both have a constant fraction of points from the same target cluster. In the unrestricted-merge model, the oracle may request to merge two clusters if both have some points from the same target cluster. 2.1 Generalized clustering error We observe that the clustering errors defined in the previous section may be generalized by abstract- ing their common properties. We define the following properties of a natural clustering error, which is any integer-valued error that decreases when we locally improve the proposed clustering. Definition 7 We say that a clustering error is natural if it satisfies the following properties: • If there exists a cluster Ci that contains points from C∗ j and some other ground-truth clus- j (which contains only points ter(s), then splitting this cluster into two clusters Ci,1 = Ci ∩ C∗ from C∗ j ), and Ci,2 = Ci − Ci,1 (which contains the other points) must decrease the error. • If there exists two clusters that contain only points from the same target cluster, then merging them into one cluster must decrease the error. • The error is integer-valued. We expect a lot of definitions of clustering error to satisfy the above criteria (especially the first two properties), in addition to other domain-specific criteria. Clearly, the under/overclustering error δ = δu + δo and the correlation-clustering error δcc are also natural clustering errors (Claim 8). As before, for a natural clustering error γ, a proposed clustering C and the target clustering C∗, we will use γ(C,C∗) to denote the magnitude of the error of C with respect to C∗. Moreover, it is easy to see that the under/overclustering error defined in the previous section is the lower-bound on any natural clustering error (Theorem 9). Claim 8 The under/overclustering error and the correlation clustering error satisfy Definition 7 and hence are natural clustering errors. Theorem 9 For any natural clustering error γ, any proposed clustering C, and any target clustering C∗, γ(C,C∗) ≥ δ(C,C∗). 6 Proof Given any proposed clustering C, and any target clustering C∗, we may transform C into C∗ via the following sequence of edits. First, we split all over-clustering instances using the following iterative procedure: while there exists a cluster Ci that contains points from C∗ j and some other ground-truth cluster(s), we split it into two clusters Ci,1 = Ci ∩ C∗ j and Ci,2 = Ci − Ci,1. Note that this iterative split procedure will require exactly δo split edits, where δo is the initial overclustering error. Then, when we are left with only "pure" clusters (each intersects exactly one target cluster), we merge all under-clustering instances using the following iterative procedure: while there exist two clusters Ci and Cj that contain only points from the same target cluster, merge Ci and Cj. Note that this iterative merge procedure will require exactly δu merge edits, where δu is the initial underclustering error. Let us use γ to refer to any natural clustering error of C with respect to C∗. By the first property of natural clustering error, each split must have decreased γ by at least one. By the second property, each merge must have decreased γ by at least one as well. Given that we performed exactly δ = δo + δu edits, it follows that initially γ(C,C∗) must have been at least δ. For additional discussion about comparing clusterings see Meila (2007). Note that several criteria discussed in Meila (2007) satisfy our first two properties (for a similarity measure we may replace "must decrease the error" with "must increase the similarity"). In addition, the Rand and Mirkin criteria discussed in Meila (2007) are closely related to the correlation clustering error defined here (all three measures are a function of the number of pairs of points that are clustered incorrectly). 3. The η-merge model In this section we describe and analyze the algorithms in the η-merge model. As a pre-processing step for all our algorithms, we first run the hierarchical average-linkage algorithm on all the points in the data set to compute the global average-linkage tree, which we denote by Tglob. The leaf nodes in this tree contain the individual points, and the root node contains all the points. The tree is computed in a bottom-up fashion: starting with the leafs in each iteration the two most similar nodes are merged, where the similarity between two nodes N1 and N2 is the average similarity between points in N1 and points in N2. We assign a label "impure" to each cluster in the initial clustering; these labels are used by the merge procedure. Given a split or merge request, a local clustering edit is computed from the global tree Tglob as described in Figure 1 and Figure 2. To implement Step 1 in Figure 1, we start at the root of Tglob and "follow" the points in Ci down one of the branches until we find a node that splits them. In order to implement Step 2 in Figure 2, it suffices to start at the root of Tglob and perform a post-order traversal, only considering nodes that have "enough" points from both clusters, and return the first output node. The split procedure is fairly intuitive: if the average-linkage tree is consistent with the target clustering, it suffices to find the node in the tree where the corresponding points are first split in two. It is more challenging to develop a correct merge procedure: note that Step 2 in Figure 2 is only correct if η > 0.5, which ensures that if two nodes in the tree have more than an η-fraction of the points from Ci and Cj, one must be an ancestor of the other. If the average-linkage tree is consistent with the ground-truth, then clearly the node equivalent to the corresponding target cluster (that Ci and Cj both intersect) will have enough points from Ci and Cj; therefore the node that we find in Step 2 must be this node or one of its descendants. In addition, because our merge procedure replaces two clusters with three, we require pure/impure labels for the merge requests to terminate: 7 Algorithm: SPLIT PROCEDURE Input: Cluster Ci, global average-linkage tree Tglob. Figure 1: Split procedure 1. Search Tglob to find the node N at which the set of points in Ci are first split in two. 2. Let N1 and N2 be the children of N. Set Ci,1 = N1 ∩ Ci, Ci,2 = N2 ∩ Ci. 3. Delete Ci and replace it with Ci,1 and Ci,2. Mark the two new clusters as "impure". Algorithm: MERGE PROCEDURE Input: Clusters Ci and Cj, global average-linkage tree Tglob. Figure 2: Merge procedure 1. If Ci is marked as "pure" set η1 = 1 else set η1 = η. Similarly set η2 for Cj. 2. Search Tglob for a node of maximal depth N that contains enough points from Ci and Cj: N ∩ Ci ≥ η1Ci and N ∩ Cj ≥ η2Cj. 3. Replace Ci by Ci \ N, replace Cj by Cj \ N. 4. Add a new cluster containing N ∩ (Ci ∪ Cj), mark it as "pure". "pure" clusters may only have other points added to them, and retain this label throughout the execution of the algorithm. We now state the performance guarantee for these split and merge algorithms. Theorem 10 Suppose the target clustering satisfies stability, and the initial clustering has overclus- tering error δo and underclustering error δu. In the η-merge model, for any η > 0.5, the algorithms in Figure 1 and Figure 2 require at most δo split requests and 2(δu + k) log 1 n merge requests to 1−η find the target clustering. In order to prove the theorem, we must do some preliminary analysis. First, we observe that if the target clustering satisfies stability, then every node of the average-linkage tree must be laminar (consistent) with respect to the ground-truth clustering. Informally, each node in a hierarchical clustering tree T is laminar (consistent) with respect to the clustering C if for each cluster Ci ∈ C, the points in Ci are first grouped together in T before they are grouped with points from any other cluster Cj(cid:54)=i. We formally state and prove these observations next. Definition 11 (Laminar) A node N is laminar with respect to a clustering C if for each cluster Ci ∈ C we have either N ∩ Ci = ∅, N ⊆ Ci, or Ci ⊆ N. 8 Lemma 12 Suppose the ground-truth clustering C∗ over a domain X satisfies stability with respect to a similarity function S. Let T be the average-linkage tree for X constructed with S. Then every node in T is laminar w.r.t. C∗. Proof The proof of this statement can be found in Balcan et al. (2008). The intuition is that if there is a node in T that is not laminar w.r.t. C∗, then the average-linkage algorithm, at some step, must have merged A ⊂ C∗ j for some i (cid:54)= j. However, this will contradict the stability property for the sets A and B. i , with B ⊂ C∗ It follows that the split computed by the algorithm in Figure 1 must also be consistent with the target clustering; we call such splits clean. Definition 13 (Clean split) A partition (split) of a cluster Ci into clusters Ci,1 and Ci,2 is said to j ∩Ci (cid:54)= ∅, be clean if Ci,1 and Ci,2 are non-empty, and for each ground-truth cluster C∗ either C∗ j such that C∗ j ∩ Ci,1 or C∗ j ∩ Ci = C∗ j ∩ Ci = C∗ j ∩ Ci,2. We now prove the correctness of the split/merge procedures. Lemma 14 If the ground-truth clustering satisfies stability and η > 0.5 then, a. The split procedure in Figure 1 always produces a clean split. b. The new cluster added in Step 4 in Figure 2 must be "pure", i.e., it must contain points from a single ground-truth cluster. Proof a. For purposes of contradiction, suppose the returned split is not clean: Ci,1 and Ci,2 contain points from the same ground-truth cluster C∗ j . It must be the case that Ci contains points from sev- eral ground-truth clusters, which implies that w.l.o.g. Ci,1 contains points from some other ground- l(cid:54)=j. This implies that N1 is not laminar w.r.t. C∗, which contradicts Lemma 12. truth cluster C∗ 2Cj points from Cj are from the same b. By our assumption, at least 1 ground-truth cluster C∗ l (which contains all the points in C∗ l and no other points) must contain enough points from Ci and Cj, and only ascendants and descendants of N(cid:48) may contain more than an η > 1/2 fraction of points from both clusters. Therefore, the node N that we find with a depth-first search must be N(cid:48) or one of its descendants, and will only contain points from C∗ l . l . Clearly, the node N(cid:48) in Tglob that is equivalent to C∗ 2Ci points from Ci and 1 Using the above lemma, we can prove the bounds on the split and merge requests stated in Theorem 10. Proof [Proof of Theorem 10] We first give a bound on the number of splits. Observe that each split reduces the overclustering error by exactly 1. To see this, suppose we execute Split(C1), and call the resulting clusters C2 and C3. Call δ1 the overclustering error before the split, and δ2 the overclustering error after the split. Let's use k1 to refer to the number of ground-truth clusters that intersect C1, and define k2 and k3 similarly. Due to the clean split property, no ground-truth cluster can intersect both C2 and C3, 9 therefore it must be the case that k2 + k3 = k1. Also, clearly k2, k3 > 0. Therefore we have: δ2 = δ1 − (k1 − 1) + (k2 − 1) + (k3 − 1) = δ1 − k1 + (k2 + k3) − 1 = δ1 − 1. Merges cannot increase overclustering error. Therefore the total number of splits may be at most δo. We next give the arguments about the number of impure and pure merges. We first argue that we cannot have too many "impure" merges before each cluster in C is marked "pure." Consider the clustering P = {Ci ∩ C∗ j (cid:54)= ∅}. Clearly, at the start P = δu + k. A merge does not increase the number of clusters in P , and the splits do not change P at all (because of the clean split property). Moreover, each impure merge (a merge of two impure clusters or a merge of a pure and an impure cluster) depletes some Pi ∈ P by moving ηPi of its points to a pure cluster. Clearly, we can then have at most log1/(1−η) n merges depleting each Pi. Since each impure merge must deplete some Pi, it must be the case that we can have at most (δu + k) log1/(1−η) n impure merges in total. j Ci is marked "impure" and Ci ∩ C∗ Notice that a pure cluster can only be created by an impure merge, and there can be at most one pure cluster created by each impure merge. Clearly, a pure merge removes exactly one pure cluster. Therefore the number of pure merges may be at most the total number of pure clusters that are created, which is at most the total number of impure merges. Therefore the total number of merges must be less than 2(δu + k) log1/(1−η) n. We can also restate the run-time bound in Theorem 10 in terms of any natural clustering error γ. The following collorary follows from Theorem 10 and Theorem 9. Corollary 15 Suppose the target clustering satisfies stability, and the initial clustering has cluster- ing error γ, where γ is any natural clustering error as defined in Definition 7. In the η-merge model, for any η > 0.5, the algorithms in Figure 1 and Figure 2 require at most O(γ + k) log 1 n edit 1−η requests to find the target clustering. 3.1 Algorithms for correlation-clustering error To bound the number of edit requests with respect to the correlation clustering objective, we must use a different merge procedure, which is described in Figure 3. Here instead of creating a new "pure" cluster, we add these points to the larger of the two clusters in the merge. Notice that the new algorithm is much simpler than the merge algorithm for the under/overclustering error. Using this merge procedure and the split procedure presented earlier gives the following performance guarantee. Theorem 16 Suppose the target clustering satisfies stability, and the initial clustering has correlation- clustering error of δcc. In the η-merge model, for any η > 2/3, using the split and merge procedures in Figures 1 and 3 requires at most δcc edit requests to find the target clustering. Proof Consider the contributions of individual points to δcco and δccu, which are defined as: δcco(u) = {v ∈ X : c(u, v) = 1 and c∗(u, v) = 0} 10 Figure 3: Merge procedure for the correlation-clustering objective Algorithm: MERGE PROCEDURE Input: Clusters Ci and Cj, global average-linkage tree Tglob Search Tglob for a node of maximal depth N that contains enough points from Ci and Cj: N ∩ Ci ≥ ηCi and N ∩ Cj ≥ ηCj if Ci ≥ Cj then Replace Ci by Ci ∪ (N ∩ Cj) Replace Cj by Cj \ N Replace Ci by Ci \ N replace Cj by Cj ∪ (N ∩ Ci) else end if δccu(u) = {v ∈ X : c(u, v) = 0 and c∗(u, v) = 1} We first argue that a split of a cluster Ci must reduce δcc by at least 1. Given that the split is clean, it is easy to verify that the outcome may not increase δccu(u) for any u ∈ Ci. We can also verify that for each u ∈ Ci, δcco(u) must decrease by at least 1. This completes the argument, given that the correlation-clustering error with respect to all other pairs of points must remain the same. We now argue that if η > 2/3, each merge of Ci and Cj must reduce δcc by at least 1. Without loss of generality, suppose that Ci ≥ Cj, and let us use P to refer to the "pure" subset of Cj that is moved to Ci. We observe that the outcome must remove at least δ1 pairwise correlation-clustering errors, where δ1 satisfies δ1 ≥ 2P(ηCi). Similarly, we observe that the outcome may add at most δ2 pairwise correlation-clustering errors, where δ2 satisfies: δ2 ≤ 2P((1 − η)Ci) + 2P((1 − η)Cj) ≤ 4P((1 − η)Ci). It follows that for η > 2/3, δ1 must exceed δ2; therefore the sum of the pairwise correlation- clustering errors must decrease, giving a lower correlation-clustering error total. Observe that the runtime bound in Theorem 16 is tight: in some instances any local algorithm requires at least δcc edits to find the target clustering. To verify this, suppose the target clustering is composed of n singleton clusters, and the initial clustering contains n/2 clusters of size 2. In this instance, the initial correlation clustering error δcc = n/2, and the oracle must issue at least n/2 split requests before we reach the target clustering (no matter how the algorithm reassigns the corresponding points). 3.2 Algorithms under stronger assumptions When the data satisfies stronger stability properties we may simplify the presented algorithms and/or obtain better performance guarantees. In particular, if the data satisfies the strict separation property from Balcan et al. (2008), we may change the split and merge algorithms to use the local average- linkage tree, which is constructed from only the points in the edit request. In addition, if the data satisfies strict threshold separation, we may remove the restriction on η and use a different merge procedure that is correct for any η > 0. 11 Theorem 17 Suppose the target clustering satisfies strict separation, and the initial clustering has overclustering error δo and underclustering error δu. In the η-merge model, for any η > 0.5, the algorithms in Figure 4 and Figure 5 require at most δo split requests and 2(δu + k) log 1 n merge 1−η requests to find the target clustering. Proof Let us use L∗ to refer to the ground-truth clustering of the points in the split/merge request. If the target clustering satisfies strict separation, it is easy to verify that every node in the local average-linkage tree Tloc must be laminar (consistent) w.r.t. L∗. We can then use this observation to prove the equivalent of Lemma 14 for the split procedure in Figure 4 and the merge procedure in Figure 5. The analysis in Theorem 10 remains unchanged. Theorem 18 Suppose the target clustering satisfies strict threshold separation, and the initial clus- tering has overclustering error δo and underclustering error δu. In the η-merge model, for any η > 0, the algorithms in Figure 4 and Figure 6 require at most δo split requests and 2(δu + k) log 1 n 1−η merge requests to find the target clustering. Proof If the target clustering satisfies strict threshold separation, we can verify that the split pro- cedure in Figure 4 and the merge procedure in Figure 6 are correct for any η > 0. The analysis in Theorem 10 remains unchanged. To verify that the split procedure always produces a clean split, again let us use L∗ to refer to the ground-truth clustering of the points in the split request. We can again verify that each node in the local average-linkage tree Tloc must be laminar (consistent) w.r.t. L∗. It follows that the split procedure always produces a clean split. Note that clearly this argument does not depend on the setting of η. We now verify that the new cluster added by the merge procedure Figure 6 must be "pure" (must contain points from a single target cluster). To see this, observe that in the graph G in Figure 6, all pairs of points from the same target cluster are connected before any pairs of points from different target clusters. It follows that the first component that contains at least an η-fraction of points from Ci and Cj must be "pure". Note that this argument applies for any η > 0. Note that the merge procedure in Figure 6 is correct for η ≤ 0.5 only if the target clustering satisfies strict threshold separation: there is a single threshold t such that for all i, x, y ∈ C∗ i , S(x, y) > t, and, for all i (cid:54)= j, x ∈ C∗ j , S(x, y) ≤ t. When only strict separation holds (the threshold for each target cluster may be different), this procedure may first connect points from different target clusters, and for η ≤ 0.5 this component may then be large enough to be output. i , y ∈ C∗ As in Corollary 15, we may also restate the run-time bounds in Theorem 17 and Theorem 18 in terms of any natural clustering error γ. The following corollaries follow from Theorem 17, Theorem 18 and Theorem 9. Corollary 19 Suppose the target clustering satisfies strict separation, and the initial clustering has clustering error γ, where γ is any natural clustering error as defined in Definition 7. In the η-merge model, for any η > 0.5, the algorithms in Figure 4 and Figure 5 require at most O(γ + k) log 1 n 1−η edit requests to find the target clustering. 12 Corollary 20 Suppose the target clustering satisfies strict threshold separation, and the initial clus- tering has clustering error γ, where γ is any natural clustering error as defined in Definition 7. In the η-merge model, for any η > 0, the algorithms in Figure 4 and Figure 6 require at most O(γ + k) log 1 1−η n edit requests to find the target clustering. Figure 4: Split procedure under stronger assumptions Algorithm: SPLIT PROCEDURE Input: Cluster Ci, local average-linkage tree Tloc. 1. Let Ci,1 and Ci,2 be the children of the root in Tloc. 2. Delete Ci and replace it with Ci,1 and Ci,2. Mark the two new clusters as "impure". Figure 5: Merge procedure under strict separation Algorithm: MERGE PROCEDURE Input: Clusters Ci and Cj, local average-linkage tree Tloc. 1. If Ci is marked as "pure" set η1 = 1 else set η1 = η. Similarly set η2 for Cj. 2. Search Tloc for a node of maximal depth N that contains enough points from Ci and Cj: N ∩ Ci ≥ η1Ci and N ∩ Cj ≥ η2Cj. 3. Replace Ci by Ci \ N, replace Cj by Cj \ N. 4. Add a new cluster containing N ∩ (Ci ∪ Cj), mark it as "pure". 4. The unrestricted-merge model In this section we further relax the assumptions about the nature of the oracle requests. As before, the oracle may request to split a cluster if it contains points from two or more target clusters. For merges, now the oracle may request to merge Ci and Cj if both clusters contain only a single point from the same ground-truth cluster. We note that this is a minimal set of assumptions for a local algorithm to make progress, otherwise the oracle may always propose irrelevant splits or merges that cannot reduce clustering error. For this model we propose the merge algorithm described in Figure 7. The split algorithm remains the same as in Figure 1. To provably find the ground-truth clustering in this setting we require that each merge request must be chosen uniformly at random from the set of feasible merges. This assumption is consis- tent with the observation in Awasthi and Zadeh (2010) that in the unrestricted-merge model with arbitrary request sequences, even very simple cases (ex. union of intervals on a line) require a pro- hibitively large number of requests. We do not make additional assumptions about the nature of the 13 Figure 6: Merge procedure under strict threshold separation Algorithm: MERGE PROCEDURE Input: Clusters Ci and Cj. 1. If Ci is marked as "pure" set η1 = 1 else set η1 = η. Similarly set η2 for Cj. 2. Let G = (V, E) be a graph where V = Ci ∪ Cj and E = ∅. Set N = ∅. 3. While true: Connect the next-closest pair of points in G; Let C1, C2, . . . , Cm be the connected components of G; if there exists Cl such that Cl ∩ Ci ≥ ηCi and Cl ∩ Cj ≥ ηCj then N = Cl; break; end if 4. Replace Ci by Ci \ N, replace Cj by Cj \ N. 5. Add a new cluster containing N, mark it as "pure". Figure 7: Merge procedure for the unrestricted-merge model Algorithm: MERGE PROCEDURE Input: Clusters Ci and Cj, global average-linkage tree Tavg. 1. Let C(cid:48) i, C(cid:48) j = Split(Ci ∪ Cj), where the split is performed as in the previous section. 2. Delete Ci and Cj. 3. If the sets C(cid:48) i and C(cid:48) C(cid:48) j. j are the same as Ci and Cj, then add Ci ∪ Cj, otherwise add C(cid:48) i and 14 split requests; in each iteration any feasible split may be proposed by the oracle. In this setting our algorithms have the following performance guarantee. Theorem 21 Suppose the target clustering satisfies stability, and the initial clustering has overclus- tering error δo and underclustering error δu. In the unrestricted-merge model, with probability at least 1 − , the algorithms in Figure 1 and Figure 7 require δo split requests and O(log k u) merge requests to find the target clustering.  δ2 The above theorem is proved in a series of lemmas. We first state a lemma regarding the cor- rectness of the Algorithm in Figure 7. We argue that if the algorithm merges Ci and Cj, it must be the case that both Ci and Cj only contain points from the same ground-truth cluster. l and Cj ⊂ C∗ l for some ground-truth cluster C∗ l . Lemma 22 If the algorithm in Figure 7 merges Ci and Cj in Step 3, it must be the case that Ci ⊂ C∗ Proof We prove the contrapositive. Suppose Ci and Cj both contain points from C∗ tion Ci ∪ Cj contains points from some other ground-truth cluster. Let us define S1 = C∗ S2 = C∗ S1, S2 ⊆ C(cid:48) so Ci and Cj are not merged. j result from a clean split, it follows that S1, S2 ⊆ C(cid:48) j. Without loss of generality, assume S1, S2 ⊆ C(cid:48) l , and in addi- l ∩ Ci and i or i (cid:54)= Cj, l ∩ Cj. Because the clusters C(cid:48) i. Then clearly C(cid:48) i (cid:54)= Ci and C(cid:48) i, C(cid:48) The δo bound on the number of split requests follows from the observation that each split reduces the overclustering error by exactly 1 (as before), and the fact that the merge procedure does not increase overclustering error. Lemma 23 The merge algorithm in Figure 7 does not increase overclustering error. Proof Suppose Ci and Cj are not both "pure" (one or both contain elements from several ground- truth clusters), and hence we obtain two new clusters C(cid:48) j. Let us call δ1 the overclustering error before the merge, and δ2 the overclustering error after the merge. Let's use k1 to refer to the number of ground-truth clusters that intersect Ci, k2 to refer to the number of ground-truth clusters that intersect Cj, and define k(cid:48) j result from a "clean" split, 2 ≤ k1 + k2. therefore no ground-truth cluster may intersect both of them. It follows that k(cid:48) Therefore we now have: 2 similarly. The new clusters C(cid:48) i and C(cid:48) 1 and k(cid:48) 1 + k(cid:48) i, C(cid:48) δ2 = δ1 − (k1 − 1) − (k2 − 1) + (k(cid:48) = δ1 − (k1 + k2) + (k(cid:48) 1 + k(cid:48) 2) ≤ δ1. 1 − 1) + (k(cid:48) 2 − 1) If Ci and Cj are both "pure" (both are subsets of the same ground-truth cluster), then clearly the merge operation has no effect on the overclustering error. The following lemmas bound the number of impure and pure merges. Here we call a proposed merge pure if both clusters are subsets of the same ground-truth cluster, and impure otherwise. Lemma 24 The merge algorithm in Figure 7 requires at most δu impure merge requests. 15 Proof We argue that the result of each impure merge request must reduce the underclustering error by at least 1. Suppose the oracle requests to merge Ci and Cj, and C(cid:48) j are the resulting clus- ters. Clearly, the local edit has no effect on the underclustering error with respect to target clusters that do not intersect Ci or Cj. In addition, because the new clusters C(cid:48) j result from a clean split, for target clusters that intersect exactly one of Ci, Cj, the underclustering error must stay the same. For target clusters that intersect both Ci and Cj, the underclustering error must decrease by exactly one; the number of such target clusters is at least one. i and C(cid:48) i and C(cid:48) Lemma 25 The probability that the algorithm in Figure 7 requires more than O(log k merge requests is less than .  δ2 u) pure Proof We first consider the pure merge requests involving points from some ground-truth clus- ter C∗ i , the total number of pure merge requests (involving any ground-truth cluster) can then be bounded with a union-bound. To facilitate our argument, let us assign an identifier to each cluster containing points from C∗ i in the following manner: 1. Maintain a CLUSTER-ID variable, which is initialized to 1. 2. To assign a "new" identifier to a cluster, set its identifier to CLUSTER-ID, and increment CLUSTER-ID. 3. In the initial clustering, assign a new identifier to each cluster containing points from C∗ i . 4. When we split a cluster containing points from C∗ i , assign its identifier to the newly-formed cluster containing points from C∗ i . 5. When we merge two clusters and one or both of them are impure, if one of the clusters i , assign its identifier to the newly-formed cluster containing points i , assign a new identifier to the newly-formed i . If both clusters contain points from C∗ contains points from C∗ from C∗ cluster containing points from C∗ i . 6. When we merge two clusters C1 and C2, and both contain only points from C∗ i , if the outcome is one new cluster, assign it a new identifier. If the outcome is two new clusters, assign them the identifiers of C1 and C2. Clearly, when clusters containing points from C∗ i : δi = dist(C∗ i are assigned identifiers in this manner, the maximum value of CLUSTER-ID is bounded by O(δi), where δi denotes the underclustering error of the initial clustering with respect to C∗ i , C). To verify this, consider that we assign exactly δi + 1 new identifiers in Step-3, and each time we assign a new identifier in Steps 5 and 6, the underclustering error of the edited clustering with respect to C∗ We say that a pure merge request involving points from C∗ i is original if the user has never asked us to merge clusters with the given identifiers, otherwise we say that this merge request is repeated. Given that the maximum value of CLUSTER-ID is bounded by O(δi), the total number of original i ). We now argue that if a merge request is not original, we can lower merge requests must be O(δ2 bound the probability that it will result in the merging of the two clusters. i decreases by one. 16 For repeated merge request Mi = M erge(C1, C2), let Xi be a random variable defined as follows:  Xi = 1 if neither C1 nor C2 have been involved in a merge request since the last time a merge of clusters with these identifiers was proposed. 0 otherwise. the probability that(cid:80)t Clearly, when Xi = 1 it must be the case that C1 and C2 are merged. We observe that Pr[Xi = 2δi+1. To verify this, observe that in each step the probability that the user requests to merge m, and the probability that the user requests to merge C1 or C2 with some other m , where m is the total number of possible merge requests; we can then bound 1] > 1 C1 and C2 is 1 cluster is less than 2δi the probability that the former happens before the latter. We can then use a Chernoff bound to argue that after t = O(log k i ) repeated merge requests, i=1 Xi < δi (which must be true if we need more repeated merge requests) i ) repeated merge  δ2 By the union-bound, the probability that we need more than O(log k is less than /k. Therefore, the probability that we need more than O(log k requests is less than /k. quests for any ground-truth cluster C∗ 1 −  for all ground-truth clusters we need(cid:80) for all ground-truth clusters we need(cid:80) i ) repeated merge re- i is less than k · /k = . Therefore with probability at least u) re- peated merge requests, where δu is the underclustering error of the original clustering. Similarly, u) original merge requests. Adding the two terms together, it follows that with probability at least 1 −  we need a total of O(log k u) pure merge requests. i ) = O(log k  i O(δ2 i ) = O(δ2 i δ2 i ) = O(log k i O(log k  δ2  δ2 (cid:80)  δ2  δ2  δ2 As in the previous section, we also restate the run-time bound in Theorem 21 in terms of any natural clustering error γ. The following collorary follows from Theorem 21 and Theorem 9. Corollary 26 Suppose the target clustering satisfies stability, and the initial clustering has cluster- ing error γ, where γ is any natural clustering error as defined in Definition 7. In the unrestricted- merge model, with probability at least 1 − , the algorithms in Figure 1 and Figure 7 require O(log k  γ2) edit requests to find the target clustering. As in the previous section, if the data satisfies strcit separation, then instead of the split proce- dure in Figure 1 we can use the procedure in Figure 4, which uses the local average-linkage tree (constructed from only the points in the user request). We can then obtain the same performance guarantee as in Theorem 21 for the algorithms in Figure 4 and Figure 7. 5. Experimental Results We perform two sets of experiments: we first test the proposed split procedure on the clustering of business listings maintained by Google, and also test the proposed framework in its entirety on the much smaller newsgroup documents data set. 5.1 Clustering business listings Google maintains a large collection of data records representing businesses. These records are clustered using a similarity function; each cluster should contain records about the same distinct 17 business; each cluster is summarized and served to users online via various front-end applications. Users report bugs such as "you are displaying the name of one business, but the address of another" (caused by over-clustering), or "a particular business is shown multiple times" (caused by under- clustering). These bugs are routed to operators who examine the contents of the corresponding clusters, and request splits/merges accordingly. The clusters involved in these requests may be quite large and usually contain records about several businesses. Therefore automated tools that can perform the requested edits are very helpful. In particular, here we evaluate the effectiveness of our proposed split procedure in computing correct cluster splits. We consider a binary split correct if the two resulting sub-clusters are "clean" using Definition 13, and consider the split incorrect otherwise. Note that a clean split is sufficient and necessary for reducing the under/overclustering error. To compute the splits, we use the al- gorithm in Figure 4, which we refer to as Clean-Split. This algorithm is easier to implement and run than the algorithm in Figure 1 because we do not need to compute the global average-linkage tree. But it is still provably correct under stronger assumptions on the data (see Theorem 17 and Theorem 18). For comparison purposes, we use two well-known techniques for computing binary splits: the optimal 2-median clustering (2-Median), and a "sweep" of the second-smallest eigenvector of the corresponding Laplacian matrix. Let {v1, . . . , vn} be the order of the vertices when sorted by their eigenvector entries, we compute the partition {v1, . . . , vi} and {vi+1, . . . , vn} such that its conductance is smallest (Spectral-Balanced), and a partition such that the similarity between vi and vi+1 is smallest (Spectral-Gap). Table 1: Number of correct (clean) splits Clean-Split 2-Median Spectral-Gap Spectral-Balanced 19 13 12 3 We compare the split procedures on 20 over-clusters that were discovered during a clustering- quality evaluation2. The results are presented in Table 1. We observe that the Clean-Split algorithm works best, giving a correct split in 19 out of the 20 cases. The well-known Spectral-Balanced technique usually does not give correct splits for this application. The balance constraint usually causes it to put records about the same business on both sides of the partition (especially when all the "clean" splits are not well-balanced), which increases clustering error. As expected, the Spectral-Gap technique improves on this limitation (because it does not have a balance constraint), but the result often still increases clustering error. The 2-Median algorithm performs fairly well, but it may not be the right technique for this problem: the optimal centers may correspond to listings about the same business, and even if they represent distinct businesses, the resulting partition is still sometimes incorrect. In addition to using the clean-split criterion, we also evaluate the computed splits using the correlation-clustering (cc) error. We find that using this criterion Clean-Split and 2-Median compute the best splits, while the other two algorithms perform significantly worse. The results for Clean- Split and 2-Median are presented in Table 2. Note that a clean split is sufficient to reduce the correlation-clustering error, but it is not necessary. Our experiments illustrate these observations: Clean-Split makes progress in reducing the cc-error in 19 out of 20 cases (when the resulting split 2. the data set is available at voevodski.org/data/businessListingsDatasets/description.html. 18 Table 2: Change in correlation-clustering error Dataset Clean-Split 2-Median 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -14 -5 -11 -117 -42 -4 -12 -27 -6 -6 +6 -10 -6 -12 -6 -10 -11 -10 -11 -10 -14 -5 -11 -117 +90 -4 -30 -27 -6 -6 -8 +14 -6 -22 -6 +14 -27 -10 -5 -10 is clean), while 2-Median is able to still reduce the cc-error even when the resulting split is not clean. Overall, in 12 instances the two algorithms give a tie in performance; in 4 instances Clean- Split makes more progress in reducing the correlation-clustering error; and in 4 instances 2-Median makes more progress. Also note that Clean-Split fails to reduce the cc-error only once; while 2- Median fails to reduce the cc-error 4 times. 5.2 Clustering newsgroup documents In order to test our entire framework (the iterative application of our algorithms), we perform com- putational experiments on newsgroup documents data.3 The objects in these data sets are posts to twenty different online forums (newsgroups). We sample these data to compute 5 data sets of man- ageable size (containing 276-301 elements), which are labeled A through E in the figures. Each data set contains some documents from every newsgroup. Each post/document is represented by a term frequency - inverse document frequency (tf-idf) vector Salton and Buckley (1988). We use cosine similarity to compare these vectors, which gives a similarity measure between 0 and 1 (inclusive). We compute an initial clustering by using the 3. http://people.csail.mit.edu/jrennie/20Newsgroups/ 19 Figure 8: Results in the η-merge model for data set A. The second chart corresponds to algorithms for correlation clustering error. following procedure to perturb the ground-truth: for each document we keep its ground-truth cluster assignment with probability 0.5, and otherwise reassign it to one of the other clusters, which is chosen uniformly at random. In each iteration, we compute the set of all feasible splits and merges: a split of a cluster is feasible if it contains points from 2 or more ground-truth clusters, and a merge is feasible if at least an η- fraction of points in each cluster are from the same ground-truth cluster. Then, we choose one of the feasible edits uniformly at random, and ask the algorithm to compute the corresponding edit. We continue this process until we find the ground-truth clustering or we reach 20000 iterations. Note that for the η-merge model, our theoretical analysis is applicable to any edit-request sequence, but in our experiments for simplicity we still select a feasible edit uniformly at random. Our initial clusterings have over-clustering error of about 100, under-clustering error of about 100; and correlation-clustering error of about 5000. We notice that for newsgroup documents it is difficult to compute average-linkage trees that are very consistent with the ground-truth. This observation was also made in other clustering studies that report that the hierarchical trees constructed from these data have low purity Telgarsky and Dasgupta (2012); Heller and Ghahramani (2005). These observations suggest that these data are quite challenging for clustering algorithms. To test how well our algorithms can perform with better data, we prune the data sets by repeatedly finding the outlier in each target cluster and removing it, where the outlier is the point with minimum sum-similarity to the other points in the target cluster. For each data set, we perform experiments with the original (unpruned) data set, a pruned data set with 2 points removed per target cluster, and a pruned data set with 4 points removed per target cluster, which prunes 40 and 80 points, respectively (given that we have 20 target clusters). 5.2.1 EXPERIMENTS IN THE η-MERGE MODEL We first experiment with local clustering algorithms in the η-restricted merge setting. Here we use the algorithm in Figure 1 to perform the splits, and the algorithm in Figure 2 to perform the merges. We show the results of running our algorithm on data set A in Figure 8. The complete experimental results are in the Apppendix. We find that for larger settings of η, the number of edit requests (necessary to find the target clustering) is very favorable and is consistent with our theoretical analysis. The results are better for pruned datasets, where we get very good performance 20 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Eta-Merge eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Eta-Merge eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 Figure 9: Results in the unrestricted merge model for data set A. regardless of the setting of η. The results for algorithms in Figure 1 and Figure 3 (for the correlation- clustering objective) are very favorable as well. 5.2.2 EXPERIMENTS IN THE UNRESTRICTED-MERGE MODEL We also experiment with algorithms in the unrestricted merge model. Here we use the same algo- rithm to perform the splits, but use the algorithm in Figure 7 to perform the merges. We show the results on dataset A in Figure 9. The complete experimental results are in the Apppendix. We find that for larger settings of η our results are better than our theoretic analysis (we only show results for η ≥ 0.5), and performance improves further for pruned datasets. Our investigations show that for unpruned datasets and smaller settings of η, we are still able to quickly get close to the target clustering, but the algorithms are not able to converge to the target due to inconsistencies in the average-linkage tree. We can address some of these inconsistencies by constructing the tree in a more robust way, which indeed gives improved performance for unpruned data sets. 5.2.3 EXPERIMENTS WITH SMALL INITIAL ERROR We also consider a setting where the initial clustering is already very accurate. In order to simulate this scenario, when we compute the initial clustering, for each document we keep its ground-truth cluster assignment with probability 0.95, and otherwise reassign it to one of the other clusters, which is chosen uniformly at random. This procedure usually gives us initial clusterings with over- clustering and under-clustering error between 5 and 20, and correlation-clustering error between 500 and 1000. As expected, in this setting our interactive algorithms perform much better, especially on pruned data sets. Figure 10 displays the results; we can see that in these cases it often takes less than one hundred edit requests to find the target clustering in both models. 5.2.4 IMPROVED PERFORMANCE USING A ROBUST AVERAGE-LINKAGE TREE When we investigate the inconsistencies in the average linkage trees, we observe that there are "outlier" points that are attached near the root of the tree, which are incorrectly split off and re- merged by the algorithm without making any progress towards finding the target clustering. We can address these outliers by constructing the average-linkage tree in a more robust way: first find groups ("blobs") of similar points of some minimum size, compute an average-linkage tree for each group, and then merge these trees using average-linkage. The tree constructed in such fashion may then be used by our algorithms. 21 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Unrestricted-Merge eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 Figure 10: Results for initial clusterings with small error. Results presented for pruned data sets (4 points per cluster). The second chart corresponds to algorithms for correlation clustering error. We tried this approach, using Algorithm 2 from Balcan and Gupta (2010) to compute the "blobs". We find that using the robust average-linkage tree gives better performance for the un- pruned data sets, but gives no gains for the pruned data sets. Figure 11 displays the comparison for the five unpruned data sets. For the pruned data sets, it's likely that the robust tree and the stan- dard tree are very similar, which explains why there is little difference in performance (results not shown). 6. Discussion In this work we motivated and studied a new framework and algorithms for interactive clustering. Our framework models practical constraints on the algorithms: we start with an initial clustering that we cannot modify arbitrarily, and are only allowed to make local edits consistent with user requests. In this setting, we develop several simple, yet effective algorithms under different assumptions about the nature of the edit requests and the structure of the data. We present theoretical analysis that shows that our algorithms converge to the target clustering after a small number of edit requests. We also present experimental evidence that shows that our algorithms work well in practice. 22 0 50 100 150 200 250 300 A B C D E Number Edit Requests Data Set Eta-Merge eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 50 100 150 200 250 300 A B C D E Number Edit Requests Data Set Eta-Merge eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 50 100 150 200 250 300 A B C D E Number Edit Requests Data Set Unrestricted-Merge eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 Figure 11: Results in the unrestricted-merge model using a robust average-linkage tree. Results presented for unpruned data sets. Several directions come out of this work. It would be interesting to relax the condition on η in the η-merge model, and the assumption about the request sequences in the unrestricted-merge model. It is important to study additional properties of an interactive clustering algorithm. In particular, it is often desirable that the algorithm never increase the error of the current clustering. Our algorithms in Figures 1, 3 and 7 have this property, but the algorithm in Figure 2 does not. References D. Achlioptas and F. McSherry. On spectral learning of mixtures of distributions. In Proceedings of the 18th Annual Conference on Learning Theory, 2005. D. Angluin. Queries and concept learning. Machine Learning, 2:319 -- 342, 1998. S. Arora and R. Kannan. Learning mixtures of arbitrary Gaussians. In Proceedings of the 33rd ACM Symposium on Theory of Computing, 2001. Pranjal Awasthi and Reza Bosagh Zadeh. Supervised clustering. In NIPS, 2010. Maria-Florina Balcan and Avrim Blum. Clustering with interactive feedback. In ALT, 2008. Maria-Florina Balcan and Pramod Gupta. Robust hierarchical clustering. In COLT, 2010. Maria-Florina Balcan, Avrim Blum, and Santosh Vempala. A discriminative framework for clus- tering via similarity functions. In Proceedings of the 40th annual ACM symposium on Theory of computing, STOC '08, 2008. Nikhil Bansal, Avrim Blum, and Shuchi Chawla. Correlation clustering. Machine Learning, 56 (1-3), 2004. Sugato Basu, A. Banjeree, ER. Mooney, Arindam Banerjee, and Raymond J. Mooney. Active semi- supervision for pairwise constrained clustering. In In Proceedings of the 2004 SIAM International Conference on Data Mining (SDM-04, pages 333 -- 344, 2004. 23 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 A B C D E Number Edit Requests Data Set Average-Linkage Tree eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 A B C D E Number Edit Requests Data Set Robust Average-Linkage Tree eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 Mikhail Belkin and Kaushik Sinha. Polynomial learning of distribution families. In FOCS, 2010. Constantinos Boulis and Mari Ostendorf. Combining multiple clustering systems. In In 8th Eu- ropean conference on Principles and Practice of Knowledge Discovery in Databases(PKDD), LNAI 3202, 2004. S. Charles Brubaker and Santosh Vempala. Isotropic PCA and affine-invariant clustering. CoRR, abs/0804.3575, 2008. David Bryant and Vincent Berry. A structured family of clustering and tree construction methods. Adv. Appl. Math., 27(4), November 2001. Bo Dai, Baogang Hu, and Gang Niu. Bayesian maximum margin clustering. In Proceedings of the 2010 IEEE International Conference on Data Mining, ICDM '10, 2010. S. Dasgupta. Learning mixtures of Gaussians. In Proceedings of the 40th Annual Symposium on Foundations of Computer Science, 1999. Sanjoy Dasgupta and Daniel Hsu. Hierarchical sampling for active learning. In ICML, 2008. Katherine A. Heller and Zoubin Ghahramani. Bayesian hierarchical clustering. In ICML, 2005. Adam Tauman Kalai, Ankur Moitra, and Gregory Valiant. Efficiently learning mixtures of two Gaussians. In STOC, 2010. R. Kannan, H. Salmasian, and S. Vempala. The spectral method for general mixture models. In Proceedings of the 18th Annual Conference on Learning Theory, 2005. Akshay Krishnamurthy, Sivaraman Balakrishnan, Min Xu, and Aarti Singh. Efficient active algo- rithms for hierarchical clustering. ICML, 2012. Marina Meila. Comparing clusterings - an information based distance. Journal of Multivariate Analysis, 98(5):873 -- 895, 2007. Ankur Moitra and Gregory Valiant. Settling the polynomial learnability of mixtures of gaussians. In FOCS, 2010. Gerard Salton and Christopher Buckley. Term-weighting approaches in automatic text retrieval. Information processing and management, 24(5):513 -- 523, 1988. Matus Telgarsky and Sanjoy Dasgupta. Agglomerative Bregman clustering. ICML, 2012. Konstantin Voevodski, Maria-Florina Balcan, Heiko Roglin, Shang-Hua Teng, and Yu Xia. Active clustering of biological sequences. Journal of Machine Learning Research, 13:203 -- 225, 2012. Shi Zhong. Generative model-based document clustering: a comparative study. Knowledge and Information Systems, 2005. 24 Appendix A. Complete Experimental Results The following figures show the complete experimental results for all the algorithms. Figure 12 and Figure 13 give the results in the η-merge model. Figure 14 and Figure 15 give the results in the η-merge model for the algorithms in Figure 1 and Figure 3 (for the correlation-clustering objective). Figure 16 and Figure 17 give the results in the unrestricted-merge model. Figure 12: Results in the η-merge model on datasets A, B and C. Figure 13: Results in the η-merge model on datasets D and E. 25 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set A eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set B eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set C eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set D eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set E eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 Figure 14: Results in the η-merge model for algorithms for the correlation-clustering objective on datasets A, B and C. Figure 15: Results in the η-merge model for algorithms for the correlation-clustering objective on datasets D and E. Figure 16: Results in the unrestricted-merge model on datasets A, B and C. 26 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set A eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set B eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set C eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set D eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set E eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set A eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set B eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set C eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 Figure 17: Results in the unrestricted-merge model on datasets D and E. 27 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set D eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000 no pruning 2 per cluster 4 per cluster Number Edit Requests Pruned Points Data Set E eta = 0.5 eta = 0.6 eta = 0.7 eta = 0.8 eta = 0.9 eta = 1.0
1304.8135
2
1304
2013-05-08T19:52:23
From Hierarchical Partitions to Hierarchical Covers: Optimal Fault-Tolerant Spanners for Doubling Metrics
[ "cs.DS", "cs.CG" ]
In this paper we devise an optimal construction of fault-tolerant spanners for doubling metrics. Specifically, for any $n$-point doubling metric, any $\eps > 0$, and any integer $0 \le k \le n-2$, our construction provides a $k$-fault-tolerant $(1+\eps)$-spanner with optimal degree $O(k)$ within optimal time $O(n \log n + k n)$. We then strengthen this result to provide near-optimal (up to a factor of $\log k$) guarantees on the diameter and weight of our spanners, namely, diameter $O(\log n)$ and weight $O(k^2 + k \log n) \cdot \omega(MST)$, while preserving the optimal guarantees on the degree $O(k)$ and the running time $O(n \log n + k n)$. Our result settles several fundamental open questions in this area, culminating a long line of research that started with the STOC'95 paper of Arya et al.\ and the STOC'98 paper of Levcopoulos et al. On the way to this result we develop a new technique for constructing spanners in doubling metrics. Our spanner construction is based on a novel \emph{hierarchical cover} of the metric, whereas most previous constructions of spanners for doubling and Euclidean metrics (such as the net-tree spanner) are based on \emph{hierarchical partitions} of the metric. We demonstrate the power of hierarchical covers in the context of geometric spanners by improving the state-of-the-art results in this area.
cs.DS
cs
From Hierarchical Partitions to Hierarchical Covers: Optimal Fault-Tolerant Spanners for Doubling Metrics Shay Solomon ∗ Abstract A (1 + ǫ)-spanner for a doubling metric (X, δ) is a subgraph H of the complete graph corresponding to (X, δ), which preserves all pairwise distances to within a factor of 1 + ǫ. A natural requirement from a spanner is to be robust against node failures, so that even when some of the nodes in the network fail, the remaining part would still provide a (1 + ǫ)-spanner. The spanner H is called a k-fault-tolerant (1 + ǫ)-spanner, for any 0 ≤ k ≤ n − 2, if for any subset F ⊆ X with F ≤ k, the graph H \ F (obtained by removing the vertices of F , as well as their incident edges, from H) is a (1 + ǫ)-spanner for X \ F . In this paper we devise an optimal construction of fault-tolerant spanners for doubling metrics. Specifically, for any n-point doubling metric, any ǫ > 0, and any integer 0 ≤ k ≤ n−2, our construction provides a k-fault-tolerant (1+ǫ)-spanner with optimal degree O(k) within optimal time O(n log n+kn). We then strengthen this result to provide near-optimal (up to a factor of log k) guarantees on the diameter and weight of our spanners, namely, diameter O(log n) and weight O(k2 + k log n) · ω(M ST ), while preserving the optimal guarantees on the degree O(k) and the running time O(n log n + kn). Our result settles several fundamental open questions in this area, culminating a long line of research that started with the STOC'95 paper of Arya et al. and the STOC'98 paper of Levcopoulos et al. On the way to this result we develop a new technique for constructing spanners in doubling metrics. In particular, our spanner construction is based on a novel hierarchical cover of the metric, whereas most previous constructions of spanners for doubling and Euclidean metrics (such as the net-tree spanner) are based on hierarchical partitions of the metric. We demonstrate the power of hierarchical covers in the context of geometric spanners by improving the state-of-the-art results in this area. 3 1 0 2 y a M 8 ] S D . s c [ 2 v 5 3 1 8 . 4 0 3 1 : v i X r a ∗Department of Computer Science and Applied Mathematics, The Weizmann Institute of Science, Rehovot 76100, Israel. E-mail: [email protected]. This work is supported by the Koshland Center for basic Research. 1 Introduction 1.1 Euclidean Spanners. Consider a set P of n points in Rd and a number ǫ > 0, and let H = (P, E) be a graph in which the weight ω(x, y) of each edge (x, y) ∈ E is equal to the Euclidean distance kx − yk between x and y. The graph H is called a (1 + ǫ)-spanner (or simply spanner if the stretch 1 + ǫ is clear from the context) for P if for every p, q ∈ P , there is a path in H between p and q whose weight (the sum of all edge weights in it) is at most (1 + ǫ) · kp − qk. Such a path is called a (1 + ǫ)-spanner path. The problem of constructing Euclidean spanners has been studied intensively [18, 19, 47, 41, 35, 4, 5, 3, 24]; see also the treatise on Euclidean spanners and their applications by Narasimhan and Smid [39]. Euclidean spanners find applications in geometric approximation algorithms, network topology design, distributed systems, and other areas. In many applications it is required to construct a (1 + ǫ)-spanner H = (P, E) that satisfies some useful properties. First, the spanner should contain O(n) (or nearly O(n)) edges. Second, the (maximum) degree deg(H) of H should be small. Third, its weight1 ω(H) = Pe∈E ω(e) should not be much greater than the weight ω(M ST (P )) of the minimum spanning tree M ST (P ) of P . A natural requirement from a spanner is to be robust against node failures, so that even when some of the nodes in the network fail, the remaining part would still provide a (1 + ǫ)-spanner. The spanner H is called a k-fault-tolerant (1 + ǫ)-spanner, for any 0 ≤ k ≤ n − 2, if for any subset F ⊆ X with F ≤ k, the graph H \ F (obtained by removing the vertices of F , as well as their incident edges, from H) is a (1 + ǫ)-spanner for X \ F ; we will henceforth write FT as a shortcut for fault-tolerant. Note that the basic (non-FT) setting when all nodes are functioning corresponds to the case k = 0. The notion of FT spanners was introduced in the pioneering work of Levcopoulos et al. [37] from STOC'98. A basic (non-FT) construction of (1 + ǫ)-spanners with constant degree (and thus O(n) edges) and constant lightness can be built in time O(n log n) [7, 23, 31]. Levcopoulos et al. [37] observed that the (k + 1)-power2 of a spanner is a k-FT spanner with the same stretch. Therefore, by taking the (k + 1)- power of the basic construction of [31], one can obtain in O(n log n) + n2O(k) time, a k-FT (1 + ǫ)-spanner with degree and lightness both bounded by 2O(k). Notice that any k-FT spanner (with an arbitrarily large stretch) must have degree Ω(k), and thus Ω(kn) edges; also, it is easy to see that the lightness must be Ω(k2) [21]. Thus there is a gap between the exponential upper bound 2O(k) and the polynomial lower bounds Ω(k) and Ω(k2) on the degree and lightness, respectively. In addition, Levcopoulos et al. [37] devised two other constructions of k-FT spanners, one with O(k2n) edges and running time O(n log n + k2n), and another with edges and running time both bounded by O(kn log n). In WADS'99 Lukovszki [38] devised two constructions of k-FT spanners, one with the optimal number of edges O(kn) and with running time O(n logd−1 n + kn log log n), and another with degree O(k2). In SoCG'03, Czumaj and Zhao [21] showed that the optimal guarantees O(k) and O(k2) on the degree and lightness of k-FT spanners can be achieved using a greedy algorithm.3 However, it is unclear whether the greedy algorithm of [21] can be implemented efficiently; a naive implementation requires time O(n2) · P aths(n, k + 1, t), where P aths(n, k + 1, t) is the time needed to check whether an n-vertex graph (with O(kn) edges) contains k + 1 vertex-disjoint t-spanner paths between an arbitrary pair of vertices. In addition, Czumaj and Zhao [21] devised a construction of k-FT spanners with the optimal degree O(k) and with lightness O(k2 log n), within time O(kn logd n + nk2 log k). (See Table 1 for a reference. We also refer to Chapter 18 in the treatise [39] for an excellent survey on Euclidean FT spanners.) We remark that the time needed to compute a k-FT spanner is Ω(n log n + kn). The first term Ω(n log n) is a lower bound on the time needed to compute a basic (non-FT) spanner in the algebraic computation tree model [17], and the second term Ω(kn) is a lower bound on the number of edges in any k-FT spanner. Up to this date no construction of k-FT spanners could combine the optimal running time O(n log n + kn) with either the optimal number of edges O(kn) (and thus the optimal degree O(k)) 1For convenience, we will henceforth refer to the normalized notion of weight Ψ(H) = ω(M ST (P )) , which we call lightness. 2An s-power of a graph G is a graph with the same vertex set as G, and there is an edge between any pair of vertices ω(H) that are connected by a path in G with at most s edges. 3The (cid:0)n 2(cid:1) edges of the underlying complete Eucldiean graph are traversed by increasing order of weight; each edge (x, y) is added to the current graph if and only if it does not contain k + 1 vertex-disjoint t-spanner paths between x and y. 1 or with the optimal lightness O(k2). In particular, the following questions are stated in the treatise of Narasimhan and Smid [39]; all these questions remained open even for 2-dimensional point sets. Question 1 (Open Problem 26 in [39]) Is there an algorithm that constructs a k-FT (1 + ǫ)-spanner with O(kn) edges in O(n log n + kn) time? Question 2 (Open Problem 27 in [39]) Is there an algorithm that constructs a k-FT (1 + ǫ)-spanner with degree O(k) in O(n log n + kn) time? (This question subsumes Question 1.) Question 3 (Open Problem 28 in [39]) Is there an algorithm that constructs a k-FT (1 + ǫ)-spanner with lightness O(k2) in O(n log n + kn) time? Another important measure of quality is the (hop-)diameter of spanners; we say that a spanner H has diameter Λ(H) if it provides a (1 + ǫ)-spanner path with at most Λ(H) edges, for every p, q ∈ P . Achieving a small diameter is desirable for some practical applications (e.g., in network routing protocols); see [6, 5, 2, 3, 11, 24], and the references therein. Euclidean Spanners that combine small diameter with some of the other parameters (among small number of edges, degree, lightness and running time) have been well studied in the last twenty years. In particular, in a seminal STOC'95 paper by Arya et al. [5], a single construction of spanners that combines all these parameters was presented, having constant degree, diameter O(log n), lightness O(log2 n) and running time O(n log n). Moreover, Arya et al. conjectured that the lightness can be improved to O(log n), without increasing any of the other parameters; having lightness and diameter both bounded by O(log n) is optimal due to a lower bound of [24]. Arya et al.'s long-standing conjecture was resolved in the affirmative in STOC'13 by Elkin and this author [25]. Chan et al. [14] generalized the result of [25] for the FT setting. Specifically, they showed that there exist k-FT spanners with degree O(k2), diameter O(log n) and lightness O(k3 log n). The running time of the construction of [14] was not analyzed; a naive implementation requires quadratic time. In the "Future Direction" Section of [14], Chan et al. asked whether the dependence on k in the degree and lightness bounds of their construction can be improved. A partial answer to this question was given by this author [44], who achieved degree O(k2), diameter O(log n) and lightness O(k2 log n), within time O(n log n + k2n). A merging of the two manuscripts [14] and [44] gave rise to the ICALP'13 paper [15]. (See Table 1 for a reference.) We remark that the upper bounds of [14, 44, 15] are pretty far from the known lower bounds: degree O(k2) versus Ω(k), lightness O(k2 log n) versus Ω(k2), and running time O(n log n + k2n) versus Ω(n log n + kn). In particular, the following question was left open. Question 4 [14, 44, 15] Is there an algorithm that constructs a k-FT spanner with degree o(k2), diameter O(log n) and lightness O(k2) + o(k2 log n), within time O(n log n) + o(k2n)? Our Results. We show that for any set P of n points in Rd, any ǫ > 0, and any integer 0 ≤ k ≤ n − 2, one can build a k-FT (1 + ǫ)-spanner with optimal degree O(k) within time O(n log n + kn). The running time of our construction holds in the algebraic computation tree model, and is therefore optimal as well. In particular, this result settles in the affirmative Questions 1 and 2 above. Moreover, our spanners also achieve diameter O(log n) and lightness O(k2 + k log n), which settles Question 4. (See Table 1 for a summary of previous and our constructions of Euclidean FT spanners.) Consider the lightness bound. Notice that it is equal to O(k2), for all k = Ω(log n), thus matching the naıve lower bound Ω(k2) in this range. In other words, it provides a positive answer to Question 3 for all k = Ω(log n). More generally, it exceeds the naıve bound Ω(k2) by a factor of log n k . However, the naıve bound Ω(k2) on the lightness can be strengthened if we take into account the diameter O(log n) of our spanners. Indeed, any spanner with diameter O(log n) must have lightness Ω(log n) [3, 24]. More generally, for any parameter ρ ≥ 2, any spanner with diameter O(logρ n) must have lightness Ω(ρ logρ n) [24]. Note also that any spanner with degree O(ρ) must have diameter Ω(logρ n). By combining all these lower bounds together (and substituting ρ with k), we get that one cannot do better than the following tradeoff: k-FT spanners with degree Ω(k), diameter Ω(logk n) and lightness Ω(k2 + k logk n). Notice that the parameters of our spanners are pretty close to this lower bound tradeoff, with only a slack of log k on the diameter and a slack of min{log k, log n k } = O(log log n) on the lightness. 2 Reference [37] [37] [37] [38] [21] [21] [13] [13] [13] [14, 44, 15] New # Edges n2O(k) O(k2n) O(kn log n) O(kn) O(kn) O(kn) O(kn) O(km) O(k2n) O(k2n) O(kn) Degree 2O(k) unspecified unspecified unspecified Diameter unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified O(α(m, n)) unspecified O(k) O(k) O(k2) O(k2) O(k) O(log n) O(log n) Lightness 2O(k) unspecified unspecified unspecified O(k2) O(k2 log n) unspecified unspecified unspecified O(k2 log n) O(k2 + k log n) Running Time Metric O(kn log n) O(n log n) + n2O(k) O(n log n + k2n) Euclidean Euclidean Euclidean O(n logd−1 n + kn log log n) Euclidean O(n2) · P aths(n, k + 1, t) Euclidean O(kn logd n + nk2 log k) Euclidean doubling doubling doubling doubling doubling O(n log n + k2n) O(n log n + kn) unspecified unspecified unspecified Table 1: A comparison between the previous state-of-the-art and our constructions of FT spanners for low-dimensional Euclidean and doubling metrics. See Theorem 1.1 for the dependencies of our construction on ǫ and d. 1.2 Doubling Metrics. The doubling dimension of a metric (X, δ) is the smallest value d such that every ball B in the metric can be covered by at most 2d balls of half the radius of B. This notion generalizes the Euclidean dimension, since the doubling dimension of the Euclidean space Rd (equipped with any of the ℓp norms) is Θ(d). A metric is called doubling if its doubling dimension is constant. Doubling metrics were implicit in the works of Assoud [8] and Clarkson [20], and were explicitly defined by Gupta et al. [32]. Since then they have been studied intensively (see, e.g., [36, 46, 33, 11, 42, 1, 9, 15]). Spanners for doubling metrics were also subject of intensive research [26, 12, 11, 33, 40, 29, 30, 42, 13, 25, 14, 44, 15]. In many of these works the objective is to devise spanners that achieve one parameter or more among small number of edges, degree, diameter, lightness, and running time. Spanners for doubling metrics were also found useful for approximation algorithms [9] and for machine learning [28]. The literature on FT spanners for doubling metrics is quite sparse, and consists of the following papers [13, 14, 44, 15]. In ICALP'12, Chan et al. [13] devised three constructions of k-FT spanners for doubling metrics. Their first construction achieves the optimal number of edges O(kn), the second achieves O(km) edges and diameter O(α(m, n)), where α is the two-parameter inverse-Ackermann function, and the third construction achieves degree O(k2). The other papers are the follow-ups [14, 44, 15] to [25] that were discussed in Section 1.1, which provide within O(n log n + k2n) time, a k-FT spanner with degree O(k2), diameter O(log n) and lightness O(k2 log n). The constructions of [14, 44, 15] apply to doubling metrics. Obviously, Questions 1-4 from Section 1.1 are relevant for doubling metrics as well. Moreover, even much weaker variants of these questions can be asked. In particular, the previous state-of-the-art bounds on the degree and lightness of k-FT spanners for doubling metrics are O(k2) and O(k2 log n), respectively; hence it is natural to ask if these bounds can be improved, regardless of the running time issue. We demonstrate that our construction extends to doubling metrics without incurring any overhead (beyond constants) in the degree, diameter, lightness, and running time. Notice that our construction improves all the previous state-of-the-art constructions of FT spanners for both Euclidean and doubling metrics, disregarding the construction of [21] which requires a somewhat unreasonable running time of O(n2) · P aths(n, k + 1, t). (See Table 1 for a summary of previous and our results.) In particular, our result settles Questions 1, 2 and 4 in the affirmative for doubling metrics. Question 3 is settled for all k = Ω(log n), but remains open in the complementary range of k = o(log n)). We remark that the problem of constructing spanners for doubling metrics with sub-logarithmic lightness is a central open question in this area (see [9]), even for basic (non-FT) spanners, and regardless of the diameter or any other parameter of the construction. In other words, a positive solution to Question 3 in the range o(log n) seems currently out of reach for doubling metrics, even for the basic case k = 0. The main result of this paper is summarized in the following theorem. Theorem 1.1 Let (X, δ) be an n-point doubling metric, with an arbitrary doubling dimension d. For any ǫ > 0 and any integer 0 ≤ k ≤ n − 2, a k-FT (1 + ǫ)-spanner with degree ǫ−O(d) · k, diameter O(log n) and lightness ǫ−O(d)(k2 + k log n) can be built within ǫ−O(d)(n log n + kn) time. 3 1.3 Our and Previous Techniques. Most previous works on geometric FT spanners [37, 38, 21, 39] apply to Euclidean metrics, and rely heavily on profound geometric properties of low-dimensional Euclidean metrics, such as the gap property [16, 7] and the leapfrog property [22]. In particular, these constructions do not extend to arbitrary doubling metrics. In contrast, in our work we only use standard packing arguments, and do not rely on any other geometric property of low-dimensional Euclidean metrics. Consequently, our construction applies to arbitrary doubling metrics. On the other hand, there are some similarities between our techniques and the techniques used in the previous works on FT spanners for doubling metrics [13, 14, 44, 15]. The starting point in both our work and the works of [13, 14, 44, 15] is the standard net-tree spanner of [26, 12], which is induced from a net-tree T = T (x) that corresponds to a hierarchical partition of the metric (X, δ). Any tree node x is associated with a single point p(x) that belongs to the point set D(x) of its descendant leaves. For any pair of tree nodes at the same level that are close together (with respect to the distance scale at that level), a cross edge is added. The net-tree spanner is the union of the tree edges (i.e., the edges of T ) and the cross edges. (See Section 2 for more details.) To obtain a k-FT spanner, [13, 14] use k + 1 net-trees rather than one, and in each of these trees, each tree node x is associated with a single point from D(x). Another idea that is used in [44, 15] is to use a single net-tree, but to associate each tree node x with Θ(k) points from D(x) (if any) rather than a single point. To achieve degree O(k2), [13, 14] used single-sink spanners similar to those in [5], whereas [44, 15] used a rerouting technique from the bounded degree spanner construction of [30]. However, achieving degree o(k2) using these ideas is doomed to failure. First, in [13, 14] there are k + 1 net-trees, each of which contributes Ω(k) units to the degree load, thereby giving a total degree of Ω(k2). Incurring a degree of Ω(k2) from the approach of [44, 15] is also inevitable. The main problem is that a node x is associated with Θ(k) points from D(x) (if any). Consequently, the same leaf point p may belong to Θ(k) different sets D(x) of internal nodes x. For each cross edge that is incident on any of these Ω(k) nodes, we must connect p with Ω(k) edges, and so the degree of p becomes Ω(k2). The basic idea of associating nodes of net-trees and other hierarchical tree structures (such as split trees and dumbbell trees) with points from their descendant leaves has been widely used in the geometric spanner literature; see [10, 5, 26, 12, 11, 39, 30, 13], and the references therein. In particular, any point in D(x) is close to the original net-point p(x) with respect to the distance scale of x, denoted rad(x). Instead of restricting ourselves to D(x), we suggest to look at a larger set B(x) of all points that belong to the ball of radius O(rad(x)) centered at p(x). By associating nodes x with points from B(x), we get a hierarchical cover of the metric. Since the doubling dimension is constant, this cover will have a constant degree (every point will belong to a constant number of sets B(·) at each level). We use this constant degree hierarchical cover to obtain degree O(k) as follows. A node x will appoint to itself Θ(k) points from B(x) whose degree due to cross edges at lower levels is small enough; let S(x) be the set of these points, called surrogates. A cross edge (x, y) increases the degree of surrogates of S(x). However, every unit of increase to a surrogate p ∈ S(x) is due to some surrogate q ∈ S(y) that is close to p -- the distance between p and q will be O( 1 ǫ · rad(x)). This surrogate q, as well as other points that are within distance O(rad(x)) from q, will not necessarily be in B(x). However, since the distance scales increase exponentially with the level of a tree node, all these points must belong to a close ancestor x′ of x, where the level of x′ is higher than that of x by at most O(log 1 ǫ ) units. The key idea here is to "compensate" one of the close ancestors x′ of x at a value that matches the "cost" of x due to cross edges. By re- appointing the same surrogates of S(x) for O(log 1 ǫ ) levels continuously (at which stage we must reach a close ancestor x′ of x that is compensated), and only then appointing new surrogates for S(x′), we will be able to achieve the optimal degree O(k). While in the approach of [44, 15] each point of X belongs to lists D(x) of Ω(k) nodes x, our approach can guarantee (though this does not follow immediately from the above discussion) that each point of X will serve as a surrogate of only O(log 1 ǫ ) nodes. Having assigned surrogates for each node, we replace each edge (x, y) of the basic spanner by a bipartite clique between the corresponding surrogate sets S(x) and S(y). Observe that S(x) and S(y) may contain Θ(k) points each, and so the size of this bipartite clique may be as large as Θ(k2). In other words, we may 4 replace a single edge of the basic spanner by Θ(k2) edges. Since the basic spanner has Θ(n) edges, one might get the wrong impression that our FT spanner contains Θ(k2n) edges, which is far too much (by a factor of k)! There are two reasons why the number of edges in our FT spanner is in check. First, it turns out that many edges (x, y) of the basic spanner satisfy S(x) + S(y) ≪ k, which implies that there are many sparse bipartite cliques. More specifically, we show that the overall number of edges in all these sparse bipartite cliques is O(kn). Second, even though there are still many edges in the basic spanner which satisfy S(x) + S(y) = Θ(k), we demonstrate that most of them are in fact redundant, and such redundant edges need not be replaced by bipartite cliques. (See Section 3.1 for more details.) The main challenge of this work was to achieve the optimal bound O(k) on the degree. However, small degree (which also implies small number of edges) is just one out of four parameters that are of interest to us. Our construction is tailored in such a way that once degree O(k) is achieved, the rest of the parameters come almost for free. Lightness. The standard net-tree analysis shows that the basic spanner construction has lightness O(log n). Replacing each edge of the basic spanner with a bipartite clique of size O(k2) between the corre- sponding surrogate sets gives rise to lightness O(k2 log n). Improving the lightness bound to O(k2+k log n) is more involved. The idea is to try replacing each edge (x, y) of the basic spanner with a bipartite match- ing instead of a bipartite clique; this is possible only when both S(x) and S(y) contain Θ(k) surrogates, which is not always the case (see Section 4). The total lightness of the bipartite matchings is clearly O(k log n). The more interesting part is to show that the total lightness of the bipartite cliques is O(k2). Diameter. We can achieve diameter O(log n) by shortcutting the net-tree using the 1-spanners of [45]. To control the lightness, we follow an idea from [14, 44, 15] and shortcut the light subtrees (those at small enough distance scales). If this is done carelessly, the degree and lightness will increase to at least O(k2) and O(k2 log n), respectively. However, by pruning a certain subset of nodes from the net-tree, and using bipartite matchings for the shortcut edges whenever possible, the desired bounds can be achieved. Running time. Given the standard net-tree spanner construction and the 1-spanners of [45], our con- struction can be implemented within O(kn) time in a rather straightforward manner. Since the standard net-tree spanner can be built within time O(n log n) [40, 30], and since the same amount of time suffices to build the 1-spanners of [45], the overall running time of our construction is O(n log n + kn). We remark that for low-dimensional Euclidean metrics, some variants of the net-tree (such as the fair split tree of [10]) can be built within time O(n log n) in the algebraic computation tree model. Consequently, the basic spanner construction can also be built within time O(n log n) in this model. The time bound O(n log n) for the 1-spanners of [45] also applies to this model. Therefore, for low-dimensional Euclidean metrics, the time bound of our construction applies to this model as well. For arbitrary doubling metrics, one should also need a rounding operation (to allow one to find the i for which 2i < x ≤ 2i+1, for any x) [27]. Independently of our work, Kapoor and Li [34] obtained 1.4 Similar Results by Kapoor and Li. similar results for Euclidean FT spanners. In particular, they showed that for any low-dimensional Euclidean metric, one can build within time O(n log n + kn), a k-FT (1 + ǫ)-spanner with degree O(k) and lightness O(k2). Similarly to our result, their running time and degree bounds are optimal. In addition, they obtain the optimal lightness bound O(k2), while our lightness bound O(k2 + k log n) has a slack of log n k . However, while the diameter of their spanners is unbounded, our spanners have diameter O(log n). Moreover, their result relies heavily on geometric properties of low-dimensional Euclidean metrics and thus cannot be extended to doubling metrics, while our result applies to all doubling metrics. In particular, the techniques and ideas used in the two papers are inherently different. It should be noted that the results of Kapoor and Li [34] were obtained much prior to our results.4 However, we stress that our results were achieved before this author became aware of the results of [34]. 1.5 Organization. In Section 2 we define the basic notions and present the notation that is used throughout the paper. Section 3 is devoted to our construction of FT spanners with optimal degree. More specifically, the description of the construction is given in Section 3.1, whereas its analysis is given 4Private communication with Sanjiv Kapoor, March 2013. 5 in Section 3.2 (degree analysis) and Section 3.3 (fault-tolerance and stretch analysis). In Sections 4 and 5 we show that small lightness and diameter, respectively, can be obtained using a few simple modifications to the construction of Section 3. The running time issue is addressed in Section 6. 2 Preliminaries Let (X, δ) be an arbitrary n-point doubling metric. Without loss of generality, we assume that the minimum inter-point distance of X is equal to 1. We denote by ∆ = maxu,v∈X δ(u, v) the diameter of X. A set Y ⊆ X is called an r-cover of X if for any point x ∈ X there is a point y ∈ Y , with δ(x, y) ≤ r. A set Y is an r-packing if for any pair of distinct points y, y′ ∈ Y , it holds that δ(y, y′) > r. For r1 ≥ r2 > 0, we say that a set Y ⊆ X is an (r1, r2)-net for X if Y is both an r1-cover of X and an r2-packing; such a net can be constructed by a greedy algorithm. We will use the following standard packing argument. Fact 2.1 Let R ≥ 2r > 0 and let Y ⊆ X be an r-packing in a ball of radius R. Then, Y ≤ ( R r )2 dim. Hierarchical Nets. We consider the hierarchical nets that are used by Gottlieb and Roditty [30]. Write ℓ = ⌈log5 ∆⌉, and let {Ni}ℓ i≥0 be a sequence of hierarchical nets, where N0 = X and for each i ∈ [ℓ], Ni is a (3 · 5i, 5i)-net for Ni−1.5 For each i ∈ [ℓ], we refer to Ni as the i-level net and the points of Ni are called the i-level net points. Note that N0 = X ⊇ N1 ⊇ . . . ⊇ Nℓ, and Nℓ contains exactly one point. The same point of X may have instances in many nets; specifically, an i-level net point is necessarily a j-level net point, for every j ∈ [0, i]. When we wish to refer to a specific instance of a point p ∈ X, which is determined uniquely by some level i ∈ [0, ℓ] (such that p ∈ Ni), we may denote it by a pair (p, i). Net-tree. The hierarchical nets induce a hierarchical tree T = T (X), called net-tree [26, 12]. Each node in the net-tree T corresponds to a unique net-point; we will use (p, i) to denote both the net point and the corresponding tree node. We refer to the nodes corresponding to the i-level net points as the i-level nodes. The only ℓ-level node is the root of T , and for each i ∈ [ℓ], each (i − 1)-level node has a parent at level i within distance 3 · 5i; such a node exists since Ni is a 3 · 5i-cover for Ni−1. (We may assume that for a pair (p, i + 1), (p, i) of net-points, (p, i + 1) will be the parent of (p, i) in T .) Thus, any descendant of every i-level node can reach it by climbing a path of weight at most Pj∈[i] 3 · 5i ≤ 4 · 5i. By Fact 2.1, since the doubling dimension is constant, each node has only a constant number of children. For a tree node v = (p, i), let Ch(v) denote the set of children of v in the net-tree T . Net-tree Spanner via Cross Edges. We recap the basic spanner construction H = H(X) of [26, 12]. In order to achieve stretch (1 + ǫ), for each i ∈ [0, ℓ − 1], cross edges are added between i-level nodes that are close together with respect to the distance scale 5i at that level. Specifically, for any pair (p, i), (q, i) of distinct i-level nodes such that δ(p, q) ≤ γ5i, for some parameter γ = Θ( 1 ǫ ), we add a cross edge between (p, i) and (q, i) of weight δ(p, q). The basic spanner construction H is obtained as the union of the tree edges (those connecting nodes with their children in T ) and the cross edges, where an edge between a pair of nodes is translated to an edge between the corresponding points. By Fact 2.1, the degree of any tree node in the spanner H (due to tree and cross edges) is ǫ−O(d). Moreover, it can be shown that H has n · ǫ−O(d) edges [26, 12]. On the other hand, as the same point may have instances in many nets (and thus in many tree nodes), the degree of a point may be unbounded. The following lemma from [26, 12] gives the essence of the basic cross edges framework. Lemma 2.2 (Basic Cross Edges Framework Guarantees Low Stretch) Consider the basic span- ner construction H, whose edge set consists of all the tree edges and the cross edges (defined with respect to some parameter γ = O( 1 ǫ )). For each p, q ∈ X, the spanner H contains a (1 + ǫ)-spanner path Πp,q, obtained by climbing up from the leaf nodes (p, 0) and (q, 0) to some j-level ancestors (p′, j) and (q′, j), respectively, where (p′, j) and (q′, j) are connected by a cross edge and δ(p, q) = Θ( 1 ǫ ) · 5j. 5As mentioned in [30], this choice of parameters is needed in order to achieve running time O(n log n). 6 As mentioned above, the degree of the spanner H is unbounded. To reduce the degree of the spanner, we will appoint to each internal node of the net-tree T a surrogate, which is a point in X that is nearby (with respect to the distance scale at that level). More specifically, a node (p, i) of T , i ∈ [ℓ], will be appointed a surrogate q ∈ X such that δ(p, q) = O(5i); the surrogate of a node (p, i) will be denoted by s(p, i). (For technical convenience, we define the surrogate of a leaf node (p, 0) as p itself, i.e., s(p, 0) = p.) Another important requirement from a surrogate of an i-level node is that its degree due to cross edges at lower levels j ∈ [0, i − 1] would be sufficiently small; we will discuss this issue in detail later on. Given a surrogate for each tree node, the basic spanner construction H is translated to its surrogate spanner s(H) by replacing each tree edge e = ((p, i + 1), (q, i)) (respectively, cross edge e = ((p, i), (q, i))) with its surrogate edge s(e) = (s(p, i + 1), s(q, i)) (resp., s(e) = (s(p, i), s(q, i))). We will demonstrate (Section 3) that surrogates can be appointed to nodes, so that the resulting surrogate spanner has constant degree. Moreover, by increasing the number of surrogates with which each node is appointed from 1 to (at most) k + 1, and thus replacing each edge of the basic spanner H by a bipartite clique between the corresponding surrogates, we will obtain a k-FT spanner with optimal degree O(k). Lemma 2.3 (Extended Cross Edges Framework Guarantees Low Stretch) For each p, q ∈ X, consider the (1+ǫ)-spanner path Πp,q in H that is guaranteed by Lemma 2.2. The corresponding surrogate path s(Πp,q) in s(H), obtained by replacing each edge e of Πp,q by its surrogate edge s(e), is a (1 + O(ǫ))- spanner path (between the same endpoints p and q). We can reduce the stretch of the path from 1 + O(ǫ) back to 1 + ǫ by scaling γ up by an appropriate constant. 3 Fault-Tolerant Spanners with Optimal Degree In this section we devise a construction of k-FT spanners with optimal degree O(k). The description of the construction is given in Section 3.1, whereas its analysis is given in Section 3.2 (degree analysis) and Section 3.3 (fault-tolerance and stretch analysis). 3.1 The Construction 3.1.1 The Basic Sceheme. Recall that the weight of i-level cross edges in the basic spanner con- struction H is at most γ5i, where γ = O( 1 ǫ ), and define τ = ⌈log5 γ⌉ + 1. Also, let ξ = ξ(ǫ, dim) = ǫ−O(d) be an upper bound for the maximum degree of any tree node in the basic spanner H. The general approach is to try appointing k + 1 surrogates s1(p, i), . . . , sk+1(p, i) for each tree node (p, i), so that for any k node failures in the network, at least one surrogate of (p, i) will be functioning. The set S(p, i) = {s1(p, i), . . . , sk+1(p, i)} will be called the surrogate set of (p, i). A surrogate s ∈ S(p, i) of an i-level node (p, i) is a point q at distance δ(p, q) = O(5i) from p, whose degree due to cross edges at lower levels j ∈ [0, i − 1] is at most D = (τ + 4)ξ2(2k + 1); we henceforth refer to D as the degree threshold. The basic spanner H is given as the union of the tree and cross edges. The FT-spanner construction H is obtained from H by replacing each edge of H with a bipartite clique. Specifically, every cross edge ((p, i), (q, i)) is replaced with a bipartite clique between the corresponding surrogate sets S(p, i) and S(q, i). Such a cross edge ((p, i), (q, i)) is referred to as an i-level cross edge (of the basic spanner H). Moreover, we may also refer to the edges of the corresponding bipartite clique as cross edges (of the FT spanner H). Similarly, a tree edge ((p, i + 1), (q, i)) is replaced with a bipartite clique between S(p, i + 1) and S(q, i); such a tree edge ((p, i + 1), (q, i)) is referred to as an i-level tree edge (of the basic spanner H), and we may also refer to the edges of the corresponding bipartite clique as tree edges (of the FT spanner H). Roughly speaking, each bipartite clique that replaces an i-level tree edge is incarnated in a clique that replace some i-level or (i + 1)-level cross edge; refer to Section 3.2.3 for a rigorous argument. For the intuitive discussion of this section we will henceforth restrict our attention to cross edges. Next, we describe how to compute the surrogate sets, which is the crux of the problem. 7 For a node (p, i), denote by D(p, i) its descendant set, i.e., the set of points in its descendant leaves. Note that for each point q ∈ D(p, i), we have δ(p, q) ≤ 4 · 5i. In particular, any point q ∈ D(p, i) is at a small enough distance from p to serve as (p, i)'s surrogate. If there are less than k + 1 points in D(p, i) whose degree is at most D, we need to look for surrogates outside D(p, i); in particular, we can look for nearby i-level nodes (q, i), with δ(p, q) = O(5i), and try to use somehow their descendant sets D(q, i). We remark that in order to achieve k-fault-tolerance, it is sufficient that the surrogate set S(p, i) of a node (p, i) will contain its entire descendant set D(p, i), even if D(p, i) ≪ k + 1. Nevertheless, we will see later that even in such cases it is still advantageous for a node to have k + 1 surrogates, if possible. The surrogate sets are computed bottom-up, starting at the leaf nodes. For a leaf (p, 0), it is enough to take just p to the surrogate set S(p, 0), i.e., S(p, 0) = D(p, 0) = {p}. More generally, we can take the surrogate set S(p, i) to be D(p, i), for small levels i = O(1) in the tree. However, as we climb up the tree, we might not be able to guarantee that S(p, i) contains the entire descendant set D(p, i) due to degree violations; in this case it is critical to guarantee that S(p, i) = k + 1. For any point a ∈ D(p, i) that cannot be taken to the surrogate set S(p, i), its degree must exceed the degree threshold D, which, in turn, implies that many cross edges at lower levels are incident on nodes of which a is a surrogate; more specifically, since each node may be incident on at most ξ cross edges at each level (in the basic spanner H) and D is sufficiently large, it follows that some cross edges at levels smaller than i−τ must be incident on nodes of which a is a surrogate. Intuitively, any j-level cross edge between a j-level node (a, j) for which a ∈ S(a, j) and some other j-level node (q, j), where j ≤ i − τ , should give rise to additional points that are close to a and thus also to p, namely, those in D(q, j). Indeed, first note that the distance between a and its surrogate a is O(5j). Second, the weight of j-level cross edges is at most γ5j, and so δ(a, q) ≤ O(5j) + γ5j ≤ O(5j) + γ5i−τ = O(5i). Hence for any point b ∈ D(q, j), δ(p, b) ≤ δ(p, a) + δ(a, q) + δ(q, b) ≤ 4 · 5i + O(5i) + 4 · 5j = O(5i). This means that we can take the points in D(q, j) of small degree to the surrogate set S(p, i) of (p, i); however, if there are points in D(q, j) whose degree exceed D, we will try to apply this argument again. Consequently, a surrogate of a node (p, i) need not belong to D(p, i), but rather to a (possibly much larger) set F (p, i) which we refer to as the friend set of p. This set F (p, i) will contain O(k) points of small degree that are at distance O(5i) from p (hence F (p, i) is some subset of O(k) points from the ball set B(p, i) mentioned in Section 1.3). We need to show that whenever the degrees of surrogates of some node (p, i) are about to exceed D, there are at least k + 1 points in F (p, i) of small degree which can be appointed as new surrogates instead of the old ones, and so the degree bound will always be in check. For now assume that the degree of a node (p, i) increases only due to cross edges (the degree contribu- tion due to tree edges can be easily controlled, as we shall later see). Consider a cross edge ((p, i), (q, i)), which gives rise to a bipartite clique between S(p, i) and S(q, i), and thus increases the degree of each point in S(p, i) by S(q, i) units. We will show that F (q, i) ≥ S(q, i), and the key idea is to let (q, i) share its friend set with (p, i). In this way we compensate (p, i) at a value that matches its cost due to cross edges. However, note that p and q may be at distance γ5i apart (recall that γ5i is the upper bound on the weight of i-level cross edges), and so the points in F (q, i) may be too far from (p, i) to serve as its friends. Thus the points of F (q, i) are not moved immediately to F (p, i), but rather to a temporary set R(p, i) called the reserve set of (p, i). All the points in R(p, i) will be moved to F (p, i) within τ levels. During these τ levels in which some point in the reserve set is too far to become a friend, we are going to re-appoint the same surrogates over and over. That is, new surrogates of a node are appointed for a long term of Ω(τ ) levels, which means that no ancestor of such a node in the next Ω(τ ) levels will appoint new surrogates. During this term of Ω(τ ) levels, the points of R(p, i) become closer and closer to the respective ancestor of (p, i), until they are close enough to become its friends and thus appointed as its surrogates -- at this stage new surrogates are appointed to that ancestor, also for a term of Ω(τ ) levels. As mentioned in Section 1.3, one may get the wrong impression that our FT spanner H contains O(k2n) edges rather than O(kn) edges. Indeed, each edge (x, y) of the basic spanner H is translated into a bipartite clique in H between the corresponding surrogate sets S(x) and S(y). Since S(x) and S(y) 8 may contain Θ(k) points each, the size of such a bipartite clique may be as large as Θ(k2). Recalling that the basic spanner has Θ(n) edges, it may seem that our FT spanner H contains Θ(k2n) edges, which is far too much! There are two reasons why the number of edges in our FT spanner is in check. First, it turns out that many nodes x have a small surrogate set S(x); such a node x is called small (see Section 3.1.2 for more details). Consequently, many edges (x, y) of the basic spanner satisfy S(x) + S(y) ≪ k, which implies that many of the bipartite cliques are sparse. Second, even though there are still many edges (x, y) in the basic spanner which satisfy S(x) + S(y) = Θ(k), we demonstrate that most of them are in fact redundant, and such redundant edges need not be replaced by bipartite cliques. The issue of redundant edges is related to the notions of leeches and hosts, and is discussed in detail in Section 3.1.3. 3.1.2 Complete Versus Incomplete, Small Versus Large, Clean Versus Dirty. A node (p, i) is called complete if S(p, i) ≥ k + 1; otherwise S(p, i) < k + 1, and it is incomplete. A node is called large if F (p, i) ∪ S(p, i) ≥ 2k + 2; otherwise F (p, i) ∪ S(p, i) < 2k + 2, and it is small. Since any point of F (p, i) can serve as a surrogate, our construction guarantees that any large node must be complete. The friend set F (p, i) of (p, i) will contain O(k) (more specifically, at most 3k + 3) clean 10-friends of (p, i); we say that a point q or a node (q, i) is a t-friend of some i-level node (p, i) if δ(p, q) ≤ t · 5i. Small and large nodes are handled differently. For a small node (p, i), all points in D(p, i) are appointed as surrogates, i.e., we assign S(p, i) = D(p, i). We will show later that D(p, i) ⊆ F (p, i).6 This means that a small node must have less than 2k + 2 surrogates. Even though we may upper bound the number of surrogates by k + 1, we do not attempt to do this; it turns out that allowing more than k + 1 (but up to 2k+2) surrogates is useful for simplifying the analysis to some extent. Assuming by induction that S(x) = D(x) holds for every child x of (p, i), we have S(p, i) = D(p, i) = Sx∈Ch(p,i) D(x) = Sx∈Ch(p,i) S(x). In other words, the old surrogates (from the surrogate sets of (p, i)'s children) are re-used. Note that a small node re-uses the surrogates of its children. Similarly to small nodes, we would like a large node to re-use the surrogates of (one of) its children. However, sometimes a large node must appoint new surrogates (this happens quite rarely). Specifically, an appointment of new surrogates to a large node x is made for a long term of at least τ + 3 = Ω(τ ) levels; recall that τ = ⌈log5 γ⌉ + 1. During this term, each ancestor of x′ of x would re-use the same surrogates of x (in fact, x′ may choose to use the surrogates of another descendant of x′); we call x an appointing node. The surrogates S(x) of x are chosen arbitrarily from its friend set F (x), and so S(x) ⊆ F (x). At the end of such a term, k + 1 new surrogates are appointed to the corresponding large ancestor y of x from the friend set of y. We need to show that the friend set F (y) of the appointing node y at this stage contains at least k + 1 10-friends of y of small degree, which can be appointed as its new surrogates. In fact, we will show something stronger, namely, that F (y) contains at least 2k + 2 (rather than k + 1) such friends. Hence k + 1 arbitrary points out of them will be appointed as the new surrogates of y, and the other at least k + 1 such friends may be used for compensating neighboring (due to cross edges) nodes. At the outset all points are marked as clean. A point p remains clean as long as it is appointed as a surrogate of small nodes. However, at the first time p is appointed as a new surrogate of a large node it becomes dirty. Once p becomes dirty, it will never be re-appointed as a new surrogate again. Thus, each point can be appointed as a new surrogate of at most one large node, and this appointment is for a term of at least τ + 3 = Ω(τ ) levels. We will make sure that during such a term the degree of any surrogate will increase by at most ǫ−O(d) · (2k + 1) units, and so the degree bound will be in check. Our construction will guarantee that either all surrogates of a node are clean, or they are all dirty. We henceforth say that a node is clean (respectively, dirty) if all its surrogates are clean (resp., dirty). A dirty node will be complete, whereas a clean node may be complete or incomplete. Also, a large node will be dirty, whereas a small node is usually (except for a leech) clean; see Section 3.1.3 for more details. 3.1.3 A Symbiosis Between Leeches and Hosts. Appointing new surrogates to large nodes is a costly operation, and should be avoided whenever possible. Specifically, before new surrogates are 6The equation D(p, i) = S(p, i) ⊆ F (p, i) holds for a small non-leech (p, i), but does not necessarily hold for a small leech. The definition of a leech (and non-leech) is given in Section 3.1.3. 9 appointed to a large node (p, i) (which happens at the beginning of each new term), we look for a dirty node (q, i) whose surrogates' term has not finished yet, which is a 24-friend of (p, i), i.e., δ(p, q) ≤ 24 · 5i. If no such node is found, we appoint k + 1 new surrogates to (p, i) as described above. Otherwise, we re-use the surrogates of an arbitrary such 24-friend (q, i) of (p, i) as the surrogates of (p, i), i.e., we assign S(p, i) = S(q, i). Observe that (q, i) is dirty and thus also complete; hence this assignment turns (p, i) too into a dirty and thus complete node. We say that (q, i) is a leech and (p, i) is its host. As mentioned, it is advantageous for a node to have (at least) k + 1 surrogates, or in other words, to be complete. We use the leech-host idea described above to turn clean (and possibly incomplete) nodes into dirty (and necessarily complete) ones. Specifically, recall that a clean node (p, i) re-uses all the surrogates of its children by appointing them as its surrogates. Before this is done, we look for a potential host for (p, i), i.e., a dirty non-leech 24-friend (q, i) of (p, i). If no such node is found, we assign S(p, i) = D(p, i) as before. Otherwise, we re-use the surrogates of (q, i) as the surrogates of (p, i), i.e., we assign S(p, i) = S(q, i), which turns (p, i) into a dirty and complete node. A node may be the host of many leeches, whereas a leech has only one host. Moreover, a node cannot be both a leech and a host, and it may be neither of them. Being a leech is an inherited trait: If (p, i) is a leech of (q, i), then (p, i)'s parent is close enough (i.e., a 24-friend) to become a leech of (q, i)'s parent (this is irrelevant if the term of the host's surrogates is over). However, in case (p, i) has a dirty non-leech sibling whose surrogates' term is not over, we will prevent (p, i)'s parent from becoming a leech. In this case (p, i)'s parent will re-use the surrogates of such a dirty non-leech sibling of (p, i), and will become a dirty non-leech. This is the only scenario when we prevent a node from becoming a leech. A clean node is necessarily small. On the other hand, a dirty node is not necessarily large. The only exception is when the dirty node is a leech. Indeed, a leech may be both small and dirty. On the other hand, we will show that a non-leech dirty node must be large (see Lemma 3.14). We will also show that for a clean node (p, i), we have D(p, i) = S(p, i) ⊆ F (p, i). For a dirty node, this equation does not hold. We remark that a clean node may be complete or incomplete, and it may contain up to 2k + 1 surrogates. On the other hand, a dirty node must be complete, and it contains exactly k + 1 surrogates. There is an interesting interplay between leeches and hosts. On the negative side, a leech exploits the host by using its surrogates and overloading their degree due to cross edges that are incident on that leech. However, each host will have at most O(1)O(d) leeches at each level, and so the surrogates' degrees due to leeches will be greater than the surrogates' degrees due to the host by a small factor. On the bright side, there are important advantages of exploiting the host. First, this allows us to "ignore" some cross edges of the basic spanner construction (and reduce the surrogates' degrees), specifically, those between leeches and their host as well as between all leeches of the same host; indeed, such cross edges connect nodes with the same surrogate set, and are thus redundant. Second, since leeches do not appoint new surrogates, the clean friends in F (y) of the corresponding host y will remain clean until the term of its surrogates S(y) is over. Consequently, this approach enables y and its non-leech ancestors to accumulate more and more clean points in their friend sets. Whenever a new term starts, new host and leeches are determined. At this stage we will have enough clean points in F (y) to appoint as surrogates of the new host y. Finally, we remark that an ancestor of a leech (respectively, host) can become a host (resp., leech). To summarize, there is a symbiosis between leeches and hosts, from which everyone enjoy. 3.1.4 Putting it All Together. Recall that once the surrogate sets S(x) of all nodes x in T are computed, the FT spanner H is obtained by replacing each edge of the basic spanner H with a bipartite clique. We remark that redundant edges that connect nodes with the same surrogate set are disregarded. We next show how to compute the surrogate sets of nodes, by putting all the ingredients that were described in Sections 3.1.1-3.1.3 together. The surrogate sets and the auxiliary sets (the descendant, friend and reserve sets) are computed bottom-up. That is, we first compute these sets for the 0-level nodes (i.e, the leaves of T ), then for the 1-level nodes, and so forth. More specifically, we employ Procedure ComputeSets(i) to compute these sets for the i-level nodes, for i = 0, . . . , ℓ. Procedure ComputeSets(i) has two parts. The first part of this procedure computes the descendant, friend and reserve sets of the i-level nodes. (We omit the computation of the descendant sets of the i-level nodes in the first part of 10 Procedure ComputeSets(i), i ∈ [0, ℓ], as it can be done in a straightforward manner.) Equipped with these sets, the second part of Procedure ComputeSets(i) computes the surrogate sets of the i-level nodes. There is a difference between Procedure ComputeSets(0) (which corresponds to the case i = 0) and Prcoedure ComputeSets(i), for i ≥ 1. We start with describing Procedure ComputeSets(0). The first part of Procedure ComputeSets(0) goes over the 0-level (leaf) nodes in an arbitrary order. Consider an arbitrary leaf node (p, 0). We first put p in both the reserve set R(p, 0) and the friend set F (p, 0) of (p, 0). Next, for every cross edge ((p, 0), (q, 0)) that is incident on (p, 0) in the basic spanner H (including redundant edges), we put q in the reserve set R(p, 0) of (p, 0). Note that q is a γ-friend of (p, 0). If q is also a 10-friend of (p, 0), we add it to the friend set F (p, 0) of (p, 0); we stop once F (p, 0) = 3k + 3. Having computed the friend and reserve sets F (p, 0) and R(p, 0) for all leaf nodes (p, 0), the second part of Procedure ComputeSets(0) starts. As opposed to the first part of the procedure, here it is important to handle nodes (p, 0) with F (p, 0) ≥ 2k + 2 (if any) first, and only later handle the rest of the nodes. (See the first remark below to understand why this order is important.) Consider a leaf node (p, 0). We first look for a potential host for (p, 0), i.e., a dirty non-leech 24-friend (q, 0) of (p, 0). • If such a node (q, 0) is found, then we assign S(p, 0) = S(q, 0), and (p, 0) will be a leech of (q, 0), and thus dirty and complete. • Otherwise we check whether F (p, 0) < 2k + 2. -- If so, (p, 0) will be small and clean, and we assign S(p, 0) = D(p, 0) = {p}. (Notice that S(p, 0) ⊆ F (p, 0), and so F (p, 0) ∪ S(p, 0) < 2k + 2, and (p, 0) is small by definition.) -- In the complementary case (i.e., F (p, 0) ≥ 2k + 2) (p, 0) will be large; in this case we appoint k + 1 points from F (p, 0) as new surrogates of (p, 0) for a term of Ω(τ ) levels (see the second remark below), and these points become dirty. Also, (p, 0) itself will be dirty and complete. We remind that at the outset all points are marked as clean. A point p becomes dirty when it is appointed as a new surrogate of a large node; p will not be re-appointed as a new surrogate again. We say that a node is clean (respectively, dirty) if all its surrogates are clean (resp., dirty). Next, we describe Procedure ComputeSets(i), for i ≥ 1, which computes the surrogate set S(p, i), the descendant set D(p, i), the friend set F (p, i) and the reserve set R(p, i), for all i-level nodes (p, i). We invoke Procedure ComputeSets(i) only after all Procedures ComputeSets(0), . . . , ComputeSets(i−1) have terminated. At this stage, the surrogate set S(q, j), the descendant set D(q, j), the friend set F (q, j) and the reserve set R(q, j) have been computed, for all nodes (q, j) at levels j ∈ [0, i − 1]. The first part of Procedure ComputeSets(i) goes over the i-level nodes in an arbitrary order. Consider an arbitrary i-level node (p, i). We first put in R(p, i) (respectively, F (p, i)) all clean points of R(q, i − 1) (resp., F (q, i − 1)), for every child (q, i − 1) of (p, i). In addition, all (clean) points of R(p, i) that are 10-friends of (p, i) but do not belong to F (p, i) are added to F (p, i); we stop once F (p, i) = 3k + 3. This concludes the computation of F (p, i), but the computation of R(p, i) is not over yet. We pause the computation of R(p, i) for now, and proceed to computing the friend sets F (x) of all i-level nodes in this way. Having computed the friend sets of all i-level nodes, we return to completing the computation of R(p, i). For every cross edge ((p, i), (q, i)) that is incident on (p, i) in the basic spanner H (including redundant edges), we add to the reserve set R(p, i) of (p, i) all (clean) points from the friend set F (q, i) of (q, i) as well as all (clean) 10-friends of (q, i) from the reserve set R(q, i) of (q, i), disregarding points that were already in R(p, i). This concludes the computation of R(p, i). Observe that any 10-friend of a child (q, i − 1) of (p, i) is also a 10-friend of (p, i) (see Claim 3.1 in Section 3.2.1). Hence, by construction, all points of F (p, i) are 10-friends of (p, i). Similarly, any (γ + 10)-friend of a child (q, i − 1) of (p, i) is also a (γ + 10)-friend (in fact, a γ-friend) of (p, i). Also, recall that the weight of i-level cross edges in the basic spanner H is at most γ · 5i. Hence, by construction, all points of R(p, i) are (γ + 10)-friends of (p, i). Having computed the friend and reserve sets F (p, i) and R(p, i) for all i-level nodes (p, i), the second part of Procedure ComputeSets(i) starts. As opposed to the first part of the procedure, here it is 11 important to handle nodes (p, i) with F (p, i) ≥ 2k + 2 first, and only later handle the rest of the nodes (see the first remark below). Consider a node (p, i). The execution of the procedure splits into two cases. Case 1: All children of (p, i) are clean. We first look for a potential host for (p, i), i.e., a dirty non-leech 24-friend (q, i) of (p, i). • If such a node (q, i) is found, then we assign S(p, i) = S(q, i), and (p, i) will be a leech of (q, i), and thus dirty and complete. • Otherwise we check whether F (p, i) < 2k + 2. -- If so, (p, i) will be small and clean, and we assign S(p, i) = D(p, i). (We will show in Corollary 3.8 that S(p, i) ⊆ F (p, i), and so F (p, i) ∪ S(p, i) < 2k + 2, and (p, i) is small by definition.) -- In the complementary case (i.e., F (p, i) ≥ 2k + 2) (p, i) will be large; in this case we appoint k + 1 points from F (p, i) as new surrogates of (p, i) for a term of Ω(τ ) levels (see the second remark below), and these points become dirty. Also, (p, i) itself will be dirty and complete. Case 2: At least one child of (p, i) is dirty. We first look for the dirty non-leech child (q, i − 1) of (p, i) (if any) whose surrogates' term started most recently. (In fact, our analysis shows that any dirty non-leech child of (p, i) whose surrogates' term is not over at level i − 1 will do. However, it is more instructive and natural to choose the one whose surrogates' term started most recently.) • If such a child (q, i − 1) is found and the term of its surrogates is not over at level i − 1, we assign S(p, i) = S(q, i − 1). In this case (p, i) becomes a dirty and complete non-leech. • Otherwise, the term of the surrogates of each dirty non-leech child of (q, i − 1) (if any) will be over at level i − 1. In this case we proceed similarly to case 1. Specifically, we first look for a potential host (q, i) for (p, i), i.e., a dirty non-leech 24-friend (q, i) of (p, i). -- If such a node (q, i) is found, then we assign S(p, i) = S(q, i), and (p, i) will be a leech of (q, i), and thus dirty and complete. -- Otherwise, we appoint k + 1 points from F (p, i) as new surrogates of (p, i) for a term of Ω(τ ) levels (see the second remark below), and these points become dirty. Also, (p, i) itself will be dirty and complete. Unlike case 1 where we may have F (p, i) < 2k + 2 and (p, i) will be clean, in this case it must hold that F (p, i) ≥ 2k + 2, implying that (p, i) is large, and thus dirty and complete. To this end, we will show (see Corollary 3.15) that whenever the need to appoint new surrogates for an ancestor (p, i) of a dirty node arises, we have F (p, i) ≥ 2k + 2. Remarks: 1. The second part of Procedure ComputeSets(i) (for any i, including i = 0) handles nodes (p, i) with F (p, i) ≥ 2k + 2 (if any) first, and only later handles the rest of the nodes. The reason we handle nodes in this order is that when looking for a potential host (q, i) for (p, i), we are in fact looking for a dirty non-leech 24-friend of (p, i). However, we do not want (q, i) to become dirty after handling (p, i), assuming (p, i) is clean, thus missing a potential host for (p, i). Handling nodes in this order guarantees that all the 24-friends of a dirty non-leech node must be dirty as well. 2. We mentioned that new surrogates of large nodes are appointed for a term of Ω(τ ) levels. The term of surrogates consists of two phases. The first phase starts with their appointment, and ends when their degree due to non-redundant cross edges (i.e., disregarding cross edges that connect nodes with the same surrogate set) since their appointment reaches k + 1. Notice that the degree of a surrogate before its appointment at a large node may be positive, but we only consider its degree since this appointment. Moreover, observe that the degree of a surrogate may also increase due to cross edges that are NOT incident on the relevant host but rather on the leeches of this host. 12 The first phase may end within a single level, but may also last for many levels. When the second phase starts, the degree of surrogates (since their appointment) is between k + 1 and k + ξ2(2k + 1). The second phase lasts precisely τ + 2 levels. Thus any term seems to last at least τ + 3 levels. However, this is true only if these surrogates are re-used over and over, which need not be the case in general. Recall that the computation of S(p, i) in Case 2 above started by looking for the dirty non-leech child (q, i − 1) of (p, i) whose surrogates' term started most recently, and setting S(p, i) = S(q, i − 1) if such a child is found. Consider another non-leech child (r, i − 1) of (p, i). Setting S(p, i) = S(q, i − 1) forces the term of points in S(r, i − 1) to be over at level i − 1. (We will show in Claim 3.10 that the surrogate sets of dirty non-leech nodes at the same level are pairwise disjoint, and so S(q, i − 1) ∩ S(r, i − 1) = ∅.) But this is fine, because the surrogates of S(p, i) = S(q, i − 1) that (p, i) chose to re-use are already sufficient for our needs, and so we can safely disregard the surrogates of all other dirty non-leech children of (p, i). In particular, this approach guarantees that once a large i-level node x appoints to itself k + 1 new surrogates, no ancestor of x at level at most i + τ + 2 will appoint to itself new surrogates. 3.2 Degree Analysis In this section we analyze the degree of the spanner construction H described in Section 3.1. 3.2.1 Getting Started. We start with some basic definitions and claims. For a node x = (p, i), recall that p(x) denotes the corresponding net-point p. The distance between two nodes x and y is defined as the distance between their net-points p(x) and p(y), i.e., δ(x, y) = δ(p(x), p(y)). The distance between a node x and a point p can be defined similarly, i.e., δ(x, p) = δ(p(x), p). Recall that an i-level node x is called a t-friend of another i-level node y (respectively, of a point p) if δ(x, y) ≤ t·5i (resp., δ(x, p) ≤ t·5i). For a point p and any i ∈ [0, ℓ], the (i-level) base bag of p is the unique i-level node x such that p ∈ D(x). Claim 3.1 (Once a Friend, Always a Friend) (1) If a point p is a 35-friend (let alone a 10-friend) of an i-level node x, then it is also a 10-friend of every ancestor of x. (2) If a point p is a (γ + 68)-friend (let alone a γ-friend) of x, then it is also a γ-friend of every ancestor of x. Proof: Suppose first that p is a 35-friend of x. To prove the first assertion, it suffices to show that p is a 10-friend of the parent π(x) of x. Indeed, we have δ(π(x), p) ≤ δ(π(x), x) + δ(x, p) ≤ 3 · 5i+1 + 35 · 5i = 10 · 5i+1. To prove the second assertion, suppose that p is a (γ + 68)-friend of x. Assuming γ ≥ 21, we have δ(π(x), p) ≤ δ(π(x), x) + δ(x, p) ≤ 3 · 5i+1 + (γ + 68) · 5i < γ · 5i+1. Claim 3.2 (Being a Leech is an Inherited Trait) If an i-level node y is a leech of some i-level node x, then y's parent π(y) is a 24-friend of x's parent π(x), and is thus close enough to become its leech. Proof: If y is a leech of x, then the net-point p(y) of y is a 24-friend of x. The first assertion of Claim 3.1 implies that p(y) is a 10-friend of π(x), i.e., δ(p(y), π(x)) ≤ 10 · 5i+1. Since δ(π(y), y) = δ(π(y), p(y)) ≤ 3 · 5i+1, it follows that δ(π(y), π(x)) ≤ δ(π(y), p(y)) + δ(p(y), π(x)) ≤ 3 · 5i+1 + 10 · 5i+1 < 24 · 5i+1. Claim 3.3 (Distant Friends Soon Become Close Friends) (1) For any i-level cross edge (x, y) of the basic spanner H and any p ∈ S(x), q ∈ S(y), δ(p, q) ≤ (γ + 68)5i. In other words, for any i-level cross edge (p, q) in the FT spanner H, δ(p, q) ≤ (γ + 68)5i. (2) Let p be a 10-friend of some i-level node x. Any point q for which δ(p, q) ≤ (γ + 68)5i is a 10-friend of the (i + τ )-level ancestor of x. 13 Proof: The weight of an i-level cross edge (x, y) in H is at most γ5i. For any p ∈ S(x), we have δ(x, p) ≤ 34 · 5i; refer to Observation 3.9 and the paragraph preceding it to see why this upper bound holds. Similarly, we have δ(y, q) ≤ 34 · 5i. Consequently, δ(p, q) ≤ δ(p, x) + δ(x, y) + δ(y, q) ≤ (γ + 68)5i. Next, we prove the second assertion. Let x′ be the (i + τ )-level ancestor of x, and notice that δ(x′, x) ≤ 4·5i+τ . We have δ(x′, q) ≤ δ(x′, x)+δ(x, p)+δ(p, q) ≤ 4·5i+τ +10·5i +(γ +68)5i ≤ 10·5i+τ , where the last inequality holds for γ ≥ 3. It follows that q is a 10-friend of x′, and we are done. By construction, a node with at least one dirty child must be dirty too. (See Case 2 in Procedure ComputeSets(i), i ≥ 1.) This means that all ancestors of a dirty node are dirty, or equivalently, all descendants of a clean node are clean. Notice also that the construction guarantees that any dirty node must be complete. More specifically, a dirty node has exactly k + 1 surrogates. We summarize these observations in the following statement. Observation 3.4 (Once Dirty, Always Dirty and Complete) All ancestors of a dirty node (in- cluding itself ) are dirty. Also, each dirty node has exactly k + 1 surrogates, and is thus complete. Remark: Note that any large node is dirty. Even though the converse statement holds for non-leech nodes (see Lemma 3.14 in Section 3.2.2), it does not necessarily hold for leeches. Nevertheless, it can be proved that all ancestors of a (possibly leech) dirty node are in fact large. (This assertion is stronger than Observation 3.4 and requires proof; we do not provide the proof of this assertion since we do not use it in the sequel.) The following observation is implied by Observation 3.4 and the construction. Observation 3.5 (The Descendants of Clean Nodes are Surrogates) For any clean node x, we have S(x) = D(x). Since any descendant x′ of x is clean, it follows that S(x′) ⊆ S(x). Remark: Let p be an arbitrary point, and let i ∈ [0, ℓ]. Observation 3.5 shows that the only clean i-level node x (if any) of which p is a surrogate (i.e., p ∈ S(x)) is the i-level base bag of p. Consequently, if the i-level base bag of p is dirty, then p will not be a surrogate of j-level clean nodes, for any j ≥ i. The next lemma shows that all descendants (and thus all surrogates) of a clean node must be clean. Claim 3.6 (All Descendant Points of Clean Nodes are Clean) For a clean j-level node x, all points of D(x) are clean at level j. In other words, if a point p is dirty at level j, then the j-level base bag of p is dirty too. Proof: Suppose for contradiction that there is a point p ∈ D(x) that is dirty at level j, and let z be the appointing node which made p dirty. Observe that z is a dirty non-leech i-level node, such that p ∈ S(z) and i ≤ j. Let x be the i-level base bag of p, i.e., p ∈ D(x). Note that x is the j-level base bag of p, and so x is a descendant of x. By Observation 3.4, x must be clean. Hence x 6= z. Note also that p is a 4-friend of x and a 10-friend of z. It follows that x is a 14-friend of z, and would become its leech and thus dirty, yielding a contradiction. We have shown in Claim 3.6 that all surrogates of a clean node are clean. Also, all surrogates of a dirty node are dirty by the construction. We summarize this property in the following statement. Corollary 3.7 All surrogates of a clean (respectively, dirty) node are clean (resp., dirty). The following corollary follows from Observation 3.5, Claim 3.6 and the construction. Corollary 3.8 For a clean node x, we have S(x) = D(x) ⊆ F (x), and so S(x) = D(x) ≤ F (x) = F (x) ∪ S(x) < 2k + 2. Observation 3.5 implies that all surrogates of a clean node are 4-friends of this node. The surrogates of a dirty non-leech node are 10-friends of it, but the surrogates of a (dirty) leech are not necessarily 10- friends of it. Since a leech is a 24-friend of its host, it follows that the surrogates of a leech are 34-friends of it. We summarize these observations in the following statement. 14 Observation 3.9 All surrogates of either a clean or dirty node are 34-friends of it. Recall that our construction makes a persistent effort to re-use old surrogates. In particular, if an i-level node x has a dirty non-leech child y, such that the term of the k + 1 surrogates of S(y) is not over at level i − 1, then we set S(x) = S(y). (If x has other such children, then it may choose to use surrogates from another child.) In this case x will be a dirty non-leech node as well, and we say that x and y are copies. Note that y itself may be a copy of one of its dirty non-leech children, and so forth. In general, there is a path of dirty non-leech copies in the tree which leads from a dirty non-leech node x down to its appointing copy a(x), which is a dirty large node which appoints k + 1 new surrogates. By construction, all these non-leech copies are dirty and complete; in fact, we will show in Claim 3.13 that they are large. Recall that surrogates of large nodes are appointed for a term of at least τ + 3 levels. This does not mean that a specific surrogate will necessarily be re-used for Ω(τ ) levels due to an abundance of surrogates; see the second remark at the end of Section 3.1.4. This only means that no j-level ancestor of an i-level appointing node, for any j ≤ i + τ + 2, will appoint to itself new surrogates. We define term(x) as the term between the level of the appointing copy a(x) of x and the highest level of any copy of x (which is either x or an ancestor of x). By construction, term(x) lasts at least τ + 3 levels. The "disjointness" properties of Claims 3.10 and 3.11 will be heavily used in the sequel. Claim 3.10 (Surrogates and Old Friends are Disjoint) For any pair x, y of (distinct) dirty non- leeches at the same level, S(x)∩S(y) = F (a(x))∩F (a(y)) = ∅. More generally, let F ∗(a(x)) and F ∗(a(y)) denote the set of all 10-friends of a(x) and a(y), respectively. Then F ∗(a(x)) ∩ F ∗(a(y)) = ∅. Proof: Write a(x) = (p, i) and a(y) = (q, j), and suppose without loss of generality that the appointment of S(a(x)) = S(x) takes place before the appointment of S(a(y)) = S(y). It must hold that i ≤ j. Let x′ be the j-level copy of x, with S(x′) = S(x). By construction, x′ is a dirty non-leech. Suppose for contradiction that there is a point s in F ∗(a(x)) ∩ F ∗(a(y)). Hence s is a 10-friend of both a(x) and a(y). By Claim 3.1, s is also a 10-friend of x′, and so x′ and a(y) are 20-friends. It follows that a(y) would become a leech of x′, and would not be an appointing node, a contradiction. Claim 3.11 (Dirty Surrogate Sets are Either Equal or Disjoint) Let x be a dirty i-level node. For each level j ∈ [i, ℓ] and any j-level node y, either S(x) = S(y) or S(x) ∩ S(y) = ∅ must hold. In the former case S(x) = S(y), y must be dirty. Proof: Let y be an arbitrary j-level node. If S(x) ∩ S(y) = ∅, then we are done. We henceforth assume that S(x) ∩ S(y) 6= ∅. We will show that S(x) = S(y), and that y is dirty. Define v as x if it is a non-leech, and as the host of x otherwise. We have S(x) = S(v). We argue that term(v) cannot be over until level j − 1. Indeed, otherwise no point of S(x) will be a surrogate of any j-level node, including y. It follows that S(x) ∩ S(y) = ∅, a contradiction. We henceforth assume that term(v) is not over before level j. Consider the j-level copy v′ of v, where S(v′) = S(v) = S(x). Observe that v′ is a dirty non-leech. Note also that S(v′) ∩ S(y) 6= ∅, and let p be a point in S(v′) ∩ S(y). Since v′ is dirty, p must be dirty too. Claim 3.6 implies that y is dirty as well. If y = v′, then S(x) = S(y) must hold, and we are done. We henceforth assume that y 6= v′. In this case y must be a leech of v′. Indeed, otherwise we have S(v′) ∩ S(y) = ∅ by Claim 3.10, which is a contradiction. Since y is a leech of v′, we have S(y) = S(v′) = S(x). The corollary follows. Claim 3.12 (Clean 10-Friends of Non-Leeches Remain Clean) Let x be a dirty non-leech i-level node. Then all points in F (x) \ S(x) remain clean during the entire term(x). More generally, all the 10-friends of x that are clean at the beginning of level i will remain clean during the entire term(x), except for the surrogates S(x) of x which get dirty in the case when x = a(x) is an appointing node. Proof: Let p be an arbitrary 10-friend of x that is clean at the beginning of level i. Suppose for contradiction that p became dirty at level i, and p 6∈ S(x). This means that some other i-level appointing 15 node y, y 6= x, appointed p as one of its k + 1 new surrogates at level i. Since p is a 10-friend of both x and y, it follows that x and y are 20-friends. If x is either a non-appointing node (i.e., x 6= a(x)) or it is an appointing node which appoints its surrogates before y does, then y would become x's leech, and would not become an appointing node, a contradiction. Otherwise, x is a an appointing node which appoints its surrogates after y does, but then x would become y's leech, yielding the same contradiction. We have shown that all 10-friends of x (except for those in S(x)) that are clean at the beginning of level i will remain clean at the end of level i, and so they will be clean at the beginning of level i + 1. By Claim 3.3, all these points are 10-friends of π(x), which is also a non-leech. Thus we can apply the same argument for level i + 1, and carry on in this way also for subsequent levels. Consequently, we get that all 10-friends of x that are clean at the beginning of level i will remain clean during the entire term(x), except for the surrogates S(x) of x which get dirty in the case x = a(x). Claim 3.13 (If the Appointing Copy is Large, All Other Copies are Large Too) Let x be a dirty non-leech i-level node. Then there is a path of dirty non-leech copies of x in the tree which leads down from x to its appointing copy a(x). Also, all points of F (a(x)) \ S(x) belong to F (x), unless F (x) = 3k + 3. In particular, if a(x) is large, then x will be large too. Proof: First, the fact that there is a path of dirty non-leech copies of x in the tree which leads down from x to its appointing copy a(x) follows easily from the construction. By Claim 3.12, all 10-friends of a(x) that are clean after the appointment of S(x) = S(a(x)) (in particular, all points in F (a(x)) \ S(a(x))) remain clean during the entire term(x). Hence they will be clean at level i. By construction, all the points in F (a(x))\S(x) will belong to F (x), unless F (x) = 3k+3. If a(x) is large, then we have F (a(x)) \ S(x) ≥ k + 1. Consequently, all the at least k + 1 points in F (a(x)) \ S(x) will belong to F (x), unless F (x) = 3k + 3. It follows that F (x) ∪ S(x) ≥ 2k + 2, and so x is large. 3.2.2 A Key Lemma and Its Corollary. The following lemma is central in our analysis. In particular, it shows that whenever the need to appoint new surrogates for some node x arises, we have F (x) ≥ 2k + 2. (See Corollary 3.15.) Thus Procedure ComputeSets(i) from Section 3.1.4 is well-defined. Lemma 3.14 (All Non-Leeches are Large) Let x be a dirty non-leech i-level node. Then: (a) The appointing copy a(x) of x is large, thus x is large too by Claim 3.13. (It is possible that x = a(x).) (b) If i is the last level of term(x), then F (x) ≥ 2k + 2. (Note that F (x) = F (x) \ S(x) in this case.) Moreover, if F (x) < 3k + 3, then at least k + 1 points from F (x) do not belong to F (a(x)). Proof: The proof of the two assertions of the lemma is by induction on i. A dirty node that has only clean children is called atomically-dirty; otherwise it is compound-dirty. For the basis of the induction we may consider nodes whose appointing copy is atomically-dirty. Such nodes must be large by the construction. (An atomically-dirty non-leech y may get dirty only if F (y) ≥ 2k + 2, in which case y is large by definition.) The first assertion follows immediately. To prove the second assertion we use an argument that works for both the basis of the induction and the induction step. We omit this argument here for conciseness, but provide it in the induction step. Induction Step: Assume that the lemma holds for all smaller values of i, i ≥ 1, and prove it for i. We start with the first assertion. We have shown that the case when a(x) is atomically-dirty is trivial. We henceforth assume that a(x) is compound-dirty. By definition, a(x) has at least one dirty child. Let ia be the level of a(x), with ia ≤ i. Next, we argue that every dirty child of a(x) is either a non-leech whose term is over at level ia − 1, or a leech of some host whose term is over at level ia − 1. Indeed, if a(x) had a dirty non-leech child y whose term is not over at level ia − 1, then Procedure ComputeSets(ia) would assign S(a(x)) = S(y), and a(x) would not be an appointing copy, a contradiction. Similarly, if a(x) had a dirty child which is a leech of some host y whose term is not over at level ia − 1, then y's parent 16 would be a non-leech by the construction. However, it is easy to see that a(x) would be close enough to y's parent to become its leech by Claim 3.2, and would not be an appointing copy, a contradiction. Consider such a node y of level ia − 1 < i, which is either a dirty non-leech child of a(x) or a (dirty) host of a leech child of a(x). We have shown that ia − 1 must be the last level of term(y). By the induction hypothesis for y, F (y) ≥ 2k + 2. By construction, all points of F (y) are clean at the beginning of level ia − 1. By Claim 3.12, all points of F (y) will remain clean at level ia − 1, and thus will be clean at the beginning of level ia. If y is a child of a(x), then for any point s of F (y), δ(a(x), s) ≤ δ(a(x), y) + δ(y, s) ≤ 3 · 5ia + 10 · 5ia−1 ≤ 5 · 5ia . Otherwise, y is a host of a child c of a(x), in which case we have δ(a(x), s) ≤ δ(a(x), c) + δ(c, y) + δ(y, s) ≤ 3 · 5ia + 24 · 5ia−1 + 10 · 5ia−1 ≤ 10 · 5ia. In both cases a(x) has at least 2k + 2 clean 10-friends at the beginning of level ia, namely, the points of F (y). By construction, all these points will belong to F (a(x)), unless F (a(x)) = 3k + 3. In either case we have F (a(x)) ≥ 2k + 2, implying that a(x) is large. The first assertion follows. Next, we prove the second assertion. We henceforth assume that i is the last level of term(x). If F (x) = 3k + 3, then we are done. We henceforth assume that F (x) < 3k + 3. The first assertion implies that a(x) is large, and so there must be at least k + 1 clean 10-friends of a(x) in F (a(x)) \ S(a(x)). By Claim 3.13, all these points remain clean during the entire term(x), and they will belong to F (x). Consider the last level of the first phase in term(x), denoted l, and let q1, . . . , qk+1 be k + 1 arbitrary points (among a total of at most k + ξ2 · (2k + 1) points) which increased the degree of points in S(a(x)) = S(x) since the beginning of term(x) (due to non-redundant cross edges). For each point qj, let lj be the first level in term(x), such that the basic spanner H contains a cross edge between either the lj-level copy xj of x or one of its leeches and some lj-level node yj for which both qj ∈ S(yj) and S(yj) 6= S(x) hold; observe that lj ≤ l. (For such a non-redundant edge, our FT spanner H contains a bipartite clique between S(x) and S(yj).) By Claim 3.11, S(yj) ∩ S(x) = ∅. Moreover, we argue that qj cannot be a 10-friend of a(x), which implies that it does not belong to F (a(x)). If yj is a dirty non-leech, this assertion follows immediately from Claim 3.10. In the case that yj is a dirty leech, we can apply Claim 3.10 with the host of yj instead of yj itself, and get the same result. We henceforth assume that yj is clean. Since qj ∈ S(yj), Observation 3.5 implies that qj is a 4-friend of yj. If qj were a 10-friend of a(x), then it must also be a 10-friend of the lj-level copy xj of x. Consequently, yj would be a 14-friend of xj, and would thus become its leech and dirty, a contradiction. The second phase of term(x) starts at level l + 1, and ends at level i = l + τ + 2. Suppose first that all k + 1 points q1, . . . , qk+1 are clean at the beginning of level i − 2 = l + τ . In this case the lj-level node yj for which qj ∈ S(yj) must be clean by Corollary 3.7 and the construction, for each j ∈ [k + 1]. Moreover, by Claim 3.3, all the k + 1 points q1, . . . , qk+1 are 10-friends of the (i − 2)-level copy of x. Claim 3.1 implies that they will also be 10-friends of all the ancestors of that node. Moreover, all these points will remain clean until level i by Claim 3.12. Finally, recall that all k + 1 points q1, . . . , qk+1 are not 10-friends of a(x), and thus they do not belong F (a(x)). On the other hand, we argue that these points will belong to F (x) by the construction. Indeed, since there is a cross edge between yj and either the lj-level copy xj of x or one of its leeches, for each j ∈ [k + 1], it follows that qj will belong to the reserve set of either xj or one of its leeches. Consequently, qj will also belong to the reserve set of the (i − 2)-level copy xi−2 of x. (The latter assertion is immediate if the cross edge is between yj and xj. In the complementary case where the cross edge is between yj and some leech of xj, qj will belong to the reserve set of the (i − 2)-level ancestor of that leech, denoted wi−2. If wi−2 = xi−2, then we are done. Otherwise, there is a cross edge between wi−2 and xi−2. Claim 3.3 implies that qj is a 10-friend of wi−2, hence our construction guarantees that qj will be added to the reserve set of xi−2.) Since qj is a 10-friend of x and F (x) < 3k + 3, it follows that qj will belong to F (x). We conclude that all points q1, . . . , qk+1 belong to F (x), which completes the proof of the second assertion in this case. We henceforth assume that some point qj became dirty until level i − 3. Recall that lj is the first level in term(x), such that H contains a non-redundant edge between either the lj-level copy xj of x or 17 j > lj) in which the l′ one of its leeches and some node yj for which both qj ∈ S(yj) and S(yj) ∩ S(x) = ∅ hold. Let l′ j be the first level after lj (i.e., l′ j of yj are 24-friends. We argue that l′ j ≤ i − 2. Indeed, as mentioned above, Claim 3.3 implies that qj is a 10-friend of the (i − 2)-level copy of x. Also, by Observation 3.9, the fact that qj is in S(yj) implies that it is a 34-friend of yj. By Claim 3.1, qj is a 10-friend of any ancestor of yj. It follows that the (i − 2)-level copy of x and the (i − 2)-level ancestor of yj are 20-friends, and so l′ j-level ancestor y′ j of x and the l′ j-level copy x′ j ≤ i − 2. Consider now level lj = l′ j − 1, where lj ≤ lj ≤ i − 3, and let xj and yj be the lj-level ancestors of xj and yj, respectively. We argue that S(yj) ∩ S(x) = ∅. Indeed, this assertion clearly holds if lj = lj. Consider the complementary case lj > lj, and suppose for contradiction that S(yj) ∩ S(x) 6= ∅. Since S(x) = S(xj), Claim 3.11 implies that S(yj) = S(xj) must hold. However, in this case yj must be a leech of xj and thus a 24-friend of it, which stands in contradiction to the above definitions. The analysis splits into two main cases. j , y′ j = lj + 1 (not before and Case 1: yj is a clean node. We argue that qj must become dirty at level l′ not after). To see this, first note that qj cannot become dirty at any level between lj and lj. Indeed, otherwise the appointing node that made qj dirty would be a 20-friend of the corresponding ancestor of yj, which would become its leech and thus dirty. However, then yj would be dirty too by Observation 3.4, a contradiction. On the other hand, if qj does not get dirty at level l′ j or before, then it must get dirty afterwards (because it gets dirty until level i − 3). Suppose for contradiction that some node z at level h appoints qj as one of its k + 1 new surrogates, where l′ j + 1 ≤ h ≤ i − 3. This means that δ(z, qj ) ≤ 10 · 5h. j is a 24-friend of x′ Recall that qj is a 10-friend of any ancestor of yj, and in particular of y′ j, j +1 ≤ 7 · 5h. (The last inequality and so δ(x′ holds since h ≥ l′ j , qj) ≤ 4 · 5h + 7 · 5h = 11 · 5h. Consequently, δ(xh, z) ≤ δ(xh, qj) + δ(qj , z) ≤ 11 · 5h + 10 · 5h ≤ 21 · 5h. Thus xh and z are 21-friends, and so z would have to become a leech of xh, and would not be an appointing node, a contradiction. It follows that qj becomes dirty at level l′ j + 1.) Let xh be the h-level copy of x. Observe that δ(xh, qj) ≤ δ(xh, x′ j = lj + 1, as was argued above. j , qj) ≤ 24 · 5l′ j , qj) ≤ δ(x′ j. Also, y′ j < 7 · 5l′ j + 10 · 5l′ j) + δ(x′ j) + δ(y′ Denote by u the l′ j is a 24-friend of x′ j and a 10-friend of qj, and so x′ j and u are 44-friends. Hence there is a cross edge between x′ j-level appointing node that appoints qj as one of its k + 1 new surrogates at level l′ j. By construction, u is a dirty non-leech. By the induction hypothesis, u must be large. Thus there are at least k + 1 clean 10-friends of u in F (u) \ S(u). Claim 3.10 implies that F (u) ∩ F (a(x)) = ∅. By Claim 3.13, all the at least k + 1 points in F (u) \ S(u) remain clean during the entire term(u). Moreover, recall that y′ j and qj are 34-friends. Since u is a 10-friend of qj, we get that x′ j and u (assuming γ > 44). Since u is dirty, it follows that the second phase of term(x) will start at level l′ j + 1 (or before), which implies that term(u) will last at least until the last level i of term(x). In particular, all the at least k + 1 points in F (u)\ S(u) will remain clean until level i. Since x′ j and u are 44-friends, all points of F (u)\ S(u) are 54-friends of x′ j + 2)-level copy of x, and let alone of x itself. By construction, since there is a cross edge between x′ j and u (and as F (x) < 3k + 3), all points of F (u) \ S(u) will belong to F (x). Hence, at least k + 1 points from F (x) do not belong to F (a(x)), and we have F (x) ≥ F (a(x)) \ S(a(x)) + F (u) \ S(u) ≥ 2k + 2, which provides the required result. Case 2: yj is a dirty node. It is possible that yj is a leech; in this case we consider the host of yj. Define uj as yj if it is a non-leech, and as the host of yj otherwise. By the induction hypothesis, uj is large, and so there are at least k + 1 clean 10-friends in F (a(uj )) \ S(uj). Moreover, all these points will also belong to F (uj) by Claim 3.13, unless F (uj) = 3k + 3. Recall that x′ j. All these points are also 10-friends of the (l′ j are 24-friends. Hence j and y′ δ(xj , yj) ≤ δ(xj , x′ j) + δ(x′ j , y′ j) + δ(y′ j , yj) ≤ 3 · 5 lj +1 + 24 · 5 lj +1 + 3 · 5 lj +1 = 30 · 5 lj +1 = 150 · 5 lj . Note also that δ(yj , uj) ≤ 24 · 5lj , and so xj and uj are 174-friends. By construction, there is a cross edge between xj and uj (assuming γ ≥ 174), and so all points of F (uj) will belong to F (x) by the construction. Since F (x) < 3k + 3, it must hold that F (uj) < 3k + 3. It follows that all the at least k + 1 points of F (a(uj))\S(uj ) belong to F (uj) (and thus also to F (x)). On the other hand, recall that S(yj)∩S(x) = ∅. 18 Since S(uj) = S(yj) and S(xj) = S(x), we have uj 6= xj. Claim 3.10 implies that F (a(x)) ∩ F (a(uj )) = ∅, and so all the at least k + 1 points in F (a(uj )) \ S(uj) belong to F (uj) but do not belong to F (a(x)). Suppose first that lj is not the last level of term(uj). In this case all the at least k + 1 points in F (a(uj)) \ S(uj) remain clean at level lj + 1 by Claim 3.13. However, it is not difficult to see that all these points are 10-friends of the (lj + 2)-level copy of x. Hence, by Claim 3.12, these points will remain clean during the entire term(x). As mentioned, all points of F (a(uj)) \ S(uj) belong to both F (uj) and F (x), but not to F (a(x)). Consequently, at least k + 1 points from F (x) do not belong to F (a(x)), and we have F (x) ≥ F (a(x)) \ S(a(x)) + F (a(uj )) \ S(uj) ≥ 2k + 2. This completes the proof in this case. In what follows we assume that lj is the last level of term(uj). Note that F (uj) = F (uj) \ S(uj). By the induction hypothesis, F (uj) ≥ 2k + 2. By Claim 3.12, all points of F (uj) remain clean at level lj. The analysis splits into two subcases. Case 2.a: F (a(x)) ∩ F (uj) = ∅. In this case some of the points in F (uj) may get dirty at level lj + 1, which occurs if they are appointed as new surrogates of some (lj + 1)-level node. We argue that no more than k + 1 of these points may get dirty at level lj + 1. Suppose for contradiction otherwise. Since any appointing node appoints exactly k + 1 points as new surrogates, this means that at least two distinct (lj + 1)-level appointing nodes v1 and v2 must appoint points from F (uj) as their new surrogates. Since all points of F (uj) are within distance 10 · 5lj = 2 · 5lj +1 from uj, it follows that they are all within distance 4 · 5lj +1 from each other. Since v1 (respectively, v2) appoints at least one point p1 (resp., p2) from F (uj) as a new surrogate, we have δ(v1, p1), δ(v2, p2) ≤ 10 · 5lj +1. Hence δ(v1, v2) ≤ δ(v1, p1) + δ(p1, p2) + δ(p2, v2) ≤ 10 · 5 lj +1 + 4 · 5 lj +1 + 10 · 5 lj +1 = 24 · 5 lj +1. Hence v1 and v2 are 24-friends, and so one would have to become a leech of the other and would not be an appointing node, a contradiction. Since F (uj) ≥ 2k + 2, it follows that at least k + 1 points from F (uj) must be clean at the beginning of level lj + 2. Moreover, it is not difficult to see that all these points are 10-friends of the (lj + 2)-level copy of x. Hence, they will remain clean during the entire term(x) by Claim 3.12, and will belong to F (x). We have proved that F (x) contains at least 2k + 2 points, at least k + 1 of which do not belong to F (a(x)), which completes the proof in this case. Case 2.b: F (a(x)) ∩ F (uj) 6= ∅. In this case uj must be a 20-friend of the lj-level copy xj of x. It is easy to see that all points of F (uj) will be 10-friends of the (lj + 1)-level copy of x, and so they will remain clean during the entire term(x) by Claim 3.12. By construction, F (x) will contain all points of F (uj). We have also shown that all the at least k + 1 points of F (a(uj)) \ S(uj) belong to F (uj). Finally, Claim 3.10 implies that F (a(x)) ∩ F (a(uj)) = ∅, and we are done. Lemma 3.14 follows. Lemma 3.14 yields the following corollary, which, in turn, implies that our construction is well-defined. Corollary 3.15 (Procedure ComputeSets(i) is Well-Defined) For any appointing node x, we have F (x) ≥ 2k + 2. Proof: By construction, the statement clearly holds for both leaf nodes and nodes for which all children are clean. We henceforth assume that x is an i-level appointing node, for i ≥ 1, with at least one dirty child y. Define z as y if it is a non-leech, or as y's host otherwise. We argue that term(z) must be over at level i − 1. Indeed, otherwise z's parent will be a dirty non-leech, and so x will not become an appointing node, a contradiction. (This follows immediately from the construction if y is a non-leech. If y is a leech and z is its host, then x would be a 24-friend of z's parent by Claim 3.2, and would become a leech of either z's parent or some other i-level dirty non-leech 24-friend of x, and not an appointing node.) We have shown that term(z) is over at level i − 1. Hence, Lemma 3.14 implies that F (z) ≥ 2k + 2. Moreover, all points of F (z) must remain clean at level i − 1 by Claim 3.12. It is easy to see that all points of F (z) are 10-friends of x. Consequently, all these points must belong to F (x) by the construction, unless F (x) = 3k + 3. The corollary follows. 19 3.2.3 Completing the Degree Analysis. In this section we prove that the degree of our FT spanner H is at most ǫ−O(d) · k. We do this in two stages. In the first stage we bound the degree of H due to cross edges, and in the second stage we show that the degree contribution due to tree edges is negligible. First Stage. Denote the degree of an arbitrary point p due to cross edges until level i by degi(p). Recall that ξ = ǫ−O(d) is an upper bound for the maximum degree of any tree node in the basic spanner H. Since the surrogates of any node are 34-friends of that node (see Observation 3.9) and the set of all i-level nodes constitutes a 5i-packing, for each i ∈ [0, ℓ], Fact 2.1 implies that any point can serve as a surrogate of at most O(1)O(d) nodes at each level. By construction, the number of surrogates in any node is at most 2k + 1, and so a bipartite clique that replaces a cross edge may increase the degree of each of the relevant surrogates by at most 2k + 1 units. It follows that the degree of any surrogate (due to cross edges) may increase by at most ξ · O(1)O(d) · (2k + 1) ≤ ξ2(2k + 1) units at each level. Recall that D = (τ + 4)ξ2(2k + 1), and that ℓ is the last level in the net-tree T (the level of the root). In what follows we show that degℓ(p) ≤ 2D, for any point p ∈ X. Lemma 3.16 For any surrogate p ∈ S(x) of a j-level clean node x, we have degj(p) ≤ D. Proof: Let p be the point in S(x) of maximum degree, i.e., for every point q ∈ S(x), degj(q) ≤ degj(p). By Observation 3.5, p ∈ D(x), implying that x is the j-level base bag of p. If degj(p) < 2k +2, then we are done. We henceforth assume that degj(p) ≥ 2k +2. Let i be the minimum level such that degi(p) ≥ 2k + 2, and let q1, . . . , q2k+2 be 2k + 2 arbitrary neighbors of p due to cross edges until level i; observe that 2k + 2 ≤ degi(p) ≤ 2k + 1 + ξ2(2k + 1). By Claim 3.3, p is within distance (γ + 68)5i from each of the 2k + 2 points q1, . . . , q2k+2. Moreover, Claim 3.3 implies that all 2k + 2 points q1, . . . , q2k+2 will be 10-friends of the (i + τ )-level base bag y of p. Write i′ = i + τ . If all these 2k + 2 points are clean at the beginning of level i′, then they would all belong to F (y) by the construction, unless F (y) = 3k + 3. (Indeed, Corollary 3.7 implies that any node yl for which ql ∈ S(yl) at level until i′ must be clean, for each l ∈ [2k + 1], and so we have ql ∈ F (yl) by Observation 3.8. Since there is a cross edge between p and ql in our FT spanner H at level at most i ≤ i′, it follows that ql will be added to the reserve set of the corresponding descendant of y, and will eventually be added to F (y), unless F (y) = 3k + 3.) In either case F (y) ≥ 2k + 2, and so y will be dirty (in fact, it will be large). By Observation 3.4, π(y) and π(π(y)) will be dirty as well. Otherwise, at least one point ql becomes dirty before level i′. Let w be the (dirty) appointing node which made ql dirty, where ql ∈ S(w), and let w′ be the i′-level ancestor of w. By Observation 3.4, w′ must be dirty. Note that ql is a 10-friend of w, and so it is also a 10-friend of w′ by Observation 3.1. Since ql is a 10-friend of both y and a w′, it follows that y and w′ are 20-friends. If w′ is a non-leech, then y will become its leech and thus dirty. By Observation 3.4, π(y) and π(π(y)) will be dirty as well. Otherwise w′ is a leech of some host z, and so w′ and z are 24-friends. There are two cases. Case 1: term(z) is not over at level i′. By construction, π(z) will be a dirty non-leech. Observe that δ(π(y), π(z)) ≤ δ(π(y), y)+δ(y, w′)+δ(w′, z)+δ(z, π(z)) ≤ 3·5i′+1+20·5i′ +24·5i′ +3·5i′+1 < 15·5i′+1. Hence π(y) is a 15-friend of π(z). In other words, π(y) is close enough to become a leech of π(z), and so it must be dirty. By Observation 3.4, π(π(y)) will be dirty too. Case 2: term(z) is over at level i′. By Lemma 3.14, we have F (z) ≥ 2k + 2. Also, all the points in F (z) = F (z) \ S(z) are clean at the beginning of level i′, and will remain clean at level i′ by Claim 3.12. For any such point s, we have δ(π(π(y)), s) ≤ δ(π(π(y)), y) + δ(y, z) + δ(z, s) ≤ 4 · 5i′+2 + 44 · 5i′ + 10 · 5i′ < 7 · 5i′+2. In other words, all points in F (z) are 7-friends of π(π(y)). If all these points are clean at the beginning of level i′ + 2, then they will belong to F (π(π(y))) by the construction, unless F (π(π(y))) = 3k + 3. (Indeed, there is a cross edge between y and z (assuming γ ≥ 44), and so all points of F (z) will be added to the reserve set of y, and will eventually be added 20 to F (π(π(y))), unless F (π(π(y))) = 3k + 3.) Hence π(π(y)) will either become a leech of some dirty (i′ + 2)-level node or it will become an appointing node. In either case π(π(y)) will be dirty. Otherwise, this means that some (i′ +1)-level appointing node v made at least one of these points s ∈ F (z) dirty at level i′ + 1. Since v is an appointing node, both v and π(v) must be dirty non-leeches by the construction. The fact that v appoints s as a new surrogate implies that v and s are 10-friends. Hence δ(π(v), s) ≤ δ(π(v), v) + δ(v, s) ≤ 3 · 5i′+2 + 10 · 5i′+1 = 5 · 5i′+2. It follows that π(v) is a dirty non-leech (i′ + 2)-level node, which is a 5-friend of s. Since s is a 7-friend of π(π(y)), we conclude that π(π(y)) is a 12-friend of π(v). In other words, π(π(y)) is close enough to become a leech of π(v), and so it must be dirty. Summarizing, we have shown that π(π(y)) is dirty. Note that π(π(y)) is the (i′ + 2)-level base bag of p and recall that x is the j-level base bag of p. Since x is clean, Observation 3.4 implies that j ≤ i′ + 1 = i + τ + 1. Recall that degi(p) ≤ 2k + 1 + ξ2(2k + 1). Also, in each of the j − i ≤ τ + 1 levels i + 1, . . . , j, the degree of p may increase by at most ξ2(2k + 1) units, and so degj(p) ≤ degi(p) + (τ + 1)ξ2(2k + 1) ≤ 2k + 1 + ξ2(2k + 1) + (τ + 1)ξ2(2k + 1) ≤ D. Let i be the first level in which p becomes dirty. (If no such i exists, we can define i = ℓ + 1.) By construction, p is appointed as a new surrogate of a large (and thus dirty) i-level appointing node x. Corollary 3.7 implies that p cannot be a surrogate of dirty nodes before level i, and so degi−1(p) ≤ D must hold by Lemma 3.16. In the degenerate case when p is not appointed as a surrogate of dirty nodes (i.e., i = ℓ + 1), we have degℓ(p) = degi−1(p) ≤ D, and we are done. We henceforth assume that i ≤ ℓ. Recall that p is appointed at level i for a term of at least τ + 3 levels, which consists of two phases. The first phase starts at level i, and ends when the degree of p due to (non-redundant) cross edges since its appointment at level i reaches k + 1. When the second phase starts, the degree of p is between k + 1 and k + ξ2(2k + 1). The second phase lasts τ + 2 levels. In each of these levels p may incur ξ2(2k + 1) additional units to its degree. Consequently, when the term of p is over, the degree of p due to cross edges since its appointment is bounded above by k + ξ2(2k + 1) + (τ + 2)ξ2(2k + 1) ≤ D. (In fact, it is possible that p does not finish its term due to abundance of surrogates; see the second remark at the end of Section 3.1.4. Thus we can refer to term(x) instead of the term of p.) When p was appointed as a new surrogate of the large i-level node x (at level i), it was marked as dirty. Therefore, by construction, p will not be re-appointed again as a surrogate (of either clean nodes or dirty ones) after term(x) is over. Summarizing, the degree of p may increase by at most D units while it is a surrogate of clean nodes, and by at most D additional units while it is a surrogate of dirty nodes. It follows that degℓ(p) ≤ 2D. Second Stage. Consider a tree edge (x, π(x)) between a node x = (p, j − 1) and its parent π(x) = (q, j) in the tree. This edge is translated into a bipartite clique Cx between S(x) and S(π(x)) in our FT spanner H. If S(x) = S(π(x)), then this edge is redundant and we do not replace it by a bipartite clique. Next, we argue that the degree of a point p in H due to tree edges is small. To this end we analyze the degree of p over all cliques Cx that correspond to tree edges (x, π(x)). We say that Cx is a j-level clique if π(x) is a j-level node (that is, the level of the clique Cx is determined by the level of π(x)). Let i be the first level in which p becomes dirty. If p does not become dirty, then we define i = ℓ + 1. By Corollary 3.7, p may only be a surrogate of clean nodes in levels 0, . . . , i − 1, whereas it may only be a surrogate of dirty nodes in levels i, . . . , ℓ. Note that the j-level base bag of p, for j < i, is not necessarily clean. Let l be the first level in which the l-level base bag of p is dirty, and assuming l ≥ 1, let z denote the (l − 1)-level base bag of p. Notice that all ancestors of z are base bags of p, and they are dirty by Observation 3.4. Since z is clean, Observation 3.4 implies that all the descendants of z are clean too. Claim 3.6 implies that l ≤ i. Moreover, p cannot be a surrogate of any j-level node, for all j ∈ [l, i − 1]. We first analyze the degree of p over all cliques until level l − 1, i.e., over j-level cliques Cx that correspond to tree edges (x, π(x)), where π(x) is a j-level node and j ≤ l − 1, and p belongs to either S(x) 21 or S(π(x)). Observation 3.5 implies that π(x) is the j-level base bag of p. Consequently, both x and π(x) must be clean. Notice that π(x) must be a descendant of the (l − 1)-level base bag z of p. Observation 3.5 implies that S(x) ⊆ S(π(x)) ⊆ S(z). Consequently, the clique Cx that corresponds to the edge (x, π(x)) is contained in the internal clique over S(z), which includes an edge between any pair of points from S(z). It follows that all cliques Cx that may increase p's degree until level l − 1 are contained in the internal clique over S(z). Corollary 3.8 implies that S(z) < 2k + 2. Hence the degree of p over all cliques Cx until level l − 1 is bounded above by 2k. For a fixed j, the degree of p due to all j-level cliques Cx may increase by at most O(1)O(d) · (2k + 1) units. (This is because (i) p may serve as a surrogate of at most O(1)O(d) nodes at each level, (ii) each tree node has at most O(1)O(d) children, and (iii) each node has at most 2k + 1 surrogates.) In particular, the degree of p due to all l-level cliques (where x and π(x) are in levels l − 1 and l, respectively) is at most O(1)O(d) · (2k + 1). Similarly, the degree of p due to all i-level cliques (where x and π(x) are in levels i − 1 and i, respectively) is also in check. Recall also that p cannot be a surrogate of any j-level node, for all j ∈ [l, i−1]. Consequently, the degree of p over all cliques Cx until level i is at most 2k+O(1)O(d) ·(2k+1). In what follows we analyze the degree of p over all cliques of level at least i + 1, i.e., over j-level cliques Cx that correspond to tree edges (x, π(x)), where π(x) is a j-level node, for j ≥ i + 1, and p belongs to either S(x) or S(π(x)). By definition, p is appointed as a surrogate of a large i-level node, denoted y, and subsequently becomes dirty. The degree of p may increase due to tree edges during term(y). However, our construction guarantees that p will not become a surrogate of any node after term(y) is over. Let i′ denote the last level of term(y), let y′ be the i′-level ancestor of y, and let Π = Πy,y′ be the path between y and y′ in the net-tree T . Observe that cliques of level larger than i′ + 1 cannot increase the degree of p, and so it suffices to bound the degree of p over all cliques of level between i + 1 and i′ + 1. In level i′ + 1 (which is the last level of interest to us) the degree of p will increase by at most O(1)O(d) · (2k + 1) units. Consider now a j-level clique Cx that corresponds to a tree edge (x, π(x)), where π(x) is a j-level node, for j ∈ [i + 1, i′], and p belongs to either S(x) or S(π(x)). We also assume that the edge (x, π(x)) is non-redundant, i.e., S(x) 6= S(π(x)). We argue that the clique Cx is incarnated in some clique that corresponds to either a (j − 1)-level cross edge or a j-level cross edge. Since we have already shown that the degree of p due to cross edges is in check, proving this assertion would imply that the degree of p due to tree edges is in check as well, thus completing the degree analysis. Observe that all nodes along the path Π are dirty non-leech copies of y. Moreover, by Claim 3.11, for any j-level node v, where j ∈ [i, i′], either S(v) = S(y) or S(v) ∩ S(y) = ∅ must hold, and in the former case Claim 3.10 implies that v is either the j-level copy of y or one of its leeches. In particular, if p belongs to S(v), then we have S(v) = S(y). Consequently, if p belongs to both S(x) and S(π(x)), then we have S(x) = S(π(x)) = S(y), and so the edge (x, π(x)) is redundant. We henceforth assume that p belongs to either S(x) or S(π(x)), but not to both, and so S(x) ∩ S(π(x)) = ∅. This means that x cannot belong to Π, as otherwise π(x) would belong to Π too, and the edge (x, π(x)) would be redundant. Suppose next that x does not belong to Π but π(x) belongs to Π. In this case π(x) has a dirty non-leech child u in Π, with S(u) = S(π(x)) = S(y). Since x and u are siblings, they must be γ-friends (assuming γ ≥ 30). Hence they are connected by a cross edge in the basic spanner H, and so Cx is incarnated in the clique Cx,u that corresponds to the (j − 1)-level cross edge (x, u). We may henceforth assume that neither x nor π(x) belong to Π. The first case is that p belongs to S(x) but does not belong to S(π(x)). In this case x is a leech of the (j − 1)-level copy yj−1 of y, and so δ(x, yj−1) ≤ 24 · 5j−1. Let yj denote the j-level copy of y, and note that yj = π(yj−1). We have δ(yj , π(x)) ≤ δ(yj , yj−1) + δ(yj−1, x) + δ(x, π(x)) ≤ 3 · 5j + 24 · 5j−1 + 3 · 5j < 11 · 5j . Hence π(x) is an 11-friend of the dirty non-leech yj, and so it must be a leech too by the construction. Note that the host h of π(x) cannot be yj, otherwise the edge (x, π(x)) would be redundant. Observe also that δ(yj , h) ≤ δ(yj , π(x)) + δ(π(x), h) ≤ 11 · 5j + 24 · 5j = 35 · 5j. In other words, yj and h are 22 γ-friends (assuming γ ≥ 35). Thus they are connected by a cross edge in the basic spanner H, and so Cx is incarnated in the clique Cyj ,h that corresponds to the j-level cross edge (yj , h). The remaining case is that p does not belong to S(x) but belongs to S(π(x)). Thus π(x) is a leech of the j-level copy yj of y, and so δ(yj , π(x)) ≤ 24 · 5j and S(π(x)) = S(yj) = S(yj−1). We have δ(yj−1, x) ≤ δ(yj−1, yj) + δ(yj , π(x)) + δ(π(x), x) ≤ 3 · 5j + 24 · 5j + 3 · 5j = 150 · 5j−1. In other words, yj−1 and x are γ-friends (assuming γ ≥ 150). Thus they are connected by a cross edge in the basic spanner H, and so Cx is incarnated in the clique Cyj−1,x that corresponds to the (j − 1)-level cross edge (yj−1, x). This concludes the proof of the above assertion and completes the degree analysis. 3.3 Fault-Tolerance and Stretch In this section we show that H is a k-FT (1 + ǫ)-spanner for (X, δ). To this end we show that for any pair p, q ∈ X \ F of functioning points (where F ≤ k), there is a (1 + ǫ)-spanner path in H \ F . Consider the (1 + ǫ)-spanner path Πp,q between p and q in the basic spanner H that is guaranteed by Lemma 2.2. The path Πp,q is obtained by climbing up from the leaf nodes (p, 0) and (q, 0) to some j-level ancestors (p′, j) and (q′, j), respectively, which are connected by a cross edge ((p′, j), (q′, j)). By Observation 3.5, p is a surrogate of every clean node along the sub-path of Πp,q that climbs from (p, 0) to (p′, j). Also, every dirty node along this path is complete, hence it has k + 1 surrogates, at least one of which must function. Since every edge along this path is translated into a bipartite clique in H between the corresponding surrogate sets, we obtain this way a functioning path that starts at p and ends at an arbitrarily chosen surrogate p ∈ S(p′, j) \ F of (p′, j). Similarly, we obtain a functioning path that starts at q and ends at an arbitrarily chosen surrogate q ∈ S(q′, j) \ F of (q′, j). The cross edge between p and q in H is functioning too, i.e., (p, q) ∈ H \ F . (In the degenerate case where S(p′, j) = S(q′, j), the cross edge between (p′, j) and (q′, j) in H is redundant, and we do not translate it into a bipartite clique in H. Hence, the edge (p, q) may not belong to H. However, in this case we can simply take p = q.) In this way we obtain a functioning path s(Πp,q) between p and q in our FT spanner H. Observation 3.9 implies that any node along the original path Πp,q in H is a 34-friend of all its surrogates (and in particular, of all its functioning surrogates). Lemma 2.3 implies that s(Πp,q) is a (1 + O(ǫ))-spanner path between p and q, but we can reduce the stretch to 1 + ǫ by scaling γ up by some constant. 4 Lightness The radius rad(x) of an i-level node is its distance scale; we have rad(x) = 5i, but in most other papers (such as [26, 12]) rad(x) is equal to 2i. The standard analysis of [12] (see also [14, 44, 15]) implies that the sum of radii of all tree nodes is O(log n) · ω(M ST (X)). Since the degree of any tree node in the basic spanner construction H is ǫ−O(d) and since all edges in H that are incident on a node x have weight at most O( 1 ǫ ) · rad(x), it follows that the lightness of H is bounded above by ǫ−O(d) · log n. Our FT spanner construction H replaces each edge (x, y) in H by a bipartite clique of size O(k2) between S(x) and S(y). By Observation 3.9, the weight of each of the O(k2) edges of the clique exceeds the weight ω(x, y) of the original edge by an additive factor of at most 34 · (rad(x) + rad(y)) = O(rad(x) + rad(y)). Hence the lightness of our FT spanner H is bounded by ǫ−O(d) · k2 log n. (See [15] for a detailed argument.) To obtain the desired lightness bound of ǫ−O(d)(k2 + k log n), we need to work harder. The key idea is to replace each bipartite clique by a bipartite matching. We can do this "matching replacement" only for edges (x, y) where both nodes x and y are complete. Note that complete nodes are not necessarily dirty. For technical reasons it is more convenient to do this matching replacement for edges (x, y) where both nodes x and y are dirty. In particular, the surrogate set of a dirty node contains exactly k + 1 points (see Observation 3.4). In this case S(x) = S(y) = k + 1, and we will use a perfect bipartite matching (of size k + 1) to connect S(x) with S(y). If x or y (or both) are clean, we will connect S(x) and S(y) by a 23 bipartite clique as before. Using a bipartite matching instead of a bipartite clique shaves a factor of k in the lightness bound; more specifically, the total lightness of all the bipartite matchings is ǫ−O(d) · k log n. Next, we analyze the lightness of the bipartite cliques. Each such clique corresponds to an edge (x, y) of H, in which either x or y (or both) are clean. We charge the total weight of all the clique edges with the clean nodes among x and y. In what follows we bound the total charge W over all clean nodes. Recall that all descendants of a clean node are clean as well (see Observation 3.4). For a clean node x, let W (x) denote the total charge over x and all its descendants. In other words, W (x) stands for the total weight of clique edges that correspond to edges of H that are incident on either x or its descendants. Lemma 4.1 For a clean i-level node x, we have W (x) ≤ ǫ−O(d) · k2 · rad(x). Proof: Let m(x) denote the number of edges in H that correspond to edges of H that are incident on either x or its descendants. Observation 3.5 implies that for any descendant x′ of x, S(x′) ⊆ S(x). It follows that m(x) ≤ Pp∈S(x) ddegi(p), where ddegi(p) stands for the total degree of a point p due to cross edges until level i and due to tree edges until level i + 1 (i.e., including the edge (x, π(x))). Recall that degi(p) stands for the degree of a point p due to cross edges until level i. By Lemma 3.16, degi(p) ≤ D, for each p ∈ S(x). We have also shown that the degree of such a point p due to tree edges until level i + 1 (including the edge (x, π(x))) is bounded above by 2k + O(1)O(d) · (2k + 1). We thus have ddegi(p) ≤ degi(p) + 2k + O(1)O(d) · (2k + 1) ≤ ǫ−O(d) · k. By construction, S(x) ≤ 2k + 1. It follows that ǫ−O(d) · k ≤ (2k + 1) · (ǫ−O(d) · k) ≤ ǫ−O(d) · k2. m(x) ≤ X p∈S(x)ddegi(p) ≤ X p∈S(x) By Claim 3.3, each of the cross edges in H that increase p's degree until level i has weight at most (γ + 68)5i. (In fact, since x is clean, S(x) = D(x). Hence the distance between x and its surrogates is at most 4 · 5i, and so the weight of these edges is at most (γ + 4 + 34)5i = (γ + 38)5i.) Also, since the distance between any two surrogates of S(x) is at most 8 · 5i, each of the tree edges in H that increase p's degree until level i has weight at most 8 · 5i. By Observation 3.9, the surrogates of π(x) are 34- friends of it, hence the edges of H that correspond to the tree edge (x, π(x)) in H have weight at most 4·5i+3·5i+1+34·5i+1 = 189·5i ≤ (γ+68)5i; this inequality holds for γ ≥ 121. Recall also that rad(x) = 5i. We conclude that the total weight of all m(x) edges is at most m(x)(γ + 68)5i = ǫ−O(d) · k2 · rad(x). A clean node is called almost-dirty if its parent in T is dirty. Let A be the set of all almost-dirty nodes in T . By Observation 3.4, for any pair x, y ∈ A of distinct almost-dirty nodes, neither one of them can be an ancestor of the other. Moreover, any clean node z 6∈ A that is not almost-dirty is a descendant of a single almost-dirty node, which implies that the total charge W of all clean nodes is equal to Px∈A W (x). By Lemma 4.1, we have W = Px∈A W (x) ≤ ǫ−O(d) · k2 · Px∈A rad(x). Next, we show that Px∈A rad(x) = O(ω(M ST (X))), which implies that W ≤ ǫ−O(d)·k2·ω(M ST (X)). Since the total weight of the bipartite cliques is at most W , the desired lightness bound would follow. The following lemma implies that the net-points p(x), p(y) that correspond to a pair x, y ∈ A of distinct almost-dirty nodes are far away from each other, and in particular distinct (i.e., p(x) 6= p(y)). Lemma 4.2 (Almost-Dirty Nodes are Far Away From Each Other) For any pair (p, i), (q, j) of distinct nodes from A, with i ≤ j, we have δ(p, q) ≥ 5j−1 = rad(q,j) . 5 Proof: Notice that both p and q belong to the i-level net Ni. Since Ni a 5i-packing, we have δ(p, q) ≥ 5i. If i ≥ j − 1, then we are done. We henceforth assume that i ≤ j − 2. Suppose for contradiction that δ(p, q) < 5j−1. Let (r, j − 1) be the (j − 1)-level ancestor of (p, i). Since j − 1 ≥ i + 1, Observation 3.4 implies that (r, j − 1) must be dirty. We have δ(r, p) ≤ 4 · 5j−1, and so δ(r, q) ≤ δ(r, p) + δ(p, q) ≤ 4 · 5j−1 + 5j−1 = 5 · 5j−1. Note also that (q, j − 1) is a clean child of (q, j). If (r, j − 1) is a non-leech, then (q, j − 1) would have to become its leech (since (q, j − 1) and (r, j − 1) are 5-friends) and thus dirty, a contradiction. We may henceforth assume that (r, j − 1) is a leech of some 24 (j − 1)-level node (h, j − 1). By construction, we have δ(r, h) ≤ 24 · 5j−1. There are two cases. Case 1: The parent (π(h), j) of (h, j − 1) is a non-leech. Notice that δ(π(h), q) ≤ δ(π(h), h) + δ(h, r) + δ(r, q) ≤ 3 · 5j + 24 · 5j−1 + 5 · 5j−1 < 9 · 5j . This means that (q, j) is a 9-friend of (π(h), j), and would become its leech and thus dirty, a contradiction. Case 2: The parent (π(h), j) of (h, j −1) is a leech. By construction, the term of the surrogates of (h, j −1) must be over at level j − 1. Lemma 3.14 implies that F (h, j − 1) ≥ 2k + 2. Also, all points of F (h, j − 1) remain clean at level j − 1 by Claim 3.12. By construction, each point of F (h, j − 1) is a (clean) 10-friend of (h, j − 1). Moreover, each point s ∈ F (h, j − 1) is an 8-friend of (q, j); to see this, note that δ(s, q) ≤ δ(s, h) + δ(h, r) + δ(r, q) ≤ 10 · 5j−1 + 24 · 5j−1 + 5 · 5j−1 < 8 · 5j . Observe also that δ(h, q) ≤ δ(h, r) + δ(r, q) ≤ 24 · 5j−1 + 5 · 5j−1 = 29 · 5j−1. Hence (h, j − 1) and (q, j − 1) are 29-friends, and so there is a cross edge between them in the basic spanner H (assuming γ ≥ 29). By construction, all the at least 2k + 2 points of F (h, j − 1) will be added to the reserve set R(q, j − 1) of (q, j − 1). Moreover, all these points will be subsequently added to F (q, j), unless F (q, j) = 3k + 3. In any case (q, j) will be large, and thus dirty, a contradiction. The lemma follows. 5 Let XA ⊆ X be the set of net-points that correspond to nodes in A, i.e., XA = {p(x) x ∈ A}. Consider the M ST (XA) of (XA, δ), and note that ω(M ST (XA))) ≤ 2 · ω(M ST (X)). Let rt be an arbitrary node in A. We root M ST (XA) at p(rt), and orient all the edges towards p(rt). In this way for each node x ∈ A \ {rt}, the corresponding net-point p(x) has a single outgoing edge in M ST (XA), denoted e(x). By Lemma 4.2, ω(e(x)) ≥ rad(x) . Also, for any pair x, y ∈ A of distinct almost-dirty nodes, their corresponding net-points p(x) and p(y) are distinct, which implies that the corresponding outgoing edges e(x) and e(y) are distinct as well. Hence ω(M ST (XA)) = Px∈A\{rt} ω(e(x)) ≥ Px∈A\{rt} rad(x) . Finally, note that rad(rt) ≤ ω(M ST (X)). It follows that Px∈A rad(x) = O(ω(M ST (X))). Denote by H the spanner obtained from H by replacing the bipartite cliques with bipartite matchings, whenever possible. The above discussion shows that H achieves the desired lightness bound ǫ−O(d)(k2 + k log n). Also, the degree of H is no greater than the degree of H, and so it is in check too. Finally, we can guarantee that H will be a k-FT (1 + ǫ)-spanner using a simple adjustment, namely, connect the surrogate set S(x) of each dirty leaf x via an internal clique (which includes an edge between any pair of points from S(x)). It is easy to see that this adjustment does not increase the degree and lightness by more than constants. Indeed, any point p may be a surrogate of at most O(1)O(d) leaves, and so its degree due to the internal cliques will increase by an additive factor of O(1)O(d) · k. In particular, this means that the number of edges due to the internal cliques is bounded above by O(1)O(d) · kn. By Observation 3.9, any such edge has weight at most 2(34 · 50) = O(1), and so the total weight due to the internal cliques is at most O(1)O(d) · kn ≤ O(1)O(d) · k · ω(M ST (X)), where the last inequality follows from the fact that the minimum inter-point distance of X is equal to 1. Hence, the lightness will be in check as well. 5 Next, we show that for any pair p, q ∈ X \ F of functioning points (where F ≤ k), there is a (1 + ǫ)- spanner path in H \ F . Consider the (1 + ǫ)-spanner path Πp,q between p and q in the basic spanner H that is guaranteed by Lemma 2.2, obtained by climbing up from the leaf nodes (p, 0) and (q, 0) to some j-level ancestors (p′, j) and (q′, j), respectively, which are connected by a cross edge ((p′, j), (q′, j)). Consider first the sub-path Πp,p′ of Πp,q that climbs from (p, 0) to (p′, j). We argue that there is a short functioning path from p to some point in S(p′, j) \ F . Note that p is a surrogate of every clean node along this path. The case when (p′, j) is clean is immediate. Suppose that (p′, j) is dirty, and consider the highest clean ancestor x(0) of (p, 0) along Πp,p′, and its dirty parent x(1) = π(x(0)). Observation 3.5 implies that p belongs to S(x(0)). By Observation 3.4, S(x(1) = k +1. There is a bipartite clique between S(x(0)) and S(x(1)) by the construction, and so p is connected to each of the k + 1 points of S(x(1)). We have disregarded the case where x(1) = (p, 0) is a dirty leaf. Recall that our adjustment added an internal clique for each dirty leaf. Hence, in this case p is connected to each of the other k points of S(x(1)). By Observation 3.4, all ancestors of x(1) are dirty. Let x(1) be the highest (dirty) ancestor of x(1) along Πp,p′ with the same surrogate set as x(1), i.e., S(x(1)) = S(x(1)). (It is possible that x(1) = x(1).) 25 Let x(2) = π(x(1)) be the parent of x(1), and let x(2) be the highest (dirty) ancestor of x(2) along Πp,p′ with the same surrogate set as x(2), i.e., S(x(2)) = S(x(2)). (It is possible that x(2) = x(2).) By definition, S(x(2)) = S(x(2)) 6= S(x(1)) = S(x(1)). Moreover, Claim 3.11 implies that S(x(1)) ∩ S(x(2)) = ∅. By construction, S(x(1)) = S(x(2)) = k + 1, and there is a perfect bipartite matching (of size k + 1) between S(x(1)) = S(x(1)) and S(x(2)) = S(x(2)). Similarly, let x(3) = π(x(2)) be the parent of x(2), and let x(3) be the highest (dirty) ancestor of x(3) along Πp,p′ with the same surrogate set as x(3), i.e., S(x(3)) = S(x(3)). By definition, S(x(3)) = S(x(3)) 6= S(x(2)) = S(x(2)) 6= S(x(1)) = S(x(1)) 6= S(x(3)). Moreover, Claim 3.11 implies that S(x(2)) ∩ S(x(3)) = S(x(1)) ∩ S(x(3)) = S(x(1)) ∩ S(x(2)) = ∅. By construction, S(x(2)) = S(x(3)) = k + 1, and there is a perfect bipartite matching (of size k + 1) between S(x(2)) = S(x(2)) and S(x(3)) = S(x(3)). It follows that there are k + 1 vertex-disjoint paths between S(x(1)) and S(x(3)). We continue this way until we reach x(l) = (p′, j). By applying this argument inductively, we get k + 1 vertex-disjoint paths between S(x(1)) and S(x(l)) = S(p′, j). Since F ≤ k (i.e., there are at most k faulty points), at least one of these paths must function. Recall also that p is connected to all points of S(x(1)), which means that there is a path in H \ F between p and some functioning point p of S(p′, j). Moreover, this functioning path is a (1 + O(ǫ))-spanner path by Lemma 2.3, and we can reduce the stretch to 1 + ǫ by scaling γ up by some constant. This proves the above assertion, but we are not done yet. In exactly the same way as above, it can be shown that there is a functioning (1 + ǫ)-spanner path between q and some functioning point q of S(q′, j). However, the cross edge (p, q) need not be in our spanner H. (This is because we use bipartite matchings rather than bipartite cliques, whenever possible.) Consequently, it may be impossible to glue these two functioning paths together via the edge (p, q). We can easily overcome this hurdle in the degenerate case where either (p′, j) or (q′, j) (or both) are clean. Indeed, suppose without loss of generality that (p′, j) is clean. In this case p belongs to S(p′, j). Moreover, by construction, there is a bipartite clique between S(p′, j) and S(q′, j), and so p is connected via cross edges to all points of S(q′, j). If (q′, j) is clean too, then there is a direct edge between p and q. Otherwise, we can use the above functioning (1 + ǫ)-spanner path between q and q, and then get from q to p via a direct edge. We thus obtain a short functioning path between p and q, as required. We will next show how to overcome the above hurdle in the more interesting case where both (p′, j) and (q′, j) are dirty. The above argument handles the two sub-paths Πp,p′ (between p and p′) and Πq,q′ (between q and q′) of Πp,q separately. More specifically, it first builds a short functioning path for each of these two sub-paths of Πp,q, and then it tries to glue these sub-paths together into a single functioning path using a possibly non-existing cross edge (p, q) (i.e., (p, q) may not belong to H). Instead of breaking the path Πp,q into two sub-paths and handling them separately, we consider the entire path Πp,q and build for it a single functioning path in roughly the same way as we did for each of these two sub-paths. As before, let x(0) be the highest clean ancestor of (p, 0) along Πp,p′, and let x(1) = π(x(0)) be its dirty parent. Similarly, let y(0) be the highest clean ancestor of (q, 0) along Πq,q′, and let y(1) = π(y(0)) be its dirty parent. Recall also that we defined x(1) as the highest (dirty) ancestor of x(1) along the sub-path Πp,p′ with the same surrogate set as x(1). Now we define x(1) differently. More specifically, unlike the above argument, we would also like to consider nodes that belong to the other sub-path Πq,q′ of Πp,q. Let Πx(1),y(1) = (v1 = x(1), v2 = π(x(1)), . . . , vt = (p′, j), vt+1 = (q′, j), . . . , vh = y(1)) be the sub-path of Πp,q from x(1) to y(1), where 1 ≤ t < h ≤ 2j + 2. Let i be the maximum index in [h], such that S(x(1)) = S(vi); we define x(1) as vi. (Unlike before, now it is indeed possible that x(1) would belong to Πq,q′.) In the above argument, we defined x(2) = π(x(1)). This makes sense, as the objective was to get closer and closer to (p, j′). Here the objective is to get closer and closer to y(1). So we will define x(2) = π(x(1)) only in the case that x(1) belongs to Πp,p′ \ (p′, j). If x(1) = (p′, j), then we define x(2) = (q′, j). Finally, in the case that x(1) belongs to Πq,q′, we define x(2) to be the child of x(1) along Πq,q′. 26 In the same way we define x(2), x(3), and so forth. We continue this way until we reach x(l) = y(1). In exactly the same way as before we get k + 1 vertex-disjoint paths between S(x(1)) and S(x(l)) = S(y(1)). Since F ≤ k, at least one of these paths must function. Observe also that p and q are connected to all points of S(x(1)) and S(y(1)), respectively. (Recall that our adjustment added an internal clique for each dirty leaf. Hence, in the case where x(1) = (p, 0) (respectively, y(1) = (q, 0)) is a dirty leaf, the point p (resp., q) is connected to each of the other k points of S(x(1)) (resp., S(y(1))).) Consequently, we obtain a path in H \ F between p and q. Moreover, this functioning path is a (1 + O(ǫ))-spanner path by Lemma 2.3, and we can reduce the stretch to 1 + ǫ by scaling γ up by some constant. 5 Diameter In this section we show how to obtain diameter O(log n), without increasing any of the other parameters. The basic idea was used before in [14, 44, 15], and involves shortcutting the light subtrees of the n , where ∆ = maxu,v∈X δ(u, v) is the diameter of the net-tree, i.e., those with distance scales less than ∆ metric X. This shortcutting is carried out using the 1-spanners of [45] (cf. Theorem 3 therein [45]). Theorem 5.1 ([45]) Let T be an arbitrary n-node tree. One can build in O(n log n) time, a 1-spanner for (the tree metric induced by) T with O(n) edges, degree at most deg(T ) + O(1) and diameter O(log n). Next, we would like to add shortcut edges to the spanner H of Section 4. The naıve approach would be to build the shortcut spanner of Theorem 5.1 for each of the light subtrees of the net-tree T , and then replace each shortcut edge by a bipartite matching if possible (i.e., if both endpoints of that edge are dirty), and by a bipartite clique otherwise. This would give rise to a k-FT (1 + ǫ)-spanner with logarithmic diameter. However, the degree and lightness would grow by too much, and would exceed the desired thresholds of ǫ−O(d) · k and ǫ−O(d)(k2 + k log n), respectively. In order to control the degree and lightness due to shortcut edges, we first prune some nodes from T , and only later proceed to shortcutting the light subtrees of the resulting pruned tree T ∗. Then we proceed as before, replacing each shortcut edge by a bipartite matching (if possible) or a bipartite clique. Our ultimate spanner H∗ is obtained by adding the shortcut edges to the spanner H of Section 4. We turn to describing how the pruned tree T ∗ is obtained. • First, we remove all clean nodes from the net-tree. Indeed, shortcutting clean nodes is redundant, as the first dirty node on any (1 + ǫ)-spanner path is connected to its clean child on that path via a bipartite clique (i.e., there is a bipartite clique between the corresponding surrogate sets). Since the surrogate set of any clean node contains its entire descendant set (see Observation 3.5), one can go from any leaf point to all the surrogates of the relevant dirty node via a direct edge. In the degenerate case where the leaf itself is dirty, we have an internal clique over the surrogate set of that leaf (recall that the spanner H of Section 4 contains an internal clique over the surrogate set of each dirty leaf), and so one can still go from any leaf point to all the surrogates of that dirty leaf via a direct edge. • Second, we go over the resulting tree (which contains only dirty nodes) top-down, looking for nodes x whose surrogate set is the same as that of its parent π(x) and as that of every one of its dirty siblings. Such nodes are called redundant, and they are removed from the tree. When a node x and its siblings are removed from the tree, we connect π(x) with its grandchildren. These grandchildren become the new children of π(x), and they will be siblings in T ∗ (hereafter, T ∗-siblings). However, they too may be redundant (if their surrogate set is the same as π(x)), and thus removed from the tree. This process may be repeated over and over, hence the children of π(x) in the resulting pruned tree T ∗ may be of significantly smaller level than that of π(x). That is, the parent x′ of an i-level node x in the pruned tree T ∗ may be of level i′, where i ≪ i′. Notice that S(x′) 6= S(x). Moreover, for every j-level node z on the path between x and x′ in the original tree T , where j ∈ [i + 1, i′ − 1], we have S(z) = S(x′). (Indeed, otherwise the node z would not be redundant; 27 since x is dirty, z will be dirty too by Observation 3.4, and so it would have to belong to T ∗, which is a contradiction.) In other words, the edge (x, x′) in the pruned tree T ∗ corresponds to a path (x = vi, vi+1, vi+2, . . . , x′ = vi′) in the original tree T , where all vertices vi+1, . . . , vi′−1 are redundant and S(vi+1) = S(vi+2) = . . . = S(x′) 6= S(x). In particular, this means that for any pair x, y of (dirty non-redundant) nodes in T ∗, x is an ancestor of y in T ∗ if and only if x is an ancestor of y in the original net-tree T . Note also that the degree of the resulting pruned tree T ∗ may be larger than the degree of the original tree T . However, by Fact 2.1, there can be only O(1)O(d) nodes with the same surrogate set at each level. This means that the degree of T ∗ will exceed the degree of T by at most a factor of O(1)O(d). Since the degree of the original tree T is O(1)O(d), it follows that the degree of the pruned tree T ∗ is at most O(1)O(d) · O(1)O(d) = O(1)O(d), i.e., the degree does not grow by too much. For a node x in T , denote by π(x) (respectively, π∗(x)) its parent in the original tree T (resp., pruned tree T ∗). If x does not belong to T ∗, then π∗(x) denotes the first ancestor of x in T which belongs to T ∗. The pruned tree T ∗ has some important advantages over the original net-tree T . First, all nodes of T ∗ are dirty, and so any shortcut edge for T ∗ will translate into a bipartite matching rather than a bipartite clique. This property, however, is not required for achieving the desired bounds. That is, even if we are being wasteful and translate the shortcut edges into bipartite cliques, the desired bounds on the degree and lightness will still be in check; we shall address this issue in the sequel. We use the fact that there are no clean and redundant nodes in T ∗ to prove the following lemma, which is critical for achieving the desired bounds on both the degree and the lightness. Lemma 5.2 Every point p ∈ X may serve as a surrogate of at most ǫ−O(d) nodes of T ∗. Proof: Consider an arbitrary point p ∈ X, and let i be the first level in which p is a surrogate of some (dirty non-redundant) i-level node x in T ∗. If x is the root of T ∗, then we are done. We henceforth assume that x is not the root of T ∗. Since x is non-redundant, its surrogate set must be different than either the surrogate set S(π∗(x)) of its parent π∗(x) in T ∗ or the surrogate set S(y) of some dirty T ∗-sibling y of x. Define x′ as x if it is a non-leech, or as the host of x otherwise. Note that x′ is dirty and S(x′) = S(x). It is possible that x′ is redundant, and thus does not belong to the pruned tree T ∗. We argue that term(x′) must be over until level i + τ + 3. Note that the parent π(x′) of x′ in T may be different than the parent π∗(x′) of x′ in T ∗; in this case π(x′) is a descendant of π∗(x′) in T . However, in either case S(π∗(x′)) = S(π(x′)) holds by the construction. Similarly, we have S(π∗(x)) = S(π(x)). In the case that S(x′) 6= S(π∗(x′)), we have S(x′) 6= S(π(x′)), which means that term(x′) is over at level i. We henceforth assume that S(x′) = S(π∗(x′)), and so S(x) = S(x′) = S(π(x′)). Suppose first that S(x) 6= S(π(x)), which means that S(π(x)) 6= S(π(x′)), and so π(x) 6= π(x′), x 6= x′. In this case x is a leech of x′. By Observation 3.2, π(x) and π(x′) are 24-friends, and so they are connected by a cross edge. Since x is dirty, π(x) is also dirty by Observation 3.4, and we have S(π(x)) = k + 1. The fact that S(π(x)) 6= S(π(x′)) implies that the degree of the surrogates of S(π(x′)) due to non-redundant cross edges since their appointment reaches k + 1 at level i + 1 or before. It follows that the second phase of term(x′) will start at level i+ 2 or before. The second phase lasts precisely τ + 2 levels, and so term(x′) will be over until level i + τ + 3. Next, assume that S(x) = S(π(x)). By construction, S(π(x)) = S(π∗(x)), and so S(x) = S(π∗(x)). In this case it must hold that S(x) 6= S(y), for some dirty T ∗-sibling y of x. Since x and y are T ∗-siblings, S(π(x)) = S(π(y)). (It is possible that π(x) = π(y).) Observation 3.9 implies that π(x) and π(y) are 68-friends, and so x and y are 370-friends. Since x is a leech of x′, it follows that x′ and y are 394-friends, and so there is a cross edge between x′ and y (assuming γ ≥ 394). Since y is dirty, we have S(y) = k + 1. Note also that S(x′) = S(x) 6= S(y). Hence the degree of the surrogates of S(x′) due to non-redundant cross edges since their appointment reaches k + 1 at level i or before. Consequently, the second phase of term(x′) will start at level i + 1 or before, and so term(x′) will be over until level i + τ + 2. We have shown that term(x′) must be over until level i + τ + 3. Moreover, by Claim 3.11 and the construction, p cannot be a surrogate of any j-level node, for all j ∈ [i + τ + 4, ℓ]. In other words, p may 28 only serve as a surrogate of j-level nodes, where j ∈ [i, i + τ + 3]. Since p may serve as a surrogate of at most O(1)O(d) nodes at each level of the original tree T , it will also serve as a surrogate of at most O(1)O(d) nodes at each level of the pruned tree T ∗. We conclude that p may serve as a surrogate of at most (τ + 4) · O(1)O(d) ≤ ǫ−O(d) nodes of the pruned tree T ∗, as required. Denote by T ∗ 1 , . . . , T ∗ m the light subtrees of the pruned tree T ∗. Notice that the node sets of all the i of T ∗. Its degree deg(T ∗ light subtrees are pairwise disjoint. Consider now an arbitrary light subtree T ∗ i ) is at most deg(T ∗) = O(1)O(d). We use the 1-spanners of Theorem 5.1 to shortcut T ∗ i , and then translate each non-redundant shortcut edge (x, y) into a perfect bipartite matching between the corresponding surrogate sets S(x) and S(y). Notice that such a matching between S(x) and S(y) increases the degree of each point in S(x) ∪ S(y) by only one unit. Any redundant shortcut edge (x, y) (with S(x) = S(y)) is simply disregarded. By Theorem 5.1, the shortcut edges increase the degree of each tree node of T ∗ i by at i ) + O(1) = O(1)O(d) units. Also, Lemma 5.2 shows that every point may serve as a surrogate most deg(T ∗ of at most ǫ−O(d) nodes of T ∗. It follows that the degree of any point (due to the bipartite matchings that correspond to the non-redundant shortcut edges) is at most ǫ−O(d), and so the degree of the spanner H∗ will be in check. In fact, even if we are being wasteful and translate the non-redundant shortcut edges into bipartite cliques, the degree of H∗ will still be bounded above by the desired threshold of ǫ−O(d) · k. By Lemma 5.2, the number of nodes in the pruned tree T ∗ is bounded above by ǫ−O(d) · n. As mentioned, the node sets of all the light subtrees of T ∗ are pairwise disjoint. Hence, by Theorem 5.1, the total number of all shortcut edges is bounded above by O(ǫ−O(d) · n) = ǫ−O(d) · n. Since the distance scale of each light subtree is at most ∆ n (and as the distance scales decrease geometrically with the level), the weight of any shortcut edge is at most O( ∆ n ). Moreover, each of the k + 1 edges of the bipartite matching that replaces a shortcut edge is also bounded by O( ∆ n ). Note also that ∆ ≤ ω(M ST (X)). It follows that the total weight of the bipartite matchings that correspond to all the non-redundant shortcut edges is at most ǫ−O(d) · n · O( ∆ n )(k + 1) ≤ ǫ−O(d) · k · ω(M ST (x)), and so the lightness of the spanner H∗ will be in check. In fact, even if we are being wasteful and translate the non-redundant shortcut edges into bipartite cliques, the lightness of H∗ will still be bounded above by the desired threshold of ǫ−O(d)(k2 + k log n). Finally, we show that H∗ is a k-FT (1 + ǫ)-spanner with diameter O(log n). Consider an arbitrary pair p, q ∈ X \ F of functioning points (where F ≤ k), and let Πp,q be the (1 + ǫ)-spanner path between p and q in the spanner H that is guaranteed by Lemma 2.2. Recall that Πp,q is obtained as the union of the two sub-paths Π(p, p′) and Π(q, q′) between (p, 0) and (p′, j) and between (q, 0) and (q′, j), respectively, which are glued together via the j-level cross edge between (p′, j) and (q′, j). Note that some of the nodes along Πp,q may not belong to T ∗. Let Π∗ p,p′ be the path obtained from Πp,p′ by (i) replacing each node x along Πp,p′ which does not belong to T ∗ with π∗(x) (i.e., with the first ancestor of x in T that belongs to T ∗), and (ii) removing duplicates, i.e., leaving only the last occurrence of each node in that path. Let x∗ be the last node in Π∗ p,p′ is almost a sub-path of Πp,p′. More specifically, if p,p′ is a sub-path of Πp,p′, with x∗ = (p′, j). Otherwise the last node x∗ along (p′, j) belongs to T ∗, then Π∗ Π∗ q,q′ in the same way, and denote the last node in Π∗ q,q′ be the union of the two paths q,q′, which are glued together via the edge (x∗, y∗). Observe that x∗ and y∗ may be different Π∗ than (p′, j) and (q′, j), respectively; in particular, the edge (x∗, y∗) may not belong to the spanner H. Nevertheless, we must have S(x∗) = S(p′, j) and S(y∗) = S(q′, j) by the construction. Consequently, the possible differences between x∗ and (p′, j) and between y∗ and (q′, j) are insignificant, as x∗ and y∗ can play the role of (p′, j) and (q′, j), respectively. That is, the bipartite clique or matching that should replace the possibly non-existing edge (x∗, y∗) is incarnated in the bipartite clique or matching that replaces the j-level cross edge between (p′, j) and (q′, j). p,p′ \ π∗(p′, j) is a sub-path of Πp,p′. We define Π∗ p,p′ is π∗(p′, j), and the path Π∗ p,p′, and observe that Π∗ q,q′ by y∗. Let Π∗ p,q = Π∗ p,p′ ◦ (x∗, y∗) ◦ Π∗ p,p′ and Π∗ Observe that the path Π∗ p,q may contain many edges. This is where the shortcut edges come in handy. That is, we can use the shortcut edges to reduce the number of edges in the path Π∗ p,q to O(log n), without increasing the weight of the path. The proof for this assertion is simple, and follows similar lines as those in the works of [14, 44, 15]. (The main idea behind this proof is that there are only O(log n) levels with distance scales at least ∆ m from the pruned n . In other words, by removing the light subtrees T ∗ 1 , . . . , T ∗ 29 tree T ∗, we obtain a tree ¯T with only O(log n) levels. To maneuver over the (possibly many) remaining levels of ¯T we use the shortcut edges.) We will henceforth assume that Π∗ p,q contains only O(log n) edges. In Section 4 we used a sub-path Πx(1),y(1) of Πp,q to show that there are k + 1 vertex-disjoint paths between S(x(1)) and S(y(1)), where x(1) (respectively, y(1)) stands for the first dirty node along Π(p, p′) (resp., Π(q, q′)). By using the path Π∗ p,q instead of Πx(1),y(1), we can show in exactly the same way that there are k + 1 vertex-disjoint paths between the surrogate sets S(x1) and S(y1) of the first and last nodes x1 and y1 along Π∗ p,q contains only O(log n) edges, all these paths have at most O(log n) edges. The fact that F ≤ k implies that at least one of these paths must function. Finally, observe that p and q are connected to all points of S(x1) and S(y1), respectively. It follows that there is a (1 + ǫ)-spanner path in H∗ \ F between p and q that consists of only O(log n) edges. p,q, respectively. Moreover, since Π∗ 6 Running Time Our construction uses the net-tree spanner of [40, 30] and the 1-spanners of [45] as black-boxes. The con- struction of [40, 30] (respectively, [45]) can be implemented within time ǫ−O(d) · n log n (resp., O(n log n)). A central ingredient in the net-tree spanner of [40, 30] is the underlying net-tree, which is based on a sophisticated hierarchical partition from [11]. To build the net-tree and the underlying spanner efficiently, it is important to be able to concentrate on only ǫ−O(d) · n useful tree nodes. In particular, a node is called lonely if it has exactly one child in T (which corresponds to the same net-point as the parent); otherwise it is non-lonely. Following [40, 30, 15] and other works in this context, a long chain of lonely nodes will be represented implicitly for efficiency reasons; implementation details can be found in [30]. Our algorithm from Section 3.1 (see in particular Section 3.1.4) traverses the net-tree bottom-up. The sets S(·), D(·), F (·), R(·) are computed for the i-level (useful) nodes, only after we have computed these sets for the nodes at lower levels j ∈ [0, i − 1]. The computation of these sets is carried out via Procedure ComputeSets(i), which makes heavy use of the i-level cross edges that we are given from the net-tree spanner of [40, 30]. Notice that each tree node x is incident on only ǫ−O(d) cross edges and only O(1)O(d) tree edges. To compute the sets S(x), D(x), F (x), R(x) for an i-level node x, we need to gather information from x's neighbors y either due to cross edges or due to tree edges (more specifically, children), where most of the information about such neighbors y is held in the corresponding sets S(y), D(y), F (y), R(y) of y. With this information at hand, it is rather simple to compute the sets S(x), D(x), F (x), R(x). In particular, since a potential host for a node is a 24-friend of that node, there is a cross edge between a node and all its potential hosts; hence finding a potential host can be carried out efficiently. The descendant sets D(·) of all tree nodes can be computed in a straightforward way within ǫ−O(d) · n time. It is more difficult to compute the other sets S(·), F (·), R(·) efficiently. In particular, note that Procedure ComputeSets(i) upper bounds the sizes of the surrogate sets S(·) and the friend sets F (·) by 2k + 1 and 3k + 3, respectively. Upper bounding the size of S(·) and F (·) by ǫ−O(d) · k is critical in order to perform efficiently. Similarly, we also need to bound the size of the reserve sets R(·) by ǫ−O(d) · k. Consider an arbitrary node x. We argue that it suffices to keep track of the clean points that were added to the reserve sets of either x or its descendants in the last τ levels. Indeed, a point p that belongs to the reserve set R(y) of some i-level node y will be a 10-friend of the (i + τ )-level ancestor y′ of y by Claim 3.3. Assuming p belongs to F (y′), there is no reason to store it in R(y′) as well. If some node y on the path in T between y and y′ satisfies F (y) = 3k + 3, then p may not belong to F (y′). (This is the only case in which p may not belong to F (y′).) However, in this case we should have enough points in F (y′). To be on the safe side, besides the points that were added to the reserve sets of either x or its descendants in the last τ levels, we may store in R(x) additional O(k) points that were added to the reserve sets of x's descendants before the last τ levels; as mentioned, such points are 10-friends of x. In this way we always keep track of enough clean 10-friends of a node. By construction, in each level at most ǫ−O(d) · k new points are added to the reserve set of any node. Since we only keep track of the last τ levels (and at most O(k) additional points), it follows that the size of the reserve sets R(·) can be upper bounded by τ · ǫ−O(d) · k + O(k) ≤ ǫ−O(d) · k. Given that the size of all sets S(·), F (·), R(·) is bounded above by 30 ǫ−O(d) · k, it is easy to see that the overall time needed to compute the sets S(x), F (x), R(x) for all useful nodes x in the tree will be (ǫ−O(d) · k) · (ǫ−O(d) · n) ≤ ǫ−O(d) · kn. Having computed the surrogate sets of all nodes, we replace each edge of the net-tree spanner H of [40, 30] by a bipartite clique between the corresponding surrogate sets. The time needed to replace all edges of the spanner H by bipartite cliques is asymptotically the same as the number of edges in the resulting FT spanner H, which is ǫ−O(d) · kn. It follows that the overall time required to build the spanner H from Section 3 is ǫ−O(d) · (n log n + kn). The transformation described in Section 4, which translates each bipartite clique into a bipartite matching whenever possible (i.e., when both endpoints of the corresponding edge in the spanner H are dirty), can be easily implemented within time ǫ−O(d) · kn. Building the internal cliques for all dirty leaves requires another amount of ǫ−O(d) · kn time. Consequently, the spanner H from Section 4 can be implemented within time ǫ−O(d) · (n log n + kn). Finally, the construction of the pruned tree T ∗ in Section 5 can be carried out within time ǫ−O(d) · n. By Theorem 5.1, shortcutting the light subtrees of T ∗ requires ǫ−O(d) · n log n time. We conclude that the overall running time required to build the ultimate spanner H∗ from Section 5 (which proves Theorem 1.1) is at most ǫ−O(d) · (n log n + kn). To summarize: The spanner H∗ of Section 5 proves Theorem 1.1. Acknowledgments The author is grateful to Michael Elkin for helpful and timely discussions. References [1] I. Abraham, Y. Bartal, and O. Neiman. Advances in metric embedding theory. Advances in Mathematics, 228(6):30263126, 2011. [2] I. Abraham and D. Malkhi. Compact routing on Euclidian metrics. In Proc. of 23rd Annual Symp. on Principles of Distributed Computing, pages 141 -- 149, 2004. [3] P. K. Agarwal, Y. Wang, and P. Yin. Lower bound for sparse Euclidean spanners. In Proc. of 16th SODA, pages 670 -- 671, 2005. [4] I. Althofer, G. Das, D. P. Dobkin, D. Joseph, and J. Soares. On sparse spanners of weighted graphs. Discrete & Computational Geometry, 9:81 -- 100, 1993. [5] S. Arya, G. Das, D. M. Mount, J. S. Salowe, and M. H. M. Smid. Euclidean spanners: short, thin, and lanky. In Proc. of 27th STOC, pages 489 -- 498, 1995. [6] S. Arya, D. M. Mount, and M. H. M. Smid. Randomized and deterministic algorithms for geometric spanners of small diameter. In Proc. of 35th FOCS, pages 703 -- 712, 1994. [7] S. Arya and M. H. M. Smid. Efficient construction of a bounded degree spanner with low weight. In Proc. of 2nd ESA, pages 48 -- 59, 1994. [8] P. Assouad. Plongements lipschitziens dans Rn. Bull. Soc. Math. France, 111(4):429448, 1983. [9] Y. Bartal, L. Gottlieb, and R. Krauthgamer. The traveling salesman problem: low-dimensionality implies a polynomial time approximation scheme. In Proc. of 44th STOC, pages 663 -- 672, 2012. [10] P. B. Callahan and S. R. Kosaraju. A decomposition of multi-dimensional point-sets with applications to k-nearest-neighbors and n-body potential fields. In Proc. of 24th STOC, pages 546 -- 556, 1992. [11] H. T.-H. Chan and A. Gupta. Small hop-diameter sparse spanners for doubling metrics. In Proc. of 17th SODA, pages 70 -- 78, 2006. [12] H. T.-H. Chan, A. Gupta, B. M. Maggs, and S. Zhou. On hierarchical routing in doubling metrics. In Proc. of 16th SODA, pages 762 -- 771, 2005. [13] T.-H. H. Chan, M. Li, and L. Ning. Sparse fault-tolerant spanners for doubling metrics with bounded hop- diameter or degree. In ICALP (1), pages 182 -- 193, 2012. [14] T.-H. H. Chan, M. Li, and L. Ning. Incubators vs zombies: Fault-tolerant, short, thin and lanky spanners for doubling metrics. Technical Report, CoRR abs/1207.0892, July, 2012. [15] T.-H. H. Chan, M. Li, L. Ning, and S. Solomon. New doubling spanners: Better and simpler. In Proc. of 40th ICALP, 2013 (to appear). 31 [16] B. Chandra, G. Das, G. Narasimhan, and J. Soares. New sparseness results on graph spanners. In Proc. of 8th SOCG, pages 192 -- 201, 1992. [17] D. Z. Chen, G. Das, and M. H. M. Smid. Lower bounds for computing geometric spanners and approximate shortest paths. Discrete Applied Mathematics, 110(2-3):151 -- 167, 2001. [18] L. P. Chew. There is a planar graph almost as good as the complete graph. In Proc. of 2nd SOCG, pages 169 -- 177, 1986. [19] K. L. Clarkson. Approximation algorithms for shortest path motion planning. In Proc. of 19th STOC, pages 56 -- 65, 1987. [20] K. L. Clarkson. Nearest neighbor queries in metric spaces. Discrete Comput. Geom., 110(1):6393, 1999. [21] A. Czumaj and H. Zhao. Fault-tolerant geometric spanners. In Proc. of 19th SoCG, pages 1 -- 10, 2003. [22] G. Das, P. J. Heffernan, and G. Narasimhan. Optimally sparse spanners in 3-dimensional Euclidean space. In Proc. of 9th SOCG, pages 53 -- 62, 1993. [23] G. Das and G. Narasimhan. A fast algorithm for constructing sparse Euclidean spanners. In Proc. of 10th SOCG, pages 132 -- 139, 1994. [24] Y. Dinitz, M. Elkin, and S. Solomon. Low-light trees, and tight lower bounds for Euclidean spanners. Discrete & Computational Geometry, 43(4):736 -- 783, 2010. [25] M. Elkin and S. Solomon. Optimal Euclidean spanners: really short, thin and lanky. In STOC, 2013 (to appear). [26] J. Gao, L. J. Guibas, and A. Nguyen. Deformable spanners and applications. In Proc. of 20th SoCG, pages 190 -- 199, 2004. [27] L. Gottlieb. Private communication, March 2013. [28] L. Gottlieb, A. Kontorovich, and R. Krauthgamer. Efficient regression in metric spaces via approximate lipschitz extension. CoRR, abs/1111.4470, 2011. [29] L. Gottlieb and L. Roditty. Improved algorithms for fully dynamic geometric spanners and geometric routing. In Proc. of 19th SODA, pages 591 -- 600, 2008. [30] L. Gottlieb and L. Roditty. An optimal dynamic spanner for doubling metric spaces. In Proc. of 16th ESA, pages 478 -- 489, 2008. Another version of this paper is available via http://cs.nyu.edu/~adi/spanner2.pdf. [31] J. Gudmundsson, C. Levcopoulos, and G. Narasimhan. Fast greedy algorithms for constructing sparse geo- metric spanners. SIAM J. Comput., 31(5):1479 -- 1500, 2002. [32] A. Gupta, R. Krauthgamer, and J. R. Lee. Bounded geometries, fractals, and low-distortion embeddings. In Proc. of 44th FOCS, page 534543, 2003. [33] S. Har-Peled and M. Mendel. Fast construction of nets in low-dimensional metrics and their applications. SIAM J. Comput., 35(5):1148 -- 1184, 2006. [34] S. Kapoor and X. Li. Efficient construction of spanners in d-dimensions. Technical Report, CoRR abs/1303.7217, March, 2013. Corresponds to an unpublished manuscript (the first draft is from November 2007), which is currently under review. [35] J. M. Keil and C. A. Gutwin. Classes of graphs which approximate the complete Euclidean graph. Discrete & Computational Geometry, 7:13 -- 28, 1992. [36] R. Krauthgamer and J. R. Lee. Navigating nets: Simple algorithms for proximity search. In Proc. of 15th SODA, page 791801, 2004. [37] C. Levcopoulos, G. Narasimhan, and M. H. M. Smid. Efficient algorithms for constructing fault-tolerant geometric spanners. In Proc. of 30th STOC, pages 186 -- 195, 1998. [38] T. Lukovszki. New results of fault tolerant geometric spanners. In Proc. of 6th WADS, pages 193 -- 204, 1999. [39] G. Narasimhan and M. Smid. Geometric Spanner Networks. Cambridge University Press, 2007. [40] L. Roditty. Fully dynamic geometric spanners. In Proc. of 23rd SoCG, pages 373 -- 380, 2007. [41] J. S. Salowe. Construction of multidimensional spanner graphs, with applications to minimum spanning trees. In Proc. of 7th SoCG, pages 256 -- 261, 1991. [42] M. H. M. Smid. The weak gap property in metric spaces of bounded doubling dimension. In Proc. of Efficient Algorithms, pages 275 -- 289, 2009. [43] S. Solomon. From hierarchical partitions to hierarchical covers: Optimal fault-tolerant spanners for doubling metrics. Available via http://cs.bgu.ac.il/~shayso/optFTspanner.pdf. [44] S. Solomon. Fault-tolerant spanners for doubling metrics: Better and simpler. Technical Report, CoRR abs/1207.7040, July, 2012. [45] S. Solomon and M. Elkin. Balancing degree, diameter and weight in Euclidean spanners. In Proc. of 18th ESA, pages 48 -- 59, 2010. [46] K. Talwar. Bypassing the embedding: algorithms for low dimensional metrics. In Proc. of 36th STOC, page 281290, 2004. [47] P. M. Vaidya. A sparse graph almost as good as the complete graph on points in k dimensions. Discrete & Computational Geometry, 6:369 -- 381, 1991. 32
1501.06259
1
1501
2015-01-26T05:53:03
On Longest Repeat Queries
[ "cs.DS" ]
Repeat finding in strings has important applications in subfields such as computational biology. Surprisingly, all prior work on repeat finding did not consider the constraint on the locality of repeats. In this paper, we propose and study the problem of finding longest repetitive substrings covering particular string positions. We propose an $O(n)$ time and space algorithm for finding the longest repeat covering every position of a string of size $n$. Our work is optimal since the reading and the storage of an input string of size $n$ takes $O(n)$ time and space. Because any substring of a repeat is also a repeat, our solution to longest repeat queries effectively provides a "stabbing" tool for practitioners for finding most of the repeats that cover particular string positions.
cs.DS
cs
On Longest Repeat Queries✩ Atalay Mert Ileria, M. Oguzhan Kulekcib, Bojian Xuc,∗ aMassachusetts Institute of Technology, USA bIstanbul Medipol University, Turkey c Eastern Washington University, USA 5 1 0 2 n a J 6 2 ] S D . s c [ 1 v 9 5 2 6 0 . 1 0 5 1 : v i X r a Abstract Repeat finding in strings has important applications in subfields such as computational biology. Surprisingly, all prior work on repeat finding did not consider the constraint on the locality of repeats. In this paper, we propose and study the problem of finding longest repetitive substrings covering particular string positions. We propose an O(n) time and space algorithm for finding the longest repeat covering every position of a string of size n. Our work is optimal since the reading and the storage of an input string of size n takes O(n) time and space. Because any substring of a repeat is also a repeat, our solution to longest repeat queries effectively provides a "stabbing" tool for practitioners for finding most of the repeats that cover particular string positions. Keywords: information retrieval, string processing, repeats, regularities, repetitive structures 1. Introduction Repetitive structures and regularities finding in genomes and proteins is important as these structures play important roles in the biological functions of genomes and proteins [1]. It is well known that overall about one-third of the whole human genome consists of repeated subsequences [2]; about 10 -- 25% of all known proteins have some form of repetitive structures [3]. In addition, a number of significant problems in molecular sequence analysis can be reduced to repeat finding [4]. Another motivation for finding repeats is to compress the DNA sequences, which is known as one of the most challenging tasks in the data compression field. DNA sequences consist only of symbols from {ACGT} and therefore can be represented by two bits per character. Standard compressors such as gzip and bzip usually use more than two bits per character and therefore cannot reach good compression. Many modern genomic sequence data compression techniques highly rely on the repeat finding in the sequences [5, 6]. The notion of maximal repeat and super maximal repeat [1, 7, 8, 9] captures all the repeats of the whole string in a space-efficient manner, but it does not track the locality of each repeat and thus can not support the finding of repeats that cover a particular string position. In this paper, we propose and study the problem of finding longest repetitive substrings covering any particular string positions. Because any substring of a repeat is also a repeat, the solution to longest repeat queries effectively provides a "stabbing" tool for practitioners for finding most of the repeats that cover particular string positions. In this paper, we propose an O(n) time and space algorithm that can find the leftmost longest repeat of every string position. We view our solution to be optimal in both time and space, because one has to spend Ω(n) time and space to read and store the input string. ✩ Author names are in alphabetical order. ∗Corresponding author. Mailing address: 319F CEB, Eastern Washington University, Cheney, WA 99004, USA. Phone: +1 (509) 359-2817. Fax: +1 (509) 359-2215. Email addresses: [email protected] (Atalay Mert Ileri), [email protected] (M. Oguzhan Kulekci), [email protected] (Bojian Xu) 1 2. Preliminary We consider a string S[1 . . . n], where each character S[i] is drawn from an alphabet Σ = {1, 2, . . . , σ}. A substring S[i . . . j] of S represents S[i]S[i + 1] . . . S[j] if 1 ≤ i ≤ j ≤ n, and is an empty string if i > j. String S[i′ . . . j ′] is a proper substring of another string S[i . . . j] if i ≤ i′ ≤ j ′ ≤ j and j ′ − i′ < j − i. The length of a non-empty substring S[i . . . j], denoted as S[i . . . j], is j − i + 1. We define the length of an empty string as zero. A prefix of S is a substring S[1 . . . i] for some i, 1 ≤ i ≤ n. A proper prefix S[1 . . . i] is a prefix of S where i < n. A suffix of S is a substring S[i . . . n] for some i, 1 ≤ i ≤ n. A proper suffix S[i . . . n] is a suffix of S where i > 1. We say the character S[i] occupies the string position i. We say the substring S[i . . . j] covers the kth position of S, if i ≤ k ≤ j. For two strings A and B, we write A = B (and say A is equal to B), if A = B and A[i] = B[i] for i = 1, 2, . . . , A. We say A is lexicographically smaller than B, denoted as A < B, if (1) A is a proper prefix of B, or (2) A[1] < B[1], or (3) there exists an integer k > 1 such that A[i] = B[i] for all 1 ≤ i ≤ k − 1 but A[k] < B[k]. A substring S[i . . . j] of S is unique, if there does not exist another substring S[i′ . . . j ′] of S, such that S[i . . . j] = S[i′ . . . j ′] but i 6= i′. A substring is a repeat if it is not unique. A character S[i] is a singleton, if it appears only once in S. Definition 2.1. For a particular string position k ∈ {1, 2, . . . , n}, the longest repeat (LR) covering position k, denoted as LRk, is a repeat substring S[i . . . j], such that: (1) i ≤ k ≤ j, and (2) there does not exist another repeat substring S[i′ . . . j ′], such that i′ ≤ k ≤ j ′ and j ′ − i′ > j − i. Definition 2.2. For a particular string position k ∈ {1, 2, . . . , n}, the left-bounded longest repeat (LLR) starting at position k, denoted as LLRk, is a repeat S[k . . . j], such that either j = n or S[k . . . j+1] is unique. Obviously, for any string position k, if S[k] is not a singleton, both LRk and LLRk must exist, because at least S[k] itself is a repeat. Further, there might be multiple choices for LRk. For example, if S = abcabcddbca, then LR2 can be either S[1 . . . 3] = abc or S[2 . . . 4] = bca. However, if LLRk does exist, it must have only one choice, because k is a fixed string position and the length of LLRk must be as long as possible. The suffix array SA[1 . . . n] of the string S is a permutation of {1, 2, . . . , n}, such that for any i and j, 1 ≤ i < j ≤ n, we have S[SA[i] . . . n] < S[SA[j] . . . n]. That is, SA[i] is the starting position of the ith suffix in the sorted order of all the suffixes of S. The rank array Rank[1 . . . n] is the inverse of the suffix array. That is, Rank[i] = j iff SA[j] = i. The longest common prefix (lcp) array LCP [1 . . . n + 1] is an array of n + 1 integers, such that for i = 2, 3, . . . , n, LCP [i] is the length of the lcp of the two suffixes S[SA[i − 1] . . . n] and S[SA[i] . . . n]. We set LCP [1] = LCP [n + 1] = 0. In the literature, the lcp array is often defined as an array of n integers. We include an extra zero at LCP [n + 1] is only to simplify the description of our upcoming algorithms. Table .1 in the appendix shows the suffix array and the lcp array of the example string mississippi. The next Lemma 2.1 shows that, by using the rank array and the lcp array of the string S, it is easy to calculate any LLRi if it exists or to detect the fact that it does not exist. Lemma 2.1. For i = 1, 2, . . . , n: LLRi = (cid:26) S[i . . . i + Li − 1] does not exist , , if Li > 0 if Li = 0 where Li = max{LCP [Rank[i]], LCP [Rank [i] + 1]}. Proof. Note that Li is the length of the lcp between the suffix S[i . . . n] and any other suffix of S. If Li > 0, it means substring S[i . . . Li − 1] is the lcp among S[i . . . n] and any other suffix of S. So S[i . . . Li − 1] is LLRi. Otherwise (Li = 0), the letter S[i] is a singleton, so LLRi does not exist. 2 Algorithm 1: Find LRk. Return the leftmost one if k has multiple LRs. Input: The position index k, and the rank array and the lcp array of the string S Output: LRk or find no such LR. The leftmost one will be returned if k has multiple LRs. 1 start ← −1; length ← 0 ; 2 for i = k down to 1 do 3 L ← max{LCP [Rank [i]], LCP [Rank [i] + 1]}; if L = 0 or i + L − 1 < k then 4 5 6 7 break; else if L ≥ length then start ← i; length ← L; // start position and length of LRk // Length of LLRi // LLRi does not exist or does not cover k. // Early stop // Tie is resolved by picking the leftmost one. 8 Print LRk ← hstart, lengthi; 3. Longest repeat finding for one position In this section, we want to find LRk for a given string position k, using O(n) time and space. We present the solution to this setting here in case the practitioners have only a smaller number of string positions, for which they want to find the longest repeats, and thus this light-weighted solution will suffice. We will start with finding the leftmost LRk if the string position k is covered by multiple LRs. In the end of the section, we will show a trivial extension to find all LRs covering position k with the same time and space complexities, if k has multiple LRs. Lemma 3.1. Every LR is an LLR. Proof. Assume that LRk = S[i . . . j] is not an LLR. Note that S[i . . . j] is a repeat starting from position i. If S[i . . . j] is not an LLR, it means S[i . . . j] can be extend to some position j ′ > j, so that S[i . . . j ′] is still a repeat and also covers position k. That says, S[i . . . j ′] > S[i . . . j]. However, the contradiction is that S[i . . . j] is already the longest repeat covering position k. Lemma 3.2. For any three string positions i, j, and k, 1 ≤ i < j ≤ k ≤ n: if LLRj does not exist or does not cover position k, LLRi does not exist or does not cover position k either. Proof. (1) If LLRj does not exist, then S[j] is a singleton. If LLRi does exist and covers position k, then LLRi also covers position j, which yields a contradiction that the substring LLRi includes the singleton S[j] but is a repeat. (2) If LLRj = S[j . . . t] does exist but does not cover position k, then S[j . . . t + 1] is unique and t + 1 ≤ k. If LLRi exists and covers position k, say LLRi = S[i . . . r], r ≥ k, it means S[j . . . t + 1] is a substring of a repeat LLRi = S[i . . . r], because i < j < t + 1 ≤ r, so S[j . . . t + 1] is also a repeat. This contradicts to the fact that S[j . . . t + 1] is unique. So LLRi does not exist or does not cover position k. The idea behind the algorithm for finding the LR covering a given position is straightforward. Algorithm 1 shows the pseudocode, where the found LR is returned as a tuple hstart, lengthi, representing the starting position and the length of the LR, respectively. If the LR that is being searched for does not exist, h−1, 0i is returned by Algorithm 1. We know that any longest repeat covering position k must be an LLR (Lemma 3.1), starting between indexes 1 to k inclusive. What we need to do is to simply compute every individual of LLR1 . . . LLRk using Lemma 2.1 and check whether it covers position k or not. We will just choose the longest LLR that covers position k and resolve the tie by picking the leftmost one if k is covered by multiple LRs (Line 6). Due to Lemma 3.2, a practical speedup is possible via an early stop (Line 5) by computing and checking from LLRk down to LLR1 (Line 2). Lemma 3.3. Given the rank array and the lcp array of the string S, for any position k in the string S, Algorithm 1 can find LRk or the fact that it does not exist, using O(k) time and O(n) space. If there are multiple candidates for LRk, the leftmost one is returned. 3 Proof. The algorithm clearly has no more than k steps and each step takes O(1) time, so it costs a total of O(k) time. The space cost is primarily from the rank array and the lcp array, which altogether is O(n), assuming each integer in these arrays costs a constant number of bytes. Theorem 3.1. For any position k in the string S, we can find LRk or the fact that it does not exist, using O(n) time and space. If there are multiple candidates for LRk, the leftmost one is returned. Proof. The suffix array of S can be constructed by existing algorithms using O(n) time and space (For ex., [10]). After the suffix array is constructed, the rank array can be trivially created using O(n) time and space. We can then use the suffix array and the rank array to construct the lcp array using another O(n) time and space [11]. Given the rank array and the lcp array, the time cost of Algorithm 1 is O(k) (Lemma 3.3). So altogether, we can find LRk or the fact that it does not exists using O(n) time and space. If multiple LRs cover position k, the leftmost LR will be returned as is guaranteed by Line 6 of Algorithm 1. Extension: Find all LRs covering a given position. It is trivial to extend Algorithm 1 to find all the LRs covering any given position k as follows. We can first use Algorithm 1 to find the leftmost LRk. If LRk does exist, then we will start over again to recheck LLRk down to LLR1 and return those whose length is equal to the length of LRk. Due to Lemma 3.2, the same early stop as we have in Algorithm 1 can be used for a practical speedup. The pseudocode of this procedure is provided in Algorithm 4 in the appendix, which clearly costs an extra O(k) time. Combining Theorem 3.1, we have: Theorem 3.2. We can find all the LRs covering any given position k using O(n) time and space. 4. Longest repeat finding for every position In this section, we want to find LRk of every position k = 1, 2, . . . , n. If any position k is covered by multiple LRs, the leftmost one will be returned. A natural solution is to iteratively use Algorithm 1 as a subroutine to find every LRk, for k = 1, 2, . . . , n. However, the total time cost of this solution will be k=1 O(k) = O(n2), where O(n) captures the time cost for the construction of the rank array and k=1 O(k) is the total time cost for the n instances of Algorithm 1. We want to have a solution that costs a total of O(n) time and space, which follows that the amortized cost for finding each LR is O(1). O(n) +Pn the lcp array and Pn 4.1. A conceptual algorithm We will first calculate LLR1, LLR2, . . . , LLRn using Lemma 2.1, and save the results in an array LLRS [1 . . . n]. Each LLR is represented by a tuple hstart, lengthi, the starting position and the length of the LLR. We assign zero as the length of any non-existing LLR, which does not cover any string position. We then sort the LLRS array in the descending order of the lengths of the LLRs, using a stable and linear-time sorting procedure such as the counting sort. Definition 4.1. After the LLRS array is stably sorted, let P1 denote the string positions that are covered by LLRS [1], and Pi, 2 ≤ i ≤ n, denote the string positions that are covered by LLRS [i] but are not covered by any of LLRS [1 . . . i − 1]. Let Pi denote the number of string positions belonging to Pi. Note that any Pi, i ≥ 1, can possibly be empty. Our conceptual algorithm will then assign LLRS [i] as the LR of those string positions belonging to Pi, if Pi is not empty, for i = 1, 2, . . . , n. We store the LRs that we have calculated in an array LRS [1 . . . n] of hstart, lengthi tuples, where LRS [i] = LRi and LRS [i].start and LRS [i].length represent the starting position and length of LRi. If LRi does not exist, the tuple h−1, 0i will be assigned to LRS [i], which can be done during the initialization of the LRS array. Early stop can be made when (1) we meet an LLRS array element whose length is zero, which indicates that all the remaining LLRS array elements also have lengths of zero; or (2) every string position has had their LR calculated. Algorithm 2 shows the pseudocode of this conceptual algorithm. 4 Algorithm 2: The conceptual algorithm for finding the leftmost LR for every non-singleton string position of S. Input: The rank array and the lcp array of the string S Output: The leftmost LR covering every non-singleton string position of S. /* Calculate the LLRS array using Lemma 2.1. Initialize the LRS array.. */ 1 for i = 1, 2, . . . , n do 2 LLRS [i] ← (i, max{LCP [Rank [i]], LCP[Rank [i] + 1]}) ; LRS [i] ← h−1, 0i ; 3 // LLRi, in the format of hstart, lengthi // LRi, in the format of hstart, lengthi 4 Stably sort LLRS [1 . . . n] in the descending order of its second dimension ; // e.g.: counting sort. /* Find the leftmost LR for every position */ // The number of non-singleton string positions that have their LRs calculated. 5 count ← 0 ; 6 for i = 1, 2, . . . , n do 7 if count = n or LLRS [i].length = 0 then break ; if Pi = 0 then continue; foreach k ∈ Pi do LRS [k] ← LLRS [i] ; count ← count + Pi; 8 9 10 // Calculate the LRs of the positions belonging to Pi. // Early stop 11 return LRS [1 . . . n] Lemma 4.1. Algorithm 2 finds the LR for every position that does not contain a singleton. It finds the leftmost LR if any position is covered by multiple LRs. Proof. The proof of the lemma is obvious. Recall that every LR must be an LLR (Lemma 3.1) and we process all LLRs in descending order of their lengths. For i = 1, 2, . . . , n, if Pi is not empty, then for each position in Pi, the substring LLRS [i] is the longest LLR that covers that position, i.e., LLRS [i] is the LR of that position. In the case where any position in Pi has multiple LRs, LLRS [i] must be the leftmost LR because of the stable sorting of the LLRS array. 4.2. High-level strategy for a fast implementation The challenge is to implement the conceptual algorithm (Algorithm 2) efficiently. Our goal is to use O(n) time and space only, which is optimal since we have to spend O(n) time and space to report all the LRs of all the n distinct string positions. We start with some property of each Pi (Definition 4.1). Recall that, in Algorithm 2, we process all the LLRs in the descending order of their lengths, and also all LLRs start from distinct string positions. Therefore, after the LLRS array is sorted (Line 4, Algorithm 2), none of LLRS [1 . . . i − 1] can be a substring of LLRS [i], for any i ≥ 2. This yields the following fact. Fact 4.1. Every non-empty Pi, i ≥ 1, is a continuous chunk of string positions, i.e., every non-empty Pi is an integer range [si, ei], where si and ei are the starting and ending string positions of Pi. In the case where Pi is empty, we set si = ei = −1. In order to achieve an overall O(n)-time imple- mentation of Algorithm 2, we need a mechanism that can quickly find si using O(1) time when processing each LLRS [i]. Then, if si 6= −1, due to Fact 4.1, we can just linearly walk from string position si through the position ei, which is either the right boundary of LLRS [i] or a string position whose next neighboring position has had its LR calculated, whichever one is reached first. We will then set the LR of each visited position during the walk to be LLRS [i], achieving an overall O(n) time implementation of Algorithm 2. When we process a non-empty LLRS [i] and calculate its si, there are two cases. Case 1: The string position LLRS [i].start has not had its LR calculated, then obviously si = LLRS [i].start. Case 2: The string position LLRS [i].start has already had its LR calculated, then it is either si > LLRS [i].start (if Pi is not empty) or si = −1 (if Pi is empty). In this case, it will not be efficient to find si by simply walking from LLRS [i].start toward ei until we reach ei or a string position whose LR has not been calculated. It is not immediately clear how to calculate si using O(1) time. This leads to the design of our following mechanism that enables us to calculate every si in Case 2 using O(1) time. 5 4.3. The two-table system: the ptr and next arrays Our mechanism is built upon two integer arrays, ptr[1 . . . n] and next[1 . . . n]. We update the two arrays online when we process the sorted LLRS array elements in the calculation of the LR of every string position. Ideally, we want to maintain these two arrays, such that for any string position k that has had its LR if no such after-k string position exists. Then, when we process a particular non-empty LLRS [i], if the string position LLRS [i].start has had its LR calculated, we can either directly get si or find the fact that all calculated, next(cid:2)ptr[k](cid:3) is either the next after-k string position whose LR is not calculated yet or n + 1 string positions covered by LLRS [i] have had their LRs calculated, by comparing nexthptr(cid:2)LLRS [i].start(cid:3)i and LLRS [i].start + LLRS [i].length − 1 (the right boundary of LLRS [i]). However, it is not clear how to achieve such an ideal maintenance of the ptr and next arrays in a time-efficient manner. This motivates us to maintain these two arrays approximately, which is to maintain the following invariance. We will show later that such approximate maintenance of the ptr and next arrays can still help calculate every si using O(1) time. 4.3.1. Invariance. We initialize every element of both ptr and next arrays to be −1. Recall that after the LLRS array is sorted in descending order of the lengths of the LLRs, we process every LLRS [i], for i = 1, 2, . . . , n. After we have finished the processing of LLRS [1 . . . i − 1], for any i ≥ 2, we want to maintain the following invariance for the ptr and next arrays when processing LLRS [i]. 1. If LLRS [i].start has already had its LR calculated but Pi > 0, then: nexthptr(cid:2)LLRS [i].start(cid:3)i = si 2. If Pi = 0 but LLRS [i].length > 0 (i.e.: LLRS [i] is not empty), then nexthptr(cid:2)LLRS [i].start(cid:3)i is larger than the index of the right boundary of LLRS [i]. That is, nexthptr(cid:2)LLRS [i].start(cid:3)i > LLRS [i].start + LLRS [j].length − 1 4.3.2. Using the invariance. Recall that when we process a particular non-empty LLRS [i], we want to calculate si quickly. The hard case is when the string position LLRS [i].start has already had its LR calculated. Provided with the above invariance of the ptr and next arrays, when we process a non-empty LLRS [i], we will first check the value of ptr(cid:2)LLRS [i].start(cid:3). If it is not equal to −1, the hard case occurs. Then, if nexthptr(cid:2)LLRS [i].start(cid:3)i ≤ LLRS [i].start+LLRS [i].length−1 (the right boundary of LLRS [i]), we can assert si = nexthptr(cid:2)LLRS [i].start(cid:3)i; otherwise, we can assert Pi is empty and thus will simply skip LLRS [i]. 4.4. Maintaining the two-table system. In the following, we will first describe how we update the ptr and next arrays when processing every LLRS [i]. In the end, we will explain why the invariance is maintained using an overall O(n) time. Remind that the whole algorithm will early stop if LLRS [i] is empty, so we will only need to describe the algorithmic for processing a non-empty LLRS [i]. We first initialize every element in both ptr and next arrays to be −1. We will use the word bucket to denote a maximal and continuous area in the ptr array where all entries share the same positive value. So initially, there is no bucket presented in the ptr array. Because all the LLRS array elements have been sorted in the descending order of their lengths, the maintenance of the two-table system will only have the following five cases to consider (Figure 1). We use lef t and right to denote the indexes of the left and right boundary of the LLRS [i]. That is, left ← LLRS [ i ]. start ; // the left boundary of LLRS [ i ] right ← LLRS [ i ]. start + LLRS [ i ]. length - 1; // the right boundary of LLRS [ i ] 6 Case 1: Case 2.1: Case 3.1: Case 5.1: Case 5.3: Case 4: Case 2.2: Case 3.2: Case 5.2: Case 5.4: positions whose LRs have been calculated string positions that are covered by LLRS [i] being processed Figure 1: Possible cases regarding the re- lationship between the coverage of LLRS [i] and other string positions whose LRs have been calculated Case 1: The coverage of LLRS [i] does not connect to or overlap with any string positions whose LRs have been calculated. We will create a bucket in the ptr array covering the string positions that are covered by LLRS [i] and set up the corresponding next array entry to be the string position that is right after the coverage of LLRS [i]. The following code shows the case condition and the update made to the ptr and next arrays. if ptr [ left ] = -1 and ptr [ right ] = -1 and ( left = 1 or ptr [ left -1] = -1) and ( right = n or ptr [ right +1] = -1) // case 1 for j = left ... right : ptr [ j ] ← i ; next [ i ] ← right + 1; Case 2: The coverage of LLRS [i] connects to or overlaps with the right side of a string position area whose LRs have been calculated. We will extend that area's corresponding ptr array bucket to the coverage of LLRS [i] and update the corresponding next array entry to be the string position that is right after the new bucket. else if ( ptr [ left ] = -1 and left 6= 1 and ptr [ left -1] 6= -1) and ptr [ right ] = -1 and ( right = n or ptr [ right +1] = -1) // case 2.1 for j = left ... right : ptr [ j ] ← ptr [ left -1]; next [ ptr [ left -1]] ← right + 1; else if ( ptr [ left ] 6= -1) and ptr [ right ] = -1 and ( right = n or ptr [ right +1] = -1) // case 2.2 for j = next [ ptr [ left ]]... right : ptr [ j ] ← ptr [ left ]; next [ ptr [ left ]] ← right + 1; Case 3: The coverage of LLRS [i] connects to or overlaps with the left side of an existing string position area whose LRs have been calculated. We will left-extend that area's corresponding ptr array bucket to the coverage of LLRS [i]. We need not to update the corresponding next array entry, since the string position that is right after the new ptr bucket does not change. else if ( ptr [ right ] = -1 and right 6= n and ptr [ right +1] 6= -1) and ptr [ left ] = -1 and ( left = 1 or ptr [ left -1] = -1) // case 3.1 for j = left ... right : ptr [ j ] ← ptr [ right +1]; else if ( ptr [ right ] 6= -1) and ptr [ left ] = -1 and ( left = 1 or ptr [ left -1] = -1) // case 3.2 j ← left ; while ptr [ j ] = -1: ptr [ j ] ← ptr [ right ]; j ++; Case 4: Every string position covered by LLRS [i] has its LR calculated already. In this case, we simply do nothing. else if ptr [ left ] 6= -1 and next [ ptr [ left ]] > right : do nothing ; // case 4 Case 5: The coverage of LLRS [i] bridges two string position areas whose LRs have been calculated. We will extend the left area's corresponding ptr array bucket up to the left boundary of the right area and update the next array entry of the left area to be the one of the right area. else if ptr [ left ] = -1: j ← left ; ptr_entry ← ptr [ left -1]; // case 5.1 , 5.2 else : while ptr [ j ] = -1: ptr [ j ] ← ptr_entry ; j ++; next [ ptr [ ptr_entry ]] ← next [ ptr [ j ]]; j ← next [ ptr [ left ]]; ptr_entry ← ptr [ left ]; // case 5.3 , 5.4 7 Lemma 4.2 (Correctness). The two-table system's invariance is maintained. Proof Sketch: Let us call a ptr array bucket ptr[i . . . j] as a tail bucket if j = n or ptr[j + 1] = −1. (1) We first prove that the invariance is maintained on tail buckets. Observe that any tail ptr bucket is created in Case 1 (Figure 1) and can be extended in Case 2 as well as in Case 3 if the black bucket in Case 3 was also a tail bucket. The update to the tail bucket as well as the corresponding next array entry guarantees that, for any i belonging to the coverage of a tail bucket, next(cid:2)ptr[i](cid:3) is ideally equal to the index of the string position that is right after the bucket (or n + 1 if no such string position exists). So obviously the invariance is maintained. (2) We now prove the invariance is also maintained on non-tail buckets. Observe that any non-tail bucket is created in Case 5 from the merge of the left black bucket and the new LLRS [i]'s coverage. as large as the index of the string position that is following the right black bucket in Case 5. That means After such non-tail bucket is created, for any position i belonging to a non-tail bucket, next(cid:2)ptr[i](cid:3) is at least next(cid:2)ptr[i](cid:3) − i is larger than the size of any unprocessed llrs array element. This guarantee is maintained, because every next(cid:2)ptr[i](cid:3) only monotonically increases. So, the invariance is also maintained for non-tail buckets. (3) Because the invariance is well maintained for all ptr buckets, it is safe to have the condition checking as we have written for Case 4. Lemma 4.3 (Time complexity). The two-table system is maintained using a total of O(n) time over the course of the processing of the LLRS array elements. Proof Sketch: Observe that the updates to the ptr array are made only to those entries whose values were −1 and the new values from the updates are all positive. So there are no more than n updates to the ptr array. It is obvious that the number of updates made to the next array is no more than the number of updates made to the ptr array. Other than ptr and next array updates, the rest of the maintenance work for the two-table system when processing each LLRS array element takes O(1) time. So the total time cost in maintaining the two-table system over the course of the processing of the whole LLRS array is O(n). 4.5. The final O(n) time and space algorithm. By combining the conceptual Algorithm 2, the high-level strategy for the fast implementation, and the two-table system's maintenance mechanism, we are ready to produce the final O(n) time and space algorithm that can find the leftmost LR of every string position. Algorithm 3 shows the pseudocode. It starts with the calculation of the LLRS array and the initialization of the LRS , ptr, and next arrays (Line 1 -- 4). It then sorts the LLRS array in the descending order of the lengths of the array elements using a linear and stable sorting procedure (Line 5). It then uses the for loop (Line 7) to process every LLRS array element with possible early stop (Line 8). Using the two-table system, the value of si is calculated by Line 10 if Pi is not empty; otherwise, the fact that Pi is empty will also be detected by Line 11. After si is calculated, finding the LR of each position in Pi becomes obvious (Line 12 -- 14). After the LR finding work is done, we will update the two-table system (Line 15) using the code presented in Section 4.4. Lemma 4.4. Given the lcp array and the rank array, Algorithm 3 calculates the leftmost LR of every non-singleton position of a string S of size n using a total O(n) time and space. Proof Sketch: (1)Correctness. The correctness of Algorithm 3 immediately follows from of Lemma 4.1 and Lemma 4.2. (2) All data structures that are being involved are the LCP , Rank, LLRS , LRS , ptr, and next arrays. Altogether they use O(n) space. (3) The time cost for the initialization (Line 1 -- 4) takes O(n) time. the stable sorting (Line 5) uses O(n) time. The rest of the work (Line 7 -- 15) also takes O(n) time, because we update every LRS array element no more than once and the two-table system maintenance also takes O(n) time (Lemma 4.3). So the total time cost is O(n). Theorem 4.1. Given a string S of size n, we can calculate the leftmost LR of every of string position using O(n) time and space. 8 Algorithm 3: The O(n) time and space algorithm for finding the leftmost LR for every non-singleton string position of S. Input: The rank array and the lcp array of the string S Output: The leftmost LR covering every non-singleton string position of S. /* Calculate the LLRS array using Lemma 2.1. Initialize the LRS array and the auxiliary ptr and next arrays. */ 1 for i = 1, 2, . . . , n do 2 LLRS [i] ← hi, max{LCP [Rank [i]], LCP[Rank [i] + 1]}i ; LRS [i] ← h−1, 0i ; ptr[i] ← −1; next[i] ← −1 ; 3 4 // LLRi, in the format of hstart, lengthi // LRi, in the format of hstart, lengthi 5 Stably sort LLRS [1 . . . n] in the descending order of its second dimension ; // e.g.: counting sort. /* Find the leftmost LR for every position */ // The number of non-singleton string positions that have their LRs calculated. 6 count ← 0 ; 7 for i = 1, 2, . . . , n do 8 if count = n or LLRS [i].length = 0 then break ; // Early stop 9 10 11 12 13 14 15 lef t ← LLRS[i].start; right ← LLRS[i].start + LLRS[i].length − 1; // The boundaries of LLRS[i]. /* f irst = si of Pi = [si, ei] if Pi is not empty. if ptr[lef t] = −1 then f irst ← lef t; else f irst ← next(cid:2)ptr[lef t](cid:3); if f irst > right then continue ; // Detect the fact that Pi is empty. */ /* Calculate the the leftmost LR of every position in Pi = [si, ei]. j ← f irst; while j ≤ right and ptr[j] = −1 do LRS [j] ← hLLRS [i].start, LLRS [i].lengthi; count ← count + 1; j ← j + 1; Update the two-table system here using the code presented in Section 4.4. */ 16 return LRS [1 . . . n] Proof Sketch: We can construct the suffix array of the string S in a total of O(n) time and space using existing algorithms (For ex., [10]). The rank array is just the inverse suffix array and can be directly obtained from SA using O(n) time and space. Then we can obtain the lcp array from the suffix array and rank array using another O(n) time and space [11]. So the total time and space costs for preparing the rank and lcp arrays are O(n). The proof of the theorem can then immediately follow from Lemma 4.4. 5. Conclusion In this paper, we proposed the problem of finding longest repeats covering particular string positions, motivated by its applications in subfields such as computational biology. We proposed optimal algorithms for finding the (leftmost) longest repeat of every string position using a total of O(n) time and space based on a novel two-table system that we designed. We have implemented our algorithms. Future work can be an experimental study of the implementation. References [1] D. Gusfield, Algorithms on strings, trees and sequences: computer science and computational biology, Cambridge University Press, 1997. [2] E. H. McConkey, Human Genetics: The Molecular Revolution, Jones and Bartlett, Boston, MA, 1993. [3] X. Liu, L. Wang, Finding the region of pseudo-periodic tandem repeats in biological sequences, Algorithms for Molecular Biology 1 (1) (2006) 2. 9 [4] H. M. Martinez, An efficient method for finding repeats in molecular sequences, Nucleic Acids Res. 11 (13) (1983) 4629 -- 4634. [5] G. Manzini, M. Rastero, A simple and fast dna compressor, Software -- Practice and Experience 34 (2004) 1397 -- 1411. [6] B. Behzadi, F. L. Fessant, Dna compression challenge revisited: A dynamic programming approach, in: Annual Symposium on Combinatorial Pattern Matching, 2005. [7] M. O. Kulekci, J. S. Vitter, B. Xu, Time- and space-efficient maximal repeat finding using the burrows-wheeler transform and wavelet trees, in: IEEE International Conference on Bioinformatics and Biomedicine, 2010, pp. 622 -- 625. [8] M. O. Kulekci, J. S. Vitter, B. Xu, Efficient maximal repeat finding using the burrows-wheeler transform and wavelet tree, IEEE Transactions on Computational Biology and Bioinformatics (TCBB) 9 (2) (2012) 421 -- 429. [9] T. Beller, K. Berger, E. Ohlebusch, Space-efficient computation of maximal and supermaximal repeats in genome sequences, in: Proceedings of the 19th International Conference on String Processing and Information Retrieval (SPIRE), 2012, pp. 99 -- 110. [10] P. Ko, S. Aluru, Space efficient linear time construction of suffix arrays, Journal of Discrete Algorithms 3 (2-4) (2005) 143 -- 156. [11] T. Kasai, G. Lee, H. Arimura, S. Arikawa, K. Park, Linear-time longest-common-prefix computation in suffix arrays and its applications, in: Symposium on Combinatorial Pattern Matching, 2001, pp. 181 -- 192. 10 Appendix i 1 2 3 4 5 6 7 8 9 10 11 12 LCP[i] 0 1 1 4 0 0 1 0 2 1 3 0 SA[i] 11 8 5 2 1 10 9 7 4 6 3 -- suffixes i ippi issippi ississippi mississippi pi ppi sippi sissippi ssippi ssissippi -- Table .1: The suffix array and the lcp array of an example string S = mississippi. Algorithm 4: Find all LRs that cover a given position k Input: The position index k, and the rank array and the lcp array of the string S Output: All LRs that cover position k or find no such LR. /* Find the length of LRk. */ 1 length ← 0; 2 for i = k down to 1 do 3 L ← max{LCP [Rank [i]], LCP [Rank [i] + 1]}; if L = 0 or i + L − 1 < k then 4 5 6 7 break; else if L ≥ length then length ← L; // Length of LLRi // LLRi does not exist or does not cover k. // Early stop /* Print all LRs that cover position k. 8 if length > 0 then 9 for i = k down to 1 do 10 11 12 13 14 L ← max{LCP [Rank [i]], LCP [Rank [i] + 1]}; if L = 0 or i + L − 1 < k then break; else if L = length then Print LRk ← hi, lengthi; */ // LRk does exist. // Length of LLRi // LLRi does not exist or does not cover k. // Early stop 15 else Print LRk ← h−1, 0i; // LRk does not exist. 11
1707.03914
1
1707
2017-07-12T21:13:08
Enumerating Vertices of $0/1$-Polyhedra associated with $0/1$-Totally Unimodular Matrices
[ "cs.DS" ]
We give an incremental polynomial time algorithm for enumerating the vertices of any polyhedron $\mathcal{P}(A,\mathbf{1})=\{x\in\RR^n \mid Ax\geq \b1,~x\geq \b0\}$, when $A$ is a totally unimodular matrix. Our algorithm is based on decomposing the hypergraph transversal problem for unimodular hypergraphs using Seymour's decomposition of totally unimodular matrices, and may be of independent interest.
cs.DS
cs
Enumerating Vertices of 0/1-Polyhedra associated with 0/1-Totally Unimodular Matrices Khaled Elbassioni∗ Kazuhisa Makino† 7 1 0 2 l u J 2 1 ] S D . s c [ 1 v 4 1 9 3 0 . 7 0 7 1 : v i X r a Abstract We give an incremental polynomial time algorithm for enumerating the vertices of any polyhe- }, when A is a totally unimodular matrix. Our algorithm dron P(A, 1 ¯ is based on decomposing the hypergraph transversal problem for unimodular hypergraphs using Seymour's decomposition of totally unimodular matrices, and may be of independent interest. ) = {x ∈ Rn Ax ≥ 1 , x ≥ 0 ¯ ¯ Keywords: Totally unimodular matrices, Vertices of polyhedra, Vertex enumeration, Hyper- graph transversals, Hypergraph decomposition, Output polynomial-time algorithm 1 Introduction 1.1 The vertex enumeraion problem The well-known Minkowski-Weyl theorem states that any convex polyhedron P ⊆ Rn can be rep- resented as the Minkowski sum of the convex hull of the set V(P) of its extreme points and the conic hull of the set D(P) of its extreme directions (see e.g. [Sch86]). Given a polyhedron P by its linear description as the intersection of finitely many halfspaces, obtaining the set V(P) ∪ D(P), required by the other representation, is a well-known problem, called Vertex Enumeration (VE) (see,. e.g.,[Dye83, BFM98]), which have been extensively studied in the literature in different (but polyno- mially equivalent) forms, e.g., , the facet enumeration problem [BFM98] or the polytope-polyhedron problem [Lov92]. Clearly, the size of the extreme set V(P) ∪ D(P) can be (and typically is) expo- nential in the dimension n and the number of linear inequalities m, and thus when considering the computational complexity of the vertex enumeration problem, one is usually interested in output- sensitive algorithms [Sei86], i.e., those whose running time depends not only on n and m, but also on V(P) ∪ D(P). Alternatively, we may consider the following, polynomially equivalent, decision variant of the problem: Dec(L;X ⊆ C(P)): Given a polyhedron P, represented by a system of linear inequalities L, and a subset X ⊆ C(P), is X = C(P)? In this description, C(P) could be either V(P), D(P), or V(P ) ∪ D(P ). The problem of enumerating the elements of C(P) is said to be solvable in incremental polynomial time if problem Dec(L;X ⊆ C(P)) can be solved in time polynomial in the size of the description of L and X .1 It is well-known ∗Masdar Institute, Khalifa University of Science and Technology, P.O. Box 54224, Abu Dhabi, UAE; (kelbas- [email protected]) †Research Institute Japan; 1Note that if the answer to the decision problem is "NO" then a new element in C(P) \ X can be found by a (RIMS) Kyoto University, Kyoto ([email protected]) for Mathematical Sciences 606-8502, polynomial number of calls to the decision problem. 1 that if the decision problem is NP-hard, then no output (or total) polynomial-time algorithm can generate the elements of C(P) unless P=NP (see e.g. [BEGM09]). Vertex enumeration is an outstanding open problem in computational geometry and polyhedral combinatorics (see, e.g., [DP77, Lov92, Pfe02]), and has numerous applications. For example, under- standing the structure of the vertices helps in designing approximation algorithms for combinatorial optimization problems [Vaz01]; finding all vertices can be used for computing Nash equilibria for bimatrix games [ARSvS10]. Numerous algorithmic ideas for vertex or facet enumeration have been introduced in the literature, see, e.g., [Abd03, STU97, AF92, AF96, BFM98, BL98, Chv83, DP77, Dye83, FP96, Pro94, RS14, Sei86]. The main result in [KBB+08] established that problem Dec(L;X ⊆ V(P)) is NP-hard for un- bounded polyhedra, more precisely, when D(P) is exponentially large in the input size. This nega- tive result holds, even when restricted to 0/1-polyhedra [BEGT11], that is, when V(P) ⊆ {0, 1}n, and comes in contrast with the fact that the VE problem for 0/1-polytopes (i.e., bounded polyhedra) is known to be solvable with polynomial delay (that is, the vertices are generated such that the delay between any successive outputs is polynomial only in the input size) and polynomial space (that is, the total space used for enumerating all the vertices is polynomial in the input size). 1.2 VE for 0/1-polyhedra associated with 0/1-totally unimodular matrices Let A ∈ {0, 1}m×n be an m × n 0/1-matrix such that the polyhedron } P(A, 1 ) = {x ∈ Rn Ax ≥ 1 , x ≥ 0 ¯ ¯ ¯ (1) has only integral vertices, where 1 ) denotes the vector of all ones (resp., zeros) of appropriate (resp., 0 dimension. Then P(A, 1 ¯ ¯ ) has only n extreme directions (namely the n unit vectors in Rn), while the vertices of P(A, 1 ¯ ) are in one-to-one correspondence with the minimal transversals of the hypergraph H[A] ⊆ 2[n], whose characteristic vectors of hyperedges are the rows of A. One of the most important ¯ examples is when the matrix A is totally unimodular : in this case, the polyhedron P(A, 1 ) has integral vertices, and VE is equivalent to finding all minimal transversals2 of a unimodular hypergraph H[A]. ¯ Consequently, it follows from the well-known result in [FK96] that all vetrices of such polyhedra can be enumerated in quasi-polynomial time, and hence the VE problem in this case is unlikely to be NP-hard. Polynomial time algorithms for special cases of this problem are known; for example, enumerating minimal vertex/edge covers in bipartite graphs [EG95, MP97], enumerating minimal hitting sets/set covers of interval hypergraphs [BEGM09], and enumerating minimal path covers/cut conjunctions in directed trees [BEGM09]. However, the complexity of the VE problem for (1) remains open, even for the totally unimodular matrices A. In this paper, we settle the complexity of the VE problem in the latter case. Theorem 1 Let A ∈ {0, 1}m×n be a totally unimodular matrix. Then the vertices of P(A, 1 ¯ enumerated in incremental polynomial time. ) can be A celebrated result of Seymour [Sey80] shows that any totally unimodular matrix (with 0, ±1- entries) arises from (essentially) the so-called network matrices, by a small set of simple operations. Similar results for 0/1-totally unimodular matrices are derived in [Tru92, Chapter 11], with the main building blocks replaced by 0/1-network matrices. On the other hand, it has been shown in 2Note that, it is not possible to reduce the problem of enumerating the vertices of P(A, 1 the vertices of the 0/1 polytope P(cid:48) = {x ∈ Rn Ax ≥ 1 ¯ those of P (namely, the vertices of P(cid:48) are the (not necessarily minimal) transversals of H[A]). ¯ ) to that of enumerating ≤ x ≤ 1 }, as P(cid:48) can have exponentially more vertcies than ¯ , 0 ¯ 2 [BEGM09] that for any polyhedron P(A, 1 ), with a 0/1-network matrix A or its transpose, the VE ¯ problem can be solved in incremental polynomial time. To prove Theorem 1, we show that the above mentioned decomposition of totally unimodular matrices yields a corresponding decomposition for the hypergraph transversal problem, that can be leveraged into a polynomial time algorithm for the enumeration problem. One of the natural ways to use such decomposition is to recursively partition the input polyhedron into two smaller polyhedra and then combine the outputs from the two subproblems. While such approach works for the simple cases of the decomposition (so-called 1- and 2-sum decompositions), it does not work for the more complicated case (so-called 3-sum decomposition). The main reason is that the number of vertices of the resulting polyhedra in either of the two subproblems may be exponentially larger than that in the original problem. To overcome this difficulty, we need to use the decomposition in a more sophisticated way, utilizing structural properties of the unimodular hypergraph H[A]. One technical hurdle which arises is that the total input/output size of the resulting subproblems might exceed the input/output size of the original problem, which may eventually lead to an exponential blow-up in the overall running time of the algorithm in terms of the input and output sizes. To deal with this issue, we introduce a volume measure as the product of the input and output sizes, and show in each case of our decomposition that the total measure of the subproblems obtained is smaller than the measure of the original problem. 2 Notation and preliminaries 2.1 Hypergraphs and transversals Let V be a finite set. A hypergraph H ⊆ 2V is a family of subsets of V . A hypergraph is called Sperner (simple or a clutter), if it has the property that no hyperedge contains another. For a hypergraph H ⊆ 2V , we denote by Tr(H) the family of minimal transversals of H, i.e., (inclusion-wise) minimal subsets of V which have a nonempty intersection with each hyperedge of H; Tr(H) is also called the dual of H. We say that the hypergraph H is trivial if H = ∅ or H = {∅}, and is irredundant if every v ∈ V belongs to some H ∈ H. As usual, we assume Tr({∅}) = ∅ and Tr(∅) = {∅}. Given two hypergraphs H1 and H2 with vertex set V , denote by H1 ∧ H2 = Min{H1 ∪ H2 H1 ∈ H1 and H2 ∈ H2}, H1 ∨ H2 = Min(H1 ∪ H2), the conjunction and disjunction of H1 and H2 respectively, where for hypergraph H, Min(H) denotes the family of (inclusion-wise) minimal sets in H. We denote by H1 ∪H2 the disjoint union of H1 and H2. For two hypergraphs H1 ⊆ 2V1 and H2 ⊆ 2V2, we denote by H1 ∧H2 the conjunction of H1 and H2 when V1 and V2 are disjoint. By definition, H1 ∪H2 = H1 + H2 and H1 ∧H2 = H1 · H2. For a hypergraph H ⊆ 2V and a set S ⊆ V , we denote by HS = {H ∈ H H ⊆ S} and HS = Min{H ∩ S H ∈ H} the subhypergraph of H induced by S, and the projection of H on S, respectively. For W, S ⊆ V , we write H(W, S) = {H ∈ H H ∩ W = S}. Two vertices of H are said to be identical if they belong to exactly the same hyperedges, i.e., the corresponding columns in the hyperedge-vertex incidence matrix are identical. The following propositions are straightforward (see e.g. [Ber89, EGM03, LLK80]). Proposition 1 Given a hypergraph H ⊆ 2V and a set S ⊆ V , the following statements hold: (i) Tr(Tr(H)) = Min(H), (ii) Tr(HS) = Tr(H)S (and hence, Tr(HS) = Tr(H)S) and 3 (iii) Tr(HS) ≤ Tr(H). Proposition 2 Given hypergraphs H1, . . . ,Hk ⊆ 2V , (cid:32) r(cid:95) Tr (cid:33) r(cid:94) Hi = Tr(Hi). i=1 i=1 As a corollary of Proposition 2 we have the following. Proposition 3 Let H ⊆ 2V be a hypergraph and S1, . . . , Sr ⊆ V be subsets such that for every hyperhedge H ∈ H there exists an i ∈ {1, . . . , r} with H ⊆ Si. Then r(cid:94) Tr(H) = Tr(HSi). Throughout the paper, we use the notation: n = n(H) = V , m = m(H) = H and k = k(H) = Tr(H). i=1 2.2 Polyhedra A convex polyhedron P ⊆ Rn is the intersection of finitely many halfspaces, determined by the facets of the polyhedron. A vertex or an extreme point of P is a point v ∈ Rn which cannot be represented as a convex combination of two other points of P , i.e., there exists no λ ∈ (0, 1) and v1, v2 ∈ P such that v = λv1 + (1 − λ)v2. A (recession) direction of P is a vector d ∈ Rn such that x0 + µd ∈ P whenever x0 ∈ P and µ ≥ 0. An extreme direction of P is a direction d that cannot be written as a conic combination of two other directions, i.e., there exist no positive real numbers µ1, µ2 ∈ R+ and directions d1, d2 of P such that d = µ1d1 + µ2d2. Denote respectively by V(P ) and D(P ) the sets of extreme points and extreme directions of polyhedron P . A bounded polyhedron, i.e., one for which D(P ) = ∅ is called a polytope. 2.3 Totally unimodular matrices A matrix A ∈ {0, 1}m×n is totally unimodular if every square subdeterminant of it has value in {−1, 0, 1}. We denote by U m×n the set of m × n 0/1-totally unimodular matrices. For a matrix A ∈ {0, 1}m×n we denote by H[A] ⊆ 2[n] the hypergraph whose characteristic vectors of hyperedges are the rows of A. A hypergraph H is said to be unimodular [Ber89] if H = H[A] for a totally unimodular matrix A. Note by definition that if H ⊆ 2V is unimodular then for any set S ⊆ V and any subhypergraph H(cid:48) ⊆ H, the hypergraph (H(cid:48))S is unimodular. A 0/1 matrix is said to be ideal ) has only integral vertices. It is well-known that (see, e.g., [Cor01]) if the polyhedron P = P (A, 1 every totally unimodular matrix A ∈ {0, 1}m×n is ideal. Furthermore, the following correspondence ¯ holds. Proposition 4 ([Leh79]) Let A be an m × n ideal matrix. Then the vertices of the polyhedron P(A, 1 ¯ ) are in one-to-one correspondence with the minimal transversals of the hypergraph H[A]. As a corollary of Theorem 1, we obtain the following result. Corollary 1 Let A ∈ {0, 1}m×n be a totally unimodular matrix and, A(cid:48) be a 0/1 matrix whose rows are the characteristic vectors of the vertices of P(A, 1 ) can be ¯ enumerated in incremental polynomial time. ). Then the vertices of P(A(cid:48), 1 ¯ 4 Proof. By a result of Lehman [Leh79], the polyhedron P(A(cid:48), 1 ) also is 0/1, whenever A(cid:48) is a 0/1 matrix whose rows are the characteristic vectors of the vertices of P(A, 1 ¯ ) for an deal matrix A. It follows that the vertices of P(A(cid:48), 1 ¯ ) are in one-to-one correspondence with the minimal transversals of H[A(cid:48)] = Tr(H[A]). By the polynomial equivalence of the enumeration and decision problems [BI95, ¯ GK99], it is enough to check, for a given sublist X ⊆ Tr(H[A(cid:48)]), whether X = Tr(H[A(cid:48)]). The latter condition is equivalent to Tr(X ) = H[A(cid:48)], which can be checked in polynomial time by Theorem 1, since X is a unimodular hypergrpah by assumption. (cid:3) 0/1-Network matrices 2.4 A matrix A ∈ U m×n is said to be a network matrix if there exists a directed tree3 T such that the rows of A one-to-one correspond to the arcs in T , and each column of A is the characteristic vector of a directed path in T . Checking if a given matrix A is a network matrix and finding the corresponding tree representation can be done in polynomial time (see e.g., [Sch86]). We call a hypergraph H a network hypergraph if H = H[A] for some network matrix A or its transpose. It is known that network hypergraphs can be dualized in incremental polynomial time and polynomial space: Theorem 2 ([BEGM09]) Let A ∈ {0, 1}m×n be a network matrix. Then (i) all the vertices of P(A, 1 ¯ ) can be enumerated in incremental polynomial time using polynomial space; (ii) all the vertices of P(AT , 1 ¯ space. ) can be enumerated in incremental polynomial time using polynomial 2.5 Decomposition of 0/1-totally unimodular matrices Seymour [Sey80] gave a decomposition theorem that allows one to decompose (in polynomial time) any 0/1-totally unimodular matrix by repeatedly applying certain operations (called i-sums, for i = 1, 2, 3) until simple building blocks are obtained; the building blocks consist of 0/1-network matrices, their transposes and a specific 5 × 5 0/1-matrix. For our purposes this theorem can be stated as follows. Theorem 3 ([Sey80, Sch86, Tru92]) Let A ∈ {0, 1}m×n be a totally unimodular matrix. Then one of the following conditions holds: (I) A or its transpose is a 0/1-network matrix; (II) A, possibly after permuting the rows and columns, is the matrix:  A0 =  ; 1 0 0 1 1 1 1 0 0 1 0 1 1 0 1 0 0 1 1 1 1 1 1 1 1 (III) A has a row or a column with at most one "1", or A has two identical rows or columns; 3We say that a directed graph G is a directed tree if the underlying graph of G (i.e., the undirected graph obtained from G by ignoring orientation of arcs) is a tree. 5 (IV) A can be decomposed as follows: (cid:20) A1 Q R A2 (cid:21) , A = where A1 ∈ U m1×n1, A2 ∈ U m2×n2, Q ∈ U m1×n2, R ∈ U m2×n1, for some positive integers n1, m1, n2, m2 with m1 + m2 = m, n1 + n2 = n, n1 + m1 ≥ 4 and n2 + m2 ≥ 4: -- 1-sum decomposition: R = 0 and Q = 0; -- 2-sum decomposition: R has rank 1 and Q = 0; -- 3-sum decomposition -- case 1: R and Q have rank 1; -- 3-sum decomposition -- case 2: R has rank 2, Q = 0. Deciding if A is a network matrix or its transpose, or (up to permutations of rows and columns) A0, and if not, finding a decomposition as above can be done in polynomial time. Corollary 2 (Decomposition of unimodular hyeprgraphs) Let H ⊆ 2V be a unimodular (non- trivial) irredundant Sperner hypergraph. Then H is a network hypergraph, (isomorphic to) the hy- pergraph H0 = {{1, 4, 5},{1, 2, 5},{2, 3, 5},{3, 4, 5}}, has two identical vertices, has a hyperedge con- sisting of a singleton, has a vertex with degree 1, or there exists a nontrivial partition V1 ∪V2 = V such that H can be decomposed as follows: • 1-sum decomposition: (i) HV1 (cid:54)= ∅, HV2 (cid:54)= ∅; (ii) for all H ∈ H: either H ⊆ V1 or H ⊆ V2; • 2-sum decomposition: there exists a set nonempty S ⊆ V1 such that (i) HV1 (cid:54)= ∅, H(V1, S) (cid:54)= ∅, H(V1, S)V2 (cid:54)= {∅}; (ii) for all H ∈ H with H ∩ V1 (cid:54)= ∅ and H ∩ V2 (cid:54)= ∅: H ∩ V1 = S; • 3-sum decomposition -- case 1: there exist two nonempty sets S1 ⊆ V1 and S2 ⊆ V2, such that (i) H(V1, S1) (cid:54)= ∅, H(V1, S1)V2 (cid:54)= {∅}, H(V2, S2) (cid:54)= ∅, H(V2, S2)V1 (cid:54)= {∅}; (ii) V1 + HV1 ∪ H(V2, S2) ≥ 4, V2 + HV2 ∪ H(V1, S1) ≥ 4; (iii) for all H ∈ H with H ∩ V1 (cid:54)= ∅ and H ∩ V2 (cid:54)= ∅: either H ∩ V1 = S1 or H ∩ V2 = S2; • 3-sum decomposition -- case 2: there exist three nonempty disjoint sets S0, S1, S2 ⊆ V1, such that (i) HV1 (cid:54)= ∅, H(V1, S0∪S1) (cid:54)= ∅, H(V1, S0∪S1)V2 (cid:54)= {∅}, H(V1, S0∪S2) (cid:54)= ∅, H(V1, S0∪S2)V2 (cid:54)= (ii) for all H ∈ H with H∩V1 (cid:54)= ∅ and H∩V2 (cid:54)= ∅: either H∩V1 = S0∪S1, or H∩V1 = S0∪S2; {∅}; • 3-sum decomposition -- case 3: there exist two nonempty disjoint sets S1, S2 ⊆ V1, such that (i) HV1 (cid:54)= ∅ and at least two of the following three conditions hold: (1) H(V1, S1) (cid:54)= ∅ and H(V1, S1)V2 (cid:54)= {∅}, (2) H(V1, S2) (cid:54)= ∅, H(V1, S2)V2 (cid:54)= {∅}, (3) H(V1, S1 ∪ S2) (cid:54)= ∅, H(V1, S1 ∪ S2)V2 (cid:54)= {∅}; (ii) V1 + HV1 ≥ 4, V2 + HV2 ∪ H(V1, S1) ∪ H(V1, S2) ∪ H(V1, S1 ∪ S2) ≥ 4; 6 (iii) for all H ∈ H with H ∩ V1 (cid:54)= ∅ and H ∩ V2 (cid:54)= ∅: either H ∩ V1 = S1, H ∩ V1 = S2, or H ∩ V1 = S1 ∪ S2. Discovering if H is a network hypergraph, or isomorphic to H0, and if not finding a decomposition as above can be done in polynomial time. Proof. We consider only the 2-sum and 3-sum decomposition rules as the other cases are immediate from the corresponding cases in Theorem 3. We define V1 and V2 to be the sets of columns of the matrices A1 and A2 in Theorem 3. Consider the 2-sum case. Since R has rank 1, each nonzero row in R is a copy of some row vector e ∈ {0, 1}V1. Let S = {i ∈ V1 ei = 1}. Then by the decomposition of the matrix A in this case, all hyperedges H ∈ H[A] such that H ∩ V1 (cid:54)= ∅ and H ∩ V2 (cid:54)= ∅, have H ∩ V1 = S. Consider next the 3-sum -- case 1 in Theorem 3. Since R and Q have rank 1, each nonzero row in R (resp., Q) is a copy of some row vector e ∈ {0, 1}V1 (resp. f ∈ {0, 1}V2). Let S1 = {i ∈ V1 ei = 1} and S2 = {i ∈ V2 fi = 1}. Then by the decomposition of the matrix A in this case, all hyperedges H ∈ H[A] such that H ∩ V1 (cid:54)= ∅ and H ∩ V2 (cid:54)= ∅, have either H ∩ V1 = S1 or H ∩ V2 = S2. Consider finally the 3-sum -- case 2 in Theorem 3. Since R has rank 2, there exist two rows a, b ∈ {0, 1}V1 of R that are linearly independent, such that any other row c ∈ {0, 1}V1 of R can be written as c = λ1a + λ2b, where λ1, λ2 ∈ R. We consider three subcases: (I) aT b (cid:54)= 0 and neither a ≥ b nor b ≥ a: then (λ1, λ2) ∈ {(0, 0), (1, 0), (0, 1)}. Let S0 = {i ∈ V1 ai = 1 and bi = 1}, S1 = {i ∈ V1 ai = 1 and bi = 0}, and S2 = {i ∈ V1 ai = 0 and bi = 1}. Then by the decomposition of the matrix A in this case, all hyperedges H ∈ H[A] such that H ∩ V1 (cid:54)= ∅ and H ∩ V2 (cid:54)= ∅, have either H ∩ V1 = S0∪ S1, or H ∩ V1 = S0∪ S2. This corresponds to case 2 of the 3-sum decomposition in the corollary. (II) aT b (cid:54)= 0 and a ≥ b (resp., b ≥ a): then (λ1, λ2) ∈ {(0, 0), (1, 0), (0, 1), (1,−1)} (resp., (λ1, λ2) ∈ {(0, 0), (1, 0), (0, 1), (−1, 1)}). Let S1 = {i ∈ V1 ai = 1 and bi = 1}, and S2 = {i ∈ V1 ai = 1 and bi = 0} (resp., S2 = {i ∈ V1 ai = 0 and bi = 1}). Then by the decomposition of the matrix A in this case, all hyperedges H ∈ H[A] such that H ∩ V1 (cid:54)= ∅ and H ∩ V2 (cid:54)= ∅, have either H ∩ V1 = S1, H ∩ V1 = S2, or H ∩ V1 = S1 ∪ S2. This corresponds to case 3 of the 3-sum decomposition in the corollary. (III) aT b = 0: then λ1, λ2 ∈ {0, 1}. Let S1 = {i ∈ V1 ai = 1 and bi = 0}, and S2 = {i ∈ V1 ai = 0 and bi = 1}. Then by the decomposition of the matrix A in this case, all hyperedges H ∈ H[A] such that H ∩ V1 (cid:54)= ∅ and H ∩ V2 (cid:54)= ∅, have either H ∩ V1 = S1, H ∩ V1 = S2, or H ∩ V1 = S1 ∪ S2. This corresponds to case 3 of the 3-sum decomposition in the corollary. Finally, we verify the boundary conditions. For the 1-sum case, HV1,HV2 are nonempty because of the requirement that m1, m2 ≥ 1 in Theorem 3. Consider next the 2-sum case. HV1 (cid:54)= ∅ follows from the requirement that m1 ≥ 1 in Theorem 3. If H(V1, S)V2 = {∅} then, by the simplicity of H, we would have H(V1, S) = {S} ∈ HV1, which would imply that we are also in the 1-sum case. Consider next the 3-sum case 1. H(V1, S1) (cid:54)= ∅ and H(V2, S2) (cid:54)= ∅ follow, respectively, from the requirements that m1 ≥ 1 and m2 ≥ 1 in Theorem 3. If either H(V1, S1)V2 = {∅} or H(V2, S2)V1 = {∅} then, again by the simplicity of H, we are in the 1-sum or the 2-sum cases. Next consider the 3-sum -- case 2. Note that HV1 (cid:54)= ∅, H(V1, S0 ∪ S1) (cid:54)= ∅ and H(V1, S0 ∪ S2) (cid:54)= ∅ in this case. If either H(V1, S0 ∪ S1)V2 = {∅} (resp., H(V1, S0 ∪ S2)V2 = {∅}) then by the simplicity of H, we would have H(V1, S0 ∪ S1) = {S0 ∪ S1} ∈ HV1 (resp., H(V1, S0 ∪ S2) = {S0 ∪ S2} ∈ HV1), implying that we are in either the 1-sum or the 2−sum cases. A similar argument applies for 3-sum -- case 3. (cid:3) A schematic illustration of these decomposition rules is given in Figures 1 and 2. 7 Remark 1 We note that the boundary condition (ii) in the 3-sum -- case 1 is essential, since without insisting on this condition, any hypergraph can be decomposed according to the 3-sum -- case 1 rule (take any v ∈ V and H ∈ H such that v ∈ H, and let V1 = S1 = {v}, V2 = V \ {v} and S2 = H \ {v}). Similarly, our analysis in the 3-sum -- case 3 uses condition (ii). However, a similar condition is not needed for all other cases. Figure 1: Decomposing a unimodular hypergraph: 1 and 2-sums. Figure 2: Decomposing a unimodular hypergraph: 3-sum. 3 Decomposition of the hypergraph transversal problem In the following, we show how to decompose the hypergraph transversal problem for a unimodular hypergraph H, given the decomposition of H as in Corollary 2. Such a decomposition yields naturally a recursive algorithm: each non-leaf node of the recursion tree is responsible for computing the dual of a unimodular hypergraph, while leaves involve the computation of the dual of a network hypergraph or the hypergraph H0. To ensure that the overall running time is polynomial, we need to bound the number of nodes of the recursion tree and the local computation time at each node, which consists of the time required for computing the decomposition and the time for combining the outputs from the recursive calls into the final output at the node. We will measure the "volume" of each subproblem to compute Tr(H) by µ(H) = nmk = n(H)m(H)k(H). We let T (µ) be the number of nodes of the recursion subtree rooted at a node of volume µ, and let L1(µ) and L2(µ) be respectively the local computation time for the decomposition and combining the outputs at a node of volume µ. We stop the recursion when either m = m(H), n = n(H) or k = k(H) drops below some constant C, in which case the hypergraph transversal problem can be solved in poly(n, m) time using a simple procedure, such as Berge Multiplication [Ber89, Chapter 2] for n(H) ≤ C or n(H) ≤ C, and the methods in [BI95, GK99] for k(H) ≤ C, which also show that the condition k(H) ≤ C can be checked in poly(n, m) time. 8 We will show by induction (on µ ≥ 1) that T (µ) ≤ µ. We also show that L2(µ) = O(µc) for some constant c ≥ 1. Since L1(µ) = poly(n, m) [Sch86, Chapter 20], it would follow then that the total time to compute Tr(H) is at most O(µ1+c) + poly(µ), which is polynomial in n, m, and k. This would give a total polynomial-time algorithm for computing Tr(H) which can be converted into an incremental polynomial-time algorithm by standard methods [KBE+05, BEGM09]. Thus, we shall assume in the sequel that n, m, k are larger than any desired constant C. Without loss of generality we assume that the input hypergraph is Sperner and irredundant, and this assumption is maintained for all hypergraphs arising as inputs to the recursive subproblems. We may also assume that H has neither a singleton hyperedge nor a vertex of degree 1 (i.e., contained in exactly one hyperedge). Indeed, if H contains a singleton hyperedge H = {v}, then by the Sperner property, no other hyperedge of H contains v. In this case, and also in the case when H has a vertex v contained exactly in one hyperedge H ∈ H, Tr(H) can be computed as follows: Tr(H) = Tr((H \ {H}) ∪ {H}) = Tr((H \ {H})∧ Tr({H}), (2) where Tr({H} = {{w} w ∈ H}. By Proposition 1 (iii), Tr((H \ {H}) ≤ k(H) and thus, µ(H(cid:48)) ≤ (n − 1)(m − 1)k ≤ µ(H) − 1. Thus, we get by induction that T (µ(H)) ≤ 1 + T (µ(H(cid:48))) ≤ µ(H). Moreover, by (2), Tr(H) can be computed from Tr((H \ {H}) in L2(µ) = poly(n, m, k) time. Indeed, if it has two such vertices v, v(cid:48) then we can reduce the problem by calling the algorithm on the hypergraph H(cid:48) = {H \ {v(cid:48)} H ∈ H} instead of H. Then the dual of H can be obtained as follows: Finally, we may also assume that H does not have two identical vertices. Tr(H) = Tr(H(cid:48)) ∪{(T \ {v} ∪ {v(cid:48)}) T ∈ Tr(H(cid:48)), v ∈ T}. (3) Note that (3) implies that k(H(cid:48)) ≤ k(H) and hence µ(H(cid:48)) ≤ (n − 1)mk ≤ µ(H) − 1. Thus, in this case, we get the recurrence T (µ) ≤ 1 + T (µ − 1), which again gives by induction on µ ≥ 1 that T (µ) ≤ 1 + (µ− 1) ≤ µ. Moreover, by (3), Tr(H) can be computed from Tr(H(cid:48)) in poly(n, m, k) time. We will use the following simple facts in our analysis of the running time of the algorithm. Fact 1 Let α, β, N, M be positive integers such that α ≤ N/2 and β ≤ M/2. Consider the maxi- mization problem: z∗ = max x1y1 + x2y2 s.t. x1 + x2 ≤ N, y1 + y2 ≤ M, x1, x2 ≥ α, y1, y2 ≥ β, x1, x2, y1, y2 ∈ Z. 1, x∗ 2, y∗ 1, y∗ 1 ≥ N 2) be an optimal solution. Clearly, x∗ 1 < M − β, then (x∗ Then z∗ = αβ + (N − α)(M − β). Proof. Let (x∗ loss of generality assume that x∗ an optimal solution since 1)(M − y∗ 1 + (N − x∗ 1y∗ 1 + 1)) = x∗ 1(y∗ x∗ 1). 1, M − β, β) is also an optimal solution. A symmetric 1, N − x∗ Thus we conclude in this case that (x∗ argument shows that (N − α, α, M − β, β) is an optimal solution of the maximization problem. (cid:3) 1 + (N − x∗ 1− N ≥ x∗ 1y∗ 1. Without 1 − 1) is also 2 = N − x∗ 1, N − x∗ 1 and y∗ 1, y∗ 2 = M − y∗ 1 + 1, M − y∗ 1)(M − y∗ 1) + 2x∗ 2 . If y∗ 1 + 1) + (N − x∗ 1)(M − (y∗ 9 Fact 2 Let xi, yi, for i = 1, . . . , h, and M be positive integers such that (cid:80)h (cid:80)h i=1(xi + yi) ≤ M + h. i=1 xiyi ≤ M . Then Proof. For i = 1, . . . , h, let αi = xiyi. Note that the function f (xi) = xi + α is convex in xi > 0, and hence max{xi + yi xiyi = αi, xi ≥ 1, yi ≥ 1} is achieved at the boundary (xi, yi) = (1, αi) or xi (xi, yi) = (αi, 1). The claim follows by summing the inequality xi + yi ≤ αi + 1 over i = 1, . . . , h. (cid:3) 3.1 1-sum decomposition Given a nontrivial partition V1 ∪V2 = V such that for all H ∈ H: either H ⊆ V1 or H ⊆ V2, we have the following decomposition of the dual hypergraph by Proposition 2: Tr(H) = Tr(HV1 ∪HV2) = Tr(HV1) ∧ Tr(HV2). (4) Note that both HV1 and HV2 are unimodular. Thus in this case we get the recurrence: T (µ) ≤ 1 + T (µ1) + T (µ2), (5) where µ = µ(H), µ1 = µ(HV1), and µ2 = µ(HV2). Let n1 = V1, m1 = HV1, k1 = Tr(HV1), n2 = V2, m2 = HV2, and k2 = Tr(HV2). Note that n1, n2, m1, m2 ≥ 1, n1 + n2 = n and m1 + m2 = m by the assumptions of the 1-sum case (Corollary 2) and hence µ1, µ2 ≥ 1. By Proposition 1(iii), k1 ≤ k and k2 ≤ k (in fact, k1k2 = k). Thus, it follows by Fact 1 and n ≥ 2, m ≥ 2 and k ≥ 1 that µ1 + µ2 = n1m1k1 + n2m2k2 ≤ (n1m1 + n2m2)k ≤ [1 + (n − 1)(m − 1)]k = [2 + nm − n − m]k ≤ (nm − 2)k ≤ nmk − 2 = µ − 2. (6) It follows by induction from (5) that (7) Note also that Tr(H) can be computed from Tr(HV1) and Tr(HV2) using (4) in time L2(µ) = poly(n, m, k). T (µ) ≤ 1 + µ1 + µ2 ≤ 1 + (µ − 2) ≤ µ. 3.2 2-sum decomposition Given a nontrivial partition V1 ∪V2 = V and a nonempty set S ⊆ V1 such that for all H ∈ H with H ∩ V1 (cid:54)= ∅ and H ∩ V2 (cid:54)= ∅: H ∩ V1 = S, we have the following decomposition of the dual hypergraph by Proposition 2: (8) ∪HV2∪S (note that HV1 ∩ HV2∪S = ∅ since H is Sperner and that both HV1 and HV2∪S as H = HV1 are unimodular). Thus in this case we get the recurrence: Tr(H) = Tr(HV1 ∪HV2∪S) = Tr(HV1) ∧ Tr(HV2∪S), T (µ) ≤ 1 + T (µ1) + T (µ2), (9) where µ = µ(H), µ1 = µ(HV1), and µ2 = µ(HV2∪S). Let n1 = n(HV1) = V1, m1 = HV1, k1 = Tr(HV1), n2 = n(HV2∪S) = V2 + S, m2 = HV2∪S, and k2 = Tr(HV2∪S). Note that n1, n2, m1, m2 ≥ 1 by the assumptions of the 2-sum case (Corollary 2) and hence µ1, µ2 ≥ 1. Then (10) µ1 + µ2 = n1m1k1 + n2m2k2 ≤ (n − 1)(m1 + m2)k = (n − 1)mk ≤ µ − 1, where k1 ≤ k and k2 ≤ k by Proposition 1 (iii). It follows by induction from (9) that (11) Note that Tr(H) can be computed from Tr(HV1) and Tr(HV2∪S) using (8) in time L2(µ) = poly(n, m, k). T (µ) ≤ 1 + µ1 + µ2 ≤ 1 + (µ − 1) = µ. 10 3.3 3-sum decomposition - case 1 Assume we are given a nontrivial partition V1 ∪V2 = V and two nonempty sets S1 ⊆ V1 and S2 ⊆ V2, such that for all H ∈ H with H ∩ V1 (cid:54)= ∅ and H ∩ V2 (cid:54)= ∅: either H ∩ V1 = S1 or H ∩ V2 = S2. Let n1 = V1, n2 = V2, m1 = HV1 ∪ H(V2, S2) and m2 = HV2 ∪ H(V1, S1). It is also assumed in this case that n1, n2, m1, m2 ≥ 1, n1 + n2 = n, m1 + m2 = m, n1 + m1 ≥ 4 and n2 + m2 ≥ 4, and that H(V1, S1) and H(V2, S2) are not empty. We consider two cases: Case I: there is no hyperedge H ∈ H such that H ⊆ S1 ∪ S2. Note that this, together with assumption (i) of the 3-sum -- case 1 in Corollary 2, implies that S1 ⊂ V1 and S2 ⊂ V2. In this case, we have the following decomposition of the dual hypergraph: Tr(H) = Tr(HV1∪S2 ∪HV2∪S1) = Tr(HV1∪S2) ∧ Tr(HV2∪S1), (12) (Note by assumption that HV1∪S2 ∩ HV2∪S1 = ∅.) Thus in this case we get the recurrence: T (µ) ≤ 1 + T (µ1) + T (µ2), where µ = µ(H), µ1 = µ(HV1∪S2), and µ2 = µ(HV2∪S1). Let n(cid:48) HV1∪S2, k1 = Tr(HV1∪S2), n(cid:48) Then (13) 1 = n(HV1∪S2) = V1 + S2, m1 = 2 = n(HV2∪S1) = V2 + S1, m2 = HV2∪S1, and k2 = Tr(HV2∪S1). µ1 + µ2 = n(cid:48) 1m1k1 + n(cid:48) 2m2k2 ≤ (n − 1)(m1 + m2)k ≤ µ − 1, (14) where k1 ≤ k and k2 ≤ k by Proposition 1 (iii). It follows by induction from (13) that T (µ) ≤ 1 + µ1 + µ2 ≤ µ. (15) Note that Tr(H) can be computed from Tr(HV1∪S2) and Tr(HV2∪S1) using (12) in time L2(µ) = poly(n, m, k). Case II: there is a hyperedge H0 ∈ H such that H0 ⊆ S1 ∪ S2. Note that H0 ∩ S1 (cid:54)= ∅ and H0 ∩ S2 (cid:54)= ∅ since otherwise by the simplicity of H we are in the 2-sum case. Without loss of generality, assume that H0 ∩ V1 = S1 and H0 ∩ V2 ⊆ S2. We assume that H(V1, S1) and H(V2, S2) are not empty; otherwise, we are in the 1-sum or 2-sum cases. Given these assumptions, we use the following decomposition of the dual hypergraph: Tr(H) = Tr(H1∪H2) = Tr(H1) ∧ Tr(H2), (16) ∪H(V1, S1). Note that H0 is the the only where H1 = HV1 ∪ H(V2, S2) ∪ {H0} and H2 = HV2 hyperedge that belongs to both H1 and H2. Note also that neither H1 nor H2 may be a projection of H (i.e., of the form HS for some S ⊆ V ) since there are hyperedges H ⊆ S1 ∪ S2 that may not be included in H1 and H2. Hence, Proposition 1 cannot be used to bound the sizes of Tr(H1) and Tr(H2). Nevertheless, due to the special structure of the decomposition in this case, we can use the bounds given in Lemma 2 below instead. Let ¯H1 ⊆ 2V1∪{v2} (resp., ¯H2 ⊆ 2V2∪{v1}) be the hypergraph obtained from H1 (resp., H2) by replacing S2 (resp., S1) by a new single vertex v2 (resp., v1), that is, ¯H1 = HV1 ∪ ¯H(V2, S2) ∪ { ¯H0}, ¯H2 = HV2 ∪ ¯H(V1, S1), where ¯H(V2, S2) = {(H \ S2) ∪ {v2} H ∈ H(V2, S2)}, ¯H0 = (H0 \ S2) ∪ {v2}, and ¯H(V1, S1) = {(H \ S1) ∪ {v1} H ∈ H(V1, S1)}. 11 Lemma 1 If H is unimodular, then both ¯H1 and ¯H2 are unimodular. Proof. Let v be an arbitrary vertex in H0 ∩ S2. Then the (hyperedge-vertex) incidence matrix of the hypergraph ¯H1 is a submatrix of that of H, with rows restricted to HV1 ∪ H(V2, S2) ∪ {H0}, and columns restricted to V1 ∪ {v}. This shows that this submatrix is totally unimodular. A similar argument shows that ¯H2 is also unimodular. (cid:3) 1 and T (cid:48) 2 are distinct. Lemma 2 Tr( ¯H1) ≤ Tr(H) and Tr( ¯H2) ≤ Tr(H). Proof. We prove the claim that Tr( ¯H1) ≤ Tr(H); the other claim can be proved similarly. It is enough to show that for every minimal transversal T ∈ Tr( ¯H1), there is a minimal transversal T (cid:48) ∈ Tr(H) such that for any distinct T1, T2 ∈ Tr( ¯H1), T (cid:48) Let T1 = {T ∈ Tr( ¯H1) : v2 (cid:54)∈ T} and T2 = Tr( ¯H1) \ T1. Consider first T ∈ T1. By assumption T ∩ S1 (cid:54)= ∅ since T has a nonempty intersection with ¯H0. It follows that the only hyperedges of H having empty intersection with T are those in HV2. Note that none of these hyperedges are contained in S2 since H is Sperner. This implies that HV2\S2 ) (cid:54)= ∅. Let T (cid:48)(cid:48) be an arbitrary minimal transversal in Tr(HV2\S2 ). Then it is easy to see that T (cid:48) = T ∪ T (cid:48)(cid:48) is in Tr(H). Consider now T ∈ T2. By the minimality of T , there is a hyperedge H ∈ ¯H(V2, S2) ∪ { ¯H0} such that H ∩ T = {v2}. Furthermore, for every v ∈ T \{v0}, there is an H ∈ HV1 such that T ∩ H = {v}. Let H(T ) = {H ∈ H H ∩ T \ {v2} = ∅} and note that H(T )V2 is nontrivial. Pick T (cid:48)(cid:48) ∈ Tr(H(T )V2) arbitrarily. Then it is easy to see that T (cid:48) = T ∪ T (cid:48)(cid:48) is in Tr(H). Finally, note that for any distinct T1, T2 ∈ T1 (resp., T1, T2 ∈ T2), the constructed minimal transversals T (cid:48) 2 are distinct because T (cid:48) (cid:3) To compute (16), we find Tr( ¯H1) and Tr( ¯H2), recursively. Then Tr(H1) and Tr(H2) are given by 2 ∈ T (H) are distinct. Moreover, for T1 ∈ T1 and T2 ∈ T2, T (cid:48) (cid:54)= {∅} and therefore Tr(HV2\S2 1 ∩ S2 = ∅ while T (cid:48) 2 ∩ S2 (cid:54)= ∅. 1 and T (cid:48) 1, T (cid:48) V2 V2 V2 1 . Then the following claim. Lemma 3 Let T1 = {T ∈ Tr( ¯H1) v2 (cid:54)∈ T}, T2 = {T ∈ Tr( ¯H1) v2 ∈ T, S1 ∩ T = ∅}, T3 = Tr( ¯H1) \ (T1 ∪ T2), T (cid:48) Tr(H1) = T1 ∪{(T \ {v2}) ∪ {v} v ∈ H0 ∩ S2 and T ∈ T2} ∪{(T \ {v2}) ∪ {v} v ∈ S2 and T ∈ T3}, (17) 1 = {T ∈ Tr( ¯H2) v1 (cid:54)∈ T} and T (cid:48) 2 = Tr( ¯H2) \ T (cid:48) 1 ∪{(T \ {v1}) ∪ {v} v ∈ S1 and T ∈ T (cid:48) 2}. Tr(H2) = T (cid:48) (18) Proof. Let us prove (17), since the proof of (18) is similar. Suppose T ∈ Tr(H1). If T ∩ S2 = ∅ then (it is easy to see that) T ∈ T1. If T ∩ S2 (cid:54)= ∅ then by minimality of T , T ∩ S2 = 1; let T ∩ S2 = {v}. If T ∩ S1 = ∅ then necessarily v ∈ H0, in which case (T \ {v}) ∪ {v2} ∈ T2; otherwise v can be any element in S2, and hence, (T \ {v}) ∪ {v2} ∈ T3. On the other direction, if T ∈ T1 then clearly T ∈ Tr(H1); if T ∈ T2 then T ∩ ¯H0 = {v2} which implies that (T \ {v2}) ∪ {v} ∈ Tr(H1) for every v ∈ H0 ∩ S2; finally, if T ∈ T3 then there is a hyperedge H ∈ ¯H(V2, S2) such that H ∩ T = {v2}, which implies in turn that (T \ {v2}) ∪ {v} ∈ Tr(H1). (cid:3) Note that Tr(H) can be computed from Tr( ¯H1) and Tr( ¯H2) using (16) and Lemma 3 in time 2 = n( ¯H2) = n2 + 1, Let n(cid:48) 1 + m2 = m + 1, and L2(µ) = poly(n, m, k). m2 = ¯H2, and k2 = Tr( ¯H2). By the decomposition, n(cid:48) 1 = ¯H1 ∈ {m1, m1 + 1}, k1 = Tr( ¯H1), n(cid:48) 2 = n + 2 and m(cid:48) 1 = n( ¯H1) = n1 + 1, m(cid:48) 1 + n(cid:48) 12 by Lemma 2, k1 ≤ k and k2 ≤ k. Note that n(cid:48) by the assumptions of the 3-sum case 1 in Corollary 2. 2 ≥ 2, m(cid:48) 1, n(cid:48) 1, m2 ≥ 1, n1 + m1 ≥ 4, and n2 + m2 ≥ 4, We consider 3 subcases. Case II-I: 2 ≤ n(cid:48) 1 ≤ 3. Then a simple procedure will be used to compute Tr( ¯H1), and hence we need only to recurse on ¯H2, giving the simpler recurrence: T (µ) ≤ 2 + T (µ2). Note that m2 ≤ m− 2 since n1 ≤ 2 implies m1 ≥ 2 and hence m2 = m − m1 ≤ m − 2. Since µ2 = n(cid:48) 2m2k2 ≤ n(m − 2)k ≤ µ − 2, we get by induction that T (µ) ≤ 2 + µ2 ≤ µ. (19) 2 = 2. Then a simple procedure will be used to compute Tr( ¯H2), and hence we need Case II-II: n(cid:48) only to recurse on ¯H1, giving the simpler recurrence: T (µ) ≤ 2 + T (µ1). As above, m1 ≤ m − 3 implying that µ1 = n(cid:48) Case II-III: n(cid:48) 1 = 1 (resp., m2 = 1), then HV1 = ∅ and H(V2, S2) = {H0} (resp., HV2 = ∅ and H(V1, S1) = {H0}). Since we assume that H does not have identical vertices, we must have n1 = 1 (resp., n2 = 1). In either case we get a contradiction to the boundary assumtpions (ii) of the 3-sum -- case 1 in Corollary 2. Lemmas 1 and 3 imply that, in this case, we get the recurrence: 1k2 ≤ n(m − 2)k ≤ µ − 2, and giving by induction again that T (µ) ≤ µ. 2 ≥ 3. We first note that m(cid:48) 1, m2 ≥ 2. Indeed, if m(cid:48) 1 ≥ 4 and n(cid:48) 1m(cid:48) T (µ) ≤ 1 + T (µ1) + T (µ2), (20) where µ = µ(H), µ1 = µ( ¯H1), and µ2 = µ( ¯H2). Then by Fact 1, applied with x1 = n(cid:48) and β = 2, we get (as n ≥ 5 and m ≥ 3) 1, y1 = m(cid:48) 1, x2 = n(cid:48) 2, y2 = m2, N = n + 2, M = m + 1, α = 3 µ1 + µ2 = n(cid:48) 1m(cid:48) 1k1 + n(cid:48) 2m2k2 ≤ (n(cid:48) 1m(cid:48) 1 + n(cid:48) 2m2)k ≤ ((n − 1)(m − 1) + 6)k = nmk − (n + m − 7)k ≤ µ − 1. It follows by induction from (20) that T (µ) ≤ 1 + µ1 + µ2 ≤ µ. (21) (22) 3.4 3-sum decomposition - case 2 Let H1 = HV1 and H2 = HV2. By Corollary 2, we have three nonempty disjoint sets S0, S1, S2 in V2, and the following two families are nonempty: F1 = {H ∈ H H ∩ V1 = S0 ∪ S2, H ∩ V2 (cid:54)= ∅}, F2 = {H ∈ H H ∩ V1 = S0 ∪ S1, H ∩ V2 (cid:54)= ∅}. Note that V1, V2 (cid:54)= ∅, H1 (cid:54)= ∅, and H can be partitioned in the following way. where ∪ denotes the disjoint union. For i = 0, 1, 2, let H = H1 ∪H2 ∪F1 ∪F2, Ti = {T ∈ Tr(H1) T ∩ Si (cid:54)= ∅, T ∩ Sj = ∅ (j (cid:54)= i)}, and let T = Tr(H1) \ (T0 ∪ T1 ∪ T2). 13 (23) (24) (25) (26) (27) By definition, we have Let Tr(H1) = T ∪T0 ∪T1 ∪T2. P = HS0∪S1∪S2 (= {H ∈ H H ⊆ S0 ∪ S1 ∪ S2}). (28) (29) We separately consider the following 4 cases. Case I: P = ∅. Case II: P = {S0 ∪ S1 ∪ S2}. Case III: P (cid:54)= ∅,{S0 ∪ S1 ∪ S2} and T (cid:54)= ∅. Case IV: P (cid:54)= ∅,{S0 ∪ S1 ∪ S2} and T = ∅. Case I H can be partitioned into H1 and HS0∪S1∪S2∪V2, i.e., H = H1 ∪HS0∪S1∪S2∪V2 and H1,HS0∪S1∪S2∪V2 (cid:54)= ∅. Since Tr(H) = Tr(H1)∧Tr(HS0∪S1∪S2∪V2), we obtain Tr(H) by computing Tr(H1) and Tr(HS0∪S1∪S2∪V2). Let n1 = V1, m1 = H1, k1 = Tr(H1), n(cid:48) 2 = HS0∪S1∪S2∪V2, k2 = Tr(HS0∪S1∪S2∪V2). Similar to the 2-sum decomposition case, we can show that T (µ) ≤ µ and the computation of Tr(H) can be done in time L2(µ) = poly(n, m, k). 2 = S0 ∪ S1 ∪ S2 ∪ V2, m(cid:48) Case II We consider two cases: II-I: H1 ≥ 2 and II-II: H1 = 1. Case II-I: H1 ≥ 2. Let G be a hypergraph obtained from HS0∪S1∪S2∪V2 by replacing S0, S1, and S2 by new vertices v0, v1 and v2, respectively. For any hyperedge H ∈ HS0∪S1∪S2∪V2, H ∩ Si (cid:54)= ∅ implies that Si ⊆ H. Thus G is well-defined. Note that Tr(HS0∪S1∪S2∪V2) can be obtained from Tr(G) in polynomial time by replacing vi with any element in Si. Since H = H1 ∪ HS0∪S1∪S2∪V2, we have Tr(H) = Tr(H1) ∧ Tr(HS0∪S1∪S2∪V2). We thus decompose H into H1 and G. Namely we compute Tr(H) from Tr(H1) and Tr(G). Since Tr(H1), Tr(G) ≤ Tr(H) (= k), this can be done in time L2(µ) = poly(n, m, k). Let us next show that T (µ) ≤ µ. Let n1 = V1, m1 = H1, k1 = Tr(H1), n(cid:48) 2 = V2+3, 2 = G, and k2 = Tr(G). Note that H = H1 ∪HS0∪S1∪S2∪V2, H1 ∩HS0∪S1∪S2∪V2 = {S0 ∪ S1 ∪ S2}. m(cid:48) This, together with definition and the discussion above, implies that 1 ≤ n1, n(cid:48) 2 ≤ n, n1 + n(cid:48) 2 = n + 3, 2 ≤ m1, m(cid:48) 2 ≤ m − 1, m1 + m(cid:48) 2 = m + 1, k1, k2 ≤ k. Thus we have n1m1k1 + n(cid:48) 2m(cid:48) 2k2 ≤ (n1m1 + n(cid:48) 2m(cid:48) 2)k ≤ (n(m − 1) + 6)k ≤ nmk − 1 (30) where Fact 1 is used for the second inequality, and the third ineuqality is obtained by assuming that n is at least 7. It follows from (30) that T (µ) ≤ µ. We recall that Tr(H) is directly computed from H if at least one of n, m, and k is bounded by some constant C. Thus in case n < 7, we have T (µ) = 1, which also satisfies T (µ) ≤ µ. Case II-II: H1 = 1. In this case, we have H1 = {S0 ∪ S1 ∪ S2}. Therefore, the following lemma is satisfied. Lemma 4 Let H be a hypergraph that satisfies (25) and H1 = {S0 ∪ S1 ∪ S2}. Then we have Tr(H) = {{v} v ∈ S0} ∧ Tr(H2) ∪ Tr(H V \S0). 14 Proof. From the definition, it is not difficult to see that Tr(H) ⊇ {{v} v ∈ S0} ∧ Tr(H2) ∪ Tr(H V \S0). For the converse inclusion, let T ∈ Tr(H). If T ∩ S0 = ∅, then T is contained in Tr(H V \S0). Assume next that T ∩ S0 (cid:54)= ∅. For any i = 0, 1, 2 and any hyperedge H ∈ H, H ∩ Si (cid:54)= ∅ inplies that S0 ⊆ H. This means that T ∩S0 = 1 and T ∩Si = ∅ for i = 1, 2. Moreover, we have T ∩V2 ∈ Tr(H2), (cid:3) which completes the converse inclusion. Note that H2,HV \S0 (cid:54)= {∅}, and hence Tr(H2), Tr(H V \S0) (cid:54)= ∅. Based on Lemma 4, we de- compose H into H2 and HV \S0. Namely, we compute Tr(H) from Tr(H2) and Tr(H V \S0) in time L2(µ) = poly(n, m, k). 2 = Tr(HV \S0). 1 = V2, m(cid:48) 2 ≤ k. Thus we have 1, n(cid:48) Then we have n(cid:48) 2 ≤ (n − 1)(m − 1)k ≤ nmk − 1, where the last inequality is obtained from n ≥ 3. n(cid:48) 1m(cid:48) 2m(cid:48) 2k(cid:48) This implies that T (µ) ≤ µ. 1 = Tr(H2), n(cid:48) 1, m(cid:48) 1 = H2, k(cid:48) 2 ≤ n − 1, m(cid:48) 2 ≤ k − 1 and k(cid:48) 2 = n − S0, m(cid:48) 2 = HV \S0, and k(cid:48) 2 ≤ m, and k(cid:48) 1, k(cid:48) Let n(cid:48) 1k(cid:48) 1 + n(cid:48) 1 + k(cid:48) Case III For a set W ⊆ V , define η(W ) ⊆ {0, 1, 2} by For i = 1, 2, let η(W ) = {i W ∩ Si (cid:54)= ∅}. F(cid:48) i = Min(F V2 i ∪ H2). (31) Lemma 5 Let H be a hypergraph that satisfies (25) and P (cid:54)= ∅. For a minimal transversal T ∈ Tr(H), the following statements are satisfied. (i) If η(T ) = {0}, then T ∩ V1 ∈ T0 and T ∩ V2 ∈ Tr(H2). (ii) If η(T ) = {i} for i = 1, 2, then T ∩ V1 ∈ Ti and T ∩ V2 ∈ Tr(F(cid:48) i). (iii) If η(T ) = {i, j}, then T ∩V2 ∈ Tr(H2), and moreover, exactly one of the following two conditions holds. (iii-1) T ∩ V1 ∈ T . (iii-2) There exists a vertex v such that either (cid:0)T ∩ Si = {v} and (T \ {v}) ∩ V1 ∈ Tj (cid:0)T ∩ Sj = {v} and (T \ {v}) ∩ V1 ∈ Ti (cid:1). (cid:1) or (iv) If η(T ) = {0, 1, 2}, then T ∩ V1 ∈ T and T ∩ V2 ∈ Tr(H2). Proof. Let T be a minimal transversal of H. Since P (cid:54)= ∅, we have η(T ) (cid:54)= ∅. (i) and (ii). Let η(T ) = {i} for some i. We first show that T ∩ V1 is a minimal transveral of H1, implying that T ∩ V1 ∈ Ti. By definition, T ∩ V1 is a transveral of H1. Since T ∈ Tr(H), for each w ∈ T ∩ V1, there exists a hyperedge Hw ∈ H such that Hw ∩ T = {w}. For w ∈ T ∩ (V1\ Si), we have Hw ∈ H1, implying that (T \ {w}) ∩ V1 is not a transveral of H1. For w ∈ T ∩ Si, if T ∩ Si = {w} holds, then we have (T \ w) ∩ P = ∅ for a P ∈ P (⊆ H1). Thus T ∩ V1 is a minimal transveral of H1. On the other hand, if T ∩ Si ≥ 2, we have Hw ∈ H1, since any H ∈ Fj (j (cid:54)= i) contains Si. This implies that T ∩ V1 is a minimal transveral of Tr(H1). If η(T ) = {0}, for any F ∈ F1 ∪ F2, we have F ∩ T (cid:54)= ∅. This implies that T ∩ V2 ∈ Tr(H2). 15 We next show that T ∩ V2 ∈ Tr(F(cid:48) i) if η(T ) = {i} for i = 1, 2. Since T ∩ (∪j(cid:54)=iSj) = ∅, T ∩ V2 is a transversal of Fi. Since T is a minimal transversal of H, for each w ∈ T ∩V2, there exists a hyperedge Hw ∈ H such that Hw ∩ T = {w}. Since w ∈ V2 and T ∩ Sj = ∅ for j ((cid:54)= i), Hw is contained in Fi ∪ H2. Thus T ∩ V2 is a minimal transversal of Fi ∪ H2, which implies that T ∩ V2 ∈ Tr(F(cid:48) i). (iii). Let η(T ) = {i, j}. By definition, we have T ∩ V2 ∈ Tr(H2). Let us assume that T ∩ V1 (cid:54)∈ T , and show that (iii-2) holds. Since T ∈ Tr(H), for each w ∈ T ∩ V1, there exists a hyperedge Hw ∈ H such that Hw ∩ T = {w}. For w ∈ T ∩ (V1\ (Si∪ Sj)), we have Hw ∈ H1, implying that (T \{w})∩ V1 is not a transveral of H1. However, since T ∩ V1 (cid:54)∈ T , there exists a v ∈ T ∩ V1 such that T \{v}∩ V1 is a transversal of H1. Thus v is contained in Si ∪ Sj. Let us assume that v ∈ Si, since otherwise we exchange i with j. For this v, we have Hv ∈ F1 ∪ F2. This means that j (cid:54)= 0 and Hv ∈ Fj. Since Si ⊆ Hv, T ∩ Si = {v} holds. We next show that (T \ {v}) ∩ V1 ∈ Tj. If T ∩ Sj = 1, say T ∩ Sj = {u} for some u, then (T \{v, u})∩ V1 is not a transversal of H1, since P (cid:54)= ∅. Thus in this case (T \{v})∩ V1 is a minimal transversal of H1, and is contained in Tj. On the other hand, if T ∩ Sj ≥ 2, then we have Hu ∈ H1 for any u ∈ T ∩ Sj. Thus it holds that (T \ {v}) ∩ V1 ∈ Tj. (iv). By definition, we have T ∩ V2 ∈ Tr(H2). Since T ∈ Tr(H), for each w ∈ T ∩ V1, there exists a hyperedge Hw ∈ H such that Hw ∩ T = {w}. For w ∈ T ∩ (V1 \ (S0 ∪ S1 ∪ S2)), we have Hw ∈ H1, implying that (T \ {w}) ∩ V1 is not a transveral of H1. For w ∈ T ∩ (S0 ∪ S1 ∪ S2), we again have Hw ∈ H1, implying that (T \ {w}) ∩ V1 is not a transveral of H1. Therefore, T ∩ V1 ∈ T holds. (cid:3) By Lemma 5, we can compute in polynomial time Tr(H) from Tr(H1) (= T ∪ T0 ∪ T1 ∪ T2) and Tr(H2), and Tr(F(cid:48) Lemma 6 Let H be a hypergraph that satisfies (25) and P (cid:54)= ∅. Then we have i) (i = 1, 2) if P (cid:54)= ∅. Tr(H) ⊆(cid:16)T0 ∪ T ∪ (cid:91) {T ∪ {v} T ∈ Ti, v ∈ S0 ∪ S3−i}(cid:17) ∧ Tr(H2) ∪ (cid:91) (Ti ∧ Tr(F(cid:48) i)). i=1,2 i=1,2 The following two lemmas show that Tr(H1), Tr(H2), and Tr(F(cid:48) i) (i = 1, 2) are bounded by the size of Tr(H), which immediately implies that the sum of their volume is bounded by the volume of H. Lemma 7 Let H be a hypergraph that satisfies (25). Then the following statements holds. (i) If T0 (cid:54)= ∅, then we have T0 ∧ Tr(H2) ∈ Tr(H). (ii) For i = 1, 2, we have Ti (cid:54)= ∅ and Ti ∧ Tr(F(cid:48) (iii) If T (cid:54)= ∅ and P (cid:54)= ∅, then T ∧ Tr(H2) ∈ Tr(H). Proof. (i). For each T1 ∈ T0 and T2 ∈ Tr(H2), T1 ∪ T2 is a transversal of Fj for any j. Thus T1 ∪ T2 is a minimal transversal of H. (ii). For i = 1, 2, Ti = ∅ if and only if there exists a hyperedge H such that H ⊆ ∪j(cid:54)=iSj. Since H is Sperner, the latter implies that Fi = ∅. Thus Fi (cid:54)= ∅ implies Ti (cid:54)= ∅. Morever, for each T1 ∈ Ti and T2 ∈ Tr(F(cid:48) i), T1 ∪ T2 is a transversal of Fj for j ((cid:54)= i). Thus T1 ∪ T2 is a minimal transversal of H. (iii). For each T1 ∈ T and T2 ∈ Tr(H2), T1 ∪ T2 is a transversal of Fj for any j, since η(T1) ≥ 2. Thus T1 ∪ T2 is a minimal transversal of H. (cid:3) i) ∈ Tr(H). As a corollary of Lemma 7, we have the following result. 16 Lemma 8 Let H be a hypergraph that satisfies (25), P (cid:54)= ∅ and T (cid:54)= ∅. Then we have (T ∪T0) ∧ Tr(H2) ∪ T1 ∧ Tr(F(cid:48) 1) ∪ T2 ∧ Tr(F(cid:48) 2) ⊆ Tr(H). Proof. Immediate from Lemma 7. (32) (cid:3) We remark that T , Tr(H2), Ti (i = 1, 2), and Tr(F(cid:48) i) (i = 1, 2) in Lemma 7 are all nonemtpy. Based on Lemmas 6 and 8, in Case III, our procedure decomposes H into 4 hypergraphs H1, However, T0 might be empty. H2, and F(cid:48) i (i = 1, 2). 1), m4 = F(cid:48) Let n1 = V1, n2 = V2, m1 = H1, k1 = Tr(H1), m(cid:48) 2 = H2, k2 = Tr(H2), m3 = F(cid:48) 1, k3 = Tr(F(cid:48) 2) = n2. By the assumptions in this case, n1 + n2 = n, n1, n2 ≥ 1, and m1, m3, m4 ≥ 1. Let k10 = T0 + T , k11 = T1 and k11 = T2. Then k1 = k10 + k11 + k12 and by the assumptions of this case and Lemma 7, we have k10, k11, k12, k2, k3, k4 ≥ 1. Moreover, Lemma 8 implies that 2). Note that n(H1) = n1, n(H2) = n(F(cid:48) 2 and k4 = Tr(F(cid:48) 1) = n(F(cid:48) Let µ1 = µ(H1), µ1 = µ(H2), µ3 = µ(F(cid:48) we do not recurse on H2, giving thus the recurrence: k10k2 + k11k3 + k12k4 ≤ k. 2). If m(cid:48) 1) and µ4 = µ(F(cid:48) (33) 2 = 0 then Tr(H2) = {∅} and hence T (µ) ≤ 1 + T (µ1) + T (µ3) + T (µ4). (34) In the general case, we get the recurrence Note that (33) implies by Fact 2 that(cid:80)4 T (µ) ≤ 1 + T (µ1) + T (µ2) + T (µ3) + T (µ4). (35) i=1 ki ≤ k + 3. Using n1, n2 ≥ 1 and k1, k2 + k3 + k4 ≥ 3, we get by Fact 1 that µ1 + µ2 + µ3 + µ4 = n1m1k1 + n2m(cid:48) 2k2 + n2m3k3 + n2m4k4 ≤ m[n1k1 + n2(k2 + k3 + k4)] ≤ m[3 + (n − 1)k] = m[nk − (k − 3)] ≤ µ − 1, (36) for k ≥ 4. Using (36) in (34) and (34), we get by induction that T (µ) ≤ µ in both cases. the sum of their volume(cid:80)2 Case IV By Lemma 5, we can compute in polynomial time Tr(H) from Tr(H1) and Tr(H2), and Tr(Fi) (i = 1, 2). However, in Case IV, T ∪ T0 might be empty. Hence, it is not clear from Lemma 8 that i=1(µ(Hi) + µ(F(cid:48) i)) is bounded by µ(H). We therefore deompose H in the way different from Case III, if T0 is empty. Since P (cid:54)= ∅,{S0 ∪ S1 ∪ S2}, there exist a vertex v∗ ∈ S0 ∪ S1 ∪ S2 and a hyperedge P ∈ P such that v∗ (cid:54)∈ P . Let us assume without loss of generality that v∗ ∈ S0 ∪ S2, and define In other word, any hyperedge H∗ ∈ F∗ v∗. Let T 0 be a family of minimal transversals T of F∗ minimal transversals T of F∗ 1 with v∗ ∈ T . F∗ 1 = {F ∪ {v∗} F ∈ F V2 1 } ∪ H2. (37) 1 \ H2 is obtained from H ∈ F1 by replacing S0 ∪ S2 by vertex 1 with v∗ (cid:54)∈ T , and let T 1 be a family of 17 Lemma 9 Let H be a hypergraph that satisfies (25). Then we have Tr(H2) ⊆ (T 1)V2 ∪ T 0 and T 0 = Tr(F(cid:48) 1). By Lemmas 5 and 9, we have the following inclusion. Lemma 10 Let H be a hypergraph that satisfies (25). Assume that T ,T0 = ∅ and P (cid:54)= ∅. Then we have {T ∪ {v} T ∈ Ti, v ∈ S0 ∪ S3−i}(cid:17) ∧(cid:16) (T 1)V2 ∪ T 0(cid:17) ∪ T1 ∧ T 0 ∪ T2 ∧ Tr(F(cid:48) Tr(H) ⊆(cid:16) (cid:91) 2). i=1,2 By this lemma, if T ,T0 = ∅ and P (cid:54)= ∅, we can compute in polynomial time Tr(H) from Tr(H1) (= T1 ∪ T2) and Tr(F∗ 1 ) (= T 0 ∪ T 1), and Tr(F(cid:48) 2) We next bound the size of three transversal hypergraphs Tr(H1) and Tr(F∗ 1 ), and Tr(F(cid:48) 2). Lemma 11 Let H be a hypergraph that satisfies (25) and T = ∅. Assume that v∗ ∈ S0 ∪ S2 and P ∈ P satisfy v∗ (cid:54)∈ P . Then for any T ∈ T1 and any U ∈ T 1, T ∪ U is a minimal transversal of H. Proof. By definition, T ∪ U is a transversal of H. Since U ∈ T 1, for any u ∈ U , T ∪ (U \{u}) is not a transversal of H. Assuming that T (cid:48) ∪ U is a minimal transversal of H such that T (cid:48) (cid:40) T , we derive a contradiction. Since T is a minimal transversal of H1, T (cid:48) is not a transversal of H1. However, by our assumption, T (cid:48) ∪ {v∗} is a transversal of H1, implying that there exist a minimal transversal T (cid:48)(cid:48) ∪ {v∗} of H1 such that T (cid:48)(cid:48) ⊆ T (cid:48). Note that T (cid:48)(cid:48) ∩ S1 (cid:54)= ∅, since we have a hyperedge P (∈ P) with v∗ (cid:54)∈ P . This implies that T (cid:48)(cid:48) ∪ {v∗} ∈ T , a contradiction. (cid:3) Lemma 12 Let H be a hypergraph that satisfies (25) and T = ∅. Let v∗ ∈ S0 ∪ S2 and P ∈ P with v∗ (cid:54)∈ P . Then we have T1 ∧ Tr(F∗ 1 ) ∪ T2 ∧ Tr(F(cid:48) 2) ⊆ Tr(H). (38) Proof. By definition and Lemma 9, we have Tr(F∗ 1 ) = T 0 ∪T 1 = Tr(F(cid:48) 1) ∪T 1. Thus, T1 ∧ Tr(F∗ 1 ) ∪ T2 ∧ Tr(F(cid:48) 2) = T1 ∧T 1 ∪ T1 ∧ Tr(F(cid:48) 1) ∪ T2 ∧ Tr(F(cid:48) 2) By Lemmas 7 and 11, it is contained in Tr(H). (cid:3) In Case IV, if T0 is nonempty, then we decompose H in the way described in Case III. Otherwise, 2, where we assume 1 ), and Tr(F(cid:48) 2) in 2 = F∗ 1, 2 ≤ n − 1, 3 ≤ m. Since T1,T2, k2, k3 ≥ 1, it follows from Fact 2 and Lemma based on Lemmas 10 and 12, we decomposes H into 3 hypergraphs H1, F∗ 1 , and F(cid:48) that v∗ ∈ S0 ∪ S2. We note that Tr(H) can be computed from Tr(H1), Tr(F∗ L2(µ) = poly(n, m, k) time. k2 = Tr(F∗ n1 + n2 = n + 1, and m1, m(cid:48) 12 that k1, k2 ≤ k and k1 + k2 + k3 ≤ k + 2. Thus, In order to analyze T (µ), let n1 = V1, m1 = H1, k1 = Tr(H1), n(cid:48) 2 = V2 + 1, m(cid:48) 2). Note that all are positive, n1, n(cid:48) 2, m(cid:48) 1 ), n3 = V2, m3 = F(cid:48) 2, and k3 = Tr(F(cid:48) n1m1k1 + n(cid:48) 2m(cid:48) 2k2 + n3m3k3 ≤ (n1k1 + n(cid:48) ≤ (n1k1 + n(cid:48) ≤ ((n − 1)k + 4)m ≤ nmk − 1, 2k2 + n3k3)m 2(k2 + k3))m (39) (40) where (39) is obtained from Fact 1 and (40) is obtained from k ≥ 5. This implies that T (µ) ≤ µ. 18 3.5 3-sum decomposition - case 3 Let H1 = HV1 and H2 = HV2. By Corollary 2, we have two nonempty disjoint sets S1 and S2 in V2. Define F0 = {H ∈ H H ∩ V1 = S1 ∪ S2, H ∩ V2 (cid:54)= ∅}, F1 = {H ∈ H H ∩ V1 = S2, H ∩ V2 (cid:54)= ∅}, F2 = {H ∈ H H ∩ V1 = S1, H ∩ V2 (cid:54)= ∅}. (43) Note that V1, V2 (cid:54)= ∅, H1 (cid:54)= ∅, and at least two of Fi are nonempy. H can be partitioned in the following way. H = H1 ∪H2 ∪F0 ∪F1 ∪F2, (41) (42) (44) (45) (46) (47) (48) where ∪ denotes the disjoint union. For i = 1, 2, let Ti = {T ∈ Tr(H1) T ∩ Si (cid:54)= ∅, T ∩ Sj = ∅ (j (cid:54)= i)}, and let By definition, we have Let T = Tr(H1) \ (T1 ∪ T2). Tr(H1) = T ∪T1 ∪T2. P = HS1∪S2 (= {H ∈ H H ⊆ S1 ∪ S2}). We separately consider the following 4 cases, similar to the case analysis in Section 3.4 Case I: P = ∅. Case II: P = {S1 ∪ S2}. Case III: P (cid:54)= ∅,{S1 ∪ S2} and T (cid:54)= ∅. Case IV: P (cid:54)= ∅,{S1 ∪ S2} and T = ∅. In Case I, we can decompose H into H1 and HS1∪S2∪V2, where the proof is similar to Case I in Section 3.4. In Case II, we note that H1 ≥ 2 holds. To see this, recall from Corollary 2 that H is irredundant Sperner and has neither identical vertices nor vertices of degree 1. Moreover, we have H1 + V1 ≥ 4 from 3-sum -- case 3 (ii) in Corollary 2, which implies H1 ≥ 2. We therefore decompose H into H1 and HS1∪S2∪V2 in a way similar to Case II-I in Section 3.4, where the proof is also similar to Case II-I in Section 3.4. For the other cases, we note that F0 = ∅ since P (cid:54)= ∅ and H is Sperner. Therefore, decompositions similar to the corresponding cases in Section 3.4 work properly. Acknowledgements We thank Endre Boros and Vladimir Gurvich for helpful discussions. The research of the second author is supported by Grant-in-Aid for Scientific Research 24106002, 25280004, 26280001 and JST CREST Grant Number JPMJCR1402, Japan. 19 References [Abd03] S. D. Abdullahi. Vertex Enumeration and Counting for Certain Classes of Polyhedra. PhD thesis, Computing (Computer Algorithms) Leeds University U.K., 2003. [AF92] D. Avis and K. Fukuda. A pivoting algorithm for convex hulls and vertex enumeration of arrangements and polyhedra. Discrete and Computational Geometry, 8(3):295 -- 313, 1992. [AF96] D. Avis and K. Fukuda. Reverse search for enumeration. Discrete Applied Mathematics, 65(1-3):21 -- 46, 1996. [ARSvS10] D. Avis, G. D. Rosenberg, Rahul Savani, and Bernhard von Stengel. Enumeration of Nash equilibria for two-player games. Economic Theory, 42(1):9 -- 37, 2010. [BEGM09] E. Boros, K. Elbassioni, V. Gurvich, and K. Makino. Generating vertices of polyhedra and related problems of monotone generation. In D. Avis, D. Bremner, and A. Deza, editors, Proceedings of the Centre de Recherches Math´ematiques at the Universit´e de Montr´eal, special issue on Polyhedral Computation, volume 49, 2009. [BEGT11] E. Boros, K. Elbassioni, V. Gurvich, and H. R. Tiwary. The negative cycles polyhedron and hardness of checking some polyhedral properties. Annals OR, 188(1):63 -- 76, 2011. [Ber89] C. Berge. Hypergraphs. Elsevier-North Holand, Amsterdam, 1989. [BFM98] D. Bremner, K. Fukuda, and A. Marzetta. Primal-dual methods for vertex and facet enumeration. Discrete and Computational Geometry, 20:333 -- 357, 1998. [BI95] [BL98] J. C. Bioch and T. Ibaraki. Complexity of identification and dualization of positive boolean functions. Information and Computation, 123(1):50 -- 63, 1995. M. R. Bussieck and M. E. Lubbecke. The vertex set of a 0/1 polytope is strongly P- enumerable. Computational Geometry: Theory and Applications, 11(2):103 -- 109, 1998. [Chv83] V. Chv´atal. Linear Programming. Freeman, San Francisco, CA, 1983. [Cor01] [DP77] [Dye83] [EG95] G. Cornu´ejols. Combinatorial Optimization: Packing and Covering. CBMS-NSF Re- gional Conference Series in Applied Mathematics. Society for Industrial and Applied Mathematics, 2001. M. E. Dyer and L.G. Proll. An algorithms for determining all extreme points of a convex polytope. Mathematical Programming, 12:81 -- 96, 1977. M. E. Dyer. The complexity of vertex enumeration methods. Mathematics of Operations Research, 8:381 -- 402, 1983. T. Eiter and G. Gottlob. Identifying the minimal transversals of a hypergraph and related problems. SIAM Journal on Computing, 24(6):1278 -- 1304, 1995. [EGM03] T. Eiter, G. Gottlob, and K. Makino. New results on monotone dualization and gener- ating hypergraph transversals. SIAM Journal on Computing, 32(2):514 -- 537, 2003. [FK96] M. L. Fredman and L. Khachiyan. On the complexity of dualization of monotone dis- junctive normal forms. Journal of Algorithms, 21:618 -- 628, 1996. 20 [FP96] [GK99] K. Fukuda and A. Prodon. Double description method revisited, pages 91 -- 111. Springer Berlin Heidelberg, Berlin, Heidelberg, 1996. V. Gurvich and L. Khachiyan. On generating the irredundant conjunctive and dis- junctive normal forms of monotone Boolean functions. Discrete Applied Mathematics, 96-97(1):363 -- 373, 1999. [KBB+08] L. Khachiyan, E. Boros, K. Borys, K. Elbassioni, and V. Gurvich. Generating all vertices of a polyhedron is hard. Discrete & Computational Geometry, 39(1-3):174 -- 190, 2008. [KBE+05] L. Khachiyan, E. Boros, K. Elbassioni, V. Gurvich, and K. Makino. On the complexity of some enumeration problems for matroids. SIAM Journal on Discrete Mathematics, 19(4):966 -- 984, 2005. [Leh79] A. Lehman. On the width-length inequality, mimeographic notes (1965). Published: Mathematical Programming, 17:403 -- 417, 1979. [LLK80] E. Lawler, J. K. Lenstra, and A. H. G. Rinnooy Kan. Generating all maximal independent sets: NP-hardness and polynomial-time algorithms. SIAM Journal on Computing, 9:558 -- 565, 1980. [Lov92] [MP97] [Pfe02] [Pro94] [RS14] L. Lov´asz. Combinatorial optimization: some problems and trends. DIMACS Technical Report 92-53, Rutgers University, 1992. N. Mishra and L. Pitt. Generating all maximal independent sets of bounded-degree hypergraphs. In COLT '97: Proceedings of the 10th annual conference on Computational learning theory, pages 211 -- 217, 1997. M. E. Pfetsch. The Maximum Feasible Subsystem Problem and Vertex-Facet Incidences of Polyhedra. Dissertation, TU Berlin, 2002. J.S. Provan. Efficient enumeration of the vertices of polyhedra associated with network LP's. Mathematical Programming, 63(1):47 -- 64, 1994. A. C. Reimers and L. Stougie. A decomposition theory for vertex enumeration of convex polyhedra. CoRR, abs/1404.5584, 2014. [Sch86] A. Schrijver. Theory of Linear and Integer Programming. Wiley, New York, 1986. [Sei86] [Sey80] R. Seidel. Output-size sensitive algorithms for constructive problems in computational geometry. Computer science, Cornell University, Ithaka, NY, 1986. P. D Seymour. Decomposition of regular matroids. Journal of Combinatorial Theory, Series B, 28(3):305 -- 359, 1980. [STU97] A. Shioura, A. Tamura, and T. Uno. An optimal algorithm for scanning all spanning trees of undirected graphs. SIAM Journal on Computing, 26(3):678 -- 692, 1997. [Tru92] K. Truemper. Matroid Decomposition. Academic Press, 1992. [Vaz01] V. V. Vazirani. Approximation Algorithms. Springer-Verlag New York, Inc., New York, NY, USA, 2001. 21
1410.7912
2
1410
2016-10-27T12:21:20
Online Top-k-Position Monitoring of Distributed Data Streams
[ "cs.DS" ]
Consider n nodes connected to a single coordinator. Each node receives an individual online data stream of numbers and, at any point in time, the coordinator has to know the k nodes currently observing the largest values, for a given k between 1 and n. We design and analyze an algorithm that solves this problem while bounding the amount of messages exchanged between the nodes and the coordinator. Our algorithm employs the idea of using filters which, intuitively speaking, leads to few messages to be sent, if the new input is "similar" to the previous ones. The algorithm uses a number of messages that is on expectation by a factor of O((log {\Delta} + k) log n) larger than that of an offline algorithm that sets filters in an optimal way, where {\Delta} is upper bounded by the largest value observed by any node.
cs.DS
cs
Online Top-k-Position Monitoring of Distributed Data Streams Alexander Macker Manuel Malatyali Friedhelm Meyer auf der Heide Heinz Nixdorf Institute & Computer Science Department University of Paderborn, Germany {amaecker, malatya, fmadh}@hni.upb.de Abstract Consider n nodes connected to a single coordinator. Each node receives an individual online data stream of numbers and, at any point in time, the coordinator has to know the k nodes currently observing the largest values, for a given k between 1 and n. We design and analyze an algorithm that solves this problem while bounding the amount of messages exchanged between the nodes and the coordinator. Our algorithm employs the idea of using filters which, intuitively speaking, leads to few messages to be sent, if the new input is "similar" to the previous ones. The algorithm uses a number of messages that is on expectation by a factor of O ((log ∆ + k) · log n) larger than that of an offline algorithm that sets filters in an optimal way, where ∆ is upper bounded by the largest value observed by any node. 1 Introduction In this paper we consider a model in which there is one coordinator and a set of n distributed nodes connected to the coordinator. Each node continuously receives data from an input stream only known to the respective node or, in other words, observes a private function whose value changes over time. At any time, the coordinator has to know the k nodes currently observing the k largest values. In order to inform the coordinator about its current value, a node can exchange messages with the coordinator. Additionally, the coordinator can send broadcast messages received by all nodes. The goal in designing an algorithm for this setting, which we call Top-k-Position Monitoring, is to find a solution that, on the one hand, keeps the coordinator informed as much as necessary for solving the problem and, at the same time, aims at minimizing the communication, i.e., the number of messages, between the coordinator and the distributed nodes. Such a model might be of interest in distributed settings. Think of a set of sensors which can communicate directly to the coordinator in order to continuously keep track of the subset of n locations at which current the highest k values (of any parameter like speed, temperature, frequency, . . . ) are observed. Since these values will change over time generating an extremely large amount of data, it is not reasonable (and even not necessary) to keep the coordinator informed about all the changes observed somewhere in the system. Instead, reducing the communication is desired and might even get inevitable in large systems. For the considered problem, we present an algorithm that combines the notion of filters with a kind of random sampling of nodes. The basic idea of assigning filters to the distributed nodes is to reduce the number of exchanged messages by providing nodes constraints defining when they can safely resign to send observed changes in their input streams to the coordinator. However, if it might become necessary to communicate observed changes and update filters, we make extensive use of a new randomized protocol for determining the maximum (or minimum) value currently observed by (a certain subset of) the nodes. As our problem is an online problem, since the values observed by the nodes change over time and are not known in advance, in our analysis we compare the number of messages exchanged by our online algorithm to that of an offline algorithm that sets filters in an optimal way. We show that they differ by a factor of at most O ((log ∆ + k) · log n) This work was partially supported by the German Research Foundation (DFG) within the Priority Program "Algorithms for Big Data" (SPP 1736) and by the EU within FET project MULTIPLEX under contract no. 317532. 1 on expectation, where ∆ is the largest difference of the values observed at the nodes holding the k-th and (k + 1)-st largest value at any time. 1.1 Related Work Efficient computation of functions on big datasets in terms of (single or distributed) data streams has turned out to be an important topic of research with applications in IP network traffic analysis, text mining or databases [11]. The theory of data stream algorithms [8] investigates the possibilities and limitations of approaches in this setting. The design of algorithms typically focuses on the computation of functions or their relaxations with objectives like using as less memory as possible, usually polylogarithmic in the length of the stream. Cormode et al. introduce the Continuous Monitoring Model [5] focusing on systems comprised of a coordinator and n nodes generating or observing distributed data streams. Consequently, the goal shifts to continuously (that is, in every time step) compute a function depending on the information available across all n data streams up to the current time at a dedicated coordinator. The major objective becomes the minimization of the overall number of messages exchanged between the nodes and the coordinator. We refer to this model and enhance it by a broadcast channel as proposed by Cormode et al. in [6]. An important class of problems in this model investigated in literature are threshold computations, i.e., the coor- dinator is supposed to decide whether the current function value has reached some given threshold τ or not. If the function is monotone, e.g., monitoring the number of distinct values or the sum over all values, exact characterizations including matching lower bounds in the deterministic case are known [6, 7]. However, non-monotone functions, e.g., the entropy [10], turned out to be much more complex to handle. A general approach to reduce the communication when monitoring distributed data streams is proposed in [9]. Zhang et al. introduce the notion of filters, which are also an integral part of our algorithm presented in this paper. They consider a problem called continuous skyline maintenance, in which a coordinator is supposed to continuously maintain the skyline of dynamic objects. As they aim at minimizing the communication overhead between the coor- dinator and the objects, they use a filter method that helps in avoiding the transmission of updates from the objects to the coordinator in case these updates cannot influence the skyline maintained by the coordinator. More precisely, the dynamic objects are points of a d-dimensional space and filters are hyper-rectangles assigned by the coordinator to the objects in such a way that as long as these points are within the assigned hyper-rectangle, updates need not be communicated to the coordinator. In their work [4], Yi and Zhang were the first to study streaming algorithms with respect to their competitiveness. In their model there is one node and one coordinator and the goal is to keep the coordinator informed about the current value of a multivalued function f : Z+ → Zd that is observed by the node and changes its value over time, while minimizing the number of messages. Among others, for d = 1, Yi and Zhang present an algorithm that is O (log δ)- competitive if the last value received by the coordinator might deviate by δ from the current value of f. For arbitrary d, a competitiveness of O(cid:0)d2 log(d · δ)(cid:1) is shown. Following the idea of studying competitive algorithms for monitoring streams and the notion of filters, Lam et al. [3] present an algorithm for online dominance tracking of distributed streams. In this problem a coordinator always has to be informed about the dominance relationship between n distributed nodes each observing an online stream of d-dimensional values. Here, the dominance relation of two nodes b1 and b2 currently observing (p1, . . . , pd) and (q1, . . . , qd), respectively, both from {1, . . . , U}d, is defined as b1 dominates b2 if pi < qi for some 1 ≤ i ≤ d and pj ≤ qj for all other 1 ≤ j ≤ d. Their algorithm is based on the idea of assigning filters to the nodes and they show that a mid-point strategy, which basically sets filters to be the mid-point between neighboring nodes, is O (d log U )-competitive with respect to the number of messages sent in comparison to an offline algorithm that sets filters optimally. A further problem related to ours, is examined in [1]. In their work, Babcock and Olston consider the problem of distributed top-k monitoring. In the considered setting there is a set of objects {O1, . . . , On} each associated with a numeric value. Additionally, there is a set of nodes each monitoring a stream of tuples (Oi, ∆) describing that the value associated with the object Oi changes by ∆. Note that these changes may occur at different nodes. The goal then is to always keep the coordinator informed about the objects having the k largest associated values. If each node observes exactly one object and each object is observed by exactly one node, their problem is basically monitoring the k largest values. By experimentally evaluating their approach, Babcock and Olston show that the amount of communication is an order of magnitude lower than that of a naive approach. Finally, a model related to our (sub-)problem of finding the k-th largest value hold by the nodes exploiting the 2 existence of a broadcast channel, was studied in literature as distributed selection using the shout-echo principle (see e.g. [13, 14]). However, this line of research aims at minimizing the number of communication cycles (i.e., the number of rounds each consisting of one broadcast and replies from all nodes), which is fundamentally different from our objectives. 1.2 Our Contribution We present and analyze a new randomized online algorithm for the Top-k-Position Monitoring problem, i.e., moni- toring the nodes currently holding the k largest values in a setting comprised of a coordinator and n distributed nodes (Sect. 2). Our algorithm basically consists of two parts: First of all, we use the notion of filters, which helps in avoiding the exchange of unnecessary updates between the nodes and the coordinator. Second, whenever filters might be updated, a protocol, which uses M (n) messages, to determine the maximum (or minimum) value hold by the distributed nodes is employed. We show that the amount of communication is by a factor of O ((log ∆ + k) · M (n)) larger than that of an offline algorithm which sets the filters optimally (Sect. 3). We also present a concrete randomized protocol that determines the maximum value hold by n nodes using M (n) = O (log n) messages, with high probability, which we also prove to be asymptotically optimal (Sect. 4). This result can be used to achieve a factor of O ((log ∆ + k) · log n). i , v2 i , v3 2 Model and Techniques In our setting there are n distributed nodes identified by unique identifiers (IDs) from the set {1, . . . , n}, each receiving a continuous data stream (v1 i . . .), which can be exclusively observed by the respective nodes. Also, at time t, a node i observes vt i , t(cid:48) > t. We omit the index t if it is clear from the context. i ∈ N and does not know any vt(cid:48) The nodes can communicate to the coordinator, but cannot communicate to each other. They are able to store a constant number of integers, compare two integers and perform Bernoulli trials with success probability 2i/n for i ∈ {0, . . . , log n}. The coordinator can, on the one hand, communicate to one device, and has, on the other hand, a broadcast-channel to communicate one message received by all nodes at the same time. All the communication methods described above incur unit communication cost per message, the delivery is instantaneous, and we allow a message at time t to have a size at most logarithmic in n and max1≤i≤n(vt i ). Following the model in [6], we also allow that between any consecutive observations, i.e., between any two time steps t and t + 1, a communication protocol exchanging messages between the coordinator and the nodes may take place. We consider a problem, which we call Top-k-Position Monitoring, of monitoring the node IDs of the nodes holding the k largest values, i.e., at each time t the coordinator has to know the value of a function F mapping from the current n to the set {s1, . . . , sk}, k ≤ n, of nodes currently observing the k largest values among the (multi- values vt n}. We refer to the set of nodes in {s1, . . . , sk} at time t as top-k, explicitly the values at times t(cid:48) < t )set {vt do not matter for this output. To ease the presentation, we assume that all vi are pairwise distinct at every time t. However, the main results remain valid if we drop this assumption. ordered sequence of nodes, ∀i < j ∈ {1, . . . , n} : vi ≥ vj, i.e., nodes are ordered descending. In the following we assume w.l.o.g. that when talking about a fixed time t, node i is at the i-th position in the 1, . . . , vt 1, . . . , vt 2.1 A First Approach & Classical Analysis One naive approach to monitor the Top-k-Positions, is to send each value observed by a node to the coordinator. In this case, the coordinator gets all the information necessary to determine the value of the function F at any time. However, this approach leads to a huge amount of messages and thus, in the following we are interested in more sophisticated solutions that aim at minimizing the number of messages exchanged between the coordinator and the distributed nodes. Now assume there is an algorithm that determines the maximum value observed by the n nodes (Sect. 4) using O (log n) messages on expectation. Furthermore, assume this algorithm can be extended to determine the nodes within Top-k using O (k · log n) messages on expectation. If we use this approach in each round to determine the Top-k, applying it for T rounds yields O (T · k · log n) messages. 3 Determining the node holding the maximum value needs at least Ω(log n) messages on expectation (Sect. 4), implying that each randomized algorithm that determines the nodes within the top-k needs at least Ω(log n) messages on expectation. Therefore, the algorithm described above is optimal up to a factor of k for worst case inputs, i.e. inputs where the position of the maximum changes considerably from round to round. However, we feel that this classical analysis does not reflect the quality of the algorithm properly for every instance. Although the analysis states that this algorithm is almost optimal - on instances in which the new observed values are "similar" to the values observed in the last round, it behaves poorly. On theses instances, the algorithm calculates the top-k from scratch in every round, generating communication not needed by a "somehow clever" algorithm which, intuitively speaking, identifies and exploits these similarities. To address this fact, in the next section we consider algorithms that are based on a concept called filters [9] which aims at minimizing the communication by identifying changes in the observed values that need not be communicated to the coordinator. i, ut i = [lt 1, . . . , F t 2.2 Filter-Based Algorithms & Competitive Analysis A set of filters is a collection of intervals, one assigned to each node, such that as long as the observed values at each node are within the given interval, the value of the function F does not change. For the problem at hand, this general idea of filters translates to the following definition. n), Fi ⊆ N ∪ {−∞,∞} and Definition 2.1. For a fixed time t, a set of filters is an n-tuple of intervals (F t vi ∈ Fi, such that as long as the value of node i only changes within its interval, i.e., it holds vi ∈ Fi, the value of the function F does not change. We use F t i] to denote the lower and upper bound of a filter interval, respectively. In our model, we assume that nodes are assigned such filters by the coordinator. If a node violates its filter, i.e., the currently observed value is not contained in its filter, the node may report the violation and its current value to the coordinator. The coordinator then computes a new set of filters and sends them to the affected nodes. Thus, for such an algorithm to be correct, we demand that the intervals assigned to the nodes always constitute a (valid) set of filters and we call such an algorithm filter-based. Note that the easiest way of defining a set of filters is to assign the value currently observed by a node as its interval. In this case the usage of filters does not lead to any benefit, so in general we are looking for filters that are as large as possible to minimize the count of filter changes which is directly related to the number of exchanged messages. In order to serve its purpose that the value of the function F does not change as long as the observed values are within their filters, each pair of filters (Fi, Fj) of nodes i ∈ top-k and j /∈ top-k must be disjoint except for a (possible) single common point at their boundaries. Formally, we can state this observation as shown in the lemma below. Lemma 2.2. For a fixed time t, an n-tuple of intervals forms a set of filters if and only if 1. for all i ∈ top-k it holds vi ∈ Fi = [li, ui] and li ≥ uj ∀k < j ≤ n, and 2. for all i /∈ top-k it holds vi ∈ Fi = [li, ui] and ui ≤ lj ∀1 ≤ j ≤ k. To analyze the quality of our online-algorithm, we use analysis based on competitiveness and compare the com- munication volume induced by the algorithm to that of an appropriately defined offline algorithm. In our model, an offline algorithm knows all the input streams in advance, and without further restrictions can trivially solve the Top- k-Monitoring Problem without any communication. In order to still get meaningful results and assess the quality of our algorithm, we assume the optimal offline algorithm OP T to use filters assigned by the coordinator to the nodes. Hence, to lower bound the cost induced by OP T , we will essentially count the number of filter updates over time. We call an online algorithm A c-competitive if for every instance (i) its communication volume is by a factor of at most c larger than the communication volume of OP T , in case A is deterministic and (ii) the expected communication volume is by a factor of at most c larger than the communication volume of OP T , in case A is randomized. 3 Filter-Based Algorithm for Top-k-Position Monitoring In this section we describe our algorithm for monitoring the IDs of the nodes holding the k largest values. Assuming that we have distributed protocols to determine the maximum and minimum value hold by the nodes (Sect. 4), the key idea is to use filters to prevent that nodes communicate changes to the coordinator that are not essential for the correct 4 computation of the function F. In case filters are violated, these protocols are applied to gain information required for updating the set of filters properly. 3.1 Monitoring of Top-k-Position One solution to the Top-k-Position Monitoring problem is to use the online dominance tracking algorithm by Lam et al. [3] as discussed in Section 1.1. However, it would no longer provide a c-competitive algorithm for any c. This is due to the fact that a lot of messages might be sent because of changing values of nodes that do not lead to a change in top-k and thus are not sent by an optimal algorithm. In Algorithm 1 we present a competitive solution for the Top-k-Position Monitoring problem, which adopts some basic idea of [3]. At the beginning, the coordinator determines the k-th and (k + 1)-st largest value and, based on their midpoint M, all filters are set to be [−∞, M ] and [M,∞], respectively, due to the idea of Lam et al. As soon as nodes violate their filters, these nodes apply the MINIMUMPROTOCOL or MAXIMUMPROTOCOL, respectively. Hereby the coordinator gets informed that some filter violations have happened and based on the received values the coordinator can determine whether the top-k set has changed or not. In the former case, the top-k set is updated by repeatedly applying the MAXIMUMPROTOCOL. In the latter case, the coordinator determines the new midpoint between the k-th and (k + 1)-st largest value and the nodes' filters are updated accordingly. In order to prove the competitiveness of Algorithm 1, we need the following definition and the consecutive Lemma 3.2: Definition 3.1. Let t0, t be given times with t ≥ t0. We denote the maximum over all values observed by nodes i /∈ top-k during the interval [t0, t] by T −(t0, t) = maxt0≤t(cid:48)≤t maxi∈{k+1,...,n}(vt(cid:48) i ). Consequently, let T +(t0, t) be the minimum over all values observed by nodes i ∈ top-k during the interval [t0, t]. Lemma 3.2. If OP T uses the same set of filters throughout the interval [t(cid:48), t(cid:48)(cid:48)], the minimum over all nodes i ∈ top-k is greater or equal the maximum over all nodes i /∈ top-k during [t(cid:48), t(cid:48)(cid:48)]. Formally, T +(t(cid:48), t(cid:48)(cid:48)) ≥ T −(t(cid:48), t(cid:48)(cid:48)). Proof. Proof by contradiction. Assume OP T uses the same set of filters throughout the interval [t(cid:48), t(cid:48)(cid:48)], but T +(t(cid:48), t(cid:48)(cid:48)) < T −(t(cid:48), t(cid:48)(cid:48)) holds. Then there are two nodes, i ∈ top-k and j /∈ top-k, and two times t1, t2 ∈ [t(cid:48), t(cid:48)(cid:48)], j = T −(t(cid:48), t(cid:48)(cid:48)). Due to the definition of a set of filters and the fact that OP T has not such that vt1 communicated during [t(cid:48), t(cid:48)(cid:48)], OP T must have set the filter for node i to [s1,∞], s1 ≤ vt1 i , and for node j to [−∞, s2], s2 ≥ vt2 j . This is a contradiction to the definition of a set of filters and Lemma 2.2. i = T +(t(cid:48), t(cid:48)(cid:48)) and vt2 The results above lead to the following theorem. Theorem 3.3. Let M (n) be the number of messages required to determine the maximum or minimum value by MAX- IMUMPROTOCOL and MINIMUMPROTOCOL in Algorithm 1. Furthermore, let ∆ = maxt(vt k+1). Then, Algo- rithm 1 is O ((log ∆ + k) · M (n))-competitive. Proof. To prove the theorem, we split the time into intervals based on the time steps t1, t2, . . . at which OP T commu- nicates. Let t0 be the time step directly after the initialization. The outline of our proof is as follows: We consider an arbitrary interval I := [ti−1 + 1, ti − 1] for i > 1. First of all, we count the number of executions of the different pro- cedures of our algorithm during this interval I. Then, we upper bound the number of messages exchanged during an execution of these procedures and finally, combine both observations to upper bound the overall number of messages sent during the interval I. k − vt First, observe that OP T does not communicate during I and thus, the top-k set does not change. According to Lemma 3.2 the procedure FILTERRESET is executed at most once during the interval I since it is only called if T +(t0, t) < T −(t0, t). Furthermore, at the beginning of I the difference between T +(·, ti−1 + 1) and T −(·, ti−1 + 1) is at most ∆. Because the procedure FILTERVIOLATIONHANDLER is only called when a filter-violation occurs and due to the fact that in lines 23 − 25 the difference between T + and T − is at least halved, there can be at most log ∆ time-steps in which filter-violations occur between two calls of FILTERRESET. Hence, during the interval I there can be at most 2 · log ∆ calls of the procedure FILTERVIOLATIONHANDLER. Next we upper bound the number of messages sent by the algorithm during the interval I. Fix a time t. If at time t there is no filter-violation, the algorithm incurs no communication. In case there are filter-violations, lines 5 and/or 7 may need M (n − k) + M (k) messages. Additionally, a call of the procedure FILTERVIOLATIONHANDLER may lead to the exchange of O (M (n)) messages and the procedure FILTERRESET to (k + 1) · M (n) messages. In conclusion, 5 Algorithm 1 Top-k-Position Monitoring 1: FilterReset(); 2: for Node i ∈ {1, . . . , n} do in parallel if Node i has a filter violation then 3: 4: 5: 6: 7: 8: 9: 10: end for MINIMUMPROTOCOL(k); MAXIMUMPROTOCOL(n − k); end if end if else if Node i was in top-k at time t-1 then (cid:46) time t = 0 initialization of filters (cid:46) let t > 0 be the current time 11: if at least one node has communicated a value at the end 12: 13: 14: end if of MINIMUMPROTOCOL in line 5 or MAXIMUMPROTOCOL in line 7 then FILTERVIOLATIONHANDLER(); (cid:46) coordinator executes the following lines, including the procedures if MINIMUMPROTOCOL has communicated a minimum to the coordinator then min ← minimum communicated in line 5; end if if MAXIMUMPROTOCOL has communicated a maximum to the coordinator then max ← maximum communicated in line 7; max ← apply MAXIMUMPROTOCOL(n − k) to all i /∈ top-k at time t − 1; min ← apply MINIMUMPROTOCOL(k) to all i ∈ top-k at time t − 1; else end if if max not set then 15: procedure FILTERVIOLATIONHANDLER() 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: end procedure end if T +(t0, t) ← min(T +(t0, t − 1), min); T −(t0, t) ← max(T −(t0, t − 1), max); if T +(t0, t) < T −(t0, t) then end if else FILTERRESET(); M ← midpoint of the interval [T +(t0, t), T −(t0, t)]; broadcast M to let the nodes update their filters; for i ← 1 to k + 1 do 36: procedure FILTERRESET() 37: 38: 39: 40: 41: 42: end procedure apply MAXIMUMPROTOCOL(n) to all nodes i(cid:48) /∈ top-(i − 1); end for M ← midpoint of the interval between the k-th and (k+1)-st largest value; broadcast M to let the nodes i(cid:48) ∈ top-k reset their filters to [M,∞] and i(cid:48) /∈ top-k analog; 6 the algorithm needs at most O ((log ∆ + k) · M (n))) messages in the interval I. Observe that OP T communicates at time ti and our algorithm may communicate at most k · M (n) messages at ti. Thus, if we consider the execution of the algorithm for a certain time horizon and assume that OP T communicates at least r times, Algorithm 1 communicates at most (r+1)·O ((log ∆ + k) · M (n)) messages and hence, the algorithm is O ((log ∆ + k) · M (n))-competitive. 4 Distributed Protocol For Maximum Computation In this section we present and analyze a protocol to determine the maximum value currently hold by a set of nodes. Here we no longer consider an online problem, as we assume that the protocol is applied at a fixed time t. Hence, also the values of the nodes applying the protocol do not change during a single execution. (cid:46) N is an upper bound on number of nodes active ← true; if maxr−1 > vi then if Node i is active then for Node i ∈ {1, . . . , n} do in parallel for Node i ∈ {1, . . . , n} do in parallel end for for Round r ← 0 to log N do Algorithm 2 MaximumProtocol 1: procedure MAXIMUMPROTOCOL(N ∈ {n, n + 1, . . .}) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: end procedure Send (i, vi) to coordinator; active ← false; end if end if goto line 14; end for end if p ← Result of a coin flip with success-probability 2r N ; if p = 1 then end for coordinator broadcasts maximum maxr of all seen values vi; The idea of how to determine the maximum value currently hold by n nodes is as follows (c.f. Algorithm 2): The algorithm proceeds in log N rounds, for a given N ≥ n. At the beginning, i.e., before round r = 0, all nodes are set to be active. In each round r, each active node decides independently of the other nodes to send its value to the coordinator with a probability of 2r/N. After this, the coordinator broadcasts the largest value observed so far and nodes having a value not larger than this maximum are deactivated, i.e., no longer take part in the algorithm. This broadcast starts the next round which continues with all nodes still being active. Note that Algorithm 2 constitutes a Las Vegas algorithm that always computes the correct solution in log N steps, but the number of messages exchanged is described by a random variable. To analyze the expectation of this random variable, we first analyze the probability that a fixed node sends a message to the coordinator during one execution of MAXIMUMPROTOCOL. Lemma 4.1. Let Xi be a binary random variable indicating whether node i ∈ {1, . . . , n} sends a message during a run of Algorithm 1. Then, Pr[Xi = 1] ≤ 1 N + · 2r N 1 − 2r−1 N (cid:18) log N(cid:88) r=1 (cid:19)i . Proof. Let Si,j be a binary random variable indicating whether node i's coin flip is successful in round r. Let Yi,j be a binary random variable indicating that node i is active in round j. A node sends a message in round j if and only if 7 it is active in round j and its coin flip results in a success. Furthermore it deactivates itself after sending a message, so it is not possible that one node sends two or more messages. Hence, r=0 log N(cid:88) log N(cid:88) log N(cid:88) r=0 r=0 Pr[Xi = 1] = = = Pr[Si,r and Yi,r = 1] (cid:12)(cid:12)Yi,r = 1] · Pr[Yi,r = 1] Pr[Si,r · Pr[Yi,r = 1] . 2r N Observe that a node i is active at the beginning of round j if and only if it is active at the beginning of round j − 1 and no node i(cid:48) ≤ i sends a message in round j − 1. Hence, we obtain Pr[Yi,0 = 1] = 1 and for j > 0: Pr[Yi,j] = Pr[no i(cid:48) ≤ i sends in round j − 1(cid:12)(cid:12)Yi,j−1 = 1] · Pr[Yi,j−1 = 1] . In a fixed round, the decisions of active nodes whether to send a message or not are independent. Additionally, Yi,j = 1 implies Yi(cid:48),j = 1 ∀1 ≤ i(cid:48) ≤ i. Hence, Pr[no i(cid:48) ≤ i sends in round j − 1(cid:12)(cid:12)Yi,j−1 = 1] ≤ and thus by an inductive argument, Pr[Yi,j = 1] ≤ j−1(cid:89) r=0 (cid:18) 1 − 2r N (cid:19)i ≤ (cid:18) 1 − 2j−1 N Therefore the probability for Xi = 1 is bounded as claimed by the lemma. (cid:19)i (cid:18) 1 − 2j−1 (cid:19)i N . This result about the probability that a node sends a message can be used to determine an upper bound on the expected communication volume. Theorem 4.2 (Upper Bound). The expected number of messages sent in Algorithm 2 is at most 2 · log N + 1 and O (log N ) with high probability, i.e., for any fixed c > 1 it is O (log N ) with probability at least 1 − 1 N c . Proof. By Lemma 4.1, we have E[Xi] ≤ 1 1 − 2r−1 . Hence, 2r N +(cid:80)log N (cid:18) 1 − 2r−1 r=1 N 2r N n(cid:88) log N(cid:88) i=1 r=1 E[X] ≤ 1 + (cid:18) n−1(cid:88) 2r (cid:19)i . 1 − 2r−1 N (cid:17)i log N(cid:88) N 1 N N ·(cid:16) (cid:19)i ≤ 1 + log N(cid:88) r=1 i=0 log N(cid:88) r=1 = 1 + 2 ≤ 2 · log N + 1 , Replacing the terms of the geometric series, we obtain log N(cid:88) r=1 1 −(cid:16) 2r 1 + 1 N (cid:17) = 1 + 1 N 1 1 − 2r−1 N 2r 1 2r−1 N r=1 proving the expected number of messages. Note that although the random variables Xi are not independent, a variable Xi only depends on those Xj with j < i and observing the event that a node i sends a message, can only decrease the probability of sending a message of another node. It is known that Chernoff bounds for the upper tail of a distribution can be applied to variables satisfying such a kind of negative correlation [2]. More precisely, we can apply such a Chernoff bound if for all I ⊆ {1, . . . , n} it holds Pr[∀i ∈ I : Xi = 1] ≤(cid:89) Pr[Xi = 1] . i∈I 8 Without loss of generality assume that I = {i1, . . . , il} and vi1 ≥ vi2 ≥ . . . ≥ vil. Then we have Pr[∀i ∈ I : Xi = 1] = Pr[Xi1 = 1 ∧ . . . ∧ Xil = 1] = Pr[Xi1 = 1(cid:12)(cid:12)Xi2 = 1 ∧ . . . ∧ Xil = 1] · Pr[Xi2 = 1 ∧ . . . ∧ Xil = 1] ≤ Pr[Xi1 = 1] · Pr[Xi2 = 1(cid:12)(cid:12)Xi3 = 1 ∧ . . . ∧ Xil = 1] · Pr[Xi3 = 1 ∧ . . . ∧ Xil = 1] ≤(cid:89) ≤ Pr[Xi1 = 1] · Pr[Xi2 = 1] · . . . ... Pr[Xi = 1] i∈I and thus, the Xi's are negatively correlated and we obtain the claimed result by applying a standard Chernoff bound. We show that the bound of Theorem 4.2 is optimal, by showing that if all values hold by n nodes are pairwise distinct, then any randomized algorithm needs a number of messages that is at least logarithmic, i.e., E[X] = Ω(log n). By following Yao's minimax principle, it is sufficient to show that, given a probability distribution on the inputs, any deterministic algorithm has to send Ω(log n) messages on expectation. Theorem 4.3 (Lower Bound). Every randomized algorithm requires Ω(log n) messages on expectation to compute the maximum in our model. Proof. Let the inputs be distributed according to a distribution P in such a way that each instance where each of the numbers {1, . . . , n} is assigned to exactly one node vi is chosen with probability (1/n!). Consider any deterministic algorithm A that calculates the maximum in our model. Since we are looking for a lower bound on the number of messages, we see that A can basically not do better than having a fixed sequence (s1, . . . , sn) of nodes that it probes consecutively in this ordering, skipping nodes that have values smaller than the maximum value observed so far. By the following simple argument, we can show the desired result: Assume for the moment, that A probes all nodes, i.e., A receives a randomly chosen permutation of the values {1, . . . , n}. The course of the algorithm can be (partly) described by gradually constructing a binary search tree of the observed values. Now consider the actual course of the algorithm, i.e., A skips nodes which cannot deliver new information about the maximum value. Then the course of the algorithm is nothing else but the path in the binary search tree from the root to the node holding the maximum value. It is known (e.g., [12]) that on expectation this path has a length of Θ(log n), proving the theorem. Conclusively, we can combine Theorem 3.3 and 4.2 to obtain our main result. Theorem 4.4. Using Algorithm 2 and its analog for determining the minimum in Algorithm 1, yields a randomized O ((log ∆ + k) · log n)-competitive algorithm for Top-k-Position Monitoring. 5 Summary In this paper we presented and analyzed an online algorithm for keeping track of the k largest values currently observed at n distributed data streams. Our analysis shows that the approach is O ((log ∆ + k) · log n)-competitive with respect to an optimal filter-based offline algorithm. Hence, it is particularly suited for applications in large systems where one is only interested in collecting information about a small (constant sized) subset of nodes. In contrast to settings where the observed values (and thus the competitiveness) may grow large, the approach performs quite well when these values are naturally bounded by the application domain. This might be, e.g., the case when monitoring environmental information like temperatures, frequencies and similar parameters. It is worth mentioning that for the optimal offline algorithm our analysis only depends on the number of filter updates the algorithm communicates. It might be interesting to also investigate the number of messages sent by the nodes to the coordinator in order to get stronger bounds on the optimal filter-based algorithm and thus, to further improve the competitiveness factor. As an integral part of our algorithm, we examined the question of how to distributedly compute the maximum value hold by the nodes at a fixed time. It might turn out that this protocol is useful in other problems considered in the distributed monitoring model. For a variant of our Top-k-Position Monitoring problem in which one is not 9 only interested in the top-k set but also the ordering of these nodes according to their values, we conjecture that a combination of the approach by Lam et al. [3] and our protocol might lead to an O (log ∆ · log(n − k))-competitve algorithm. Still, a detailed analysis remains open for future work. References [1] Babcock, B., Olston, C.: Distributed Top-K Monitoring. In: International Conference on Management of Data, pp.28 -- 39. ACM, (2003) [2] Panconesi, A., Srinivasan, A.: Randomized Distributed Edge Coloring via an Extension of the Chernoff -- Hoeffding Bounds. In: Journal on Computing 26(2), pp. 350 -- 368. SIAM, 1997 [3] Lam, T.W., Liu, C.-M., Ting, H.-F.: Online Tracking of the Dominance Relationship of Distributed Multi- dimensional Data. In: Jansen, K., Solis-Oba, R. (eds.) WAOA 2010. LNCS, vol. 6534, pp.178 -- 189. Springer, (2011) [4] Yi, K., Zhang, Q.: Multidimensional Online Tracking. ACM Transactions on Algorithms 8, 12 (2012) [5] Cormode, G.: Continuous Distributed Monitoring: A Short Survey. In: 1st International Workshop on Algorithms and Models for Distributed Event Processing, pp. 1 -- 10. ACM, (2011) [6] Cormode, G., Muthukrishnan, S., Ke, Y.: Algorithms for Distributed Functional Monitoring. ACM Transactions on Algorithms 7, 21 (2011) [7] Cormode, G., Muthukrishnan, S., Yi, K., Zhang, Q.: Optimal Sampling From Distributed Streams. In: 29th Symposium on Priniciples of Database Systems, pp.77 -- 86. ACM, (2010) [8] Muthukrishnan, S.: Data Streams: Algorithms and Applications. Now Publishers Inc, (2005) [9] Zhang, Z., Cheng, R., Papadias, D. and Tung, A.K.H.: Minimizing the Communication Cost for Continuous Skyline Maintenance. In: ACM SIGMOD International Conference on Management of data, pp. 495 -- 508. ACM, New York (2009) [10] Arackaparambil, C., Brody, J., Chakrabarti, A.: Functional Monitoring without Monotonicity. In: Albers, S., Marchetti-Spaccamela, A., Matias, Y., Nikoletseas, S., Thomas, W. (eds.) ICALP 2009, LNCS, vol. 5555, pp. 95 -- 106. Springer, Berlin (2009) [11] Sanders, P., Schlag, S., Muller, I.: Communication Efficient Algorithms for Fundamental Big Data Problems. In: IEEE International Conference on Big Data, pp. 15 -- 23. IEEE, Silicon Valley (2013) [12] Sedgewick, R., Flajolet, P.: An Introduction to the Analysis of Algorithms. Addison-Wesley, (2013) [13] Marberg, J.: An Optimal Shout-Echo Algorithm for Selection in Distributed Sets. UCLA, (1985) [14] Rotem, D., Santoro N., Sidney, J.: Shout Echo Selection in Distributed Files. Networks, vol. 16, pp. 77 -- 86. John Wiley & Sons (1986) 10
1904.09354
1
1904
2019-04-19T22:00:09
Submodular Maximization Beyond Non-negativity: Guarantees, Fast Algorithms, and Applications
[ "cs.DS", "cs.LG", "math.OC" ]
It is generally believed that submodular functions -- and the more general class of $\gamma$-weakly submodular functions -- may only be optimized under the non-negativity assumption $f(S) \geq 0$. In this paper, we show that once the function is expressed as the difference $f = g - c$, where $g$ is monotone, non-negative, and $\gamma$-weakly submodular and $c$ is non-negative modular, then strong approximation guarantees may be obtained. We present an algorithm for maximizing $g - c$ under a $k$-cardinality constraint which produces a random feasible set $S$ such that $\mathbb{E} \left[ g(S) - c(S) \right] \geq (1 - e^{-\gamma} - \epsilon) g(OPT) - c(OPT)$, whose running time is $O (\frac{n}{\epsilon} \log^2 \frac{1}{\epsilon})$, i.e., independent of $k$. We extend these results to the unconstrained setting by describing an algorithm with the same approximation guarantees and faster $O(\frac{n}{\epsilon} \log\frac{1}{\epsilon})$ runtime. The main techniques underlying our algorithms are two-fold: the use of a surrogate objective which varies the relative importance between $g$ and $c$ throughout the algorithm, and a geometric sweep over possible $\gamma$ values. Our algorithmic guarantees are complemented by a hardness result showing that no polynomial-time algorithm which accesses $g$ through a value oracle can do better. We empirically demonstrate the success of our algorithms by applying them to experimental design on the Boston Housing dataset and directed vertex cover on the Email EU dataset.
cs.DS
cs
Submodular Maximization Beyond Non-negativity: Guarantees, Fast Algorithms, and Applications Christopher Harshaw1, Moran Feldman2, Justin Ward3, and Amin Karbasi1 1Yale University 2Open University of Israel 3 Queen Mary University of London Abstract It is generally believed that submodular functions -- and the more general class of γ-weakly submodular functions -- may only be optimized under the non- negativity assumption f (S) ≥ 0. In this paper, we show that once the function is expressed as the difference f = g − c, where g is monotone, non-negative, and γ-weakly submodular and c is non-negative modular, then strong approximation guarantees may be obtained. We present an algorithm for maximizing g − c under a k-cardinality constraint which produces a random feasible set S such that E [g(S)−c(S)]≥ (1 − e−γ−)g(OPT )−c(OPT ), whose running time is O( n  log2 1  ), i.e., independent of k. We extend these results to the unconstrained setting by describing an algorithm with the same approximation guarantees and faster O( n  ) runtime. The main techniques underlying our algorithms are two-fold: the use of a surrogate objective which varies the relative importance between g and c throughout the algorithm, and a geometric sweep over possible γ values. Our algorithmic guarantees are complemented by a hardness result showing that no polynomial-time algorithm which accesses g through a value oracle can do better. We empirically demonstrate the success of our algorithms by applying them to experimental design on the Boston Housing dataset and directed vertex cover on the Email EU dataset.  log 1 1 Introduction From summarization and recommendation to clustering and inference, many machine learning tasks are inherently discrete. Submodularity is an attractive property when designing discrete objective functions, as it encodes a natural diminishing returns condition and also comes with an extensive literature on optimization techniques. For example, submodular optimization techniques have been successfully applied in a wide variety of machine learning tasks, including sensor placement [Krause and Guestrin, 2005], document summarization [Lin and Bilmes, 2011], speech subset selection [Wei et al., 2013] influence maximization in social networks [Kempe et al., 2003], information gathering [Golovin and Krause, 2011], and graph-cut based image segmentation [Boykov et al., 2001, Jegelka and Bilmes, 2011], to name a few. However, in instances where the objective function is not submodular, existing techniques for submodular optimization many perform arbitrarily poorly, motivating the need to study broader function classes. 1 While several notions of approximate submodularity have been studied, the class of γ-weakly submodular functions have (arguably) enjoyed the most practical success. For example, γ-weakly submodular optimization techniques have been used in feature selection [Das and Kempe, 2011, Khanna et al., 2017], anytime linear prediction [Hu et al., 2016], interpretation of deep neural networks [Elenberg et al., 2017], and high dimensional sparse regression problems [Elenberg et al., 2018]. Here, we study the constrained maximization problem g(S) − c(S) , max S≤k (1) where g is a non-negative monotone γ-weakly submodular function and c is a non-negative modular function. Problem (1) has various interpretations which may extend the current submodular framework to apply to more tasks in machine learning. For instance, the modular cost c may be added as a penalty to existing submodular maximization problems to encode a cost for each element. Such a penalty term may play the role of a regularizer or soft constraint in a model. When g models the revenue of some collection of products S and c models the cost of each item, then (1) corresponds to maximizing profits. While Problem (1) has promising modeling potential, existing optimization techniques fail to provide nontrivial approximation guarantees for it. The main reason for that is that most existing techniques require the objective function to take only non-negative values, while g(S) − c(S) may take both positive and negative values. Moreover, g(S) − c(S) might be non-monotone, and thus, the definition of γ-weak submodularity does not even apply to it when γ < 1. Our Contributions. We provide several fast algorithms for solving Problem (1) as well as a matching hardness result and experimental validation of our methods. In particular, 1. Algorithms. In the case where γ is known, we provide a deterministic algorithm which uses O(nk) function evaluations and returns a set S such that g(S)− c(S) ≥ (1 − e−γ)g(OPT ) − c(OPT ). If g is regarded as revenue and c as a cost, then this guarantee intuitively states that the algorithm will return a solution whose total profit is at least as much as would be obtained by paying the same cost as the optimal solution while gaining at least a fraction of (1 − e−γ) out of the revenue of the last solution. We also describe a randomized variant of our algorithm which uses O(n log 1  ) function evaluations and has a similar approximation guarantee in expectation, but with an  additive loss in the approximation factor. For the unconstrained setting (when k = n) we provide another randomized algorithm which achieves the same approximation guarantee in expectation using only O(n) function evaluations. When γ is unknown, we give a meta-algorithm for guessing γ that loses a δ additive factor in the approximation ratio and increases the run time by a multiplicative O( 1 δ log 1 δ ) factor. 2. Hardness of Approximation. To complement our algorithms, we provide a matching hardness result which shows that no algorithm which makes polynomially many queries in the value oracle model may do better. To the best of our knowledge, this is the first hardness result of this kind for γ-weakly submodular functions. 3. Experimental Evaluation. We demonstrate the effectiveness of our algorithm on experimental design on the Boston Housing dataset and directed vertex cover on the Email EU dataset, both with costs. 2 Prior Work The celebrated result of Nemhauser et al. [1978] showed that the greedy algorithm achieves a (1 − 1/e) approximation for maximizing a nonnegative monotone submodular function subject to a cardinality constraint. Das and Kempe [2011] showed the more general result that the greedy algorithm achieves a (1 − e−γ) approximation when g is γ-weakly submodular. At the same time, an extensive line of research has lead to the development of algorithms to handle non-monotone submodular objectives and/or more complicated constraints (see, e.g., Buchbinder and Feldman [2016], Chekuri et al. [2014], Ene and Nguyen [2016], Feldman et al. [2017], Lee et al. [2010], Sviridenko [2004]). The (1 − 1/e) approximation was shown to be optimal in the value oracle model Nemhauser and Wolsey [1978], but until this work, no stronger hardness result was known for constrained γ-weakly submodular maximization. The problem of maximizing g + (cid:96) for non-negative monotone submodular g and an (arbitrary) modular function (cid:96) under cardinality constraints was first considered in Sviridenko et al. [2017], who gave a randomized polynomial time algorithm which outputs a set S such that g(S) + (cid:96)(S) ≥ (1−1/e)g(OPT )+(cid:96)(OPT ), where OPT is the optimal set. This approximation was shown to be optimal in the value oracle model via a reduction from submodular maximization with bounded curvature. However, the algorithm of Sviridenko et al. [2017] is of mainly theoretical interest, as it requires continuous optimization of the multilinear extension and an expensive routine to guess the contribution of OPT to the modular term, yielding it practically intractable. Feldman [2019] suggested the idea of using a surrogate objective that varies with time, and showed that this idea removes the need for the guessing step. However, the algorithm of Feldman [2019] still requires expensive sampling as it is based on the multilinear extension. Moreover, neither of these approaches can currently handle γ-weakly submodular functions, as optimization routines that go through their multilinear extensions have not yet been developed. Organization The remainder of the paper is organized as follows. Preliminary def- initions are given in Section 2. The algorithms we present for solving Problem (1) are presented in Section 3. The hardness result is stated in Section 4. Applications, experimental set-up, and experimental results are discussed in Section 5. Finally, we conclude with a discussion in Section 6. 2 Preliminaries Let Ω be a ground set of size n. For a real-valued set function g : 2Ω → R, we write the marginal gain of adding an element e to a set A as g(e S) (cid:44) g(S ∪ {e}) − g(S). We say that g is monotone if g(A) ≤ g(B) for all A ⊆ B, and say that g is submodular if for all sets A ⊆ B ⊆ Ω and element e /∈ B, g(e A) ≥ g(e B) . (2) When g is interpreted as a utility function, (2) encodes a natural diminishing returns condition in the sense that the marginal gain of adding an element decreases as the current e∈B g(e A) ≥ g(A ∪ B) − g(A), which allows for the following natural extension. A monotone set function g is γ-weakly set grows larger. An equivalent definition is that (cid:80) submodular for γ ∈ (0, 1] if(cid:88) g(e A) ≥ γ (g(A ∪ B) − g(A)) (3) e∈B\A 3 c(S) =(cid:80) holds for all A ⊆ B. In this case, γ is referred to as the submodularity ratio. Intuitively, such a function g may not have strictly diminishing returns, but the increase in the returns is bounded by the marginals. Note that g is submodular if and only if it is γ-weakly submodular with γ = 1. A real-valued set function c : 2Ω → R is modular if (2) holds with equality. A modular function may always be written in terms of coefficients as e∈S ce and is non-negative if and only if all of its coefficients are non-negative. Our algorithms are specified in the value oracle model, namely under the assumption that there is an oracle that, given a set S ⊆ Ω, returns the value g(S). As is standard, we analyze the run time complexity of these algorithms in terms of the number of function evaluations they require. 3 Algorithms In this section, we present a suite of fast algorithms for solving Problem 1. The main idea behind each of these algorithms is to optimize a surrogate objective, which changes throughout the algorithm, preventing us from getting stuck in poor local optima. Further computational speed ups are obtained by randomized sub-sampling of the ground set.1 The first algorithms we present assume knowledge of the weak submodularity parameter γ. However, γ is rarely known in practice (unless it is equal to 1), and thus, we show in Section 3.4 how to adapt these algorithms for the case of unknown γ. To motivate the distorted objective we use, let us describe a way in which the greedy algorithm may fail. Suppose there is a "bad element" b ∈ Ω which has the highest overall gain, g(b) − cb and so is added to the solution set; however, once added, the marginal gain of all remaining elements drops below the corresponding costs, and so the greedy algorithm terminates. This outcome is suboptimal when there are other elements e that, although their overall marginal gain g(e S) − ce is lower, have much higher ratio between the marginal utility g(e S) and the cost ce (see Appendix A for an explicit construction). To avoid this type of situation, we design a distorted objective which initially places higher relative importance on the modular cost term c, and gradually increases the relative importance of the utility g as the algorithm progresses. Our analysis relies on two functions: Φ, the distorted objective, and Ψ, an important quantity in analyzing the trajectory of Φ. Let k denote the cardinality constraint, then for any i = 0, 1, . . . , k and any set T , we define Φi(T ) (cid:44)(cid:16) (cid:26) (cid:17)k−i 1 − γ k (cid:16) 1 − γ k g(T ) − c(T ) . (cid:17)k−(i+1) (cid:27) Additionally, for any iteration i = 0, 1, . . . , k − 1 of our algorithm, a set T ⊆ Ω, and an element e ∈ Ω, let Ψi(T, e) (cid:44) max 0, g(e T ) − ce . 3.1 Distorted Greedy Our first algorithm, Distorted Greedy, is presented as Algorithm 1. At each iteration, this algorithm chooses an element ei maximizing the increase in the distorted objective. The algorithm then only accepts ei if it positively contributes to the distorted objective. 1We note that these two techniques can be traced back to the works of Feldman [2019] and Mirza- soleiman et al. [2015], respectively. 4 Algorithm 1 Distorted Greedy Input: utility g, weak γ, cost c, cardinality k Initialize S0 ← ∅ for i = 0 to k − 1 do (cid:1)k−(i+1) ei ← arg maxe∈Ω (cid:8)(cid:0)1 − γ (cid:1)k−(i+1) g(ei Si) − cei > 0 then if (cid:0)1 − γ g(e Si) − ce k (cid:9) k Si+1 ← Si ∪ {ei} Si+1 ← Si else Return Sk The analysis consists mainly of two lemmas. First, Lemma 1 shows that the marginal gain in the distorted objective is lower bounded by a term involving Ψ. This fact relies on the non-negativity of c and the rejection step in the algorithm. Lemma 1. In each iteration of Distorted Greedy, Φi+1(Si+1) − Φi(Si) = Ψi(Si, ei) + γ k 1 − γ k (cid:16) (cid:17)k−(i+1) g(Si) . Proof. By expanding the definition of Φ and rearranging, we get Φi+1(Si+1) − Φi(Si) (cid:16) (cid:16) (cid:16) = = = 1 − γ k 1 − γ k 1 − γ k (cid:17)k−(i+1) (cid:17)k−(i+1) (cid:17)k−(i+1) g(Si+1) − c(Si+1) −(cid:16) g(Si+1) − c(Si+1) −(cid:16) 1 − γ k 1 − γ k (cid:17)k−i (cid:17)k−(i+1)(cid:16) [g(Si+1) − g(Si)] − [c(Si+1) − c(Si)] + g(Si) + c(Si) (cid:17) g(Si) + c(Si) (cid:17)k−(i+1) (cid:16) 1 − γ k 1 − γ γ k k g(Si) . k (cid:16) Φi+1(Si+1) − Φi(Si) = Greedy passes, which means that Ψi(Si, ei) =(cid:0)1 − γ (cid:1)k−(i+1) Now let us consider two cases. First, suppose that the if statement in Distorted g(ei Si) − cei > 0 and that ei is added to the solution set. By the non-negativity of c, we can deduce in this case that ei /∈ Si, and thus, g(Si+1) − g(Si) = g(ei Si) and c(Si+1) − c(Si) = cei. Hence, (cid:16) (cid:17)k−(i+1) (cid:16) (cid:1)k−(i+1) Next, suppose that the if statement in Distorted Greedy does not pass, which g(ei Si) − cei and the algorithm does not add ei to its solution. In particular, Si+1 = Si, and thus, g(Si+1) − g(Si) = 0 and c(Si+1) − c(Si) = 0. In this case, (cid:16) means that Ψi(Si, ei) = 0 ≥(cid:0)1 − γ (cid:17)k−(i+1) g(ei Si) − cei + 1 − γ k (cid:17)k−(i+1) = Ψi(Si, ei) + 1 − γ k 1 − γ k g(Si) . g(Si) γ k γ k k Φi+1(Si+1) − Φi(Si) = 0 + (cid:17)k−(i+1) (cid:16) 1 − γ k g(Si) (cid:17)k−(i+1) γ k 1 − γ k γ k = Ψi(Si, ei) + g(Si) . 5 The second lemma shows that the marginal gain in the distorted objective is suffi- ciently large to ensure the desired approximation guarantees. This fact relies on the monotonicity and γ-weak submodularity of g. Lemma 2. In each iteration of Distorted Greedy, (cid:16) (cid:17)k−(i+1) Ψi(Si, ei) ≥ γ k 1 − γ k [g(OPT ) − g(Si)] − 1 k c(OPT ) . (cid:17)k−(i+1) Proof. Observe that k · Ψi(Si, ei) = k · max e∈Ω (cid:26) (cid:16) 0, (cid:26) 0, 1 − γ k 1 − γ k 1 − γ k (cid:16) (cid:26)(cid:16) (cid:20)(cid:16) (cid:17)k−(i+1) (cid:17)k−(i+1) (cid:88) (cid:17)k−(i+1) ≥ OP T · max e∈Ω ≥ OP T · max e∈OPT 1 − γ k ≥ (cid:88) (cid:16) (cid:16) e∈OPT 1 − γ k 1 − γ k ≥ γ = (cid:27) g(e Si) − ce (cid:17)k−(i+1) (cid:17)k−(i+1) g(e Si) − ce g(e Si) − ce (cid:21) g(e Si) − ce (cid:27) (cid:27) (definitions of Ψ and ei) (OPT ≤ k) (restricting maximization) (averaging argument) g(e Si) − c(OPT ) e∈OPT [g(OPT ) − g(Si)] − c(OPT ) . (γ-weak submodularity) Using these two lemmas, we present an approximation guarantee for Distorted Greedy. Theorem 3. Distorted Greedy makes O(nk) evaluations of g and returns a set R of size at most k with g(R) − c(R) ≥(cid:0)1 − e−γ(cid:1) g(OPT ) − c(OPT ) . Proof. Since c is modular and g is non-negative, the definition of Φ gives Φ0(S0) = g(∅) − c(∅) = 1 − γ k g(∅) ≥ 0 . (cid:16) (cid:17)k and Φk (Sk) = g(Sk) − c(Sk) = g(Sk) − c(Sk) . Using this and the fact that the returned set R is in fact Sk, we get (cid:16) (cid:17)k (cid:17)0 1 − γ k (cid:16) 1 − γ k g(R) − c(R) ≥ Φk(Sk) − Φ0(S0) = Φi+1(Si+1) − Φi(Si) . (4) k−1(cid:88) i=0 6 Applying Lemmas 1 and 2, respectively, we have Φi+1(Si+1) − Φi(Si) = Ψi(Si, ei) + (cid:17)k−(i+1) (cid:17)k−(i+1) 1 − γ g(Si) k [g(OPT ) − g(Si)] 1 − γ k g(OPT ) − 1 k g(Si) c(OPT ) . ≥ γ k − 1 k γ k = (cid:16) (cid:16) (cid:16) (cid:16) 1 − γ k c(OPT ) + 1 − γ k γ k γ k (cid:16) (cid:17)k−(i+1) (cid:16) (cid:17)k−(i+1) (cid:17)k−(i+1) (cid:17)i(cid:35) (cid:17)k(cid:19) Finally, plugging this bound into (4) yields (cid:21) k i=0 1 − γ k (cid:20) γ g(R) − c(R) ≥ k−1(cid:88) (cid:34) k−1(cid:88) (cid:18) 1 −(cid:16) ≥(cid:0)1 − e−γ(cid:1) g(OPT ) − c(OPT ) . 1 − γ k 1 − γ k γ k i=0 = = g(OPT ) − c(OPT ) g(OPT ) − c(OPT ) g(OPT ) − 1 k c(OPT ) 3.2 Stochastic Distorted Greedy Our second algorithm, Stochastic Distorted Greedy, is presented as Algorithm 2. It uses the same distorted objective as Distorted Greedy, but enjoys an asymptotically faster run time due to sampling techniques of Mirzasoleiman et al. [2015]. Instead of optimizing over the entire ground set at each iteration, Stochastic Distorted Greedy optimizes over a random sample Bi ⊆ Ω of size O(cid:0) n (cid:1). This sampling k log 1  procedure ensures that sufficient potential gain occurs in expectation, which is true for the following reason. If the sample size is sufficiently large, then Bi contains at least one element of OPT with high probability. Conditioned on this (high probability) event, choosing the element with the maximum potential gain is at least as good as choosing an average element from OPT . Algorithm 2 Stochastic Distorted Greedy (cid:8)(cid:0)1 − γ  )(cid:101) k log( 1 (cid:1)k−(i+1) Input: utility g, weak γ, cost c, cardinality k, error  Initialize S0 ← ∅, s ← (cid:100) n for i = 0 to k − 1 do Bi ← sample s elements uniformly and independently from Ω (cid:1)k−(i+1) ei ← arg maxe∈Bi Si+1 ← Si ∪ {ei} Si+1 ← Si g(ei Si) − cei > 0 then if (cid:0)1 − γ g(e Si) − ce (cid:9) else k k Return Sk The next three lemmas formalize this idea and are analogous to Lemma 2 in Mirza- soleiman et al. [2015]. The first step is to show that an element of OPT is likely to 7 appear in the sample Bi. Lemma 4. In each step 0 ≤ i ≤ k − 1 of Stochastic Distorted Greedy, Proof. Pr [Bi ∩ OPT = ∅] ≤ where we used the known inequality 1 − x ≤ e−x. Thus, Pr [Bi ∩ OPT (cid:54)= ∅] ≥ 1 − e− sk n 1 − e− sk n Pr [Bi ∩ OPT (cid:54)= ∅] ≥ (1 − ) OPT . k (cid:19)s ≤ e−s (cid:18) n 1 − OPT k ≥(cid:16) OPT OPT n = e− sk n OPT k , (cid:17) OPT k ≥ (1 − ) OPT k , where the second inequality follows from 1 − e−ax ≥ (1 − e−a)x for x ∈ [0, 1] and a > 0, and the last inequality follows from the choice of sample size s = (cid:100) n (cid:101). k log 1 Conditioned on the fact that at least one element of OPT was sampled, the following lemma shows that sufficient potential gain is made. Lemma 5. In each step 0 ≤ i ≤ k − 1 of Stochastic Distorted Greedy, Eei [Ψi(Si, ei) Si, Bi ∩ OPT (cid:54)= ∅] ≥ γ OPT − 1 (cid:17)k−(i+1) (cid:16) 1 − γ k OPT c(OPT ) . [g(OPT ) − g(Si)] Proof. Throughout the proof, all expectations are conditioned on the current set Si and the event that Bi ∩ OPT (cid:54)= ∅, as in the statement of the lemma. For convenience, we drop the notations of these conditionals from the calculations below. Eei [Ψi(Si, ei)] = E (definition of ei) Ψi(Si, ei) (cid:21) (cid:20) (cid:20) (cid:20) ≥ E ≥ E max e∈Bi max e∈Bi∩OPT Ψi(Si, ei) (cid:26)(cid:16) 1 − γ k (cid:21) (cid:17)k−(i+1) (cid:27)(cid:21) (restricting max) g(e Si) − ce max e∈Bi∩OPT (definition of Ψ) We now note that Bi ∩ OP T is a subset of OP T that contains every element of OP T with the same probability. Moreover, this is true also conditioned on Bi ∩ OP T (cid:54)= ∅. Thus, picking the best element from Bi ∩ OP T (when this set is not-empty) achieves gain at least as large as picking a random element from Bi ∩ OP T , which is identical to picking a random element from OP T . Plugging this observation into the previous inequality, we get . (cid:21) g(e Si) − ce Eei [Ψi(Si, ei)] ≥ 1 OPT = 1 OPT ≥ γ OPT ≥ γ OPT 1 − γ k (cid:20)(cid:16) (cid:17)k−(i+1) (cid:17)k−(i+1) (cid:88) (cid:17)k−(i+1) (cid:17)k−(i+1) (cid:88) (cid:16) (cid:16) (cid:16) e∈OPT 1 − γ k 1 − γ k 1 − γ k 8 g(e Si) − 1 OPT c(OPT ) e∈OPT [g(OPT ∪ Si) − g(Si)] − 1 OPT c(OPT ) [g(OPT ) − g(Si)] − 1 OPT c(OPT ) , where the last two inequalities follows from the γ-weak submodularity and monotonicity of g, respectively. The next lemma combines the previous two to show that sufficient gain of the distorted objective occurs at each iteration. Lemma 6. In each step of Stochastic Distorted Greedy, (cid:16) (cid:18) γ k 1 − γ k (cid:17)k−(i+1)(cid:2)g(OPT ) − E [g(Si)](cid:3) − 1 (cid:19) c(OPT ) . k E [Ψi(Si, ei)] ≥ (1 − ) Proof. By the law of iterated expectation and the non-negativity of Ψ, Eei [Ψi(Si, ei) Si] =Eei [Ψi(Si, ei) Si, Bi ∩ OPT (cid:54)= ∅] Pr [Bi ∩ OPT (cid:54)= ∅] (cid:18) γ ≥ Eei [Ψi(Si, ei) Si, Bi ∩ OPT (cid:54)= ∅] Pr [Bi ∩ OPT (cid:54)= ∅] ≥ + Eei [Ψi(Si, ei) Si, Bi ∩ OPT = ∅] Pr [Bi ∩ OPT = ∅] (cid:19) [g(OPT ) − g(Si)] − 1 (cid:17)k−(i+1) (cid:17)k−(i+1) (cid:16) (cid:18) γ OPT c(OPT ) OPT [g(OPT ) − g(Si)] − 1 k c(OPT ) , (cid:16) 1 − γ k 1 − γ k k = (1 − ) (cid:19)(cid:18) (1 − ) (cid:19) OPT k where the second inequality holds by Lemmas 4 and 5. The lemma now follows since the law of iterated expectations also implies E [Ψi(Si, ei)] = ESi [Eei [Ψi(Si, ei) Si]]. Using the previous lemmas, we can now prove the approximation guarantees of Stochastic Distorted Greedy. Theorem 7. Stochastic Distorted Greedy uses O(n log 1 and returns a set R with E [g(R) − c(R)] ≥(cid:0)1 − e−γ − (cid:1) g(OPT ) − c(OPT ) .  ) evaluations of g Proof. As discussed in the proof of Theorem 3, we have that E [g(R) − c(R)] ≥ E [Φk(Sk) − Φ0(S0)] = E [Φi+1(Si+1) − Φi(Si)] , (5) k−1(cid:88) i=0 and so it is enough to lower bound each term in the rightmost side. To this end, we apply Lemma 1 and Lemma 6 to obtain E [Φi+1(Si+1) − Φi(Si)] ≥ E [Ψi(Si, ei)] + γ k 1 − γ k ≥ (1 − ) 1 − γ k (cid:16) (cid:17)k−(i+1) (cid:16) (cid:17)k−(i+1) E [g(Si)] (cid:17)k−(i+1) (cid:16) 1 − γ k (cid:16) (cid:18) γ (cid:18) γ k 1 − γ k k + γ k = (1 − ) (cid:17)k−(i+1) E [g(Si)] [g(OPT ) − E [g(Si)]] + (cid:19) c(OPT ) g(OPT ) − 1 k (cid:19) 1 k c(OPT ) 9 (cid:17)k−(i+1) E [g(Si)] (cid:17)k−(i+1) (cid:16) (cid:18) γ (cid:16) 1 − γ k 1 − γ k k g(OPT ) − 1 k +  · γ k ≥ (1 − ) (cid:19) c(OPT ) , where the last inequality followed from non-negativity of g. Plugging this bound into (5) yields E [g(R) − c(R)] ≥ (1 − ) 1 − γ k g(OPT ) − 1 k c(OPT ) k−1(cid:88) (cid:34) i=0 (cid:20) γ k−1(cid:88) k (cid:16) (cid:16) (cid:17)k−(i+1) (cid:17)i(cid:35) (cid:21) g(OPT ) − (1 − )c(OPT ) γ k 1 − γ k = (1 − ) ≥ (1 − )(cid:0)1 − e−γ(cid:1) g(OPT ) − c(OPT ) =(cid:0)1 − e−γ − α(cid:1) g(OPT ) − c(OPT ) , i=0 where the second inequality follows from non-negativity of g and c, and α = 1 − e−γ ≤ 0.65. Greedy, observe that this algorithm has k rounds, each requiring s = (cid:100) n evaluations. Thus, the total number of function evaluations is k ×(cid:100) n k log 1 To bound the number of function evaluations used by Stochastic Distorted (cid:101) function k log 1 (cid:101) = O(n log 1  ). 3.3 Unconstrained Distorted Greedy In this section, we present Unconstrained Distorted Greedy, an algorithm for the unconstrained setting (i.e., k = n), listed as Algorithm 3. Unconstrained Distorted Greedy samples a single random element at each iteration, and adds it to the current solution if the potential gain is sufficiently large. Note that this algorithm is faster than the previous two, as it requires only O(n) evaluations of g. Algorithm 3 Unconstrained Distorted Greedy Input: utility g, weak γ, cost c, cardinality k Initialize S0 ← ∅ for i = 0 to n − 1 do ei ← sample uniformly from Ω if (cid:0)1 − γ (cid:1)n−(i+1) g(ei Si) − cei > 0 then n Si+1 ← Si ∪ {ei} Si+1 ← Si else Return Sn Like Distorted Greedy and Stochastic Distorted Greedy, Unconstrained Distorted Greedy relies on the distorted objective and the heart of the analysis is showing that the increase of this distorted objective is sufficiently large in each iteration. However, the argument in the analysis is different. Our analysis of the previous algorithms argued that "the best element is better than an average element", while the analysis of Unconstrained Distorted Greedy works with that average directly. This allows for significantly fewer evaluations of g required by the algorithm. 10 Lemma 8. In each step of Unconstrained Distorted Greedy, (cid:16) (cid:17)n−(i+1)(cid:2)g(OPT ) − E [g(Si)](cid:3) − 1 E [Ψi(Si, ei)] ≥ γ n 1 − γ n c(OPT ) . n Proof. We begin by analyzing the conditional expectation Eei [Ψi(Si, ei) Si] Ψi(Si, e) = e∈OPT e∈Ω (cid:88) (cid:88) (cid:88) (cid:88) e∈OPT (cid:16) (cid:16) (cid:16) e∈OPT 1 − γ n 1 − γ n 1 − γ n 1 n ≥ 1 n = 1 n ≥ 1 n = 1 n ≥ γ n ≥ γ n max 0, (cid:26) Ψi(Si, e) 1 − γ n 1 − γ n (cid:16) (cid:26)(cid:16) (cid:17)n−(i+1) (cid:17)n−(i+1) (cid:88) (cid:17)n−(i+1) (cid:17)n−(i+1) (cid:17)n−(i+1) g(e Si) − ce (cid:27) g(e Si) − ce (cid:27) (non-negativity of Ψ) (by definition of Ψ) (linearity of c) g(e Si) − 1 n c(OPT ) e∈OPT [g(OPT ∪ Si) − g(Si)] − 1 n [g(OPT ) − g(Si)] − 1 n c(OPT ) (γ-weakly submodular) c(OPT ) (monotonicity of g) . The lemma now follows by the law of iterated expectations. In the same way that Theorem 3 follows from Lemma 2, the next theorem follows from Lemma 8, and so we omit its proof. Theorem 9. Unconstrained Distorted Greedy requires O(n) function evalu- ations and outputs a set R such that E [g(R) − c(R)] ≥ (1 − e−γ)g(OPT ) − c(OPT ) . 3.4 Guessing Gamma: A Geometric Sweep The previously described algorithms required knowledge of the submodularity ratio γ. However, it is very rare that the precise value of γ is known in practice -- unless g is submodular, in which case γ = 1. Oftentimes, γ is data dependent and only a crude lower bound L ≤ γ is known. In this section, we describe a meta algorithm that "guesses" the value of γ. γ-Sweep, listed as Algorithm 4, runs a maximization algorithm A as a subroutine with a geometrically decreasing sequence of "guesses" γ(k) δ(cid:101). The best set obtained by this procedure is guaranteed to for k = 0, 1, . . . ,(cid:100) 1 have nearly as good approximation guarantees as when the true submodularity ratio γ is known exactly. Moreover, fewer guesses are required if a good lower bound L ≤ γ is known, which is true for several problems of interest. In the following theorem, we assume that A(g, γ, c, k, ) is an algorithm which returns a set S with S ≤ k and E [g(S) − c(S)] ≥ (1 − e−γ − ) g(OPT ) − c(OPT ) when g is γ-weakly submodular, and L ≤ γ is known (one may always use L = 0). δ log 1 11 Input: utility g, cost c, algorithm A, lower bound L, δ ∈ (0, 1) Algorithm 4 γ-Sweep S−1 ← ∅, T ←(cid:108) 1 (cid:16) δ ln 1 max{δ,L} (cid:17)(cid:109) for r = 0 to T do γr ← (1 − δ)r Sr ← A(g, γr, c, k, δ) Return the set R maximizing g(R) − c(R) among S−1, S0, . . . , ST . Theorem 10. γ-Sweep requires at most O(cid:0) 1 (cid:1) calls to A and returns a set E [g(R) − c(R)] ≥(cid:0)1 − e−γ − O(δ)(cid:1) g(OPT ) − c(OPT ) . δ log 1 δ R with Proof. We consider two cases. First, suppose that γ < δ. Under this assumption, we have 1 − e−γ − δ < 1 − e−δ − δ ≤ δ − δ = 0 , where the second inequality used the fact that 1 − e−x ≤ x. Thus, g(∅) − c(∅) ≥ 0 ≥ (1 − e−γ − δ)g(OPT ) − c(OPT ) , where the first inequality follows from non-negativity of g, and the second inequality follows from non-negativity of both c and g. Because Algorithm 4 sets S(−1) = ∅ and R is chosen to be the best solution, g(R) − c(R) ≥ g(∅) − c(∅) ≥(cid:0)1 − e−γ − δ(cid:1) g(OPT ) − c(OPT ) . (cid:16) 1 (cid:17)T ≥ 1 For the second case, suppose that γ ≥ δ. Recall that γ ≥ L by assumption, and thus, γ ≥ B (cid:44) max{δ, L}. Now, we need to show that (1 − δ)T ≤ B. This is equivalent to . This is true since the 1−δ inequality δ ≤ ln B , and by taking ln, this is equivalent to T ≥ ln 1 B ln 1 1−δ , which holds for all δ ∈ (0, 1), implies (cid:16) 1 (cid:17) 1−δ (cid:25) (cid:24) 1 δ T = ln 1 B ≥ 1 δ ln 1 B ≥ ln 1 B ln 1 1−δ . Hence, we have proved that (1 − δ)T ≤ B ≤ γ, which implies that there exists t ∈ {0, 1, . . . , T} such that γ ≥ γ(t) ≥ (1− δ)γ. For notational convenience, we write γ = γ(t). Because g is γ-weakly submodular and γ ≥ γ, g is also γ-weakly submodular. Therefore, by assumption, the algorithm A returns a set S(t) which satisfies (cid:105) ≥(cid:0)1 − e−γ − δ(cid:1) g(OPT ) − c(OPT ) . g(S(t)) + (cid:96)(S(t)) E(cid:104) From the convexity of ex, we have eδ ≤ (1 − δ)e0 + δe1 = 1 + (e − 1)δ for all δ ∈ [0, 1]. Using this inequality, and the fact that γ ≥ (1 − δ)γ, we get 1 − e−γ ≥ 1 − e−(1−δ)γ ≥ 1 − e−γeδ ≥ 1 − e−γ(1 + (e − 1)δ) = 1 − e−γ − βδ . We remark that β ≤ e − 1 ≈ 1.72. Thus, by the non-negativity of g and because the output set R was chosen as the set with highest value, (cid:105) ≥(cid:0)1 − e−γ − (βδ + δ)(cid:1) g(OPT )−c(OPT ) . E [g(R) − c(R)] ≥ E(cid:104) g(S(t)) − c(S(t)) 12 Figure 1: Results of the γ-Sweep with Distorted Greedy (DG) and Stochastic Distorted Greedy (SDG) as subroutines. For Stochastic Distorted Greedy, mean values with standard deviation bars are reported over 20 trials. In our experiments, we see that Stochastic Distorted Greedy combined with the γ-Sweep outperforms Distorted Greedy with γ-Sweep, especially for larger values of k. Here, we provide some experimental evidence and explanation for why this may be occurring. Figure 1 shows the objective value of the sets {Sr}T r=0 produced by Stochastic Distorted Greedy and Distorted Greedy during the γ-Sweep for cardinality constraints k = 5, 10, and 20. Both subroutines return the highest objective value for similar ranges of γ. However, the Stochastic Distorted Greedy subroutine appears to be better in two ways. First, the average objective value is usually larger, meaning that an individual run of Stochastic Distorted Greedy is returning a higher quality set than Distorted Greedy. This is likely due to the sub-sampling of the ground set, which might help avoiding the picking of a single "bad element", if one exists. Second, the variation in Stochastic Distorted Greedy leads to a higher chance of producing a good solution. For many values of γ, the Distorted Greedy subroutine returns a set of the same value; thus, the extra guesses of γ are not particularly helpful. On the other hand, the variation within the Stochastic Distorted Greedy subroutine means that these extra guesses are not wasted; in fact, they allow a higher chance of producing a set with good value. Figure 1 also shows that the objective function throughout the sweep is fairly well-behaved, suggesting the possibility of early stopping heuristics. However, that is outside the scope of this paper. 4 Hardness Result In this section, we give a hardness result which complements our algorithmic guaran- tees. The hardness result shows that -- in the case where c = 0 -- no algorithm making polynomially many queries to g can achieve a better approximation ratio than 1 − e−γ. Although this was known in the case when γ = 1 (i.e., g is submodular), the more general result for γ < 1 was unknown until this work. Theorem 11. For every two constants ε > 0 and γ ∈ (0, 1], no polynomial time algorithm achieves (1 − e−γ + ε)-approximation for the problem of maximizing a non-negative monotone γ-weakly submodular function subject to a cardinality constraint in the value oracle model. As is usual in hardness proofs for submodular functions, the proof is based on constructing a family of γ-weakly submodular functions on which any deterministic algorithm will perform poorly in expectation, and then applying Yao's principle. It 13 B\A(cid:88) f (B A) = B\A(cid:88) turns out that, instead of proving Theorem 11, it is easier to prove a stronger theorem given below as Theorem 12. However, before we can present Theorem 12, we need the following definition (this definition is related to a notion called the DR-ratio defined by Kuhnle et al. [2018] for functions over the integer lattice). Definition 4.1. A function f : 2N → R is γ-weakly DR if for every two sets A ⊆ B ⊆ N and element u ∈ N \ B it holds that f (u A) ≥ γ · f (u B). Theorem 12. For every two constants ε > 0 and γ ∈ (0, 1], no polynomial time algorithm achieves (1 − e−γ + ε)-approximation for the problem of maximizing a non- negative monotone γ-weakly DR function subject to a cardinality constraint in the value oracle model. The following observation shows that every instance of the problem considered by Theorem 12 is also an instance of the problem considered by Theorem 11, and therefore, Theorem 12 indeed implies Theorem 11. Observation 13. A monotone γ-weakly DR set function f : 2N → R≥0 is also γ-weakly submodular. Proof. Consider arbitrary sets A ⊆ B ⊆ N , and let us denote the elements of the set B \ A by u1, u2, . . . , uB\A in a fixed arbitrary order. Then, f (ui A ∪ {u1, u2, . . . , ui−1}) ≥ γ · f (ui A) . i=1 i=1 The following proposition is the main technical component used in the proof of Theorem 12. To facilitate the reading, we defer its proof to Section 4.1. Proposition 14. For every value ε(cid:48) ∈ (0, 1/6), value γ ∈ (0, 1] and integer k ≥ 1/ε(cid:48), there exists a ground set N of size (cid:100)3k/ε(cid:48)(cid:101) and a set function fT : 2N → R≥0 for every set T ⊆ N of size at most k such that (P1) fT is non-negtive monotone and γ-weakly DR. (P2) fT (S) ≤ 1 for every set S ⊆ N , and the inequality holds as an equality for S = T (P3) f∅(S) ≤ 1 − e−γ + 12ε(cid:48) for every set S of size at most k. (P4) fT (S) = f∅(S) when S ≥ 3k − g or S ∩ T ≤ g, where g = (cid:100)ε(cid:48)k + 3k2/N(cid:101). when the size of T is exactly k. At this point, let us consider some γ value and set ε(cid:48) = ε/20. Note that Theorem 12 is trivial for ε > 1, and thus, we may assume ε(cid:48) ∈ (0, 1/6), which implies that there exists a large enough integer k for which γ, ε(cid:48) and k obey all the requirements of Proposition 14. From this point on we consider the ground set N and the functions fT whose existence is guaranteed by Proposition 14 for these values of γ, ε(cid:48) and k. Let T be a random subset of N of size k (such subsets exist because N > k). Intuitively, in the rest of this section we prove Theorem 12 by showing that the problem max{f T (S) S ⊆ N ,S ≤ k} is hard in expectation for every algorithm. Property (P2) of Proposition 14 shows that the optimal solution for the problem max{f T (S) S ⊆ N ,S ≤ k} is T . Thus, an algorithm expecting to get a good approximation ratio for this problem should extract information about the random set T . The question is on what sets should the algorithm evaluate f T to get such information. Property (P4) of the proposition shows that the algorithm cannot get much information about T when querying f T on a set S that is either too large or has 14 a too small intersection with T . Thus, the only way in which the algorithm can get a significant amount of information about T is by evaluating f T on a set S that is small and not too likely to have a small intersection with T . Lemma 16 shows that such sets do not exist. However, before we can prove Lemma 16, we need the following known lemma. Lemma 15 (Proved by Skala [2013] based on results of Chv´atal [1979] and Hoeffd- ing [1963]). Consider a population of N balls, out of which M are white. Given a hypergeometric variable X measuring the number of white balls obtained by draw- ing uniformly at random n balls from this population, it holds for every t ≥ 0 that Pr[X ≥ nM/N + tn] ≤ e−2t2n. Lemma 16. For every set S ⊆ N whose size is less than 3k − g, Pr[S ∩ T ≤ g] ≥ 1 − e−Ω(ε3N). Proof. The distribution of S ∩ T is hypergeometric. More specifically, it is equivalent to drawing k balls from a population of N balls, of which only S are white. Thus, by Lemma 15, for every t ≥ 0 we have Pr[S ∩ T ≥ kS/N + tk] ≤ e−2t2k . Setting t = ε(cid:48) and observing that S ≤ 3k − g ≤ 3k, the last inequality yields Pr[S ∩ T ≥ 3k2/N + ε(cid:48)k] ≤ exp(cid:0)−2(ε(cid:48))2k(cid:1) = exp (cid:18) (cid:19) − ε2k 200 . The lemma now follows since g ≥ 3k2/N + ε(cid:48)k, and (by the definition of N ) k ≥ ε(cid:48)(N − 1) 3 = ε(N − 1) 60 = Ω(εN) . Corollary 17. For every set S ⊆ N , Pr[f∅(S) = f T (S)] ≥ 1 − e−Ω(ε3N). Proof. If S ≥ 3k − g, then the corollary follows from Property (P4) of Proposition 14. Otherwise, it follows by combining this property with Lemma 16. Using the above results, we are now ready to prove an hardness result for deterministic algorithms. Lemma 18. Consider an arbitrary deterministic algorithm ALG for the problem max{f (S) S ⊆ N ,S ≤ k} whose time complexity is bounded by some polynomial function C(N). Then, there is a large enough value k that depends only on C(·) and ε such that, given the random instance max{f T (S) S ⊆ N ,S ≤ k} of the above problem, the expected value of the output set of ALG is no better than 1 − e−γ + ε. Proof. Let S1, S2, . . . , S(cid:96) be the sets on which ALG evaluate f∅ when it is given the instance max{f∅(S) S ⊆ N ,S ≤ k}, and S(cid:96)+1 be its output set given this instance. Let E be the event that f∅(Si) = f T (Si) for every 1 ≤ i ≤ (cid:96) + 1. By combining Corollary 17 with the union bound, we get that Pr[E] ≥ 1 − ((cid:96) + 1) · e−Ω(ε3N) ≥ 1 − [C(N) + 1] · e−Ω(ε3N)) , where the second inequality holds since the time complexity of an algorithm upper bounds the number of sets on which it may evaluate f∅. Since C(N) is a polynomial 15 function, by making k large enough, we can make N large enough to guarantee that C(N) · e−Ω(ε3N) ≤ ε/20, and thus, Pr[E] ≥ 1 − ε/20. When the event E happens, the values that ALG gets when evaluating f T on the sets S1, S2, . . . , S(cid:96) is equal to the values that it would have got if the objective function was f∅. Thus, in this case ALG follows the same execution path as when it gets f∅, and outputs S(cid:96)+1 whose value is f T (S(cid:96)+1) = f∅(S(cid:96)+1) ≤ 1 − e−γ + 12ε(cid:48) = 1 − e−γ + 3ε/5 , where the inequality holds by Property (P3) of Proposition 14 since the output set S(cid:96)+1 must be a feasible set, and thus, of size at most k. When the event E does not happen, we can still upper bound the value of the output set of ALG by 1 using Property (P2) of the same proposition. Thus, if we denote by R the output set of ALG, then, by the law of iterated expectations, E[f T (R)] = Pr[E] · E[f T (S(cid:96)+1) E] + Pr[¬E] · E[f T (R) ¬E] ≤ 1 · (1 − e−γ + 3ε/5) + (ε/20) · 1 = 1 − e−γ + 13ε/20 ≤ 1 − e−γ + ε . Lemma 18 shows that there is a single distribution of instances which is hard for every deterministic algorithm whose time complexity is bounded by a polynomial function C(N). Since a randomized algorithm whose time complexity is bounded by C(N) is a distribution over deterministic algorithms of this kind, by Yao's principle, Lemma 18 yields the next corollary. Corollary 19. Consider an arbitrary algorithm ALG for the problem max{f (S) S ⊆ N ,S ≤ k} whose time complexity is bounded by some polynomial function C(N). Then, there is a large enough value k that depends only on C(·) such that, for some set T ⊆ N of size k, given the instance max{fT (S) S ⊆ N ,S ≤ k} of the above problem, the expected value of the output set of ALG is no better than 1 − e−γ + ε. Theorem 12 now follows from Corollary 19 because Property (P2) shows that the optimal solution for the instance max{fT (S) S ⊆ N ,S ≤ k} mentioned by this corollary has a value of 1, and Property (P1) of the same proposition shows that this instance is an instance of the problem of maximizing a non-negative monotone γ-weakly-DR function subject to a cardinality constraint. 4.1 Proof of Proposition 14 In this section we prove Proposition 14. We begin the proof by defining the function fT whose existence is guaranteed by the proposition. To define fT , we first need to define the following four helper functions. Note that in fT,2 we use the notation [x]+ to denote the maximum between x and 0. • tT (S) (cid:44) S \ T + min{g,S ∩ T} • fT,2(S) (cid:44) 1 − min{[tT (S) − k]+, k − g} • fT,3(S) (cid:44) 1 − min{S − tT (S), k − g} k − g . (cid:18) (cid:19)min{tT (S),k} 1 − γ • fT,1(S) (cid:44) Using these helper functions, we can now define fT for every set S ⊆ N by k − g k − g fT (S) (cid:44) 1 − fT,1(S) · fT,2(S) · fT,3(S) . 16 In the rest of this section we show that the function fT constructed this way obeys all the properties guaranteed by Proposition 14. We begin with the following technical observation that comes handy in some of our proofs. Observation 20. g ≤ 2ε(cid:48)k + 1 ≤ min{k − 2, 3ε(cid:48)k}. Proof. The second inequality of the observation follows immediately from the assumptions of Proposition 14 regarding k and ε(cid:48) (i.e., the assumptions that k ≥ 1/ε(cid:48) and ε(cid:48) ∈ (0, 1/6)). Thus, we only need to prove the first inequality. Since N ≥ 3k/ε(cid:48), 3k/ε(cid:48) + 1 = 2ε(cid:48)k + 1 . ≤ ε(cid:48)k + 3k2 N (cid:25) (cid:24) g = ε(cid:48)k + 3k2 The next three lemmata prove together Property (P1) of Proposition 14. Lemma 21. The outputs of the functions fT,1, fT,2 and fT,3 are always within the range [0, 1], and thus, fT is non-negative. Proof. We prove the lemma for every one of the functions fT,1, fT,2 and fT,3 separately. • Let b = 1 − γ/(k − g). One can observe that fT,1 is defined as b to the power of min{tT (S), k}. Thus, to show that the value of fT,1 always belongs to the range [0, 1], it suffices to prove that b ∈ (0, 1] and min{tT (S), k} is non-negative. The first of these claims holds since γ ∈ (0, 1] by assumption and k − g ≥ 2 by Observation 20, and the second claim can be verified by looking at the definition of tT (S) and noting that g must be positive. • Since k − g ≥ 0 by Observation 20, min{[tT (S) − k]+, k − g} ∈ [0, k − g]. Plugging this result into the definition of fT,2 yields that the value of fT,2 always belongs to [0, 1]. • Note that the definition of tT (S) implies tT (S) ≤ S. Together with the inequality k− g ≥ 0, which holds by Observation 20, this guarantees min{S− tT (S), k− g} ∈ [0, k − g]. Plugging this result into the definition of fT,3 yields that the value of fT,3 always belongs to [0, 1]. We say that a set function h : 2N → R is monotonically decreasing if f (A) ≥ f (B) for every two sets A ⊆ B ⊆ N . Lemma 22. The functions fT and S − tT (S) are monotone and the functions fT,1, fT,2 and fT,3 are monotonically decreasing. Proof. It immediately follows from the definition of tT (S) that it is monotone. Addi- tionally, S − tT (S) is a monotone function since it is equal to S − tT (S) = S ∩ T − min{g,S ∩ T} = [S ∩ T − g]+ . Plugging these observations into the definitions of fT,1, fT,2 and fT,3 yields that these three functions are all monotonically decreasing. Since these three functions are also non- negative by Lemma 21, this implies that fT,1(S)· fT,2(S)· fT,3(S) is also a monotonically decreasing function, and thus, fT is a monotone function since it is equal to 1 minus this product. Lemma 23. fT is γ-weakly-DR. 17 Proof. Consider arbitrary sets A ⊆ B ⊆ N , and fix an element u ∈ N \ B. We need to show that fT (u A) ≥ γ · fT (u B), which we do by considering three cases. The first case is when tT (A ∪ {u}) = tT (A) + 1 and tT (B ∪ {u}) = tT (B) + 1. Note that for every set S for which tT (S ∪ {u}) = tT (S) + 1 and tT (S) < k we have fT (u S) = fT,1(S) · fT,2(S) · fT,3(S) − fT,1(S ∪ {u}) · fT,2(S ∪ {u}) · fT,3(S ∪ {u}) (cid:18) (cid:19) · fT,1(S) · fT,3(S) (6) = fT,1(S) · fT,3(S) − 1 − γ k − g = γ k − g · fT,1(S) · fT,3(S) , and for every set S for which tT (S + u) = tT (S) + 1 and tT (S) ≥ k we have fT (u S) = fT,1(S) · fT,2(S) · fT,3(S) − fT,1(S ∪ {u}) · fT,2(S ∪ {u}) · fT,3(S ∪ {u}) = fT,1(S) · fT,2(S) · fT,3(S) − fT,1(S) · (cid:20) fT,2(S) − min{[(k − g) − (tT (S) − k)]+, 1} · fT,1(S) · fT,3(S) ≤ 1 k − g k − g k − g (cid:21) min{[(k − g) − (tT (S) − k)]+, 1} = · fT,3(S) (7) · fT,1(S) · fT,3(S) , where the last inequality holds since fT,1 and fT,3 are non-negative by Lemma 21. Since f1 and f3 are monotonically decreasing functions (by Lemma 22), the above inequalities show fT (u A) ≥ γ · fT (u B) whenever tT (A) < k -- if tT (B) < k, then the inequalities in fact show fT (u A) ≥ fT (u B), but this implies fT (u A) ≥ γ · fT (u B) because fT is monotone and γ ∈ (0, 1]. It remains to consider the option t(A) ≥ k. Note that when this happens, we also have tT (B) ≥ k because tT (S) is a monotone function. Thus, fT (u A) ≥ fT (u B) because fT,1, fT,3 and min{[(k − g) − (tT (S) − k)]+, 1} are all non-negative monotonically decreasing functions, and like in the above, this implies fT (u A) ≥ γ · fT (u B). The second case we consider is when tT (A ∪ {u}) = tT (A). Note that in this case we also have tT (B ∪ {u}) = tT (B) because the equality tT (A ∪ {u}) = tT (A) implies g = min{A∩ T, g} ≤ min{B ∩ T, g} ≤ g, which implies in its turn min{B ∩ T, g} = g. For every set S for which tT (S ∪ {u}) = tT (S) and u (cid:54)∈ S we have fT (u S) = fT,1(S) · fT,2(S) · fT,3(S) − fT,1(S ∪ {u}) · fT,2(S ∪ {u}) · fT,3(S ∪ {u}) (cid:20) fT,3(S) − min{[(k − g) − (S − tT (S))]+, 1} (cid:21) (8) = fT,1(S) · fT,2(S) · fT,3(S) − fT,1(S) · fT,2(S) · k − g = fT,1(S) · fT,2(S) · min{[(k − g) − (S − tT (S))]+, 1} . k − g Recall now that fT,1 and fT,3 are non-negative and monotonically decreasing functions by Lemmata 21 and 22. We additionally observe that the function min{[(k − g) − (S − tT (S)]+, 1} also has these properties because Lemma 22 shows that S − t(S) is monotone. Combining these facts, we get that the expression we obtained for f (u S) is a monotonically decreasing function of S. Thus, f (u A) ≥ f (u B), which implies f (u A) ≥ γ · f (u B). The last case we need to consider is the case that tT (A ∪ {u}) = tT (A) + 1 and tT (B ∪ {u}) = tT (B). The fact that tT (B ∪ {u}) = tT (B) implies that u ∈ T , and 18 therefore, the fact that t(A ∪ {u}) = t(A) + 1 implies that A ∩ T < g and tT (A) = A, which induces in its turn fT,3(A) = 1. There are now a few sub-cases to consider. If tT (A) < k, then fT (u A) = γ k − g ≥ γ · fT,1(B) · fT,2(B) · min{[(k − g) − (B − tT (B))]+, 1} = γ · fT (u B) , · fT,1(A) k − g where the first equality holds by Equation (6), the last equality holds by Equation (8), and the inequality holds since min{[(k−g)−(B−tT (B))]+, 1} ∈ [0, 1], fT,1(A) ≥ fT,1(B) ≥ 0 by Lemmata 21 and 22 and fT,2(B) ∈ [0, 1] by Lemma 21 . The second sub-case we need to consider is when k ≤ t(A) ≤ 2k − g − 1. In this case k − g · fT,1(A) = 1 k − g · fT,1(A) fT (u A) = min{[(k − g) − (tT (A) − k)]+, 1} · fT,1(B) ≥ γ k − g ≥ γ · min{[(k − g) − (B − tT (B))]+, 1} k − g · fT,1(B) · fT,2(B) = γ · fT (u B) , where the first equality holds by Equation (7) and the last equality holds by Equation (8). The first inequality holds since γ ∈ (0, 1] and fT,1 is non-negative and monotonicity decreasing, and the second inequality holds since min{[(k − g) − (B − tT (B))]+, 1} and fT,2(B) are both values in the range [0, 1] and γ · fT,1(B)/(k − g) is non-negative. The final sub-case we consider is the case in which tT (A) ≥ 2k − g − 1. Since T ∩ A < g (but T ∩ B ≥ g), in this sub-case we must have tT (B) ≥ 2k − g, which implies fT,2(B) = 0, and thus, fT (u B) = fT,1(B) · fT,2(B) · min{[(k − g) − (B − tT (B))]+, 1} k − g = 0 ≤ fT (u A) , where the equality holds by Equation (8), and the inequality follows from the monotonicity of fT . This completes the proof of Property (P1) of Proposition 14. The next lemma proves Property (P2) of this proposition. Lemma 24. fT (S) ≤ 1 for every set S ⊆ N , and the inequality holds as an equality for S = T when the size of T is exactly k. Proof. Since fT,1, fT,2 and fT,3 all output only values within the range [0, 1] by Lemma 21, fT (S) = 1 − fT,1(S) · fT,2(S) · fT,3(S) ≤ 1. Additionally, since g ≤ k by Observation 20, tT (T ) = g when T = k. Hence, for such T , fT,3(T ) = 1 − min{k − g, k − g} which implies, fT (T ) = 1 − fT,1(T ) · fT,2(T ) · fT,3(T ) = 1. k − g = 0 , The next lemma proves Property (P3) of Proposition 14. Lemma 25. f∅(S) ≤ 1 − e−γ + 8ε(cid:48) for every set S obeying S ≤ k. 19 Proof. Consider an arbitrary set S obeying S ≤ k. Note that for such a set we have t∅(S) = S ≤ k. Hence, f∅,2(S) = f∅,3(S) = 1 − min{0, k − g} = 1 . k − g Therefore, f∅(S) = 1 − f∅,1(S) · f∅,2(S) · f∅,3(S) = 1 − f∅,1(S) (cid:19)S (cid:18) (cid:19)k = 1 − 1 − γ k − g ≤ 1 − 1 − γ k − g . (9) To prove the lemma, we need to upper bound the rightmost side of the last inequality. Towards this goal, observe that (cid:19)k ≥ 1 − γ k − g (cid:19)k (cid:19)k−3ε(cid:48)k · (cid:18) 1 − γ k − 3ε(cid:48)k 1 − γ (cid:18) (cid:18) (cid:18) (cid:18) (cid:18) (cid:18) (cid:19)3ε(cid:48)k 1 − γ (cid:19) (cid:19)k−3ε(cid:48)k ≥ e−γ (cid:18) (10) where the first inequality holds since g ≤ 3ε(cid:48)k by Observation 20. Let us now lower bound the two factors in the product on the rightmost side. First, k − 3ε(cid:48)k k − 3ε(cid:48)k = , 1 − γ k − 3ε(cid:48)k 1 − γ2 k − 3ε(cid:48)k ≥ e−γ (1 − 2ε(cid:48)) , where the first inequality holds since the assumptions of Proposition 14 imply k − 3ε(cid:48)k ≥ k/2 ≥ 1, and the second inequality holds since these assumptions include k ≥ 1/ε(cid:48) and γ ∈ (0, 1]. Additionally, (cid:19)3ε(cid:48)k ≥ (cid:18) (cid:19)3ε(cid:48)k ≥ 1 − 2 k 1 − 2 k 1 − γ k − 3ε(cid:48)k · (3ε(cid:48)k) = 1 − 6ε(cid:48) , where the first inequality holds again since γ ∈ (0, 1] and k − 3ε(cid:48)k ≥ k/2. Plugging the last two lower bounds into Inequality (10) and combining with Inequality (9), we get f∅(S) ≤ 1 − e−γ(1 − 2ε(cid:48)) · (1 − 6ε(cid:48)) ≤ 1 − e−γ · (1 − 8ε(cid:48)) ≤ 1 − e−γ + 8ε(cid:48) . To complete the proof of Proposition 14, it remains to prove Property (P4), which is done by the next two observations. Observation 26. If S ∩ T ≤ g, then fT (S) = f∅(S). Proof. The only place in the definition of fT (S) in which the set T is used is in the definition of tT (S). Thus, fT (S) = fT (cid:48)(S) whenever tT (S) = tT (cid:48)(S). In particular, one can note that the condition S ∩ T ≤ g implies tT (S) = S = t∅(S), and thus, fT and f∅ must agree on the set S. Observation 27. The equality fT (S) = 1 holds for every set S of size at least 3k − g and set T of size at most k. Proof. Note that tT (S) ≥ S \ T ≥ S − T ≥ (3k − g) − k = 2k − g. Thus, fT,2(S) = 1 − min{[tT (S) − k]+, k − g} k − g = 1 − k − g k − g = 0 , which implies fT (S) = 1 − fT,1(S) · fT,2(S) · fT,3(S) = 1. 20 5 Experiments To demonstrate the effectiveness of our proposed algorithms, we run experiments on two applications: Bayesian A-optimal design with costs and directed vertex cover with costs. The code was written using the Julia programming language, version 1.0.2. Experiments were run on a 2015 MacBook Pro with 3.1 GHz Intel Core i7 and 8 GB DDR3 SDRAM and the timing was reported using the @timed feature in Julia. The source code is available on a public GitHub repository.2 5.1 Bayesian A-Optimal Design We first describe the problem of Bayesian A-Optimal design. Suppose that θ ∈ Rd is an unknown parameter vector that we wish to estimate from noisy linear measurements using least squares regression. Our goal is to choose a set S of linear measurements (the so-called experiments) which have low cost and also maximally reduce the variance of our estimate θ. More precisely, let x1, x2, . . . , xn ∈ Rd be a fixed set of measurement vectors, and let X = [x1, x2, . . . , xn] be the corresponding d × n matrix. Given a set of measurement vectors S ⊆ [n], we may run the experiments and obtain the noisy linear observations, yS = X T S θ + ζS , where ζS is normal i.i.d. noise, i.e., ζ1, . . . , ζn ∼ N (0, σ2). We estimate θ using the least squares estimator θ = (XSX T S yS. Assuming a normal Bayesian prior distribution on the unknown parameter, θ ∼ N (0, Σ), the sum of the variance of the coefficients given . We define g(S) = r(∅)− r(S) S )−1X T (cid:1)−1 σ2 XSX T S to be the reduction in variance produced by experiment set S. the measurement set S is r(S) = T r(cid:0)Σ−1 + 1 (cid:18) g(S) − c(S) = T r (Σ) − T r Suppose that each experiment xi has an associated non-negative cost ci. In this application, we seek to maximize the "revenue" of the experiment, (cid:19)−1− c(S) , Σ−1 + 1 σ2 XSX T S which trades off the utility of the experiments (i.e., the variance reduction in the estimator) and their overall cost. Bian et al. [2017] showed that g is γ-weakly submodular, providing a lower bound for γ in the case where Σ = βI. However, their bound relies rather unfavorably on the spectral norm of X, and does not extend to general Σ. Chamon and Ribeiro [2017] showed that g satisfies the stronger condition of γ-weak DR (Definition 4.1), but their bound on the submodularity ratio γ depends on the cardinality of the sets. We give a tighter bound here which relies on the Matrix Inversion Lemma (also known as Woodbury Matrix Identity and Sherman-Morrison-Woodbury Formula). Lemma 28 (Woodbury). For matrices A, C, U , and V of the appropriate sizes, (A + U CV )−1 = A−1 − A−1U (C−1 + V A−1U )−1V A−1 In particular, for a matrix A, a vector x, and a number α, we have that (cid:18) (cid:19)−1 A + 1 α xxT = A−1 − A−1xxT A−1 α + xT A−1x . 2https://github.com/crharshaw/submodular-minus-linear 21 Claim 29. g is a non-negative, monotone and γ-weakly submodular function with (cid:18) 1 + s2 σ2 λmax(Σ) (cid:19)−1 , γ ≥ where s = maxi∈[n] (cid:107)xi(cid:107)2. Proof. Recall that g(S) = T r (Σ) − T r (cid:18) Σ−1 + 1 σ2 XSX T S (cid:19)−1 . Let A, B ⊆ Ω, and suppose without loss of generality that A and B are disjoint. Using Lemma 28, we show how to obtain a formula for g(B ∪ A) − g(A). Let us denote MA = Σ−1 + 1 g(B ∪ A) − g(A) Σ−1 + A . Using linearity and cyclic property of trace, we obtain (cid:19)−1 σ2 XAX T Σ−1 + = T r (cid:18) (cid:18) (cid:19)−1 − T r (cid:19)−1 − T r (cid:18) (cid:18) A 1 σ2 XAX T 1 σ2 XAX T = T r Σ−1 + A Σ−1 + (cid:18) (cid:19)−1 (cid:16) (cid:0)σ2I + X T MA + (cid:17) (cid:0)σ2I + X T (cid:1)−1 A − M−1 M−1 B M−1 (cid:17) (cid:1)−1 B M−1 B M−1 X T A XB B M−2 X T 1 σ2 XBX T A XB B M−1 B A −1 − T r −1 − T r = T r (MA) = T r (MA) M−1 = T r (cid:16) (cid:16)(cid:0)σ2I + X T A XB B∪A 1 σ2 XB∪AX T 1 σ2 XAX T A + 1 σ2 XBX T B (cid:19)−1 (cid:1)−1 (cid:17) B M−1 X T A (Lemma 28) A XB A XB = T r where the identity matrix is of size B. From this formula, we can easily derive the marginal gain of a single element. In this case, B = {e} and XB = xe, so the marginal gain is given by A XB , g(e A) = e M−2 xT A xe e M−1 . σ2 + xT (11) Note that Σ−1 (cid:22) MA (where (cid:22) denotes the usual semidefinite ordering), and thus, MA is positive definite. Hence, M−1 A are also positive definite, which means that A xe ≥ 0, their quadratic forms are non-negative. In particular, xT which implies g(e A) ≥ 0. Also note that g(∅) = 0. Combining this equality with the previous inequality, we get that g is non-negative and monotonically increasing. Now we seek to show the lower bound on γ. Again, let A, B ⊆ Ω, and assume without A xe ≥ 0 and xT A and M−2 e M−1 e M−2 A xe loss of generality that A and B are disjoint. We seek to lower bound the ratio Let s = maxe∈Ω (cid:107)xe(cid:107)2. Observe that σ2 + xT e M−1 A xe = σ2 + (cid:107)xe(cid:107)2 ≤ σ2 + s2λmax . (12) (cid:0)M−1 A (cid:1) = σ2 + s2λmax (Σ) , (13) (cid:80) e∈B g(e A) g(B ∪ A) − g(A) (cid:19) (cid:18) xT e M−1 (cid:107)xe(cid:107)2 A xe 22 (cid:88) e∈B g(e A) = = ≥ = = e M−2 xT e∈B e∈B σ2 + xT σ2 + xT T r(cid:0)xexT (cid:88) (cid:88) T r(cid:0)XBX T T r(cid:0)X T B M−2 1 σ2 + s2λmin (MA) B M−2 σ2 + s2λmin (MA) A e∈B (cid:1) (cid:88) A xe e M−1 A xe e M−2 A e M−1 A xe (cid:1) (cid:1) (cid:16)(cid:0)σ2I + X T A XB . σ2 + s2λmin (MA) T r(cid:0)xexT e M−2 A (cid:1) (by (11)) (cyclic property of trace) (by (13)) (linearity of trace) (cyclic property of trace) (cid:1)−1 (cid:17) where the first inequality follows from the Courant-Fischer theorem, i.e., the variational characterization of eigenvalues. The second inequality is derived as follows: MA = Σ−1 + A ) ≤ λmax (Σ). σ XAX T Using this, we may obtain a lower bound on the numerator in (12). A and so MA (cid:23) Σ−1. This means that M−1 A (cid:22) Σ. Thus, λmax(M−1 1 Now, we will bound the denominator of (12). We have already shown that g(B ∪ A) − g(A) = T r B M−1 A XB B M−2 X T A XB . Additionally, we have shown that M−1 is also positive semidefinite. Hence, σ2I (cid:22) σ2I + X T (cid:0)σ2I + X T B M−1 A XB A is positive semidefinite, and thus, X T σ2 I. Finally, we have shown that M−2 A XB A XB. This implies that A is positive A XB is also positive semidefinite. Thus, B M−1 = 1 B M−1 semidefinite, and therefore, we have that X T (cid:1)−1 (cid:22)(cid:0)σ2I(cid:1)−1 (cid:16)(cid:0)σ2I + X T B M−1 A XB B M−2 X T A XB e∈B g(e A) and g(A ∪ B) − g(A), we obtain g(B ∪ A) − g(A) = T r Applying these bound on(cid:80) (cid:80) e∈B g(e A) g(B ∪ A) − g(A) (cid:18) ≥ B M−2 (cid:1)−1 (cid:19) T r(cid:0)X T T r(cid:0)X T (cid:17) ≤ 1 σ2 T r(cid:0)X T (cid:18) (cid:1) . B M−2 (cid:19)−1 A XB 1 + s2 σ2 λmax(Σ) . (cid:1) (cid:1) = σ2 σ2 + s2λmax(Σ) B M−2 B M−2 A XB A XB Unlike submodular functions, lazy evaluations [Minoux, 1978] of γ-weakly submodular g are generally not possible, as the marginal gains vary unpredictably. However, for specific functions, one can possibly speed up the greedy search. For the utility g considered here, we implemented a faster greedy search using the matrix inversion lemma. The naive approach of computing g(e S) by constructing Σ−1 + XSX T S , explicitly computing its inverse, and summing the diagonal elements is not only expensive -- inversion alone costs O(d3) arithmetic operations -- but also memory-inefficient. Instead, (11) shows that g(e S) = (cid:107)ze(cid:107)2 σ2 + (cid:104)xe, ze(cid:105) , S . In fact, M−1 where ze = M−1 S may be stored and updated directly in each iteration using the matrix inversion lemma so that no matrix inversion S xe and MS = Σ−1 + XSX T 23 are required. Note that M−1∅ = Σ, which is an input parameter. By the matrix inversion lemma, e M−1 e M−1 S xe which takes O(d2) arithmetic operations. Once M−1 is known explicitly, computing g(e S) is simply matrix-vector multiplication on a fixed matrix. We found that this greatly improved the efficiency of our code. S − M−1 M−1 S∪e = M−1 S , S xexT σ2 + xT S For this experiment, we used the Boston Housing dataset [Jr. and Rubenfield, 1978], a standard benchmark dataset containing d = 14 attributes of n = 506 Boston homes, including average number of rooms per dwelling, proximity to the Charles River, and crime rate per capita. We preprocessed the data by normalizing the features to have a zero mean and a standard deviation of 1. As there is no specified cost per measurement, √ we assigned costs proportionally to initial marginal gains in utility; that is, ce = αg(e) for some α ∈ [0, 1]. We set σ = 1/ d, and randomly generated a normal prior with covariance Σ = ADAT , where A is randomly chosen as Ai,j ∼ N (0, 1) and D is diagonal with Di,i = (i/d)2. We choose not to use Σ = βI, as we found this causes g to be nearly modular along solution paths, yielding it an easy problem instance for all algorithms and not a suitable benchmark. (a) (c) (b) (d) Figure 2: An algorithmic performance comparison for Bayesian A-Optimal design on the Boston Housing dataset. We report values for stochastic algorithms with mean and standard deviation bars, over 20 trials. (2a) objective values, varying the cardinality k, for a fixed cost penalty α = 0.8. (2b) runtime for a fixed cardinality k = 15. (2c) objective values, varying the cost penalty α for a fixed cardinality k = 15. (2d) objective values, varying the cost penalty α in an unconstrained setting. In our first experiment, we fixed the cost penalty α = 0.8, and ran the algorithms for varying cardinality constraints from k = 1 to k = 15. We ran the greedy algorithm, Distorted Greedy with γ-Sweep (setting δ = 0.1), and two instances of Stochastic Distorted Greedy with γ-Sweep (with δ =  = 0.1 and δ =  = 0.05). All γ-Sweep 24 runs used L = 0. Figure 2a compares the objective value of the sets returned by each of these algorithms. One can observe that the marginal gain obtained by the greedy algorithm is not non-increasing (at least for the first few elements), which is a result of the fact that g is weakly submodular with γ < 1. For small values of k, all algorithms produce comparable solutions; however, the greedy algorithm gets stuck in a local maximum of size k = 7, while our algorithms are able to produce larger solutions with higher objective value. Moreover, γ-Sweep with Stochastic Distorted Greedy performs better than γ-Sweep with Distorted Greedy for larger values of k, for reasons discussed in Section 3.4. Figure 2b shows CPU times of each algorithm run with the single cardinality constraint k = 20. We see that the greedy algorithm runs faster than our algorithms. This difference in the runtime is a result of both the added complexity of the γ-Sweep procedure, and that greedy terminates early, when a local maximum is reached. Figure 2b also shows that the sub-sampling step in Stochastic Distorted Greedy results in a faster runtime than Distorted Greedy, as predicted by the theory. We did not display the number of function evaluations, as it exhibits nearly identical trends to the actual CPU run time. In our next experiment, we fixed the cardinality k = 15 and varied the cost penalty α ∈ [0, 1]. Figure 2c shows that all algorithm return similar solutions for α = 0 and α = 1, which are the cases in which either c = 0 or the function g − c is non-positive, respectively. For all other values of α, our algorithms yield improvements over greedy. In our final experiment, we varied the cost penalty α ∈ [0, 1], comparing the output of greedy and γ-Sweep with Unconstrained Distorted Greedy for the unconstrained setting. Figure 2d shows that greedy outperforms our algorithm in this instance, which can occur, especially in the absence of "bad elements" of the kind discussed in Section 3. 5.2 Directed Vertex Cover with Costs The second experiment is directed vertex cover with costs. Let G = (V, E) be a directed graph and let w : V → R be a weight function on the vertices. For a vertex set S ⊆ V , let N (S) denote the set of vertices which are pointed to by S, N (S) (cid:44) {v ∈ V (u, v) ∈ E for some u ∈ S}. The weighted directed vertex cover function is u∈N (S)∪S wu. We also assume that each vertex v ∈ V has an associated g(S) = (cid:80) nonnegative cost cv. Our goal is to maximize the resulting revenue, g(S) − c(S) = cu . (cid:88) wu −(cid:88) u∈N (S)∪S u∈S Because g is submodular, we can forgo the γ-Sweep routine and apply our algorithms directly with γ = 1. Moreover, we implement lazy evaluations of g in our code. For our experiments, we use the EU Email Core network, a directed graph generated using email data from a large European research institution [Yin et al., 2017, Leskovec et al., 2007]. The graph has 1k nodes and 25k directed edges, where nodes represent people and a directed edge from u to v means that an email was sent from u to v. We assign each node a weight of 1. Additionally, as there are no costs in the dataset, we assign costs in the following manner. For a fixed q, we set c(v) = 1 + max{d(v) − q, 0}, where d(v) is the out-degree of v. In this way, all vertices with out-degree larger than q have the same initial marginal gain g(v) − c(v) = q. In our first experiment, we fixed the cost factor q = 6, and ran the algorithms for varying cardinality constraints from k = 1 to k = 130. We see in Figure 3a that our methods outperform greedy. Distorted Greedy achieves the highest objective 25 (a) (b) (c) Figure 3: A performance comparison for directed vertex cover on the EU Email Core network. We report values for stochastic algorithms with mean and standard deviation bars, over 20 trials. (3a) objective values, varying the cardinality k, for a fixed cost factor q = 6. (3b) g evaluations for a fixed cardinality k = 130. (3c) objective values, varying the cost factor q in an unconstrained setting. value for each cardinality constraint, while Stochastic Distorted Greedy achieves higher objective values as the accuracy parameter  is decreased. Figure 3b shows the number of function evaluations made by the algorithms when k = 130. We observe that Stochastic Distorted Greedy requires much fewer function evaluations, even when lazy evaluations are implemented.3 Finally, we ran greedy and Unconstrained Distorted Greedy while varying the cost factor q from 1 to 12, and we note that in this setting (as can be seen in Figure 3c) our algorithm performs similarly to the greedy algorithm. 6 Conclusion We presented a suite of fast algorithms for maximizing the difference between a non- negative monotone γ-weakly submodular g and a non-negative modular c in both the cardinality constrained and unconstrained settings. Moreover, we gave a matching hardness result showing that no algorithm can do better with only polynomially many oracle queries to g. Finally, we experimentally validated our algorithms on Bayesian A-Optimality with costs and directed vertex cover with costs, and demonstrated that they outperform the greedy heuristic. 3We do not report the CPU time for this experiment, as its behavior is somewhat different than the behavior of the number of function evaluations. This is an artifact of the implementation of the data structure we use to store the lazy evaluations. 26 References Andrew An Bian, Joachim M. Buhmann, Andreas Krause, and Sebastian Tschiatschek. Guarantees for greedy maximization of non-submodular functions with applications. In Proceedings of the 34th International Conference on Machine Learning, volume 70, pages 498 -- 507, 2017. Y. Boykov, O. Veksler, and R. Zabih. Fast approximate energy minimization via graph IEEE Transactions on Pattern Analysis and Machine Intelligence, 23(11): cuts. 1222 -- 1239, 2001. Niv Buchbinder and Moran Feldman. Constrained submodular maximization via a non-symmetric technique. CoRR, abs/1611.03253, 2016. Luiz F. O. Chamon and Alejandro Ribeiro. Approximate supermodularity bounds for experimental design. In Advances in Neural Information Processing Systems, 2017. Chandra Chekuri, Jan Vondr´ak, and Rico Zenklusen. Submodular function maximization via the multilinear relaxation and contention resolution schemes. SIAM J. Comput., 43(6):1831 -- 1879, 2014. V. Chv´atal. The tail of the hypergeometric distribution. Discrete Mathematics, 25(3): 285 -- 287, 1979. Abhimanyu Das and David Kempe. Submodular meets Spectral: Greedy Algorithms for Subset Selection, Sparse Approximation and Dictionary Selection. In International Conference on Machine Learning, pages 1057 -- 1064, 2011. Ethan R. Elenberg, Alexandros G. Dimakis, Moran Feldman, and Amin Karbasi. Stream- ing weak submodularity: Interpreting neural networks on the fly. In Advances in Neural Information Processing Systems, 2017. Ethan R. Elenberg, Rajiv Khanna, Alexandros G. Dimakis, and Sahand Negahban. Restricted strong convexity implies weak submodularity. Annals of Statistics, 46, 2018. Alina Ene and Huy L. Nguyen. Constrained submodular maximization: Beyond 1/e. In FOCS, pages 248 -- 257, 2016. Moran Feldman. Guess free maximization of submodular and linear sums, 2019. To appear in WADS 2019. Moran Feldman, Christopher Harshaw, and Amin Karbasi. Greed is good: Near-optimal submodular maximization via greedy optimization. In COLT, pages 758 -- 784, 2017. Daniel Golovin and Andreas Krause. Adaptive submodularity: Theory and applications in active learning and stochastic optimization. Journal of Artificial Intelligence Research, 42:427 -- 486, 2011. Wassily Hoeffding. Probability inequalities for sums of bounded random variables. Journal of the American Statistical Association, 1963. Hanzhang Hu, Alexander Grubb, J. Andrew Bagnell, and Martial Hebert. Efficient feature group sequencing for anytime linear prediction. In Proceedings of the Thirty- Second Conference on Uncertainty in Artificial Intelligence, 2016. 27 Stefanie Jegelka and Jeff Bilmes. Submodularity beyond submodular energies: coupling edges in graph cuts. In Computer Vision and Pattern Recognition (CVPR), pages 1897 -- 1904. IEEE, 2011. David Harrison Jr. and Daniel L Rubenfield. Hedonic housing prices and the demand for clean air. J. of Environmental Economics and Management, 5(1):81 -- 102, 1978. David Kempe, Jon Kleinberg, and ´Eva Tardos. Maximizing the spread of influence through a social network. In Proceedings of the ninth ACM SIGKDD international conference on Knowledge discovery and data mining, pages 137 -- 146. ACM, 2003. Rajiv Khanna, Ethan R. Elenberg, Alexandros G. Dimakis, Sahand Negahban, and Joydeep Ghosh. Scalable Greedy Feature Selection via Weak Submodularity. In Proceedings of the 20th International Conference on Artificial Intelligence and Statistics (AISTATS), pages 1560 -- 1568, 2017. A. Krause and C. Guestrin. Near-optimal Nonmyopic Value of Information in Graphical Models. In Uncertainty in Artificial Intelligence (UAI), pages 324 -- 331, 2005. Alan Kuhnle, J. David Smith, Victoria G. Crawford, and My T. Thai. Fast maximization In ICML, pages of non-submodular, monotonic functions on the integer lattice. 2791 -- 2800, 2018. Jon Lee, Maxim Sviridenko, and Jan Vondr´ak. Submodular maximization over multiple matroids via generalized exchange properties. Math. Oper. Res., 35(4):795 -- 806, 2010. Jure Leskovec, Jon Kleinberg, and Christos Faloutsos. Graph evolution: Densification and shrinking diameters. ACM Trans. Knowl. Discov. Data, 1(1), 2007. Hui Lin and Jeff Bilmes. A class of submodular functions for document summarization. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies-Volume 1, pages 510 -- 520. Association for Computational Linguistics, 2011. Michel Minoux. Accelerated greedy algorithms for maximizing submodular set functions. In Optimization Techniques, pages 234 -- 243, 1978. Baharan Mirzasoleiman, Ashwinkumar Badanidiyuru, Amin Karbasi, Jan Vondr´ak, and Andreas Krause. Lazier than lazy greedy. In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, pages 1812 -- 1818, 2015. G L Nemhauser and L A Wolsey. Best algorithms for approximating the maximum of a submodular set function. Mathematics of Operations Research, 3(3):177 -- 188, 1978. G L Nemhauser, L A Wolsey, and M L Fisher. An analysis of approximations for maximizing submodular set functions -- I. Mathematical Programming, 14(1):265 -- 294, 1978. Matthew Skala. Hypergeometric tail inequalities: ending the insanity. CoRR, abs/1311.5939, 2013. Maxim Sviridenko. A note on maximizing a submodular set function subject to a knapsack constraint. Oper. Res. Lett., 32(1):41 -- 43, 2004. 28 Maxim Sviridenko, Jan Vondr´ak, and Justin Ward. Optimal approximation for submod- ular and supermodular optimization with bounded curvature. Math. Oper. Res., 42 (4):1197 -- 1218, 2017. Kai Wei, Yuzong Liu, Katrin Kirchhoff, and Jeff Bilmes. Using Document Summarization Techniques for Speech Data Subset Selection. In Proceedings of NAACL-HLT 2013, page 721726, 2013. Hao Yin, Austin R. Benson, Jure Leskovec, and David F. Gleich. Local higher-order graph clustering. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. ACM, 2017. 29 A Greedy Performs Arbitrarily Poorly In this section, we describe an instance of Problem (1) where the greedy algorithm performs arbitrarily poorly. More specifically, the greedy algorithm does not achieve any constant factor approximation. Let G be a graph with n vertices and let b ∈ V be a "bad vertex". The graph G includes a single directed edge (b, e) for every vertex e ∈ V \ {b}, and no other edges (i.e., G is a directed star with b in the center). Let g be the unweighted directed vertex cover function. Note that if e (cid:54)= b , if e = b . (cid:26) 1 g({e}) = n Fix some  > 0, and let us define the nonnegative costs coefficients as (cid:26) 1/2 ce = n − (1/2 + ) if e (cid:54)= b , if e = b . The initial marginal gain of a vertex e is now given by (cid:26) 1/2 1/2 +  if e (cid:54)= b , if e = b . g({e}) − ce = Thus, the greedy algorithm chooses the "bad element" b ∈ V in the first iteration. Note that after b is chosen, the greedy algorithm terminates, as g(e {b}) = 0 and ce > 0 for all remaining vertices e. However, for any set S of vertices which does not contain b, we have that Thus, for any k < n, the competitive ratio of greedy subject to a k cardinality constraint is at most g(S) − c(S) = S − 1 2 S = S . 1/2 +  1 + 2 = k/2 = O . 1 2 (cid:19) (cid:18) 1 k k 30
1610.05115
5
1610
2018-07-18T03:36:20
Tropical Vertex-Disjoint Cycles of a Vertex-Colored Digraph: Barter Exchange with Multiple Items Per Agent
[ "cs.DS", "cs.CC" ]
In a barter exchange market, agents bring items and seek to exchange their items with one another. Agents may agree to a k-way exchange involving a cycle of k agents. A barter exchange market can be represented by a digraph where the vertices represent items and the edges out of a vertex indicate the items that an agent is willing to accept in exchange for that item. It is known that the problem of finding a set of vertex-disjoint cycles with the maximum total number of vertices (MAX-SIZE-EXCHANGE) can be solved in polynomial time. We consider a barter exchange where each agent may bring multiple items, and items of the same agent are represented by vertices with the same color. A set of cycles is said to be tropical if for every color there is a cycle that contains a vertex of that color. We show that the problem of determining whether there exists a tropical set of vertex-disjoint cycles in a digraph (TROPICAL-EXCHANGE) is NP-complete and APX-hard. This is equivalent to determining whether it is possible to arrange an exchange of items among agents such that every agent trades away at least one item. TROPICAL-MAX-SIZE-EXCHANGE is a similar problem, where the goal is to find a set of vertex-disjoint cycles that contains the maximum number of vertices and also contains all of the colors in the graph. We show that this problem is likewise NP-complete and APX-hard. For the restricted case where there are at most two vertices of each color (corresponding to a restriction that each agent may bring at most two items), both problems remain NP-hard but are in APX. Finally, we consider MAX-SIZE-TROPICAL-EXCHANGE, where the set of cycles must primarily include as many colors as possible and secondarily include as many vertices as possible. We show that this problem is NP-hard.
cs.DS
cs
Discrete Mathematics and Theoretical Computer Science DMTCS vol. 20:2, 2018, #1 Tropical Vertex-Disjoint Cycles of a Vertex-Colored Digraph: Barter Exchange with Multiple Items Per Agent Timothy Highley Hoang Le La Salle University, Philadelphia, Pennsylvania, USA received 17th Mar. 2017, revised 3rd Aug. 2017, 6th Apr. 2018, accepted 26th June 2018. In a barter exchange market, agents bring items and seek to exchange their items with one another. Agents may agree to a k-way exchange involving a cycle of k agents. A barter exchange market can be represented by a digraph where the vertices represent items and the edges out of a vertex indicate the items that an agent is willing to accept in exchange for that item. It is known that the problem of finding a set of vertex-disjoint cycles with the maximum total number of vertices (MAX-SIZE-EXCHANGE) can be solved in polynomial time. We consider a barter exchange where each agent may bring multiple items, and items of the same agent are represented by vertices with the same color. A set of cycles is said to be tropical if for every color there is a cycle that contains a vertex of that color. We show that the problem of determining whether there exists a tropical set of vertex-disjoint cycles in a digraph (TROPICAL-EXCHANGE) is NP-complete and APX-hard. This is equivalent to determining whether it is possible to arrange an exchange of items among agents such that every agent trades away at least one item. TROPICAL- MAX-SIZE-EXCHANGE is a similar problem, where the goal is to find a set of vertex-disjoint cycles that contains the maximum number of vertices and also contains all of the colors in the graph. We show that this problem is likewise NP-complete and APX-hard. For the restricted case where there are at most two vertices of each color (corresponding to a restriction that each agent may bring at most two items), both problems remain NP-hard but are in APX. Finally, we consider MAX-SIZE-TROPICAL-EXCHANGE, where the set of cycles must primarily include as many colors as possible and secondarily include as many vertices as possible. We show that this problem is NP-hard. Keywords: vertex-disjoint cycles, vertex-colored digraph, barter exchange, kidney exchange, assignment problem 1 Introduction Consider a barter exchange where many different agents each bring multiple items to trade. For each item at the barter exchange, the agent lists which other items may be accepted in trade for that item. Based on the lists, an algorithm determines which items are traded for which other items. Instead of restricting exchanges to one-to-one trades, k-way trades are also permitted, where k is limited only by the number of items at the swap meet. If k-way trades are permitted, the traders potentially give items to and receive items from different agents. ISSN 1365–8050 Distributed under a Creative Commons Attribution 4.0 International License c(cid:13) 2018 by the author(s) 8 1 0 2 l u J 8 1 ] S D . s c [ 5 v 5 1 1 5 0 . 0 1 6 1 : v i X r a 2 Timothy Highley, Hoang Le This barter exchange can be represented as a directed graph where each item brought to the exchange is a vertex and there are edges from each item to those items that may be accepted in trade for that item. The problem of determining the maximum possible number of items that can be simultaneously exchanged is equivalent to finding a set of vertex-disjoint cycles that maximizes the total number of vertices in the cycles. (Throughout this paper, all cycles are assumed to be simple cycles.) This problem is equivalent to the Assignment Problem, which can be solved in polynomial time. It has also been called MAX-SIZE-EXCHANGE (Biro, Manlove, and Rizzi, 2009). The decision and optimization versions of the problem are defined as follows. Problem 1a. EXCHANGE-x Input: A directed graph G and an integer x Question: Is there a set of vertex-disjoint cycles that includes at least x vertices? Problem 1b. MAX-SIZE-EXCHANGE Input: A directed graph G Output: A set of vertex-disjoint cycles that includes as many vertices as possible If there are many items, it is very likely that there are multiple solutions that tie for the maximum number of items traded. How should the tie be broken? As a secondary criterion, it may be desirable to choose, from among those item-maximizing solutions, a solution that maximizes the number of agents who trade away at least one item. This can be accomplished by converting the previously described directed graph into a vertex-colored digraph, with each participant having a unique color. The problem, then, is equivalent to finding a set of vertex-disjoint cycles with the maximum total number of vertices in the cycles, and in the case of ties, finding a solution that secondarily contains the maximum number of colors. A subset of vertices from a vertex-colored graph is called tropical if it includes every color in the vertex-colored graph (Angles d'Auriac et al., 2016a). We define the decision and optimization versions of the TROPICAL-MAX-SIZE-EXCHANGE as follows. Problem 2a. TROPICAL-MAX-SIZE-EXCHANGE-d (TMaxEx-d) Input: A vertex-colored digraph G Question: Is there a set of vertex-disjoint cycles S such that no other set of vertex-disjoint cycles contains more vertices in the cycles, and for every color in the graph there is a cycle in S that contains a vertex of that color? Problem 2b. TROPICAL-MAX-SIZE-EXCHANGE-o (TMaxEx-o) Input: A vertex-colored digraph G Output: A set of vertex-disjoint cycles that includes as many colors as possible, subject to the restriction that there does not exist another set of vertex-disjoint cycles that has more vertices Tropical Vertex-Disjoint Cycles of a Vertex-Colored Digraph 3 If the goal is instead to simply maximize the number of agents who trade away at least one item (with no regard for the total number of items traded away), that is equivalent to the problem of finding a set of vertex-disjoint cycles that collectively contain the maximum number of colors. To this end, we define the decision and optimization versions of TROPICAL-EXCHANGE as follows. Problem 3a. TROPICAL-EXCHANGE-d (TEx-d) Input: A vertex-colored digraph G Question: Is there a set of vertex-disjoint cycles such that for every color there is a cycle that contains a vertex of that color? Problem 3b. TROPICAL-EXCHANGE-o (TEx-o) Input: A vertex-colored digraph G. Output: A set of vertex-disjoint cycles such that the total number of vertex colors in the cycles is maxi- mized We show that both TMaxEx-d and TEx-d are NP-complete via a reduction from CNFSAT. We show that both TMaxEx-o and TEx-o are APX-hard. We also consider restricted cases where each agent is permitted to bring at most j items to the barter exchange. We then maximize the number of agents who get to trade an item: Problem 4. j-PER-COLOR-TROPICAL-EXCHANGE (jPC-TEx) Input: A vertex-colored digraph G with at most j vertices of each color Output: A set of vertex-disjoint cycles such that the total number of vertex colors in the cycles is maxi- mized Problem 5. j-PER-COLOR-TROPICAL-MAX-SIZE-EXCHANGE (jPC-TMaxEx) Input: A vertex-colored digraph G with at most j vertices of each color Output: A set of vertex-disjoint cycles that includes as many colors as possible, subject to the restriction that no other set of vertex-disjoint cycles has more vertices These problems can be trivially solved in polynomial time if j = 1, but even if j = 2, a reduction from MAX-2-SAT shows that these problems are NP-hard. They are, however, in APX for any fixed j. Finally, we define MAX-SIZE-TROPICAL-EXCHANGE, which reverses the criteria of TMaxEx-o. In TMaxEx- o, the first criterion is maximizing the total number of vertices in the cycles, and the second criterion is maximizing the total number of colors. MAX-SIZE-TROPICAL-EXCHANGE first maximizes the total number of colors in the cycles and secondarily maximizes the total number of vertices. We show that it is NP-hard and APX-hard. We define the decision and optimization versions of MAX-SIZE-TROPICAL-EXCHANGE as follows. Problem 6a. MAX-SIZE-TROPICAL-EXCHANGE-d (MaxTEx-d) Input: A vertex-colored digraph G and an integer x. Question: Is there a set of vertex-disjoint cycles S with a total of at least x vertices in the cycles such that no other set of vertex-disjoint cycles contains more colors in the cycles? 4 Timothy Highley, Hoang Le Problem 6b. MAX-SIZE-TROPICAL-EXCHANGE-o (MaxTEx-o) Input: A vertex-colored digraph G. Output: A set of vertex-disjoint cycles S such that no other set of vertex-disjoint cycles contains more colors, and no other set with the same number of colors contains more vertices. Barter exchanges as described in this paper regularly occur online. For example, since 2006 an average of 10 barter exchanges per month have been organized at boardgamegeek.com, with a total of over 500,000 items offered for trade. When participants are informed of the results, they exchange items either in person or by mailing items to each other. Usually, a participant will give an item to one person and receive an item from a different person. Maximizing the number of items traded is the primary goal, and is accomplished using a solution to the Assignment Problem. Maximizing the number of users that trade at least one item is the secondary goal, and this is addressed by solving the Assignment Problem multiple times and after a set number of iterations selecting the solution that yields the greatest number of users trading. However, there is no guarantee that the chosen solution actually maximizes the number of users who trade at least one item. This paper demonstrates that, in general, the problem of maximizing the number of users trading cannot be solved in polynomial time unless P = N P . Other websites, such as barterquest.com, swapdom.com, netcycle.com, and rehash.com, have offered similar services in a more general context. 2 Related Work The Assignment Problem is the minimum weight bipartite perfect matching problem. It is a well-known fundamental optimization problem that can be solved in polynomial time. The polynomial bound was first shown by Jacobi (see Jacobi, 2016), but was not widely known until Kuhn's publication of the Hungarian Algorithm (Kuhn, 1955). More efficient algorithms for the Assignment Problem have been discovered since then (Daitch and Spielman, 2008) (Lee and Sidford, 2014). It is known that MAX-SIZE-EXCHANGE can be solved by reducing it to the Assignment Problem (Abraham et al., 2007) (Biro et al., 2009). MAX-SIZE-EXCHANGE and related problems have been studied extensively in the context of kidney exchange programs. In kidney exchange programs, it is impractical to allow cycles of unbounded length because it is important for all surgeries to happen at the same time. As a result, most work related to kidney exchanges addresses the MAX SIZE ≤ k-WAY EXCHANGE problem, which is APX-complete when k ≥ 3 (Abraham et al., 2007) (Biro et al., 2009). Work on the kidney exchange problem includes investigation of approximability (Bir´o and Cechl´arov´a, 2007), techniques to mitigate failure after matches have been determined (Dickerson, Procaccia, and Sandholm, 2013), dynamic exchanges ( Unver, 2010), and incentive-compatible mechanisms to ensure that hospitals publish all incompatible pairs (Ashlagi et al., 2015). The problems discussed in this paper differ from the kidney exchange problem because we are not concerned with the length of the cycles, and because of the introduction of colored vertices. We explore problems that are similar to the Assignment Problem and kidney exchange problem but based on vertex-colored graphs. Vertex-colored graphs have also been called tropical graphs (Foucaud et al., 2016). As mentioned earlier, a subset of vertices from a vertex-colored graph is called tropical if it includes every color in the vertex-colored graph. Tropical connected subgraphs, tropical dominating sets, and tropical homomorphisms have been studied (Angles d'Auriac et al., 2016a) (Angles d'Auriac et al., 2016b) (Foucaud et al., 2016). In this paper, we are concerned with sets of vertex-disjoint cycles. We say Tropical Vertex-Disjoint Cycles of a Vertex-Colored Digraph 5 that a set of cycles is tropical if every color in the vertex-colored graph is represented by a vertex in at least one cycle. We study the total number of vertices and colors in a set of vertex-disjoint cycles, but not the total number of cycles in the set. Cycle packing is concerned with the total number of cycles, and it has been studied extensively for both edge-disjoint and vertex-disjoint cycles (Bodlaender et al., 2009) (Krivelevich et al., 2007) (Pedroso, 2014). There is other work on graphs and colors that is not directly related to our work, but we provide rep- resentative citations to help readers delineate the differences. For instance, Fellows et al. (2011) and Dondi, Fertin, and Vialette (2011) explored pattern-matching in vertex-colored graphs. Coudert et al. (2007) explored complexity and approximability properties of edge-colored graphs. Our work assumes that the color of a vertex is an inherent property of the graph. Graph-coloring is a separate topic where colors are added to a graph such that adjacent nodes have different colors. The Four-Color Theorem is a famous result from graph-coloring (Appel and Haken, 1977) (Appel, Haken, and Koch, 1977). Coloring graphs are graphs where each node represents a possible coloring of another graph (Beier, Fierson, Haas, Russell, and Shavo, 2016). More recent graph-coloring work includes the search for rainbow connections (Chartrand et al., 2008) (Li and Sun, 2012) (Li and Shi, 2013). Colorful paths are paths that are both rainbow paths (all vertices in the path have different colors) and tropical paths (all colors in the graph are represented in the path) (Akbari et al., 2011). 3 CNFSAT as a Vertex-Colored Graph Consider an instance of CNFSAT with q clauses. Let x1, ..., xn be the n variables in the expression. For each variable, create a vertex. Give all of these vertices the same color, and refer to them as the"variable vertices." On each vertex, create two edges that loop back to the same vertex. Label one edge TRUE and one edge FALSE on each vertex. Assign each clause of the CNFSAT instance a separate color: c1, c2, ..., cq. For each literal in the clause, create a vertex that has the clause's color. Refer to these vertices as "literal vertices." For negative literals, put the corresponding vertex on the FALSE loop of the variable vertex for that variable by removing one edge from that loop and adding the new literal vertex along with two edges so that the FALSE loop remains a single cycle from the variable vertex back to itself. Similarly, for positive literals put the literal vertex on the TRUE loop of the variable vertex for that variable. Figure 1 depicts an example graph for a given CNFSAT instance. 4 CNFSAT reduces to TROPICAL-EXCHANGE-d Constructing a graph for a CNFSAT instance can clearly be accomplished in polynomial time. Each variable only adds one vertex and two edges to the graph, and each clause only adds a vertex and an edge for each literal in the clause. Based on the way that the graph is constructed, there can be at most n vertex-disjoint cycles. Each variable vertex is part of two cycles (the TRUE loop and the FALSE loop), so a set of vertex-disjoint cycles can only contain one or the other. There are no other cycles in the graph. The cycle that is chosen for the set of vertex-disjoint cycles corresponds to the truth value of that variable in the expression. If we have a polynomial time algorithm for TROPICAL-EXCHANGE-d (TEx-d), then solving TEx-d will also solve CNFSAT in polynomial time. This is because each clause's color will be in a cycle if and only if a variable 6 Timothy Highley, Hoang Le Fig. 1: CNFSAT instance represented as a vertex-colored directed graph. is set to a truth value that satisfies that clause. If all colors can be in the set of vertex-disjoint cycles, then all clauses and thus the entire expression is satisfiable. Since CNFSAT is NP-complete, TEx-d is NP-hard. TEx-d is also in NP (it is trivial to verify that all colors are in the solution), so TEx-d is NP-complete. Theorem 1 TEx-d is NP-complete. 5 CNFSAT reduces to TROPICAL-MAX-SIZE-EXCHANGE EXCHANGE-x can be solved in polynomial time, but TROPICAL-EXCHANGE-d is NP-complete. What about TROPICAL-MAX-SIZE-EXCHANGE-d (TMaxEx-d)? That is, if we restrict the search space to only those sets of cycles that maximize the total number of vertices in the cycles, then does that make it easier to determine whether it is possible for a set of vertex-disjoint cycles to cover all of the colors in the graph? The previous reduction does not work for TMaxEx-d due to the fact that solving TMaxEx-d for the con- structed graph does not solve CNFSAT. Because TMaxEx-d first maximizes the total number of vertices in the cycles, it may be the case that the CNFSAT instance is satisfiable even though the solution to TMaxEx-d for the graph does not include all of the colors. That would be the case if the only way to include all of the colors in the graph in the cycles is to accept a lower total number of vertices in the cycles. We can adjust the graph by adding "balance vertices" that all have the same color (the "balance color"). First, we identify the cycle with the most vertices. In the case of a tie, we choose any of the tied cycles. We add one balance vertex to this cycle and then add balance vertices to all other cycles so that every cycle has the same number of vertices. These balance vertices accomplish two tasks: • The number of vertices in each cycle has no impact on the solution produced by TMaxEx-d. With the addition of the balance vertices, every cycle has the same number of vertices, so every possible combination of vertex-disjoint cycles has the same total number of vertices, assuming one cycle Tropical Vertex-Disjoint Cycles of a Vertex-Colored Digraph 7 per variable vertex. As a result, the secondary criterion (number of colors in the set of cycles) determines the solution. • The balance color has no impact. Because every cycle has a balance vertex, the balance color is guaranteed to be in the set of vertex-disjoint cycles, and the balance color will not have an impact on the final solution. If all possible combinations of vertex-disjoint cycles have the same number of total vertices, then by the same logic described for the previous reduction, the solution to TMaxEx-d for the constructed graph will also solve CNFSAT. Figure 2 depicts an example graph for a given CNFSAT instance. Fig. 2: CNFSAT graph with the addition of Balance Vertices. TMaxEx-d is easily shown to be in NP. A proposed solution to an instance of TMaxEx-d can be verified by first solving MAX-SIZE-EXCHANGE-o for the same graph, which can be accomplished in polynomial time. The next step is verifying that the proposed solution to TMaxEx-d and the solution produced by MAX-SIZE- EXCHANGE-o have the same number of vertices in their respective sets of vertex-disjoint cycles. Assuming they do, it is simple to verify that all colors appear in the proposed solution. Therefore, TMaxEx-d is NP- complete. Theorem 2 TMaxEx-d is NP-complete. 6 TROPICAL-EXCHANGE and TROPICAL-MAX-SIZE-EXCHANGE are APX- hard MAX-3-SAT3 is a well-known APX-complete problem that restricts CNFSAT to at most three literals per clause, and each literal can appear in only three clauses. Additionally, it is an optimization problem 8 Timothy Highley, Hoang Le instead of a decision problem. Section 4 contains a reduction from CNFSAT to TROPICAL-EXCHANGE. A reduction from MAX-3-SAT3 to TEx-o works like the reduction in Section 4. We show that such a reduction is an L-reduction, so we can conclude that TEx-o is APX-hard. Some additional definitions from Crescenzi (1997) and Papadimitriou and Yannakakis (1991) are needed. A reduction from problem A to problem B consists of a function f that maps an instance of problem A to an instance of problem B, and a function g that maps a solution of problem B to a solution of problem A. The set of instances of problem A is IA. The set of feasible solutions of an instance x ∈ IA is sol(x). The measure of the quality of a solution y ∈ sol(x) of an instance x ∈ IA is denoted by m(x, y). If a solution y is optimal, then m(x, y) = opt(x). The absolute error E(x, y) = opt(x) − m(x, y). A reduction is said to be an L-reduction if it meets the following criteria. 1. For any instance of A and corresponding instance of B, the optimal solution of B is within a constant factor of the optimal solution of A. More formally: ∀x ∈ IA, optB(f (x)) ≤ α · optA(x) 2. For any x that is an instance of problem A and any y that is the solution to corresponding instance of problem B, the absolute error of the proposed solution to A is within a constant factor of the absolute error of y. More formally: ∀x ∈ IA∀y ∈ solB(f (x)), EA(x, g(x, y)) ≤ βEB(f (x), y) For our purposes, problem A is MAX-3-SAT3 and problem B is TEx-o. For TEx-o and TMaxEx-o, m(x, y) measures the number of colors in the solution. The reduction in Section 4 satisfies criterion 1 because the number of colors in the graph is equal to the number of clauses in the expression plus one. Similarly, the number of colors in the solution to TEx-o is equal to one plus the number of satisfied clauses in the solution to MAX-3-SAT3. For each instance of MAX-3-SAT3 it is necessary to find a value for α that satisfies criterion 1. If, for example, α = 3, then the criterion is satisfied for all instances. The reduction satisfies criterion 2 because the absolute errors for the two problems are equal. The number of clauses not satisfied is exactly equal to the number of colors that do not appear in the proposed solution to TEx-o. For each instance it is necessary to find a value for β that satisfies criterion 2. If β = 1, criterion 2 is satisfied for all instances. Therefore, we conclude that it is an L-reduction and MAX-3-SAT3 ≤L TEx-o. Because an L-reduction preserves membership in PTAS (Crescenzi, 1997, Proposition 7), we can say that TEx-o is APX-hard and there is no PTAS for TEx-o. A similar argument can be made about the reduction in Section 5. That allows us to conclude that MAX-3-SAT3 ≤L TMaxEx-o, and that TMaxEx-o is APX-hard and has no PTAS. 7 TROPICAL-EXCHANGE with only 2 vertices per color We now consider the problems jPC-TEx and jPC-TMaxEx, which are special cases of TROPICAL-EXCHANGE- o and TROPICAL-MAX-SIZE-EXCHANGE-o, respectively. For these problems, there can be at most j vertices of each color. In terms of a barter exchange, this corresponds to an organized exchange where each person is permitted to bring at most j items. We will show that these restricted cases are in APX and, unless j = 1, they are NP-hard. There is a trivial algorithm to show that both 2PC-TEx and 2PC-TMaxEx are in APX. Simply solve MAX- SIZE-EXCHANGE for the given graph, completely ignoring vertex colors. Because there are only two vertices in the graph for each color, the solution to MAX-SIZE-EXCHANGE is guaranteed to have at least half as many colors as the maximum number of colors possible in a solution to 2PC-TEx or 2PC-TMaxEx. Tropical Vertex-Disjoint Cycles of a Vertex-Colored Digraph 9 Therefore it is a 2-approximation. Similarly, a j-approximation can be attained for any j, so jPC-TEx and jPC-TMaxEx are in APX for all j. Consider an instance of the NP-hard problem MAX-2-SAT. Build a graph in polynomial time as described in Section 3, but instead of making all variable vertices the same color, assign a unique color to each variable vertex. This graph has at most two vertices of any given color, so it is an instance of 2PC-TEx. Refer to Figure 3, but ignore the balance vertices for now. A solution of 2PC-TEx will include as many colors as possible. If a clause's color is included in the solution, that corresponds to a satisfied clause, so MAX-2-SAT reduces to 2PC-TEx, which means 2PC-TEx is NP-hard, just as MAX-2SAT is NP-hard. Similarly, 2PC-TMaxEx can be shown to be NP-hard with a reduction from MAX-2-SAT. As before, create a graph to represent the MAX-2-SAT instance, giving each variable vertex a unique color. Add balance vertices so that every cycle contains the same number of vertices. Give each balance vertex its own unique color. Finally, add an additional cycle that includes a vertex for each of the balance vertex colors. Each balance vertex color appears only twice: once in a TRUE or FALSE cycle and once in the balance vertex cycle. Due to the balance vertex cycle, every balance vertex color is guaranteed to appear in the solution, so those colors do not affect any decisions regarding whether to take a TRUE cycle or a FALSE cycle. As a result, every combination of TRUE and FALSE cycles has the same number of vertices in the cycles, and a solution to 2PC-TMaxEx will simply maximize the number of colors in the cycles. Maximizing the number of colors in the solution corresponds to maximizing the number of satisfied clauses. Thus, 2PC-TMaxEx is also NP-hard. Figure 3 depicts the reduction of an instance of MAX-2-SAT to 2PC-TMaxEx. Because 2PC-TEx and 2PC-TMaxEx are NP-hard, jPC-TEx and jPC-TMaxEx are also NP-hard for all j > 2. Theorem 3 jPC-TEx and jPC-TMaxEx are NP-hard. Fig. 3: MAX-2-SAT instance reduced to 2PC-TMaxEx. 10 8 MAX-SIZE-TROPICAL-EXCHANGE is NP-Hard For completeness, we consider MAX-SIZE-TROPICAL-EXCHANGE-o (MaxTEx-o), where the primary cri- terion is maximizing the total number of colors in the set of vertex-disjoint cycles, and the secondary criterion is maximizing the number of vertices. This simply reverses the criteria of TMaxEx-o. It is easy to see that a solution to MaxTEx-o simultaneously solves TEx-o. One only needs to observe the number of colors in the solution to MaxTEx-o. Thus, MaxTEx-o is NP-hard because TEx-o is NP-hard. Whether MaxTEx-d is in NP remains an open question. Timothy Highley, Hoang Le 9 Conclusion In this paper, we have defined and analyzed problems that have practical application in the area of al- gorithmically arranged barter exchanges. We have shown that TROPICAL-EXCHANGE-d and TROPICAL- MAX-SIZE-EXCHANGE-d are NP-complete and that TROPICAL-EXCHANGE-o and TROPICAL-MAX-SIZE- EXCHANGE-o are APX-hard. We have also shown that MAX-SIZE-TROPICAL-EXCHANGE-o is NP-hard. When instances of TROPICAL-EXCHANGE-o and TROPICAL-MAX-SIZE-EXCHANGE-o are restricted to j vertices per color (jPC-TEx and jPC-TMaxEx, respectively), the optimization problems remain NP-hard if j > 1, but are in APX. References D. J. Abraham, A. Blum, and T. Sandholm. Clearing algorithms for barter exchange markets: Enabling nationwide kidney exchanges. In Proceedings of the 8th ACM Conference on Electronic Commerce, EC '07, pages 295–304, New York, NY, USA, 2007. ACM. ISBN 978-1-59593-653-0. doi: 10.1145/ 1250910.1250954. S. Akbari, V. Liaghat, and A. Nikzad. Colorful paths in vertex coloring of graphs. Electronic Journal of Combinatorics, 18(1), 2011. J.-A. Angles d'Auriac, C. Bujt´as, H. El Maftouhi, N. Narayanan, L. Rosaz, J. Thapper, and Z. Tuza. In Proceedings of WALCOM: Algorithms and Tropical dominating sets in vertex-coloured graphs. Computation: 10th International Workshop. Springer, 2016a. J.-A. Angles d'Auriac, H. El Maftouhi, S. Legay, N. Cohen, A. Harutyunan, and Y. Manoussakis. Con- nected tropical subgraphs in vertex-coloured graphs. Discrete Mathematics and Theoretical Computer Science, 17(3):327–348, 2016b. K. Appel and W. Haken. Every planar map is four colorable. Part i: Discharging. Illinois Journal of Mathematics, 21(3):429–490, 1977. K. Appel, W. Haken, and J. Koch. Every planar map is four colorable. Part ii: Reducibility. Journal of Mathematics, 21(3):491–567, 1977. Illinois I. Ashlagi, F. Fischer, I. A. Kash, and A. D. Procaccia. Mix and match: A strategyproof mechanism for multi-hospital kidney exchange. Games and Economic Behavior, 91:284–296, 2015. J. Beier, J. Fierson, R. Haas, H. M. Russell, and K. Shavo. Classifying coloring graphs. Discrete Mathe- matics, 339:2100–2012, 2016. doi: 10.1016/j.disc.2016.03.003. Tropical Vertex-Disjoint Cycles of a Vertex-Colored Digraph 11 P. Bir´o and K. Cechl´arov´a. Inapproximability of the kidney exchange problem. Information Processing Letters, 101(5):199–202, 2007. P. Biro, D. F. Manlove, and R. Rizzi. Maximum weight cycle packing in directed graphs, with application to kidney exchange programs. Discrete Mathematics, Algorithms and Applications, 1(04):499–517, 2009. H. L. Bodlaender, S. Thomass´e, and A. Yeo. Kernel bounds for disjoint cycles and disjoint paths. In European Symposium on Algorithms, pages 635–646. Springer, 2009. G. Chartrand, G. L. Johns, K. A. McKeon, and P. Zhang. Rainbow connection in graphs. Mathematica Bohemica, 133(1):85–98, 2008. D. Coudert, P. Datta, S. P´erennes, H. Rivano, and M.-E. Voge. Shared risk resource group complexity and approximability issues. Parallel Processing Letters, 17(02):169–184, 2007. P. Crescenzi. A short guide to approximation preserving reductions. In Proceedings of the 12th Annual IEEE Conference on Computational Complexity, CCC '97, pages 262–, Washington, DC, USA, 1997. IEEE Computer Society. ISBN 0-8186-7907-7. URL http://dl.acm.org/citation.cfm? id=791230.792302. S. Daitch and D. Spielman. Faster approximate lossy generalized flow via interior point algorithms. In Proceedings of the Fortieth Annual ACM Symposium on Theory of Computing, pages 451–460. ACM, 2008. J. P. Dickerson, A. D. Procaccia, and T. Sandholm. Failure-aware kidney exchange. In Proceedings of the fourteenth ACM conference on Electronic commerce, pages 323–340. ACM, 2013. R. Dondi, G. Fertin, and S. Vialette. Complexity issues in vertex-colored graph pattern matching. Journal of Discrete Algorithms, 9(1):82–99, 2011. M. R. Fellows, G. Fertin, D. Hermelin, and S. Vialette. Upper and lower bounds for finding connected motifs in vertex-colored graphs. Journal of Computer and System Sciences, 77(4):799–811, 2011. doi: doi:10.1016/j.jcss.2010.07.003. F. Foucaud, A. Harutyunyan, P. Hell, S. Legay, Y. Manoussakis, and R. Naserasr. The complexity of tropical graph homomorphisms. CoRR, abs/1607.04777, 2016. URL http://arxiv.org/abs/ 1607.04777. C. Jacobi. About the research of the order of a system of arbitrary ordinary differential equations, 2016. URL http://www.lix.polytechnique.fr/ollivier/JACOBI/jacobiEngl. htm. [Online; accessed 6-October-2016]. M. Krivelevich, Z. Nutov, M. R. Salavatipour, J. V. Yuster, and R. Yuster. Approximation algorithms and hardness results for cycle packing problems. ACM Transactions on Algorithms (TALG), 3(4):48, 2007. H. Kuhn. The Hungarian Method for the assignment problem. Naval Research Logistics Quarterly, 2: 83–97, 1955. 12 Timothy Highley, Hoang Le √ rank) iterations and faster algorithms for maximum flow. Y. Lee and A. Sidford. Path finding methods for linear programming: Solving linear programs in O( In 2014 IEEE 55th Annual Sympo- sium on Foundations of Computer Science (FOCS), pages 424–433. IEEE, 2014. doi: 10.1109/FOCS. 2014.52. X. Li and Y. Shi. Rainbow connection in 3-connected graphs. Graphs and Combinatorics, 29(5):1471– 1475, 2013. X. Li and Y. Sun. Rainbow connections of graphs. Springer Science & Business Media, 2012. C. H. Papadimitriou and M. Yannakakis. Optimization, approximation, and complexity classes. Jour- nal of Computer and System Sciences, 43(3):425–440, 1991. ISSN 0022-0000. doi: https://doi. org/10.1016/0022-0000(91)90023-X. URL http://www.sciencedirect.com/science/ article/pii/002200009190023X. J. P. Pedroso. Maximizing expectation on vertex-disjoint cycle packing. In International Conference on Computational Science and Its Applications, pages 32–46. Springer, 2014. M. U. Unver. Dynamic kidney exchange. The Review of Economic Studies, 77(1):372–414, 2010.
1303.3445
1
1303
2013-03-14T13:44:44
New modular multiplication and division algorithms based on continued fraction expansion
[ "cs.DS", "cs.SC" ]
In this paper, we apply results on number systems based on continued fraction expansions to modular arithmetic. We provide two new algorithms in order to compute modular multiplication and modular division. The presented algorithms are based on the Euclidean algorithm and are of quadratic complexity.
cs.DS
cs
New modular multiplication and division algorithms based on continued fraction expansion Mourad Gouicema aUPMC Univ Paris 06 and CNRS UMR 7606, LIP6 4 place Jussieu, F-75252, Paris cedex 05, France Abstract In this paper, we apply results on number systems based on continued fraction expansions to modular arithmetic. We provide two new algorithms in order to compute modular multiplication and modular division. The presented algo- rithms are based on the Euclidean algorithm and are of quadratic complexity. 1. Introduction Continued fractions are commonly used to provide best rational approxima- tions of an irrational number. This sequence of best rational approximations (pi/qi)i∈N is called the convergents' sequence. In the beginning of the 20th cen- tury, Ostrowski introduced number systems derived from the continued fraction expansion of any irrational α [1]. He proved that the sequence (qi)i∈N of the denominators of the convergents of any irrational α forms a number scale, and any integer can be uniquely written in this basis. In the same way, the sequence (qiα − pi)i∈N also forms a number scale. In this paper, we show how such number systems based on continued fraction expansions can be used to perform modular arithmetic, and more particularly modular multiplication and modular division. The presented algorithms are of quadratic complexity like many of the existing implemented algorithms [2, Chap. 2.4]. Furthermore, they present the advantage of being only based on the extended Euclidean algorithm, and to integrate the reduction step. In the following, we will first introduce notations and some properties of the number systems based on continued fraction expansions in Section 2. Then we describe the new algorithms in Section 3. Finally, we give elements of complexity analysis of these algorithms in Section 4, and perspectives in Section 5. 2. Number systems and continued fractions 2.1. Notations First, we give some notations on the continued fraction expansion of an irrational α with 0 < α < 1 [3]. We call the tails of the continued fraction expansion of α the real sequence (ri)i∈N defined by r0 = α, ri = 1/ri−1 − ⌊1/ri−1⌋. We denote (ki)i∈N the integer sequence of the partial quotients of the continued fraction expansion of α. They are computed as ki = ⌊1/ri−1⌋. We have := [0; k1, k2, . . . , ki + ri]. α = k1 + k2 + 1 1 1 . . . + 1 ki + ri We write pi/qi the ith convergent of α. The sequences (pi)i∈N and (qi)i∈N are integer valued and positive, pi qi = [0; k1, k2, . . . , ki]. We will also write (θi)i∈N the positive real sequence of (−1)i(qiα − pi) which we call the sequence of the partial remainders as they are related to the tails by ri = θi/θi−1. Hereafter, we recall the recurrence relations to compute these sequences, pi = pi−2 + kipi−1, p−1 = 1 p0 = 0 qi = qi−2 + kiqi−1, q−1 = 0 q0 = 1 θ0 = α θi = θi−2 − kiθi−1. θ−1 = 1 We also write ηi = qiα − pi the sequence of the signed partial remainders, which elements are of sign (−1)i. The sequence (ηi)i∈N of the signed partial remainders can be computed as ((−1)iθi)i∈N. 2.2. Related number systems over irrational numbers In this section, we present two number systems based on the sequences of the signed partial remainders (ηi)i∈N and the denominators of the convergents (qi)i∈N of an irrational α. They have been extensively studied during the second part of the 20th century [1, 4]. Property 2.1 ([1, Proposition 1]). Given (qi)i∈N the denominators of the con- vergents of any irrational 0 < α < 1, every positive integer N can be uniquely written as m N = 1 + niqi−1 where (cid:26) 0 ≤ n1 ≤ k1 − 1, 0 ≤ ni ≤ ki, for i ≥ 2, ni = 0 if ni+1 = ki+1 ("Markovian" conditions). Xi=1 2 Algorithm 1: Integer decomposition in Ostrowski number system. niqi−1 m Xi=1 input : N ∈ N, (qi)i<m output: ni such that N = 1 + 1 tmp ← N − 1; 2 i ← m; 3 while i ≥ 1 do 4 ni ← ⌊tmp/qi−1⌋; tmp ← tmp − niqi−1; i ← i − 1; 5 6 This number system associated to the (qi)i∈N is named the Ostrowski number system. To write an integer in this number system, we use a classical decompo- sition algorithm (Algorithm 1). The rank m is chosen such that qm > N . Property 2.2 ([1, Proposition 2]). Given (ηi)i∈N the sequence of the signed partial remainders of any irrational 0 < α < 1, every real β, with 0 ≤ β < 1 can be uniquely written as β = α + biηi−1 +∞ Xi=1 where (cid:26) 0 ≤ b1 ≤ k1 − 1, 0 ≤ bi ≤ ki, for i ≥ 2, bi = 0 if bi+1 = ki+1 ("Markovian" conditions). There also exists two other number systems that are dual to these two. One decomposes integers in the basis ((−1)iqi)i∈N and the other decomposes reals in the basis of the unsigned partial remainders (θi)i∈N [1]. The second Markovian condition then becomes bi+1 = 0 if bi = ki. An algorithm to write real numbers in the (θi)i∈N number scale has been proposed by Ito [5]. It proceeds by iterating the mapping T1 : (α, β) → (1/α − ⌊1/α⌋, β/α − ⌊β/α⌋). 2.3. Related number systems over rational numbers In this subsection, we consider α = p/q rational. We recall that the continued fraction expansion of a rational is finite. We denote p q = [0; k1, k2, . . . , kn] the continued fraction expansion of p/q, and recall pn = p and qn = q. The Ostrowski number system still holds for integers N < qn, since the keypoint in the Ostrowski number system is that there exists qm such that qm > N . The (ηi)i<n number system also still holds under one supplemental condition: β must be rational with precision at most q (i.e. the denominator of β must be less or equal than q). 3 3. Modular arithmetic and continued fraction In this section, we consider α = a/d. We highlight that the same decompo- sition (b1, . . . , bn+1) can be interpreted in two ways depending on the number system used. In the Ostrowski number system, we obtain an integer N whereas in the number scale (ηi)i∈N, we obtain the reduced value of N α mod 1 [1]. Hence, we will use the fact that studying an integer a modulo d is similar to considering the rational a/d modulo 1. This enables us to use properties 2.1 and 2.2 to compute modular multiplication and division. 3.1. Modular arithmetic and continued fraction First, we briefly recall how continued fraction expansion and the Euclidean algorithm are linked. We write (θ′ i)i∈N the integer sequence of remainders when computing gcd(a, d). This sequence is composed of decreasing values less than d. We also write (η′ i)i∈N. We obtain the following recurrence relation, and recall the recurrence relation over the (θi)i∈N sequence of partial remainders of the continued fraction expansion of a/d : i)i∈N the sequence ((−1)iθ′ θ′ −1 = d θ′ θ−1 = 1 0 = a i−1 θ0 = a/d θi = θi−2 − ⌊θi−2/θi−1⌋θi−1. i−2 − ⌊θ′ i = θ′ θ′ i−2/θ′ i−1⌋θ′ It is widely known and can be easily proved by induction that both sequences compute the same partial quotients, that we will note ki. Proof of ki+1 = ⌊θi−1/θi⌋ = ⌊θ′ i−1/θ′ i⌋. We prove it by proving θi−1/θi = θ′ i−1/θ′ i. • Base case : θ−1/θ0 = d/a = θ′ −1/θ′ 0 • Induction : Let i such that θi−1/θi = θ′ i−1/θ′ i. θi−1 θi θi+1 + ⌊θi−1/θi⌋θi θi = = θ′ i−1 θ′ i i+1 + ⌊θ′ i−1/θ′ θ′ θ′ i i⌋θ′ i θi+1 θi + ⌊θi−1/θi⌋ = θ′ i+1 θ′ i + ⌊θ′ i−1/θ′ i⌋ which implies θi/θi+1 = θ′ i/θ′ i+1. It can also be noticed that η′ Euclidean algorithm compute the relations θ′ it gives the Bezout's identity with θ′ and qn−1 the inverse of a if a is invertible modulo d (gcd(a, d) = 1). i = θid as the extended i = (−1)i(qia − pid). In particular, n−1 = (−1)n−1(qn−1a − pn−1d) = gcd(a, d), i = ηid. Actuallly, θ′ 4 3.2. Modular multiplication Now, given a, b ∈ Z/dZ, we write c = a · b mod d the integer 0 ≤ c < d such that ab − ⌊ab/d⌋ · d = c. We can observe that the decompositions presented in properties 2.1 and 2.2 are both unique and both need the same "Markovian" condition over their coefficients. Hence, we can interpret the same decomposition in both basis. Theorem 3.1. Given a, b ∈ Z/dZ, and (qi)i≤n, (η′ rithm on a and d, if we write b in the (qi)i≤n number scale as i)i≤n from Euclidean algo- then b = 1 + biqi−1, n+1 Xi=1 a · b mod d = a + biη′ i−1. n+1 Xi=1 Proof. First, we consider b < qn, it can be written in the Ostrowski number system as n and the coefficients bi respect the "Markovian" condition of the Ostrowski num- ber system. Hence, b = 1 + biqi−1, Xi=1 n α · b = α + By definition, ηi = qiα − pi, thus biqi−1α. Xi=1 n n Xi=1 biηi−1 + bipi−1. α · b = α + As the coefficients bi's verify the "Markovian" condition, the uniqueness of the i=1 bipi−1 ∈ Xi=1 i=1 biηi−1 < 1 andPn decomposition in property 2.2 gives 0 ≤ α +Pn Xi=1 α · b mod 1 = α + N. Hence, By multiplying this inequality by d, as α = a/d and η′ i = ηid, we obtain n biηi−1. a · b mod d = a + biη′ i−1. n Xi=1 which finalizes the proof of the theorem for b < qn. Now if b ≥ qn and b = bn+1qn + b′ with b′ < qn the remainder of the division of b by qn, b′ can be uniquely written in the Ostrowski number system. Furthermore, as η′ n = 0, which finishes the proof. n = 0, bn+1η′ 5 3.3. Modular division Inversely, given a, b ∈ Z/dZ, with a invertible modulo d (gcd(a, d) = 1) we can efficiently compute a−1 · b mod d. Theorem 3.2. Given a, b ∈ Z/dZ with gcd(a, d) = 1, and (qi)i≤n, (θ′ Euclidean algorithm on a and d, if we write b in the (θ′ i)i<n number scale as i)i≤n from then if we denote c = b = n+1 Xi=1 biθ′ i−1, bi(−1)i−1qi−1, n+1 Xi=1 a−1 · b mod d ∈ {c, d + c}. Proof. The proof of correctness is similar to the one of theorem 3.1, using the facts that θ′ i = θid and that θi = (−1)i(qiα − pi). Now, the greatest integer c is clearly the one associated to the decomposition (k1, 0, k3, 0, . . . , kn) when n is odd. However, kiqi−1 = qi − qi−2 by definition, which implies (n−1)/2 k2i+1q2i = qn. The smallest integer that can be returned is clearly the one associated to the decomposition (0, k2, 0, k4, . . . , kn) when n is even. Once again, as kiqi−1 = qi − qi−2, we get − k2iq2i−1 = 1 − qn. Xi=0 n/2 Xi=1 Hence, −d < Pn+1 most a correction by an addition by d. i=1 bi(−1)i−1qi−1 < d, that is to say, the result needs at We mention that we also tried to decompose b in the (η′ i)i≤n signed re- mainders number scale and evaluate this same decomposition in the (qi)i≤n number scale to compute modular division. We used Ito T2 transform [5] T2 : (α, β) → (1/α − ⌊1/α⌋, ⌈β/α⌉ − β/α). In practice, it returns the right result without the need of any correction. However, as the decomposition com- puted by Ito T2 transform does not verify the same "Markovian" conditions as in the Ostrowski number system, we were not able to give a theoretical proof that it always returns the reduced result of the modular division. 4. Elements of Complexity Analysis In this section, we introduce elements of complexity analysis of the proposed modular multiplication algorithm based on theorem 3.1. The same analysis holds for the division. 6 y t i l i b a b o r P 0.95 0.9 0.85 0.8 0.75 0.7 0 5 10 15 20 25 30 35 40 45 Max expected bn+1 Figure 1: Probability law of the value of the coefficient bn+1 First, the algorithm computes (qi)i≤n and (η′ i)i≤n. This can be computed us- ing the classical extended Euclidean algorithm in O(log (d)2) binary operations. We notice here that the divisions computed in the Euclidean algorithm can be computed by subtraction as the mean computed quotient equals to Khinchin's constant (approximately 2.69) [3, p. 93]. Furthermore, big quotients are very unlikely to occur as the quotients of any continued fraction follow the Gauss- Kuzmin distribution [3, p. 83] [6, p. 352], P(ki = k) = − log2(cid:18)1 − 1 (k + 1)2(cid:19) . Second, the decomposition in (qi)i≤n as in algorithm 1 also clearly has com- plexity in O(log (d)2). By the same arguments, the coefficients of the decompo- sition in (qi)i≤n can be computed by subtraction as they are likely small. The only quotient not following the Gauss-Kuzmin distribution is the coefficient bn+1 as it corresponds to the quotient ⌊b/qn⌋. We prove in Appendix A that if a, d are uniformly chosen integers in [1, N ] and b is uniformly chosen in [1, d], then when N tends to infinity, P(bn+1 ≤ k) tends to ζ(2)−1"k+1 Xi=1 i − (k + 1) i3 + (k + 1)ζ(3)# . Figure 1 shows the probability distribution of P(bn+1 ≤ k). In particular, we obtain P(bn+1 ≤ 3) ≈ 92.5%. To finish the complexity analysis, evaluating the sum to return the final result can also be done in O(log (d)2). 7 5. Perspectives In this paper, we presented an algorithm for modular multiplication and an algorithm for modular division. Both are based on the extended Euclidean algorithm and are of quadratic complexity in the size of the modulus. Furthermore, the two stated theorems imply that, knowing the remainders generated when computing the gcd of a number a and the modulus d, one can compute efficiently reduced multiplications by a or a−1. This can be useful in algorithms computing several multiplications and/or divisions by the same number a, as in the Gaussian elimination algorithm for example. The presented algorithms can also be useful in hardware implementation of modular arithmetic. They allow to perform inversion, multiplication and division with the same circuit. Further investigations have to be led to find optimal decomposition algo- rithms, that minimize the number of coefficients of the produced decomposition and their size. Also, we are working on an efficient software implementation of these algorithms. 6. Aknowledgement This work was supported by the TaMaDi project of the french ANR (grant ANR 2010 BLAN 0203 01). This work has also been greatly supported and improved by many helpful proof readings and discussions with Jean-Claude Bajard, Val´erie Berth´e, Pierre Fortin, Stef Graillat and Emmanuel Prouff. References References [1] V. Berth´e, L. Imbert, Diophantine approximation, Ostrowski numeration and the double-base number system, Discrete Mathematics & Theoretical Computer Science 11 (1) (2009) 153 -- 172. [2] R. Brent, P. Zimmermann, Modern computer arithmetic, Vol. 18, Cambridge University Press, 2010. [3] A. Y. Khinchin, Continued fractions, Dover, 1997. [4] A. Vershik, N. Sidorov, Arithmetic expansions associated with a rotation of the circle and with continued fractions, Saint Petersburg Mathematical Journal 5 (6) (1994) 1121 -- -1136. [5] S. Ito, Some skew product transformations associated with continued frac- tions and their invariant measures, Tokyo Journal of Mathematics 9 (1) (1986) 115 -- 133. [6] D. E. Knuth, The Art of Computer Programming, 2nd Edition, Vol. 2 (Seminumerical Algorithms), Addison-Wesley, 1981. 8 [7] G. H. Hardy, E. M. Wright, An Introduction to the Theory of Numbers, 6th Edition, Oxford University Press, 2008. Appendix A. Detailed proof of the distribution function of {bn+1 < k}. Let U1, U2 and U3 be three independent uniform distributions over [0, 1]. We write a = ⌈U1N ⌉, d = ⌈U2N ⌉ and b = ⌈U3d⌉. We denote A = {b < (k + 1)qn}, B = {gcd(a, d) ≤ k + 1}, ¯B = {gcd(a, d) > k + 1} and Bi = {gcd(a, d) = i}. Hence using the law of total probability we have P(A) = P(A ∩ B) + P(A ∩ ¯B), P(A ∩ Bi), = Gi≤k+1 = Gi≤k+1 P(A ∩ Bi) + Gi>k+1 P(ABi)·P(Bi) + Gi>k+1 P(ABi)·P(Bi). As the Bi are disjoint events, we have P(A) = k+1 Xi=1 P(ABi) · P(Bi) + +∞ Xi=k+2 P(ABi) · P(Bi). First, P(ABi) = 1 for i ≤ k + 1 as b < d = gcd(a, d) · qn ≤ (k + 1) · qn. Hence, k+1 +∞ P(A) = P(Bi) + P(ABi) · P(Bi). Xi=1 Xi=k+2 Now we want to determine P(ABi) for i ≥ k + 2. Hereafter, we write Qi(·) = P(·Bi) and P(ABi) = Qi(A), N N = Xl=1 Xm=1 However, Qi({a = l} ∩ {d = m}) · Qi(A {a = l} ∩ {d = m}). Qi(A {a = l} ∩ {d = m}) = k + 1 i as b is uniformly distributed between 1 and d = iqn. If we consider the segment of length d and slice it in i segments of length qn, it can be interpreted as the probability that b is in the first k + 1 slices. Hence P(ABi) = N Xl=1 N Xm=1 Xl=1 N · k + 1 = i Qi({a = l} ∩ {d = m}) · k + 1 i , Qi({a = l} ∩ {d = m}). N Xm=1 9 As {a = l} and {d = m} are independent by hypothesis (U1 and U2 are independent), Qi({a = l} ∩ {d = m}) = Qi({a = l}) · Qi({d = m}), and P(ABi) = k + 1 i · N N Qi({a = l}) · Qi({d = m}). Xl=1 Xm=1 Now, we use the fact that the sum of the probabilities over the whole sample space always sum to 1 to obtain P(ABi) = k + 1 i . If we recapitulate, P(A) = k+1 Xi=1 P(Bi) + +∞ Xi=k+2 k + 1 i · P(Bi). Finally, it is widely known that P(Bi) tends to ζ(2)−1 when N tends to i2 infinity [7, p. 353]. Hence, we get lim N→+∞ which equals to P(A) = k+1 ζ(2)−1 Xi=1 i2 + = ζ(2)−1"k+1 Xi=1 ∞ k + 1 i Xi=k+2 1 i2 + (k + 1) · ζ(2)−1 i2 , +∞ Xi=k+2 1 i3# , ζ(2)−1"k+1 Xi=1 = ζ(2)−1"k+1 Xi=1 1 k+1 1 i3 − i2 + (k + 1) +∞ Xi=1 Xi=1 + (k + 1) +∞ Xi=1 i − (k + 1) i3 1 i3!# , i3!# . 1 By definition, Riemann zeta function equals ζ(s) = 1 is . +∞ Xi=1 Hence we get the following simplification, which is more convenient for compu- tation and has been used to generate Fig. 1, lim N→+∞ P(A) = ζ(2)−1"k+1 Xi=1 i − (k + 1) i3 +(k+1)·ζ(3)#. 10
1903.04936
1
1903
2019-03-12T14:05:07
The k-d tree data structure and a proof for neighborhood computation in expected logarithmic time
[ "cs.DS" ]
For practical applications, any neighborhood concept imposed on a finite point set P is not of any use if it cannot be computed efficiently. Thus, in this paper, we give an introduction to the data structure of k-d trees, first presented by Friedman, Bentley, and Finkel in 1977. After a short introduction to the data structure (Section 1), we turn to the proof of efficiency by Friedman and his colleagues (Section 2). The main contribution of this paper is the translation of the proof of Freedman, Bentley, and Finkel into modern terms and the elaboration of the proof.
cs.DS
cs
The k-d tree data structure and a proof for neighborhood computation in expected logarithmic time Martin Skrodzki March 13, 2019 For practical applications, any neighborhood concept imposed on a finite point set P is not of any use if it cannot be computed efficiently. Thus, in this paper, we give an introduction to the data structure of k-d trees, first presented by Friedman, Bentley, and Finkel in 1977, see [5]. After a short introduction to the data structure (Section 1), we turn to the proof of efficiency by Friedman and his colleagues (Section 2). The main contribution of this paper is the translation of the proof of Freedman, Bentley, and Finkel into modern terms and the elaboration of the proof. Note that the present paper is an excerpt of a PhD thesis, see [9]. 1 The Data Structure of k-d Trees In this section, we will give a brief introduction to the k-d tree data structure. It was originally presented by Jon Louis Bentley in 1975, see [1]. A modern introduction to the two-dimensional case can be found in [2, Chapter 5.2]. Let P = {p1, . . . , pn} ⊂ Rd be a finite point set with pi = (p1 i )T ∈ Rd for i = 1, . . . , n. A k-d tree for P is defined recursively. If P is empty or contains only one point, an empty tree or a tree with one node containing the one point is returned. Oth- erwise, it is determined in which dimension d′ ∈ [d] the point set has the largest spread. ℓ − qd′′ for all d′′ ∈ [d], ℓ, m ∈ [n]. Now, find the median1 of the points pi according to a sorting along this dimension, i.e. pd′ in, denote it by q = pi⌈n/2⌉. Note that the points do not necessarily have to be sorted, as the median can be found in linear time, see [4]. However, there has to be a unique ordering on the points to de- termine the resulting k-d tree uniquely. Thus, we assume that the point set P can be That is, d′ is chosen such that there are two points pi, pj with (cid:12)(cid:12)(cid:12)pd′ j (cid:12)(cid:12)(cid:12) ≥(cid:12)(cid:12)(cid:12)pd′′ i1 ≤ . . . ≤ pd′ i⌈n/2⌉ ≤ . . . ≤ pd′ i , . . . , pd i − pd′ m(cid:12)(cid:12)(cid:12) 1For any number n ∈ N of ordered points, we define the median to be the point with index ⌈n/2⌉. Note that ⌊n/2⌋ + 1 would also give a valid choice which has to be considered slightly differently when building the k-d tree. 1 uniquely ordered2 along any dimension d′ ∈ [d]. After finding the median, a hyperplane H = {x ∈ Rd xd′ = qd′} is introduced, which splits the set P into two subsets P1 = {pi1, . . . , pi⌈n/2⌉−1}, P2 = {pi⌈n/2⌉+1, . . . , pin} with P1 containing at most one point more than P2. A node is created, holding q and H. Partitioning P into the two subsets P1 and P2 can be performed in Θ(n). The node is given the results of recursively processing P1 and P2 as children and then it is returned. An example for the building process in the two-dimensional case is given in Figure 1. The algorithm is given in pseudo code as Algorithm 1. From this building procedure, we see that the building time T (n) of a k-d tree satisfies the following recursion T (n) =(Θ(1) n = 1 Θ(n) + 2 · T (⌈n/2⌉) n > 1 , which solves to T (n) = Θ(n · log(n)), see [7, pp. 272 -- 274]. By the above and by noting that each node of the k-d tree stores a distinct point of the input set P , we proved the following theorem. Theorem 1 (Storage requirement and building time of a k-d tree, [2]) A k-d tree for a set of n points uses Θ(n) storage and can be constructed in Θ(n · log(n)) time. The k-d tree data structure has applications in orthogonal range searches, as discussed in [2, Chapter 5.2] and [8, Chapter 3.2]. In the following, we will focus on applications in the context of neighborhood queries. Algorithm 1 Build k-d tree 1: procedure Build k-d tree(point set P ) 2: if P ≤ 1 then return node containing P i ≤ qd′ end if d′ ← most spread dimension of P q ← median according to dimension d′ P1 ← {pi ∈ P pd′ P2 ← P \(P1 ∪ {q}) H ← {x ∈ Rd xd′ Nℓ ←Build k-d tree(P1) Nr ←Build k-d tree(P2) return node containing q, H with Nℓ and Nr as children , pi 6= q} = qd′} 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: end procedure 2In any practical application, this can be achieve by e.g. sorting points with equal entries according to their indices, i.e. in the case pi = pj we order by i < j. 2 p8 p6 p7 p8 p6 p4 p1 p3 p2 p4 p1 p3 p2 p5 p5 p3 p2 p5 p4 p1 p7 p8 p6 p3 p2 p7 p5 p7 p4 p1 p4 p1 p8 p6 p8 p6 p3 p2 p5 p7 p4 p3 p5 p2 p1 p7 p6 ∅ p8 Figure 1: Recursively building a k-d tree on eight points. The hyperplanes are shown in the first five figures, while the whole tree is shown in the last figure on the lower right. 3 2 Neighborhood Queries in Logarithmic Time Amongst the data structures computing the k nearest neighborhood, the most prominent choice is the k-d tree data structure presented above. The reason is that in 1977, Fried- mann, Bentley, and Finkel were able to prove an average case running time of O(log(n)) for a single neighbor query in a k-d tree built on n points. The proof in their paper is very concise and covers roughly three pages [5, pp. 214 -- 216]. Thus, we will give a more elaborate version of their proof in modern wording here. Let a point set P and a corresponding k-d tree built according to Section 1 be given. A neighborhood query for any point p ∈ Rd is then performed by traversing the tree to the leaf representing the box which contains the query point. From there, the query goes back to the root, investigating subtrees along the path where the splitting hyperplane is closer to p than the currently found nearest neighbors. When reaching a node, all elements in it are investigated as to whether they are closer to p than the current closest points found. The algorithm is fast, as it can be expected that several subtrees do not have to be investigated. See Algorithm 2 for a pseudo code version and see [8, Section 5.2] for an illustration of the nearest neighbor search for a single nearest neighbor, i.e. k = 1. We will now investigate the following question: What is the expected query time for a neighborhood query in a k-d tree? We will do this by considering a different setup compared to the construction in Section 1. Namely, we will store points only in the leaves of the tree and we will further allow for more than one point to be stored in each leaf. Collecting all factors that can affect the runtime of the neighborhood search, we get the following list: • total number n of points, • dimension d of the ambient space, • number of neighbors sought k, • number b of points to be stored in each leaf, • distance measure3 d : Rd × Rd → R≥0, (p, q) 7→ d(p, q), • density δ : Rd → [0, 1] of points in space. The density is taken into account as a way to analyze an arbitrary point set. As we will not make any assumption on the actual positions of the points pi ∈ P throughout the proof, we turn to a probabilistic argument. Thus, we consider an arbitrary non- empty sample space Ω and random variables X1, . . . , Xn, Xp : Ω → Rd. Draw a sample ω ∈ Ω. Now, our point set P is given by P = {X1(ω), . . . , Xn(ω)} and the point p to search neighbors for is given as Xp(ω). That is, we want to find k points from {X1(ω), . . . , Xn(ω)} ⊂ Rd that are the k nearest neighbors to Xp(ω) ∈ Rd within the set {X1(ω), . . . , Xn(ω)} ⊂ Rd. 3While the theory holds for any distance measure, i.e. any metric, in the following we will use the Euclidean metric. 4 Algorithm 2 Nearest Neighbor Search in k-d trees 1: procedure NNk-dTree(point p, k-d tree T , distance ε, number k) 2: L ←empty list return NNk-dTreeRec(p,root,ε, k, L) 3: 4: end procedure 5: procedure NNk-dTreeRec(point p, k-d tree T , distance ε, number k, list L) 6: if T = ∅ then return L end if Extract point pj from T .root and store it in L if kpj − pk ≤ ε. if L is larger than k then Delete the point with largest distance to p from L. end if if T is just a leaf then return L end if if T .root.leftSubtree contains p then T1 = T .root.leftSubtree, T2 = T .root.rightSubtree else T2 = T .root.leftSubtree, T1 = T .root.rightSubtree end if NNk-dTreeRec(p, T1, ε, k, L) if L < k and kp − T .root.hyperplanek < ε then NNk-dTreeRec(p, T2, ε, k, L) else kL.farthest − pk kp − T.root.hyperplanek ≤ ε then if NNk-dTreeRec(p, T2, ε, k, L) 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: end if return L 27: 28: end procedure > kp − T.root.hyperplanek and 5 Without loss of generality we assume X1(ω), . . . , Xk(ω) to be the k nearest neighbors with Xk(ω) being the farthest from Xp(ω). Now, denote Bk(Xp(ω)) = {x ∈ Rd d(x, Xp(ω)) ≤ d(Xk(ω), Xp(ω))} to be the ball around Xp(ω) containing all points in Rd with distance less than or equal to the distance to Xk(ω). The volume of this ball is vk(Xp(ω)) :=ZBk(Xp(ω)) 1 dx. Furthermore, the probability content of this region -- according to the density δ(x) -- is uk(Xp(ω)) =ZBk(Xp(ω)) δ(x) dx. Since RRd δ(x) dx = 1, we have uk(Xp(Ω)) ≤ 1. Furthermore, since δ(x) ≥ 0 for all x ∈ Bk(Xp(ω)), we have 0 ≤ uk(Xp(ω)). Consider some additional random variable X : Ω → Rd with density δ. Then, uk(Xp(ω)) =ZBk(Xp(ω)) δ(x) dx δ(x) · 1Bk(Xp(ω))(x) dx =ZRd ⋄ = E(1Bk(Xp(ω))(X)), where ⋄ holds by the law of the unconscious statistician: E(g(X)) =RRd g(x) · δ(x) dx, [3, p. 156], with g(x) := 1Bk(Xp(ω))(x). Furthermore, we have 1Bk(Xp(ω))(x) =(1, 0, if x ∈ Bk(Xp(ω)) otherwise . Therefore, E(1Bk(Xp(ω))(X)) = P(X ∈ Bk(Xp(ω))) = P(d(X, Xp(ω)) ≤ d(Xk(ω), Xp(ω))). Now, from X and Xi we define new random variables ξ := d(X, Xp(ω)), ξi := d(Xi, Xp(ω)), which provide distances ξi(ω) := d(Xi(ω), Xp(ω)). Then, uk(Xp(ω)) = P(ξ ≤ ξk(ω)) by the above computations. Furthermore, ξ : Ω → R is a random variable with distribution Fξ(x) = P(ξ ≤ x), therefore uk(Xp(ω)) = Fξ(ξk(ω)). The question to be answered now is: What is the distribution Fξ at ξk(ω)? 6 Order the distances ξi(ω), then we have the following one-to-one correspondence: ξ1(ω) ≤ . . . ≤ ξn(ω) 1:1←→ Fξ(ξ1(ω)) ≤ . . . ≤ Fξ(ξn(ω)). Now, consider the random variable F (ξi) : Ω → [0, 1]. It is defined by and its distribution is F (ξi)(ω) := Fξ(ξi(ω)) P(F (ξi) ≤ x) = P(ξi ≤ F −1 ξ (x)) ⋆= Fξi(F −1 ξ (x)) ⋄= x, where ⋆ holds because Fξi(x) = P(ξi ≤ x) and where ⋄ holds because ξ and ξi have the same density δ and thus the same distribution Fξ = Fξi. Hence, a single F (ξi) is uniformly distributed. However, when choosing an ordering, the k-th distance ξk is β-distributed (see appendix on page 10), therefore It can be shown that uk(Xp(ω)) = β(ω). uk(Xp(ω)) = k (n + 1) , (1) see appendix on page 10. This states that any compact volume enclosing exactly k (n+1) on average. Now, assume that n is large enough points has probability content such that Bk(Xp(ω)) is small and thus δ(x) can be approximated by a constant ¯p(Xp(ω)) on Bk(Xp(ω)). In this case k ZBk(Xp(ω)) δ(x) dx = uk(Xp(ω)) ≈ ¯p(Xp(ω)) · vk(Xp(ω)). (2) Assume further that δ(x) is continuous (which enables us to approximate it over a small region in the first place), then by definition of Bk(Xp(ω)), there are small neighborhoods Bεi(Xi(ω)), i = 1, . . . , k − 1 such that δ(x) > 0 for all x ∈ Bεi(Xi(ω)), i = 1, . . . , k − 1. Therefore, ¯p(Xp(ω)) =ZBk(Xp(ω)) δ(x) dx δ(x)≥0 ∀x∈Rd ≥ Now, we obtain k−1 Xi=1ZBεi (Xi(ω)) {z >0 δ(x) dx > 0. } k (n + 1) (1) = uk(Xp(ω)) (2) ≈ ¯p(Xp(ω)) · vk(Xp(ω)), which is equivalent to vk(Xp(ω)) ≈ k (n + 1) · ¯p(Xp(ω)) . (3) 7 (a) Ball Bk and Cube Ck for (b) Ball Bk and Cube Ck for d = 2. d = 3. (c) A hypercube Ck over- lapped by ¯ℓ = 5 buckets. Figure 2: Illustration of hypercubes in different dimensions. Observe now the effect of the k-d tree partitioning algorithm described in Section 1. Choosing the median ensures that the bucket sizes of all non-empty buckets will be between ⌈b/2⌉ and b, where b is the maximum bucket size. Choosing to split on the widest spread dimension ensures that the geometric shape of these buckets will be reasonably compact. In fact, the expected edge lengths of these buckets at most differ pairwise by a factor of 2. The buckets themselves are by this approximation hypercubical with edge length equal to the d-th root of the volume of space occupied by the bucket. The edges are parallel to the coordinate axes. The effect of the k-d tree partitioning, then, is to divide the coordinate space into approximately hypercubical subregions, each containing the aforementioned roughly same number of records. Because of (3) we have that the expected volume of such a bucket is E(vb(Xb)) ≈ b (n + 1) · ¯p(Xb) , (4) where Xb : Ω → Rd is a random variable yielding a point that locates the bucket in the coordinate space. Consider now the smallest d-dimensional hypercube Ck(Xp(ω)) with edges parallel to the coordinate axes that completely contains the ball Bk(Xp(ω)). The volume Vk(Xp(ω)) of this hypercube is proportional to vk(Xp(ω)), with proportionality constant volume(d − dim cube) volume(d − dim ball) = (2r)d πd/2 Γ(d/2+1) rd · = 2d · Γ(d/2 + 1) πd/2 =: G(d), where r is the radius of the ball. See Figures 2a and 2b for an illustration of Bk and Ck. Therefore, Vk(Xp(ω)) = G(d) · vk(Xp(ω)) (3) ≈ G(d) · k (n + 1) · ¯p(Xp(ω)) . (5) In order to calculate the average number of buckets ¯ℓ examined by the k-d tree during a search for the k nearest neighbors, we need to find the buckets overlapping the ball Bk(Xp(ω)), see Figure 2c for an illustration. This number ¯ℓ is bounded from above by 8 ¯L, the number of buckets overlapping the hypercube Ck(Xp(ω)), where (cid:16)j ek(Xp(ω)) eb(Xp(ω))k + 1(cid:17)d 2d for eb(Xp(ω)) ≤ ek(Xp(ω)) otherwise ¯L =  where ek(Xp(ω)) denotes the edge length of Ck(Xp(ω)) and eb(Xp(ω)) denotes the edge length of the buckets in the neighborhood. However, the edge length of a hypercube is the d-th root of its volume, hence ek(Xp(ω)) = dqVk(Xp(ω)), eb(Xp(ω)) = dpVb(Xb(ω)). Assume that buckets around Bk(Xp(ω)) are smaller than Bk(Xp(ω)) and since they are close, ¯p(Xp(ω)) ≈ ¯p(Xb(ω)). Then, by (5) we have Finally, b · G(d) (n + 1)¯p(Xb(ω)) . , ek(Xp(ω)) ≈ ds k · G(d) (n + 1)¯p(Xp(ω)) eb(Xp(ω)) = ds dq k·G(d)  ≈ ¯l ≤ ¯L =(cid:18)(cid:22)ek(Xp(ω)) eb(Xp(ω))(cid:23) + 1(cid:19)d  dq b·G(d) + 1!d b% + 1!d ≤ (cid:18) k b(cid:19) 1 = $ dr k d (n+1)¯p(Xp(ω)) (n+1)·¯p(Xb(ω)) d  + 1  is an upper bound for the average number of buckets overlapping Bk(Xp(ω)). Here, we use that Bk(Xp(ω)) is small and thus we have Xp(ω) ≈ Xb(ω). Note that the inequality holds as dpk/b ≥ 0. The number of records in each bucket is b, so an upper bound on the number of records examined is ¯R ≤ b · ¯L ≤ b · (cid:18) k b(cid:19)1/d + 1!d =(cid:16)k1/d + b1/d(cid:17)d . This expression is minimized when choosing b = 1 (which explains the corresponding choice in Section 1), yielding ¯R ≤(cid:16)k1/d + 1(cid:17)d , (6) which is independent of the number of records n and the density δ(x). The constancy of the number of records examined as the number of records increases implies that the time required for a nearest neighbor search is equal to finding the record in the balanced binary tree, the k-d tree, which takes O(log(n)) on average. Thus, the following theorem is proven: Theorem 2 (Runtime of nearest neighbor queries in a k-d tree, [5]) The expected query time for a neighborhood query in a k-d tree is O(log(n)). 9 Conclusion We have presented the data structure of k-d trees and have given the classical proof of Friedman, Bentley, and Finkel in a modernized form. The proof shows the practical relevance of k-d trees for the field of geometry processing, as both combinatorial and metric neighborhood concepts can be computed efficiently utilizing the k-d tree data structure. Appendix: Beta Distribution The proof in the Section 2 makes use of the Beta Distribution which we will present here briefly with the facts used in the proof above. We follow the description in [6, Section 2.5.3]. It describes the waiting time for the k-th event of n events happening in (0, 1) ⊂ R, called 1, . . . , n. Hence, the space of results as well as the sample space is Ω = (0, 1)n. For all 1 ≤ i ≤ n, ω ∈ (ω1, . . . , ωn) ∈ Ω, let Ti(ω) = ωi be the time of event i. Assume all ωi are uniform distributed in (0, 1). Now order the Ti(ω) strictly, which is possible since P(Si6=j{ωi = ωj}) = 0, i.e. no two events happen at the same time. Call the order T1:n < . . . < Tn:n with {T1:n, . . . , Tn:n} = {T1(ω), . . . , Tn(ω)}, then Tk:n is the time of the k-th event. Now fix k, n, and some c ∈ (0, 1). For a given order T1:n < . . . < Tn:n, we obtain P(Tk:n ≤ c) fixed order } For any other order, we can exchange the integration by Fubini, s.t. it yields the same =Z 1 0 . . .Z 1 0 1{t1<...<tn}(t1, . . . , tn) · 1(0,c](tk) dtn . . . dt1. {z 10 0 0 P(Tk:n ≤ c) = n!Z 1 = n! ·Z 1   (cid:18)Z 1 ·(cid:18)Z 1 0 0 · 0 1 =R c {z . . .Z 1 0 R tk 0 ... R tk 0 1{t1<...<tk }(t1,...,tk−1) dtk−1...dt1 } 1{t1<...<tk}(t1, . . . , tk) dtk−1 . . . dt1(cid:19) }   1{tk<...<tn}(tk, . . . , tn) dtk+1 . . . dtn(cid:19) } 1{tk+1<...<tn}(tk+1,...,tn) dtn...dtk+1 {z {z . . .Z 1 0 =R 1 tk ... R 1 tk (7) expression independent of any of the n! possible orders. Hence, 1{t1<...<tn}(t1, . . . , tn) · 1(0,c](tk) dtn . . . dt1 . . .Z 1 0 1(0,c](tk) Using the following two identities, see [6, p. 44], 0 0 . . .Z s Z s . . .Z s Z s 0 0 1{t1<...<tk−1}(t1, . . . , tk−1) dtk−1 . . . dt1 = 1{tk+1<...<tn}(tk+1, . . . , tn) dtn . . . dtk+1 = sk−1 (k − 1)! (1 − s)n−k (n − k)! in (7), we get P(Tk:n ≤ c) = n! (k − 1)!(n − k)! ·Z c 0 sk−1(1 − s)n−k ds. In general, for a random variable X with distribution FX and density f , if FX is differen- tiable, we have f (x) = F ′(X). Finally, it can be shown, see [6, p. 45], that E(βa,b) = a a+b , where for k, n ∈ N, βk,n−k+1 describes the distribution of the k-th smallest time of n random times in [0, 1]. In particular, β1,n(s) = n(1 − s)n−1 is the density of the first time and β1,1 = U(0,1). References [1] Jon Louis Bentley. "Multidimensional Binary Search Trees Used for Associative Searching". In: Communications of the ACM 18.9 (1975), pp. 509 -- 517. [2] Marc de Berg et al. Computational Geometry. 2nd. Springer, 2000. [3] Joseph K. Blitzstein and Jessica Hwang. Introduction to probability. Chapman and Hall/CRC, 2014. 11 [4] Manuel Blum et al. "Time Bounds for Selection". In: Journal of Computer and System Sciences 7.4 (1973), pp. 448 -- 461. [5] Jerome Harold Friedman, Jon Louis Bentley, and Raphael Ari Finkel. "An algorithm for finding best matches in logarithmic expected time". In: ACM Transactions on Mathematical Software (TOMS) 3.3 (1977), pp. 209 -- 226. [6] Hans-Otto Georgii. Stochastik: Einfuhrung in die Wahrscheinlichkeitstheorie und Statistik. Walter de Gruyter GmbH & Co KG, 2015. [7] Robert Sedgewick and Kevin Wayne. Algorithms. 4th. Addison-Wesley, 2011. [8] Martin Skrodzki. "Neighborhood Computation of Point Set Surfaces". MA thesis. Freie Universitat Berlin, 2014. [9] Martin Skrodzki. "Neighborhood Data Structures, Manifold Properties, and Pro- cessing of Point Set Surfaces". PhD thesis. Freie Universitat Berlin, to be published. 12
1712.00918
1
1712
2017-12-04T06:09:50
Boolean function analysis meets stochastic optimization: An approximation scheme for stochastic knapsack
[ "cs.DS" ]
The stochastic knapsack problem is the stochastic variant of the classical knapsack problem in which the algorithm designer is given a a knapsack with a given capacity and a collection of items where each item is associated with a profit and a probability distribution on its size. The goal is to select a subset of items with maximum profit and violate the capacity constraint with probability at most $p$ (referred to as the overflow probability). While several approximation algorithms have been developed for this problem, most of these algorithms relax the capacity constraint of the knapsack. In this paper, we design efficient approximation schemes for this problem without relaxing the capacity constraint. (i) Our first result is in the case when item sizes are Bernoulli random variables. In this case, we design a (nearly) fully polynomial time approximation scheme (FPTAS) which only relaxes the overflow probability. (ii) Our second result generalizes the first result to the case when all the item sizes are supported on a (common) set of constant size. (iii) Our third result is in the case when item sizes are so-called "hypercontractive" random variables i.e., random variables whose second and fourth moments are within constant factors of each other. In other words, the kurtosis of the random variable is upper bounded by a constant. Crucially, all of our algorithms meet the capacity constraint exactly, a result which was previously known only when the item sizes were Poisson or Gaussian random variables. Our results rely on new connections between Boolean function analysis and stochastic optimization. We believe that these ideas and techniques may prove to be useful in other stochastic optimization problems as well.
cs.DS
cs
Boolean function analysis meets stochastic optimization: An approximation scheme for stochastic knapsack Anindya De∗ Abstract The stochastic knapsack problem is the stochastic variant of the classical knapsack problem in which the algorithm designer is given a a knapsack with a given capacity and a collection of items where each item is associated with a profit and a probability distribution on its size. The goal is to select a subset of items with maximum profit and violate the capacity constraint with probability at most p (referred to as the overflow probability). While several approximation algorithms [27, 22, 4, 17, 30] have been developed for this problem, most of these algorithms relax the capacity constraint of the knapsack. In this paper, we design efficient approximation schemes for this problem without relaxing the capacity constraint. (i) Our first result is in the case when item sizes are Bernoulli random variables. In this case, we design a (nearly) fully polynomial time approximation scheme (FPTAS) which only relaxes the overflow probability. (ii) Our second result generalizes the first result to the case when all the item sizes are supported on a (common) set of constant size. In this case, we obtain a quasi-FPTAS. (iii) Our third result is in the case when item sizes are so-called "hypercontractive" random variables i.e., random variables whose second and fourth moments are within constant factors of each other. In other words, the kurtosis of the random variable is upper bounded by a constant. This class has been widely studied in probability theory and most natural random variables are hypercontractive including well-known families such as Poisson, Gaussian, exponential and Laplace distributions. In this case, we design a polynomial time approximation scheme which relaxes both the overflow probability and maximum profit. Crucially, all of our algorithms meet the capacity constraint exactly, a result which was previously known only when the item sizes were Poisson or Gaussian random variables [22, 24]. Our results rely on new connections between Boolean function analysis and stochastic optimization and are obtained by an adaption and extension of ideas such as (central) limit theorems, moment matching theorems and the influential critical index machinery of Servedio [43] developed in the context of complexity theoretic analysis of halfspaces. We believe that these ideas and techniques may prove to be useful in other stochastic optimization problems as well. 7 1 0 2 c e D 4 ] S D . s c [ 1 v 8 1 9 0 0 . 2 1 7 1 : v i X r a ∗Northwestern University. Email: [email protected]. 1 Introduction The knapsack problem is one of the most well-studied combinatorial optimization problems [20] and early work on this problem dates back more than a century [31]. While several variants of this problem have now been studied, in its simplest instantiation, we are given a set of items, each associated with a size and profit. Given a capacity constraint of C, the task is to find a subset of items which maximizes the total profit and whose total size is bounded by C. While the knapsack problem is known to be NP-hard, it admits both a pseudopolynomial time algorithm as well as a fully polynomial time approximation scheme, thus making the problem tractable in many settings. In this paper, we are interested in the stochastic variant of this problem. Here, the item sizes are no longer fixed and are instead given as a probability distribution (supported on R+, i.e., the set of positive real numbers). As is the case with nearly any combinatorial optimization problem, there are several potential stochastic variants of the knapsack problem which have been studied in the literature. See [17, 4, 30, 25] for a partial list of results in various types of models. Our emphasis is on the so-called chance-constrained version of knapsack (alternately referred to as the fixed-set version of stochastic knapsack). A problem instance here is given by items I1, . . . , In where each Ij = (Xj, vj). Here {Xj} are (independent) non- negative real-valued random variables representing the stochastic size of each item and vj are non-negative real numbers representing the profit of each item. Given a knapsack capacity C and an overflow probability p ≥ 0, the aim is to find a set S ⊆ [n] of items which maximizesPj∈S vj such that Pr[Pj∈S Xj > C] ≤ p. The second condition, namely Pr[Pj∈S Xj > C] ≤ p is equivalent to saying that the constraint on the More generally, in a chance-constrained optimization problem, we want to maximize an objective func- tion while allowing the constraints to be violated with a maximum probability p (which is referred to as the unreliability level). Such problems have been long investigated in the optimization community starting with the work of Charnes et al. [6] and the seminal work of Pr´ekopa [38, 39] and continue to remain the topic of current research [3, 35]. See the books [2, 44] which provide a good survey of the current state of the art of this family of problems. As far as the author is aware, work in the TCS community has mostly focused on specific problems in this family (as opposed to developing a broad theory of chance-constrained optimiza- tion problems). However, some authors (see Nikolova's thesis [36]) have considered ways of modeling risk other than via chance constraints. knapsack is violated with probability at most p. Before we discuss prior work on this problem, let us focus on some core issues of the stochastic knapsack problem which this paper seeks to address. 1. Given S ⊆ [n], it is #P hard to compute Pr[Pi∈S Xj > C] even for very simple classes of random variables (such as when each Xj is ±wj with probability 1/2 each). Thus, even checking whether a given solution meets the probabilistic constraint exactly is computationally hard. 2. For the usual (i.e., deterministic) knapsack problem, when {vj} are arbitrary non-negative numbers, maximizing the profit is NP-hard. This suggests that relaxing (at least one of) the overflow probability or the maximum profit is necessary to obtain efficient algorithms.1 However, with the exception of two cases, namely when {Xi} are distributed as Poisson [22] or Gaussian [24], all known algorithms relax the capacity constraint as well. In fact, both these algorithms rely on very delicate properties of these distributions: (i) sum of two Poisson (resp. Gaussian) random variables is a Poisson (resp. Gaussian) random variable. (ii) their distribution is determined entirely by (at most) their first two moments. In fact, these algorithms cannot handle the case when some of the variables follow a Gaussian and the others follow a Poisson distribution. 1We do not know of any formal hardness results here apart from those trivially implied by the hardness of the deterministic knapsack problem. 1 The main focus of this work is to obtain approximation schemes for stochastic knapsack without relaxing the capacity constraint for a large class of random variables. In particular, we obtain such approximation schemes in three different settings for stochastic knapsack: (i) When {Xj} are Bernoulli random variables, we obtain a poly(n)· quasipoly(1/ǫ) time approximation scheme. (ii) When {Xj} are all supported on a common support {a1, . . . , ak}, we obtain a (nk/ǫ)O(k log(1/ǫ))k+1 time approximation scheme. Note that when k = O(1), the running time is quasipolynomial in n and ǫ. For k = 2, this is the same result as the first one (with a slightly worse running time). (iii) When {Xj} are so-called (c, 2, 4) hypercontractive random variables, we obtain a n O(c4/ǫ2) time approximation scheme. Roughly speaking, a random variable is (O(1), 2, 4) hypercontractive if its (central) fourth moment is bounded by the square of its variance up to a O(1) factor. In the language of statistics, this is also referred to as having the kurtosis bounded by a constant. While we later elaborate on this notion later, we mention here that most common random variables are (c, 2, 4) hy- percontractive for a constant c. Examples include Poisson2, Gaussian, exponential, Laplace, uniform on an interval, finitely supported distributions etc. Just to contrast with our earlier remark, our algo- rithms can easily handle the case when, say, some of the {Xi} follow a Poisson distribution while others follow a Gaussian distribution. 1.1 Our results We now formally state our results. To do this, we begin by formally defining an instance of the stochastic knapsack problem. Definition 1. An instance of the stochastic knapsack problem is specified by a list of items {(Xi, vi)}n i=1, a capacity C > 0 and a risk budget p > 0. Here each vi is a positive rational number representing the profit of item i and Xi is a non-negative random variable representing the "stochastic size" of the item. For q > 0, let Feasq ⊆ 2[n] be defined as The task here is to output S ⊆ Feasp such that Feasq = {S ⊆ [n] : Pr[Xj∈S S∈FeaspXi∈ S Xi∈S vi = max Xj > C] ≤ q}. vi. Let D be a class of non-negative real valued random variables and V ⊆ R+. If {Xi}n V, then we say that it is an instance of type (D,V). Definition 2. Given an instance of stochastic knapsack as in Definition 1, we say that an algorithm outputs an (ǫ, 0) approximation if it outputs S ∈ Feasp+ǫ such that Pi∈S vi ≥ max S∈FeaspPi∈ S vi. An algo- rithm is said to output an (ǫ, ǫ) approximation if it outputs S ∈ Feasp+ǫ such that Pi∈S vi ≥ (1 − ǫ) · max S∈FeaspPi∈ S vi. Thus, in an (ǫ, 0) approximation algorithm, we only relax the overflow probability (by an additive ǫ) whereas an (ǫ, ǫ) approximation algorithm relaxes both the profit and the overflow probability. Note that crucially neither type of approximation relaxes the capacity constraint. i=1 ⊆ D and {vi}n i=1 ⊆ 2We note that a Poisson with mean λ is (λ−1/4, 2, 4) hypercontractive. Thus, the constant c is upper bounded by O(1) only when the mean of the Poisson is bounded away from 0. On the other hand, Gaussian, exponential, Laplace etc. are (c, 2, 4) hypercontractive for a fixed c > 0. 2 1.1.1 Approximation scheme for Bernoulli random variables Our first result is an (ǫ, 0) approximation algorithm when {Xi} are Bernoulli random variables. More for- mally, let DB be the class of Bernoulli random variables and let Q+ be the set of positive rational numbers. Then, we have the following theorem. Theorem 3. There is an (ǫ, 0) approximation algorithm for stochastic knapsack instances of type (DB, Q+) running in time poly(n) · (1/ǫ)log2(1/ǫ). Our theorem make significant use of results on (central) limit theorems for sums of Bernoulli random variables3 (aka Poisson binomial distributions) which have recently been a subject of investigation in com- putational learning theory [10, 9] and algorithmic game theory [12, 14]. In particular, such limit theorems (approximately) characterize the distribution of sums in terms of their low-order moments. Combining this with standard dynamic programming techniques gives us the algorithm. It is useful to mention here that while the specific probabilistic techniques we use here are new (for this line of work), dynamic program- ming as an algorithmic tool has been a staple in several papers in this area [22, 4, 30]. 1.1.2 Approximation scheme for k-supported random variables Our second result is an (ǫ, 0) approximation algorithm when {Xi} are independent random variables, all supported on a common set A = {a1, . . . , ak}. More formally, given any set A of size k, let DA be the set of random variables supported on A. Then, our result is the following. Theorem 4. There is an (ǫ, 0) approximation algorithm for stochastic knapsack instances of type (DA, Q+) running in time (nk/ǫ)O(k log k+log(1/ǫ))k+1 for any set A of size k. As with Theorem 3, this algorithm also makes use of very recent moment-matching theorems for so- called Poisson multinomial distributions [11] coupled with standard dynamic programming techniques. Note that after a suitable translation, any set A of size 2 can be assumed to be {0, 1}. Thus, Theorem 3 is a special case of Theorem 4 with a faster running time. 1.1.3 Approximation scheme for hypercontractive random variables Our next result is for a much broader, albeit incomparable class of random variables namely hypercontractive random variables. This is a very widely studied class of random variables in Boolean function analysis (see O'Donnell's book [37]). We begin with some brief motivation and definitions. Let us begin with the definition of central moments. Definition 5. For a real-valued random variable X and for j > 1, we define µj(X) = E[Yj] where Y is the random variable Y = X − E[X]. In other words, for j > 1, µj(X) is the jth absolute central moment of X. Note that µ2(X) is simply the variance of X. Now, by Jensen's inequality, it easily follows that for any j ≥ 2, we have µj(X) ≥ (µ2(X))j/2. Essentially, a real-valued random variable is said to be hypercontrac- tive if the inequality holds in the opposite direction (with appropriate constants). More formally, we define the notion of (c, 2, 4) hypercontractivity below. Definition 6. A real-valued random variable X is said to be (c, 2, 4)-hypercontractive if µ4(X) ≤ c4 · µ2 2(X). 3They are similar in flavor but technically very different from say the well-known Berry-Ess´een theorem 3 In the language of statistics, this is equivalent to stating that the kurtosis of X is at most c4. The notion of (c, 2, 4) hypercontractivity is the quantitative analogue of the existence of fourth moment of X (provided the second moment exists). We refer to c as the hypercontractivity constant for X. As we have said before, most well-known families of random variables such as Poisson, Gaussian, Laplace and exponential random variables are (O(1), 2, 4) hypercontractive. For the convenience of the reader, in Appendix B, we list some common families of random variables which are (c, 2, 4) hypercontractive along with the (corresponding) explicit value of c. On the other hand, there are real-valued random variables which are not (c, 2, 4) hypercontractive for any c. For example, consider the random variable X supported on [−1, 1] where the density of X is given by X(x) = x− 1 3 . While µ2(X) = 6, µ4(X) is unbounded and is thus, not (c, 2, 4) hypercontractive for any c. We mention that the definition of hypercontractivity we use here is a weakening of the more standard notion of hypercontractivity from analysis [29, 45, 34]. The latter definition is nicer from an analysts' point of view but we prefer the definition here for two reasons: (a) it is more intuitive to understand. (b) For our application, this definition is easier to work with and in fact, given a random variable X, it is easier to check our condition of hypercontractivity. For now, we state our main result for stochastic knapsack when {Xi} are (c, 2, 4) hypercontractive random variables. Let Dc be the class of non-negative (c, 2, 4) hypercontractive random variables. Our main result is the following. Theorem 7. There is an (ǫ, ǫ) approximation algorithm for stochastic knapsack instances of type (DC, Q+) running in time n O(c4/ǫ2). Thus for (c, 2, 4) hypercontractive random variables, our approximation algorithm relaxes both the profit as well as the overflow probability. Crucially, our algorithm does not relax the capacity constraint of the knapsack. We now highlight an important corollary of this theorem. Namely, let us say a finitely supported distribution X is α-balanced if minx:X(x)6=0 X(x) = α i.e., the probability of any support point is at least α. In Proposition 35, we prove that any α-balanced distribution is (α−1/4, 2, 4)-hypercontractive. As a corollary of Theorem 7, we get an approximation scheme for stochastic knapsack when {Xi} are α-balanced which runs in time nO((αǫ2)−1). Note that every finitely supported distribution is α-balanced for some fixed α > 0. Thus, this implies the following corollary. Corollary 8. There is an (ǫ, ǫ) approximation algorithm for stochastic knapsack instances where the ran- dom variables {Xi} are finitely supported. Further, the running time is nO((αǫ2)−1) where α is defined as α = mini,x:Xi(x)6=0 Xi(x). This should be compared to the results of [22, 7] (which we discuss shortly) where they obtained a polynomial time approximation scheme for the case when each {Xi} is supported on 0 and another point (this point can depend on i). They call such random variables "Bernoulli-type" random variables. On one hand, these papers obtain a fully polynomial time approximation scheme in this setting whereas our running time depends on the "balanced-ness" parameter of the random variables. On the other, the algorithm in [22, 7] relaxes the capacity constraint, whereas ours does not and in fact, ours yields an efficient approximation scheme for any constant sized support. Further, our algorithms apply to a much broader class of random variables, and are not tailored towards Bernoulli-type random variables. Theorem 7 follows by a reduction to the following theorem which obtains an (ǫ, 0) approximation when M be the set of non-negative integers the profit of each item is a polynomially bounded integer. Let Z+ bounded by M . We prove the following theorem. Theorem 9. There is an (ǫ, 0) approximation algorithm for stochastic knapsack instances of type (DC , Z+ M ) running in time n O(c4/ǫ2) · poly(M ). 4 The reduction from Theorem 7 to Theorem 9 is essentially the standard reduction that yields a poly- nomial time approximation scheme for (the standard) knapsack by reducing to knapsack with polynomially bounded weights. Thus, our focus will essentially be on proving Theorem 9. We now give a brief description of prior work followed by a high level overview of our techniques. Prior work Motivated by the problem of allocating bandwidth to bursty connections, Kleinberg, Rabani and Tardos [27] were the first to study the stochastic knapsack problem. They proved several incomparable results for the case when {Xi} are Bernoulli type random variables4. In particular they obtained a log(1/p) approximation without relaxing either the capacity constraint or the overflow probability (where p is the overflow proba- bility). They also obtained a O(1/ǫ) approximation by either relaxing the overflow probability to p1−ǫ or the capacity constraint by a factor of (1 + ǫ). Soon thereafter, Goel and Indyk [22] studied this problem for Poisson, exponential and Bernoulli-type random variables and obtained a PTAS for the first two and a quasi-PTAS for the last one (this was improved subsequently to a PTAS by Chekuri and Khanna [7]). The main caveat of their result was that in addition to relaxing the overflow probability, for both exponential and Bernoulli-type distributions, they relaxed the capacity constraint by a multiplicative factor of (1 + ǫ) as well. Subsequently, there were several papers which explored other models of stochastic knapsack, particu- larly, the power of adaptive strategies in this context [17, 4, 25, 16, 30]. In terms of progress on the fixed set version (considered in this paper), Goyal and Ravi [24] obtained a PTAS when the item sizes are Gaussian. Finally, Bhalgat, Goel and Khanna [4] obtained a PTAS which works for any random variable but relaxes all the three parameters, namely the capacity constraint, optimal value and overflow probability by a factor of (1 + ǫ). The running time in [4] was nOǫ(1) where Oǫ(1) is doubly exponential in ǫ. This was improved to a singly exponential in ǫ by Li and Yuan [30] (using different techniques). To summarize, the results of [4, 30] essentially settle the case of stochastic knapsack if one is willing to relax the capacity constraint. However, without relaxing the capacity constraint, we knew of approximation schemes in precisely two cases: When the item sizes are Gaussian [24] or when they are Poisson [22]. In fact, prior to this work the best known algorithm that does not violate capacity constraints achieved a O(log(1/p)) approximation to the objective even when the item sizes are Bernoulli random variables. Overview of our techniques Proof overview of Theorem 3 and Theorem 4: At a very high level, there are two main technical ideas in this paper. We start with the first idea, which is used to prove Theorem 3 and Theorem 4 and is significantly easier to explain. The main plan is to exploit limit theorems for sums of independent random variables (of the type appearing in Theorem 3 and Theorem 4). In a nutshell, these limit theorems approximately characterize the distribution of the sum in terms of its low order moments. This characterization is then used to convert the stochastic knapsack problem into a deterministic multidimensional knapsack problem. However, we know of pseudopolynomial time algorithms for the latter which translates into an approximation scheme for stochastic knapsack. In fact, the idea of converting stochastic knapsack into multidimensional deterministic knapsack (via different means) can be traced back to the work of Goel and Indyk [22]. The novel aspect of our work here is the use of ideas and tools from limit theorems to perform this conversion. To explain the idea in a little more detail, let us first focus on Theorem 3 (i.e., Bernoulli sized items). Consider a stochastic knapsack instance (as in Definition 1) where the items are {(Xℓ, vℓ)}n ℓ=1, capacity is C and the overflow probability is p. Also, assume that all the probabilities in {Xℓ} are rounded to the nearest multiple of ǫ/(4n). This can be accomplished by losing at most an additive ǫ/4 in the overflow probability of 4Recall that Xi is said to be Bernoulli-type if its support size is at most 2 and one of the points in the support is 0. 5 any subset of [n]. Now, assume that Sopt ⊆ [n] is the optimal solution to this problem. Consider the random variable ZSopt = Pℓ∈Sopt Xℓ. Our algorithm is split into two cases: (i) when Var(ZSopt) ≥ 1/ǫ2 and (ii) when Var(ZSopt) < 1/ǫ2. In the first case, our algorithm finds a set S ⊆ [n] such that for ZS =Pℓ∈S Xℓ, its first two moments are the same as ZSopt andPℓ∈S vℓ ≥Pℓ∈Sopt vℓ (this can be accomplished by dynamic programming). Note that while we do not know the values of the first two moments of ZSopt, there are only poly(n/ǫ) possibilities for these as all the probabilities in {Xℓ} are integral multiples of ǫ/(4n). Thus, we can exhaustively try out all possibilities and find out a set S for each possibility. The key fact that we use here is a so-called discrete central limit theorem for sums of Bernoulli random variables (Lemma 17): Namely, if the first two moments of ZSopt and ZS are the same (and the variance is at least 1/ǫ2), then they are ǫ-close to each other in total variation distance. Thus, the overflow probability of ZS is at most ǫ more than ZSopt . This finishes the first case. The algorithm in the second case is quite similar to the first case but here we find a set S such that the first O(log(1/ǫ)) moments of ZS match those of ZSopt (instead of just the first two moments as was done in case (1)). The key fact on which we rely here is a recent so-called "moment matching theorem" of Daskalakis and Papadimtriou [12] (Lemma 19) which essentially says that matching O(log(1/ǫ)) moments implies ǫ-closeness in total variation distance between ZS and ZSopt (we are glossing over an additional technical condition required to apply this theorem and indeed our algorithm is also somewhat more involved). In fact, naively applying Lemma 19 results in a running time of (n/ǫ)log2(1/ǫ) in Case (2). To instead get a running time of poly(n)· (1/ǫ)log2(1/ǫ) (as claimed in Theorem 3), some additional complication is required and one instead has to apply a so-called Poisson approximation theorem [5] in tandem with the moment matching theorem of [12]. We do not discuss the proof for Theorem 4 here but at a high level, it also relies on a "moment-matching theorem" similar to case (ii) of Theorem 3. In particular, we use a very recent "moment-matching theorem" for so-called Poisson multinomial distributions (PMDs) due to Daskalakis, Kamath and Tzamos [11]. The actual theorem statement is somewhat more complicated, so we refrain from discussing it here any further. We also mention that Li and Yuan [30] had used a similarly flavored idea for stochastic knapsack: Namely, they used a so called compound Poisson approximation [5] to convert stochastic knapsack into (determinis- tic) multidimensional knapsack. While their method of approximation is quite general and in fact applies to any random variable, their guarantee is weaker and in fact, they relax the capacity constraint even when all the sizes {Xi} are Bernoulli random variables. Proof overview of Theorem 7: As we have said, the proof of Theorem 7 essentially reduces to proving Theorem 9 i.e., where the profits are non-negative integers bounded by M . So, let us focus on the proof of Theorem 9. The main idea here is a new connection between the stochastic knapsack problem and the struc- connection between halfspaces and stochastic knapsack, let us consider an instance of the stochastic knap- tural analysis of halfspaces. We begin by recalling that halfspaces are Boolean functions f : Rn → {0, 1} which are of the form f (x) = sign(Pn i=1 wixi − θ) where all of w1, . . . , wn and θ ∈ R.5 To understand the sack problem (Definition 1) of type (Dc, ZM ). In other words, the items are given by {(Xℓ, vℓ)}, the knap- sack capacity is C and the overflow probability is p and the item sizes {Xℓ} are now (c, 2, 4) hypercontrac- tive random variables. Now, consider any set S ⊆ [n] which is feasible i.e., Pr[Pℓ∈S Xi > C] ≤ p. This is equivalent to saying that the halfspace fS defined as fS(X1, . . . , Xn) = sign(Pℓ∈S Xℓ− C) is 1 with prob- ability at most p. Ostensibly, these halfspaces appear to be simple as all the weights w1, . . . , wn ∈ {0, 1}. However, this simplicity is superficial as we allow {Xℓ} to be arbitrary (c, 2, 4) hypercontractive random variables and in fact, if Xℓ is (c, 2, 4) hypercontractive, so is w · Xℓ for any w ∈ R. The high level idea in the proof of Theorem 9 is to exploit the so-called "structure versus random- ness" phenomenon for halfspaces which was introduced in the influential work of Servedio [43] and has subsequently played a crucial role in the recent developments in the complexity theoretic analysis of half- 5the sign function outputs 1 iff its argument is positive. 6 spaces [43, 18, 15, 33, 32] (we explain this phenomenon a little later). Results in this line of work have mostly looked at halfspaces of the form g(X1, . . . , Xn) = sign(Pi∈S Xi) where S ⊆ [n] and each Xi is a so-called "balanced Bernoulli type" random variable i.e., random variables of the form wi · Zi where Zi is a Bernoulli random variable such that Pr[Zi = 0] is bounded away from 0 and 1 by a positive constant. In fact, most of the work in complexity theory considers the case when Pr[Zi = 0] = Pr[Zi = 1] = 1/2. Starting with the observation that balanced Bernoulli type random variables are (O(1), 2, 4) hypercontrac- tive, we generalize a significant fraction of the machinery from [43] to arbitrary (c, 2, 4) hypercontractive random variables. Indeed, we believe that a key conceptual contribution of this work is to realize the connection between stochastic optimization (specifically stochastic knapsack) and the "structure versus ran- domness" paradigm of [43] for halfspaces on hypercontractive random variables. Finally, we also mention that in the context of constructing pseudorandom generators, Gopalan et al. [23] also extended the machin- ery of Servedio [43] to hypercontractive random variables. However, they work with the stronger notion of hypercontractivity [45, 29] alluded to earlier. While there is some parallel between our extension of the machinery of [43] and that of Gopalan et al., it is not clear if their extension can be adapted to our setting in a black box manner. Finally, we would like to emphasize that the main thrust of this paper is not on Boolean function analysis but more on how it can serve as an effective tool in stochastic design problems. We now briefly explain the structure versus randomness paradigm in the context of stochastic knapsack problem as well as how it is algorithmically useful. Let us assume that Sopt = {j1, . . . , jR} ⊆ [n] is the optimal solution. Assume that Var(Xj1) ≥ . . . ≥ Var(XjR). There are now two possibilities: (i) The first is that Var(Xj1) is small compared to the total sum of the variances Pℓ∈Sopt Var(Xj1). In this case, the Berry-Ess´een theorem (Theorem 16) implies that the distribution ZSopt =Pℓ∈Sopt Xℓ (approximately) follows a Gaussian distribution. We remark that in order to get non-trivial error bounds from the Berry- Ess´een theorem, we need that the random variables {Xℓ} are (c, 2, 4) hypercontractive. Now, observe that a Gaussian is completely characterized by its mean and its variance (i.e., its first two moments). Using an idea similar to case (i) of Theorem 3, we can use dynamic programming to find another set S ⊆ [n] such that ZS =Pℓ∈S Xℓ has the same first and second moments as ZSopt and such thatPℓ∈S vℓ ≥Pℓ∈Sopt vℓ. By applying the Berry-Ess´een theorem, we obtain that the overflow probability of ZS is at most ǫ more than that of ZSopt which completes the proof of this case. This description here is significantly simplified and glosses over some key technical difficulties (which is the reason we get an (ǫ, ǫ) approximation as opposed to an (ǫ, 0) approximation in Theorem 7). the random variable ZSopt,2 defined asPℓ∈Sopt\j1 The other possibility is if Xj1 constitutes a significant fraction of the variance of ZSopt. In that case, Xℓ has a noticeably smaller variance than ZSopt and in essence, "we have made progress". We can now recursively look at the random variable ZSopt,2 and apply the same argument as before. Intuitively, such a process can only continue for a bounded number of steps because in each step, we "cut-off a sizeable fraction of the variance". In particular, we show that after L = O(c4/ǫ2) such steps, the random variable ZSopt,L essentially behaves like a constant. This argument can be formalized by the notion of critical index (Definition 27) and is an extension of the eponymous notion from [43]. Roughly speaking, the critical index is the smallest integer K such that ZSopt,K behaves like a Gaussian random variable. The reason the notion of critical index is algorithmically useful is the following. Define T = min{K, L}. Since T is upper bounded by a constant, the algorithm can guess the indices {j1, . . . , jT}. On the other hand, the random variable ZSopt,T either behaves like a constant (if K ≥ L) or like a Gaussian random variable (if K < L). Both these cases can be handled using dynamic programming techniques discussed earlier. At a thematic level, the strategy follows the usual "critical-index" machinery of [43]. However, si- multaneously extending this machinery to arbitrary (c, 2, 4) hypercontractive random variables as well as adapting it in the context of stochastic knapsack poses several challenges (which are difficult to explain at this level of detail). Also, we introduce some new technical tools such as the Kolmogorov-Rogozin inequal- 7 ity (Lemma 14) etc. which do not seem to have been explicitly used before in this line of work and can potentially be useful elsewhere. C, they seek to find a vector w ∈ [0, 1]n such that (i)Pn i=1 wi = 1 and (ii) Pr[Pn Finally, we mention that the critical-index machinery was also used by Daskalakis et al. [8] in the con- text of stochastic optimization; in particular, to obtain an approximation scheme for so-called fault tolerant distributed storage. Very briefly, given balanced Bernoulli random variables6 Y1, . . . , Yn and a threshold i=1 wi · Yi > C] is max- imized. While there is some ostensible similarity between their problem and ours, there are fundamental differences: namely, their solution space is the n-dimensional polytope and indeed, a significant use of the critical machinery in [8] is to argue that there is an approximately optimal solution with a "nice", so-called "anti-concentrated" solution. In contrast, our solution space is combinatorial (namely subsets of [n]) and we XS for all S ⊆ [n]. Fi- nally, we also emphasize that [8] only dealt with sums of balanced Bernoulli type random variables whereas we have to tackle sums of independent (c, 2, 4) hypercontractive random variables thus creating additional complications. use the critical index machinery to characterize the probabilistic behavior ofPS⊆[n] To sum up, a wealth of sophisticated and powerful results have been developed in probability theory and the complexity theoretic study of halfspaces that have direct relevance to the linear forms in random variables that are at the heart of the stochastic knapsack problem. We view the transfer of these ideas and techniques from complexity theory and probability to stochastic optimization as a conceptual contribution of this work, and we hope that more connections will be uncovered between these previously rather disjoint fields. 2 Some basics of probability theory In this section, we list some probabilistic preliminaries which will be useful throughout the paper. Distance between distributions We will use two (well-known) notions of distances between real-valued random variables which we recall below. Definition 10. For real-valued random variables X and Y, dcdf (X, Y) = sup dTV(X, Y) = sup t∈R(cid:12)(cid:12) Pr[X ≤ t] − Pr[Y ≤ t](cid:12)(cid:12), A⊆R(cid:12)(cid:12) Pr[X ∈ A] − Pr[Y ∈ A](cid:12)(cid:12). Here the supremum A is taken over any measurable subset of R. It is easy to see that dTV(X, Y) (up to a factor of 2) is the same as the ℓ1 distance between the random variables X and Y. 2.0.1 Anti-concentration and smoothness of random variables The notion of anti-concentration of random variables is going to play an important role in the proof of Theorem 7. We quantify the notion of anti-concentration of a real-valued random variable by the so-called L´evy concentration function (defined below). Definition 11. For a real-valued random variable X and t > 0, we define QX(t) as QX(t) = supa∈R Pr[a ≤ X ≤ a + t]. 6i.e., the probability of being 0 is bounded away from both 0 and 1. 8 Note that QX(t) is an upper bound on the mass that X puts in any interval of size t. A useful intuition for QX(t) is that it is a measure of smoothness of the random variable t. We now record a very simple but useful fact about the function QX(t), namely that it decreases upon convolution. Fact 12. Let X and Y be independent random variables. Then, for t > 0, QX+Y(t) ≤ QX(t). The next lemma shows that hypercontractive random variables have non-trivial bounds on QX (·). Lemma 13. Let X be a (c, 2, 4)-hypercontractive random variable with µ2(X) = σ2. Then, for t = σ/2 and δ = 9 128·(c+2)4 , QX(t) ≤ 1 − δ. Proof. We begin with a simplification. Namely, let Z = X − X′ where X′ is an i.i.d. copy of X. Note that E[Z] = 0, µ2(Z) = 2µ2(X) and µ4(Z) = 2µ4(X) + 6µ2 2(X). It easily follows Z is (c + 2, 2, 4)- hypercontractive. Now, towards a contradiction assume that QX(t) > 1 − δ. Then, it follows that Pr[Z ≤ t] > 1 − 2δ. Let us define κ = Pr[Z > t]. Also, let Y be the random variable obtained by conditioning Z on the event Z > t. Also, let p(·) be the density of Z. σ2 =Zx∈R x2p(x)dx = Zx≤t x2p(x)dx +Zx>t x2p(x)dx ≤ t2 · (1 − κ) +Zx>t = t2 · (1 − κ) + κ · E[Y 2] x2p(x)dx As a consequence, we have Likewise, it is clear that E[Y2] ≥ 1 κ · (σ2 − t2(1 − κ)). E[Y4] ≤ 1 κ · E[Z4] ≤ (c + 2)4 κ · (E[Z2])2 = 4 · (c + 2)4 κ · σ4 Applying Jensen's inequality on (1) and (2), we get (1) (2) Plugging in t = σ/2, we get 4 · (c + 2)4 κ · σ4 ≥ 1 κ2 · (σ2 − t2(1 − κ))2 κ ≥ 9 64 · (c + 2)4 and δ ≥ 9 128 · (c + 2)4 . The following well-known inequality, known as the Kolmogorov-Rogozin inequality [28, 40] states that adding independent random variables improves anti-concentration. Lemma 14 (Kolmogorov-Rogozin inequality). Let X1, X2, . . . , Xn be independent random variables and let Z = X1 + . . . + Xn. Then, for t > 0 and 0 < ti ≤ t (for i = 1, . . . , n), we have QZ(t) ≤ 100 · t i · (1 − QXi(ti)) qPn i=1 t2 9 2.0.2 Berry-Ess´een theorem and other central limit theorems Quantitative versions of the central limit theorem will be a key ingredient in nearly all the theorems. We begin with the Berry-Ess´een theorem [19] which implies convergence in cdf distance. Let N (µ, σ2) denote the Gaussian with mean µ and variance σ2. Theorem 15. X1 + . . . + Xn, µ = E[Z] and σ2 = Var(Z). Then, (Berry-Ess´een theorem) Let X1, . . . , Xn be independent random variables and let Z = dcdf (Z,N (E[Z], Var(Z)) ≤ 1 σ · max 1≤i≤n µ3(Xi) µ2(Xi) . dcdf (Z,N (E[Z], Var(Z)) ≤ 1 σ · max 1≤i≤npµ4(Xi) pµ2(Xi) . Note that by Lyupanov's inequality [21], for any random variable X, µ3(X) ≤pµ2(X) · µ4(X). Thus, As a consequence, we have the following corollary which is applicable to (c, 2, 4) hypercontractive random variables. Corollary 16. Let X1, . . . , Xn be independent (c, 2, 4) hypercontractive random variables and let Z = X1 + . . . + Xn, µ = E[Z] and σ2 = Var(Z). Then, dcdf (Z,N (E[Z], Var(Z)) ≤ max i c2 ·pµ2(Xi) σ . The next limit theorems are applicable only to sums of Bernoulli random variables but provide a stronger convergence guarantee, namely in total variation distance. The translated Poisson distribution TP(µ, σ2) is the Poisson distribution Poi(λ) translated by ⌊µ − σ2⌋ and λ = µ − ⌊µ − σ2⌋. Note that Poi(λ) is the Poisson with mean λ. Lemma 17. variables and let Z =Pn i=1 Translated Poisson approximation [41] Let X1, . . . , Xn be independent Bernoulli random Xi. Let µ = E[Z] and σ2 = Var(Z). Then, σ + 2 . σ2 Lemma 18. Poisson approximation [1] Let X1, . . . , Xn be independent Bernoulli random variables and for 1 ≤ j ≤ n, E[Xj] = pj . For Z =Pn dTV(cid:0)Z, TP(µ, σ2)) ≤ Xi and µ =Pn dTV(cid:0)Z, Poi(µ)(cid:1) ≤ Pn iPn Lemma 19. Moment matching theorem for PBDs [42, 13] Let {Xi}n i=1 be two families of independent Bernoulli random variables such that for all 1 ≤ i ≤ n, E[Xi] = pi, E[Yi] = qi ≤ 1/2. Let ZX = Pn Yi and for 1 ≤ j ≤ T ,Pi∈[n] pj i . Then, dTV(ZX, ZY) is bounded by i=1 and {Yi}n i = Pi∈[n] qj Xi, ZY = Pn i=1 p2 i=1 pi j=1 pi, i=1 i=1 i=1 For sufficiently large T , the right hand side is upper bounded by 2−T /3. dTV(ZX, ZY) ≤ 13 · (T + 1)1/4 · 2−(T +1)/2. We next define Poisson multinomial distributions and state a moment matching theorem for these dis- tributions. 10 Definition 20. A random variable X supported on {e1, . . . , ek} (where ei is the standard unit vector in the ith direction) is said to be a k-categorical random variable (CRV). A (n, k) Poisson-multinomial distribution is obtained by adding n independent random variables X1, . . . , Xn where each Xi is a k-CRV. The following moment matching theorem was proven by Daskalakis, Kamath and Tzamos [11]. To do this, for positive integers w and k, define Vk(w) = {v ∈ Zk : vi ≥ 0 ∧Pi vi ≤ w}. Theorem 21. Let {X1, . . . , Xn} and {Y1, . . . , Ym} be independent k-CRVs. They satisfy the following properties: • For all 1 ≤ j ≤ k, maxi Pr[Xi = ej] − mini Pr[Xi = ej] ≤ 1 mini Pr[Yi = ej] ≤ 1 4ek3 . • There exists j0 ∈ [k] such thatPn • For all α ∈ Vk(w), let Pr[Xi = ej0] ≥ n k andPm i=1 i=1 4ek3 and maxi Pr[Yi = ej] − Pr[Yi = ej0] ≥ m k . Pr[Xi = ej]αj = nXi=1 kYj=1 Yi) ≤ 2−w+1. mXi=1 kYj=1 Pr[Yi = ej]αj . Then, dTV(Pn i=1 Xi,Pm i=1 An easy corollary of this is the following. Corollary 22. Let A = {a1, . . . , ak} and let {X1, . . . , Xn} and {Y1, . . . , Ym} be independent random variables supported on A. Assume that they satisfy: • For all 1 ≤ j ≤ k, maxi Pr[Xi = aj] − mini Pr[Xi = aj] ≤ 1 4ek3 and maxi Pr[Yi = aj] − mini Pr[Yi = aj] ≤ 1 4ek3 . • There exists j0 ∈ [k] such that for all 1 ≤ i ≤ n, Pr[Xi = aj0] = maxj∈[k] Pr[Xi = aj] and 1 ≤ i ≤ m, Pr[Yi = aj0] = maxj∈[k] Pr[Yi = aj]. • For all α ∈ Vk(w), let Pr[Xi = aj]αj = mXi=1 kYj=1 Pr[Yi = aj]αj . kYj=1 nXi=1 Yi) ≤ 2−w+1. i=1 i=1 Xi,Pm Then, dTV(Pn Proof. Corresponding to each Xi, define the k-CRV Xi as follows: For every 1 ≤ i ≤ n and 1 ≤ j ≤ k, Pr[ Xi = ej] = Pr[Xi = aj]. Likewise, for each Yi, define the k-CRV Yi as Pr[ Yi = ej] = Pr[Yi = aj]. Note that the three conditions of Corollary 22 imply the three conditions required to apply Theorem 21 for { Xi} and { Yi}. Applying Theorem 21, we obtain dTV(Pn Yi) ≤ 2−w+1. Finally, note that Pn Yii where a = (a1, . . . , ak). This proves the Yi = ha,Pn Xi = ha,Pn Xii and Pn Xi,Pm i=1 corollary. i=1 i=1 i=1 i=1 i=1 11 3 Proof of Theorem 3 We first make the following simple observation (which will be useful in the proof of Theorem 9 as well). Proposition 23. Given (efficiently samplable) random variables X1, . . . , Xn, capacity C, a subset S ⊆ [n] and an error parameter ǫ > 0, there is a randomized poly(n/ǫ) time algorithm which computes Pr[Pj∈S Xi > C] to additive error ±ǫ. Proof. This is the consequence of a trivial sampling algorithm. key observations about this relation. We will use this proposition in a simple way. Namely, for any S ⊆ [n], we use the notation Pr[Pj∈S C] ≤ǫ q to denote that a ±ǫ additive approximation to Pr[Pj∈S (i) If Pr[Pj∈S Xi > C] ≤ q + ǫ. (ii) If Pr[Pj∈S Xi > C] ≤ǫ q. Xi > C] ≤ǫ q, then Pr[Pj∈S Xi > C] ≤ q − ǫ, then Pr[Pj∈S Xi > C] is bounded by q. Here are a few (iii) There is a randomized algorithm to check this relation in polynomial time. While the randomized algorithm has a non-zero probability of failure, it can be made inverse exponentially small in n by increasing the running time by a factor of O(n). Thus, for simplicity, we will assume that the relation is computed with probability 1. Xi > We will divide the proof of Theorem 3 into two claims. First of all, given any stochastic knapsack instance {(Xi, vi)}n V , define Feasp,V as i=1 of type (DB, Q+), capacity C, overflow probability p, error parameter ǫ > 0 and profit value Feasp,V = {S ⊆ [n] : Pr[Xj∈S of two algorithms: The first one succeeds if Var(Pj∈S and the second one succeeds if (Pj∈S smaller than any explicitly specified constant occuring in our proofs. Xj > C] ≤ p and Xj∈S vj = V }. Let Vopt be the maximum V such that Feasp,V is non-empty. The algorithm in Theorem 3 is a combination Xj) is large where S is the target set in Feasp,Vopt Xj) is small. Also, from now on, we will assume that ǫ > 0 is Claim 24. There is an algorithm SK-Bernoulli-Large with the following guarantee: Given a stochastic knapsack instance {(Xi, vi)}n M ), capacity C, overflow probability p, error parameter ǫ > 0, it outputs a set S∗ with the following guarantee: For a profit value V , define the set Feasp,V,1 as i=1 of type (DB, Z+ Feasp,V,1 = {S ⊆ [n] : Pr[Xj∈S Xj > C] ≤ p, Var(Xj∈S Xj) ≥ 1/ǫ2 and Xj∈S vj = V }. Let Vopt,1 be the maximum value such that Feasp,V,1 is non-empty. Then, S∗ ∈ Feasp+4·ǫ andPj∈S∗ vj ≥ Vopt,1. The running time of the algorithm is poly(n, 1/ǫ). Claim 25. There is an algorithm SK-Bernoulli-Small with the following guarantee: Given a stochastic knapsack instance {(Xi, vi)}n M ), capacity C, overflow probability p, error parameter ǫ > 0, it outputs a set S∗ with the following guarantee: For a profit V , define the set Feasp,V,2 as i=1 of type (DB, Z+ Feasp,V,2 = {S ⊆ [n] : Pr[Xj∈S Xj > C] ≤ p, Var(Xj∈S Xj) ≤ 1/ǫ2 and Xj∈S vj = V }. Let Vopt,2 be the maximum value such that Feasp,V,2 is non-empty. Then, S∗ ∈ Feasp+4·ǫ andPj∈S∗ vj ≥ Vopt,2. The running time of the algorithm is poly(n, (1/ǫ)log2(1/ǫ)). 12 Note that Theorem 3 follows easily as a combination of Claim 24 and Claim 25. Let Vopt be the maximum value for which Feasp,V is non-empty. For C0 = 8, run SK-Bernoulli-Large and SK-Bernoulli- Small with error parameter ǫ/C0. Let the output sets be S∗,ℓ and S∗,s respectively. We discard S ∈ {S∗,ℓ, S∗,s} if Pr[Pj∈S 4 . We are guaranteed that both S∗,ℓ and S∗,s are not discarded. We now output the set S ∈ {S∗,ℓ, S∗,s} which maximizesPj∈S vj. This finishes the proof of Theorem 3. Proof of Claim 24: For ℓ ∈ [n], let us define pℓ = E[Xℓ] and qℓ be pℓ rounded to the nearest multiple of ǫ/(4n). For ℓ ∈ [n], let {Yℓ}n ℓ=1 be independent Bernoulli random variables such that E[Yℓ] = qℓ. Define the set A1 and A2 as: Xj > C] ≤ǫ/4 p + 3ǫ A1 =(cid:26)j · ǫ 4n : j ∈ N and j · ǫ 4n ≤ n(cid:27), A2 =(cid:26)j · ǫ2 16n2 : j ∈ N and j · ǫ2 16n2 ≤ n(cid:27). For 1 ≤ ℓ ≤ n, define item Jℓ with size (qℓ, q2 SK-Bernoulli-Large. ℓ ) and profit vℓ. We are now ready to define the algorithm 1. Let Vmax = 0 and Smax = φ. 2. For (x, y) ∈ A1 × A2, 3. 5. Output Smax. Run Pseudo-knapsack with items {Jℓ}n If the output is S ⊆ [n] and Pr[Pℓ∈S 4. ℓ=1, target size (x, y) and quantization is (ǫ/4n, ǫ2/16n2). Xj > C] ≤ǫ/2 p + 3.5ǫ andPℓ∈S vℓ > Vmax, Smax ← S. that The running time is computed as follows: Every invocation of Pseudo-knapsack takes time poly(n, 1/ǫ). Since the cardinality of A1 × A2 is poly(n/ǫ), the total running time is poly(n, 1/ǫ). To prove correctness, it suffices to show that there exists (x0, y0) ∈ A1 × A2 such that the output of Pseudo-knapsack with target (x0, y0) returns set S such that Pr[Pj∈S Xj > C] ≤ p + 3ǫ and Pj∈S vj ≥ Vopt,1. To show this, let V = Vopt,1 and let Sopt ⊆ [n] be such that Sopt ∈ Feasp,V,1 and V = Pℓ∈Sopt vℓ. Then, it follows that Pr[Pℓ∈Sopt Yℓ > C] ≤ p + ǫ/4. Now, note that by construction ℓ ∈ A2. Let x0 = Pℓ∈Sopt qℓ and y0 = Pℓ∈Sopt q2 Pℓ∈Sopt qℓ ∈ A1 and Pℓ∈Sopt q2 ℓ . Then, the routine ℓ = y0 andPℓ∈S vℓ ≥ V . This implies Pseudo-knapsack returns set S such thatPℓ∈S qℓ = x0,Pℓ∈S q2 E(cid:2)Xℓ∈S Yℓ(cid:3) =Xℓ∈S Yℓ(cid:19) =Xℓ∈S Var(cid:18)Xℓ∈S qℓ − q2 Yℓ(cid:19) = Var(cid:18)Xℓ∈S Yℓ(cid:3). ℓ = Var(cid:18) Xℓ∈Sopt Xℓ(cid:19) − qℓ = Xℓ∈Sopt ℓ = Xℓ∈Sopt Yℓ(cid:19) ≥ Var(cid:18)Xℓ∈S qℓ = E(cid:2) Xℓ∈Sopt qℓ − q2 Var(cid:18) Xℓ∈Sopt Further, note that ǫ 4n · n ≥ 1 ǫ2 − ǫ ≥ 0.9 ǫ2 . Yℓ(cid:19) (3) (4) The last inequality relies on assuming that ǫ > 0 is sufficiently small. Combining Lemma 17 and (3), (4), we obtain dTV(cid:0) Xℓ∈Sopt Yℓ,Xℓ∈S Yℓ(cid:1) ≤ 2ǫ 0.9 . 13 Now, observe that , ǫ 4 dTV(cid:0) Xℓ∈Sopt Yℓ, Xℓ∈Sopt Xℓ(cid:1) ≤ dTV(cid:0)Xℓ∈S Xℓ, Xℓ∈Sopt Xj > C] ≤ p, we have Pr[Pj∈S dTV(cid:0)Xℓ∈S Xℓ(cid:1) < 3ǫ. This implies that As Pr[Pj∈Sopt Yℓ,Xℓ∈S Xℓ(cid:1) ≤ ǫ 4 Proof of Claim 25: Let us begin by defining a partition of [n] into four sets B1, B2, B3, B4 as follows: Xj > C] ≤ p + 3ǫ. This concludes the proof. ǫ B1 =(cid:8)ℓ ∈ [n] : pℓ ≤ 100(cid:9), B2 =(cid:8)ℓ ∈ [n] : pℓ ≥ 1 − ǫ 100}, 100 ≤ pℓ ≤ 1/2(cid:9), B4 =(cid:8)ℓ ∈ [n] : 1/2 ≤ pℓ ≤ 1 − B3 =(cid:8)ℓ ∈ [n] : ǫ ǫ 100(cid:9). For 1 ≤ ℓ ≤ n, we define qℓ as follows: For elements in B1 and B2, qℓ is pℓ rounded to the nearest multiple ǫ 4n . For elements in B3 and B4, qℓ is pℓ rounded to the nearest multiple of ǫ4/1000. First, let us define of the set A1 (similar to the proof of Claim 24) as A1 =(cid:26)j · ǫ 4n : j ∈ N and j · ǫ 4n ≤ n(cid:27). Next, let us define T0 = 4 log(1/ǫ) and for T ∈ {1, 2, . . . , T0}, we define the set eAT as ǫ2(cid:27). Next, for ℓ ∈ [n], we construct items Jℓ whose sizes are defined as follows. ǫ4T 1000T : j ∈ N and j · ǫ4T 1000T ≤ 1 Jℓ = (qℓ) (1, 1 − qℓ) (qℓ, q2 (1, (1 − qℓ), (1 − qℓ)2, . . . , (1 − qℓ)T0) ℓ , . . . , qT0 ℓ ) if ℓ ∈ B1 if ℓ ∈ B2 if ℓ ∈ B3 if ℓ ∈ B4 eAT =(cid:26)j ·   Further, for all ℓ ∈ [n], the profit of Jℓ is defined to be vℓ. We are now ready to describe SK-Bernoulli-Small. 1. Set Vmax = 0 and Smax = φ. 2. For x1 ∈ A1, x2 ∈ [n] × A1, x3 ∈ A1 × . . . × AT0 and x4 ∈ [n] × A1 × . . . × AT0 , 3. Run Pseudo-knapsack with items {Jℓ}ℓ∈B1 , target x1 and quantization (ǫ/(4n)). 4. Run Pseudo-knapsack with items {Jℓ}ℓ∈B2 , target x2 and quantization (1, ǫ/(4n)). 5. Run Pseudo-knapsack with items {Jℓ}ℓ∈B3 , target x3 and quantization (ǫ4/1000, . . . , ǫ4T0 /1000T0 ). 6. Run Pseudo-knapsack with items {Jℓ}ℓ∈B4 , target x4 and quantization (1, ǫ4/1000, . . . , ǫ4T0 /1000T0 ). 7. Let the outputs of Steps 3, 4, 5, 6 be S1, S2, S3, S4. Let S = S1 ∪ S2 ∪ S3 ∪ S4. 8. Xj > C] ≤ǫ/2 p + 3.5ǫ andPj∈S vj ≥ Vmax, set Smax ← S and Vmax =Pj∈S vj. If Pr[Pj∈S 14 9. Output the set Smax. Note that the total number of choices for (x1, x2) is poly(n/ǫ), (x3, x4) is n· (1/ǫ)O(T 2 0 ). Further, for a fixed choice of (x1, x2, x3, x4), Theorem 34 implies that the running time of Steps 3, 4, 5, 6 is upper bounded by poly(n, (1/ǫ)T 2 0 ). As T0 = O(log(1/ǫ)), this implies our upper bound on the running time. As in Claim 24, it suffices to show that if for V = Vopt,2, Feasp,V,2 is non-empty, then there exists Xj > (x1, x2, x3, x4) such that if the algorithm returns S1, S2, S3, S4, then S = S1∪S2∪S3∪S4, Pr[Pj∈S C] ≤ p + 3ǫ and Pj∈S vj ≥ V . To show this, let Sopt ∈ Feasp,V,2. For 1 ≤ i ≤ 4, Sopt,i = Sopt ∩ Bi and Vopt,2,i = Pℓ∈Sopt,i Jℓ. Then, steps 3-6 of the algorithm return sets S1, S2, S3, S4 such that for all 1 ≤ i ≤ 4,Pℓ∈Si vℓ ≥ Vopt,2,i. We now claim that for all 1 ≤ i ≤ 4, dTV(Xℓ∈Si (5) vℓ. Let us define xi = Pℓ∈Sopt,i Jℓ = xi andPℓ∈Si Yℓ, Xℓ∈Sopt,i Yℓ) ≤ ǫ/4 Case i = 1: We apply Lemma 18 to obtain dTV(cid:18)Xℓ∈S1 Yℓ, Poi(cid:18)Xℓ∈S1 E[Yℓ](cid:19)(cid:19) ≤ max ℓ∈S1 qℓ and dTV(cid:18) Xℓ∈Sopt,1 Yℓ, Poi(cid:18) Xℓ∈Sopt,1 E[Yℓ](cid:19)(cid:19) ≤ max ℓ∈Sopt,1 qℓ As qℓ is obtained by rounding pℓ to the nearest multiple of ǫ/(4n), hence applying the definition of B1, we obtain that maxℓ∈B1 qℓ ≤ ǫ/100. Additionally, by guarantee of Pseudo-knapsack (in Step 3 of the algorithm), we havePℓ∈Sopt,1 E[Yℓ]. This implies E[Yℓ] =Pℓ∈S1 dTV( Xℓ∈Sopt,1 Yℓ,Xℓ∈S1 Yℓ) ≤ ǫ 50 , thus proving (5) for i = 1. Case i = 2: For ℓ ∈ B2, define Zℓ = 1 − Yℓ. Now, applying the same argument as i = 1, one obtains dTV(cid:18) Xℓ∈Sopt,2 Zℓ,Xℓ∈S2 Zℓ(cid:19) ≤ ǫ 50 . Furthermore, by guarantee of Pseudo-knapsack (in Step 4 of the algorithm), we have S2 = Sopt,2. Combining this with the above equation, we obtain (5) for i = 2. Case i = 3: By the guarantees of the Pseudo-knapsack (in Step 5 of the algorithm), it follows that for every j ≤ T0, qj qj ℓ . Xℓ∈S3 ℓ = Xℓ∈Sopt,3 Yℓ(cid:19) ≤ 13 · (T0 + 1) 1 4 · 2−(T0+1)/2. Using Lemma 19, it follows that dTV(cid:18) Xℓ∈Sopt,3 Yℓ,Xℓ∈S3 Plugging in T0 = 4 log(1/ǫ) and assuming ǫ is sufficiently small, we obtain (5) for i = 3. Case i = 4: For ℓ ∈ B4, define Zℓ = 1 − Yℓ. Applying the same argument as the case i = 3, we obtain Zℓ(cid:19) ≤ ǫ 50 . dTV(cid:18) Xℓ∈Sopt,4 Zℓ,Xℓ∈S4 15 ǫ 4 Yℓ(cid:19) ≤ dTV(cid:18) Xℓ∈Sopt,i and dTV(cid:18)Xℓ∈Si However, by guarantee of Pseudo-knapsack (in Step 6 of the algorithm), Sopt,4 = S4. Combining this, we obtain (5) for i = 4. This finishes the proof of (5). Next, we claim that for 1 ≤ i ≤ 4, Yℓ(cid:19) ≤ ǫ 4 Xℓ, Xℓ∈Sopt,i We will only prove the first inequality, the proof of the second one is exactly the same. For i = 1, 2, (6) follows from the fact that dTV(Xℓ, Yℓ) ≤ ǫ 4n (for i ∈ B1, B2) and Sopt,1 + Sopt,2 ≤ n. For i = 3, 4, we claim that Sopt,3,Sopt,4 ≤ 100/ǫ3. To see this, note thatPℓ∈Sopt,3 qℓ ≤ 1/ǫ2 and on the other hand, for all ℓ ∈ B3, qℓ ≥ ǫ/100. This implies Sopt,3 ≤ 100/ǫ3. The proof for Sopt,4 is analogous. However, for ℓ ∈ B3, B4, dTV(Xℓ, Yℓ) ≤ ǫ4 10 for i ∈ {3, 4}. This Xℓ(cid:19) ≤ proves (6). Combining (5) and (6), we obtain that Xℓ,Xℓ∈Si Yℓ) ≤ ǫ (6) . dTV(cid:18)Xℓ∈S Xℓ, Xℓ∈Sopt dTV(cid:18)Xℓ∈Si Xℓ,Xℓ∈Si Yℓ(cid:19) ≤ Xℓ,Pℓ∈Sopt,i Xℓ(cid:19) Yℓ(cid:19) + 4Xi=1 Yℓ(cid:19). 4Xi=1 4Xi=1 4Xi=1 1000 . Thus, dTV(Pℓ∈Sopt,i Xℓ, Xℓ∈Sopt,i Yℓ, Xℓ∈Sopt,i Xℓ, Xℓ∈Sopt,i dTV(cid:18)Xℓ∈Si dTV(cid:18)Xℓ∈Si dTV(cid:18) Xℓ∈Sopt,i Xℓ, Xℓ∈Sopt dTV(Xℓ∈S Xℓ) ≤ 3ǫ. + Applying (5) and (6), we get all the three terms on the right hand side are bounded by ǫ and thus This proves Pr[Pj∈S Xj > C] ≤ p + 3ǫ which finishes the proof. 4 Proof of Theorem 4 The proof of this theorem will be quite similar to the proof of Lemma 25. We start with the setup. For every ℓ ∈ [n], define Yℓ to be an independent A-valued random variables obtained by rounding the probabilities 4nk . Divide the interval [0, 1] into s = ⌈4ek3⌉ equal sized intervals; call in Xℓ to the nearest multiple of them I1, . . . , Is. We now define Φ : [n] → [k] × [s]k as follows: (i) Φ1(i) = arg maxj Pr[Xi = aj] (break lexicographically if there is a tie). (ii) For 1 ≤ j ≤ k, Φj+1(i) = t if Pr[Yi = aj] ∈ [(t − 1)/s, t/s]. The reason for defining the map Φ is simple: ǫ 1 • For any β ∈ [k] × [s]k and 1 ≤ j ≤ k, maxi∈Φ−1(β) s ≤ 1 4ek3 . • For any β ∈ [k] × [s]k and any subset S ⊆ Φ−1(β),Pℓ∈S Thus, this meets the first two conditions of Corollary 22. We now define w ∈ Z as w = ⌈log(16ksk/ǫ)⌉. Recall that Vk(w) was defined as Vk(w) = {v ∈ Zk : vi ≥ 0 ∧ Pi vi ≤ w}. For every α ∈ Vk(w), let Aα Pr[Xi = aj] − mini∈Φ−1(β) Pr[Xi = β1] ≥ Sk . Pr[Xi = aj] ≤ denote the set defined as: Aα =(cid:26)j · ǫkαk1 (4nk)kαk1 : j · ǫkαk1 (4nk)kαk1 ≤ n and j ∈ N(cid:27). 16 Note that the set Aα only depends on kαk1. We are naming Aα using α for notation reasons. Finally, as in Claim 24 and Claim 25, we will run the routine Pseudo-knapsack. For the routine, we define items {Jℓ}ℓ∈[n] as follows: Its "size" is given by a Vk(w)-dimensional vector indexed by elements of Vk(w). In particular, for α ∈ Vk(w), the αth coordinate, denoted by Jℓ,α is given byQk Pr[Yℓ = j]αj . Observe that crucially, for any subset S ⊆ [n],Pℓ∈S Jℓ,α ∈ Aα. Further, we define the profit of Jℓ to be vℓ. We are now ready to define the algorithm. j=1 1. Set Vmax = 0 and Smax = φ. 2. For {xβ,α ∈ Aα}β∈[k]×[s]k,α∈Vk(w), 3. Run Pseudo-knapsack with items {Jℓ}ℓ∈Φ−1(β) with target vector xβ of dimension Vk(w) and the αth coordinate is xβ,α. 4. 5. 6. The quantization list is a vector of dimension Vk(w) whose αth coordinate is Let the output of sets be Sβ. Let S = ∪βSβ. If Pr[Pℓ∈S 4 and Vmax ≤Pℓ∈S vℓ, then set Smax ← S and Vmax ← V . Xj > C] ≤ǫ/4 p + 3ǫ ǫkαk1 (4nk)kαk1 . First, we bound the running time of this algorithm. Note that the size of Aα is n · (4nk)kαk1 kαk1 ≤ w = O(log(1/ǫ) + k log k). Thus, we have that for all α ∈ Vk(w), ǫkαk1 . Further, Aα =(cid:18) nk ǫ (cid:19)O(k log k+log(1/ǫ)) . As the total size of Vk(w) ≤ wk = O(log(1/ǫ) + k · log k)k, by Theorem 34, this bounds the running time to ǫ (cid:19)O(k log k+log(1/ǫ))·(log(1/ǫ)+k·log k)k (cid:18) nk =(cid:18) nk ǫ (cid:19)O(k log k+log(1/ǫ))k+1 Recall that for V ≥ 0, we define Feasp,V as Feasp,V =(cid:8)S ⊆ [n] : Pr[Xℓ∈S Xℓ > C] ≤ p and Xℓ∈S vℓ ≥ V(cid:9). Let Vopt = max{V : Feasp,V is not empty}. To prove the correctness of the algorithm, it suffices to show that there exists a choice of {xβ,α ∈ Aα}β∈[k]×[s]k,α∈Vk(w) such that if the corresponding sets returned as {Sβ}β∈[k]×[s]k, then for S = ∪βSβ (i)Pℓ∈S vℓ ≥ V and (ii) Pr[Pℓ∈S Set V = Vopt and let Sopt ∈ Feasp,V . For β ∈ [k] × [s]k, define Sopt,β = Sopt ∩ Φ−1(β). For β ∈ [k] × [s]k and α ∈ Vk(w), we define Xℓ > C] ≤ p + ǫ/2. xβ,α = Xℓ∈Sopt,β kYj=1 Pr[Yℓ = aj]αj . Also, define Vβ = Pℓ∈Sopt,β {xβ,α}, we obtain sets {Sβ}β∈[k]×[s]k such that for all β ∈ [k] × [s]k and α ∈ Vk(w) which satisfy vℓ. Then, by guarantee of the routine Pseudo-knapsack, for this choice of xβ,α = Xℓ∈Sβ kYj=1 Pr[Yℓ = aj]αj and Sβ ⊆ Φ−1(β). 17 Further, Pℓ∈Sβ Pℓ∈Sopt,β vℓ ≥ Pℓ∈Sopt,β Yℓ to obtain that vℓ. Now, we apply Corollary 22 on the partial sums Pℓ∈Sβ dTV(Xℓ∈Sβ Yℓ) = 2−w+1 ≤ 16ksk . ǫ Yℓ and Yℓ, Xℓ∈Sopt,β Adding this inequality over all β ∈ [k] × [s]k, we get Yℓ, Xℓ∈Sopt Further, by our rounding, for all ℓ ∈ [n], dTV(Xℓ, Yℓ) ≤ ǫ Xℓ) ≤ dTV(Xℓ∈S dTV(Xℓ∈S Xℓ, Xℓ∈Sopt Yℓ) ≤ ǫ 16 . ǫ 16 + ǫ 4 < ǫ 2 . 4n . Thus, it immediately follows that This finishes the proof. 5 Proof of Theorem 7 and Theorem 9 We first start by sketching a reduction from Theorem 7 to Theorem 9. As we have said before, this reduction is quite standard and follows the usual reduction which is used to obtain a polynomial time approximation scheme for the (deterministic) knapsack problem using the pseudopolynomial time algorithm. We give the reduction here for the sake of completeness. Reduction to the case when profits are small integers Given any class of random variables D supported on non-negative reals, the next lemma (Lemma 26) gives reduction from an (ǫ, ǫ) approximation for stochastic knapsack instances of type (D, Q+) to an (ǫ, 0) ap- proximation for stochastic knapsack instance of type (D, Z+ M ) where M = poly(n/ǫ). In particular, this reduces Theorem 7 to Theorem 9. Lemma 26. Let there be an algorithm A which given a stochastic knapsack instance of type (D, ZM ) produces an (ǫ, 0) approximation running in time T (n, M, ǫ). Then, there is an algorithm which given a stochastic knapsack instance of type (D, Q+) produces an (ǫ, ǫ) approximation running in time T (n, poly(n/ǫ), ǫ). Proof. This proof follows the usual reduction from the approximation scheme for (standard) knapsack prob- lem to the pseudopolynomial time algorithm for the knapsack problem. We sketch it here for the sake of completeness. Let the knapsack instance be given by items {Ij}n j=1 with profits vj and size Xj . Let the knapsack capacity be C and the risk tolerance be p. Assume that the items are arranged so that v1 ≤ . . . ≤ vn. Let S∗ be the optimal solution i.e., S∗ ∈ Feasp and OPT =Pj∈S∗ vj = maxS∈FeaspPj∈S vj . Now, let ℓ0 be the largest index such that Pr[Xℓ0 > C] ≤ p. Then, vℓ0 ≤ OPT ≤ n · vℓ0. Clearly, for ǫvℓ0 all j > ℓ0, Xj 6∈ S∗ and thus, we can remove these items from our list. Let us define K = n and for all 1 ≤ ℓ ≤ ℓ0, define wℓ = ⌊vℓ/K⌋. Note that {wℓ}ℓ0 ℓ=1 are non-negative integers bounded by M = ⌈n/ǫ⌉. Let us define items I1, . . . , Iℓ0 where Ij = {(Xj, wj)} and run A on this instance with overflow probability p and capacity constraint C. Also for q > 0, let us define gFeasq as gFeasq = {S ⊆ [ℓ0] : Pr[Xj∈S Xj > C] ≤ q}. 18 By guarantee of the algorithm A, we output Sw ∈ gFeasp+ǫ such that wi = max wi. Xi∈Sw S∈ gFeaspXi∈ S The final output is Sw. We now verify the guarantees of this algorithm. First, since M = poly(n/ǫ), the running time of the algorithm is T (n, poly(n/ǫ), ǫ). Next, note that by definition, ^Feasp+ǫ ⊆ Feasp+ǫ for any q > 0. As a consequence, Finally, to lower bound Pi∈Sw vi, we make two observations. First is that ^Feasp = Feasp. As a conse- quence, by definition, Sw ∈ Feasp+ǫ. OPT = max vi. S∈ FeaspXi∈ S (7) (8) Let us assume that Sv achieves the optimum in the above equation. In other words,Pi∈Sv vi = OPT. Note that for every i, vi < Kwi + K. Thus, we have OPT = Xi∈Sv K · wi + K · Sv ≤ Xi∈Sv K · wi + ǫ · vℓ0. The last inequality uses that Sv ≤ n. Now, using OPT ≥ vℓ0 , we have K · wi ≥ (1 − ǫ) · OPT. (9) vi ≤ Xi∈Sv Xi∈Sv Next, we observe that since Sv ∈ gFeasp, using (7), Pi∈Sw wi ≥ Pi∈Sv wi. As a result, using (9), we get Pi∈Sw K · wi ≥ (1 − ǫ) · OPT. However, note that for every ℓ ∈ [ℓ0], vℓ ≥ wℓ · K. Thus, we get that Pi∈Sw vi ≥ (1 − ǫ) · OPT. This finishes the proof. We now turn to the proof Theorem 9. 5.1 Proof of Theorem 9 We start with some useful definitions. The important notion that we use here is the notion of critical index. This is an extension of the notion of critical index introduced by Servedio [43] which has proved to be very influential in the complexity theoretic study of Boolean functions such as halfspaces and polynomial threshold functions. Definition 27. Let X1, . . . , Xn be a set of independent (c, 2, 4)-hypercontractive random variables and (are numbered so that) µ2(X1) ≥ . . . ≥ µ2(Xn). For ǫ > 0, define the ǫ-critical index of this sequence to be the smallest 1 ≤ i ≤ n such that µ2(Xi) Pj≥i µ2(Xj) ≤ ǫ2 c4 . In case no such i exists, then we say that the ǫ-critical index of the sequence is ∞. For the rest of this section, let us define the quantity L(c, ǫ) as L(c, ǫ) = (c4/ǫ2) log(1/ǫ). Definition 28. Let {(Xi, vi)} be a stochastic knapsack instance of type (Dc, Z+ M ). For a subset S ⊆ [n] and a parameter ǫ > 0, we define its ǫ-type of S as follows: Let S = {j1, . . . , jR} and let K be the ǫ-critical index of the set {Xj1, . . . , XjR}. Let L = L(c, ǫ). If K < L, the ǫ-type is the tuple (K, j1, . . . , jK ), else it is (L, j1, . . . , jL). 19 To prove Theorem 9, it suffices to prove the following lemma. Lemma 29. There is an algorithm SK-hyper with the following guarantee: Let {(Xi, vi)}n stochastic knapsack instance of type (Dc, Z+ ǫ > 0, capacity C and a given ǫ-type B = (T, j1, . . . , jT ), define the set Feasp,B,V as Feasp,B,V =(cid:8)S ⊆ [n] :Xi∈S vi = V, ǫ-type of S is B and Pr[Xi∈S i=1 be a given M ), 1 ≤ V ≤ M · n, overflow probability p, error parameter Xi > C] ≤ p(cid:9). If Feasp,B,V is non-empty, the algorithm outputs S∗ such that S∗ ∈ Feasp+4ǫ,B,V and runs in time poly(n, M, 1/ǫ). We now see how Lemma 29 implies Theorem 9. Proof of Theorem 9: Let {(Xi, vi)}n Let Cδ be the set of all δ-types for this instance. We now describe the algorithm: i=1 be the given knapsack instance of type (Dc, Z+ M ) and let δ = ǫ/8. 1. Initialize set A to empty. B,V Xj > C] ≤2δ p + 6 · δ, add S∗ 2. For all 1 ≤ V ≤ n · M and for all B ∈ Cδ, 3. Run SK-hyper with δ-type B, error parameter δ, overflow probability p and profit V . 4. Let the output set be S∗ B,V . If Pr[Pj∈S∗ 5. Output the set S∗ defined as S∗ = arg maxS∗∈APj∈S∗ vj. First, note that for any S ∈ A, Pr[Pj∈S Xj > C] ≤ p + 8δ i.e., p + ǫ. Secondly, note if there exists Xj > C] ≤ p and Pj∈S vj = V , then there exists B ∈ C, Feasp,B,V is any set S such that Pr[Pj∈S non-empty. In that case, we know (by guarantee of SK-hyper) that there exists S∗ B,V ∈ Feasp+4δ,B,V and B,V ∈ A. Thus, if S∗ is the output of the last step of the algorithm, Pj∈S∗ vj ≥ V . Thus the output S∗ of the algorithm is an (ǫ, 0) approximation. To bound the running time, note that every element of C is of the form (T, j1, . . . , jT ) where T ≤ L(c, δ) and {j1, . . . , jT} ⊆ [n]. Thus, Cδ = nO(L(c,δ)). For each B ∈ Cδ, the running time of Steps 3, 4, 5 is bounded by poly(n, M ). This shows that the total running time is n O(c4/ǫ2) · M O(1), finishing the proof. B,V to A. First, let us set L = L(c, ǫ). We will now split the proof of Lemma 29 into two parts: (a) One where the ǫ-type is of the form (L, j1, . . . , jL) where {j1, . . . , jL} ⊆ [n]. (b) In the second case, the ǫ-type is of the form (T, j1, . . . , jT ) where T < L. Lemma 30 covers case (a) and Lemma 31 covers case (b). Lemma 30. There is an algorithm SK-hyper-large with the following guarantee: Let {(Xi, vi)}n i=1 be a stochastic knapsack instance of type (Dc, Z+ M ) with capacity C, overflow probability p, error parameter ǫ > 0, profit V and a given ǫ-type B = (T, j1, . . . , jT ) where T = L. If the set Feasp,B,V is non-empty, then B,V such thatPj∈S∗ SK-hyper-large outputs S∗ Xj > C] < p + ǫ. The running time of the algorithm is poly(n, M, 1/ǫ). Lemma 31. There is an algorithm SK-hyper-small with the following guarantee: Let {(Xi, vi)}n i=1 be a stochastic knapsack instance of type (Dc, Z+ M ) with capacity C, overflow probability p, error parameter ǫ > 0, profit V and a given ǫ-type B = (T, j1, . . . , jT ) where T < L. If the set Feasp,B,V is non-empty, then B,V such thatPj∈S∗ SK-hyper-large outputs S∗ Xj > C] < p + ǫ. The running time of the algorithm is poly(n, M, 1/ǫ). vj = V and Pr[Pj∈S∗ vj = V and Pr[Pj∈S∗ B,V B,V B,V B,V 20 5.2 Proof of Lemma 30 Recall that B = {L, j1, . . . , jL}. We first define the set Γ = {i ∈ [n] : µ2(Xi) ≤ µ2(XjL−1)}. Let us define S′ = S \ {j1, . . . , jL−1}. Note that if the ǫ-type of S is B, then S′ ⊆ Γ. Let us now define the rational number ρ to be such that n2 · ρ ǫ2 ≤ µ2(XjL−1) ≤ 2 · n2 · ρ . ǫ2 Note that we can efficiently compute such a ρ and is an integral multiple of (ǫ2/n2) · 2−3n. For ℓ ∈ Γ, we define βℓ as βℓ =(cid:22) µ2(Xℓ) ρ (cid:23)ρ. In other words, βℓ is the integral multiple of ρ which is closest to µ2(Xℓ) (and larger than µ2(Xℓ)). For every ℓ ∈ Γ, we define item Jℓ with "size" (vℓ, βℓ) and "profit" −E[Xℓ]. Also, let us define the set A = {0, ρ, . . . , 2c4·n2 · ρ}. We now describe the algorithm. ǫ4 1. Let V = V − (vj1 + . . . + vjL−1). 2. For all x ∈ A, 3. Run Pseudo-knapsack on items {Jℓ}ℓ∈Γ with target (x, V ) and quantization (ρ, 1). Let the output be S ⊆ Γ. 4. Let S = S ∪ {j1, . . . , jL−1}. If Pr[Pj∈S First of all, observe that if the algorithm outputs a set S then it clearly satisfies the requirement. Further, for every ℓ ∈ Γ, βℓ/ρ is a non-negative integer bounded by 2n2/ǫ2. Applying the guarantee of Theorem 34, the running time is bounded by poly(n, M, 1/ǫ). Thus to prove the correctness of the algorithm, it suffices to prove that if Feasp,B,V is non-empty, then there exists x ∈ A such that the output S (corresponding to x) satisfies Pr[Pj∈S Xj > C] ≤ p + ǫ/2. To prove this, let us assume that Sopt ∈ Feasp,B,V and Sopt = S \ {j1, . . . , jL−1}. Let us now define x =Pℓ∈ Sopt E[Xℓ]. Note that x is an βℓ and y = −Pℓ∈ Sopt Xj > C] ≤ǫ/4 p + 3ǫ/4, output S. integral multiple of ρ. Further, Xℓ∈ Sopt βℓ ≤ Xℓ∈ Sopt µ2(Xℓ) ≤ c4 ǫ2 · µ2(XL−1) ≤ c4 ǫ2 · 2n2 · ρ ǫ2 = 2n2 · c4 · ρ ǫ4 . Thus, x lies in the set A. By guarantee of the routine Pseudo-knapsack, the output is a set S with the following properties: E[Xℓ] ≥ −Pℓ∈ Sopt (i) S ⊆ Γ,Pℓ∈ S vℓ = V andPℓ∈ S βℓ = x. (ii) −Pℓ∈ S Let us now observe that for all ℓ ∈ Γ, µ2(Xℓ) ≤ (βℓ + ρ) and thus, Xℓ∈ S µ2(Xℓ) ≤Xℓ∈ S ǫ2 · µ2(XjL−1) +Xℓ∈ S (βℓ + ρ) ≤ βℓ ≤ E[Xℓ]. n ǫ2 · µ2(XjL−1) n + Xℓ∈ Sopt µ2(Xℓ). (10) Claim 32. The 2ǫ-type of the set S is B′ = (L, i1, . . . , iL) where for 1 ≤ k ≤ L − 1, ik = jk. 21 Proof. Let us enumerate S = {j′1, . . . , j′R} such that µ2(X ). Observe that by construc- tion, for every ℓ ∈ S, µ2(Xℓ) ≤ µ2(XL−1). Thus, j′1 = j1, j′2 = j2 . . . j′L−1 = jL−1. Next, observe that for any 1 ≤ i ≤ L − 1, ) ≥ . . . ≥ µ2(X j′ R j′ 1 µ2(X ) j′ i Pk≥i µ2(X ) j′ k = ≥ ≥ µ2(Xji) µ2(Xji) PL>k≥i µ2(Xjk ) +Pk≥L µ2(X PL>k≥i µ2(Xjk ) +Pℓ∈ Sopt PL>k≥i µ2(Xjk ) +Pℓ∈ Sopt µ2(Xji) µ2(Xℓ) + ǫ2·µ2(XjL−1 ) n µ2(Xℓ) + ǫ2·µ2(Xj ) n = ) j′ k µ2(Xji) PL>k≥i µ2(Xjk ) +Pℓ∈ S µ2(Xℓ) Here the first inequality uses (10). Now, since the ǫ-type of S is {L, j1, . . . , jL}, we have that µ2(Xji) PL>k≥i µ2(Xjk ) +Pℓ∈ Sopt µ2(Xℓ) ≥ ǫ2 c4 . This immediately implies the claim. We now state the following important proposition. Proposition 33. Let X1, . . . , Xn be a sequence of independent (c, 2, 4) hypercontractive random variables. Further, the ǫ-critical index of this sequence is at least L = L(c, ǫ) (as in Definition 28). Define another sequence of random variables such Y1, . . . , Yn such that Yi = Xi (if i < L) and Yi = E[Xi] (otherwise). Then, dcdf ( Xi, nXi=1 nXi=1 Yi) ≤ ǫ 8 . Before we see the proof of this proposition, let us first see why this implies the correctness of our algorithm. To see this, for every ℓ ∈ Γ, let us define the random variable Yℓ to be E[Xℓ] with probability 1. For ℓ 6∈ Γ, Xℓ = Yℓ. Then, applying Proposition 33 to the sequence {Xj1, . . . , XjT }, we get Likewise, if we enumerate S = {j′1, . . . , j′R} and apply Proposition 33 to the sequence {X get (11) , . . . , X j′ 1 j′ R}, we (12) dcdf ( Xℓ∈Sopt Xℓ, Xℓ∈Sopt Yℓ) ≤ ǫ 8 . Yℓ) ≤ ǫ 4 . dcdf (Xℓ∈S Xℓ,Xℓ∈S Yℓ − Xℓ∈ Sopt Finally, note that Xℓ∈S Yℓ − Xℓ∈Sopt Yℓ =Xℓ∈ S Yℓ =Xℓ∈ S E[Xℓ] − Xℓ∈ Sopt E[Xℓ] < 0. (13) The second equality uses the definition of the random variables {Yℓ} and the last inequality uses the guar- antee of Pseudo-knapsack. Now, applying (12), we get that for every t ∈ R, Pr[Pℓ∈S Xℓ > C] ≤ Pr[Pℓ∈S Yℓ > 4 . However, applying (13), this implies Pr[Pℓ∈S Xℓ > C] ≤ Pr[Pℓ∈Sopt Yℓ > C] + ǫ 22 4 . Finally, applying (11), this finally implies that Pr[Pℓ∈S Xℓ > C] = p, we obtain Xℓ > C] ≤ Pr[Pℓ∈Sopt Xℓ > C] + 3ǫ 8 . C] + ǫ As Pr[Pℓ∈Sopt Pr[Xℓ∈S Xℓ > C] ≤ p + 3ǫ 8 . This concludes the proof modulo Proposition 33 which we prove next. Proof of Proposition 33: Let us set K = 225·(c+2)4 any large constant). Define the random variable ZK =Pi≤K is arranged in decreasing order of variance. Thus, applying Lemma 13, we get that for all 1 ≤ j ≤ K, 2 (cid:19) ≤ QXj(cid:18)pµ2(Xj) Xi and let σK =pµ2(XK ). Note that {Xi} (cid:19) ≤ 1 − QXj(cid:18) σK 128(c + 2)4 . 9·ǫ2 (14) 9 2 (The choice of 225 is not crucial and can be essentially Using the above and Lemma 14 (on the variable ZK ), we get QZK (σK/2) ≤ 100σK i=1 σ2 K · qPK = 9 128(c+2)4 qK · 100 9 128(c+2)4 ǫ 16 . ≤ (15) Define ZL =Pj≤L Xj . Since L = L(c, ǫ) ≥ K, (applying Fact 12) we obtain that QZL(σK /2) ≤ Next, define the random variable Z>L as Z>L = Pj>L definition of critical index, we have ǫ 16 . Xj. Using L − K ≥ (2c4/ǫ2) · log(1/ǫ) and the By applying Chebyshev's inequality, µ2(Z>L) ≤ (1 − ǫ)L−K · σ2 Pr(cid:20)Z>L − E[Z>L ≥ K ≤ ǫ2 · σ2 K. 8 (cid:21) ≤ O(ǫ2). σK (16) σK i=1 i=1 i=1 Xi = Z>L + ZL andPn Now note thatPn sign(Pn Xi−x) 6= sign(Pn 8 (ii) ZL − x ≤ σK (cid:12)(cid:12)(cid:12)(cid:12) Pr[ nXi=1 Yi = E[Z>L] + ZL. Now, consider any x ∈ R. Then, Yi−x) only if at least one of the following happens: (i) Z>L−E[Z>L] ≥ nXi=1 Xi ≤ x] − Pr[ Yi ≤ x](cid:12)(cid:12)(cid:12)(cid:12) ≤ Pr(cid:2)Z>L − E[Z>L ≥ 8 (cid:3) + QZL(σK /2) 4 . Using (16) and (15), this implies σK i=1 ǫ 16 + O(ǫ2) ≤ ǫ 8 . ≤ 5.3 Proof of Lemma 31 The initial setup of this proof will be quite similar to the proof of Lemma 30. However, since there are some subtle differences, we repeat the setup again. Recall that B = {T, j1, . . . , jT} where T < L. We now define the set Γ = {i ∈ [n] : µ2(Xi) ≤ µ2(XT )}. Let ρ be a rational number such that n4 · ρ ǫ4 ≤ µ2(XjT ) ≤ 2n4 · ρ ǫ4 . 23 (17) Note, we can efficiently compute such a ρ which is an integral multiple of ( ǫ4 βℓ as n4 ) · 2−3n. For ℓ ∈ Γ, we define βℓ =(cid:22) µ2(Xℓ) ρ (cid:23) · ρ. In other words, we obtain βℓ by rounding (down) µ2(Xℓ) to the nearest multiple of ρ. Now, for every ℓ ∈ Γ, we define item Jℓ with "size" (vℓ, βℓ) and "profit" −E[Xℓ]. Finally, let us define the set A = {ρ · j : j ∈ N and (c4 · n4/ǫ6) − n ≤ j ≤ (2n5/ǫ4)}. With this notation, we describe the algorithm (which is the same as the algorithm in Lemma 30). 1. Let V = V − (vj1 + . . . + vjL−1). 2. For all x ∈ A, 3. Run Pseudo-knapsack on items {Jℓ}ℓ∈Γ with target (x, V ) and quantization (ρ, 1). Let the output be S ⊆ Γ. 4. Let S = S ∪ {j1, . . . , jL−1}. If Pr[Pj∈S Xj > C] ≤ǫ/4 p + 3ǫ/4, output S. As before, it is easy to see that that the running time of this procedure is bounded by poly(n, M, 1/ǫ). Further, as in Claim 24, if the algorithm outputs a set S, then it satisfies our requirement. Thus, to prove correctness of the algorithm, it suffices to show that if Feasp,B,V is non-empty, then there exists x ∈ A such that the output S (corresponding to x) satisfies Pr[Pj∈S 2 . Let us assume that Sopt ∈ Feasp,B,V and define Sopt = S \ {j1, . . . , jT−1}. Let us now define x = Pℓ∈ Sopt βℓ and y = Pℓ∈ Sopt −E[Xℓ]. Now, as µ2(XT ) ≥ µ2(Xℓ) for any ℓ ∈ Sopt, hence for all ℓ ∈ Sopt, βℓ ≤ βT . Thus, x ≤ Sopt · βT ≤ 2n5 Xℓ∈ Sopt βℓ ≥ Xℓ∈ Sopt ǫ4 . On the other hand, we have Xj > C] ≤ p + ǫ µ2(Xℓ) − n · ρ ≥ c4 · µ2(XT ) (18) − n · ρ ≥ c4 · n4 · ρ ǫ6 − n · ρ. ǫ2 The second inequality uses that T ∈ Sopt and the definition of ǫ-type. As x is trivially an integral multiple of ρ, combining with the above inequalities, we get that x ∈ A. By guarantee of the routine Pseudo- knapsack, we get that there is a output set S with the following properties: (i) S ⊆ Γ,Pℓ∈ S vℓ = V andPℓ∈ S βℓ = x. (ii) −Pℓ∈ S E[Xℓ] ≥ −Pℓ∈ Sopt E[Xℓ]. Next, we have that maxℓ∗∈ S µ2(Xℓ∗) Pℓ∈ S µ2(Xℓ) ≤ maxℓ∗∈Γ µ2(Xℓ∗ ) Pℓ∈ S βℓ ≤ 2n4·ρ ǫ4 ǫ6 − ρ · n ≤ ρ · n4·c4 3ǫ2 c4 . (19) The first inequality uses that for every ℓ, µ2(Xℓ) ≥ βℓ and S ⊆ Γ. The second inequality follows by applying (18) and (17) along with the definition of Γ. Similarly, it also follows that Let σ, σopt, µ and µopt be defined as maxℓ∗∈ Sopt Pℓ∈ Sopt µ2(Xℓ∗) µ2(Xℓ) ≤ 3ǫ2 c4 . (20) σ2 = µ2(Xℓ∈ S Xℓ), µ = E[Xℓ∈ S Xℓ], σ2 opt = µ2( Xℓ∈ Sopt Xℓ), µopt = E[ Xℓ∈ Sopt Xℓ]. 24 Applying Corollary 16 with (19) and (20), we obtain dcdf(cid:0)Xℓ∈ S Xℓ,N (µ, σ2)(cid:1) ≤ √3 · ǫ, dcdf(cid:0) Xℓ∈ Sopt Xℓ,N (µopt, σ2 opt)(cid:1) ≤ √3 · ǫ (21) Further, σ2 and σ2 opt are close in the following sense: σ2 − σ2 σ2 opt ≤ Pℓ∈ S βℓ Thus, dcdf (N (µ, σ2),N (µ, σ2 µ ≤ µopt and thus for all t ∈ R, Pr[N (µopt, σ2 we obtain that for all t ∈ R, Pℓ∈ S βℓ −Pℓ∈ Sopt ρ ·(cid:0) c4n4 √2·ǫ3 c2n1.5 . Finally, note that by guarantee of Pseudo-knapsack, we have opt) ≤ t]. Combining this with (21), βℓ + ρ · ( S + Sopt) ǫ6 − n(cid:1) ≤ 2ǫ6 c4n3 . 2ρn ≤ opt)) ≤ opt) ≤ t] ≥ Pr[N (µ, σ2 Xℓ ≤ t(cid:3) + 2√3ǫ + √2 · ǫ3 c2n1.5 Pr(cid:2)Xℓ∈ S Xℓ ≤ t(cid:3) ≤ Pr(cid:2) Xℓ∈ Sopt Adding the random variable Xj1 + . . . + XjL−1 to both sides, we get Pr(cid:2)Xℓ∈S Xℓ ≤ t(cid:3) ≤ Pr(cid:2) Xℓ∈Sopt Xℓ ≤ t(cid:3) + 2√3ǫ + √2 · ǫ3 c2n1.5 ≤ Pr(cid:2) Xℓ∈Sopt Xℓ ≤ t(cid:3) + 4ǫ. This proves the lemma. Acknowledgments The author is extremely grateful to Costis Daskalakis, Gautam Kamath, Rocco Servedio and Christos Tzamos for their contributions to this project. The author also thanks Chandra Chekuri, Vineet Goyal, Sanjeev Khanna and Jian Li for helpful email exchanges about the stochastic knapsack problem and David Morton for a very useful conversation about stochastic optimization. Finally, the author thanks Rocco Serve- dio and Aravindan Vijayaraghavan for their many helpful comments concerning the presentation. References [1] A.D. Barbour, L. Holst, and S. Janson. Poisson Approximation. Oxford University Press, New York, NY, 1992. [2] A. Ben-Tal, L. El Ghaoui, and A.S. Nemirovski. Robust Optimization. Princeton Series in Applied Mathematics. Princeton University Press, October 2009. [3] A. Ben-Tal, A. Nemirovski, and C. Roos. Robust Solutions of Uncertain Quadratic and Conic- Quadratic Problems. SIAM Journal on Optimization, 13(2):535–560, 2002. [4] A. Bhalgat, A. Goel, and S. Khanna. Improved approximation results for stochastic knapsack prob- lems. In SODA, pages 1647–1665, 2011. [5] L. Le Cam. An approximation theorem for the Poisson binomial distribution. Pacific J. Math, 10:1181– 1197, 1960. 25 [6] A. Charnes, W. W. Cooper, and Symonds G. Cost horizons and certainty equivalents: An approach to stochastic programming of heating oil. Management Science, pages 235–263, 1958. [7] C. Chekuri and S. Khanna. A polynomial time approximation scheme for the multiple knapsack prob- lem. SIAM J. Comput., 35(3):713–728, 2005. [8] C. Daskalakis, A. De, I. Diakonikolas, A. Moitra, and R. Servedio. A polynomial-time approximation scheme for fault-tolerant distributed storage. In Proceedings of the twenty-fifth annual ACM-SIAM symposium on Discrete algorithms, pages 628–644. Society for Industrial and Applied Mathematics, 2014. [9] C. Daskalakis, I. Diakonikolas, R. O'Donnell, R. A. Servedio, and L.-Y. Tan. Learning sums of in- dependent integer random variables. In 54th Annual IEEE Symposium on Foundations of Computer Science, pages 217–226, 2013. [10] C. Daskalakis, I. Diakonikolas, and R.A. Servedio. Learning Poisson Binomial Distributions. In STOC, pages 709–728, 2012. [11] C. Daskalakis, G. Kamath, and C. Tzamos. On the structure, covering, and learning of poisson multino- mial distributions. In Foundations of Computer Science (FOCS), 2015 IEEE 56th Annual Symposium on, pages 1203–1217. IEEE, 2015. [12] C. Daskalakis and C. Papadimitriou. On Oblivious PTAS's for Nash Equilibrium. In STOC, pages 75–84, 2009. [13] C. Daskalakis and C. Papadimitriou. Sparse covers for sums of indicators. Probability Theory and Related Fields, 162(3):679–705, 2015. [14] C. Daskalakis and C. H. Papadimitriou. Discretized Multinomial Distributions and Nash Equilibria in Anonymous Games. In 49th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2008, October 25-28, 2008, Philadelphia, PA, USA, pages 25–34, 2008. [15] A. De, I. Diakonikolas, V. Feldman, and R. Servedio. Nearly optimal solutions for the chow parameters problem and low-weight approximation of halfspaces. Journal of the ACM (JACM), 61(2):11, 2014. [16] B. Dean, M. Goemans, and J. Vondr´ak. Adaptivity and approximation for stochastic packing problems. In Proceedings of the sixteenth annual ACM-SIAM symposium on Discrete algorithms, pages 395–404. Society for Industrial and Applied Mathematics, 2005. [17] B. Dean, M. Goemans, and J. Vondr´ak. Approximating the stochastic knapsack problem: The benefit of adaptivity. Math. Oper. Res., 33(4):945–964, 2008. [18] I. Diakonikolas, P. Gopalan, R. Jaiswal, R. Servedio, and E. Viola. Bounded independence fools halfspaces. SIAM J. on Comput., 39(8):3441–3462, 2010. [19] W. Feller. An introduction to probability theory and its applications. John Wiley & Sons, 1968. [20] M. Garey and D. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., New York, NY, USA, 1979. [21] D.J.H. Garling. Inequalities: A journey into linear analysis. Cambridge, 2007. [22] A. Goel and P. Indyk. Stochastic Load Balancing and Related Problems. In 40th Annual Symposium on Foundations of Computer Science, FOCS '99, pages 579–586, 1999. 26 [23] P. Gopalan, R. O'Donnell, Y. Wu, and D. Zuckerman. Fooling functions of halfspaces under product distributions. In IEEE Conf. on Computational Complexity (CCC), pages 223–234, 2010. [24] V. Goyal and R. Ravi. A ptas for the chance-constrained knapsack problem with random item sizes. Operations Research Letters, 38(3):161 – 164, 2010. [25] A. Gupta, R. Krishnaswamy, M. Molinaro, and R Ravi. Approximation algorithms for correlated In 2011 IEEE 52nd Annual Symposium on Foundations of knapsacks and non-martingale bandits. Computer Science (FOCS), pages 827–836, 2011. [26] H. Kellerer, U. Pferschy, and D. Pisinger. Multidimensional Knapsack Problems, pages 235–283. Springer Berlin Heidelberg, Berlin, Heidelberg, 2004. [27] J. Kleinberg, Y. Rabani, and E. Tardos. Allocating bandwidth for bursty connections. In STOC, pages 664–673, 1997. [28] A.N. Kolmogorov. Sur les propri´et´es des fonctions de concentration de M. P. L´evy. Ann. Inst. H. Poincar´e, 16:27–34, 1958-60. [29] W. Krakowiak and J. Szulga. Hypercontraction principle and random multilinear forms. Probability Theory and Related Fields, 77(3):325–342, Mar 1988. [30] J. Li and W. Yuan. Stochastic combinatorial optimization via poisson approximation. In STOC, pages 971–980, 2013. [31] G. B. Mathews. On the Partition of Numbers. Proceedings of the London Mathematical Society, s1-28(1):486–490, 1896. [32] K. Matulef, R. O'Donnell, R. Rubinfeld, and R. Servedio. Testing halfspaces. SIAM J. on Comput., 39(5):2004–2047, 2010. [33] Raghu Meka and David Zuckerman. Pseudorandom generators for polynomial threshold functions. In Proc. 42nd Annual ACM Symposium on Theory of Computing (STOC), pages 427–436, 2010. [34] E. Mossel, R. O'Donnell, and K. K. Oleszkiewicz. Noise stability of functions with low influences: Invariance and optimality. Annals of Mathematics, 171:295–341, 2010. [35] A. Nemirovski and A. Shapiro. Convex approximations of chance constrained programs. SIAM Journal on Optimization, 17(4):969–996, 2006. [36] E. Nikolova. Strategic Algorithms. PhD thesis, Massachusetts Institute of Technology, 2009. [37] R. O'Donnell. Analysis of Boolean Functions. Cambridge University Press, New York, NY, USA, 2014. [38] A. Pr´ekopa. On probabilistic constrained programming. In Princeton Symposium on Mathematical Programming, pages 113–138, 1970. [39] A. Pr´ekopa. Stochastic Programming. Kluwer Academic Publishers, 1995. [40] B.A. Rogozin. An Estimate for Concentration Functions. Theory Probab. Appl., 6:94–97, 1961. [41] A. R ollin. Translated Poisson Approximation Using Exchangeable Pair Couplings. Annals of Applied Probability, 17(5/6):1596–1614, 2007. 27 [42] B. Roos. Binomial approximation to the Poisson binomial distribution: The Krawtchouk expansion. Theory Probab. Appl., 45:328–344, 2000. [43] R. Servedio. Every linear threshold function has a low-weight approximator. Comput. Complexity, 16(2):180–209, 2007. [44] A. Shapiro, D. Dentcheva, and A. Ruszczynski. Lectures on Stochastic Programming: Modeling and Theory, Second Edition. Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 2014. [45] P. Wolff. Hypercontractivity of simple random variables. Studia Mathematica, 3(180):219–236, 2007. A Pseudopolynomial time algorithm for multidimensional knapsack The well-known pseudopolynomial time algorithm for the (standard) multidimensional knapsack (see [26] for a reference) will be one of our principal algorithmic tools. We recall the guarantee of this algorithm below. ℓ=1 be a collection of items such that the "size of" Jℓ is xℓ = (x(1) ℓ ) ∈ R+k Theorem 34. Let {Jℓ}n and profit vℓ ∈ R. Further, the item sizes are quantized i.e., there are α = (α1, . . . , αk) such that for all 1 ≤ ℓ ≤ n and 1 ≤ j ≤ k, x(j) is an integral multiple of αj . For y = (y1, . . . , yk), define the set Ay as Ay = {S ⊆ [n] : Pi∈S(x(1) ) = (y1, . . . , yk)}. There is an algorithm Pseudo-knapsack such that given a target size (y1, . . . , yk) ∈ Rk, the algorithm outputs S∗ ⊆ [n] such that S∗ ∈ Ay and , . . . , x(k) ℓ , . . . , x(k) i ℓ i Xi∈S∗ vi = max vi. S∈AyXi∈S Assuming that (yj/αj) = Mj , the running time of the algorithm is poly(n,Qj∈k Mj). In case, no profits are specified, the algorithm simply outputs a set S ∈ A if A is non-empty. Proof sketch: The proof is quite standard and follows the usual dynamic programming formulation used to obtain a pseudopolynomial time algorithm for the standard knapsack problem. We leave the details to the interested reader. B Hypercontractivity of well-known random variables Table B lists some common (c, 2, 4) hypercontractive random variables along with the explicit values for c4. We note that while for many random variables (such as Gaussian or Laplace), the value of c is an absolute constant independent of the parameters, in other cases, the value of c depends on the parameters of the distribution (such as in the case of a Poisson). This directly affects the running time of Theorem 7 where the exponent of n is O(c4/ǫ2) if all the individual variables are (c, 2, 4) hypercontractive. The next proposition says that finitely supported distributions are (c, 2, 4) hypercontractive where c depends on the size of the smallest atom. Proposition 35. Let X be supported over R and α = minx:X(x)6=0 where c = α−1/4. X(x). Then, X is (c, 4, 2)-hypercontractive 28 Type of random variable Gaussian Poisson (λ) Exponential Laplace Uniform on [a, b] Beta(α, β) Γ(k, θ) Maxwell-Boltzmann distribution value of c4 3 3 + 1 λ 9 6 9 5 3 + 6((α−β)2(α+β+1)−αβ(α+β+2)) αβ(α+β+2)(α+β+3) 3 + 6 k 3 + 4 · 40π−96−3π2 (3π−8)2 Table 1: Some common (c, 2, 4) hypercontractive random variables Proof. Without loss of generality, X can be assumed to be centered i.e., E[X] = 0. Let y1, . . . , yT be i and the support points of X with mass β1, . . . , βT . Thus, mini∈[T ] βi = α. Thus, µ4(X) = Pi∈[T ] βiy4 µ2(X) =Pi∈[T ] βiy2 i(cid:19)2 E[X4] = Xi∈[T ] i ≤(cid:18) Xi∈[T ]pβiy2 i(cid:19)2 α ·(cid:18) Xi∈[T ] 1 mini∈[T ] βi ·(cid:18) Xi∈[T ] i . Observe that, βiy2 . βiy4 i(cid:19)2 βiy2 1 = ≤ This concludes the proof. 29
1703.08041
1
1703
2017-03-23T12:32:10
Resolving the Complexity of Some Fundamental Problems in Computational Social Choice
[ "cs.DS", "cs.AI", "cs.MA" ]
This thesis is in the area called computational social choice which is an intersection area of algorithms and social choice theory.
cs.DS
cs
Resolving the Complexity of Some Fundamental Problems in Computational Social Choice 7 1 0 2 r a M 3 2 ] S D . s c [ 1 v 1 4 0 8 0 . 3 0 7 1 : v i X r a A THESIS SUBMITTED FOR THE DEGREE OF Doctor of Philosophy IN THE Faculty of Engineering BY Palash Dey Computer Science and Automation Indian Institute of Science Bangalore – 560 012 (INDIA) August 2016 c(cid:13) Palash Dey August 2016 All rights reserved DEDICATED TO My teachers Acknowledgements I am grateful to my Ph.D. advisors Prof. Y. Narahari and Prof. Arnab Bhattacharyya for providing me a golden opportunity to work with them. I thank them for the all encompassing support they ushered upon me throughout my Ph.D. I convey my special thanks to Prof. Y. Narahari for all his academic and nonacademic supports which made my Ph.D. life very easy and enjoyable. I have throughly enjoyed working with Prof. Arnab Bhattacharyya. I convey my very special thanks to Prof. Neeldhara Misra for many excellent and successful research collaborations, useful discussions, and playing an all encompassing super-active role in my Ph.D. life. Prof. Neeldhara Misra was always my constant source of inspiration and she guided me throughout my Ph.D. as a supervisor, advisor, friend, and elder sister. I am indebted to Prof. Dilip P. Patil for teaching me how the practice of writing statements rigorously and precisely in mathematics automatically clarifies many doubts. I am extremely grateful to have a teacher like him at the very early stage of my stay in IISc who not only significantly improved my mathematical thinking process but also acted like a friend, philosopher, and guide throughout my stay in IISc. I throughly enjoyed all the courses that he taught during my stay in IISc and learned a lot from those courses. Specially his courses on linear algebra, Galois theory, commutative algebra have immensely influenced my thinking process. I thank Prof. Sunil Chandran for teaching me the art of proving results in graph theory in particular and theoretical computer science in general. I am grateful to Dr. Deeparnab Chakrabarty and Prof. Arnab Bhattacharyya for teaching me approximation algorithms and randomized algorithms, Prof. Manjunath Krishnapur for teaching me probability theory and martingales, Prof. Chandan Saha for teaching me complexity theory and algebraic geometry, Prof. Y. Narahari for teaching me game theory. I thank all the faculty members of Department of Computer Science and Automation (CSA) for all of their supports. I convey my special thank to all the staffs of CSA specially Ms. Suguna, Ms. Meenakshi, Ms. Kushael for their helping hands. I thank Prof. Ashish Goel for giving me an excellent opportunity to work with i Acknowledgements him and for hosting me in Stanford University for three months. I thank Dr. David Woodruff for collaborating with me on important problems. I feel myself extremely lucky to get such a wonderful and friendly lab members in the Game Theory lab. I want to thank all the members of the Game Theory lab with special mention to Dr. Rohith D. Vallam, Satyanath Bhat, Ganesh Ghalme, Shweta Jain, Swapnil Dhamal, Divya Padmanabhan, Dr. Pankaj Dayama, Praful Chandra, Shourya Roy, Tirumala Nathan, Debmalya Mandal, Arupratan Ray, and Arpita Biswas. I want to thank Dr. Minati De, Abhiruk Lahiri, Achintya Kundu, Aniket Basu Roy, Prabhu Chandran, Prasenjit Karmakar, R Kabaleeshwaran, Rohit Vaish, Sayantan Mukherjee, Srinivas Karthik, Suprovat Ghoshal, Vineet Nair for all the important discussions. I greatly acknowledge support from Ratul Ray and Uddipta Maity during my internship in Stanford University. I thank Google India for providing me fellowship during second and third years of my Ph.D. I acknowledge financial support from Ministry of Human Resource Development (MHRD) in India during my first year of Ph.D. Last but not the least, I express my gratitude to my parents, brother, wife, and all my friends for their love, blessing, encouragement, and support. ii Abstract In many real world situations, especially involving multiagent systems and artificial intel- ligence, participating agents often need to agree upon a common alternative even if they have differing preferences over the available alternatives. Voting is one of the tools of choice in these situations. Common and classic applications of voting in modern applications in- clude collaborative filtering and recommender systems, metasearch engines, coordination and planning among multiple automated agents etc. Agents in these applications usually have computational power at their disposal. This makes the study of computational aspects of voting crucial. This thesis is devoted to a study of computational complexity of several fundamental algorithmic and complexity-theoretic problems arising in the context of voting theory. The typical setting for our work is an "election"; an election consists of a set of voters or agents, a set of alternatives, and a voting rule. The vote of any agent can be thought of as a ranking (more precisely, a complete order) of the set of alternatives. A voting profile comprises a collection of votes of all the agents. Finally, a voting rule is a mapping that takes as input a voting profile and outputs an alternative, which is called the "winner" or "outcome" of the election. Our contributions in this thesis can be categorized into three parts and are described below. Part I: Preference Elicitation. In the first part of the thesis, we study the problem of elicit- ing the preferences of a set of voters by asking a small number of comparison queries (such as who a voter prefers between two given alternatives) for various interesting domains of preferences. We commence with considering the domain of single peaked preferences on trees in Chap- ter 3. This domain is a significant generalization of the classical well studied domain of sin- gle peaked preferences. The domain of single peaked preferences and its generalizations are iii Abstract hugely popular among political and social scientists. We show tight dependencies between query complexity of preference elicitation and various parameters of the single peaked tree, for example, number of leaves, diameter, path width, maximum degree of a node etc. We next consider preference elicitation for the domain of single crossing preference pro- files in Chapter 4. This domain has also been studied extensively by political scientists, social choice theorists, and computer scientists. We establish that the query complexity of pref- erence elicitation in this domain crucially depends on how the votes are accessed and on whether or not any single crossing ordering is a priori known. Part II: Winner Determination. In the second part of the thesis, we undertake a study of the computational complexity of several important problems related to determining winner of an election. We begin with a study of the following problem: Given an election, predict the winner of the election under some fixed voting rule by sampling as few votes as possible. We establish optimal or almost optimal bounds on the number of votes that one needs to sample for many commonly used voting rules when the margin of victory is at least εn (n is the number of voters and ε is a parameter). We next study efficient sampling based algorithms for estimating the margin of victory of a given election for many common voting rules. The margin of victory of an election is a useful measure that captures the robustness of an election outcome. The above two works are presented in Chapter 5. In Chapter 6, we design an optimal algorithm for determining the plurality winner of an election when the votes are arriving one-by-one in a streaming fashion. This resolves an intriguing question on finding heavy hitters in a stream of items, that has remained open for more than 35 years in the data stream literature. We also provide near optimal algorithms for determining the winner of a stream of votes for other popular voting rules, for example, veto, Borda, maximin etc. Voters' preferences are often partial orders instead of complete orders. This is known as the incomplete information setting in computational social choice theory. In an incomplete information setting, an extension of the winner determination problem which has been stud- ied extensively is the problem of determining possible winners. We study the kernelization complexity (under the complexity-theoretic framework of parameterized complexity) of the possible winner problem in Chapter 7. We show that there do not exist kernels of size that is polynomial in the number of alternatives for this problem for commonly used voting rules iv Abstract under a plausible complexity theoretic assumption. However, we also show that the problem of coalitional manipulation which is an important special case of the possible winner prob- lem admits a kernel whose size is polynomially bounded in the number of alternatives for common voting rules. Part III: Election Control. In the final part of the thesis, we study the computational com- plexity of various interesting aspects of strategic behavior in voting. First, we consider the impact of partial information in the context of strategic manipu- lation in Chapter 8. We show that lack of complete information makes the computational problem of manipulation intractable for many commonly used voting rules. In Chapter 9, we initiate the study of the computational problem of detecting possible instances of election manipulation. We show that detecting manipulation may be computa- tionally easy under certain scenarios even when manipulation is intractable. The computational problem of bribery is an extensively studied problem in computational social choice theory. We study computational complexity of bribery when the briber is "fru- gal" in nature. We show for many common voting rules that the bribery problem remains intractable even when the briber's behavior is restricted to be frugal, thereby strengthening the intractability results from the literature. This forms the subject of Chapter 10. v Publications based on this Thesis 1. Palash Dey, Neeldhara Misra, and Yadati Narahari. "Kernelization Complexity of Possible Winner and Coalitional Manipulation Problems in Voting". In Theoretical Computer Sci- ence, volume 616, pages 111-125, February 2016. Remark: A preliminary version of this work was presented in the 14th International Conference on Autonomous Systems and Multiagent Systems (AAMAS-15), 2015. 2. Palash Dey, Neeldhara Misra, and Yadati Narahari. "Frugal Bribery in Voting". Accepted in Theoretical Computer Science, March 2017. Remark: A preliminary version of this work was presented in the 30th AAAI Conference on Artificial Intelligence (AAAI-16), 2016. 3. Arnab Bhattacharyya, Palash Dey, and David P. Woodruff. "An Optimal Algorithm for ℓ1- Heavy Hitters in Insertion Streams and Related Problems". Proceedings of the 35th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems (PODS-16), pages 385-400, San Francisco, USA, 26 June - 1 July, 2016. 4. Palash Dey and Neeldhara Misra. "Elicitation for Preferences Single Peaked on Trees". Proceedings of the 25th International Joint Conference on Artificial Intelligence (IJCAI- 16), pages 215-221, New York, USA, 9-15 July, 2016. 5. Palash Dey and Neeldhara Misra. "Preference Elicitation For Single Crossing Domain". Proceedings of the 25th International Joint Conference on Artificial Intelligence (IJCAI- 16), pages 222-228, New York, USA, 9-15 July, 2016. 6. Palash Dey, Neeldhara Misra, and Yadati Narahari. "Complexity of Manipulation with Partial Information in Voting". Proceedings of the 25th International Joint Conference on Artificial Intelligence (IJCAI-16), pages 229-235, New York, USA, 9-15 July, 2016. vii Publications based on this Thesis 7. Palash Dey, Neeldhara Misra, and Yadati Narahari. "Frugal Bribery in Voting". Pro- ceedings of the 30th AAAI Conference on Artificial Intelligence (AAAI-16), vol. 4, pages 2466-2672, Phoenix, Arizona, USA, 2016. 8. Palash Dey and Yadati Narahari. "Estimating the Margin of Victory of Elections using Sam- pling". Proceedings of the 24th International Joint Conference on Artificial Intelligence (IJCAI-15), pages 1120-1126, Buenos Aires, Argentina, 2015. 9. Palash Dey and Arnab Bhattacharyya. "Sample Complexity for Winner Prediction in Elec- tions". Proceedings of the 14th International Conference on Autonomous Systems and Multiagent Systems (AAMAS-15), pages 1421-1430, Istanbul, Turkey, 2015. 10. Palash Dey, Neeldhara Misra, and Yadati Narahari. "Detecting Possible Manipulators in Elections". Proceedings of the 14th International Conference on Autonomous Systems and Multiagent Systems(AAMAS-15), pages 1441-1450, Istanbul, Turkey, 2015. 11. Palash Dey, Neeldhara Misra, and Yadati Narahari "Kernelization Complexity of Possible Winner and Coalitional Manipulation Problems in Voting". Proceedings of the 14th Inter- national Conference on Autonomous Systems and Multiagent Systems (AAMAS-15), pages 87-96, Istanbul, Turkey, 2015. viii Contents Acknowledgements Abstract Publications based on this Thesis Contents List of Figures List of Tables 1 Introduction 1.1 Important Aspects of Voting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Applications and Challenges of Voting Theory Relevant to Computer Science . 1.3 Thesis Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.1 Part I: Preference Elicitation . . . . . . . . . . . . . . . . . . . . . . . . 1.3.2 Part II: Winner Determination . . . . . . . . . . . . . . . . . . . . . . . 1.3.3 Part III: Election Control . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Background 2.1 Voting and Elections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Basic Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.2 Axioms of Voting Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.3 Majority Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.4 Condorcet Paradox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.5 Incomplete Information Setting . . . . . . . . . . . . . . . . . . . . . . ix i iii vii ix xv xvi 1 2 4 5 5 7 9 13 13 13 14 16 16 16 CONTENTS 2.1.6 Voting Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Computational Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.1 Parameterized Complexity . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.2 Approximation Factor of an Algorithm . . . . . . . . . . . . . . . . . . 2.2.3 Communication Complexity . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Probability Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 Statistical Distance Measures . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 Concentration Inequalities of Probability . . . . . . . . . . . . . . . . . 2.4 Information Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5 Relevant Terminology for Trees . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6 Universal Family of Hash Functions . . . . . . . . . . . . . . . . . . . . . . . . I Preference Elicitation 3 Preference Elicitation for Single Peaked Profiles on Trees 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1 Our Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.2 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Domain of Single Peaked Profiles on Trees . . . . . . . . . . . . . . . . . . . . 3.3 Problem Definitions and Known Results . . . . . . . . . . . . . . . . . . . . . 3.4 Results for Preference Elicitation . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.1 Algorithmic Results for PREFERENCE ELICITATION . . . . . . . . . . . . 3.4.2 Lower Bounds for PREFERENCE ELICITATION . . . . . . . . . . . . . . . 3.5 Results for Weak Condorcet Winner . . . . . . . . . . . . . . . . . . . . . . . . 3.5.1 Algorithmic Results for Weak Condorcet Winner . . . . . . . . . . . . . 3.5.2 Lower Bounds for Weak Condorcet Winner . . . . . . . . . . . . . . . . 3.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Preference Elicitation for Single Crossing Profiles 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.1 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.2 Single Crossing Domain . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.3 Single Crossing Width . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.4 Our Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x 17 18 18 20 20 20 20 21 22 23 25 27 29 30 32 35 36 36 37 40 41 45 45 47 49 51 51 52 53 53 53 CONTENTS 4.2 Problem Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 Model of Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Results for Preference Elicitation . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.1 Known Single Crossing Order . . . . . . . . . . . . . . . . . . . . . . . 4.3.2 Unknown Single Crossing Order . . . . . . . . . . . . . . . . . . . . . 4.3.3 Single Crossing Width . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4 Results for Condorcet Winner . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . II Winner Determination 5 Winner Prediction and Margin of Victory Estimation 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.1 Our Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.1.1 Winner Prediction . . . . . . . . . . . . . . . . . . . . . . . . 5.1.1.2 Estimating Margin of Victory . . . . . . . . . . . . . . . . . . 5.1.2 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Results for Winner Prediction . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.1 Results on Lower Bounds . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.2 Results on Upper Bounds . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.2.1 Approval Voting Rule . . . . . . . . . . . . . . . . . . . . . . 5.2.2.2 Scoring Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.2.3 Maximin Voting Rule . . . . . . . . . . . . . . . . . . . . . . 5.2.2.4 Copeland Voting Rule . . . . . . . . . . . . . . . . . . . . . . 5.2.2.5 Bucklin Voting Rule . . . . . . . . . . . . . . . . . . . . . . . 5.2.2.6 Plurality with Runoff Voting Rule . . . . . . . . . . . . . . . . 5.2.2.7 STV Voting Rule . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Results for Estimating Margin of Victory . . . . . . . . . . . . . . . . . . . . . 5.3.1 Results on Lower Bounds . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.2 Results on Upper Bounds . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.2.1 Scoring Rules and Approval Voting Rule . . . . . . . . . . . . 54 55 56 56 62 66 67 68 69 71 72 74 74 77 78 80 80 84 85 86 90 91 92 93 95 97 97 98 98 5.3.2.2 Bucklin Voting Rule . . . . . . . . . . . . . . . . . . . . . . . 102 5.3.2.3 Maximin Voting Rule . . . . . . . . . . . . . . . . . . . . . . 104 xi CONTENTS 5.3.2.4 Copelandα Voting Rule . . . . . . . . . . . . . . . . . . . . . 104 5.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 6 Streaming Algorithms for Winner Determination 108 6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 6.1.1 Our Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 6.1.2 Motivation for Variants of Heavy Hitters . . . . . . . . . . . . . . . . . 114 6.2 Problem Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 6.3 Our Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 6.3.1 List Heavy Hitters Problem . . . . . . . . . . . . . . . . . . . . . . . . 119 6.3.1.1 A Simpler, Near-Optimal Algorithm . . . . . . . . . . . . . . . 119 6.3.1.2 An Optimal Algorithm . . . . . . . . . . . . . . . . . . . . . . 122 6.3.2 ε-Maximum Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 6.3.3 ε-Minimum Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 6.3.4 Problems for the Borda and Maximin Voting Rules . . . . . . . . . . . 132 6.3.5 Algorithms with Unknown Stream Length . . . . . . . . . . . . . . . . 133 6.4 Results on Space Complexity Lower Bounds . . . . . . . . . . . . . . . . . . . 135 6.4.1 Communication Complexity . . . . . . . . . . . . . . . . . . . . . . . . 135 6.4.2 Reductions from Problems in Communication Complexity . . . . . . . 137 6.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 7 Kernelization for Possible Winner and Coalitional Manipulation 142 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 7.1.1 Our Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 7.2 Problem Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 7.3 Kernelization Hardness of the Possible Winner Problem . . . . . . . . . . . . . 146 7.3.1 Results for the Scoring Rules . . . . . . . . . . . . . . . . . . . . . . . 146 7.3.2 Results for the Maximin Voting Rule . . . . . . . . . . . . . . . . . . . 149 7.3.3 Results for the Copeland Voting Rule . . . . . . . . . . . . . . . . . . . 154 7.3.4 Results for the Bucklin Voting Rule . . . . . . . . . . . . . . . . . . . . 157 7.3.5 Results for the Ranked Pairs Voting Rule . . . . . . . . . . . . . . . . . 160 7.4 Polynomial Kernels for the Coalitional Manipulation Problem . . . . . . . . . 162 7.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 xii III Election Control 8 Manipulation with Partial Votes CONTENTS 166 168 8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 8.1.1 Motivation and Problem Formulation . . . . . . . . . . . . . . . . . . . 170 8.1.2 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 8.1.3 Our Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 8.1.4 Problem Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 8.1.5 Comparison with Possible Winner and Coalitional Manipulation Problems176 8.2 Hardness Results for WEAK MANIPULATION, OPPORTUNISTIC MANIPULATION, and STRONG MANIPULATION Problems . . . . . . . . . . . . . . . . . . . . . . 178 8.2.1 Weak Manipulation Problem . . . . . . . . . . . . . . . . . . . . . . . . 178 8.2.1.1 Result for the k-Approval Voting Rule . . . . . . . . . . . . . 179 8.2.1.2 Result for the k-Veto Voting Rule . . . . . . . . . . . . . . . . 180 8.2.1.3 Result for the Bucklin Voting Rule . . . . . . . . . . . . . . . 182 8.2.2 Strong Manipulation Problem . . . . . . . . . . . . . . . . . . . . . . . 184 8.2.3 Opportunistic Manipulation Problem . . . . . . . . . . . . . . . . . . . 186 8.2.3.1 Result for the k-Approval Voting Rule . . . . . . . . . . . . . 186 8.2.3.2 Result for the k-Veto Voting Rule . . . . . . . . . . . . . . . . 188 8.2.3.3 Result for the Borda Voting Rule . . . . . . . . . . . . . . . . 190 8.2.3.4 Result for the Maximin Voting Rule . . . . . . . . . . . . . . . 192 8.2.3.5 Result for the Copelandα Voting Rule . . . . . . . . . . . . . 194 8.2.3.6 Result for the Bucklin Voting Rule . . . . . . . . . . . . . . . 196 8.3 Polynomial Time Algorithms for WEAK MANIPULATION, STRONG MANIPULA- TION, and OPPORTUNISTIC MANIPULATION Problems . . . . . . . . . . . . . . . 199 8.3.1 Weak Manipulation Problem . . . . . . . . . . . . . . . . . . . . . . . . 199 8.3.2 Strong Manipulation Problem . . . . . . . . . . . . . . . . . . . . . . . 199 8.3.3 Opportunistic Manipulation Problem . . . . . . . . . . . . . . . . . . . 204 8.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 9 Manipulation Detection 206 9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 9.1.1 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 9.1.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 xiii CONTENTS 9.1.3 Our Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 9.2 Problem Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 9.2.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 9.3 Results for the CPMW, CPM, CPMSW, and CPMS Problems . . . . . . . . . . . 214 9.3.1 Scoring Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 9.3.2 Maximin Voting Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 9.3.3 Bucklin Voting Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 9.3.4 STV Voting Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 9.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 10 Frugal Bribery 226 10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 10.1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 10.1.2 Our Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 10.1.3 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 10.2 Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 10.3 Results for Unweighted Elections . . . . . . . . . . . . . . . . . . . . . . . . . 235 10.4 Results for Weighted Elections . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 10.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 11 Summary and Future Directions 251 11.1 Summary of Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 11.1.1 Part I: Preference Elicitation . . . . . . . . . . . . . . . . . . . . . . . . 251 11.1.2 Part II: Winner Determination . . . . . . . . . . . . . . . . . . . . . . . 252 11.1.3 Part III: Election Control . . . . . . . . . . . . . . . . . . . . . . . . . . 252 11.2 Future Directions of Research . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 References 257 xiv List of Figures 1.1 Structural overview of this dissertation . . . . . . . . . . . . . . . . . . . . . . 6 2.1 Condorcet paradox. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.2 Depicting classes of trees: (a) a path, (b) a star, (c) a (balanced) subdivision of a star, (d) a caterpillar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 8.1 An example of a partial profile. Consider the plurality voting rule with one manipulator. If the favorite candidate is A, then the manipulator simply has to place A on the top his vote to make A win in any extension. If the favorite candidate is B, there is no vote that makes B win in any extension. Finally, if the favorite candidate is C, then with a vote that places C on top, the manipulator can make C win in the only viable extension (Extension 2). . . . . . . . . . . . 172 xv List of Tables 1.1 Example of an election. Chocolate is the winner if the plurality voting rule is used. Kulfi is the winner if the Borda voting rule is used. Butterscotch is the Condorcet winner. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3.1 Summary of query complexity bounds for eliciting preferences which are single peaked on trees. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.1 Summary of Results for preference elicitation for single crossing profiles. . . . 54 5.1 Sample complexity of the (ε, δ)-WINNER DETERMINATION problem for common voting rules. †–The lower bound of Ω((ln m/ε2) (1 − δ)) also applies to any vot- ing rule that is Condorcet consistent. ∗– The lower bound of (1/4ε2) ln(1/8e√πδ) holds for any voting rule that reduces to the plurality voting rule for elections with two candidates. §– The lower bound holds for k 6 .999m. . . . . . . . . 76 5.2 Sample complexity for the (c, ε, δ)–MARGIN OF VICTORY problem for common voting rules. †The result holds for any c ∈ [0, 1). . . . . . . . . . . . . . . . . . 6.1 The bounds hold for constant success probability algorithms and for n sufficiently 78 large in terms of ε. For the (ε, φ)-Heavy Hitters problem and the ε-Maximum prob- lem, we also achieve O(1) update time and reporting time which is linear in the size of the output. The upper bound for ε-Borda (resp. ε-Maximin) is for returning ev- ery item's Borda score (resp. Maximin score) up to an additive εmn (resp. additive εm), while the lower bound for ε-Borda (resp. ε-Maximin) is for returning only the approximate Borda score (resp. Maximin score) of an approximate maximum. . . . . 112 xvi LIST OF TABLES 8.1 Summary of Results (ℓ denotes the number of manipulators). The results in white follow immediately from the literature (Observation 8.1 to 8.3). Our results for the Copelandα voting rule hold for every rational α ∈ [0, 1] \ {0.5} for the WEAK MANIPULATION problem and for every α ∈ [0, 1] for the OPPOR- TUNISTIC MANIPULATION and STRONG MANIPULATION problems. . . . . . . . . 175 8.2 DP∪Q∪v(z, ·) and DP∪Q∪v(c, ·) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 9.1 Results for CPM and CPMW (k denotes coalition size). The '?' mark means that the problem is open. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 10.1 ⋆- The result holds for k > 5. •- The result holds for k > 3. †- The result holds for a much wider class of scoring rules. ⋄- The results do not hold for the plurality voting rule. ?- The problem is open. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 xvii Chapter 1 Introduction In this chapter, we provide an informal introduction to the area called social choice theory and motivate its computational aspects. We then provide an overview of the thesis along with further motivations for the problems we study in this thesis. People always have different opinions on almost everything and hence they often have to come to a decision collectively on things that affect all of them. There are various ways for people with different opinions to come to a decision and the use of voting is the most natural and common method for this task. Indeed, the use of voting can be traced back to Socrates (470-399 BC) who was sentenced to death by taking a majority vote. We also see the mention of voting rules in Plato's (424-348 BC) unfinished book "Laws". Then, in the Middle Ages, the Catalan philosopher, poet, and missionary Ramon Llull (1232-1316) mentioned Llull voting in his manuscripts Ars notandi, Ars eleccionis, and Alia ars eleccionis, which were lost until 2001. The German philosopher, theologian, jurist, and astronomer Nicholas of Cusa (1401-1464) suggested the method for electing the Holy Roman Emperor in 1433. The first systematic study of the theory of voting was carried out by two French mathematicians, political scientists, and philosophers Marie Jean Antoine Nicolas de Caritat, marquis de Condorcet (1743-1794) and Jean-Charles, chevalier de Borda (1733-1799). A more involved study of voting was pioneered by Kenneth Arrow (a co-recipient of the Nobel Memorial Prize in Economics in 1972). The celebrated Arrow's impossibility theorem in 1951 along with Gibbard-Satterthwaite's impossibility theorem in 1973 and 1977 laid the foundation stone of modern voting theory. 1 1.1 Important Aspects of Voting In a typical setting for voting, we have a set of alternatives or candidates, a set of agents called voters each of whom has an ordinal preference called votes over the candidates, and a voting rule which chooses one or a set of candidates as winner(s). We call a set of voters along with their preferences over a set of candidates and a voting rule an election. In Table 1.1 we exhibit an election with a set of voters {Satya, Shweta, Swapnil, Divya, Ganesh} and a set of five ice cream flavors {Chocolate, Butterscotch, Pesta, Vanilla, Kulfi} as a set of candidates. Suppose we use the plurality voting rule which chooses the candidate that is placed at the first positions of the votes most often as winner. Then the winner of the plurality election in Table 1.1 is Chocolate. Plurality voting rule is among the simplest voting rules and only observes the first position of every vote to determine the winner. Mainly due to its simplicity, the plurality voting rule frequently finds its applications in voting scenarios where human beings are involved, for example, political elections. Indeed many countries including India, Singapore, United Kingdom, Canada use plurality voting at various levels of elections [plu]. Voters Preferences Chocolate ≻ Kulfi ≻ Butterscotch ≻ Vanilla ≻ Pesta Satya Shweta Butterscotch ≻ Kulfi ≻ Chocolate ≻ Vanilla ≻ Pesta Swapnil Pesta ≻ Butterscotch ≻ Kulfi ≻ Vanilla ≻ Chocolate Chocolate ≻ Vanilla ≻ Kulfi ≻ Pesta ≻ Butterscotch Divya Ganesh Kulfi ≻ Butterscotch ≻ Chocolate ≻ Vanilla ≻ Pesta Table 1.1: Example of an election. Chocolate is the winner if the plurality voting rule is used. Kulfi is the winner if the Borda voting rule is used. Butterscotch is the Condorcet winner. However, there are more sophisticated voting rules which takes into account the entire preference ordering of the voters to choose a winner. One such voting rule which finds its widespread use specially in sports and elections in many educational institutions is the Borda voting rule [bor]. The Borda voting rule, first proposed by Jean-Charles, chevalier de Borda in 1770, gives a candidate a score equal to the number of other candidates it is preferred over for every vote. In Table 1.1 for example, the candidate Kulfi receives a score of 3 from Satya, 3 from Shweta, 2 from Swapnil, 2 from Divya, and 4 from Ganesh. Hence the Borda score of Kulfi is 14. It can be verified that the Borda score of every other candidate is less than 14 2 which makes Kulfi the Borda winner of the election. We can already observe how two widely used and intuitively appealing voting rules select two different winners for the same set of votes. A closer inspection of Table 1.1 reveals something peculiar about what the plurality and Borda voting rules choose as winners. The plurality voting rule chooses Chocolate as the winner whereas a majority (three out of five) of the voters prefer Butterscotch over Choco- late. The same phenomenon is true for the Borda winner (Kulfi) too - a majority of the voters prefer Butterscotch over Kulfi. More importantly Butterscotch is preferred over every other alternative (ice cream flavors) by a majority of the voters. Such an alternative, if it exists, which is preferred over every other alternative by a majority of the voters, is called the Condorcet winner of the election, named after the French mathematician and philosopher Marie Jean Antoine Nicolas de Caritat, marquis de Condorcet. We provide a more detailed discussion to all these aspects of voting including others in Chapter 2. Now let us again consider the example in Table 1.1. Suppose Shweta misreports her pref- erence as "Butterscotch ≻ Pesta ≻ Chocolate ≻ Vanilla ≻ Kulfi." Observe that the misreported vote of Shweta when tallied with the other votes makes Butterscotch the Borda winner with a Borda score of 12. Moreover, misreporting her preference results in an outcome (that is Butterscotch) which Shweta prefers over the honest one (that is Kulfi). This example demon- strate a fundamental notion in voting theory called manipulation - there can be instances where an individual voter may have an outcome by misreporting her preference which she prefers over the outcome of honest voting (according to her preference). Obviously manipu- lation is undesirable since it leads to suboptimal societal outcome. Hence one would like to use voting rules that do not create such possibilities of manipulation. Such voting rules are called strategy-proof voting rules. When we have only two candidates, it is known that the majority voting rule, which selects the majority candidate (breaking ties arbitrarily) as the winner, is a strategy-proof voting rule. There exist strategy-proof voting rules even if we have more than two candidates. For example, consider the voting rule fv that always outputs the candidate which is preferred most by some fixed voter say v. Obviously fv is strategy-proof since any voter other than v cannot manipulate simply because they can never change the outcome of the election and the winner is already the most preferred candidate of v. How- ever, voting rules like fv are undesirable intuitively because it is not performing the basic job of voting which is aggregating preferences of all the voters. The voting rule fv is called a dictatorship since it always selects the candidate preferred most by some fixed voter v; such 3 a voter v is called a dictator. Hence an important question to ask is the following: do there exist voting rules other than dictatorship that are strategy-proof with more than two candi- dates? Unfortunately classical results in social choice theory by Gibbard and Satterthwaite prove that there does not exist any such onto voting rule [Gib73, Sat75] if we have more than two candidates. A voting rule is onto if every candidate is selected for some set of votes. We formally introduce all these fundamental aspects of voting including others in Chapter 2. 1.2 Applications and Challenges of Voting Theory Relevant to Computer Science With rapid improvement of computational power, the theory of voting found its applications not only in decision making among human beings but also in aggregating opinions of com- putational agents. Indeed, voting is commonly used whenever any system with multiple autonomous agents wish to take a common decision. Common and classic applications of voting in multiagent systems in particular and artificial intelligence in general include collab- orative filtering and recommender systems [PHG00], planning among multiple automated agents [ER93], metasearch engines [DKNS01], spam detection [CSS99], computational bi- ology [JSA08], winner determination in sports competitions [BBN14], similarity search and classification of high dimensional data [FKS03]. The extensive use of voting by computa- tional agents makes the study of computational aspects of voting extremely important. In many applications of voting in artificial intelligence, one often has a huge number of vot- ers and candidates. For example, voting has been applied in the design of metasearch en- gines [DKNS01] where the number of alternatives the agents are voting for is in the order of trillions if not more - the alternatives are the set of web pages in this case. In a commer- cial recommender system, for example Amazon.com, we often have a few hundred millions of users and items. In these applications, we need computationally efficient algorithms for quickly finding a winner of an election with so many candidates and voters. Moreover, the very fact that the agents now have computational power at their disposal allows them to easily strategize their behavior instead of acting truthfully. For example, the problem of manipulation is much more severe in the presence of computational agents since the voters can easily use their computational power to find a manipulative vote. The field known as computational social choice theory (COMSOC) studies various computational aspects 4 in the context of voting. We refer the interested readers to a recent book on computational social choice theory for a more elaborate exposition [MBC+16]. Other than practical applications, the theory of voting turns out to be crucial in proving various fundamental theoretical results in computer science. Indeed, a notion known as noise stability of majority voting has been beautifully utilized for proving a lower bound on the quality of any polynomial time computable approximate solution of the maximum cut problem in a undirected graph [KKMO07, MOO05]. We refer interested reader to [O'D14] for a more detailed discussion. 1.3 Thesis Overview In this thesis, we resolve computational questions of several fundamental problems arising in the context of voting theory. We provide a schematic diagram of the contribution of the thesis in Figure 1.1. We begin our study with the first step in any election system – eliciting the preferences of the voters. We consider the problem of preference elicitation in the first part of the thesis and develop (often) optimal algorithms for learning the preferences of a set of voters. In the second part of the thesis, we develop (often) optimal sublinear time algorithms for finding the winner of an election. The problem of determining winner of an election is arguably the most fundamental problem that comes to our mind once the preferences of all the voters have been elicited. In the third part of the thesis, we exhibit complexity-theoretic results for various strategic aspects of voting. 1.3.1 Part I: Preference Elicitation The first step in any election system is to receive preferences of the voters as input. However, it may often be impractical to simply ask the voters for their preferences due to the presence of a huge number of alternatives. For example, asking users of Amazon.com to provide a complete ranking of all the items does not make sense. In such scenarios, one convenient way to know these agents' preferences is to ask the agents to compare (a manageable number of) pairs of items. However, due to the existence of a strong query complexity lower bound (from sorting), we can hope to reduce the burden of eliciting preference from the agents only by assuming additional structure on the preferences. Indeed, in several application scenarios commonly considered, it is rare that preferences are entirely arbitrary, demonstrating no 5 Computational Voting Theory Preference Elicitation Winner Determination (Chapters 3, 4) (Chapters 5, 6, 7) Election Control (Chapters 8, 9, 10) Summary (Chapter 11) Figure 1.1: Structural overview of this dissertation patterns whatsoever. For example, the notion of single peaked preferences forms the basis of several studies in the analytical political sciences. Intuitively, preferences of a set of agents is single peaked if the alternatives and the agents can be arranged in a linear order and the preferences "respect" this order. We defer the formal definition of single peaked profiles to Chapter 3. We show in Chapter 3 and 4 that the query complexity for preference elicitation can be reduced substantially by assuming practically appealing restrictions on the domain of the preferences. Chapter 3: Preference Elicitation for Single Peaked Preferences on Trees Suppose we have n agents and m alternatives. Then it is known that if the preferences are single peaked, then elicitation can be done using Θ(mn) comparisons [Con09]. The notion of single peaked preferences has been generalized to single peaked preferences in a tree - intuitively, the preferences should be single peaked on every path of the tree. We show that if the single peaked tree has ℓ leaves, then elicitation can be done using Θ(mn log ℓ) comparisons [DM16a]. We also show that other natural parameters of the single peaked tree, for example, its diameter, path width, minimum degree, maximum degree do not decide the query complexity for preference elicitation. 6 Chapter 4: Preference Elicitation for Single Crossing Preferences Another well studied domain is the domain of single crossing profiles. Intuitively, a set of preferences is single crossing if the preferences can be arranged in a linear order such that all the preferences who prefer an alternative x over another alternative y are consecutive, for every x and y. We consider in [DM16b] two distinct scenarios: when an ordering of the voters with respect to which the profile is single crossing is known a priori versus when it is unknown. We also consider two different access models: when the votes can be accessed at random, as opposed to when they arise in any arbitrary sequence. In the sequential access model, we distinguish two cases when the ordering is known: the first is that the sequence in which the votes appear is also a single-crossing order, versus when it is not. The main contribution of our work is to provide polynomial time algorithms with low query complexity for preference elicitation in all the above six cases. Further, we show that the query complexities of our algorithms are optimal up to constant factor for all but one of the above six cases. 1.3.2 Part II: Winner Determination Once we have elicited the preferences of the voters, the next important task in an election is to determine the winner of this election. We show interesting complexity theoretic results on determining the winner of an election under a variety of application scenarios. Chapter 5: Winner Prediction We begin by studying the following problem: Given an election, predict the winner of the election under some fixed voting rule by sampling as few preferences as possible. Our results show that the winner of an election can be determined (with high probability) by observing only a few preferences that are picked uniformly at random from the set of preferences. We show this result for many common voting rules when the margin of victory is at least εn [DB15], where n is the number of voters and ε is a parameter. The margin of victory of an election is the smallest number of preferences that must be modified to change the winner of an election. We also establish optimality (in terms of the number of preferences our algorithms sample) of most of our algorithms by proving tight lower bounds on the sample complexity of this problem. Another important aspect of an election is the robustness of the election outcome. A popular measure of robustness of an election outcome is its margin of victory. We develop 7 efficient sampling based algorithms for estimating the margin of victory of a given election for many common voting rules [DN15b]. We also show optimality of our algorithms for most of the cases under appealing practical scenarios. Chapter 6: Winner Determination in Streaming An important, realistic model of data in big data research is the streaming model. In the setting that we consider, the algorithms are allowed only one pass over the data. We give the first optimal bounds for returning the ℓ1-heavy hitters in an insertion only data stream, together with their approximate frequencies, thus settling a long line of work on this problem. For a stream of m items in {1, 2, . . . , n} and parameters 0 < ε < φ 6 1, let fi denote the frequency of item i, i.e., the number of times item i occurs in the stream in [BDW16]. With arbitrarily large constant probability, our algorithm returns all items i for which fi > φm, returns no items j for which fj 6 (φ − ε)m, and returns approximations fi with fi − fi 6 εm for each item i that it returns. Our algorithm uses O(ε−1 log φ−1 + φ−1 log n + log log m) bits of space, processes each stream update in O(1) worst-case time, and can report its output in time linear in the output size. We also prove a lower bound, which implies that our algorithm is optimal up to a constant factor in its space complexity. A modification of our algorithm can be used to estimate the maximum frequency up to an additive εm error in the above amount of space, resolving an open question on algorithms for data streams for the case of ℓ1-heavy hitters. We also introduce several variants of the heavy hitters and maximum frequency problems, inspired by rank aggregation and voting schemes, and show how our techniques can be applied in such settings. Unlike the traditional heavy hitters problem, some of these variants look at comparisons between items rather than numerical values to determine the frequency of an item. Chapter 7: Kernelization Complexity for Determining Possible Winners Voters' preferences are often partial orders instead of complete orders. This is known as the incomplete information setting in computational social choice theory. In an incomplete infor- mation setting, an extension of the winner determination problem which has been studied extensively is the problem of determining possible winners. An alternative x is a possible winner in a set of incomplete preferences if there exists a completion of these incomplete preferences where the alternative x wins. Previous work has provided, for many common 8 voting rules, fixed parameter tractable algorithms for the Possible winner problem, with num- ber of candidates as the parameter. However, the corresponding kernelization question is still open, and in fact, has been mentioned as a key research challenge [BCF+14a]. In this work, we settle this open question for many common voting rules. We show in [DMN15b, DMN16c] that the Possible winner problem for maximin, Copeland, Bucklin, ranked pairs, and a class of scoring rules that includes the Borda voting rule do not admit a polynomial kernel with the number of candidates as the parameter. We show however that the Coalitional manipulation problem which is an important special case of the Possible winner problem does admit a polynomial kernel for maximin, Copeland, ranked pairs, and a class of scoring rules that includes the Borda voting rule, when the number of manipulators is polynomial in the number of candidates. A significant conclusion of this work is that the Possible winner problem is computationally harder than the Coalitional manipulation problem since the Coalitional manipulation problem admits a polynomial kernel whereas the Possible winner problem does not admit a polynomial kernel. 1.3.3 Part III: Election Control When agents in a multiagent system have conflicting goals, they can behave strategically to make the system produce an outcome that they favor. For example, in the context of vot- ing, there can be instances where an agent, by misreporting her preference, can cause the election to result in an alternative which she prefers more than the alternative that would have been the outcome in case she had reported her preference truthfully. This phenomenon is called manipulation. Certainly, we would like to design systems that are robust to such manipulation. Unfortunately, classical results in social choice theory establish that any rea- sonable voting rule will inevitably create such opportunities for manipulation. In this context, computer scientists provide some hope by showing that the computational problem of manip- ulation can often be intractable. Indeed, if a computationally bounded agent has to solve an intractable problem to manipulate the election system, then the agent would, in all likelihood, fail to manipulate. Chapter 8: Manipulation with Partial Information The computational problem of manipulation has classically been studied in a complete in- formation setting – the manipulators know the preference of every other voter. We extend 9 this line of work to the more practical, incomplete information setting where agents have only a partial knowledge about the preferences of other voters [DMN16a]. In our frame- work, the manipulators know a partial order for each voter that is consistent with the true preference of that voter. We say that an extension of a partial order is viable if there exists a manipulative vote for that extension. We propose the following notions of manipulation when manipulators have incomplete information about the votes of other voters. 1. WEAK MANIPULATION: the manipulators seek to vote in a way that makes their preferred candidate win in at least one extension of the partial votes of the non-manipulators. 2. OPPORTUNISTIC MANIPULATION: the manipulators seek to vote in a way that makes their preferred candidate win in every viable extension of the partial votes of the non- manipulators. 3. STRONG MANIPULATION: the manipulators seek to vote in a way that makes their pre- ferred candidate win in every extension of the partial votes of the non-manipulators. We consider several scenarios for which the traditional manipulation problems are easy (for instance, the Borda voting rule with a single manipulator). For many of them, the corre- sponding manipulative questions that we propose turn out to be computationally intractable. Our hardness results often hold even when very little information is missing, or in other words, even when the instances are very close to the complete information setting. Our over- all conclusion is that computational hardness continues to be a valid obstruction or deterrent to manipulation, in the context of the more realistic setting of incomplete information. Chapter 9: Manipulation Detection Even if the computational problem of manipulation is almost always intractable, there have been many instances of manipulation in real elections. In this work, we initiate the study of the computational problem of detecting possible instances of manipulation in an elec- tion [DMN15a]. We formulate two pertinent computational problems in the context of ma- nipulation detection - Coalitional Possible Manipulators (CPM) and Coalitional Possible Ma- nipulators given Winner (CPMW), where a suspect group of voters is provided as input and we have to determine whether they can form a potential coalition of manipulators. In the absence of any suspect group, we formulate two more computational problems namely Coali- tional Possible Manipulators Search (CPMS) and Coalitional Possible Manipulators Search 10 given Winner (CPMSW). We provide polynomial time algorithms for these problems, for sev- eral popular voting rules. For a few other voting rules, we show that these problems are NP-complete. We observe that detecting possible instances of manipulation may be easy even when the actual manipulation problem is computationally intractable, as seen for example, in the case of the Borda voting rule. Chapter 10: Frugal Bribery Another fundamental problem in the context of social choice theory is bribery. Formally, the computational problem of bribery is as follows: given (i) a set of votes, (ii) a cost model for changing the votes, (iii) a budget, and (iv) a candidate x, is it possible for an external agent to bribe the voters to change their votes (subject to the budget constraint) so that x wins the election? We introduce and study two important special cases of the classical $BRIBERY problem, namely, FRUGAL-BRIBERY and FRUGAL-$BRIBERY where the briber is frugal in nature in [DMN16b]. By this, we mean that the briber is only able to influence voters who benefit from the suggestion of the briber. More formally, a voter is vulnerable if the outcome of the election improves according to her own preference when she accepts the suggestion of the briber. In the FRUGAL-BRIBERY problem, the goal of the briber is to make a certain candidate win the election by changing only the vulnerable votes. In the FRUGAL-$BRIBERY problem, the vulnerable votes have prices and the goal is to make a certain candidate win the election by changing only the vulnerable votes, subject to a budget constraint. We further formulate two natural variants of the FRUGAL-$BRIBERY problem namely UNIFORM-FRUGAL-$BRIBERY and NONUNIFORM-FRUGAL-$BRIBERY where the prices of the vulnerable votes are, respectively, all same or different. We observe that, even if we have only a small number of candidates, the problems are intractable for all voting rules studied here for weighted elections, with the sole exception of the FRUGAL-BRIBERY problem for the plurality voting rule. In contrast, we have polynomial time algorithms for the FRUGAL-BRIBERY problem for plurality, veto, k-approval, k-veto, and plurality with runoff voting rules for unweighted elections. However, the FRUGAL-$BRIBERY problem is intractable for all the voting rules studied here barring the plurality and the veto voting rules for unweighted elections. These intractability results demonstrate that bribery is a hard computational problem, in the sense that several special cases of this problem continue to be computationally intractable. This strengthens the view that bribery, although a possible attack on an election in principle, may be infeasible in practice. 11 We believe that the thesis work has attempted to break fresh ground by resolving the computational complexity of many long-standing canonical problems in computational social choice. We finally conclude in Chapter 11 with future directions of research. 12 Chapter 2 Background This chapter provides an overview of selected topics required to understand the technical content in this thesis. We cover these topics, up to the requirement of following this the- sis, in the following order: Voting and Elections, Computational Complexity, Probability Theory, Information Theory, Relevant Terminology for Trees, Universal Family of Hash Functions. We present the basic preliminaries in this chapter. We denote, for any natural number ℓ ∈ N, the set {1, 2, . . . , ℓ} by [ℓ]. We denote the set of permutations of [ℓ] by Sℓ. For a set X, we denote the set of subsets of X of size k by Pk(X) and the power set of X by 2X. 2.1 Voting and Elections In this section, we introduce basic terminologies of voting. 2.1.1 Basic Setting Let C = {c1, c2, . . . , cm} be a set of candidates or alternatives and V = {v1, v2, . . . , vn} a set of voters. If not mentioned otherwise, we denote the set of candidates by C, the set of voters by V, the number of candidates by m, and the number of voters by n. Every voter vi has a preference or vote ≻i which is a complete order over C. A complete order over any set X is a relation on X which is reflexive, transitive, anti-symmetric, and total. A relation R on X is a subset of X × X. A relation R is called reflexive if (x, x) ∈ R for every x ∈ X, transitive if (x, y) ∈ R and (y, z) ∈ R implies (x, z) ∈ R for every x, y, z ∈ X, anti-symmetric 13 is (x, y) ∈ R and (y, x) ∈ R implies x = y for every x, y ∈ X, and total is either (x, y) ∈ R or (y, x) ∈ R for every x, y ∈ X. We denote the set of complete orders over C by L(C). We call a tuple of n preferences (≻1, ≻2, · · · , ≻n) ∈ L(C)n an n-voter preference profile. Given a preference ≻= c1 ≻ c2 ≻ · · · ≻ cm ∈ L(C), we call the order cm ≻ cm−1 ≻ · · · ≻ c2 ≻ c1 the reverse order of ≻ and denote it by ←−≻ . We say that a candidate x ∈ C is at the ith position of a preference ≻ if there exists exactly i − 1 other candidates in C who are preferred over x in ≻, that is {y ∈ C \ {x} : y ≻ x} = i − 1. It is often convenient to view a preference as a subset of C × C - a preference ≻ corresponds to the subset A = {(x, y) ∈ C × C : x ≻ y}. For a preference ≻ and a subset A ⊆ C of candidates, we define ≻ (A) be the preference ≻ restricted to A, that is ≻ (A) =≻ ∩(A × A). A voting correspondence is a function r : ∪n∈NL(C)n −→ 2C \ {∅} which selects, from a preference profile, a nonempty set of candidates as the winners. A tie breaking rule τ : 2C \ {∅} −→ C with τ(A) ∈ A for every A ∈ 2C \ {∅} selects one candidate from a nonempty set of (tied) candidates. A voting rule r : ∪n∈NL(C)n −→ C selects one candidate as the winner from a preference profile. An important class of tie breaking rules is the class of lexicographic tie breaking rules where the ties are broken in a fixed complete order of candidates. More formally, given a complete order ≻∈ L(C), we can define a tie breaking rule τ≻ as follows: for every nonempty subset A ⊆ C of C, τ≻(A) = x such that x ∈ A and x ≻ y for every y ∈ A \ {x}. A natural way for defining a voting rule is to compose a voting correspondence r with a tie breaking rule τ; that is r = τ ◦ r is a voting rule. We call a preference profile over a set of candidates along with a voting rule an election. The winner (or winners) of an election is often called the outcome of the election. 2.1.2 Axioms of Voting Rules Let us now look at important axiomatic properties of voting rules that one may wish to satisfy. ⊲ Onto: A voting rule r is called onto if every candidate wins for at least one voting profile. More formally, a voting rule r is called onto if for every x ∈ C there exists a (≻1, ≻2, . . . , ≻n) ∈ L(C)n such that r(≻1, ≻2, . . . , ≻n) = x. ⊲ Anonymity: A voting rule is anonymous if the "names" of the voters does not affect the outcome. More formally, a voting rule r is said to satisfy anonymity if for every (≻1, ≻2, . . . , ≻n) ∈ L(C)n, we have r(≻1, ≻2, . . . , ≻n) = r(≻σ(1), ≻σ(2), . . . , ≻σ(n)) for every permutation σ ∈ Sn. 14 ⊲ Neutrality: A voting rule is called neutral if the "names" of the candidates are immaterial for determining election outcome. That is, a voting rule r is called neutral if for every (≻1, ≻2, . . . , ≻n) ∈ L(C)n, we have r(≻1, ≻2, . . . , ≻n) = σ(r(σ(≻1), σ(≻2), . . . , σ(≻n))) for every permutation σ ∈ Sm. Given a preference ≻= c1 ≻ c2 ≻ · · · ≻ cm and a permutation σ ∈ Sm, we denote the preference cσ(1) ≻ cσ(2) ≻ · · · ≻ cσ(m) by σ(≻). ⊲ Homogeneity: A voting rule is called homogeneous if the outcome of the election solely depends on the fraction of times (of the number of voters n) every complete order ≻∈ L(C) appears in the preference profile. ⊲ Dictatorship: A voting rule r is called a dictatorship if there exists an integer i ∈ [n] such that r(≻1, ≻2, . . . , ≻n) =≻i (1) for every (≻1, ≻2, . . . , ≻n) ∈ L(C)n, where ≻i (1) the candidate placed at the first position of the preference ≻i. ⊲ Manipulability: A voting rule r is called manipulable if there exists a preference profile (≻1, ≻2, . . . , ≻n) ∈ L(C)n and a preference ≻∈ L(C) such that the following holds. r(≻1, ≻2, . . . , ≻i−1, ≻, ≻i+1, . . . , ≻n) ≻i r(≻1, ≻2, . . . , ≻n) That it, voter vi prefers the election outcome if she reports ≻ to be her preference than the election outcome if she reports her true preference ≻i. ⊲ Condorcet consistency: A candidate is called the Condorcet winner of an election if it defeats every other candidate in pairwise election. More formally, given an election E, let us define NE(x, y) = {i : x ≻i y} for any two candidates x, y ∈ C. A candidate c is called the Condorcet winner of an election if NE(c, x) > n/2 for every candidate x ∈ C \ {c} other than c. A voting rule is called Condorcet consistent is it selects the Condorcet winner as the outcome of the election whenever such a candidate exists. ⊲ Weak Condorcet consistency: A candidate is called a weak Condorcet winner of an election if it does not lose to any other candidate in pairwise election. More formally, given an election E, let us define NE(x, y) = {i : x ≻i y} for any two candidates x, y ∈ C. A candidate c is called the Condorcet winner of an election if NE(c, x) > n/2 for every candidate x ∈ C \ {c} other than c. A voting rule is called weak Condorcet consistent is it selects a weak Condorcet winner as the outcome of the election whenever one such candidate exists. 15 Given an election E = (≻, C) and two candidates x, y ∈ C, we say that the candidate x defeats the candidate y in pairwise election if NE(x, y) > NE(y, x). 2.1.3 Majority Graph Given an election E = (≻= (≻1, ≻2, . . . , ≻n), C), we can construct a weighted directed graph GE = (U = C, E) as follows. The vertex set of the graph GE is the set of candidates C. For any two candidates x, y ∈ C with x 6= y, let us define the margin DE(x, y) of x from y to be NE(x, y) − NE(y, x). We have an edge from x to y in GE if DE(x, y) > 0. Moreover, in that case, the weight w(x, y) of the edge from x to y is DE(x, y). Observe that, a candidate c is the Condorcet winner of an election E if and only if there is an edge from c to every other vertices in the weighted majority graph GE. 2.1.4 Condorcet Paradox Given an election E = (≻, C), there may exist candidates c1, c2, . . . , ck ∈ C for some integer k > 3 such that the candidate ci defeats ci+1 mod k in pairwise election for every i ∈ [k]. This phenomenon was discovered by Marie Jean Antoine Nicolas de Caritat, marquis de Condorcet and is called Condorcet paradox or Condorcet cycles. Figure 2.1 shows an example of a Condorcet paradox where a defeats b, b defeats c, and c defeats a. a ≻ b ≻ c b ≻ c ≻ a c ≻ a ≻ b Figure 2.1: Condorcet paradox. 2.1.5 Incomplete Information Setting A more general setting is an election where the votes are only partial orders over candidates. A partial order is a relation that is reflexive, antisymmetric, and transitive. A partial vote can be extended to possibly more than one linear votes depending on how we fix the order for the unspecified pairs of candidates. For example, in an election with the set of candidates C = {a, b, c}, a valid partial vote can be a ≻ b. This partial vote can be extended to three 16 linear votes namely, a ≻ b ≻ c, a ≻ c ≻ b, c ≻ a ≻ b. However, the voting rules always take as input a set of votes that are complete orders over the candidates. 2.1.6 Voting Rules Examples of common voting correspondences are as follows. We can use any tie breaking rule, for example, any lexicographic tie breaking rule, with these voting correspondences to get a voting rule. ⊲ Positional scoring rules: A collection of m-dimensional vectors −→sm = (α1, α2, . . . , αm) ∈ Rm with α1 > α2 > . . . > αm and α1 > αm for every m ∈ N naturally defines a voting rule - a candidate gets score αi from a vote if it is placed at the ith position, and the score of a candidate is the sum of the scores it receives from all the votes. The winners are the candidates with maximum score. Scoring rules remain unchanged if we multiply every αi by any constant λ > 0 and/or add any constant µ. Hence, we assume without loss of generality that for any score vector −→sm, there exists a j such that αj − αj+1 = 1 and αk = 0 for all k > j. We call such a −→sm a normalized score vector. A scoring rule is called strict if α1 > α2 > · · · > αm for every natural number m. If αi is 1 for i ∈ [k] and 0 otherwise, then we get the k-approval voting rule. For the k-veto voting rule, αi is 0 for i ∈ [m − k] and −1 otherwise. 1-approval is called the plurality voting rule and 1-veto is called the veto voting rule. For the Borda voting rule, we have αi = m − i for every i ∈ [m]. ⊲ Bucklin and simplified Bucklin: Let ℓ be the minimum integer such that at least one candidate gets majority within top ℓ positions of the votes. The winners under the simplified Bucklin voting rule are the candidates having more than n/2 votes within top ℓ positions. The winners under the Bucklin voting rule are the candidates appearing within top ℓ positions of the votes highest number of times. However, for brevity, other than Chapter 8, we use Bucklin to mean simplified Bucklin only. ⊲ Fallback and simplified Fallback: For these voting rules, each voter v ranks a subset Xv ⊂ C of candidates and disapproves the rest of the candidates [BS09]. Now for the Fallback and simplified Fallback voting rules, we apply the Bucklin and simplified Bucklin voting rules respectively to define winners. If there is no integer ℓ for which at least one candidate gets more than n/2 votes, both the Fallback and simplified Fallback 17 voting rules output the candidates with most approvals as winners. We assume, for simplicity, that the number of candidates each partial vote approves is known. ⊲ Maximin: The maximin score of a candidate x in an election E is miny6=x DE(x, y). The winners are the candidates with maximum maximin score. ⊲ Copelandα: Given α ∈ [0, 1], the Copelandα score of a candidate x is {y 6= x : DE(x, y) > 0} + α{y 6= x : DE(x, y) = 0}. The winners are the candidates with maximum Copelandα score. If not mentioned otherwise, we will assume α to be zero. ⊲ Ranked pairs: Given an election E, we pick a pair (ci, cj) ∈ C × C such that DE(ci, cj) is maximum. We fix the ordering between ci and cj to be ci ≻ cj unless it contradicts previously fixed orders. We continue this process until all pairwise elections are con- sidered. At this point, we have a complete order ≻ over the candidates. Now the top candidate of ≻ is chosen as the winner. ⊲ Plurality with runoff: The top two candidates according to plurality score are selected first. The pairwise winner of these two candidates is selected as the winner of the election. This rule is often called the runoff voting rule. ⊲ Single transferable vote: In single transferable vote (STV), a candidate with least plurality score is dropped out of the election and its votes are transferred to the next preferred candidate. If two or more candidates receive least plurality score, then some predetermined tie breaking rule is used. The candidate that remains after (m − 1) rounds is the winner. The single transferable vote is also called the instant runoff vote. We use the parallel-universes tie breaking [CRX09, BF12] to define the winning candidate for the ranked pairs voting rule. In this setting, a candidate c is a winner if and only if there exists a way to break ties in all of the steps such that c is the winner. 2.2 Computational Complexity 2.2.1 Parameterized Complexity Preprocessing, as a strategy for coping with hard problems, is universally applied in practice. The main goal here is instance compression - the objective is to output a smaller instance 18 while maintaining equivalence. In the classical setting, NP-hard problems are unlikely to have efficient compression algorithms (since repeated application would lead to an efficient solution for the entire problem, which is unexpected). However, the breakthrough notion of kernelization in parameterized complexity provides a mathematical framework for analyzing the quality of preprocessing strategies. In parameterized complexity, each problem instance comes with a parameter k, and the central notion 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 x. We use the notation O∗(f(k)) to denote O(f(k)poly(x)). A parameterized problem Π is a subset of Γ∗ × N, where Γ is a finite alphabet. An instance of a parameterized problem is a tuple (x, k), where k is the parameter. We refer the reader to the books [GN07, DF99, FG06] for a detailed introduction to this paradigm, and below we state only the definitions that are relevant to our work. A kernelization algorithm is a set of preprocessing rules that runs in polynomial time and reduces the instance size with a guarantee on the output instance size. This notion is formalized below. Definition 2.1. [Kernelization] [Nie02, FG06] A kernelization algorithm for a parameterized problem Π ⊆ Γ∗ × N is an algorithm that, given (x, k) ∈ Γ∗ × N, outputs, in time polynomial in x + k, a pair (x′, k′) ∈ Γ∗ × N such that (a) (x, k) ∈ Π if and only if (x′, k′) ∈ Π and (b) x′, k′ 6 g(k), where g is some computable function. The output instance x′ is called the kernel, and 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. For many parameterized problems, it is well established that the existence of a polyno- mial kernel would imply the collapse of the polynomial hierarchy to the third level (or more precisely, CoNP ⊆ NP/Poly). Therefore, it is considered unlikely that these problems would admit polynomial-sized kernels. For showing kernel lower bounds, we simply establish re- ductions from these problems. Definition 2.2. [Polynomial Parameter Transformation] [BTY09] Let Γ1 and Γ2 be param- eterized problems. We say that Γ1 is polynomial time and parameter reducible to Γ2, written Γ1 6Ptp Γ2, if there exists a polynomial time computable function f : Σ∗ × N → Σ∗ × N, and a polynomial p : N → N, and for all x ∈ Σ∗ and k ∈ N, if f ((x, k)) = (x′, k′), then (x, k) ∈ Γ1 if and only if (x′, k′) ∈ Γ2, and k′ 6 p (k). We call f a polynomial parameter transformation (or a PPT) from Γ1 to Γ2. 19 This notion of a reduction is useful in showing kernel lower bounds because of the follow- ing theorem. Theorem 2.1. [BTY09, Theorem 3] Let P and Q be parameterized problems whose derived classical problems are Pc, Qc, respectively. Let Pc be NP-complete, and Qc ∈ NP. Suppose there exists a PPT from P to Q. Then, if Q has a polynomial kernel, then P also has a polynomial kernel. 2.2.2 Approximation Factor of an Algorithm For a minimization problem P, we say an algorithm A archives an approximation factor of α if A(I) 6 αOPT (I) for every problem instance I of P. In the above, OPT (I) denotes the value of the optimal solution of the problem instance I. 2.2.3 Communication Complexity Communication complexity of a function measures the number of bits that need to be ex- changed between two players to compute a function whose input is split among those two players [Yao79]. In a more restrictive one-way communication model, Alice, the first player, sends only one message to Bob, the second player, and Bob outputs the result. A protocol is a method that the players follow to compute certain functions of their input. Also the protocols can be randomized; in that case, the protocol needs to output correctly with probability at least 1−δ, for δ ∈ (0, 1) (the probability is taken over the random coin tosses of the protocol). The randomized one-way communication complexity of a function f with error probability δ is denoted by R1-way (f). [KN97] is a standard reference for communication complexity. δ 2.3 Probability Theory 2.3.1 Statistical Distance Measures Given a finite set X, a distribution µ on X is defined as a function µ : X −→ [0, 1], such that Px∈X µ(x) = 1. The finite set X is called the base set of the distribution µ. We use the following distance measures among distributions in our work. 20 Definition 2.3. The KL divergence [KL51] and the Jensen-Shannon divergence [Lin91] be- tween two distributions µ1 and µ2 on X are defined as follows. DKL(µ1µ2) = X x∈X µ1(x) ln µ1(x) µ2(x) JS(µ1, µ2) = 1 2(cid:18)DKL(cid:18)µ1 µ1 + µ2 2 (cid:19) + DKL(cid:18)µ2 µ1 + µ2 2 (cid:19)(cid:19) The Jensen-Shannon divergence has subsequently been generalized to measure the mu- tual distance among more than two distributions as follows. Definition 2.4. Given n distributions µ1, . . . , µn over the same base set, the generalized Jensen- Shannon divergence1 among them is: JS(µ1, . . . , µn) = 1 n n X i=1 DKL µi 1 n n X j=1 µj! 2.3.2 Concentration Inequalities of Probability Suppose we have n events namely A1, A2, . . . , An in a probability space. Then the probability of occurring any of these n events can be bounded by what is known as union bound. Theorem 2.2. (Union Bound) The probability of happening any of a given n events A1, A2, . . . , An can be upper bounded as follows. Pr[∪n i=1Ai] 6 n X i=1 Pr[Ai] Given a probability space (Ω, F, µ), a random variable X : Ω −→ R is a function from the sample space Ω to the set of real numbers R such that {ω ∈ Ω : X(ω) 6 c} ∈ F for every c ∈ R. We refer to [Dur10] for elementary notions of probability theory. Given a positive random variable X with finite mean E[X], the classical Markov inequality bounds the probability by which the random variable X deviates from its mean. Theorem 2.3. (Markov Inequality) For a positive random variable X with mean E[X], the probability that the random variable X 1The generalized Jensen-Shannon divergence is often formulated with weights on each of the n distribu- tions. The definition here puts equal weight on each distribution and is sufficient for our purposes. 21 takes value more than cE[X] can be upper bounded as follows. Pr[X > cE[X]] 6 1 c If the variance of a random variable X is known, the Chebyshev inequality provides a sharper concentration bound for a random variable. Theorem 2.4. (Chebyshev Inequality) For a random variable with mean E[X] and variance σ2, the probability that the random variable X takes value more than cσ away from its mean E[X] is upper bounded as follows. Pr[X − E[X] > cσ] 6 1 c2 For a sum of independent bounded random variables X, the Chernoff bound gives a much tighter concentration around the mean of X. Theorem 2.5. (Chernoff Bound) Let X1, . . . , Xℓ be a sequence of ℓ independent random variables in [0, 1] (not necessarily identi- cal). Let S = Pi Xi and let µ = E [S]. Then, for any 0 6 δ 6 1: Pr[S − µ > δµ] < 2 exp(−δ2µ/3) 2.4 Information Theory For a discrete random variable X with possible values {x1, x2, . . . , xn}, the Shannon entropy of X is defined as H(X) = −Pn i=1 Pr(X = xi) log2 Pr(X = xi). Let Hb(p) = −p log2 p − (1 − p) log2(1 − p) denote the binary entropy function when p ∈ (0, 1). For two random variables X and Y with possible values {x1, x2, . . . , xn} and {y1, y2, . . . , ym}, respectively, the conditional entropy of X given Y is defined as H(X Y) = Pi,j Pr(X = xi, Y = yj) log2 Pr(X=xi,Y=yj) . Let I(X; Y) = H(X) − H(X Y) = H(Y) − H(Y X) denote the mutual information between two Pr(Y=yj) random variables X, Y. Let I(X; Y Z) denote the mutual information between two random variables X, Y conditioned on Z, i.e., I(X; Y Z) = H(X Z) − H(X Y, Z). The following summarizes several basic properties of entropy and mutual information. Proposition 2.1. Let X, Y, Z, W be random variables. 22 1. If X takes value in {1, 2, . . . , m}, then H(X) ∈ [0, log m]. 2. H(X) > H(X Y) and I(X; Y) = H(X) − H(X Y) > 0. 3. If X and Z are independent, then we have I(X; Y Z) > I(X; Y). Similarly, if X, Z are independent given W, then I(X; Y Z, W) > I(X; Y W). 4. (Chain rule of mutual information) I(X, Y; Z) = I(X; Z) + I(Y; Z X). More generally, for any random variables X1, X2, . . . , Xn, Y, I(X1, . . . , Xn; Y) = Pn Thus, I(X, Y; Z W) > I(X; Z W). i=1 I(Xi; Y X1, . . . , Xi−1). 5. (Fano's inequality) Let X be a random variable chosen from domain X according to distri- bution µX, and Y be a random variable chosen from domain Y according to distribution µY. For any reconstruction function g : Y → X with error δg, Hb(δg) + δg log(X − 1) > H(X Y). We refer readers to [CT12] for a nice introduction to information theory. 2.5 Relevant Terminology for Trees A tree T = (V, E) is a set of vertices V along with a set of edges E ⊂ P2(V) such that for every two vertices x, y ∈ V, there exists exactly one path between x and y in T. The following definitions pertaining to the structural aspects of trees will be useful. ⊲ The pathwidth of T is the minimum width of a path decomposition of T [Hei93]. ⊲ A set of disjoint paths Q = {Q1 = (X1, E1), . . . , Qk = (Xk, Ek)} is said to cover a tree T = (X, E) if X = ∪i∈[k]Xi, Ei ⊆ E, Xi ∩ Xj = ∅, Ei ∩ Ej = ∅ for every i, j ∈ [k] with i 6= j. The path cover number of T is the cardinality of the smallest set Q of disjoint paths that cover T. ⊲ The distance of a tree T from a path is the smallest number of nodes whose removal makes the tree a path. ⊲ The diameter of a tree T is the number of edges in the longest path in T. 23 Figure 2.2: Depicting classes of trees: (a) a path, (b) a star, (c) a (balanced) subdivision of a star, (d) a caterpillar. We also list some definitions of subclasses of trees (which are special types of trees, see also Figure 2.2). ⊲ A tree is a star if there is a center vertex and every other vertex is a neighbor of this vertex. ⊲ A tree is a subdivision of a star if it can be constructed by replacing each edge of a star by a path. ⊲ A subdivision of a star is called balanced if there exists an integer ℓ such that the distance of every leaf node from the center is ℓ. ⊲ A tree is a caterpillar if there is a central path and every other vertex is at a distance of one it. ⊲ A tree is a complete binary tree rooted at r if every nonleaf node has exactly two children and there exists an integer h, called the height of the tree, such that every leaf node is at a distance of either h or h − 1 from the root node r. 24 2.6 Universal Family of Hash Functions In this section, we discuss universal family of hash functions. Intuitively, a family of hash functions is universal if a hash function picked uniformly at random from the family behaves like a completely random function. The formal definition of universal family of hash functions is as follows. We use this notion crucially in Chapter 6. Definition 2.5. (Universal family of hash functions) A family of functions H = {hh : A → B} is called a universal family of hash functions if for all a 6= b ∈ A, Pr{h(a) = h(b)} = 1/B, where h is picked uniformly at random from H. h picked uniformly at random from H Pr {h(a) = h(b)} = 1/B We know that there exists a universal family of hash functions H from [k] to [ℓ] for every positive integer ℓ and every prime k [Cor09]. Moreover, H, the size of H, is O(k2). 25 Part I Preference Elicitation This part of the thesis consists of the following two chapters. ⊲ In Chapter 3 – Preference Elicitation for Single Peaked Profiles on Trees – we present ef- ficient algorithms for preference elicitation when the preferences belong to the domain of single peaked preferences on a tree. We show interesting connections between query complexity for preference elicitation and various common parameters of trees. ⊲ In Chapter 4 – Preference Elicitation for Single Crossing Profiles – we show optimal algorithms (except for one scenario) for eliciting single crossing preference profiles. Our results show that the query complexity for preference elicitation for single crossing preference profiles crucially depends on the way the votes are allowed to access. 27 Chapter 3 Preference Elicitation for Single Peaked Profiles on Trees In multiagent systems, we often have a set of agents each of which has a preference ordering over a set of items. One would often like to know these preference orderings for various tasks like data analysis, preference aggregation, voting etc. However, we often have a large number of items which makes it impractical to directly ask the agents for their complete preference ordering. In such scenarios, one convenient way to know these agents' preferences is to ask the agents to compare (hopefully a small number of) pairs of items. Prior work on preference elicitation focuses on unrestricted domain and the domain of single peaked preferences. They show that the preferences in single peaked domain can be elicited with much less number of queries compared to unrestricted domain. We extend this line of research and study preference elicitation for single peaked preferences on trees which is a strict superset of the domain of single peaked preferences. We show that the query complexity for preference elicitation crucially depends on the number of leaves, the path cover number, and the minimum number of nodes that should be removed to turn the single peaked tree into a path. We also observe that the other natural parameters of the single peaked tree like maximum and minimum degrees of a node, diameter, pathwidth do not play any direct role in determining the query complexity of preference elicitation. We A preliminary version of the work in this chapter was published as [DM16a]: Palash Dey and Neeldhara Misra. Elicitation for preferences single peaked on trees. In Proc. Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI 2016, New York, NY, USA, 9-15 July 2016, pages 215-221, 2016. 29 then investigate the query complexity for finding a weak Condorcet winner (we know that at least one weak Condorcet winner always exists for profiles which are single peaked on a tree) for preferences single peaked on a tree and show that this task has much less query complexity than preference elicitation. Here again we observe that the number of leaves in the underlying single peaked tree and the path cover number of the tree influence the query complexity of the problem. 3.1 Introduction In multiagent systems, we often have scenarios where a set of agents have to arrive at a consensus although they possess different opinions over the alternatives available. Typically, the agents have preferences over a set of items, and the problem of aggregating these pref- erences in a suitable manner is one of the most well-studied problems in social choice the- ory [BCE+15]. There are many ways of expressing preferences over a set of alternatives. One of the most comprehensive ways is to specify a complete ranking over the set of alternatives. However, one of the downsides of this model is the fact that it can be expensive to solicit the preferences when a large number of alternatives and agents are involved. Since asking agents to provide their complete rankings is impractical, a popular notion is one of elicitation, where we ask agents simple comparison queries, such as if they prefer an alternative x over another alternative y. This naturally gives rise to the problem of preference elicitation, where we hope to recover the complete ranking (or possibly the most relevant part of the ranking) based on a small number of comparison queries. In the context of a fixed voting rule, we may also want to query the voters up to the point of determining the winner (or the aggregate ranking, as the case may be). Yet another refinement in this setting is when we have prior information about how agents are likely to vote, and we may want to determine which voters to query first, to be able to quickly rule out a large number of alternatives, as explored by [CS02]. When our goal is to elicit preferences that have no prior structure, one can demonstrate scenarios where it is imperative to ask each agent (almost) as many queries as would be required to determine an arbitrary ranking. However, in recent times, there has been consid- erable interest in voting profiles that are endowed with additional structure. The motivation for this is two-fold. The first is that in several application scenarios commonly considered, it is rare that votes are ad-hoc, demonstrating no patterns whatsoever. For example, the notion 30 of single-peaked preferences, which we will soon discuss at length, forms the basis of sev- eral studies in the analytical political sciences [HM97]. In his work on eliciting preferences that demonstrate the "single-peaked" structure, Conitzer argues that the notion of single- peakedness is also a reasonable restriction in applications outside of the domain of political elections [Con09]. The second motivation for studying restricted preferences is somewhat more technical, but is just as compelling. To understand why structured preferences have received consider- able attention from social choice theorists, we must first take a brief detour into some of the foundational ideas that have shaped the landscape of voting theory as we understand them today. As it turns out, the axiomatic approach of social choice involves defining certain "prop- erties" that formally capture the quality of a voting rule. For example, we would not want a voting rule to be, informally speaking, a dictatorship, which would essentially mean that it discards all but one voter's input. Unfortunately, a series of cornerstone results establish that it is impossible to devise voting rules which respect some of the simplest desirable prop- erties. Indeed, the classic work of Arrow [Arr50] and Gibbard-Satterthwaite [Gib73, Sat75] show that there is no straight forward way to simultaneously deal with properties like voting paradoxes, strategy-proofness, nondictatorship, unanimity etc. We refer to [Mou91] for a more elaborate discussion on this. Making the matter worse, many classical voting rules, for example the Kemeny voting rule [Kem59, BNM+58, BITT89, HSV05], the Dodgson voting rule [Dod76, HHR97], the Young voting rule [You77] etc., turn out to be computationally intractable. This brings us to the second reason for why structured preferences are an important con- sideration. The notion of single-peakedness that we mentioned earlier is an excellent illus- tration (we refer the reader to Section 3.2 for the formal definition). Introduced in [Bla48], it not only captures the essence of structure in political elections, but also turns out to be ex- tremely conducive to many natural theoretical considerations. To begin with, one can devise voting rules that are "nice" with respect to several properties, when preferences are single- peaked. Further, they are structurally elegant from the point of view of winner determination, since they always admit a weak Condorcet winner - a candidate which is not defeated by any other candidate in pairwise election - thus working around the Condorcet paradox which is otherwise a prominent concern in the general scenario. In a landmark contribution, Brandt et al. [BBHH15] show that several computational problems in social choice theory that are 31 intractable in the general setting become polynomial time solvable when we consider single- peaked preferences. A natural question at this point is if the problem of elicitation becomes any easier - that is, if we can get away with fewer queries - by taking advantage of the structure provided by single-peakedness. It turns out that the answer to this is in the affirmative, as shown in a detailed study by Conitzer [Con09]. The definition of single-peakedness involves an ordering over the candidates (called the harmonious ordering by some authors). The work of Conitzer [Con09] shows that O(mn) queries suffice, assuming either that the harmonious ordering is given, or one of the votes is known, where m and n are the number of candidates and voters respectively. We now return to the theme of structural restrictions on preferences. As it turns out, the single peaked preference domain has subsequently been generalized to single peakedness on trees (roughly speaking, these are profiles that are single peaked on every path on a given tree) [Dem82, Tri89]. This is a class that continues to exhibit many desirable properties of single peaked domain. For example, there always exists a weak Condorcet winner and further, many voting rules that are intractable in an unrestricted domain are polynomial time computable if the underlying single peaked tree is "nice" [YCE13, PE16]. We note the class of profiles that are single peaked on trees are substantially more general than the class of single peaked preferences. Note that the latter is a special case since a path is, in particular, a tree. Our work here addresses the issue of elicitation on profiles that are single-peaked on trees, and can be seen as a significant generalization of the results in [Con09]. We now detail the specifics of our contributions. 3.1.1 Our Contribution We study the query complexity for preference elicitation when the preference profile is single peaked on a tree. We provide tight connections between various parameters of the underlying single peaked tree and the query complexity for preference elicitation. Our broad goal is to provide a suitable generalization of preference elicitation for single peaked profiles to profiles that are single peaked on trees. Therefore, we consider various ways of quantifying the "closeness" of a tree to a path, and reflect on how these measures might factor into the query complexity of an algorithm that is actively exploiting the underlying tree structure. We summarize our results for preference elicitation in Table 3.1, where the readers will note that most of the parameters (except diameter) chosen are small constants (typically 32 Parameter Upper Bound Lower Bound Path width (w) Maximum degree (∆) Path cover number (k) Number of leaves (ℓ) Distance from path (d) Diameter (ω) O(mn log m) Ω(mn log m) even for w = 1, log m [Observation 3.1] [Corollary 3.5] O(mn log m) Ω(mn log m) even for ∆ = 3, m − 1 Observation 3.1] O(mn log k) [Theorem 3.2] O(mn log ℓ) [Corollary 3.1] O(mn + nd log d) [Theorem 3.3] O(mn log m) [Corollary 3.3] Ω(mn log k) [Corollary 3.2] Ω(mn log ℓ) [Theorem 3.4] Ω(mn + nd log d) [Theorem 3.6] Ω(mn log m) even for ω = 2, m/2 [Observation 3.1] [Corollary 3.4] Table 3.1: Summary of query complexity bounds for eliciting preferences which are single peaked on trees. zero, one or two) when the tree under consideration is a path. Observe that in some cases - such as the number of leaves, or the path cover number - the dependence on the parameter is transparent (and we recover the results of [Con09] as a special case), while in other cases, it is clear that the perspective provides no additional mileage (the non-trivial results here are the matching lower bounds). In terms of technique, our strategy is to "scoop out the paths from the tree" and use the algorithm form [Con09] to efficiently elicit the preference on the parts of the trees that are paths. We then efficiently merge this information across the board, and that aspect of the algorithm varies depending on the parameter under consideration. The lower bounds typically come from trees that provide large "degrees of freedom" in reordering candidates, typically these are trees that don't have too many long paths (such as stars). The arguments are often subtle but intuitive. We then study the query complexity for finding a weak Condorcet winner of a preference profile which is single peaked on a tree. Here, we are able to show that a weak Condorcet win- ner can be found with far fewer queries than the corresponding elicitation problem. In par- ticular, we establish that a weak Condorcet winner can be found using O(mn) many queries for profiles that are single peaked on trees [Theorem 3.7], and we also show that this bound is the best that we can hope for [Theorem 3.11]. We also consider the problem for the special 33 case of single peaked profiles. While Conitzer in [Con09] showed that Ω(mn) queries are necessary to determine the aggregate ranking, we show that only O(n log m) queries suffice if we are just interested in (one of the) weak Condorcet winners. Moreover, we show this bound is tight under the condition that the algorithm does not interleave queries to different voters [Theorem 3.12] (our algorithm indeed satisfies this condition). Finally, for expressing the query complexity for determining a weak Condorcet winner in terms of a measure of closeness to a path, we show an algorithm with query complexity O(nk log m) where k is the path cover number of T [Theorem 3.10] or the number of leaves in T [Corollary 3.6]. We now elaborate further on our specific contributions for preference elicitation. ⊲ We design novel algorithms for preference elicitation for profiles which are single peaked on a tree with ℓ leaves with query complexity O(mn log ℓ) [Corollary 3.1]. Moreover, we prove that there exists a tree T with ℓ leaves such that any preference elicitation algorithm for profiles which are single peaked on tree T has query complex- ity Ω(mn log ℓ) [Theorem 3.4]. We show similar results for the parameter path cover number of the underlying tree [Theorem 3.2 and Corollary 3.2]. ⊲ We provide a preference elicitation algorithm with query complexity O(mn + nd log d) for single peaked profiles on trees which can be made into a path by deleting at most d nodes [Theorem 3.3]. We show that our query complexity upper bound is tight up to constant factors [Theorem 3.6]. These results show that the query complexity for preference elicitation tightly depends on the number of leaves, the path cover number, and the distance from path of the underlying tree. ⊲ We then show that there exists a tree T with pathwidth one or log m [Corollary 3.5] or maximum degree is 3 or m − 1 [Corollary 3.3] or diameter is 2 or m/2 [Corollary 3.4] such that any preference elicitation algorithm for single peaked profiles on the tree T has query complexity Ω(mn log m). These results show that the query complexity for preference elicitation does not directly depend on the parameters above. We next investigate the query complexity for finding a weak Condorcet winner for profiles which are single peaked on trees and we have the following results. ⊲ We show that a weak Condorcet winner can be found using O(mn) queries for profiles that are single peaked on trees [Theorem 3.7] which is better than the query complexity 34 for preference elicitation. Moreover, we prove that this bound is tight in the sense that any algorithm for finding a weak Condorcet winner for profiles that are single peaked on stars has query complexity Ω(mn) [Theorem 3.11]. ⊲ On the other hand, we can find a weak Condorcet winner using only O(n log m) queries for single peaked profiles [Theorem 3.8]. Moreover, we show that this bound is tight under the condition that the algorithm does not interleave queries to different voters [Theorem 3.12] (our algorithm indeed satisfies this condition). For any arbitrary un- derlying single peaked tree T, we provide an algorithm for finding a weak Condorcet winner with query complexity O(nk log m) where k is the path cover number of T [The- orem 3.10] or the number of leaves in T [Corollary 3.6]. To summarize, we remark that our results non-trivially generalize earlier works on query complexity for preference elicitation in [Con09]. We believe revisiting the preference elici- tation problem in the context of profiles that are single peaked on trees is timely, and that this work also provides fresh algorithmic and structural insights on the domain of preferences that are single peaked on trees. 3.1.2 Related Work We have already mentioned the work in [Con09] addressing the question of eliciting pref- erences in single-peaked profiles, which is the closest predecessor to our work. Before this, Conitzer and Sandholm addressed the computational hardness for querying minimally for winner determination [CS02]. They also prove that one would need to make Ω(mn log m) queries even to decide the winner for many commonly used voting rules [CS05] which matches with the trivial O(mn log m) upper bound for preference elicitation in unrestricted domain (due to sorting lower bound). Ding and Lin study preference elicitation under partial information setting and show interesting properties of what they call a deciding set of queries [DL13a]. Lu and Boutilier provide empirical study of preference elicitation under probabilis- tic preference model [LB11b] and devise several novel heuristics which often work well in practice [LB11a]. 35 3.2 Domain of Single Peaked Profiles on Trees A preference ≻∈ L(C) over a set of candidates C is called single peaked with respect to an order ≻′∈ L(C) if, for every candidates x, y ∈ C, we have x ≻ y whenever we have either c ≻′ x ≻′ y or y ≻′ x ≻′ c, where c ∈ C is the candidate at the first position of ≻. A profile P = (≻i)i∈[n] is called single peaked with respect to an order ≻′∈ L(C) if ≻i is single peaked with respect to ≻′ for every i ∈ [n]. Notice that if a profile P is single peaked with respect to an order ≻′∈ L(C), then P is also single peaked with respect to the order ←−≻ ′. Example 3.1 exhibits an example of a single peaked preference profile. Example 3.1. (Example of single peaked preference profile) Consider a set C of m candidates, corresponding m distinct points on the Real line, a set V of n voters, also corresponding n points on the Real line, and the preference of every voter are based on their distance to the candidates – given any two candidates, every voter prefers the candidate nearer to her (breaking the tie arbitrarily). Then the set of n preferences is single peaked with respect to the ordering of the candidates according to the ascending ordering of their positions on the Real line. Given a path Q = (x1, x2, . . . , xℓ) from a vertex x1 to another vertex xℓ in a tree T, we define the order induced by the path Q to be x1 ≻ x2 ≻ · · · ≻ xℓ. Given a tree T = (C, E) with the set of nodes as the set of candidates C, a profile P is called single peaked on the tree T if P is single peaked on the order induced by every path of the tree T; that is for every two candidates x, y ∈ C, the profile P(X) is single peaked with respect to the order ≻ on the set of candidates X induced by the unique path from x to y in T. We call the tree T the underlying single peaked tree of the preference profile P. It is known (c.f. [Dem82]) that there always exists a weakly Condorcet winner for a profile P which is single peaked on a tree T. 3.3 Problem Definitions and Known Results Suppose we have a profile P with n voters and m candidates. For any pair of distinct candi- dates x and y, and a voter ℓ ∈ [n], we introduce the boolean-valued function QUERY(x ≻ℓ y) as follows. The output of this function is TRUE if the voter ℓ prefers the candidate x over the candidate y and FALSE otherwise. We now formally state the two problems that we consider in this work. 36 Definition 3.1. PREFERENCE ELICITATION Given a tree T = (C, E) and an oracle access to the function QUERY (·) for a profile P which is single peaked on T, find P. Suppose we have a set of candidates C = {c1, . . . , cm}. We say that an algorithm A makes q queries if there are exactly q distinct tuples (ℓ, ci, cj) ∈ [n] × C × C with i < j such that A calls QUERY (ci ≻ℓ cj) or QUERY (cj ≻ℓ ci). We call the maximum number of queries made by an algorithm A for any input its query complexity. We state some known results that we will appeal to later. The first observation employs a sorting algorithm like merge sort to elicit every vote with O(m log m) queries, while the second follows from the linear-time merge subroutine of merge sort ([Cor09]). Observation 3.1. There is a PREFERENCE ELICITATION algorithm with query complexity O(mn log m). Observation 3.2. Suppose C1, C2 ⊆ C form a partition of C and ≻ is a ranking of the candidates in C. Then there is a linear time algorithm that finds ≻ given ≻ (C1) and ≻ (C2) with query complexity O(C). Theorem 3.1. [Con09] There is a PREFERENCE ELICITATION algorithm with query complexity O(mn) for single peaked profiles. We now state the WEAK CONDORCET WINNER problem, which asks for eliciting only up to the point of determining a weak Condercet winner (recall that at least one such winner is guaranteed to exist on profiles that are single-peaked on trees). Definition 3.2. WEAK CONDORCET WINNER Given a tree T = (C, E) and an oracle access to the function QUERY (·) for a profile P which is single peaked on T, find a weak Condorcet winner of P. 3.4 Results for Preference Elicitation In this section, we present our results for PREFERENCE ELICITATION for profiles that are single peaked on trees. Recall that we would like to generalize Theorem 3.1 in a way to profiles that are single peaked on trees. Since the usual single peaked profiles can be viewed as profiles single peaked with respect to a path, we propose the following measures of how much a tree resembles a path. 37 ⊲ Leaves. Recall any tree has at least two leaves, and paths are the trees that have exactly two leaves. We consider the class of trees that have ℓ leaves, and show an algorithm with query complexity of O(mn log ℓ). ⊲ Path Cover. Consider the notion of a path cover number of a tree, which is the smallest number of disjoint paths that the tree can be partitioned into. Clearly, the path cover number of a path is one; and for trees that can be covered with k paths, we show an algorithm with query complexity O(mn log k). ⊲ Distance from Paths. Let d be the size of the smallest set of vertices whose removal makes the tree a path. Again, if the tree is a path, then the said set is simply the empty set. For trees that are at a distance d from being a path (in the sense of vertex deletion), we provide an algorithm with query complexity O(mn log d). ⊲ Pathwidth and Maximum Degree. Finally, we note that paths are also trees that have pathwidth one, and maximum degree two. These perspectives turn out to be less useful: in particular, there are trees where these parameters are constant, for which we show that elicitation is as hard as it would be on an arbitrary profile, and therefore the easy algorithm from Observation 3.1 is actually the best that we can hope for. For the first three perspectives that we employ, that seemingly capture an appropriate as- pect of paths and carry it forward to trees, the query complexities that we obtain are tight - we have matching lower bounds in all cases. Also, while considering structural parameters, it is natural to wonder if there is a class of trees that are incomparable with paths but effective for elicitation. Our attempt in this direction is to consider trees of bounded diameter. How- ever, again, we find that this is not useful, as we have examples to show that there exist trees of diameter two that are as hard to elicit as general profiles. We remark at this point that all these parameters are polynomially computable for trees, making the algorithmic results viable. For example, the distance from path can be found by finding the longest path in the single peaked tree which can be computed in polynomial amount of time [Cor09]. Also, for the parameters of pathwidth, maximum degree and diam- eter, we show lower bounds on trees where these parameters are large (such as trees with pathwidth O(log m), maximum degree m−1, and diameter m/2), which - roughly speaking - also rules out the possibility of getting a good inverse dependence. As a concrete example, motivated by the O(mn) algorithm for paths, which have diameter m, one might wonder if 38 there is an algorithm with query complexity O( mn log m log ω ) for single peaked profiles on a tree with diameter ω. This possibility, in particular, is ruled out. We are now ready to discuss the results in Table 3.1. We begin with showing a structural result about trees: any tree with ℓ leaves can be partitioned into ℓ paths. The idea is to fix some non-leaf node as root and iteratively find a path from low depth nodes (depth of a node is its distance from root) to some leaf node which is disjoint from all the paths chosen so far. We formalize this idea below. Lemma 3.1. Let T = (X, E) be a tree with ℓ leaves. Then there is a polynomial time algorithm which partitions T into ℓ disjoint paths Qi = (Xi, Ei), i ∈ [ℓ]; that is we have Xi∩Xj = ∅, Ei∩Ej = ∅ for every i, j ∈ [ℓ] with i 6= j, X = ∪i∈[ℓ]Xi, E = ∪i∈[ℓ]Ei, and Qi is a path in T for every i ∈ [ℓ]. Proof. We first make the tree T rooted at any arbitrary nonleaf node r. We now partition the tree T into paths iteratively as follows. Initially every node of the tree T is unmarked and the set of paths Q we have is empty. Let Q1 = (X1, E1) be the path in T from the root node to any leaf node. We put Q1 into Q and mark all the nodes in Q1. More generally, in the ith iteration we pick an unmarked node u that is closest to the root r, breaking ties arbitrarily, and add any path Qi in T from u to any leaf node in the subtree Tu rooted at u, and mark all the nodes in Qi = (Xi, Ei). Since u is unmarked, we claim that every node in Tu is unmarked. Indeed, otherwise suppose there is a node w in Tu which is already marked. Then there exists two paths from r to w one including u and another avoiding u since u is currently unmarked and w is already marked. This contradicts the fact that T is a tree. Hence every node in Tu is unmarked. We continue until all the leaf nodes are marked and return Q. Since T has ℓ leaves and in every iteration at least one leaf node is marked (since every Qi contains a leaf node), the algorithm runs for at most ℓ iterations. Notice that, since the algorithm always picks a path consisting of unmarked vertices only, the set of paths in Q are pairwise disjoint. We claim that Q forms a partition of T. Indeed, otherwise there must be a node x in T that remains unmarked at the end. From the claim above, we have all the nodes in the subtree Tx rooted at x unmarked which includes at least one leaf node of T. This contradicts the fact that the algorithm terminates when all the leaf nodes are marked. Using Lemma 3.1, and the fact that any path can account for at most two leaves, we have that the path cover number of a tree is the same as the number of leaves up to a factor of two. 39 Lemma 3.2. Suppose the path cover number of a tree T with ℓ leaves is k. Then we have ℓ/2 6 k 6 ℓ. Proof. The inequality ℓ/2 6 k follows from the fact that any path in T can involve at most two leaves in T and there exists k paths covering all the leaf nodes. The inequality k 6 ℓ follows from the fact from Lemma 3.1 that any tree T with ℓ leaves can be partitioned into ℓ paths. 3.4.1 Algorithmic Results for PREFERENCE ELICITATION We now present our main algorithmic results. We begin with generalizing the result of The- orem 3.1 to any single peaked profiles on trees whose path cover number is at most k. The idea is to partition the tree into k disjoint paths, use the algorithm from Theorem 3.1 on each paths to obtain an order of the candidates on each path of the partition, and finally merge these suborders intelligently. We now formalize this idea as follows. Theorem 3.2. There is a PREFERENCE ELICITATION algorithm with query complexity O(mn log k) for profiles that are single peaked on trees with path cover number at most k. Proof. Since the path cover number is at most k, we can partition the tree T = (C, E) into t disjoint paths Pi = (Ci, Ei), i ∈ [t], where t is at most k. We now show that we can elicit any preference ≻ which is single peaked on the tree T by making O(m log t) queries which in turn proves the statement. We first find the preference ordering restricted to Ci using Theorem 3.1 by making O(Ci) queries for every i ∈ [t]. This step needsPi∈[t] O(Ci) = O(m) queries since Ci, i ∈ [t] forms a partition of C. We next merge the t orders ≻ (Ci), i ∈ [t], to obtain the complete preference ≻ by using a standard divide and conquer approach for t-way merging as follows which makes O(m log t) queries [HUA83]. ⌈t/2⌉ Initially we have t orders to merge. We arbitrarily pair the t orders into ⌈t/2⌉ pairs with at most one of them being singleton (when t is odd). By renaming, suppose the pairings are as follows: (≻ (C2i−1), ≻ (C2i)), i ∈ [⌊t/2⌋]. Let us define C′i = C2i−1 ∪ C2i for every i ∈ [⌊t/2⌋] and C′ = Ct if t is an odd integer. We merge ≻ (C2i−1) and ≻ (C2i) to get ≻ (C′i) for every i ∈ [⌊t/2⌋] using Observation 3.2. The number queries the algorithm makes in this iteration is Pi∈[⌊t/2⌋] O(C2i−1 + C2i) = O(m) since (Ci)i∈[t] forms a partition of C. At the end of the first iteration, we have ⌈t/2⌉ orders ≻ (C′i), i ∈ [⌈t/2⌉] to merge to get ≻. The algorithm repeats the step above O(log t) times to obtain ≻ and the query complexity of each iteration is O(m). Thus the query complexity of the algorithms is O(m + m log t) = O(m log k). 40 Using the fact from Lemma 3.2 that a tree with ℓ leaves can be partitioned into at most ℓ paths, we can use the algorithm from Theorem 3.2 to obtain the following bound on query complexity for preference elicitation in terms of leaves. Corollary 3.1. There is a PREFERENCE ELICITATION algorithm with query complexity O(mn log ℓ) for profiles that are single peaked on trees with at most ℓ leaves. Finally, if we are given a subset of candidates whose removal makes the single peaked tree a path, then we have an elicitation algorithm that makes O(mn + nd log d) queries. As before, we first determine the ordering among the candidates on the path (after removing those d candidates) with O(m − d) queries. We then determine the ordering among the rest in O(d log d) queries using Observation 3.1 and merge using Observation 3.2 these two orderings. This leads us to the following result. Theorem 3.3. There is a PREFERENCE ELICITATION algorithm with query complexity O(mn + nd log d) for profiles that are single peaked on trees with distance d from path. Proof. Let X be the smallest set of nodes of a tree T = (C, E) such that T \ X, the subgraph of T after removal of the nodes in X, is a path. We have X 6 d. For any preference ≻, we make O(d log d) queries to find ≻ (X) using Observation 3.1, make O(C \ X) = O(m − d) queries to find ≻ (C \ X) using Theorem 3.1, and finally make O(m) queries to find ≻ by merging ≻ (X) and ≻ (C \ X) using Observation 3.2. This gives an overall query complexity of O(mn + nd log d). 3.4.2 Lower Bounds for PREFERENCE ELICITATION We now turn to query complexity lower bounds for preference elicitation. Our first result is based on a counting argument, showing that the query complexity for preference elicitation in terms of the number of leaves, given by Corollary 3.1, is tight up to constant factors. Indeed, let us consider a subdivision of a star T with ℓ leaves and let t denote the distance from the center to the leaves, so that we have a total of tℓ + 1 candidates. One can show that if the candidates are written out in level order, the candidates that are distance i from the star center can be ordered arbitrarily within this ordering. This tells us that the number of possible preferences ≻ that are single peaked on the tree T is at least (ℓ!)t. We obtain the lower bound by using a decision tree argument, wherein we are able to show that it is always possible for an oracle to answer the comparison queries asked by the algorithm in such a way 41 that the total number of possibilities for the preference of the current voter decreases by at most a factor of two. Since the decision tree of the algorithm must entertain at least (ℓ!)t leaves to account for all possibilities, we obtain the claimed lower bound. Theorem 3.4. Let T = (C, E) be a balanced subdivision of a star on m nodes with ℓ leaves. Then any deterministic PREFERENCE ELICITATION algorithm for single peaked profiles on T has query complexity Ω(mn log ℓ). Proof. Suppose the number of candidates m be (tℓ + 1) for some integer t. Let c be the center of T. We denote the shortest path distance between any two nodes x, y ∈ C in T by d(x, y). We consider the partition (C0, . . . , Ct) of the set of candidates C where Ci = {x ∈ C : d(x, c) = i}. We claim that the preference ≻= π0 ≻ π1 ≻ · · · ≻ πt of the set of candidates C is single peaked on the tree T where πi is any arbitrary order of the candidates in Ci for every 0 6 i 6 t. Indeed; consider any path Q = (X, E′) in the tree T. Let y be the candidate closest to c among the candidates in X; that is y = argminx∈X d(x, c). Then clearly ≻ (X) is single peaked with respect to the path Q having peak at y. We have Ci = ℓ for every i ∈ [t] and thus the number of possible preferences ≻ that are single peaked on the tree T is at least (ℓ!)t. Let A be any PREFERENCE ELICITATION algorithm for single peaked profiles on the tree T. We now describe our oracle to answer the queries that the algorithm A makes. For every voter v, the oracle maintains the set Rv of possible preferences of the voter v which is consistent with the answers to all the queries that the algorithm A have already made for the voter v. At the beginning, we have Rv > (ℓ!)t for every voter v as argued above. Whenever the oracle receives a query on v for any two candidates x and y, it computes the numbers n1 and n2 of orders in Rv which prefers x over y and y over x respectively; the oracle can compute the integers n1 and n2 since the oracle has infinite computational power. The oracle answers that the voter v prefers the candidate x over y if and only if n1 > n2 and updates the set Rv accordingly. Hence, whenever the oracle is queried for a voter v, the size of the set Rv decreases by a factor of at most two. On the other hand, we must have, from the correctness of the algorithm, Rv to be a singleton set when the algorithm terminates for every voter v – otherwise there exists a voter v (whose corresponding Rv is not singleton) for which there exist two possible preferences which are single peaked on the tree T and are consistent with all the answers the oracle has given and thus the algorithm A fails to output the preference of the voter v correctly. Hence every voter must be queried at least Ω(log((ℓ!)t)) = Ω(tℓ log ℓ) = Ω(m log ℓ) times. 42 Since the path cover number of a subdivided star on ℓ leaves is at least ℓ/2, we also obtain the following. Corollary 3.2. There exists a tree T with path cover number k such that any determinis- tic PREFERENCE ELICITATION algorithm for single peaked profiles on T has query complexity Ω(mn log k). Mimicking the level order argument above on a generic tree with ℓ leaves, and using the connection between path cover and leaves, we obtain lower bounds that are functions of (n, ℓ) and (n, k), as given below. This will be useful for our subsequent results. Theorem 3.5. Let T = (C, E) be any arbitrary tree with ℓ leaves and path cover number k. Then any deterministic PREFERENCE ELICITATION algorithm for single peaked profiles on T has query complexity Ω(nℓ log ℓ) and Ω(nk log k). Proof. Let X be the set of leaves in T. We choose any arbitrary nonleaf node r as the root of T. We denote the shortest path distance between two candidates x, y ∈ C in the tree T by d(x, y). Let t be the maximum distance of a node from r in T; that is t = maxy∈C\X d(r, x). We partition the candidates in C \ X as (C0, C1, . . . , Ct) where Ci = {y ∈ C \ X : d(r, y) = i} for 0 6 i 6 t. We claim that the preference ≻= π0 ≻ π1 ≻ · · · ≻ πt ≻ π of the set of candidates C is single peaked on the tree T where πi is any arbitrary order of the candidates in Ci for every 0 6 i 6 t and π is an arbitrary order of the candidates in C \ X. Indeed, otherwise consider any path Q = (Y, E′) in the tree T. Let y be the candidate closest to r among the candidates in Y; that is y = argminx∈Y d(x, r). Then clearly ≻ (Y) is single peaked with respect to the path Q having peak at y. We have the number of possible preferences ≻ that are single peaked on the tree T is at least X! = ℓ!. Again using the oracle same as in the proof of Theorem 3.4, we deduce that any PREFERENCE ELICITATION algorithm A for profiles that are single peaked on the tree T needs to make Ω(nℓ log ℓ) queries. The bound with respect to the path cover number now follows from Lemma 3.2. The following results can be obtained simply by applying Theorem 3.5 on particular graphs. For instance, we use the fact that stars have (m − 1) leaves and have pathwidth one to obtain the first part of Corollary 3.5, while appealing to complete binary trees that have O(m) leaves and pathwidth O(log m) for the second part. These examples also work in the context of maximum degree, while for diameter we use stars and caterpillars with a central path of length m/2 in Corollary 3.4. 43 Corollary 3.3. There exist two trees T and T′ with maximum degree ∆ = 3 and m−1 respectively such that any deterministic PREFERENCE ELICITATION algorithm for single peaked profiles on T and T′ respectively has query complexity Ω(mn log m). Proof. Using Theorem 3.5, we know that any PREFERENCE ELICITATION algorithm for profiles which are single peaked on a complete binary tree has query complexity Ω(mn log m) since a complete binary tree has Ω(m) leaves. The result now follows from the fact that the maximum degree ∆ of a node is three for any binary tree. The case of ∆ = m − 1 follows immediately from Theorem 3.5 applied on stars. Corollary 3.4. There exists two trees T and T′ with diameters ω = 2 and ω = m/2 respectively such that any deterministic PREFERENCE ELICITATION algorithm for profiles which are single peaked on T and T′ respectively has query complexity Ω(mn log m). Proof. The ω = 2 and ω = m/2 cases follow from Theorem 3.5 applied on star and caterpillar graphs with a central path of length m/2 respectively. We next consider the parameter pathwidth of the underlying single peaked tree. We immediately get the following result for PREFERENCE ELICITATION on trees with pathwidths one or log m from Theorem 3.5 and the fact that the pathwidths of a star and a complete binary tree are one and log m respectively. Corollary 3.5. There exist two trees T and T′ with pathwidths one and log m respectively such that any deterministic PREFERENCE ELICITATION algorithm for single peaked profiles on T and T′ respectively has query complexity Ω(mn log m). Our final result, which again follows from Theorem 3.5 applied of caterpillar graphs with a central path of length m − d, shows that the bound in Theorem 3.3 is tight. Theorem 3.6. For any integers m and d with 1 6 d 6 m/4, there exists a tree T with distance d from path such that any deterministic PREFERENCE ELICITATION algorithm for profiles which are single peaked on T has query complexity Ω(mn + nd log d). Proof. Consider the caterpillar graph where the length of the central path Q is m − d; there exists such a caterpillar graph since d 6 m/4. Consider the order ≻= π ≻ σ of the set of candidates C where π is an order of the candidates in Q which is single peaked on Q and σ is any order of the candidates in C \ Q. Clearly, ≻ is single peaked on the tree T. Any elicitation algorithm A needs to make Ω(m − d) queries involving only the candidates in Q to elicit π 44 due to [Con09] and Ω(d log d) queries to elicit σ due to sorting lower bound for every voter. This proves the statement. 3.5 Results for Weak Condorcet Winner In this section, we present our results for the query complexity for finding a weak Condorcet winner in profiles that are single peaked on trees. 3.5.1 Algorithmic Results for Weak Condorcet Winner We now show that we can find a weak Condorcet winner of profiles that are single peaked on trees using fewer queries than the number of queries needed to find the profile itself. We note that if a Condorcet winner is guaranteed to exist for a profile, then it can be found using O(mn) queries - we pit an arbitrary pair of candidates x, y and use O(n) queries to determine if x defeats y. We push the winning candidate forward and repeat the procedure, clearly requiring at most m rounds. Now, if a profile is single peaked with respect to a tree, and there are an odd number of voters, then we have a Condorcet winner and the procedure that we just described would work. Otherwise, we simply find a Condorcet winner among the first (n − 1) voters. It can be easily shown that such a winner is one of the weak Condorcet winners for the overall profile, and we therefore have the following results. We begin with the following general observation. Observation 3.3. Let P be a profile where a Condorcet winner is guaranteed to exist. Then we can find the Condorcet winner of P by making O(mn) queries. Proof. For any two candidates x, y ∈ C we find whether x defeats y or not by simply asking all the voters to compare x and y; this takes O(n) queries. The algorithms maintains a set S of candidates which are potential Condorcet winners. We initialize S to C. In each iteration we pick any two candidates x, y ∈ S from S, remove x from S if x does not defeat y and vice versa using O(n) query complexity until S is singleton. After at most m − 1 iterations, the set S will be singleton and contain only Condorcet winner since we find a candidate which is not a Condorcet winner in every iteration and thus the size of the set S decreases by at least one in every iteration. This gives a query complexity bound of O(mn). Using Observation 3.3 we now develop a WEAK CONDORCET WINNER algorithm with query complexity O(mn) for profiles that are single peaked on trees. 45 Theorem 3.7. There is a WEAK CONDORCET WINNER algorithm with query complexity O(mn) for single peaked profiles on trees. Proof. Let P = (≻i)i∈[n] be a profile which is single peaked on a tree T. If n is an odd integer, then we know that there exists a Condorcet winner in P since no two candidates can tie and there always exists at least one weak Condorcet winner in every single peaked profile on trees. Hence, if n is an odd integer, then we use Observation 3.3 to find a weak Condorcet winner which is the Condorcet winner too. Hence let us now assume that n is an even integer. Notice that P−1 = (≻2, . . . , ≻n) is also single peaked on T and has an odd number of voters and thus has a Condorcet winner. We use Observation 3.3 to find the Condorcet winner c of P−1 and output c as a weak Condorcet winner of P. We claim that c is a weak Condorcet winner of P. Indeed otherwise there exists a candidate x other than c who defeats c in P. Since n is an even integer, x must defeat c by a margin of at least two (since all pairwise margins are even integers) in P. But then x also defeats c by a margin of at least one in P−1. This contradicts the fact that c is the Condorcet winner of P−1. For the special case of single peaked profiles, we can do even better. Here we take advan- tage of the fact that a "median candidate" [MCWG95] is guaranteed to be a weak Condorcet winner. We make O(log m) queries per vote to find the candidates placed at the first position of all the votes using the algorithm in [Con09] and find a median candidate to have an al- gorithm for finding a weak Condorcet winner. If a profile is single peaked (on a path), then there is a WEAK CONDORCET WINNER algorithm with query complexity O(n log m) as shown below. Let us define the frequency f(x) of a candidate x ∈ C to be the number of votes where x is placed at the first position. Then we know that a median candidate according to the single peaked ordering of the candidates along with their frequencies as defined above is a weak Condorcet winner for single peaked profiles [MCWG95]. Theorem 3.8. There is a WEAK CONDORCET WINNER algorithm with query complexity O(n log m) for single peaked profiles (on a path). Proof. Let P be a profile that is single peaked with respect to an ordering ≻∈ L(C) of candi- dates. Then we find, for every voter v, the candidate the voter v places at the first position using O(log m) queries using the algorithm in [Con09] and return a median candidate. The next result uses Theorem 3.8 on paths in a path cover of the single peaked tree eliminating the case of even number of voters by the idea of setting aside one voter that was used in Theorem 3.7. 46 Theorem 3.9. Let T be a tree with path cover number at most k. Then there is an algorithm for WEAK CONDORCET WINNER for profiles which are single peaked on T with query complexity O(nk log m). Recalling that the number of leaves bounds the path cover number, we have the following consequence. Corollary 3.6. Let T be a tree with ℓ leaves. Then there is an algorithm for WEAK CONDORCET WINNER for profiles which are single peaked on T with query complexity O(nℓ log m). From Theorem 3.7 and 3.8 we have the following result for any arbitrary tree. Theorem 3.10. Let T be a tree with path cover number at most k. Then there is an algorithm for WEAK CONDORCET WINNER for profiles which are single peaked on T with query complexity O(nk log m). Proof. Let P be the input profile and Qi = (Xi, Ei) i ∈ [t] be t(6 k) disjoint paths that cover the tree T. Here again, if the number of voters is even, then we remove any arbitrary voter and the algorithm outputs the Condorcet winner of the rest of the votes. The correctness of this step follows from the proof of Theorem 3.7. Hence we assume, without loss of generality, that we have an odd number of voters. The algorithm proceeds in two stages. In the first stage, we find the Condorcet winner wi of the profile P(Xi) for every i ∈ [t] using Theorem 3.8. The query complexity of this stage is O(nPi∈[t] log Xi) = O(nt log(m/t)). In the second stage, we find the Condorcet winner w of the profile P({wi : i ∈ [t]}) using Theorem 3.7 and output w. The query complexity of the second stage is O(nt log t). Hence the overall query complexity of the algorithm is O(nt log(m/t)) + O(nt log t) = O(nk log m). 3.5.2 Lower Bounds for Weak Condorcet Winner We now state the lower bounds pertaining to WEAK CONDORCET WINNER. First, we show that any algorithm for WEAK CONDORCET WINNER for single peaked profiles on stars has query complexity Ω(mn), showing that the bound of Theorem 3.7 is tight. Theorem 3.11. Any deterministic WEAK CONDORCET WINNER algorithm for single peaked pro- files on stars has query complexity Ω(mn). Proof. Let T be a star with center vertex c. We now design an oracle that will "force" any WEAK CONDORCET WINNER algorithm A for single peaked profiles on T to make Ω(mn) 47 queries. For every voter v, the oracle maintains a set of "marked" candidates which can not be placed at the first position of the preference of v. Suppose the oracle receives a query to compare two candidates x and y for a voter ℓ. If the order between x and y for the voter ℓ follows from the answers the oracle has already provided to all the queries for the voter ℓ, then the oracle answers accordingly. Otherwise it answers x ≻ℓ y if y is unmarked and marks y; otherwise the oracle answers y ≻ℓ x and marks x. Notice that the oracle marks at most one unmarked candidate every time it is queried. We now claim that there must be at least n/10 votes which have been queried at least m/4 times. If not, then there exists n − n/10 = 9n/10 votes each of which has at least m − m/4 = 3m/4 candidates unmarked. In such a scenario, there exists a constant N0 such that for every m, n > N0, we have at least two candidates x and y who are unmarked in at least (⌊n/2⌋ + 1) votes each. Now if the algorithm outputs x, then we put y at the first position in at least (⌊n/2⌋ + 1) votes and at the second position in the rest of the votes and this makes y the (unique) Condorcet winner. If the algorithm does not output x, then we put x at the first position in at least (⌊n/2⌋ + 1) votes and at the second position in the rest of the votes and this makes x the (unique) Condorcet winner. Hence the algorithm fails to output correctly in both the cases contradicting the correctness of the algorithm. Also the resulting profile is single peaked on T with center at y in the first case and at x in the second case. Therefore the algorithm A must have query complexity Ω(mn). Our next result uses an adversary argument, and shows that the query complexity for WEAK CONDORCET WINNER for single peaked profiles in Theorem 3.8 is essentially optimal, provided that the queries to different voters are not interleaved, as is the case with our algorithm. Theorem 3.12. Any deterministic WEAK CONDORCET WINNER algorithm for single peaked pro- files which does not interleave the queries to different voters has query complexity Ω(n log m). Proof. Let a profile P be single peaked with respect to the ordering of the candidates ≻= c1 ≻ c2 ≻ · · · ≻ cm. The oracle maintains two indices ℓ and r for every voter such that any candidate from {cℓ, cℓ+1, . . . , cr} can be placed at the first position of the preference of the voter v and still be consistent with all the answers provided by the oracle for v till now and single peaked with respect to ≻. The algorithm initializes ℓ to one and r to m for every voter. The oracle answers any query in such a way that maximizes the new value of r − ℓ. More specifically, suppose the oracle receives a query to compare candidates ci and cj with i < j for a voter v. If the ordering between ci and cj follows, by applying transitivity, from the answers 48 to the queries that have already been made so far for this voter, then the oracle answers accordingly. Otherwise the oracle answers as follows. If i < ℓ, then the oracle answers that cj is preferred over ci; else if j > r, then the oracle answers that ci is preferred over cj. Otherwise (that is when ℓ 6 i < j 6 r), if j − ℓ > r − i, then the oracle answers that ci is preferred over cj and changes r to j; if j−ℓ 6 r−i, then the oracle answers that cj is preferred over ci and changes ℓ to i. Hence whenever the oracle answers a query for a voter v, the value of r − ℓ for that voter v decreases by a factor of at most two. Suppose the election instance has an odd number of voters. Let V be the set of voters. Now we claim that the first ⌊n/5⌋ voters must be queried (log m − 1) times each. Suppose not, then consider the first voter v′ that is queried less than (log m − 1) times. Then there exist at least two candidates ct and ct+1 each of which can be placed at the first position of the vote v′. The oracle fixes the candidates at the first positions of all the votes that have not been queried till v′ is queried (and there are at least ⌈4n/5⌉ such votes) in such a way that ⌊n/2⌋ voters in V \ {v′} places some candidate in the left of ct at the first positions and ⌊n/2⌋ voters in V \ {v′} places some candidate in the right of ct+1. If the algorithm outputs ct as the Condorcet winner, then the oracle makes ct+1 the (unique) Condorcet winner by placing ct+1 at the top position of v′, because ct+1 is the unique median in this case. If the algorithm does not output ct as the Condorcet winner, then the oracle makes ct the (unique) Condorcet winner by placing ct at the top position of v′, because ct is the unique median in this case. Hence the algorithm fails to output correctly in both the cases thereby contradicting the correctness of the algorithm. 3.6 Conclusion In this work, we present algorithms for eliciting preferences of a set of voters when the pref- erences are single peaked on a tree thereby significantly extending the work of [Con09]. Moreover, we show non-trivial lower bounds on the number of comparison queries any pref- erence elicitation algorithm would need to ask in a domain of single peaked profiles on a tree. From this, we conclude that our algorithms asks optimal number of comparison queries up to constant factors. Our main finding in this work is the interesting dependencies between the number of comparison queries any preference elicitation algorithm would ask and various pa- rameters of the single peaked tree. For example, our results show that the query complexity for preference elicitation is a monotonically increasing function on the number of leaf nodes in the single peaked tree. On the other hand, the query complexity for preference elicitation 49 does not directly depend on other tree parameters like, maximum degree, minimum degree, path width, diameter etc. We then move on to study query complexity for finding a weak Condorcet winner of a set of votes which is single peaked on a tree. Here, our results show that a weak Condorcet winner can be found with much less number of queries compared to preference elicitation. In the next chapter, we explore the preference elicitation problem again, but for another well-studied domain known as single crossing profiles. 50 Chapter 4 Preference Elicitation for Single Crossing Profiles In this chapter, we consider the domain of single crossing preference profiles and study the query complexity of preference elicitation under various situations. We consider two distinct scenarios: when an ordering of the voters with respect to which the profile is single crossing is known a priori versus when it is unknown. We also consider two different access models: when the votes can be accessed at random, as opposed to when they are coming in a predefined sequence. In the sequential access model, we distinguish two cases when the ordering is known: the first is that the sequence in which the votes appear is also a single-crossing order, versus when it is not. The main contribution of our work is to provide polynomial time algorithms with low query complexity for preference elicitation in all the above six cases. Further, we show that the query complexities of our algorithms are optimal up to constant factors for all but one of the above six cases. 4.1 Introduction Eliciting the preferences of a set of agents is a nontrivial task since we often have a large number of candidates (ranking restaurants for example) and it will be infeasible for the A preliminary version of the work in this chapter was published as [DM16b]: Palash Dey and Neeldhara Misra. Preference elicitation for single crossing domain. In Proc. Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI 2016, New York, NY, USA, 9-15 July 2016, pages 222-228, 2016. 51 agents to rank all of them. Hence it becomes important to elicit the preferences of the agents by asking them (hopefully a small number of) comparison queries only - ask an agent i to compare two candidates x and y. Unfortunately, it turns out that one would need to ask every voter Ω(m log m) queries to know her preference (due to sorting lower bound). However, if the preferences are not completely arbitrary, and admit additional structure, then possibly we can do better. Indeed, an affirmation of this thought comes from the work of [Con09, DM16a], who showed that we can elicit preferences using only O(m) queries per voter if the preferences are single peaked. The domain of single peaked preferences has been found to be very useful in modeling pref- erences in political elections. We, in this work, study the problem of eliciting preferences of a set of agents for another popular domain namely the domain of single crossing profiles. A profile is called single crossing if the voters can be arranged in a complete order ≻ such that for every two candidates x and y, all the voters who prefer x over y appear consecutively in ≻ [Mir71, Rob77]. Single crossing profiles have been extensively used to model income of a set of agents [Rob77, MR81]. The domain is single crossing profiles are also popular among computational social scientists since many computationally hard voting rules become tractable if the underlying preference profile is single crossing [MBC+16]. 4.1.1 Related Work Conitzer and Sandholm show that determining whether we have enough information at any point of the elicitation process for finding a winner under some common voting rules is computationally intractable [CS02]. They also prove in their classic paper [CS05] that one would need to make Ω(mn log m) queries even to decide the winner for many commonly used voting rules which matches with the trivial O(mn log m) upper bound (based on sorting) for preference elicitation in unrestricted domain. A natural question at this point is if these restricted domains allow for better elicitation algorithms as well. The answer to this is in the affirmative, and one can indeed elicit the preferences of the voters using only O(mn) many queries for the domain of single peaked preference profiles [Con09]. Our work belongs to this kind of research– we investigate the number of queries one has to ask for preference elicitation in single crossing domains. When some partial information is available about the preferences, Ding and Lin prove interesting properties of what they call a deciding set of queries [DL13a]. Lu and Boutilier empirically show that several heuristics often work well [LB11b, LB11a]. 52 4.1.2 Single Crossing Domain A preference profile P = (≻1, . . . , ≻n) of n agents or voters over a set C of candidates is called a single crossing profile if there exists a permutation σ ∈ Sn of [n] such that, for every two distinct candidates x, y ∈ C, whenever we have x ≻σ(i) y and x ≻σ(j) y for two integers i and j with 1 6 i < j 6 n, we have x ≻σ(k) y for every i 6 k 6 j. Example 4.1 exhibits an example of a single crossing preference profile. Example 4.1. (Example of single crossing preference profile) Consider a set C of m candidates, corresponding m distinct points on the Real line, a set V of n voters, also corresponding n points on the Real line, and the preference of every voter are based on their distance to the candidates – given any two candidates, every voter prefers the candidate nearer to her (breaking the tie arbitrarily). Then the set of n preferences is single crossing with respect to the ordering of the voters according to the ascending ordering of their positions on the Real line. The following observation is immediate from the definition of single crossing profiles. Observation 4.1. Suppose a profile P is single crossing with respect to an ordering σ ∈ Sn of votes. Then P is single crossing with respect to the ordering ←−σ too. 4.1.3 Single Crossing Width A preference P = (≻1, . . . , ≻n) of n agents or voters over a set C of candidates is called a single crossing profile with width w if the set of candidates C can be partitioned into (Ci)i∈[k] such that Ci 6 w for every i and for every two candidates x ∈ Cℓ and y ∈ Ct with ℓ 6= t from two different subsets of the partition, whenever we have x ≻σ(i) y and x ≻σ(j) y for two integers i and j with 1 6 i < j 6 n, we have x ≻σ(k) y for every i 6 k 6 j. 4.1.4 Our Contribution In this work we present novel algorithms for preference elicitation for the domain of single crossing profiles in various settings. We consider two distinct situations: when an ordering of the voters with respect to which the profile is single crossing is known versus when it is unknown. We also consider different access models: when the votes can be accessed at random, as opposed to when they are coming in a pre-defined sequence. In the sequential access model, we distinguish two cases when the ordering is known: the first is that sequence 53 in which the votes appear is also a single-crossing order, versus when it is not. We also prove lower bounds on the query complexity of preference elicitation for the domain of single crossing profiles; these bounds match the upper bounds up to constant factors (for a large number of voters) for all the six scenarios above except the case when we know a single crossing ordering of the voters and we have a random access to the voters; in this case, the upper and lower bounds match up to a factor of O(m). We summarize our results in Table 6.1. Ordering Access model Known Random Sequential single crossing order Unknown Sequential any order Sequential any order Random Query Complexity Upper Bound O(m2 log n) [Lemma 4.1] O(mn + m2) [Theorem 4.2] O(mn + m2 log n) [Theorem 4.4] O(mn + m3 log m) [Theorem 4.5] O(mn + m3 log m) [Corollary 4.1] Lower Bound Ω(m log m + m log n) [Theorem 4.1] Ω(m log m + mn) [Theorem 4.3] Ω(m log m + mn) [Theorem 4.6] Table 4.1: Summary of Results for preference elicitation for single crossing profiles. We then extend our results to domains which are single crossing of width w in Sec- tion 4.3.3. We also prove that a weak Condorcet winner and the Condorcet winner (if it exists) of a single crossing preference profile can be found out with much less number of queries in Section 4.4. 4.2 Problem Formulation The query and cost model is the same as Definition 3.1 in Chapter 3. We recall it below for ease of access. Suppose we have a profile P with n voters and m candidates. Let us define a function QUERY(x ≻ℓ y) for a voter ℓ and two different candidates x and y to be TRUE if the voter ℓ prefers the candidate x over the candidate y and FALSE otherwise. We now formally define the problem. 54 Definition 4.1. PREFERENCE ELICITATION Given an oracle access to QUERY (·) for a single crossing profile P, find P. For two distinct candidates x, y ∈ C and a voter ℓ, we say a PREFERENCE ELICITATION algorithm Acompares candidates x and y for voter ℓ, if A makes a call to either QUERY(x ≻ℓ y) or QUERY(y ≻ℓ x). We define the number of queries made by the algorithm A, called the query complexity of A, to be the number of distinct tuples (ℓ, x, y) ∈ V × C × C with x 6= y such that the algorithm A compares the candidates x and y for voter ℓ. Notice that, even if the algorithm A makes multiple calls to QUERY (·) with same tuple (ℓ, x, y), we count it only once in the query complexity of A. This is without loss of generality since we can always implement a wrapper around the oracle which memorizes all the calls made to the oracle so far and whenever it receives a duplicate call, it replies from its memory without "actually" making a call to the oracle. We say two query complexities q(m, n) and q′(m, n) are tight up to a factor of ℓ for a large number of voters if 1/ℓ 6 limn→∞ Note that by using a standard sorting routine like merge sort, we can fully elicit an un- q(m,n)/q′(m,n) 6 ℓ. known preference using O(m log m) queries. We state this explicitly below, as it will be useful in our subsequent discussions. Observation 4.2. There is a PREFERENCE ELICITATION algorithm with query complexity O(m log m) for eliciting one vote from a single crossing preference profile. 4.2.1 Model of Input We study two models of input for PREFERENCE ELICITATION for single crossing profiles. ⊲ Random access to voters: In this model, we have a set of voters and we are allowed to ask any voter to compare any two candidates at any point of time. Moreover, we are also allowed to interleave the queries to different voters. Random access to voters is the model of input for elections within an organization where every voter belongs to the organization and can be queried any time. ⊲ Sequential access to voters: In this model, voters are arriving in a sequential manner one after another to the system. Once a voter ℓ arrives, we can query voter ℓ as many times as we like and then we "release" the voter ℓ from the system to access the next voter in the queue. Once voter ℓ is released, it can never be queried again. Sequential 55 access to voters is indeed the model of input in many practical elections scenarios such as political elections, restaurant ranking etc. 4.3 Results for Preference Elicitation In this section, we present our technical results. We first consider the (simpler) situation when one single crossing order is known, and then turn to the case when no single crossing order is a priori known. In both cases, we explore all the relevant access models. 4.3.1 Known Single Crossing Order We begin with a simple PREFERENCE ELICITATION algorithm when we are given a random access to the voters and one single crossing ordering is known. Lemma 4.1. Suppose a profile P is single crossing with respect to a known permutation of the voters. Given a random access to voters, there is a PREFERENCE ELICITATION algorithm with query complexity O(m2 log n). Proof. By renaming, we assume that the profile is single crossing with respect to the identity permutation of the votes. Now, for every (cid:0)m 2(cid:1) pair of candidates {x, y} ⊂ C, we perform a binary search over the votes to find the index i({x, y}) where the ordering of x and y changes. We now know how any voter j orders any two candidates x and y from i({x, y}) and thus we have found P. Interestingly, the simple algorithm in Lemma 4.1 turns out to be optimal up to a multi- plicative factor of O(m) as we prove next. The idea is to "pair up" the candidates and design an oracle which "hides" the vote where the ordering of the two candidates in any pair (x, y) changes unless it receives at least (log m − 1) queries involving only these two candidates x and y. We formalize this idea below. Observe that, when a single crossing ordering of the voters in known, we can assume without loss of generality, by renaming the voters, that the preference profile is single crossing with respect to the identity permutation of the voters. Theorem 4.1. Suppose a profile P is single crossing with respect to the identity permutation of votes. Given random access to voters, any deterministic PREFERENCE ELICITATION algorithm has query complexity Ω(m log m + m log n). 56 Proof. The Ω(m log m) bound follows from the query complexity lower bound of sorting and the fact that any profile consisting of only one preference ≻∈ L(C) is single crossing. Let C = {c1, . . . , cm} be the set of m candidates where m is an even integer. Consider the ordering Q = c1 ≻ c2 ≻ · · · ≻ cm ∈ L(C) and the following pairing of the candidates: {c1, c2}, {c3, c4}, . . . , {cm−1, cm}. Our oracle answers QUERY (·) as follows. The oracle fixes the preferences of the voters one and n to be Q and ←−Q respectively. For every odd integer i ∈ [m], the oracle maintains θi (respectively βi) which corresponds to the largest (respectively smallest) index of the voter for whom (ci, ci+1) has already been queried and the oracle answered that the voter prefers ci over ci+1 (ci+1 over ci respectively). The oracle initially sets θi = 1 and βi = n for every odd integer i ∈ [m]. Suppose oracle receives a query to compare candidates ci and cj for i, j ∈ [m] with i < j for a voter ℓ. If i is an even integer or j − i > 2 (that is, ci and cj belong to different pairs), then the oracle answers that the voter ℓ prefers ci over cj. Otherwise we have j = i + 1 and i is an odd integer. The oracle answers the query to be ci ≻ ci+1 and updates θi to ℓ keeping βi fixed if ℓ − θi 6 ℓ − βi and otherwise answers ci+1 ≻ ci and updates βi to ℓ keeping θi fixed (that is, the oracle answers according to the vote which is closer to the voter ℓ between θi and βi and updates θi or βi accordingly). If the pair (ci, ci+1) is queried less than (log n − 2) times, then we have βi − θi > 2 at the end of the algorithm since every query for the pair (ci, ci+1) decreases βi − θi by at most a factor of two and we started with βi − θi = n − 1. Consider a voter κ with θi < κ < βi. If the elicitation algorithm outputs that the voter κ prefers ci over ci+1 (respectively ci+1 over ci), then the oracle sets all the voters κ′ with θi < κ′ < βi to prefer ci+1 over ci (respectively ci over ci+1). Clearly, the algorithm does not elicit the preference of the voter κ correctly. Also, the profile is single crossing with respect to the identity permutation of the voters and consistent with the answers of all the queries made by the algorithm. Hence, for every odd integer i ∈ [m], the algorithm must make at least (log n − 1) queries for the pair (ci, ci+1) thereby making Ω(m log n) queries in total. We now present our PREFERENCE ELICITATION algorithm when we have a sequential ac- cess to the voters according to a single crossing order. We elicit the preference of the first voter using Observation 4.2. From second vote onwards, we simply use the idea of inser- tion sort relative to the previously elicited vote [Cor09]. Since we are using insertion sort, any particular voter may be queried O(m2) times. However, we are able to bound the query complexity of our algorithm due to two fundamental reasons: (i) consecutive preferences will often be almost similar in a single crossing ordering, (ii) our algorithm takes only O(m) 57 queries to elicit the preference of the current voter if its preference is indeed the same as the preference of the voter preceding it. In other words, every time we have to "pay" for shifting a candidate further back in the current vote, the relative ordering of that candidate with all the candidates that it jumped over is now fixed, because for these pairs, the one permitted crossing is now used up. We begin with presenting an important subroutine called Elicit(·) which finds the preference of a voter ℓ given another preference R by performing an insertion sort using R as the order of insertion. Algorithm 1 Elicit(C, R, ℓ) Input: A set of candidates C = {ci : i ∈ [m]}, an ordering R = c1 ≻ · · · ≻ cm of C, a voter ℓ Output: Preference ordering ≻ℓ of voter ℓ on C 1: Q ← c1 2: for i ← 2 to m do ⊲ Q will be the preference of the voter ℓ ⊲ ci is inserted in the ith iteration Scan Q linearly from index i − 1 to 1 to find the index j where ci should be inserted 3: according to the preference of voter ℓ and insert ci in Q at j 4: end for 5: return Q For the sake of the analysis of our algorithm, let us introduce a few terminologies. Given two preferences ≻1 and ≻2, we call a pair of candidates (x, y) ∈ C × C, x 6= y, good if both ≻1 and ≻2 order them in a same way; a pair of candidates is called bad if it is not good. We divide the number of queries made by our algorithm into two parts: goodCost(·) and badCost(·) which are the number of queries made between good and respectively bad pair of candidates. In what follows, we show that goodCost(·) for Elicit(·) is small and the total badCost(·) across all the runs of Elicit(·) is small. Lemma 4.2. The goodCost(Elicit(C, R, ℓ)) of Elicit(C, R, ℓ) is O(m) (good is with respect to the preferences R and ≻ℓ). Proof. Follows immediately from the observation that in any iteration of the for loop at line 2 in Algorithm 1, only one good pair of candidates are compared. We now use Algorithm 1 iteratively to find the profile. We present the pseudocode in Algorithm 2 which works for the more general setting where a single crossing ordering is known but the voters are arriving in any arbitrary order π. We next compute the query complexity of Algorithm 2 when voters are arriving in a single crossing order. 58 Algorithm 2 PreferenceElicit(π) Input: π ∈ Sn Output: Profile of all the voters 1: Q[π(1)] ← Elicit ≻π(1) using Observation 4.2 2: X ← {π(1)} 3: for i ← 2 to n do 4: 5: k ← minj∈X j − i R ← Q[k], X ← X ∪ {π(i)} Q[π(i)] ← Elicit(C, R, π(i)) 6: 7: end for 8: return Q ⊲ Q stores the profile ⊲ Set of voters' whose preferences have already been elicited ⊲ Elicit the preference of voter π(i) in iteration i ⊲ Find the closest known preference Theorem 4.2. Assume that the voters are arriving sequentially according to an order with respect to which a profile P is single crossing. Then there is a PREFERENCE ELICITATION algorithm with query complexity O(mn + m2). Proof. By renaming, let us assume, without loss of generality, that the voters are arriving according to the identity permutation idn of the voters and the profile P is single crossing with respect to idn. Let the profile P be (P1, P2, . . . , Pn) ∈ L(C)n. For two candidates x, y ∈ C and a voter i ∈ {2, . . . , n}, let us define a variable b(x, y, i) to be one if x and y are compared for the voter i by Elicit(C,Pi−1, i) and (x, y) is a bad pair of candidates with respect to the preferences of voter i and i − 1; otherwise b(x, y, i) is defined to be zero. Then we have the following. CostPreferenceElicit(idn) = O(m log m) + n X i=2 (goodCost(QUERY(C, Pi−1, i)) + badCost(QUERY(C, Pi−1, i))) badCost(QUERY(C, Pi−1, i)) n i=2 6 O(m log m + mn) + X (x,y)∈C×C n = O(m log m + mn) + X X 6 O(m log m + mn) + X (x,y)∈C×C = O(mn + m2) i=2 1 b(x, y, i)! 59 The first inequality follows from Lemma 4.2, the second equality follows from the definition of b(x, y, i), and the second inequality follows from the fact that Pn pair of candidates (x, y) ∈ C since the profile P is single crossing. i=2 b(x, y, i) 6 1 for every We show next that, when the voters are arriving in a single crossing order, the query complexity upper bound in Theorem 4.3 is tight for a large number of voters up to constant factors. The idea is to pair up the candidates in a certain way and argue that the algorithm must compare the candidates in every pair for every voter thereby proving a Ω(mn) lower bound on query complexity. Theorem 4.3. Assume that the voters are arriving sequentially according to an order with re- spect to which a profile P is single crossing. Then any deterministic PREFERENCE ELICITATION algorithm has query complexity Ω(m log m + mn). Proof. The Ω(m log m) bound follows from the fact that any profile consisting of only one preference P ∈ L(C) is single crossing. By renaming, let us assume without loss of generality that the profile P is single crossing with respect to the identity permutation of the voters. Suppose we have an even number of candidates and C = {c1, . . . , cm}. Consider the order Q = c1 ≻ c2 ≻ · · · ≻ cm and the pairing of the candidates {c1, c2}, {c3, c4}, . . . , {cm−1, cm}. The oracle answers all the query requests consistently according to the order Q till the first voter κ for which there exists at least one odd integer i ∈ [m] such that the pair (ci, ci+1) is not queried. If there does not exist any such κ, then the algorithm makes at least mn/2 queries thereby proving the statement. Otherwise, let κ be the first vote such that the algorithm does not compare ci and ci+1 for some odd integer i ∈ [m]. The oracle answers the queries for the rest of the voters {κ + 1, . . . , n} according to the order Q′ = c1 ≻ c2 ≻ · · · ≻ ci−1 ≻ ci+1 ≻ ci ≻ ci+2 ≻ · · · ≻ cm. If the algorithm orders ci ≻κ ci+1 in the preference of the voter κ, then the oracle sets the preference of the voter κ to be Q′. On the other hand, if the algorithm orders ci+1 ≻κ ci in the preference of voter κ, then the oracle sets the preference of voter κ to be Q. Clearly, the elicitation algorithm fails to correctly elicit the preference of the voter κ. However, the profiles for both the cases are single crossing with respect to the identity permutation of the voters and are consistent with the answers given to all the queries made by the algorithm. Hence, the algorithm must make at least mn/2 queries. We next move on to the case when we know a single crossing order of the voters; however, the voters arrive in an arbitrary order π ∈ Sn. The idea is to call the function Elicit(C, R, i) where the current voter is the voter i and R is the preference of the voter which is closest to 60 i according to a single crossing ordering and whose preference has already been elicited by the algorithm. Theorem 4.4. Assume that a profile P is known to be single crossing with respect to a known ordering of voters σ ∈ Sn. However, the voters are arriving sequentially according to an arbitrary order π ∈ Sn which may be different from σ. Then there is a PREFERENCE ELICITATION algorithm with query complexity O(mn + m2 log n). Proof. By renaming, let us assume, without loss of generality, that the profile P is sin- gle peaked with respect to the identity permutation of the voters. Let the profile P be (P1, P2, . . . , Pn) ∈ L(C)n. Let f : [n] −→ [n] be the function such that f(i) is the k correspond- ing to the i at line 4 in Algorithm 2. For candidates x, y ∈ C and voter ℓ, we define b(x, y, ℓ) analogously as in the proof of Theorem 4.2. We claim that B(x, y) = Pn i=2 b(x, y, i) 6 log n. To see this, we consider any arbitrary pair (x, y) ∈ C × C. Let the set of indices of the voters that have arrived immediately after the first time (x, y) contributes to B(x, y) be {i1, i2, . . . , it}. Without loss of generality, let us assume i1 < i2 < · · · < it. Again, without loss of generality, let us assume that voters i1, i2, . . . , ij prefer x over y and voters ij+1, . . . , it prefer y over x. Let us define ∆ to be the difference between smallest index of the voter who prefers y over x and the largest index of the voter who prefers x over y. Hence, we currently have ∆ = ij+1 − ij. A crucial observation is that if a new voter ℓ contributes to B(x, y) then we must necessarily have ij < ℓ < ij+1. Another crucial observation is that whenever a new voter contributes to B(x, y), the value of ∆ gets reduced at least by a factor of two by the choice of k at line 4 in Algorithm 2. Hence, the pair (x, y) can contribute at most (1 + log ∆) = O(log n) to B(x, y) since we have ∆ 6 n to begin with. Then we have the following. 61 CostPreferenceElicit(π) = O(m log m) + n X i=2 goodCost(QUERY(C, Pf(i), i)) + badCost(QUERY(C, Pf(i), i)) n i=2 6 O(m log m + mn) + X = O(m log m + mn) + X (x,y)∈C×C 6 O(m log m + mn) + X (x,y)∈C×C = O(mn + m2 log n) badCost(QUERY(C, Pf(i), i)) n X i=2 b(x, y, i) log n The first inequality follows from Lemma 4.2, the second equality follows from the definition of b(x, y, i), and the second inequality follows from the fact that Pn i=2 b(x, y, i) 6 log n. 4.3.2 Unknown Single Crossing Order We now turn our attention to PREFERENCE ELICITATION for single crossing profiles when no single crossing ordering is known. Before we present our PREFERENCE ELICITATION algorithm for this setting, let us first prove a few structural results about single crossing profiles which we will use crucially later. We begin with showing an upper bound on the number of distinct preferences in any single crossing profile. Lemma 4.3. Let P be a profile on a set C of candidates which is single crossing. Then the number of distinct preferences in P is at most(cid:0)m 2(cid:1) + 1. Proof. By renaming, let us assume, without loss of generality, that the profile P is single cross- ing with respect to the identity permutation of the voters. We now observe that whenever the ith vote is different from the (i + 1)th vote for some i ∈ [n − 1], there must exist a pair of candidates (x, y) ∈ C × C whom the ith vote and the (i + 1)th vote order differently. Now the statement follows from the fact that, for every pair of candidates (a, b) ∈ C × C, there can exist at most one i ∈ [n − 1] such that the ith vote and the (i + 1)th vote order a and b differently. 62 We show next that in every single crossing preference profile P where all the preferences are distinct, there exists a pair of candidates (x, y) ∈ C × C such that nearly half of the voters in P prefer x over y and the other voters prefer y over x. Lemma 4.4. Let P be a preference profile of n voters such that all the preferences are distinct. Then there exists a pair of candidates (x, y) ∈ C such that x is preferred over y in at least ⌊n/2⌋ preferences and y is preferred over x in at least ⌊n/2⌋ preferences in P. Proof. Without loss of generality, by renaming, let us assume that the profile P is single crossing with respect to the identity permutation of the voters. Since all the preferences in P are distinct, there exists a pair of candidates (x, y) ∈ C × C such that the voter ⌊n/2⌋ and the voter ⌊n/2⌋ + 1 order x and y differently. Let us assume, without loss of generality, that the voter ⌊n/2⌋ prefers x over y. Now, since the profile P is single crossing, every voter in [⌊n/2⌋] prefer x over y and every voter in {⌊n/2⌋ + 1, . . . , n} prefer y over x. Using Lemma 4.3 and 4.4 we now design a PREFERENCE ELICITATION algorithm when no single crossing ordering of the voters is known. The overview of the algorithm is as follows. At any point of time in the elicitation process, we have the set Q of all the distinct preferences that we have already elicited completely and we have to elicit the preference of a voter ℓ. We first search the set of votes Q for a preference which is possibly same as the preference ≻ℓ of the voter ℓ. It turns out that we can find a possible match ≻∈ Q using O(log Q) queries due to Lemma 4.4 which is O(log m) due to Lemma 4.3. We then check whether the preference of the voter ℓ is indeed the same as ≻ or not using O(m) queries. If ≻ is the same as ≻ℓ, then we have elicited ≻ℓ using O(m) queries. Otherwise, we elicit ≻ℓ using O(m log m) queries using Observation 4.2. Fortunately, Lemma 4.3 tells us that we would use the algorithm in Observation 4.2 at most O(m2) times. We present the pseudocode of our PREFERENCE ELICITATION algorithm in this setting in Algorithm 4. It uses Algorithm 3 as a subroutine which returns TRUE if the preference of any input voter is same as any given preference. Theorem 4.5. Assume that a profile P is known to be single crossing. However, no ordering of the voters with respect to which P is single crossing is known a priori. The voters are arriving sequentially according to an arbitrary order π ∈ Sn. Then there is a PREFERENCE ELICITATION algorithm with query complexity O(mn + m3 log m). Proof. We present the pesudocode in Algorithm 4. We maintain two arrays in the algorithm. The array R is of length n and the jth entry stores the preference of voter j. The other array 63 Algorithm 3 Same(R, ℓ) Input: R = c1 ≻ c2 ≻ · · · ≻ cm ∈ L(C), ℓ ∈ [n] Output: TRUE if the preference of the ℓth voter is R; FALSE otherwise 1: for i ← 1 to m − 1 do 2: 3: if QUERY (ci ≻ℓ ci+1) = FALSE then end if return FALSE 4: 5: end for 6: return TRUE ⊲ We have found a mismatch. Q stores all the votes seen so far after removing duplicate votes; more specifically, if some specific preference ≻ has been seen ℓ many times for any ℓ > 0, Q stores only one copy of ≻. Upon arrival of voter i, we first check whether there is a preference in Q which is "potentially" same as the preference of voter i. At the beginning of the search, our search space Q′ = Q for a potential match in Q is of size Q. We next iteratively keep halving the search space as follows. We find a pair of candidates (x, y) ∈ C × C such that at least ⌊Q′/2⌋ preferences in Q′ prefer x over y and at least ⌊Q′/2⌋ preferences prefer y over x. The existence of such a pair of candidates is guaranteed by Lemma 4.4 and can be found in O(m2) time by simply going over all possible pairs of candidates. By querying how voter i orders x and y, we reduce the search space Q′ for a potential match in Q to a set of size at most ⌊Q′/2⌋ + 1. Hence, in O(log m) queries, the search space reduces to only one preference since we have Q 6 m2 by Lemma 4.3. Once we find a potential match w in Q (line 12 in Algorithm 4), we check whether the preference of voter i is the same as w or not using O(m) queries. If the preference of voter i is indeed same as w, then we output w as the preference of voter i. Otherwise, we use Observation 4.2 to elicit the preference of voter i using O(m log m) queries and put the preference of voter i in Q. Since the number of times we need to use the algorithm in Observation 4.2 is at most the number of distinct votes in P which is known to be at most m2 by Lemma 4.3, we get the statement. Theorem 4.5 immediately gives us the following corollary in the random access to voters model when no single crossing ordering is known. Corollary 4.1. Assume that a profile P is known to be single crossing. However, no ordering of the voters with respect to which P is single crossing is known. Given a random access to voters, there is a PREFERENCE ELICITATION algorithm with query complexity O(mn + m3 log m). 64 3: 4: 5: ⊲ Q stores all the votes seen so far without duplicate. R stores the profile. ⊲ Elicit preference of the ith voter in ith iteration of this for loop. Algorithm 4 PreferenceElicitUnknownSingleCrossingOrdering(π) Input: π ∈ Sn Output: Profile of all the voters 1: R, Q ← ∅ 2: for i ← 1 to n do Q′ ← Q while Q′ > 1 do ⊲ Search Q to find a vote potentially same as the preference of π(i) Let x, y ∈ C be two candidates such that at least ⌊Q′/2⌋ votes in Q′ prefer x over y if QUERY (x ≻π(i) y) = TRUE then Q′ ← {v ∈ Q′ : v prefers x over y} else Q′ ← {v ∈ Q′ : v prefers y oer x} and at least ⌊Q′/2⌋ votes in Q′ prefer y over x. end if end while Let w be the only vote in Q′ ⊲ w is potentially same as the preference of π(i) if Same(w, π(i)) = TRUE then ⊲ Check whether the vote π(i) is potentially same as w 8: 9: 6: 7: 10: else R[π(i)] ← w R[π(i)] ← Elicit using Observation 4.2 Q ← Q ∪ {R[π(i)]} 11: 12: 13: 14: 15: 16: 17: end if 18: 19: end for 20: return R Proof. Algorithm 4 works for this setting also and exact same bound on the query complexity holds. We now show that the query complexity upper bound of Corollary 4.1 is tight up to con- stant factors for large number of voters. Theorem 4.6. Given a random access to voters, any deterministic PREFERENCE ELICITATION algorithm which do not know any ordering of the voters with respect to which the input profile is single crossing has query complexity Ω(m log m + mn). Proof. The Ω(m log m) bound follows from sorting lower bound and the fact that any profile consisting of only one preference P ∈ L(C) is single crossing. Suppose we have an even number of candidates and C = {c1, . . . , cm}. Consider the ordering Q = c1 ≻ c2 ≻ · · · ≻ cm and the pairing of the candidates {c1, c2}, {c3, c4}, . . . , {cm−1, cm}. The oracle answers all the query requests consistently according to the ordering Q. We claim that any PREFERENCE 65 ELICITATION algorithm A must compare ci and ci+1 for every voter and for every odd integer Indeed, otherwise, there exist a voter κ and an odd integer i ∈ [m] such that i ∈ [m]. the algorithm A does not compare ci and ci+1. Suppose the algorithm outputs a profile P′. If the voter κ prefers ci over ci+1 in P′, then the oracle fixes the preference ≻κ to be c1 ≻ c2 ≻ · · · ≻ ci−1 ≻ ci+1 ≻ ci ≻ ci+2 ≻ · · · ≻ cm; otherwise the oracle fixes ≻κ to be Q. The algorithm fails to correctly output the preference of the voter κ in both the cases. Also the final profile with the oracle is single crossing with respect to any ordering of the voters that places the voter κ at the end. Hence, A must compare ci and ci+1 for every voter and for every odd integer i ∈ [m] and thus has query complexity Ω(mn). 4.3.3 Single Crossing Width We now consider preference elicitation for profiles which are nearly single crossing. We begin with profiles with bounded single crossing width. Proposition 4.1. Suppose a profile P is single crossing with width w. Given a PREFERENCE ELICITATION algorithm A with query complexity q(m, n) for random (or sequential) access to the voters when a single crossing order is known (or unknown), there exists a PREFERENCE ELIC- ITATION algorithm A′ for the single crossing profiles with width w which has query complexity O(q(m/w, n) + mn log w) under same setting as A. Proof. Let the partition of the set of candidates C with respect to which the profile P is single crossing be Ci, i ∈ [⌈m/w⌉]. Hence, C = ∪i∈[⌈m/w⌉]Ci and Ci ∩ Cj = ∅ for every i, j ∈ [⌈m/w⌉] with i 6= j. Let C′ be a subset of candidates containing exactly one candidate from Ci for each i ∈ [⌈m/w⌉]. We first find P(C′) using A. The query complexity of this step is O(q(m/w, n)). Next we find P(Ci) using Observation 4.2 for every i ∈ [m/w] thereby finding P. The overall query complexity is O(q(m/w, n) + (m/w)nw log w) = O(q(m/w, n) + mn log w). From Proposition 4.1, Lemma 4.1, Theorem 4.2, 4.4 and 4.5, and Corollary 4.1 we get the following. Corollary 4.2. Let a profile P be single crossing with width w. Then there exists a PREFERENCE ELICITATION algorithm with query complexity O((m2/w) log(n/w) + mn log w) for known single crossing order and random access to votes, O(m2/w2 + mn log w) for sequential access to votes according to a single crossing order, O((m2/w2) log(n/w) + mn log w) for known single crossing order but arbitrary sequential access to votes, O(m3/w3 log(m/w) + mn log w) for unknown single crossing order and arbitrary sequential access to votes or random access to votes. 66 4.4 Results for Condorcet Winner Lemma 4.5. Let an n voter profile P is single crossing with respect to the ordering v1, v2, . . . , vn. Then the candidate which is placed at the top position of the vote v⌈n/2⌉ is a weak Condorcet winner. Proof. Let c be the candidate which is placed at the top position of the vote v⌈n/2⌉ and w be any other candidate. Now the result follows from the fact that either all the votes in {vi : 1 6 i 6 ⌈n/2⌉} prefer c to w or all the votes in {vi : ⌈n/2⌉ 6 i 6 n} prefer c to w. Lemma 4.5 immediately gives the following. Corollary 4.3. Given either sequential or random access to votes, there exists a WEAK CON- DORCET WINNER algorithm with query complexity O(m) when a single crossing ordering is known. Proof. Since we know a single crossing ordering v1, v2, . . . , vn, we can find the candidate at the first position of the vote v⌈n/2⌉ (which is a weak Condorcet winner by Lemma 4.5) by making O(m) queries. We now move on to finding the Condorcet winner. We begin with the following observa- tion regarding existence of the Condorcet winner of a single crossing preference profile. Lemma 4.6. Let an n voter profile P is single crossing with respect to the ordering v1, v2, . . . , vn. If n is odd, then the Condorcet winner is the candidate placed at the first position of the vote v⌈n/2⌉. If n is even, then there exists a Condorcet winner if and only there exists a candidate which is placed at the first position of both the votes vn/2 and vn/2+1. Proof. If n is odd, the result follows from Lemma 4.5 and the fact that a candidate c is a Condorcet winner if and only if c is a weak Condorcet winner. Now suppose n is even. Let a candidate c is placed at the first position of the votes vn/2 and vn/2+1. Then for every candidate x ∈ C \ {c}, either all the votes in {vi : 1 6 i 6 n/2 + 1} or all the votes in {vi : n/2 6 i 6 n} prefer c over x. Hence, c is a Condorcet winner. Now suppose a candidate w is a Condorcet winner. Then we prove that w must be placed at the first position of both the votes vn/2 and vn/2+1. If not, then both the two candidates placed at the first positions of the votes vn/2 and vn/2+1 are weak Condorcet winners according to Lemma 4.5 applied to single crossing orders v1, v2, . . . , vn and vn, vn−1, . . . , v1. 67 Lemma 4.6 immediately gives us the following. Corollary 4.4. Given either sequential or random access to votes, there exists a WEAK CON- DORCET WINNER algorithm with query complexity O(m) when a single crossing ordering is known. Proof. Since we know a single crossing ordering v1, v2, . . . , vn, we can find the candidates which are placed at the first positions of the votes vn/2 and vn/2+1 by making O(m) queries. Now the result follows from Lemma 4.6. 4.5 Conclusion In this work, we have presented PREFERENCE ELICITATION algorithms with low query com- plexity for single crossing profiles under various settings. Moreover, we have proved that the query complexity of our algorithms are tight for a large number of voters up to constant factors for all but one setting namely when the voters can be accessed randomly but we do not know any ordering with respect to which the voters are single crossing. We then move on to show that a weak Condorcet winner and the Condorcet winner (if one exists) can be found from a single crossing preference profile using much less number of queries. With this, we conclude the first part of the thesis. In the next part of the thesis, we study the problem of finding a winner of an election under various real world scenarios. 68 Part II Winner Determination In the second part of the thesis, we present our work on determining the winner of an election under various circumstances. This part consists of the following chapters. ⊲ In Chapter 5 – Winner Prediction and Margin of Victory Estimation – we present efficient algorithms based on sampling to predict the winner of an election and its robustness. We prove that both the problems of winner prediction and robustness estimation can be solved simultaneously by sampling only a few votes uniformly at random. ⊲ In Chapter 6 – Streaming Algorithms for Winner Determination – we develop (often) optimal algorithms for determining the winner of an election when the votes are ar- riving in a streaming fashion. Our results show that an approximate winner can be determined fast with a small amount of space. ⊲ In Chapter 7 – Kernelization for Possible Winner and Coalitional Manipulation – we present interesting results on kernelization for determining possible winners from a set of incomplete votes. Our results prove that the problem of determining possible winners with incomplete votes does not have any efficient preprocessing strategies un- der plausible complexity theoretic assumptions even when the number of candidates is relatively small. We also present efficient kernelization algorithms for the problem of manipulating an election. 69 Chapter 5 Winner Prediction and Margin of Victory Estimation Predicting the winner of an election and estimating the margin of victory of that elec- tion are favorite problems both for news media pundits and computational social choice theorists. Since it is often infeasible to elicit the preferences of all the voters in a typical prediction scenario, a common algorithm used for predicting the winner and estimating the margin of victory is to run the election on a small sample of randomly chosen votes and predict accordingly. We analyze the performance of this algorithm for many commonly used voting rules. More formally, for predicting the winner of an election, we introduce the (ε, δ)- WINNER DETERMINATION problem, where given an election E on n voters and m can- didates in which the margin of victory is at least εn votes, the goal is to determine the winner with probability at least 1 − δ where ε and δ are parameters with 0 < ε, δ < 1. The margin of victory of an election is the smallest number of votes that need to be modified in order to change the election winner. We show interesting lower and upper bounds on the number of samples needed to solve the (ε, δ)-WINNER DETERMINATION problem for many A preliminary version of the work on winner prediction in this chapter was published as [DB15]: Palash Dey and Arnab Bhattacharyya. Sample complexity for winner prediction in elections. In Proceedings of the 2015 International Conference on Autonomous Agents and Multiagent Systems, AAMAS 2015, Istanbul, Turkey, May 4-8, 2015, pages 1421-1430, 2015. A preliminary version of the work on the estimation of margin of victory in this chapter was published as [DN15b]: Palash Dey and Y. Narahari. Estimating the margin of victory of an election using sampling. In Proceedings of the Twenty-Fourth International Joint Conference on Artificial Intelligence, IJCAI 2015, Buenos Aires, Argentina, July 25-31, 2015, pages 1120-1126, 2015. 71 common voting rules, including all scoring rules, approval, maximin, Copeland, Bucklin, plurality with runoff, and single transferable vote. Moreover, the lower and upper bounds match for many common voting rules up to constant factors. For estimating the margin of victory of an election, we introduce the (c, ε, δ)–MARGIN OF VICTORY problem, where given an election E on n voters, the goal is to estimate the margin of victory M(E) of E within an additive error of cM(E) + εn with probability of er- ror at most δ where ε, δ, and c are the parameters with 0 < ε, δ < 1 and c > 0. We exhibit interesting bounds on the sample complexity of the (c, ε, δ)–MARGIN OF VICTORY problem for many commonly used voting rules including all scoring rules, approval, Bucklin, max- imin, and Copelandα. We observe that even for the voting rules for which computing the margin of victory is NP-hard, there may exist efficient sampling based algorithms for esti- mating the margin of victory, as observed in the cases of maximin and Copelandα voting rules. 5.1 Introduction In many situations, one wants to predict the winner without holding the election for the entire population of voters. The most immediate such example is an election poll. Here, the pollster wants to quickly gauge public opinion in order to predict the outcome of a full-scale election. For political elections, exit polls (polls conducted on voters after they have voted) are widely used by news media to predict the winner before official results are announced. In surveys, a full-scale election is never conducted, and the goal is to determine the winner, based on only a few sampled votes, for a hypothetical election on all the voters. For instance, it is not possible to force all the residents of a city to fill out an online survey to rank the local Chinese restaurants, and so only those voters who do participate have their preferences aggregated. If the result of the poll or the survey has to reflect the true election outcome, it is obviously necessary that the number of sampled votes not be too small. Here, we investigate this fundamental question: What is the minimum number of votes that need to be sampled so that the winner of the election on the sampled votes is the same as the winner of the election on all the votes? 72 This question can be posed for any voting rule. The most immediate rule to study is the plurality voting rule, where each voter votes for a single candidate and the candidate with most votes wins. Although the plurality rule is the most common voting rule used in political elections, it is important to extend the analysis to other popular voting rules. For example, the single transferable vote is used in political elections in Australia, India and Ireland, and it was the subject of a nationwide referendum in the UK in 2011. The Borda voting rule is used in the Icelandic parliamentary elections. Outside politics, in private companies and competitions, a wide variety of voting rules are used. For example, the approval voting rule has been used by the Mathematical Association of America, the American Statistical Institute, and the Institute of Electrical and Electronics Engineers, and Condorcet consistent voting rules are used by many free software organizations. A voting rule is called anonymous if the winner does not change after any renaming of the voters. All popular voting rules including the ones mentioned before are anonymous. For any anonymous voting rule, the question of finding the minimum number of vote samples required becomes trivial if a single voter in the election can change the winning candidate. In this case, all the votes need to be counted, because otherwise that single crucial vote may not be sampled. We get around this problem by assuming that in the elections we consider, the winning candidate wins by a considerable margin of victory. Formally, the margin of victory of an election is defined as the minimum number of votes that must be changed in order to change the election winner. Note that the margin of victory depends not only on the votes cast but also on the voting rule used in the election. Other than predicting the winner of an election, one may also like to know how robust the election outcome is with respect to the changes in votes [SYE13, CPS14, RGMT06]. One way to capture robustness of an election outcome is the margin of victory of that election. An election outcome is considered to be robust if the margin of victory of that election is large. In addition to formalizing the notion of robustness of an election outcome, the margin of victory of an election plays a crucial role in many practical applications. One such example is post election audits - methods to observe a certain number of votes (which is often se- lected randomly) after an election to detect an incorrect outcome. There can be a variety of reasons for an incorrect election outcome, for example, software or hardware bugs in vot- ing machine [NL07], machine output errors, use of various clip-on devices that can tamper with the memory of the voting machine [WWH+10], human errors in counting votes. Post election audits have nowadays become common practice to detect problems in electronic 73 voting machines in many countries, for example, USA. As a matter of fact, at least thirty states in the USA have reported such problems by 2007 [NL07]. Most often, the auditing process involves manually observing some sampled votes. Researchers have subsequently proposed various risk limiting auditing methodologies that not only minimize the cost of manual checking, but also limit the risk of making a human error by sampling as few votes as possible [Sta08a, Sta08b, Sta09, SCS11]. The sample size in a risk limiting audit critically depends on the margin of victory of the election. Another important application where the margin of victory plays an important role is polling. One of the most fundamental questions in polling is: how many votes should be sampled to be able to correctly predict the outcome of an election? It turns out that the sample complexity in polling too crucially depends on the margin of victory of the election from which the pollster is sampling [CEG95, DB15]. Hence, computing (or at least approximating sufficiently accurately) the margin of victory of an election is often a necessary task in many practical applications. However, in many applications including the ones discussed above, one cannot observe all the votes. For example, in a survey or polling, one cannot first observe all the votes to compute the margin of victory and then sample the required number of votes based on the margin of victory computed. Hence, one often needs a "good enough" estimate of the margin of victory by observing a small number votes. We precisely address this problem: estimate the margin of victory of an election by sampling as few votes as possible. 5.1.1 Our Contribution In this work, we show nontrivial bounds for the sample complexity of predicting the winner of an election and estimating the margin of victory of an election for many commonly used voting rules. 5.1.1.1 Winner Prediction Let n be the number of voters, m the number of candidates, and r a voting rule. We introduce and study the following problem in the context of winner prediction: Definition 5.1. ((ε, δ)-WINNER DETERMINATION) Given a r-election E whose margin of victory is at least εn, determine the winner of the election with probability at least 1 − δ. (The probability is taken over the internal coin tosses of the algorithm.) 74 We remind the reader that there is no assumption about the distribution of votes in this problem. Our goal is to solve the (ε, δ)-WINNER DETERMINATION problem by a randomized algorithm that is allowed to query the votes of arbitrary voters. Each query reveals the full vote of the voter. The minimum number of votes queried by any algorithm that solves the (ε, δ)-WINNER DETERMINATION problem is called the sample complexity of this problem. The sample complexity can of course depend on ε, δ, n, m, and the voting rule in use. on 2 candidates requires at least (1/4ε2) ln( A standard result in [CEG95] implies that solving the above problem for the majority rule 8e√πδ) samples (Theorem 5.1). Also, a straight- forward argument (Theorem 5.3) using Chernoff bounds shows that for any homogeneous voting rule, the sample complexity is at most (9m!2/2ε2) ln(2m!/δ). So, when m is a constant, 1 the sample complexity is of the order Θ((1/ε2) ln(1/δ)) for any homogeneous voting rule that reduces to the majority voting rule on 2 candidates and this bound is tight up to constant fac- tors. We note that all the commonly used voting rules including the ones we study here, are homogeneous and they reduce to the majority voting rule when we have only 2 candidates. Note that this bound is independent of n if ε and δ are independent of n. Our main technical contribution is in understanding the dependence of the sample com- plexity on the number of candidates m. Note that the upper bound cited above has very bad dependence on m and is clearly unsatisfactory in situations when m is large (such as in online surveys about restaurants). ⊲ We show that the sample complexity of the (ε, δ)-WINNER DETERMINATION problem is at most (9/2ε2) ln(2k/δ) for the k-approval voting rule (Theorem 5.6) and at most (27/ε2) ln(4/δ) for the plurality with runoff voting rule (Theorem 5.11). In particular, for the plurality rule, the sample complexity is independent of m as well as n. ⊲ We show that the sample complexity of the (ε, δ)-WINNER DETERMINATION problem is at most (9/2ε2) ln(2m/δ) and Ω ((1 − δ)(1/ε2) ln m) for the Borda (Theorem 5.2), approval (Theorem 5.4), maximin (Theorem 6.6), and Bucklin (Theorem 5.10) voting rules. Note that when δ is a constant, the upper and lower bounds match up to constant factors. ⊲ We show a sample complexity upper bound of (25/2ε2) ln3(m/δ) for the (ε, δ)- WINNER DETERMINATION problem for the Copelandα voting rule (Theorem 5.9) and (3m2/ε2)(m ln 2 + ln(2m/δ)) for the STV voting rule (Theorem 5.12). We summarize these results in Table 5.1. 75 Voting rules Sample complexity for (ε, δ)-WINNER DETERMINATION Upper bounds Lower bounds k-approval (9/2ε2) ln(2k/δ) [Theorem 5.6] k-veto (9/2ε2) ln(2k/δ) [Theorem 5.7] Ω ((ln(k+1)/ε2) (1 − δ))§ [Theorem 5.2] (1/4ε2) ln(1/8e√πδ)∗ [Corollary 5.1] Scoring rules Borda Approval Maximin Copeland Bucklin (9/2ε2) ln(2m/δ) [Theorem 5.5] (9/2ε2) ln(2m/δ) [Theorem 5.4] Ω ((ln m/ε2) (1 − δ))† (9/2ε2) ln(2m/δ) [Theorem 6.6] [Theorem 5.2] (25/2ε2) ln3(2m/δ) [Theorem 5.9] (9/2ε2) ln(2m/δ) [Theorem 5.10] Plurality with runoff (27/ε2) ln(4/δ) [Theorem 5.11] STV (3m2/ε2)(m ln 2 + ln(2m/δ)) [Theorem 5.12] Any homogeneous voting rule (9m!2/2ε2) ln(2m!/δ) [Theorem 5.3] (1/4ε2) ln(1/8e√πδ)∗ [Corollary 5.1] Table 5.1: Sample complexity of the (ε, δ)-WINNER DETERMINATION problem for common voting rules. †–The lower bound of Ω((ln m/ε2) (1 − δ)) also applies to any voting rule that is Condorcet consistent. ∗– The lower bound of (1/4ε2) ln(1/8e√πδ) holds for any voting rule that reduces to the plurality voting rule for elections with two candidates. §– The lower bound holds for k 6 .999m. 76 5.1.1.2 Estimating Margin of Victory The margin of victory of an election is defined as follows. Definition 5.2. Margin of Victory (MOV) Given an election E, the margin of victory of E is defined as the smallest number of votes that must be changed to change the winner of the election E. We abbreviate margin of victory as MOV. We denote the MOV of an election E by M(E). We introduce and study the following computational problem for estimating the margin of victory of an election: Definition 5.3. ((c, ε, δ)–MARGIN OF VICTORY(MOV )) Given a r-election E, determine the margin of victory Mr(E) of E, within an additive error of at most cMr(E) + εn with probability at least 1 − δ. The probability is taken over the internal coin tosses of the algorithm. Our goal here is to solve the (c, ε, δ)–MARGIN OF VICTORY problem by observing as few sample votes as possible. Our main technical contribution is to come up with efficient sam- pling based polynomial time randomized algorithms to solve the (c, ε, δ)–MARGIN OF VICTORY problem for common voting rules. Each sample reveals the entire preference order of the sampled vote. We summarize the results on the (c, ε, δ)–MARGIN OF VICTORY problem in Table 5.2. Table 5.2 shows a practically appealing positive result - the sample complexity of all the algorithms presented here is independent of the number of voters. Our lower bounds on the sample complexity of the (c, ε, δ)–MARGIN OF VICTORY problem for all the voting rules studied here match with the upper bounds up to constant factors when we have a constant number of candidates. Moreover, the lower and upper bounds on the sample complexity for the k- approval voting rule match up to constant factors irrespective of number of candidates, when k is a constant. ⊲ We show a sample complexity lower bound of ((1−c)2/36ε2) ln (1/8e√πδ) for the (c, ε, δ)– MARGIN OF VICTORY problem for all the commonly used voting rules, where c ∈ [0, 1) (Theorem 5.13 and Corollary 5.3). ⊲ We show a sample complexity upper bound of (12/ε2) ln(2m/δ) for the (1/3, ε, δ)–MARGIN OF VICTORY problem for arbitrary scoring rules (Theorem 5.14). However, for a special 77 Voting rules Sample complexity for (c, ε, δ)–MARGIN OF VICTORY Upper bounds Lower bounds Scoring rules (1/3, ε, δ)–MOV, (12/ε2) ln(2m/δ) [Theorem 5.14] k-approval (0, ε, δ)–MOV, (12/ε2) ln(2k/δ), [Theorem 5.15] (c, ε, δ)–MOV†, Approval (0, ε, δ)–MOV, (12/ε2) ln(2m/δ), [Theorem 5.16] ((1−c)2/36ε2) ln (1/8e√πδ), Bucklin (1/3, ε, δ)–MOV, (12/ε2) ln(2m/δ), [Theorem 5.17] Maximin (1/3, ε, δ)–MOV, (24/ε2) ln(2m/δ), [Theorem 5.18] Copelandα (1 − O (1/ln m) , ε, δ)–MOV, (96/ε2) ln(2m/δ), [Theorem 5.19] [Theorem 5.13] [Corollary 5.3] Table 5.2: Sample complexity for the (c, ε, δ)–MARGIN OF VICTORY problem for common voting rules. †The result holds for any c ∈ [0, 1). class of scoring rules, namely, the k-approval voting rules, we prove a sample com- plexity upper bound of (12/ε2) ln(2k/δ) for the (0, ε, δ)–MARGIN OF VICTORY problem (Theorem 5.15). One key finding of our work is that, there may exist efficient sampling based polynomial time algorithms for estimating the margin of victory, even if computing the margin of victory is NP-hard for a voting rule [Xia12], as observed in the cases of maximin and Copelandα voting rules. 5.1.2 Related Work The subject of voting is at the heart of (computational) social choice theory, and there is a vast amount of literature in this area. Elections take place not only in human societies but also in man made social networks [BBCV09, RSW+07] and, generally, in many multiagent systems [ER91, PHG00]. The winner determination problem is the task of finding the winner in an election, given the voting rule in use and the set of all votes cast. It is known that there are natural voting rules, e.g., Kemeny's rule and Dodgson's method, for which the winner determination problem is NP-hard [BITT89, HSV05, HHR97]. The basic model of election has been generalized in several other ways to capture real world situations. One important consideration is that the votes may be incomplete 78 rankings of the candidates and not a complete ranking. There can also be uncertainty over which voters and/or candidates will eventually turn up. The uncertainty may ad- ditionally come up from the voting rule that will be used eventually to select the win- ner. In these incomplete information settings, several winner models have been proposed, for example, robust winner [BLOP14, LB11a, SYE13], multi winner [LB13], stable win- ner [FMT12], approximate winner [DLC14], probabilistic winner [BBF10], possible win- ner [MBC+16, DMN15b, DMN16c]. Hazon et al. [HAKW08] proposed useful methods to evaluate the outcome of an election under various uncertainties. We do not study the role of uncertainty in this work. The general question of whether the outcome of an election can be determined by less than the full set of votes is the subject of preference elicitation, a central category of prob- lems in AI. The (ε, δ)-WINNER DETERMINATION problem also falls in this area when the elections are restricted to those having margin of victory at least εn. For general elec- tions, the preference elicitation problem was studied by Conitzer and Sandholm [CS02], who defined an elicitation policy as an adaptive sequence of questions posed to voters. They proved that finding an efficient elicitation policy is NP-hard for many common vot- ing rules. Nevertheless, several elicitation policies have been developed in later work [Con09, LB11a, LB11b, DL13b, OFB13, DM16a, DM16b] that work well in practice and have formal guarantees under various assumptions on the vote distribution. Another related work is that of Dhamal and Narahari [DN13] who show that if the voters are members of a social network where neighbors in the network have similar candidate votes, then it is possible to elicit the votes of only a few voters to determine the outcome of the full election. In contrast, in our work on winner prediction, we posit no assumption on the vote distri- bution other than that the votes create a substantial margin of victory for the winner. Under this assumption, we show that even for voting rules in which winner determination is NP- hard in the worst case, it is possible to sample a small number of votes to determine the winner. Our work falls inside the larger framework of property testing [Ron01], a class of problems studied in theoretical computer science, where the inputs are promised to either satisfy some property or have a "gap" from instances satisfying the property. In our case, the instances are elections which either have some candidate w as the winner or are "far" from having w being the winner (in the sense that many votes need to be changed). There have been quite a few work on computing the margin of victory of an election. Most prominent among them is the work of Xia [Xia12]. Xia presents polynomial time algorithms 79 for computing the margin of victory of an election for various voting rules, for example the scoring rules, and proved intractability results for several other voting rules, for example the maximin and Copelandα voting rules. Magrino et al. [MRSW11] present approximation algo- rithms to compute the margin of victory for the instant runoff voting (IRV) rule. Cary [Car11] provides algorithms to estimate the margin of victory of an IRV election. Endriss et al. [EL14] compute the complexity of exact variants of the margin of victory problem for Schulze, Cup, and Copeland voting rules. However, all the existing algorithms to either compute or esti- mate the margin of victory need to observe all the votes, which defeats the purpose in many applications including the ones we discussed. We, in this work, show that we can estimate the margin of victory of an election for many commonly used voting rules quite accurately by sampling a few votes only. Moreover, the accuracy of our estimation algorithm is good enough for many practical scenarios. For example, Table 5.2 shows that it is enough to select only 3600 many votes uniformly at random to estimate MOV n of a plurality election within an addi- tive error of 0.1 with probability at least 0.99, where n is the number of votes. We note that in all the sampling based applications we discussed, the sample size is inversely proportional to MOV n [CEG95] and thus it is enough to estimate MOV The problem of finding the margin of victory in an election is the same as the optimization n accurately (see Table 5.1). version of the destructive bribery problem introduced by Faliszewski et al. [FHH06, FHH09]. However, to the best of our knowledge, there is no prior work on estimating the cost of bribery by sampling votes. 5.2 Results for Winner Prediction In this section, we present our results for the (ε, δ)-WINNER DETERMINATION problem. 5.2.1 Results on Lower Bounds We begin with presenting our lower bounds for the (ε, δ)-WINNER DETERMINATION problem for various voting rules. Our lower bounds for the sample complexity of the (ε, δ)-WINNER DETERMINATION problem are derived from information-theoretic lower bounds for distin- guishing distributions. We start with the following basic observation. Let X be a random variable taking value 1 2 + ε; Y be a random variable taking value 1 2 − ε and 0 with probability 1 with probability 1 80 with probability 1 needs at least 1 4ε2 ln 2 + ε and 0 with probability 1 2 − ε. Then, it is known that every algorithm 8e√πδ many samples to distinguish between X and Y with probability of 1 making an error being at most δ [CEG95, BYKS01]. We immediately have the following: Theorem 5.1. The sample complexity of the (ε, δ)-WINNER DETERMINATION problem for the plurality voting rule is at least 1 4ε2 ln 1 8e√πδ even when the number of candidates is 2. Proof. Consider an election with two candidates a and b. Consider two vote distributions X and Y. In X, exactly 1 2 + ε fraction of voters prefer a to b and thus a is the plurality winner of the election. In Y, exactly 1 2 + ε fraction of voters prefer b to a and thus b is the plurality winner of the election. Also, the margin of victory of both the elections corresponding to the vote distributions X and Y is εn, since each vote change can change the plurality score of any candidate by at most one. Observe that any (ε, δ)-WINNER DETERMINATION algorithm for plurality will give us a distinguisher between the distributions X and Y with probability of error at most δ. and hence will need 1 1 4ε2 ln 8e√πδ samples. Theorem 5.1 immediately gives us the following sample complexity lower bounds for the (ε, δ)-WINNER DETERMINATION problem for other voting rules. Corollary 5.1. Every (ε, δ)-WINNER DETERMINATION algorithm needs at least 1 8e√πδ sam- ples for any voting rule which reduces to the plurality rule for two candidates. In particular, the 4ε2 ln 1 lower bound holds for approval, scoring rules, maximin, Copeland, Bucklin, plurality with runoff, and STV voting rules. Proof. All the voting rules mentioned in the statement except the approval voting rule is same as the plurality voting rule for elections with two candidates. Hence, the result follows immediately from Theorem 5.1 for the above voting rules except the approval voting rule. The result for the approval voting rule follows from the fact that any arbitrary plurality election is also a valid approval election where every voter approves exactly one candidate. We derive stronger lower bounds in terms of m by explicitly viewing the (ε, δ)-WINNER DETERMINATION problem as a statistical classification problem. In this problem, we are given a black box that contains a distribution µ which is guaranteed to be one of ℓ known distributions µ1, . . . , µℓ. A classifier is a randomized oracle which has to determine the identity of µ, where each oracle call produces a sample from µ. At the end of its execution, the classifier announces a guess for the identity of µ, which has to be correct with probability at least 1 − δ. Using information-theoretic methods, Bar-Yossef [BY03] showed the following: 81 Lemma 5.1. The worst case sample complexity q of a classifier C for ℓ probability distributions µ1, . . . , µℓ which does not make error with probability more than δ satisfies following. q > Ω(cid:18) ln ℓ JS (µ1, . . . , µℓ) . (1 − δ)(cid:19) The connection with our problem is the following. A set V of n votes on a candidate set C generates a probability distribution µV on L(C), where µV (≻) is proportional to the number of voters who vote ≻. Querying a random vote from V is then equivalent to sampling from the distribution µV . The margin of victory is proportional to the minimum statistical distance between µV and µW, over all the voting profiles W having a different winner than the winner of V. Now suppose we have m voting profiles V1, . . . , Vm having different winners such that each Vi has margin of victory at least εn. Any (ε, δ)-WINNER DETERMINATION algorithm must also be a statistical classifier for µV1, . . . , µVm in the above sense. It then remains to con- struct such voting profiles for various voting rules which we do in the proof of the following theorem: Theorem 5.2. Every (ε, δ)-WINNER DETERMINATION algorithm needs Ω(cid:0) ln m for approval, Borda, Bucklin, and any Condorcet consistent voting rules, and Ω(cid:0) ln k samples for the k-approval voting rule for k 6 cm for any constant c ∈ (0, 1). Proof. For each voting rule mentioned in the theorem, we will show d (d = k + 1 for the ε2 . (1 − δ)(cid:1) samples ε2 . (1 − δ)(cid:1) k-approval voting rule and d = m for the rest of the voting rules) distributions µ1, . . . , µd on the votes with the following properties. Let Vi be an election where each vote v ∈ L(C) occurs exactly µi(v) · n many times. Let µ = 1 i=1 µi. d Pd 1. For every i 6= j, the winner in Vi is different from the winner in Vj. 2. For every i, the margin of victory of Vi is Ω(εn). 3. DKL(µiµ) = O(ε2) The result then follows from Lemma 5.1. The distributions for different voting rules are as follows. Let the candidate set be C = {c1, . . . , cm}. ⊲ k-approval voting rule for k 6 cm for any constant c ∈ (0, 1): Fix any arbitrary M := k + 1 many candidates c1, . . . , cM. For i ∈ [M], we define a distribution µi on all 82 k sized subsets of C (for the k-approval voting rule, each vote is a k-sized subset of C) as follows. Each k sized subset corresponds to top k candidates in a vote. µi(x) =   (ε/(M−1 k−1 )) + (1−ε/(M k )) (1−ε)/(M k ) 0 if ci ∈ x and x ⊆ {c1, . . . , cM} ci /∈ x and x ⊆ {c1, . . . , cM} else The score of ci in Vi is n(cid:0)ε + (1−ε)(M−1 k−1 )/(M {c1, . . . , cM} \ {ci} is n(1−ε)(M−1 k ), and the score of the rest of the candidates is zero. Hence, the margin of victory is Ω(εn), since each vote change can reduce the score of k )(cid:1), the score of any other candidate cj ∈ k−1 )/(M ci by at most one and increase the score of any other candidate by at most one and k 6 cm for constant c ∈ (0, 1). This proves the result for the k-approval voting rule. Now we show that DKL(µiµ) to be O(ε2). DKL(µiµ) = (cid:18)ε + (1 − ε) 6 (cid:18)ε + (1 − ε) = ε2(cid:18) M − 1(cid:19) k 6 2ε2 k M M(cid:19) ln(cid:18)1 − ε + ε M(cid:19)(cid:18)ε k (cid:19) + (1 − ε)(cid:18)1 − M(cid:19) ε − ε(cid:19) − (1 − ε)(cid:18)1 − M k k k k M(cid:19) ln (1 − ε) ⊲ Approval voting rule: The result follows from the fact that every m 2 -approval election is also a valid approval election and Lemma 5.2. ⊲ Borda and any Condorcet consistent voting rule: The score vector for the Borda voting rule which we use in this proof is (m, m − 1, . . . , 1). For i ∈ [m], we define a distribution µi on all possible linear orders over C as follows. µi(x) =   2ε/m! + (1−ε)/m! if ci is within top m 2 positions in x. (1−ε)/m! else The score of ci in Vi is at least n(3εm/5 + (1−ε)m/2) = n(m/2 + εm/10) whereas the score of any other candidate cj 6= ci is mn/2. Hence, the margin of victory is at least εn/8, since each vote change can reduce the score of ci by at most m and increase the score of any 83 other candidate by at most m. Also, in the weighted majority graph for the election Vi, w(ci, cj) > εn/10. Hence, the margin of victory is at least εn/4, since each vote change can change the weight of any edge in the weighted majority graph by at most two. Now we show that DKL(µiµ) to be O(ε2). DKL(µiµ) = 6 1 + ε 2 1 + ε 2 ln (1 + ε) + ε − 1 − ε 2 ε = ε2 1 − ε 2 ln (1 − ε) ⊲ Bucklin: For i ∈ [m], we define a distribution µi on all m/4 sized subsets of C as follows. Each m/4 sized subset corresponds to the top m 4 candidates in a vote. µi(x) =   (ε/( m−1 4 −1)) + ((1−ε)/( m m 4 m (1−ε)/( m m 4 ) )) if ci ∈ x else 2 + 9ε The candidate ci occurs within the top m( 1 n( 1 positions at most n( 1 Now we show that DKL(µiµ) to be O(ε2). 2 − ε 10 ) times. On the other hand any candidate cj 6= ci occurs within the top m( 1 10) times. Hence the margin of victory is at least εn 2 − ε 10 ) positions at least n( 1 2 − ε 10 + ε) = 2 − ε 10 ) 30 = Ω(εn). DKL(µiµ) = (cid:18)ε + 1 − ε 4 (cid:19) ln (1 + 3ε) + 3 4 (1 − ε) ln (1 − ε) = (3ε (1 + 3ε) − 3ε (1 − ε)) 1 4 = 3ε2 5.2.2 Results on Upper Bounds In this section, we present the upper bounds on the sample complexity of the (ε, δ)-WINNER DETERMINATION problem for various voting rules. The general framework for proving the upper bounds is as follows. For each voting rule, we first prove a useful structural property 84 about the election when the margin of victory is known to be at least εn. Then, we sample a few votes uniformly at random to estimate either the score of the candidates for score based voting rules or weights of the edges in the weighted majority graph for the voting rules which are defined using weighted majority graph (maximin and Copeland for example). Finally, appealing to the structural property that has been established, we argue that, the winner of the election on the sampled votes will be the same as the winner of the election, if we are able to estimate either the scores of the candidates or the weights of the edges in the weighted majority graph to a certain level of accuracy. Before getting into specific voting rules, we prove a straightforward bound on the sample complexity for the (ε, δ)-winner determination problem for any homogeneous voting rule. Theorem 5.3. There is a (ε, δ)-WINNER DETERMINATION algorithm for every homogeneous voting rule with sample complexity (9m!2/2ε2) ln(2m!/δ). Proof. We sample ℓ votes uniformly at random from the set of votes with replacement. For x ∈ L(C), let Xx and let g(x) be the total number of voters whose vote is x. Define g(x) = n i be an indicator random variable that is 1 exactly when x is the i'th sample, i . Using the Chernoff bound (Theorem 2.5), we have the following: Prhg(x) − g(x) > εn 3m!i 6 2 · exp(cid:18)− 2ε2ℓ 9m!2(cid:19) By using the union bound, we have the following, ℓ Pℓ i=1 Xx Prh∃x ∈ L(C), g(x) − g(x) > εn 3m!i 6 2m! · exp(cid:18)− 2ε2ℓ 9m!2(cid:19) Since the margin of victory is εn and the voting rule is anonymous, the winner of the ℓ sample votes will be same as the winner of the election if g(x) − g(x) 6 εn/3m! for every linear order x ∈ L(C). Hence, it is enough to take ℓ = (9m!2/2ε2) ln(2m!/δ). 5.2.2.1 Approval Voting Rule We derive the upper bound on the sample complexity for the (ε, δ)-WINNER DETERMINATION problem for the approval voting rule. Lemma 5.2. If MOV > εn and w be the winner of an approval election, then, s(w) − s(x) > εn, for every candidate x 6= w, where s(y) is the number of approvals that a candidate y receives. 85 Proof. Suppose there is a candidate x 6= w such that s(w) − s(x) < εn. Then there must exist εn − 1 votes which does not approve the candidate x. We modify these votes to make it approve x. This makes w not the unique winner in the modified election. This contradicts the fact that the MOV is at least εn. Theorem 5.4. There is a (ε, δ)-WINNER DETERMINATION algorithm for the approval voting rule with sample complexity at most 9 ln(2m/δ)/2ε2. Proof. Suppose w is the winner. We sample ℓ votes uniformly at random from the set of votes with replacement. For a candidate x, let Xx vote sampled approved x. Define s(x) = n i be a random variable indicating whether the i'th ℓ Pℓ i . Then, by an argument analogous to i=1 Xx the proof of Theorem 5.3, Pr[∃x ∈ C, s(x) − s(x) > εn/3] 6 2m · exp(cid:0)−2ε2ℓ/9(cid:1). Thus since MOV> εn and by Lemma 5.2, if we take ℓ = 9 ln(2m/δ)/2ε2, s(w) is greater than s(x) for all x 6= w. 5.2.2.2 Scoring Rules Now we move on to the scoring rules. Again, we first establish a structural consequence of having large MOV. Lemma 5.3. Let α = (α1, . . . , αm) be any normalized score vector (hence, αm = 0). If w and z are the candidates that receive highest and second highest score respectively in a α–scoring rule election instance E = (V, C) and Mα(E) is the margin of victory of E, then, α1(Mα(E) − 1) 6 s(w) − s(z) 6 2α1Mα(E) Proof. We claim that there must be at least Mα(E) − 1 many votes v ∈ V where w is preferred over z. Indeed, otherwise, we swap w and z in all the votes where w is preferred over z. This makes z win the election. However, we have changed at most Mα(E) − 1 votes only. This contradicts the definition of margin of victory (see Definition 5.2). Let v ∈ V be a vote where w is preferred over z. Let αi and αj(6 αi) be the scores received by the candidates w and z respectively from the vote v. We replace the vote v by v′ = z ≻ · · · ≻ c. This vote change reduces the value of s(w) − s(z) by α1 + αi − αj which is at least α1. Hence, α1(Mα(E) − 1) 6 s(w) − s(z). Each vote change reduces the value of s(w) − s(z) by at most 2α1 since αm = 0. Hence, s(w) − s(z) 6 2α1Mα(E). 86 Using Lemma 5.3, we prove the following sample complexity upper bound for the (ε, δ)- WINNER DETERMINATION problem for the scoring rules. Theorem 5.5. Suppose α = (α1, . . . , αm) be a normalized score vector. There is a (ε, δ)-WINNER DETERMINATION algorithm for the α-scoring rule with sample complexity at most 9 ln(2m/δ)/2ε2. Proof. We sample ℓ votes uniformly at random from the set of votes with replacement. For a candidate x, define Xi = αi/α1 if x gets a score of αi from the ith sample vote, and let s(x) = nα1 i=1 Xi. Now using Chernoff bound (Theorem 2.5), we have: ℓ Pℓ Pr [s(x) − s(x) > α1εn/3] 6 2 exp(cid:18)− 2ε2ℓ 9 (cid:19) The rest of the proof follows from an argument analogous to the proof of Theorem 5.4 using Lemma 5.3. From Theorem 5.5, we have a (ε, δ)-winner determination algorithm for the k-approval voting rule which needs 9 ln(2m/δ)/2ε2 many samples for any k. We now improve this bound to 9 ln(2k/δ)/2ε2 for the k-approval voting rule. Before embarking on the proof of the above fact, we prove the following lemma which we will use crucially in Theorem 5.6. Lemma 5.4. Let f : R −→ R be a function defined by f(x) = e−λ/x. Then, f(x) + f(y) 6 f(x + y), for x, y > 0, λ x + y > 2, x < y Proof. For the function f(x), we have following. f(x) = e−λ/x ⇒ f′(x) = ⇒ f′′(x) = λ x2 e−λ/x λ2 x4 e−λ/x − 2λ x3 e−λ/x 87 Hence, for x, y > 0, λ x+y > 2, x < y we have f′′(x), f′′(y), f′′(x + y) > 0. This implies following for x < y and an infinitesimal positive δ. f′(x) 6 f′(y) f(x − δ) − f(x) δ ⇒ > f(y) − f(y − δ) δ ⇒ f(x) + f(y) 6 f(x − δ) + f(y + δ) ⇒ f(x) + f(y) 6 f(x + y) We now present our (ε, δ)-WINNER DETERMINATION algorithm for the k-approval voting rule. Theorem 5.6. There is a (ε, δ)-WINNER DETERMINATION algorithm for the k-approval voting rule with sample complexity at most 9 ln(2k/δ)/2ε2. Proof. We sample ℓ votes uniformly at random from the set of votes with replacement. For a candidate x, let Xx for the ith vote sample. Define s(x) = n i be a random variable indicating whether x is among the top k candidates i , and let s(x) be the actual score of x. Then i=1 Xx ℓ Pℓ by the multiplicative Chernoff bound (Theorem 2.5), we have: Pr [s(x) − s(x) > εn/3] 6 2 exp(cid:18)− 2ε2ℓn 9s(x)(cid:19) By union bound, we have the following, Pr[∃x ∈ C, s(x) − s(x) > εn/3] 2 exp(cid:0)−2ε2ℓn/9s(x)(cid:1) 6 X x∈C 6 2k exp(cid:0)−2ε2ℓ/9(cid:1) Let the candidate w be the winner of the election. The second inequality in the above deriva- tion follows from the fact that, the function Px∈C 2exp(cid:0)−2ε2ℓn/9s(x)(cid:1) is maximized in the do- main, defined by the constraint: for every candidate x ∈ C, s(x) ∈ [0, n] and Px∈C s(x) = kn, by setting s(x) = n for every x ∈ C′ and s(y) = 0 for every y ∈ C \ C′, for any arbitrary subset C′ ⊂ C of cardinality k (due to Lemma 5.4). The rest of the proof follows by an argument analogous to the proof of Theorem 5.3 using Lemma 5.3. 88 Notice that, the sample complexity upper bound in Theorem 5.6 is independent of m for the plurality voting rule. Theorem 5.6 in turn implies the following Corollary which we consider to be of independent interest. Corollary 5.2. There is an algorithm to estimate the ℓ an additive factor of ε by querying only 9 ln(2/δ)/2ε2 many samples, if we are allowed to get i.i.d. norm ℓ (µ) of a distribution µ within ∞ ∞ samples from the distribution µ. Such a statement seems to be folklore in the statistics community [DKW56]. Recently in an independent and nearly simultaneous work, Waggoner [Wag15] obtained a sharp bound of 4 ε2 ln( 1 We now turn our attention to the k-veto voting rule. For the k-veto voting rule, we have δ) for the sample complexity in Corollary 5.2. the following result for the (ε, δ)-WINNER DETERMINATION problem. Theorem 5.7. There is a (ε, δ)-WINNER DETERMINATION algorithm for the k-veto voting rule with sample complexity at most 9 ln(2k/δ)/2ε2. Proof. We first observe that, since the margin of victory of the input election is at least εn, every candidate other than the winner must receive at least εn vetoes. Hence we have the following. εn(m − 1) > kn i.e. m − 1 6 k/ε Let us sample ℓ votes uniformly at random from the set of votes with replacement. For a candidate x, let Xx candidates for the ith vote sample. Define s(x) = n i be a random variable indicating whether x is among the bottom k i , and let s(x) be the actual score i=1 Xx ℓ Pℓ of x. Then by the multiplicative Chernoff bound (Theorem 2.5), we have: Pr [s(x) − s(x) > εn/3] 6 2 exp(cid:18)− 2ε2ℓn 9s(x)(cid:19) By union bound, we have the following, Pr[∃x ∈ C, s(x) − s(x) > εn/3] 6 X 2 exp(cid:0)−2ε2ℓn/9s(x)(cid:1) x∈C 6 2k exp(cid:0)−2ε2ℓ/9(cid:1) Let the candidate w be the winner of the election. The second inequality in the above deriva- tion follows from the fact that, the function Px∈C 2exp(cid:0)−2ε2ℓn/9s(x)(cid:1) is maximized in the do- 89 main, defined by the constraint: for every candidate x ∈ C, s(x) ∈ [0, n] and Px∈C s(x) = kn, by setting s(x) = n for every x ∈ C′ and s(y) = 0 for every y ∈ C \ C′, for any arbitrary subset C′ ⊂ C of cardinality k (due to Lemma 5.4). The rest of the proof follows by an argument analogous to the proof of Theorem 5.3 using Lemma 5.3. 5.2.2.3 Maximin Voting Rule We now turn our attention to the maximin voting rule. The idea here is to sample enough number of votes such that we are able to estimate the weights of the edges in the weighted majority graph with certain level of accuracy which in turn leads us to predict winner. Lemma 5.5. Let E = (V, C) be any instance of a maximin election. If w and z are the candidates that receive highest and second highest maximin score respectively in E and Mmaximin(E) is the margin of victory of E, then, 2Mmaximin(E) 6 s(w) − s(z) 6 4Mmaximin(E) Proof. Each vote change can increase the value of s(z) by at most two and decrease the value of s(w) by at most two. Hence, we have s(w) − s(z) 6 4Mmaximin(E). Let x be the candidate that minimizes DE(w, x), that is, x ∈ argminx∈C\{w}{DE(w, x)}. Let v ∈ V be a vote where w is preferred over x. We replace the vote v by the vote v′ = z ≻ x ≻ · · · ≻ w. This vote change reduces the score of w by two and does not reduce the score of z. Hence, s(w) − s(z) > 2Mmaximin(E). We now present our (ε, δ)-WINNER DETERMINATION algorithm for the maximin voting rule. Theorem 5.8. There is a (ε, δ)-WINNER DETERMINATION algorithm for the maximin voting rule with sample complexity (9/2ε2) ln(2m/δ). Proof. Let x and y be any two arbitrary candidates. We sample ℓ votes uniformly at random from the set of votes with replacement. Let Xi be a random variable defined as follows. Xi =   1, −1, if x ≻ y in the ith sample else 90 Define D(x, y) = n i=1 Xi. We estimate D(x, y) within the closed ball of radius εn/2 around D(x, y) for every candidates x, y ∈ C and the rest of the proof follows from by an argument analogous to the proof of Theorem 5.4 using Lemma 5.5. ℓ Pℓ 5.2.2.4 Copeland Voting Rule Now we move on to the Copelandα voting rule. The approach for the Copelandα voting rule is similar to the maximin voting rule. However, it turns out that we need to estimate the edge weights of the weighted majority graph more accurately for the Copelandα voting rule. Xia introduced the quantity called the relative margin of victory (see Section 5.1 in [Xia12]) which we will use crucially for showing sample complexity upper bound for the Copelandα voting rule. Given an election, a candidate x ∈ C, and an integer (may be negative also) t, s′t(V, x) is defined as follows. s′t(V, x) = {y ∈ C : y 6= x, D(y, x) < 2t} + α{y ∈ C : y 6= x, D(y, x) = 2t} For every two distinct candidates x and y, the relative margin of victory, denoted by RM(x, y), between x and y is defined as the minimum integer t such that, s′−t(V, x) 6 s′t(V, y). Let w be the winner of the election E. We define a quantity Γ (E) to be minx∈C\{w}{RM(w, x)}. Notice that, given an election E, Γ (E) can be computed in polyno- mial amount of time. Now we have the following lemma. Lemma 5.6. Suppose MOV > εn and w be the winner of a Copelandα election. Then, RM(w, x) > εn/(2(⌈ln m⌉+1)), for every candidate x 6= w. Proof. Follows from Theorem 11 in [Xia12]. Theorem 5.9. There is a (ε, δ)-WINNER DETERMINATION algorithm for the Copelandα voting rule with sample complexity (25/2ε2) ln3(2m/δ). Proof. Let x and y be any two arbitrary candidates and w the Copelandα winner of the election. We estimate D(x, y) within the closed ball of radius εn/(5(⌈ln m⌉+1)) around D(x, y) for every candidates x, y ∈ C in a way analogous to the proof of Theorem 6.6. This needs (25/2ε2) ln3(2m/δ) many samples. The rest of the proof follows from Lemma 5.6 by an argument analogous to the proof of Theorem 5.3. 91 5.2.2.5 Bucklin Voting Rule For the Bucklin voting rule, we will estimate how many times each candidate occurs within the first k position for every k ∈ [m]. This eventually leads us to predict the winner of the election due to the following lemma. Lemma 5.7. Suppose MOV of a Bucklin election be at least εn. Let w be the winner of the election and x be any arbitrary candidate other than w. Suppose bw = min i {i : w is within top i places in at least n/2 + εn/3 votes} bx = min {i : x is within top i places in at least n/2 − εn/3 votes} i Then, bw < bx. Proof. We prove it by contradiction. So, assume bw > bx. Now by changing εn/3 votes, we can make the Bucklin score of w to be at least bw. By changing another εn/3 votes, we can make the Bucklin score of x to be at most bx. Hence, by changing 2εn/3 votes, it is possible not to make w the unique winner which contradicts the fact that the MOV is at least εn. Our (ε, δ)-WINNER DETERMINATION algorithm for the Bucklin voting rule is as follows. Theorem 5.10. There is a (ε, δ)-WINNER DETERMINATION algorithm for the Bucklin voting rule with sample complexity (9/2ε2) ln(2m/δ). Proof. Let x be any arbitrary candidate and 1 6 k 6 m. We sample ℓ votes uniformly at random from the set of votes with replacement. Let Xi be a random variable defined as follows. Xi =   1, 0, if x is within top k places in ith sample else Let sk(x) be the estimate of the number of times the candidate x has been placed within top k positions. That is, sk(x) = n i=1 Xi. Let sk(x) be the number of times the candidate x been placed in top k positions. Clearly, E[sk(x)] = n i=1 E[Xi] = sk(x). We estimate sk(x) within the closed ball of radius εn/3 around sk(x) for every candidate x ∈ C and every integer k ∈ [m], and the rest of the proof follows from by an argument analogous to the proof of Theorem 5.4 using Lemma 5.7. ℓ Pℓ ℓ Pℓ 92 5.2.2.6 Plurality with Runoff Voting Rule Now we move on to the plurality with runoff voting rule. In this case, we first estimate the plurality score of each of the candidates. In the next round, we estimate the pairwise margin of victory of the two candidates that qualifies to the second round. Lemma 5.8. Suppose MOV > εn, and w and r be the winner and runner up of a plurality with runoff election respectively, and x be any arbitrary candidate other than and r. Then, following holds. Let s(.) denote plurality score of candidates. Then following holds. 1. D(w, r) > 2εn. 2. For every candidate x ∈ C \ {w, r}, 2s(w) > s(x) + s(r) + εn. 3. If s(x) > s(r) − εn/2, then D(w, x) > εn/2. Proof. If the first property does not hold, then by changing εn votes, we can make r winner. If the second property does not hold, then by changing εn votes, we can make both x and r qualify to the second round. If the third property does not hold, then by changing εn/2 votes, the candidate x can be sent to the second round of the runoff election. By changing another εn/2 votes, x can be made to win the election. This contradicts the MOV assumption. Now we present our (ε, δ)-WINNER DETERMINATION algorithm for the plurality with runoff voting rule. Theorem 5.11. There is a (ε, δ)-WINNER DETERMINATION algorithm for the plurality with runoff voting rule with sample complexity (27/ε2) ln(4/δ). Proof. Let x be any arbitrary candidate. We sample ℓ votes uniformly at random from the set of votes with replacement. Let, Xi be a random variable defined as follows. Xi =   1, 0, if x is at first position in the ith sample else The estimate of the plurality score of x be s(x). Then s(x) = n i=1 Xi. Let s(x) be the actual plurality score of x. Then we have following, E[Xi] = s(x) n , E[s(x)] = n ℓ 93 ℓ X i=1 ℓ Pℓ E[Xi] = s(x) By Chernoff bound, we have the following, Pr[s(x) − s(x) > εn] 6 2 exp{ε2ℓn/3s(x)} By union bound, we have the following, Pr[∃x ∈ C, s(x) − s(x) > εn] 6 X x∈C 2 exp{ε2ln/3s(x)} 2 6 exp{ε2ℓ/3} The last line follows from Lemma 5.4. Notice that, we do not need the random variables s(x) and s(y) to be independent for any two candidates x and y. Hence, we can use the same ℓ sample votes to estimate s(x) for every candidate x. Now let y and z be the two candidates that go to the second round. Yi =   1, −1, if y ≻ z in the ith sample else The estimate of D(y, z) be D(y, z). Then D(y, z) = n i=1 Yi. Then we have following, E[Yi] = D(y, z) n , E[ D(y, z)] = By Chernoff bound, we have the following, n ℓ ℓ Pℓ X ℓ i=1 E[Yi] = D(y, z) Pr[ D(y, z) − D(y, z) > εn] 6 2 exp{ε2ℓ/3} Let A be the event that ∀x ∈ C, s(x) − s(x) 6 εn and D(y, z) − D(y, z) 6 εn. Now we have, Pr[A] > 1 − ( 2 exp{ε2ℓ/3} + 2 exp{ε2ℓ/3} ) Since we do not need independence among the random variables s(a), s(b), D(w, x), D(y, z) for any candidates a, b, w, x, y, and z, we can use the same ℓ sampled votes. Now from Lemma 5.8, if s(x) − s(x) 6 εn/3 for every candidate x and D(y, z) − D(y, z) 6 εn/3 for every 94 candidates y and z, then the plurality with runoff winner of the sampled votes coincides with the actual runoff winner. The above event happens with probability at least 1 − δ by choosing an appropriate ℓ = (27/ε2) ln(4/δ). 5.2.2.7 STV Voting Rule Now we move on the STV voting rule. The following lemma provides an upper bound on the number of votes that need to be changed to make some arbitrary candidate win the election. More specifically, given a sequence of m candidates {xi}m i=1 with xm not being the winner, Lemma 5.9 below proves an upper bound on the number of number of votes that need to be modified such that the candidate xi gets eliminated at the ith round in the STV voting rule. Lemma 5.9. Suppose V be a set of votes and w be the winner of a STV election. Consider the following chain with candidates x1 6= x2 6= . . . 6= xm and xm 6= w. C ⊃ C \ {x1} ⊃ C \ {x1, x2} ⊃ . . . ⊃ {xm} Let sV(A, x) be the plurality score of a candidate x when all the votes in V are restricted to the set of candidates A ⊂ C. Let us define C−i = C \ {x1, . . . , xi} and s∗V(A) := minx∈A{sV(A, x)}. Then, we have the following. m−1 X i=0 (sV (C−i, xi+1) − s∗V (C−i)) > MOV Proof. We will show that by changing Pm−1 i=0 (sV (C−i, xi+1) − s∗V (C−i)) votes, we can make the candidate xm winner. If x1 minimizes sV(C, x) over x ∈ C, then we do not change anything and define V1 = V. Otherwise, there exist sV(C, x1) − s∗V(C) many votes of following type. x1 ≻ a1 ≻ a2 ≻ . . . ≻ am−1, ai ∈ C, ∀1 6 i 6 m − 1 We replace sV(C, x1) − s∗V(C) many votes of the above type by the votes as follows. a1 ≻ x1 ≻ a2 ≻ . . . ≻ am−1 Let us call the new set of votes by V1. We claim that, sV(C \ x1, x) = sV1(C \ x1, x) for every candidate x ∈ C \ {x1}. Fix any arbitrary candidate x ∈ C \ {x1}. The votes in V1 that are same 95 as in V contributes same quantity to both side of the equality. Let v be a vote that has been changed as described above. If x = a1 then, the vote v contributes one to both sides of the equality. If x 6= a1, then the vote contributes zero to both sides of the equality. Hence, we have the claim. We repeat this process for (m − 1) times. Let Vi be the set of votes after the candidate xi gets eliminated. Now in the above argument, by replacing V by Vi−1, V1 by Vi, the candidate set C by C \ {x1, . . . , xi−1}, and the candidate x1 by the candidate xi, we have the following. sVi−1(C−i, x) = sVi(C−i, x)∀x ∈ C \ {x1, . . . , xi} Hence, we have the following. sV(C−i, x) = sVi (C−i, x)∀x ∈ C \ {x1, . . . , xi} In the above the Pm−1 i=0 (sV (C−i, xi+1) − s∗V (C−i)). process, total number of votes that are changed is We now use Lemma 5.9 to prove the following sample complexity upper bound for the (ε, δ)-WINNER DETERMINATION problem for the STV voting rule. Theorem 5.12. There is a (ε, δ)-WINNER DETERMINATION algorithm for the STV voting rule with sample complexity (3m2/ε2)(m ln 2 + ln(2m/δ)). Proof. We sample ℓ votes uniformly at random from the set of votes with replacement and output the STV winner of those ℓ votes say w′ as the winner of the election. Let, w be the winner of the election. We will show that for ℓ = (3m2/ε2)(m ln 2 + ln(2m/δ)) for which w = w′ with probability at least 1 − δ. Let A be an arbitrary subset of candidates and x be any candidate in A. Let us define a random variables Xi, 1 6 i 6 ℓ as follows. Xi =   1, 0, if x is at top ith sample when restricted to A else Define another random variable sV(A, x) := Pℓ Now using Chernoff bound, we have the following, i=1 Xi. Then we have, E[sV(A, x)] = sV(A, x). Pr[sV(A, x) − sV(A, x) > εn m ] 6 2 exp{ε2ℓ/3m2} 96 Let E be the event that ∃A ⊂ C and ∃x ∈ A, sV(A, x) − sV(A, x) > εn have, m . By union bound, we Pr[¯E] > 1 − m2m+1 exp{ε2ℓ/3m2} The rest of the proof follows by an argument analogous to the proof of Theorem 5.3 using Lemma 5.9. 5.3 Results for Estimating Margin of Victory In this section we present our results for the (c, ε, δ)–MARGIN OF VICTORY problem. 5.3.1 Results on Lower Bounds Our lower bounds for the sample complexity of the (c, ε, δ)–MARGIN OF VICTORY problem are derived from the information-theoretic lower bound for distinguishing two distributions. Theorem 5.13. The sample complexity of the (c, ε, δ)–MARGIN OF VICTORY problem for the plurality voting rule is at least ((1−c)2/36ε2) ln (1/8e√πδ) for any c ∈ [0, 1). Proof. Consider two vote distributions X and Y, each over the candidate set {a, b}. exactly 1 In Y, exactly 1 In X, 1−c n. 1−c 2 fraction of voters prefer b to a and thus the margin of victory is one. Any (c, ε, δ)–MARGIN OF VICTORY algorithm A for the plurality voting rule gives us a distinguisher 2 + 6ε+2c/n fraction of voters prefer a to b and thus the margin of victory is 3ε+c/n between X and Y with probability of error at most 2δ. This is so because, if the input to A is X then, the output of A is less than c + 2εn with probability at most δ, whereas, if the input to A is Y then, the output of A is more than c + εn with probability at most δ. Now since n can be arbitrarily large, we get the result. Theorem 5.1 immediately gives the following corollary. Corollary 5.3. For any c ∈ [0, 1), every (c, ε, δ)–MARGIN OF VICTORY algorithm needs at least ((1−c)2/36ε2) ln (1/8e√πδ) many samples for all voting rules which reduce to the plurality rule for two candidates. In particular, the lower bound holds for scoring rules, approval, Bucklin, maximin, and Copelandα voting rules. 97 We note that the lower bound results in Theorem 5.1 and Corollary 5.1 do not assume anything about the sampling strategy or the computational complexity of the estimator. 5.3.2 Results on Upper Bounds A natural approach for estimating the margin of victory of an election efficiently is to compute the margin of victory of a suitably small number of sampled votes. Certainly, it is not immedi- ate that the samples chosen uniformly at random preserve the value of the margin of victory of the original election within some desired factor. Although it may be possible to formulate clever sampling strategies that tie into the margin of victory structure of the election, we will show that uniformly chosen samples are good enough to design algorithms for estimating the margin of victory for many common voting rules. Our proposal has the advantage that the sampling component of our algorithms are always easy to implement, and further, there is no compromise on the bounds in the sense that they are optimal for any constant number of candidates. Our algorithms involve computing a quantity (which depends on the voting rule under consideration) based on the sampled votes, which we argue to be a suitable estimate of the margin of victory of the original election. This quantity is not necessarily the margin of victory of the sampled votes. For scoring rules, for instance, we will use the sampled votes to estimate candidate scores, and we use the difference between the scores of the top two candidates (suitably scaled) as an estimate for the margin of victory. We also establish a relationship between scores and the margin of victory to achieve the desired bounds on the estimate. The overall strategy is in a similar spirit for other voting rules as well, although the exact estimates may be different. We now turn to a more detailed description. 5.3.2.1 Scoring Rules and Approval Voting Rule We begin with showing that the margin of victory of any scoring rule based election can be estimated quite accurately by sampling only 12 δ many votes. An important thing to note ε2 ln 2m is that, the sample complexity upper bound is independent of the score vector. Theorem 5.14. There is a polynomial time (1/3, ε, δ)–MOV algorithm for the scoring rules with sample complexity at most (12/ε2) ln(2m/δ). Proof. Let α = (α1, . . . , αm) be any arbitrary normalized score vector and E = (V, C) an election instance. We sample ℓ (the value of ℓ will be chosen later) votes uniformly at ran- 98 dom from the set of votes with replacement. For a candidate x, define a random variable Xi(x) = αi/α1 if x gets a score of αi from the ith sample vote. Define ¯s(x) = nα1 i=1 Xi(x) the estimate of s(x), the score of x. Also define ε′ = ε/2. Now using Chernoff bound (Theo- rem 2.5), we have the following. ℓ Pℓ Pr [¯s(x) − s(x) > α1ε′n] 6 2 exp(cid:18)− ε′2ℓ 3 (cid:19) We now use the union bound to get the following. Pr[∃x ∈ C, ¯s(x) − s(x) > α1ε′n] 6 2m exp(cid:18)− ε′2ℓ 3 (cid:19) (5.1) Define ¯M def == (¯s( ¯w)−¯s(¯z))/1.5α1 the estimate of the margin of victory of the election E (and thus the output of the algorithm), where ¯w ∈ argmaxx∈C{¯s(x)} and ¯z ∈ argmaxx∈C\{ ¯w}{¯s(x)}. We claim that, if ∀x ∈ C, ¯s(x) − s(x) 6 ε′n, then ¯M − Mα(E) 6 Mα(E)/3 + εn. This can be shown as follows. ¯M − Mα(E) = 6 6 ¯s( ¯w) − ¯s(¯z) 1.5α1 s(w) − s(z) 1.5α1 − Mα(E) + 2ε′n 1.5 − Mα(E) 1 3 Mα(E) + εn The second inequality follows from the fact that, ¯s( ¯w) 6 s( ¯w) + ε′n 6 s(w) + ε′n and ¯s(¯z) > ¯s(z) > s(z) − ε′n. The third inequality follows from Lemma 5.3. Similarly, we bound Mα(E) − ¯M as follows. Mα(E) − ¯M = Mα(E) − 6 Mα(E) − ¯s(w) − ¯s(z) 1.5α1 s(w) − s(z) 1.5α1 + 2ε′n 1.5 6 1 3 Mα(E) + εn 99 This proves the claim. Now we bound the success probability of the algorithm as follows. Let A be the event that ∀x ∈ C, ¯s(x) − s(x) 6 ε′n. A(cid:21) Pr[A] 1 3 Pr(cid:20) ¯M − Mα(E) 6 > Pr(cid:20) ¯M − Mα(E) 6 Mα(E) + εn(cid:21) Mα(E) + εn(cid:12)(cid:12)(cid:12)(cid:12) 1 3 = Pr[A] > 1 − 2m exp(cid:0)−ε′2ℓ/3(cid:1) The third equality follows from Lemma 5.3 and the fourth inequality follows from in- equality 5.1. Now by choosing ℓ = (12/ε2) ln(2m/δ), we get a (1/3, ε, δ)–MOV algorithm for the scoring rules. Now we show an algorithm for the (0, ε, δ)–MOV problem for the k-approval voting rule which not only provides more accurate estimate of the margin of victory, but also has a lower sample complexity. The following structural result will be used subsequently. Lemma 5.10. Let E = (V, C) be an arbitrary instance of a k-approval election. If w and z are the candidates that receive highest and second highest score respectively in E and Mk−approval(E) is the margin of victory of E, then, 2(Mk−approval(E) − 1) < s(w) − s(z) 6 2Mk−approval(E) Proof. We call a vote v ∈ V favorable if w appears within the top k positions and z does not appear within top the k positions in v. We claim that the number of favorable votes must be at least Mk−approval(E). Indeed, otherwise, we swap the positions of w and z in all the favorable votes while keeping the other candidates fixed. This makes the score of z at least as much as the score of w which contradicts the fact that the margin of victory is Mk−approval(E). Now notice that the score of z must remain less than the score of w even if we swap the positions of w and z in Mk−approval(E) − 1 many favorable votes, since the margin of victory is Mk−approval(E). Each such vote change increases the score of z by one and reduces the score of w by one. Hence, 2(Mk−approval(E) − 1) < s(w) − s(z). Again, since the margin of victory is Mk−approval(E), there exists a candidate x other than w and Mk−approval(E) many votes in V which can be modified such that x becomes a winner of 100 the modified election. Now each vote change can reduce the score of w by at most one and increase the score of x by at most one. Hence, s(w) − s(x) 6 2Mk−approval(E) and thus s(w) − s(z) 6 2Mk−approval(E) since s(z) > s(x). With Lemma 5.4 and 5.10 at hand, we now describe our margin of victory estimation algorithm for the k-approval voting rule. Theorem 5.15. There is a polynomial time (0, ε, δ)–MOV algorithm for the k-approval voting rule with sample complexity at most (12/ε2) ln(2k/δ). Proof. Let E = (V, C) be an arbitrary k-approval election. We sample ℓ votes uniformly at random from V with replacement. For a candidate x, define a random variable Xi(x) which takes value 1 if x appears among the top k candidates in the ith sample vote, and 0 otherwise. Define ¯s(x) actual score of x. Also define ε′ = ε def == n ℓ Pℓ i=1 Xi(x) the estimate of the score of the candidate x, and let s(x) be the 2 . Then by the Chernoff bound (Theorem 2.5), we have: Pr [¯s(x) − s(x) > ε′n] 6 2 exp(cid:18)− ε′2ℓn 3s(x)(cid:19) Now we apply the union bound to get the following. 2 exp(cid:18)− Pr[∃x ∈ C, ¯s(x) − s(x) > ε′n] 6 X x∈C 6 2k exp(cid:0)−ε′2ℓ/3(cid:1) ε′2ℓn 3s(x)(cid:19) (5.2) The second inequality follows from Lemma 5.4 : The expression Px∈C 2 exp(cid:16)− ε′2ℓn 3s(x)(cid:17) is maximized subject to the constraints that 0 6 s(x) 6 n, ∀x ∈ C and Px∈C s(x) = kn, when s(x) = n∀x ∈ C′ for any subset of candidates C′ ⊆ C with C′ = k and s(x) = 0∀x ∈ C \ C′. Now to estimate the margin of victory of the given election E, let ¯w and ¯z be can- didates with maximum and second maximum estimated score respectively. That is, ¯w ∈ def== (¯s( ¯w)−¯s(¯z))/2 the estimate of argmaxx∈C{¯s(x)} and ¯z ∈ argmaxx∈C\{ ¯w}{¯s(x)}. We define ¯M the margin of victory of the election E (and thus the output of the algorithm). Let A be the event that ∀x ∈ C, ¯s(x) − s(x) 6 ε′n. We bound the success probability of the algorithm as follows. 101 Pr(cid:2) ¯M − Mk−approval(E) 6 εn(cid:3) > Pr(cid:2) ¯M − Mk−approval(E) 6 εn(cid:12)(cid:12)A(cid:3) Pr[A] > 1 − 2k exp(cid:0)−ε′2ℓ/3(cid:1) = Pr[A] The second equality follows from Lemma 5.10 and an argument analogous to the proof of Theorem 5.14. The third inequality follows from inequality 5.2. Now by choosing ℓ = (12/ε2) ln(2k/δ), we get a (0, ε, δ)–MOV algorithm. Note that, the sample complexity upper bound matches with the lower bound proved in Corollary 5.3 for the k-approval voting rule when k is a constant, irrespective of the number of candidates. Next, we estimate the margin of victory of an approval election. Theorem 5.16. There is a polynomial time (0, ε, δ)–MOV algorithm for the approval rule with sample complexity at most (12/ε2) ln(2m/δ). Proof. We estimate the approval score of every candidate within an additive factor of εn/2 by sampling (12/ε2) ln(2m/δ) many votes uniformly at random with replacement and the result follows from an argument analogous to the proofs of Lemma 5.10 and Theorem 5.15. 5.3.2.2 Bucklin Voting Rule Now we consider the Bucklin voting rule. Given an election E = (V, C), a candidate x ∈ C, and an integer ℓ ∈ [m], we denote the number of votes in V in which x appears within the top ℓ positions by nℓ(x). We prove useful bounds on the margin of victory of any Bucklin election in Lemma 5.11. Lemma 5.11. Let E = (V, C) be an arbitrary instance of a Bucklin election, w the winner of E, and MBucklin(E) the margin of victory of E. Let us define a quantity ∆(E) as follows. ∆(E) def== Then, min {nℓ(w) − nℓ(x) + 1} ℓ∈[m−1]:nℓ(w)>n/2, x∈C\{w}:nℓ(x)6n/2 ∆(E) 2 6 MBucklin(E) 6 ∆(E) 102 Proof. Pick any ℓ ∈ [m − 1] and x ∈ C \ {w} such that, nℓ(w) > n/2 and nℓ(x) 6 n/2. Now by changing nℓ(w) − ⌊n/2⌋ many votes, we can ensure that w is not placed within the top ℓ positions in more than n/2 votes: choose nℓ(w) − ⌊n/2⌋ many votes where w appears within top ℓ positions and swap w with candidates placed at the last position in those votes. Similarly, by changing ⌊n/2⌋ + 1 − nℓ(x) many votes, we can ensure that x is placed within top ℓ positions in more than n/2 votes. Hence, by changing at most nℓ(w) −⌊n/2⌋ +⌊n/2⌋ + 1 − nℓ(x) = nℓ(w) − nℓ(x) + 1 many votes, we can make w not win the election. Hence, MBucklin(E) 6 nℓ(w) − nℓ(x) + 1. Now since we have picked an arbitrary ℓ and an arbitrary candidate x, we have MBucklin(E) 6 ∆(E). For the other inequality, since the margin of victory is MBucklin(E), there exists an ℓ′ ∈ [m − 1], a candidate x ∈ C \ {w}, and MBucklin(E) many votes in V such that, we can change those votes in such a way that in the modified election, w is not placed within top ℓ′ positions in more than n/2 votes and x is placed within top ℓ′ positions in more than n/2 votes. Hence, we have the following. MBucklin(E) > n′ℓ(w) −(cid:4) n 2(cid:5), MBucklin(E) >(cid:4) n ⇒ MBucklin(E) > max{nℓ′(w) −j n 2(cid:5) +(cid:4) n ⇒ MBucklin(E) > 2(cid:5) + 1 − n′ℓ(x) 2k,jn 2(cid:5) + 1 − nℓ′(x) 2k + 1 − nℓ′(x)} nℓ′(w) −(cid:4) n ∆(E) 2 > 2 Notice that, given an election E, ∆(E) can be computed in a polynomial amount of time. Lemma 5.7 leads us to the following result for the Bucklin voting rule. Theorem 5.17. There is a polynomial time (1/3, ε, δ)–MOV algorithm for the Bucklin rule with sample complexity (12/ε2) ln(2m/δ). Proof. Similar to the proof of Theorem 5.15, we estimate, for every candidate x ∈ C and for every integer ℓ ∈ [m], the number of votes where x appears within top ℓ positions within an approximation factor of (0, ε/2). Next, we compute an estimate of ¯∆(E) from the sampled votes and output the estimate for the margin of victory as ¯∆(E)/1.5. Using Lemma 5.11, we can argue the rest of the proof in a way that is analogous to the proofs of Theorem 5.5 and 5.6. 103 5.3.2.3 Maximin Voting Rule Next, we present our (1/3, ε, δ)–MOV algorithm for the maximin voting rule. Theorem 5.18. There is a polynomial time (1/3, ε, δ)–MOV algorithm for the maximin rule with sample complexity (24/ε2) ln(2m/δ). Proof. Let E = (V, C) be an instance of maximin election. Let x and y be any two candidates. We sample ℓ votes uniformly at random from the set of all votes with replacement. Let Xi(x, y) be a random variable defined as follows. Xi(x, y) =   1, −1, if x ≻ y in the ith sample vote else Define ¯DE(x, y) = n the following. ℓ Pℓ i=1 Xi(x, y). By using the Chernoff bound and union bound, we have Pr(cid:2)∃x, y ∈ C, ¯DE(x, y) − DE(x, y) > εn(cid:3) 6 2m2 exp(cid:18)− ε2ℓ 3 (cid:19) def We define ¯M == (¯s( ¯w)−¯s(¯z))/3, the estimate of the margin of victory of E, where ¯w ∈ argmaxx∈C{¯s(x)} and ¯z ∈ argmaxx∈C\{ ¯w}{¯s(x)}. Now using Lemma 5.5, we can complete the rest of the proof in a way that is analogous to the proof of Theorem 5.14. 5.3.2.4 Copelandα Voting Rule Now we present our result for the Copelandα voting rule. The following lemma is immediate from Theorem 11 in [Xia12]. Lemma 5.12. Γ (E) 6 MCopelandα(E) 6 2(⌈ln m⌉ + 1)Γ (E). Proof. Follows from Theorem 11 in [Xia12]. Theorem 5.19. For the Copelandα voting rule, there is a polynomial time (1 − O (1/ln m) , ε, δ)– MOV algorithm whose sample complexity is (96/ε2) ln(2m/δ). Proof. Let E = (V, C) be an instance of a Copelandα election. For every x, y ∈ C, we com- pute ¯DE(x, y), which is an estimate of DE(x, y), within an approximation factor of (0, ε′), where ε′ = ε/4. This can be achieved with an error probability at most δ by sampling 104 (96/ε2) ln(2m/δ) many votes uniformly at random with replacement (the argument is same as the proof of Theorem 5.5). We define ¯s′t(V, x) = {y ∈ C : y 6= x, DE(y, x) < 2t} + α{y ∈ C : y 6= x, DE(y, x) = 2t}. We also define RM(x, y) between x and y to be the minimum integer t such that, ¯s′−t(V, x) 6 s′t(V, y). Let ¯w be the winner of the sampled election, ¯z = argminx∈C\{ ¯w}{RM(w, x)}, w the winner of E, and z = argminx∈C\{w}{RM(w, x)}. Since, ¯DE(x, y) is an approximation of DE(x, y) within a factor of (0, ε′), we have the following for every candidate x, y ∈ C. s′t(V, x) − ε′n 6 ¯s′t(V, x) 6 s′t(V, x) + ε′n RM(x, y) − 2ε′n 6 RM(x, y) 6 RM(x, y) + 2ε′n (5.3) Define ¯Γ (E) = RM( ¯w, ¯z) to be the estimate of Γ (E). We show the following claim. Claim 5.1. With the above definitions of w, z, ¯w, and ¯z, we have the following. Γ (E) − 4ε′n 6 ¯Γ (E) 6 Γ (E) + 4ε′n Proof. Below, we show the upper bound for ¯Γ (E). ¯Γ (E) = RM( ¯w, ¯z) 6 RM(w, ¯z) + 2ε′n 6 RM(w, z) + 2ε′n 6 RM(w, z) + 4ε′n = Γ (E) + 4ε′n The second inequality follows from the fact that ¯DE(x, y) is an approximation of DE(x, y) by a factor of (0, ε′). The third inequality follows from the definition of ¯z, and the fourth inequality uses inequality 5.3. Now we show the lower bound for ¯Γ (E). ¯Γ (E) = RM( ¯w, ¯z) > RM(w, ¯z) − 2ε′n > RM(w, ¯z) − 4ε′n > RM(w, z) − 4ε′n = Γ (E) − 4ε′n 105 The third inequality follows from inequality 5.3 and the fourth inequality follows from the definition of z. We define ¯M, the estimate of MCopelandα(E), to be 4(ln m+1) 2 ln m+3 ¯Γ (E). The following argument shows that ¯M is a(cid:0)1 − O(cid:0) 1 ln m(cid:1) , ε, δ(cid:1)–estimate of MCopelandα(E). ¯M − MCopelandα(E) = 6 6 6 4(ln m + 1) 2 ln m + 3 4(ln m + 1) 2 ln m + 3 4(ln m + 1) 2 ln m + 3 2 ln m + 1 2 ln m + 3 ¯Γ (E) − MCopelandα(E) Γ (E) − MCopelandα(E) + 16(ln m + 1) 2 ln m + 3 ε′n MCopelandα(E) − MCopelandα(E) + εn MCopelandα(E) + εn 6(cid:18)1 − O(cid:18) 1 ln m(cid:19)(cid:19) MCopelandα(E) + εn The second inequality follows from Claim 5.1 and the third inequality follows from Lemma 5.12. Analogously, we have: MCopelandα(E) − ¯M = MCopelandα(E) − 6 MCopelandα(E) − 6 MCopelandα(E) − 4(ln m + 1) 2 ln m + 3 4(ln m + 1) 2 ln m + 3 2(ln m + 1) 2 ln m + 3 ¯Γ (E) Γ (E) + 16(ln m + 1) 2 ln m + 3 ε′n MCopelandα(E) + εn 6 2 ln m + 1 2 ln m + 3 MCopelandα(E) + εn 6(cid:18)1 − O(cid:18) 1 ln m(cid:19)(cid:19) MCopelandα(E) + εn The second line follows Claim 5.1 and the third line follows from Lemma 5.12. The approximation factor in Theorem 5.19 is weak when we have a large number of candi- dates. The main difficulty for showing a better approximation factor for the Copelandα voting 106 rule is to find a polynomial time computable quantity (for example, Γ (E) in Lemma 5.12) that exhibits tight bounds with margin of victory. We remark that, existence of such a quantity will not only imply a better estimation algorithm, but also, a better approximation algorithm (the best known approximation factor for finding the margin of victory for the Copelandα voting rule is O(ln m) and it uses the quantity Γ (E)). However, we remark that Theorem 5.19 will be useful in applications, for example, post election audit and polling, where the number of candidates is often small. 5.4 Conclusion In this work, we introduced the (ε, δ)-WINNER DETERMINATION problem and showed (often tight) bounds for the sample complexity for many common voting rules. We have also in- troduced the (c, ε, δ)–MARGIN OF VICTORY problem and presented efficient sampling based algorithms for solving it for many commonly used voting rules which are also often observes an optimal number of sample votes. We observe that predicting the winner of an elections needs least number of queries, whereas more involved voting rules like Borda and maximin need significantly more queries. In the next chapter, we study the problem of finding a winner of an election when votes are arriving one by one in a sequential manner. 107 Chapter 6 Streaming Algorithms for Winner Determination We give the first optimal bounds for returning the ℓ1-heavy hitters in a data stream of insertions, together with their approximate frequencies, closing a long line of work on this problem. For a stream of m items in {1, 2, . . . , n} and parameters 0 < ε < φ 6 1, let fi denote the frequency of item i, i.e., the number of times item i occurs in the stream. With arbitrarily large constant probability, our algorithm returns all items i for which fi > φm, returns no items j for which fj 6 (φ − ε)m, and returns approximations fi with fi − fi 6 εm for each item i that it returns. Our algorithm uses O(ε−1 log φ−1 + φ−1 log n+log log m) bits of space, processes each stream update in O(1) worst-case time, and can report its output in time linear in the output size. We also prove a lower bound, which implies that our algorithm is optimal up to a constant factor in its space complexity. A modification of our algorithm can be used to estimate the maximum frequency up to an additive εm error in the above amount of space, resolving Question 3 in the IITK 2006 Workshop on Algorithms for Data Streams for the case of ℓ1-heavy hitters. We also introduce several variants of the heavy hitters and maximum frequency problems, inspired by rank aggregation and voting schemes, and show how our techniques can be applied in such settings. Unlike the traditional heavy hitters problem, some of these variants look at A preliminary version of the work in this chapter was published as [BDW16]: Arnab Bhattacharyya, Palash Dey, and David P. Woodruff. An optimal algorithm for l1-heavy hitters in insertion streams and related problems. In Proc. 35th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, PODS 16, pages 385- 400, New York, NY, USA, 2016. ACM. 108 comparisons between items rather than numerical values to determine the frequency of an item. 6.1 Introduction The data stream model has emerged as a standard model for processing massive data sets. Because of the sheer size of the data, traditional algorithms are no longer feasible, e.g., it may be hard or impossible to store the entire input, and algorithms need to run in linear or even sublinear time. Such algorithms typically need to be both randomized and approxi- mate. Moreover, the data may not physically reside on any device, e.g., if it is internet traffic, and so if the data is not stored by the algorithm, it may be impossible to recover it. Hence, many algorithms must work given only a single pass over the data. Applications of data streams include data warehousing [HSST05, BR99, FSG+98, HPDW01], network measure- ments [ABW03, CKMS08, DLOM02, EV03], sensor networks [BGS01, SBAS04], and com- pressed sensing [GSTV07, CRT06]. We refer the reader to recent surveys on the data stream model [Mut05, Nel12, Cor12]. One of the oldest and most fundamental problems in the area of data streams is the problem of finding the ℓ1-heavy hitters (or simply, "heavy hitters"), also known as the top- k, most popular items, frequent items, elephants, or iceberg queries. Such algorithms can be used as subroutines in network flow identification at IP routers [EV03], association rules and frequent itemsets [AS94, SON95, Toi96, Hid99, HPY00], iceberg queries and iceberg datacubes [FSG+98, BR99, HPDW01]. The survey [CH08] presents an overview of the state- of-the-art for this problem, from both theoretical and practical standpoints. We now formally define the heavy hitters problem that we focus on in this work: Definition 6.1. ((ε, φ)-Heavy Hitters Problem) In the (ε, φ)-Heavy Hitters Problem, we are given parameters 0 < ε < φ 6 1 and a stream a1, . . . , am of items aj ∈ {1, 2, . . . , n}. Let fi denote the number of occurrences of item i, i.e., its frequency. The algorithm should make one pass over the stream and at the end of the stream output a set S ⊆ {1, 2, . . . , n} for which if fi > φm, then i ∈ S, while if fi 6 (φ − ε)m, then i /∈ S. Further, for each item i ∈ S, the algorithm should output an estimate fi of the frequency fi which satisfies fi − fi 6 εm. Note that other natural definitions of heavy hitters are possible and sometimes used. For example, ℓ2-heavy hitters are those items i for which f2 i > φ2Pn j=1 f2 j , and more generally, 109 ℓp-heavy hitters are those items i for which fp j . It is in this sense that Definition 6.1 corresponds to ℓ1-heavy hitters. While ℓp-heavy hitters for p > 1 relax ℓ1-heavy hitters and algorithms for them have many interesting applications, we focus on the most direct and j=1 fp i > φpPn common formulation of the heavy hitters notion. We are interested in algorithms which use as little space in bits as possible to solve the (ε, φ)-Heavy Hitters Problem. Further, we are also interested in minimizing the update time and reporting time of such algorithms. Here, the update time is defined to be the time the algorithm needs to update its data structure when processing a stream insertion. The reporting time is the time the algorithm needs to report the answer after having processed the stream. We allow the algorithm to be randomized and to succeed with probability at least 1 − δ for 0 < δ < 1. We do not make any assumption on the ordering of the stream a1, . . . , am. This is desirable as often in applications one cannot assume a best-case or even a random order. We are also interested in the case when the length m of the stream is not known in advance, and give algorithms in this more general setting. The first algorithm for the (ε, φ)-Heavy Hitters Problem was given by Misra and Gries [MG82], who achieved O(ε−1(log n + log m)) bits of space for any φ > ε. This algorithm was rediscovered by Demaine et al. [DLOM02], and again by Karp et al. [KSP03]. Other than these algorithms, which are deterministic, there are also a number of randomized algorithms, such as the CountSketch [CCFC04], Count-Min sketch [CM05], sticky sampling [MM02], lossy counting [MM02], space-saving [MAE05], sample and hold [EV03], multi-stage bloom filters [CFM09], and sketch-guided sampling [KX06]. Berinde et al. [BICS10] show that using O(kε−1 log(mn)) bits of space, one can achieve the stronger guarantee of reporting, for each item i ∈ S, fi with fi − fi 6 ε/kFres(k) < m denotes the sum of , where Fres(k) frequencies of items in {1, 2, . . . , n} excluding the frequencies of the k most frequent items. 1 1 We emphasize that prior to our work the best known algorithms for the (ε, φ)-Heavy Hitters Problem used O(ε−1(log n + log m)) bits of space. Two previous lower bounds were known. The first is a lower bound of log((cid:0) n 1/φ(cid:1)) = Ω(φ−1 log(φn)) bits, which comes from the fact that the output set S can contain φ−1 items and it takes this many bits to encode them. The second lower bound is Ω(ε−1) which follows from a folklore reduction from the randomized communication complexity of the Index problem. In this problem, there are two players, Alice and Bob. Alice has a bit string x of length (2ε)−1, while Bob has an index i. Alice creates a stream of length (2ε)−1 consisting of one copy of each j for which xj = 1 and copies of a dummy item to fill the rest of the stream. She runs the heavy hitters streaming 110 algorithm on her stream and sends the state of the algorithm to Bob. Bob appends (2ε)−1 copies of the item i to the stream and continues the execution of the algorithm. For φ = 1/2, it holds that i ∈ S. Moreover, fi differs by an additive εm factor depending on whether xi = 1 or xi = 0. Therefore by the randomized communication complexity of the Index problem [KNR99], the (ε, 1/2)-heavy hitters problem requires Ω(ε−1) bits of space. Although this proof was for φ = 1/2, no better lower bound is known for any φ > ε. Thus, while the upper bound for the (ε, φ)-Heavy Hitters Problem is O(ε−1(log n + log m)) bits, the best known lower bound is only Ω(φ−1 log n + ε−1) bits. For constant φ, and log n ≈ ε−1, this represents a nearly quadratic gap in upper and lower bounds. Given the limited resources of devices which typically run heavy hitters algorithms, such as internet routers, this quadratic gap can be critical in applications. A problem related to the (ε, φ)-Heavy Hitters Problem is estimating the maximum fre- quency in a data stream, also known as the ℓ -norm. In the IITK 2006 Workshop on Algo- ∞ rithms for Data Streams, Open Question 3 asks for an algorithm to estimate the maximum frequency of any item up to an additive εm error using as little space as possible. The best known space bound is still O(ε−1 log n) bits, as stated in the original formulation of the ques- tion (note that the "m" in the question there corresponds to the "n" here). Note that, if one can find an item whose frequency is the largest, up to an additive εm error, then one can solve this problem. The latter problem is independently interesting and corresponds to finding ap- proximate plurality election winners in voting streams [DB15]. We refer to this problem as the ε-Maximum problem. Finally, we note that there are many other variants of the (ε, φ)-Heavy Hitters Problem that one can consider. One simple variant of the above is to output an item of frequency within εm of the minimum frequency of any item in the universe. We refer to this as the ε-Minimum problem. This only makes sense for small universes, as otherwise outputting a random item typically works. This is useful when one wants to count the "number of dislikes", or in anomaly detection; see more motivation below. In other settings, one may not have numerical scores associated with the items, but rather, each stream update consists of a "ranking" or "total ordering" of all stream items. This may be the case in ranking aggregation on the web (see, e.g., [MBG04, MYCC07]) or in voting streams (see, e.g., [CS05, CP11, DB15, Xia12]). One may consider a variety of aggregation measures, such as the Borda score of an item i, which asks for the sum, over rankings, of the number of items j 6= i for which i is ranked ahead of j in the ranking. Alternatively, one may consider the Maximin score of an item i, 111 Problem (ε, φ)-Heavy Hitters ε-Maximum and ℓ -approximation ∞ ε-Minimum ε-Borda ε-Maximin Upper bound Lower bound Space complexity [Theorem 6.2 and 6.7] [Theorem 6.1 and 6.7] O(cid:0)ε−1 log φ−1 + φ−1 log n + log log m(cid:1) O(cid:0)ε−1 log ε−1 + log n + log log m(cid:1) O(cid:0)ε−1 log log ε−1 + log log m(cid:1) O(cid:0)n(log ε−1 + log n) + log log m(cid:1) O(cid:16)nε−2 log2 n + log log m(cid:17) [Theorem 6.6 and 6.8] [Theorem 6.5 and 6.8] [Theorem 6.4 and 6.8] [Theorem 6.9 and 6.14] Ω(cid:0)ε−1 log φ−1 + φ−1 log n + log log m(cid:1) Ω(cid:0)ε−1 log ε−1 + log n + log log m(cid:1) [Theorem 6.10 and 6.14] Ω(cid:0)ε−1 + log log m(cid:1) [Theorem 6.11 and 6.14] [Theorem 6.12 and 6.14] Ω(cid:0)n(log ε−1 + log n) + log log m(cid:1) Ω(cid:0)n(ε−2 + log n) + log log m(cid:1) [Theorem 6.13] Table 6.1: The bounds hold for constant success probability algorithms and for n sufficiently large in terms of ε. For the (ε, φ)-Heavy Hitters problem and the ε-Maximum problem, we also achieve O(1) update time and reporting time which is linear in the size of the output. The upper bound for ε-Borda (resp. ε-Maximin) is for returning every item's Borda score (resp. Maximin score) up to an additive εmn (resp. additive εm), while the lower bound for ε-Borda (resp. ε-Maximin) is for returning only the approximate Borda score (resp. Maximin score) of an approximate maximum. which asks for the minimum, over items j 6= i, of the number of rankings for which i is ranked ahead of j. For these aggregation measures, one may be interested in finding an item whose score is an approximate maximum. This is the analogue of the ε-Maximum problem above. Or, one may be interested in listing all items whose score is above a threshold, which is the analogue of the (ε, φ)-Heavy Hitters Problem. We give more motivation of these variants of heavy hitters in this section below, and more precise definitions in Section 6.2. 6.1.1 Our Contribution Our results are summarized in Table 6.1. We note that independently of this work and nearly parallelly, there have been improvements to the space complexity of the ℓ2-heavy hitters prob- lem in insertion streams [BCIW16] and to the time complexity of the ℓ1-heavy hitters problem in turnstile1 streams [LNNT16]. These works use very different techniques. Our first contribution is an optimal algorithm and lower bound for the (ε, φ)-Heavy Hit- ters Problem. Namely, we show that there is a randomized algorithm with constant proba- 1In a turnstile stream, updates modify an underlying n-dimensional vector x initialized at the zero vector; each update is of the form x ← x + ei or x ← x − ei where ei is the i'th standard unit vector. In an insertion stream, only updates of the form x ← x + ei are allowed. 112 bility of success which solves this problem using O(ε−1 log φ−1 + φ−1 log n + log log m) bits of space, and we prove a lower bound matching up to constant factors. In the unit-cost RAM model with O(log n) bit words, our algorithm has O(1) update time and reporting time linear in the output size, under the standard assumptions that the length of the stream and universe size are at least poly(ε−1 log(1/φ)). Furthermore, we can achieve nearly the optimal space complexity even when the length m of the stream is not known in advance. Although the results of [BICS10] achieve stronger error bounds in terms of the tail, which are useful for skewed streams, here we focus on the original formulation of the problem. Next, we turn to the problem of estimating the maximum frequency in a data stream up to an additive εm. We give an algorithm using O(ε−1 log ε−1 + log n + log log m) bits of space, improving the previous best algorithms which required space at least Ω(ε−1 log n) bits, and show that our bound is tight. As an example setting of parameters, if ε−1 = Θ(log n) and log log m = O(log n), our space complexity is O(log n log log n) bits, improving the previous Ω(log2 n) bits of space algorithm. We also prove a lower bound show- ing our algorithm is optimal up to constant factors. This resolves Open Question 3 from the IITK 2006 Workshop on Algorithms for Data Streams in the case of insertion streams, for the case of "ℓ1-heavy hitters". Our algorithm also returns the identity of the item with the approximate maximum frequency, solving the ε-Maximum problem. We then focus on a number of variants of these problems. We first give nearly tight bounds for finding an item whose frequency is within εm of the minimum possible frequency. While this can be solved using our new algorithm for the (ε, ε)-Heavy Hitters Problem, this would incur Ω(ε−1 log ε−1 + log log m) bits of space, whereas we give an algorithm using only O(ε−1 log log(ε−1) + log log m) bits of space. We also show a nearly matching Ω(ε−1 + log log m) bits of space lower bound. We note that for this problem, a dependence on n is not necessary since if the number of possible items is sufficiently large, then outputting the identity of a random item among the first say, 10ε−1 items, is a correct solution with large constant probability. 113 Finally, we study variants of heavy hitter problems that are ranking-based. In this setting, each stream update consists of a total ordering of the n universe items. For the ε-Borda problem, we give an algorithm using O(n(log ε−1 + log log n) + log log m) bits of space to report the Borda score of every item up to an additive εmn. We also show this is nearly optimal by proving an Ω(n log ε−1 + log log m) bit lower bound for the problem, even in the case when one is only interested in outputting an item maximum Borda score up to an additive εmn. For the ε-Maximin problem, we give an algorithm using O(nε−2 log2 n + log log m) bits of space to report the maximin score of every item up to an additive εm, and prove an Ω(nε−2 + log log m) bits of space lower bound even in the case when one is only interested in outputting the maximum maximin score up to an additive εm. This shows that finding heavy hitters with respect to the maximin score is significantly more expensive than with respect to the Borda score. 6.1.2 Motivation for Variants of Heavy Hitters While the (ε, φ)-Heavy Hitters and ε-Maximum problem are very well-studied in the data stream literature, the other variants introduced are not. We provide additional motivation for them here. For the ε-Minimum problem, in our formulation, an item with frequency zero, i.e., one that does not occur in the stream, is a valid solution to the problem. In certain scenarios, this might not make sense, e.g., if a stream containing only a small fraction of IP addresses. However, in other scenarios we argue this is a natural problem. For instance, consider an online portal where users register complaints about products. Here, minimum frequency items correspond to the "best" items. That is, such frequencies arise in the context of voting or more generally making a choice: in cases for which one does not have a strong preference for an item, but definitely does not like certain items, this problem applies, since the frequencies correspond to "number of dislikes". The ε-Minimum problem may also be useful for anomaly detection. Suppose one has a known set of sensors broadcasting information and one observes the "From:" field in the broadcasted packets. Sensors which send a small number of packets may be down or defec- tive, and an algorithm for the ε-Minimum problem could find such sensors. 114 Finding items with maximum and minimum frequencies in a stream correspond to finding winners under plurality and veto voting rules respectively in the context of voting1 [BCE+15]. The streaming aspect of voting could be crucial in applications like online polling [KTW11], recommender systems [RV97, HKTR04, AT05] where the voters are providing their votes in a streaming fashion and at every point in time, we would like to know the popular items. While in some elections, such as for political positions, the scale of the election may not be large enough to require a streaming algorithm, one key aspect of these latter voting- based problems is that they are rank-based which is useful when numerical scores are not available. Orderings naturally arise in several applications - for instance, if a website has multiple parts, the order in which a user visits the parts given by its clickstream defines a voting, and for data mining and recommendation purposes the website owner may be interested in aggregating the orderings across users. Motivated by this connection, we define similar problems for two other important voting rules, namely Borda and maximin. The Borda scoring method finds its applications in a wide range of areas of artificial intelligence, for example, machine learning [HHS94, CP06, VZ14, PPR15], image processing [LN06, MG09], information retrieval [Li14, AM01, NC06], etc. The Maximin score is often used when the spread between the best and worst outcome is very large (see, e.g., p. 373 of [MR91]). The maximin scoring method also has been used frequently in machine learning [WL04, JMP+14], human computation [MPC12, MPC13], etc. 6.2 Problem Definitions We now formally define the problems we study here. Suppose we have 0 < ε < ϕ < 1. Definition 6.2. (ε, ϕ)-LIST HEAVY HITTERS Given an insertion-only stream of length m over a universe U of size n, find all items in U with frequency more than ϕm, along with their frequencies up to an additive error of εm, and report no items with frequency less than (ϕ − ε)m. Definition 6.3. ε-MAXIMUM Given an insertion-only stream of length m over a universe U of size n, find the maximum frequency up to an additive error of εm. 1In fact, the first work [Moo81] to formally pose the heavy hitters problem couched it in the context of voting. 115 Next we define the minimum problem for 0 < ε < 1. Definition 6.4. ε-MINIMUM Given an insertion-only stream of length m over a universe U of size n, find the minimum frequency up to an additive error of εm. Next we define related heavy hitters problems in the context of rank aggregation. The input is a stream of rankings (permutations) over an item set U for the problems below. The Borda score of an item i is the sum, over all rankings, of the number of items j 6= i for which i is ranked ahead of j in the ranking. Definition 6.5. (ε, ϕ)-LIST BORDA Given an insertion-only stream over a universe L(U) where U = n, find all items with Borda score more than ϕmn, along with their Borda score up to an additive error of εmn, and report no items with Borda score less than (ϕ − ε)mn. Definition 6.6. ε-BORDA Given an insertion-only stream over a universe L(U) where U = n, find the maximum Borda score up to an additive error of εmn. The maximin score of an item i is the minimum, over all items j 6= i, of the number of rankings for which i is ranked ahead of j. Definition 6.7. (ε, ϕ)-LIST MAXIMIN Given an insertion-only stream over a universe L(U) where U = n, find all items with maximin score more than ϕm along with their maximin score up to an additive error of εm, and report no items with maximin score less than (ϕ − ε)m. Definition 6.8. ε-MAXIMIN Given an insertion-only stream over a universe L(U) where U = n, find the maximum maximin score up to an additive error of εm. Notice that the maximum possible Borda score of an item is m(n − 1) = Θ(mn) and the maximum possible maximin score of an item is m. This justifies the approximation factors in Definition 6.5 to 6.8. We note that finding an item with maximum Borda score within additive εmn or maximum maximin score within additive εm corresponds to finding an approximate winner of an election (more precisely, what is known as an ε-winner) [DB15]. 116 6.3 Our Algorithms In this section, we present our upper bound results. All omitted proofs are in Appendix B. Before describing specific algorithms, we record some claims for later use. We begin with the following space efficient algorithm for picking an item uniformly at random from a universe of size n below. Lemma 6.1. Suppose m is a power of two1. Then there is an algorithm A for choosing an item with probability 1/m that has space complexity of O(log log m) bits and time complexity of O(1) in the unit-cost RAM model. Proof. We generate a (log2 m)-bit integer C uniformly at random and record the sum of the digits in C. Choose the item only if the sum of the digits is 0, i.e. if C = 0. We remark that the algorithm in Lemma 6.1 has optimal space complexity as shown in Proposition 6.1 in Appendix B. We remark that the algorithm in Lemma 6.1 has optimal space complexity as shown in Proposition 6.1 below which may be of independent interest. We also note that every algo- rithm needs to toss a fair coin at least Ω(log m) times to perform any task with probability at least 1/m. Proposition 6.1. Any algorithm that chooses an item from a set of size n with probability p for 0 < p 6 1 n , in unit cost RAM model must use Ω(log log m) bits of memory. Proof. The algorithm generates t bits uniformly at random (the number of bits it generates uniformly at random may also depend on the outcome of the previous random bits) and finally picks an item from the say x. Consider a run R of the algorithm where it chooses the item x with smallest number of random bits getting generated; say it generates t random bits in this run R. This means that in any other run of the algorithm where the item x is chosen, the algorithm must generate at least t many random bits. Let the random bits generated in R be r1, · · · , rt. Let si be the memory content of the algorithm immediately after it generates ith random bit, for i ∈ [t], in the run R. First notice that if t < log2 n, then the probability with which the item x is chosen is more than 1 n , which would be a contradiction. Hence, t > log2 n. Now we claim that all the si's must be different. Indeed otherwise, let us assume 1In all our algorithms, whenever we pick an item with probability p > 0, we can assume, without loss of generality, that 1/p is a power of two. If not, then we replace p with p′ where 1/p ′ is the largest power of two less than 1/p. This does not affect correctness and performance of our algorithms. 117 si = sj for some i < j. Then the algorithm chooses the item x after generating t − (j − i) many random bits (which is strictly less than t) when the random bits being generated are r1, · · · , ri, rj+1, · · · , rt. This contradicts the assumption that the run R we started with chooses the item x with smallest number of random bits generated. Our second claim is a standard result for universal families of hash functions. Lemma 6.2. For S ⊆ A, δ ∈ (0, 1), and universal family of hash functions H = {hh : A → [⌈S2/δ⌉]}: Pr h∈UH [∃i 6= j ∈ S, h(i) = h(j)] 6 δ Proof. For every i 6= j ∈ S, since H is a universal family of hash functions, we have . Now we apply the union bound to get Prh∈UH[∃i 6= j ∈ Prh∈UH[h(i) = h(j)] 6 S2 S, h(i) = h(j)] 6 ⌈S2/δ⌉ ⌈S2/δ⌉ 6 δ 1 Our third claim is folklore and also follows from the celebrated DKW inequality [DKW56]. We provide a simple proof here that works for constant δ. Lemma 6.3. Let fi and fi be the frequencies of an item i in a stream S and in a random sample T of size r from S, respectively. Then for r > 2ε−2 log(2δ−1), with probability 1 − δ, for every universe item i simultaneously, 6 ε. fi r − (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) fi m(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Proof for constant δ. This follows by Chebyshev's inequality and a union bound. Indeed, consider a given i ∈ [n] with frequency fi and suppose we sample each of its occurrences pairwise-independently with probability r/m, for a parameter r. Then the expected number E[ fi] of sampled occurrences is fi · r/m and the variance Var[ fi] is fi · r/m(1 − r/m) 6 fir/m. Applying Chebyshev's inequality, fi − E[ fi](cid:12)(cid:12)(cid:12) Prh(cid:12)(cid:12)(cid:12) > rε 2i 6 Var[ fi] (rε/2)2 6 4fir mr2ε2 . ε2 for a constant C > 0 makes this probability at most 4fi Setting r = C we sample each element in the stream independently with probability r there exists an i for which fi − E[ fi] > rε most 1 2 is at most Pn 4fi Cm 6 4 i=1 100 , as desired. Cm . By the union bound, if m , then the probability C , which for C > 400 is at 118 For now, assume that the length of the stream is known in advance; we show in sec- tion 6.3.5 how to remove this assumption. 6.3.1 List Heavy Hitters Problem For the LIST HEAVY HITTERS problem, we present two algorithms. The first is slightly sub- optimal, but simple conceptually and already constitutes a very large improvement in the space complexity over known algorithms. We expect that this algorithm could be useful in practice as well. The second algorithm is more complicated, building on ideas from the first algorithm, and achieves the optimal space complexity upto constant factors. We note that both algorithms proceed by sampling O(ε−2 ln(1/δ)) stream items and up- dating a data structure as the stream progresses. In both cases, the time to update the data structure is bounded by O(1/ε), and so, under the standard assumption that the length of the stream is at least poly(ln(1/δ)ε), the time to perform this update can be spread out across the next O(1/ε) stream updates, since with large probability there will be no items sampled among these next O(1/ε) stream updates. Therefore, we achieve worst-case1 update time of O(1). 6.3.1.1 A Simpler, Near-Optimal Algorithm Theorem 6.1. Assume the stream length is known beforehand. Then there is a randomized one- pass algorithm A for the (ε, ϕ)-LIST HEAVY HITTERS problem which succeeds with probability at least 1 − δ using O(cid:0)ε−1(log ε−1 + log log δ−1) + ϕ−1 log n + log log m(cid:1) bits of space. Moreover, A has an update time of O(1) and reporting time linear in its output size. Overview The overall idea is as follows. We sample ℓ = O(ε−2) many items from the stream uniformly at random as well as hash the id's (the word "id" is short for identifier) of the sampled elements into a space of size O(ε−4). Now, both the stream length as well as the universe size are poly(ε−1). From Lemma 6.3, it suffices to solve the heavy hitters problem on the sampled stream. From Lemma 6.2, because the hash function is chosen from a universal family, the sampled elements have distinct hashed id's. We can then feed these elements into a standard Misra-Gries data structure with ε−1 counters, incurring space O(ε−1 log ε−1). 1We emphasize that this is stronger than an amortized guarantee, as on every insertion, the cost will be O(1). 119 Because we want to return the unhashed element id's for the heavy hitters, we also use log n space for recording the φ−1 top items according to the Misra-Gries data structure and output these when asked to report. Algorithm 5 for (ε, ϕ)-LIST HEAVY HITTERS Input: A stream S of length m over U = [n]; let f(x) be the frequency of x ∈ U in S Output: A set X ⊆ U and a function f : X → N such that if f(x) > ϕm, then x ∈ X and 1: Initialize: f(x) − εm 6 f(x) 6 f(x) + εm and if f(y) 6 (φ − ε)m, then y /∈ X for every x, y ∈ U 2: ℓ ← 6 log(6/δ)/ε2 3: Hash function h uniformly at random from a universal family 4: An empty table T1 of (key, value) pairs of length ε−1. Each key entry of H ⊆ {h : [n] → ⌈4ℓ2/δ⌉}. T1 can store an integer in [0, ⌈400ℓ2/δ⌉] and each value entry can store an integer in [0, 11ℓ]. throughout. ⊲ The table T1 will be in sorted order by value 5: An empty table T2 of length 1/ϕ. Each entry of T2 can store an integer in [0, n]. ⊲ The entries of T2 will correspond to ids of the keys in T1 of the highest 1/ϕ values 6: 7: procedure INSERT(x) 8: With probability p = 6ℓ/m, continue. Otherwise, return . Perform Misra-Gries update using h(x) maintaining T1 sorted by values. if The value of h(x) is among the highest 1/ϕ valued items in T1 then if xi is not in T2 then if T2 currently contains 1/ϕ many items then For y in T2 such that h(y) is not among the highest 1/ϕ valued items in T1, replace y with x. else We put x in T2. end if end if Ensure that elements in T2 are ordered according to corresponding values in T1. 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: end if 20: 21: end procedure 22: 23: procedure REPORT( ) 24: return items in T2 along with their corresponding values in T1 25: 26: end procedure 120 Proof of Theorem 6.1. The pseudocode of our (ε, ϕ)-LIST HEAVY HITTERS algorithm is in Al- gorithm 5. By Lemma 6.3, if we select a subset S of size at least ℓ = 6ε−2log(6δ−1) uniformly at random from the stream, then Pr[∀i ∈ U, ( fi/S) − (fi/n) 6 ε] > 1 − δ/3, where fi and fi are the frequencies of item i in the input stream and S respectively. First we show that with the choice of p in line 11 in Algorithm 5, the number of items sampled is at least ℓ and at most 11ℓ with probability at least (1 − δ/3). Let Xi be the indicator random variable of the event i=1 Xi. that the item xi is sampled for i ∈ [m]. Then the total number of items sampled X = Pm We have E[X] = 6ℓ since p = 6ℓ/m. Now we have the following. Pr[X 6 ℓ or X > 11ℓ] 6 Pr[X − E[X] > 5ℓ] 6 δ/3 The inequality follows from the Chernoff bound and the value of ℓ. From here onwards we assume that the number of items sampled is in [ℓ, 11ℓ]. We use (a modified version of) the Misra-Gries algorithm [MG82] to estimate the frequen- cies of items in S. The length of the table in the Misra-Gries algorithm is ε−1. We pick a hash function h uniformly at random from a universal family H = {hh : [n] → ⌈4ℓ2/δ⌉} of hash functions of size H = O(n2). Note that picking a hash function h uniformly at random from H can be done using O(log n) bits of space. Lemma 6.2 shows that there are no collisions in S under this hash function h with probability at least 1 − δ/3. From here onwards we assume that there is no collision among the ids of the sampled items under the hash function h. We modify the Misra-Gries algorithm as follows. Instead of storing the id of any item x in the Misra-Gries table (table T1 in line 5 in Algorithm 5) we only store the hash h(x) of the id x. We also store the ids (not the hash of the id) of the items with highest 1/ϕ values in T1 in another table T2. Moreover, we always maintain the table T2 consistent with the table T1 in the sense that the ith highest valued key in T1 is the hash of the ith id in T2. Upon picking an item x with probability p, we create an entry corresponding to h(x) in T1 and make its value one if there is space available in T1; decrement the value of every item in T1 by one if the table is already full; increment the entry in the table corresponding to h(x) if h(x) is already present in the table. When we decrement the value of every item in T1, the table T2 remains consistent and we do not need to do anything else. Otherwise there are three cases to consider. Case 1: h(x) is not among the 1/ϕ highest valued items in T1. In this case, we do not need to do anything else. Case 2: h(x) was not among the 1/ϕ highest valued items in T1 but now it is among the 1/ϕ highest valued items in T1. In this case the last item y in T2 is no longer among the 1/ϕ highest valued items in T1. We replace y with x in T2. Case 121 3: h(x) was among the 1/ϕ highest valued items in T1. When the stream finishes, we output the ids of all the items in table T2 along with the values corresponding to them in table T1. Correctness follows from the correctness of the Misra-Gries algorithm and the fact that there is no collision among the ids of the sampled items. 6.3.1.2 An Optimal Algorithm Theorem 6.2. Assume the stream length is known beforehand. Then there is a randomized one-pass algorithm A for the (ε, ϕ)-LIST HEAVY HITTERS problem which succeeds with constant probability using O(cid:0)ε−1 log φ−1 + φ−1 log n + log log m(cid:1) bits of space. Moreover, A has an update time of O(1) and reporting time linear in its output size. Note that in this section, for the sake of simplicity, we ignore floors and ceilings and state the results for a constant error probability, omitting the explicit dependence on δ. Overview As in the simpler algorithm, we sample ℓ = O(ε−2) many stream elements and solve the (ε/2, φ)-LIST HEAVY HITTERS problem on this sampled stream. Also, the Misra- Gries algorithm for (φ/2, φ)-LIST HEAVY HITTERS returns a candidate set of O(φ−1) items containing all items of frequency at least φℓ. It remains to count the frequencies of these O(φ−1) items with upto εℓ/2 = O(ε−1) additive error, so that we can remove those whose frequency is less than (φ − ε/2)ℓ. Fix some item i ∈ [n], and let fi be i's count in the sampled stream. A natural approach to count fi approximately is to increment a counter probabilistically, instead of deterministically, at every occurrence of i. Suppose that we increment a counter with probability 0 6 pi 6 1 whenever item i arrives in the stream. Let the value of the counter be ci, and let fi = It follows that if pi = Θ(ε2fi), then Var[fi] = O(ε−2), and hence, fi is an unbiased estimator of fi with additive error O(ε−1) with constant probability. We call such a counter an accelerated counter as the probability of incrementing accelerates with increasing counts. For each i, we can maintain O(log φ−1) ci/pi. We see that Ehfii = fi and Var[fi] 6 fi/pi. accelerated counters independently and take their median to drive the probability of deviating by more than O(ε−1) down to O(φ). So, with constant probability, the frequency for each of the O(φ−1) items in the Misra-Gries data structure is estimated within O(ε−1) error, as desired. However, there are two immediate issues with this approach. The first problem is that we may need to keep counts for Ω(ℓ) = Ω(ε−2) distinct items, which is too costly for our 122 Algorithm 6 for (ε, ϕ)-LIST HEAVY HITTERS Input: A stream S of length m over universe U = [n]; let f(x) be the frequency of x ∈ U in S Output: A set X ⊆ U and a function f : X → N such that if f(x) > ϕm, then x ∈ X and 1: Initialize: f(x) − εm 6 f(x) 6 f(x) + εm and if f(y) 6 (φ − ε)m, then y /∈ X for every x, y ∈ U 2: ℓ ← 105ε−2 3: s ← 0 4: Hash functions h1, . . . , h200 log(12φ−1) uniformly at random from a 5: An empty table T1 of (key, value) pairs of length 2φ−1. Each key entry universal family H ⊆ {h : [n] → [100/ε]}. of T1 can store an element of [n] and each value entry can store an integer in [0, 10ℓ]. 6: An empty table T2 with 100ε−1 rows and 200 log(12φ−1) columns. Each entry of T2 can store an integer in [0, 100εℓ]. 7: An empty 3-dimensional table T3 of size at most 100ε−1 × 200 log(12φ−1) × 4 log(ε−1). Each entry of T3 can store an integer in [0, 10ℓ]. ⊲ These are upper bounds; not all the allowed cells will actually be used. 8: 9: procedure INSERT(x) 10: With probability ℓ/m, increment s and continue. Else, return Perform Misra-Gries update on T1 with x. for j ← 1 to 200 log(12φ−1) do i ← hj(x) With probability ε, increment T2[i, j] t ← ⌊log(10−6T2[i, j]2)⌋ and p ← min(ε · 2t, 1) if t > 0 then With probability p, increment T3[i, j, t] end if end for 20: 21: end procedure 22: 23: procedure REPORT( ) 24: 11: 12: 13: 14: 15: 16: 17: 18: 19: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: X ← ∅ for each key x with nonzero value in T1 do for j ← 1 to 200 log(12φ−1) do fj(x) ← P4 log(ε−1) t=0 end for f(x) ← median(f1, . . . , f10 log φ−1) if f(x) > (φ − ε/2)s then T3[h(x), j, t]/ min(ε2t, 1) X ← X ∪ {x} end if end for return X, f 35: 36: end procedure 123 purposes. To get around this, we use a hash function from a universal family to hash the universe to a space of size u = Θ(ε−1), and we work throughout with the hashed id's. We can then show that the space complexity for each iteration is O(ε−1). Also, the accelerated counters now estimate frequencies of hashed id's instead of actual items, but because of universality, the expected frequency of any hashed id is ℓ/u = O(ε−1), our desired error bound. The second issue is that we need a constant factor approximation of fi, so that we can set pi to Θ(ε2fi). But because the algorithm needs to be one-pass, we cannot first compute pi in one pass and then run the accelerated counter in another. So, we divide the stream into epochs in which fi stays within a factor of 2, and use a different pi for each epoch. In particular, set pt i = ε · 2t for 0 6 t 6 log(pi/ε). We want to keep a running estimate of i's count to within a factor of 2 to know if the current epoch should be incremented. For this, we ε . We see that E(cid:2)¯fi(b)(cid:3) = fi(b), and Var[¯fi(b)] 6 subsample each element of the stream with probability ε independently and maintain exact counts for the observed hashed id's. It is easy to see that this requires only O(ε−1) bits in expectation. Consider any i ∈ [u] and the prefix of the stream upto b 6 ℓ, and let fi(b) be i's frequency in the prefix, let ¯ci(b) be i's frequency among the samples in the prefix, and ¯fi(b) = ¯ci(b) ε . By Chebyshev, for any fixed b, Pr[¯fi(b) − fi(b) > fi(b)/√2] 6 2 fi(b)ε, and hence, can show that ¯fi(b) is a √2-factor approximation of fi(b) with probability 1 − O((fi(b)ε)−1). Now, let pi(b) = Θ(ε2fi(b)), and for any epoch t, set bi,t = min{b : pi(b) > pt−1 }. The last makes sense because pi(b) is non-decreasing with b. Also, note that fi(bi,t) = Ω(2t/2/ε). So, by the union bound, the probability that there exists t for which ¯fi(bi,t) is not a √2-factor approximation of fi(bi,t) is at most Pt In fact, it follows then that with constant probability, for all b ∈ [ℓ], ¯fi(b) is a 2-factor approximation of fi(b). Moreover, we show that for any b ∈ [ℓ], ¯fi(b) is a 4-factor approximation of fi(b) with constant probability. By repeating O(log φ−1) times independently and taking the median, the error probability Ω(2t/2) , a small constant. fi(b) i 1 Ω(fi(bi,t)ε) = Pt 1 can be driven down to O(φ). Now, for every hashed id i ∈ [u], we need not one accelerated counter but O(log(εfi)) many, one corresponding to each epoch t. When an element with hash id i arrives at po- sition b, we decide, based on ¯fi(b), the epoch t it belongs to and then increment the t'th accelerated counter with probability pt i. The storage cost over all i is still O(1/ε). Also, we iterate the whole set of accelerated counters O(log φ−1) times, making the total storage cost O(ε−1 log φ−1). 124 Let ci,t be the count in the accelerated counter for hash id i and epoch t. Then, let fi = Pt ci,t/pt O(ε−2 log ε−1), not O(ε−2) which we wanted. This issue is fixed by a change in how the i. Clearly, Ehfii = fi. The variance is O(ε−2) in each epoch, and so, Var[fi] = sampling probabilities are defined. We now go on to the formal proof. Proof of Theorem 6.2. Pseudocode appears in algorithm 6. Note that the numerical constants are chosen for convenience of analysis and have not been optimized. Also, for the sake of simplicity, the pseudocode does not have the optimal reporting time, but it can be modified to achieve this; see the end of this proof for details. By standard Chernoff bounds, with probability at least 99/100, the length of the sampled stream ℓ/10 6 s 6 10ℓ. For x ∈ [n], let fsamp(x) be the frequency of x in the sampled stream. By Lemma 6.3, with probability at least 9/10, for all x ∈ [n]: fsamp(x) s − (cid:12)(cid:12)(cid:12)(cid:12) 6 ε 4 f(x) m (cid:12)(cid:12)(cid:12)(cid:12) Now, fix j ∈ [10 log φ−1] and x ∈ [n]. Let i = hj(x) and fi = Py:hj(y)=hj(x) fsamp(y). Then, for a random hj ∈ H, the expected value of fi 100 , since H is a universal mapping to a space of size 100ε−1. Hence, using Markov's inequality and the above: s − fsamp(x) is ε s < − fsamp ε > − m − > 1 10 + 1 25 ε > fsamp(x) f(x) m f(x) m fi s(cid:12)(cid:12)(cid:12)(cid:12) fi s(cid:12)(cid:12)(cid:12)(cid:12) ε 4(cid:21) < s (cid:12)(cid:12)(cid:12)(cid:12) Pr(cid:20)(cid:12)(cid:12)(cid:12)(cid:12) 4(cid:21) + Pr(cid:20)(cid:12)(cid:12)(cid:12)(cid:12) 2(cid:21) 6 Pr(cid:20)(cid:12)(cid:12)(cid:12)(cid:12) 3 20 (6.1) In Lemma 6.4 below, we show that for each j ∈ [200 log(12φ−1)], with error probability at most 3/10, fj(x) (in line 27) estimates fi with additive error at most 5000ε−1, hence esti- mating fi 2 . Taking the median over 200 log(12φ−1) repetitions (line 29) makes the error probability go down to φ 6 using standard Chernoff bounds. Hence, by the union bound, with probability at least 2/3, for each of the 2/φ keys x with nonzero values in T1, we have an estimate of f(x) m within additive error ε, thus showing correctness. Lemma 6.4. Fix x ∈ [n] and j ∈ [200 log 12φ−1], and let i = hj(x). Then, Pr[fj(x) − fi > 5000ε−1] 6 3/10, where fj is the quantity computed in line 27. s with additive error at most ε Proof. Index the sampled stream elements 1, 2, . . . , s, and for b ∈ [s], let fi(b) be the fre- quency of items with hash id i restricted to the first b elements of the sampled stream. Let ¯fi(b) denote the value of T2[i, j] · ε−1 after the procedure INSERT has been called for the first b items of the sampled stream. 125 Claim 6.1. With probability at least 9/10, for all b ∈ [s] such that fi(b) > 100ε−1, ¯fi(b) is within a factor of 4 of fi(b). Proof. Fix b ∈ [s]. Note that E(cid:2)¯fi(b)(cid:3) = fi(b) as T2 is incremented with rate ε. Var[¯fi(b)] 6 fi/ε, and so by Chebyshev's inequality: Pr[¯fi(b) − fi(b) > fi(b)/2] < 4 fi(b)ε We now break the stream into chunks, apply this inequality to each chunk and then take a union bound to conclude. Namely, for any integer t > 0, define bt to be the first b such that 100ε−12t 6 fi(b) < 100ε−12t+1 if such a b exists. Then: Pr[∃t > 0 : ¯fi(bt) − fi(bt) > fi(bt)/2] < X t 1 10 < 4 100 · 2t−1 So, with probability at least 9/10, every ¯fi(bt) and fi(bt) are within a factor of 2 of each other. Since for every b > b0, fi(b) is within a factor of 2 from some fi(bt), the claim follows. Assume the event in Claim 6.1 henceforth. Now, we are ready to analyze T3 and in particular, fj(x). First of all, observe that if t < 0 in line 16, at some position b in the stream, then T2[i, j] at that time must be at most 1000, and so by standard Markov and Chernoff bounds, with probability at least 0.85, fi(b)  < 4000ε−1, > 100ε−1, if t < 0 if t > 0 (6.2) Assume this event. Then, fi − 4000ε−1 6 Ehfj(x)i 6 fi. Claim 6.2. Var(fj(x)) 6 20000ε−2 Proof. If the stream element at position b causes an increment in T3 with probability ε2t (in line 18), then 1000 · 2t/2 6 T2[i, j] 6 1000 · 2(t+1)/2, and so, ¯fi(b) 6 1000ε−12(t+1)/2. This must be the case for the highest b = ¯bt at which the count for i in T3 increments at the t'th 126 slot. The number of such occurrences of i is at most fi(¯bt) 6 4 ¯fi(¯bt) 6 4000ε−12(t+1)/2 by Claim 6.1 (which can be applied since fi(b) > 100ε−1 by Equation 6.2). So: Var[fj(x)] 6 X t>0 fi(¯bt) ε2t 6 X t>0 4000 ε2 2−t/3 6 20000ε−2 Elements inserted with probability 1 obviously do not contribute to the variance. So, conditioning on the events mentioned, the probability that fj(x) deviates from fi by more than 5000ε−1 is at most 1/50. Removing all the conditioning yields what we wanted: Pr[fj(x) − fi > 5000ε−1] 6 1 50 + 3 20 + 1 10 6 0.3 We next bound the space complexity. Claim 6.3. With probability at least 2/3, algorithm 6 uses O(ε−1 log φ−1 + φ−1 log n + log log m) bits of storage, if n = ω(ε−1). Proof. The expected length of the sampled stream is ℓ = O(ε−2). So, the number of bits stored in T1 is O(φ−1 log n). For T2, note that in lines 13-15, for any given j, T2 is storing a total of εℓ = O(ε−1) elements in expectation. So, for k > 0, there can be at most O((ε2k)−1) hashed id's with counts between 2k and 2k+1. Summing over all k's and accounting for the empty cells gives O(ε−1) bits of storage, and so the total space requirement of T2 is O(ε−1 log φ−1). . The probability that a hashed id i gets counted in table T3 is at most 10−6ε3 ¯f2 i (s) from line 16 and our definition of ¯fi above. Moreover, from Claim 6.1, we have that this is at most 16 · 10−6ε3f2 i (s) if fi > 100ε−1. Therefore, if fi = 2k · 100ε−1 with k > 0, then the expected value of a cell in T3 with first coordinate i is at most 1600 · 22kε = 2O(k). Taking into account that there are at most O((ε2k)−1) many such id's i and that the number of epochs t associated with such an i is at most log(16 · 10−6ε2f2 i ) = O(log(εfi)) = O(k) (from line 16), we get that 127 the total space required for T3 is: O(log φ−1) j=1 O(ε−1) + ∞X X = O(ε−1 log φ−1) k=0 O((ε2k)−1) · O(k) · O(k)! where the first O(ε−1) term inside the summation is for the i's with fi < 100ε−1. Since we have an expected space bound, we obtain a worst-case space bound with error probability 1/3 by a Markov bound. The space required for sampling is an additional O(log log m), using Lemma 6.1. We note that the space bound can be made worst case by aborting the algorithm if it tries to use more space. The only remaining aspect of Theorem 6.2 is the time complexity. As observed in sec- tion 6.3.1, the update time can be made O(1) per insertion under the standard assumption of the stream being sufficiently long. The reporting time can also be made linear in the output by changing the bookkeeping a bit. Instead of computing fj and f at reporting time, we can maintain them after every insertion. Although this apparently makes INSERT costlier, this is not true in fact because we can spread the cost over future stream insertions. The space complexity grows by a constant factor. 6.3.2 ε-Maximum Problem By tweaking Algorithm 5 slightly, we get the following result for the ε-MAXIMUM problem. Theorem 6.3. Assume the length of the stream is known beforehand. Then there is a random- ized one-pass algorithm A for the ε-MAXIMUM problem which succeeds with probability at least 1 − δ using O (min{1/ε, n}(log 1/ε + log log 1/δ) + log n + log log m) bits of space. Moreover, the algorithm A has an update time of O(1). Proof. Instead of maintaining the table T2 in Algorithm 5, we just store the actual id of the item with maximum frequency in the sampled items. 128 6.3.3 ε-Minimum Problem Theorem 6.4. Assume the length of the stream is known beforehand. Then there is a randomized one-pass algorithm A for the ε-MINIMUM problem which succeeds with probability at least 1 − δ using O ((1/ε) log log(1/εδ) + log log m) bits of space. Moreover, the algorithm A has an update time of O(1). Overview Pseudocode is provided in algorithm 7. The idea behind our ε-Minimum problem is as follows. It is most easily explained by looking at the REPORT(x) procedure starting in line 13. In lines 14-15 we ask, is the universe size U significantly larger than 1/ε? Note that if it is, then outputting a random item from U is likely to be a solution. Otherwise U is O(1/ε). The next point is that if the number of distinct elements in the stream were smaller than 1/(ε log(1/ε)), then we could just store all the items together with their frequencies with O(1/ε) bits of space. Indeed, we can first sample O(1/ε2) stream elements so that all relative frequencies are preserved up to additive ε, thereby ensuring each frequency can be stored with O(log(1/ε) bits. Also, since the universe size is O(1/ε), the item identifiers can also be stored with O(log(1/ε) bits. So if this part of the algorithm starts taking up too much space, we stop, and we know the number of distinct elements is at least 1/(ε log(1/ε)), which means that the minimum frequency is at most O(mε log(1/ε)). This is what is being implemented in steps 9-10 and 18-19 in the algorithm. We can also ensure the minimum frequency is at least Ω(mε/ log(1/ε)). Indeed, by ran- domly sampling O((log(1/ε)/ε) stream elements, and maintaining a bit vector for whether or not each item in the universe occurs - which we can with O(1/ε) bits of space since U = O(1/ε) - any item with frequency at least Ω(εm/ log(1/ε)) will be sampled and so if there is an entry in the bit vector which is empty, then we can just output that as our solution. This is what is being implemented in steps 8 and 16-17 of the algorithm. Finally, we now know that the minimum frequency is at least Ω(mε/ log(1/ε)) and at most O(mε log(1/ε)). At this point if we randomly sample O((log6 1/ε)/ε) stream elements, then by Chernoff bounds all item frequencies are preserved up to a relative error factor of (1 ± 1/ log2(1/ε)), and in particular the relative minimum frequency is guaranteed to be preserved up to an additive ε. At this point we just maintain the exact counts in the sampled stream but truncate them once they exceed poly(log(1/ε))) bits, since we know such counts 129 do not correspond to the minimum. Thus we only need O(log log(1/ε)) bits to represent their counts. This is implemented in step 11 and step 20 of the algorithm. Algorithm 7 for ε-MINIMUM Input: A stream S = (xi)i∈[m] ∈ Um of length m over U; let f(x) be the frequency of x ∈ U Output: An item x ∈ U such that f(x) 6 f(y) + εm for every y ∈ U 1: Initialize: in S 2: ℓ1 ← log(6/εδ)/ε, ℓ2 ← log(6/δ)/ε2, ℓ3 ← log6(6/δε)/ε 3: p1 ← 6ℓ1/m, p2 ← 6ℓ2/m, p3 ← 6ℓ3/m 4: S1, S2, S3 ← ∅ 5: B1 ← the bit vector for S1 6: 7: procedure INSERT(x) 8: 9: 10: 11: 12: Put x in S1 with probability p1 by updating the bit vector B1 if the number of distinct items in the stream so far is at most 1/(ε log(1/ε)) then Pick x with probability p2 and put the id of x in S2 and initialize the corresponding counter to 1 if x /∈ S2 and increment the counter corresponding to x by 1. end if Pick x with probability p3, put the id of x in S3 and initialize the corresponding counter to 1 if xi /∈ S3 and increment the counter corresponding to xi by 1. Truncate counters of S3 at 2 log7(2/εδ). 13: end procedure 14: 15: procedure REPORT( ) 16: if U > 1/((1−δ)ε) then 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: return an item x from the first 1/((1−δ)ε) items in U (ordered arbitrarily) uniformly at random end if if S1 6= U then return any item from U \ S1 end if if the number of distinct items in the stream is at most 1/(ε log(1/ε)) then return an item in S2 with minimum counter value in S2 end if return the item with minimum frequency in S3 29: 30: end procedure 130 Proof of Theorem 6.4. The pseudocode of our ε-MINIMUM algorithm is in Algorithm 7. If the size of the universe U is at least 1/((1−δ)ε), then we return an item x chosen from U uniformly at random. Note that there can be at most 1/ε many items with frequency at least εm. Hence every item x among other remaining δ/((1−δ)ε) many items has frequency less than εm and thus is a correct output of the instance. Thus the probability that we answer correctly is at least (1 − δ). From here on, let us assume U < 1/((1−δ)ε). Now, by the value of pj, it follows from the proof of Theorem 6.1 that we can assume ℓj < Sj < 11ℓj for j = 1, 2, 3 which happens with probability at least (1 − (δ/3)). We first show that every item in U with frequency at least εm is sampled in S1 with probability at least (1 − (δ/6)). For that, let Xj i be the indicator random variable for the event that the jth sample in S1 is item i where i ∈ U is an item with frequency at least εm. Let H ⊂ U be the set of items with frequencies at least εm. Then we have the following. Pr[Xj i = 0] = 1 − ε ⇒ Pr[Xj i = 0 ∀j ∈ S1] 6 (1 − ε)ℓ1 6 exp{−εℓ1} = εδ/6 Now applying union bound we get the following. Pr[∃i ∈ H, Xj i = 0 ∀j ∈ S1] 6 (1/ε)εδ/6 6 δ/6 Hence with probability at least (1 − (δ/3) − (δ/6)) > (1 − δ), the output at line 22 is correct. Now we show below that if the frequency of any item x ∈ U is at most ε ln(6/δ)/ln(6/εδ), then x ∈ S1 with probability at least (1 − (δ/6)). Pr[x /∈ S1] = (1 − ε ln(6/δ)/ln(6/εδ))ln(6/εδ)/ε 6 δ/6 Hence from here onwards we assume that the frequency of every item in U is at least εm ln(6/δ)/ln(6/εδ). If the number of distinct elements is at most 1/(ε ln(1/ε)), then line 26 outputs the mini- mum frequency item up to an additive factor of εm due to Chernoff bound. Note that we need only O(ln(1/((1−δ)ε))) bits of space for storing ids. Hence S2 can be stored in space O((1/ε ln(1/ε)) ln(1/((1−δ)ε) ln ln(1/δ)) = O(1/ε ln ln(1/δ)). Now we can assume that the number of distinct elements is at least 1/(ε ln(1/ε)). Hence if f(t) is the frequency of the item t with minimum frequency, then we have mε/ln(1/ε) 6 f(t) 6 mε ln(1/ε). 131 Let fi be the frequency of item i ∈ U, ei be the counter value of i in S3, and fi = eim/ℓ3. Now again by applying Chernoff bound we have the following for any fixed i ∈ U. Pr[fi − fi > fi/ln2(1/ε)] 6 2 exp{−ℓ3fi/(m ln4(1/ε))} 6 2 exp{−fi ln2(6/εδ)/(εm)} 6 εδ/6. Now applying union bound we get the following using the fact that U 6 1/ε(1−δ). Pr[∀i ∈ U, fi − fi 6 fi/ln2(1/ε)] > 1 − δ/6 Again by applying Chernoff bound and union bound we get the following. Pr[∀i ∈ U with fi > 2mε ln(1/ε), fi − fi 6 fi/2] > 1 − δ/6 Hence the items with frequency more than 2mε ln(1/ε) are approximated up to a multiplica- tive factor of 1/2 from below in S3. The counters of these items may be truncated. The other items with frequency at most 2mε ln(1/ε) are be approximated up to (1 ± 1/ln2(1/ε)) relative error and thus up to an additive error of εm/3. The counters of these items would not get truncated. Hence the item with minimum counter value in S3 is the item with minimum frequency up to an additive εm. We need O(ln(1/εδ)) bits of space for the bit vector B1 for the set S1. We need O(ln2(1/εδ)) bits of space for the set S2 and O((1/ε) ln ln(1/εδ)) bits of space for the set S3 (by the choice of truncation threshold). We need an additional O (ln ln m) bits of space for sampling using Lemma 6.1. Moreover, using the data structure of Section 3.3 of [DLOM02] Algorithm 7 can be performed in O(1) time. Alternatively, we may also use the strategy described in section 6.3.1 of spreading update operations over several insertions to make the cost per insertion be O(1). 6.3.4 Problems for the Borda and Maximin Voting Rules Theorem 6.5. Assume the length of the stream is known beforehand. Then there is a randomized one-pass algorithm A for (ε, ϕ)-LIST BORDA problem which succeeds with probability at least 1 − δ using O(cid:0)n(cid:0)log n + log 1 ε + log log 1 δ(cid:1) + log log m(cid:1) bits of space. 132 Proof. Let ℓ = 6ε−2 log(6nδ−1) and p = 6ℓ/m. On each insertion of a vote v, select v with probability p and store for every i ∈ [n], the number of candidates that candidate i beats in the vote v. Keep these exact counts in a counter of length n. Then it follows from the proof of Theorem 6.1 that ℓ 6 S 6 11ℓ with probability at least (1 − δ/3). Moreover, from a straightforward application of the Chernoff bound (see [DB15]), it follows that if s(i) denotes the Borda score of candidate i restricted to the sampled votes, then: m S Pr(cid:20)∀i ∈ [n],(cid:12)(cid:12)(cid:12)(cid:12) < εmn(cid:21) > 1 − δ s(i) − s(i)(cid:12)(cid:12)(cid:12)(cid:12) The space complexity for exactly storing the counts is O(n log(nℓ)) = O(n(log n+log ε−1+ log log δ−1)) and the space for sampling the votes is O(log log m) by Lemma 6.1. Theorem 6.6. Assume the length of the stream is known beforehand. Then there is a randomized one-pass algorithm A for (ε, ϕ)-LIST MAXIMIN problem which succeeds with probability at least 1 − δ using O(cid:16)nε−2 log2 n + nε−2 log n log δ−1 + log log m(cid:17) bits of space. Proof. Let ℓ = (8/ε2) ln(6n/δ) and p = 6ℓ/m. We put the current vote in a set S with probability p. Then it follows from the proof of Theorem 6.1 that ℓ 6 S 6 11ℓ with probability at least (1 − δ/3). Suppose S = ℓ1; let S = {vi : i ∈ [ℓ1]} be the set of votes sampled. Let DE(x, y) be the total number of votes in which x beats y and DS(x, y)) be the number of such votes in S. Then by the choice of ℓ and the Chernoff bound (see [DB15]), it follows that DS(x, y)m/ℓ1 − DE(x, y) 6 εm/2 for every pair of candidates x, y ∈ U. Note that each vote can be stored in O(n log n) bits of space. Hence simply finding DS(x, y) for every x, y ∈ U by storing S and returning all the items with maximin score at least (φ − ε/2)ℓ1 in S requires O(cid:0)nε−2 log n(log n + log δ−1) + log log m(cid:1) bits of memory, with the additive O(log log m) due to Lemma 6.1. 6.3.5 Algorithms with Unknown Stream Length Now we consider the case when the length of the stream is not known beforehand. We present below an algorithm for (ε, ϕ)-LIST HEAVY HITTERS and ε-MAXIMUM problems in the setting where the length of the stream is not known beforehand. Theorem 6.7. There is a randomized one-pass algorithm for (ε, ϕ)-LIST HEAVY HITTERS and ε-MAXIMUM problems with space complexity O(cid:0)ε−1 log ε−1 + ϕ−1 log n + log log m(cid:1) bits and update time O(1) even when the length of the stream is not known beforehand. 133 Proof. We describe below a randomized one-pass algorithm for the (8ε, ϕ)-LIST HEAVY HIT- TERS problem. We may assume that the length of the stream is at least 1/ε2; otherwise, we use the algorithm in Theorem 6.1 and get the result. Now we guess the length of the stream to be 1/ε2, but run an instance I1 of Algorithm 5 with ℓ = log(6/δ)/ε3 at line 2. By the choice of the size of the sample (which is Θ(log(1/δ)/ε3)), I1 outputs correctly with probability at least (1 − δ), if the length of the stream is in [1/ε2, 1/ε3]. If the length of the stream exceeds 1/ε2, we run another instance I2 of Algorithm 5 with ℓ = log(6/δ)/ε3 at line 2. Again by the choice of the size of the sample, I2 outputs correctly with probability at least (1 − δ), if the length of the stream is in [1/ε3, 1/ε4]. If the stream length exceeds 1/ε3, we discard I1, free the space it uses, and run an instance I3 of Algorithm 5 with ℓ = log(6/δ)/ε3 at line 2 and so on. At any point of time, we have at most two instances of Algorithm 5 running. When the stream ends, we return the output of the older of the instances we are currently running. We use the approximate counting method of Morris [Mor78] to approximately count the length of the stream. We know that the Morris counter outputs correctly with probability (1 − 2−k/2) using O(log log m + k) bits of space at any point in time [Fla85]. Also, since the Morris counter increases only when an item is read, it outputs correctly up to a factor of four at every position if it outputs correctly at positions 1, 2, 4, . . . , 2⌊log2 m⌋; call this event E. Then we have Pr(E) > 1 − δ by choosing k = 2 log2(log2 m/δ) and applying union bound over the positions 1, 2, 4, . . . , 2⌊log2 m⌋. The correctness of the algorithm follows from the correctness of Algorithm 5 and the fact that we are discarding at most εm many items in the stream (by discarding a run of an instance of Algorithm 5). The space complexity and the O(1) update time of the algorithm follow from Theorem 6.1, the choice of k above, and the fact that we have at most two instances of Algorithm 5 currently running at any point of time. The algorithm for the ε-MAXIMUM problem is same as the algorithm above except we use the algorithm in Theorem 6.3 instead of Algorithm 5. Note that this proof technique does not seem to apply to our optimal algorithm 6. Sim- ilarly to Theorem 6.7, we get the following result for the ε-MINIMUM, (ε, φ)-BORDA, and (ε, φ)-MAXIMIN problems. Theorem 6.8. There are randomized one-pass algorithms for ε-MINIMUM, (ε, φ)-BORDA, and (ε, φ)-MAXIMIN problems space complexity O ((1/ε) log log(1/εδ) + log log m), O(cid:16)nε−2 log2 n + nε−2 log n log(1/δ) + log log m(cid:17) bits respectively even when the length of the stream is not known beforehand. Moreover, the update time for ε-MINIMUM is O(1). O(cid:0)n(cid:0)log n + log 1 δ(cid:1) + log log m(cid:1), and with ε + log log 1 134 6.4 Results on Space Complexity Lower Bounds In this section, we prove space complexity lower bounds for the ε-HEAVY HITTERS, ε- MINIMUM, ε-BORDA, and ε-MAXIMIN problems. We present reductions from certain com- munication problems for proving space complexity lower bounds. Let us first introduce those communication problems with necessary results. 6.4.1 Communication Complexity Definition 6.9. (INDEXINGm,t ) Let t and m be positive integers. Alice is given a string x = (x1, · · · , xt) ∈ [m]t. Bob is given an index i ∈ [t]. Bob has to output xi. The following is a well known result [KN97]. Lemma 6.5. R1-way δ (INDEXING m,t) = Ω(t log m) for constant δ ∈ (0, 1). Definition 6.10. (AUGMENTED-INDEXINGm,t ) Let t and m be positive integers. Alice is given a string x = (x1, · · · , xt) ∈ [m]t. Bob is given an integer i ∈ [t] and (x1, · · · , xi−1). Bob has to output xi. The following communication complexity lower bound result is due to [EJS10] by a simple extension of the arguments of Bar-Yossef et al [BYJKS02]. Lemma 6.6. R1-way δ (AUGMENTED-INDEXING m,t) = Ω((1 − δ)t log m) for any δ < 1 − 3 2m . [SW15] defines a communication problem called PERM, which we generalize to ε-PERM as follows. Definition 6.11. (ε-PERM) Alice is given a permutation σ over [n] which is partitioned into 1/ε many contiguous blocks. Bob is given an index i ∈ [n] and has to output the block in σ where i belongs. Our lower bound for ε-PERM matches the lower bound for PERM in Lemma 1 in [SW15] when ε = 1/n. For the proof, the reader may find useful some information theory facts described in Appendix A. Lemma 6.7. R1-way δ (ε − PERM) = Ω(n log(1/ε)), for any constant δ < 1/10. 135 Proof. Let us assume σ, the permutation Alice has, is uniformly distributed over the set of all permutations. Let τj denotes the block the item j is in for j ∈ [n], τ = (τ1, . . . , τn), and τ<j = (τ1, . . . , τj−1). Let M(τ) be Alice's message to Bob, which is a random variable depending on the randomness of σ and the private coin tosses of Alice. Then we have R1−way(ε − PERM) > H(M(τ)) > I(M(τ); τ). Hence it is enough to lower bound I(M(τ); τ). Then we have the following by chain rule. I(M(τ); τ) = = > n X j=1 n X j=1 I(M(τ); τjτ<j) H(τjτ<j) − H(τjM(τ), τ<j) n X j=1 H(τjτ<j) − n X j=1 H(τjM(τ)) = H(τ) − n X j=1 H(τjM(τ)) The number of ways to partition n items into 1/ε blocks is n!/((εn)!)(1/ε) which is Ω((n/e)n/(εn/e)n). Hence we have H(τ) = n log(1/ε). Now we consider H(τjM(τ)). By the correctness of the algorithm, Fano's inequality, we have H(τjM(τ)) 6 H(δ)+(1/10) log2((1/ε)−1) 6 (1/2) log(1/ε). Hence we have the following. I(M(τ); τ) > (n/2) log(1/ε) Finally, we consider the GREATER-THAN problem. Definition 6.12. (GREATER-THANn ) Alice is given an integer x ∈ [n] and Bob is given an integer y ∈ [n], y 6= x. Bob has to output 1 if x > y and 0 otherwise. The following result is due to [Smi88, MNSW98]. We provide a simple proof of it that seems to be missing1 in the literature. Lemma 6.8. R1-way δ (GREATER-THAN n) = Ω(log n), for every δ < 1/4. 1A similar proof appears in [KNR99] but theirs gives a weaker lower bound. 136 Proof. We reduce the AUGMENTED-INDEXING2,⌈log n⌉+1 problem to the GREATER-THANn prob- lem thereby proving the result. Alice runs the GREATER-THANn protocol with its input number whose representation in binary is a = (x1x2 · · · x⌈log n⌉1)2. Bob participates in the GREATER-THANn protocol with its input number whose representation in binary is b = (x1x2 · · · xi−11 )2. Now xi = 1 if and only if a > b. 0· · · 0 {z } (⌈log n⌉−i+1) 0′s 6.4.2 Reductions from Problems in Communication Complexity We observe that a trivial Ω((1/ϕ) log n) bits lower bound for (ε, ϕ)-LIST HEAVY HITTERS, (ε, ϕ)-LIST BORDA, (ε, ϕ)-LIST MAXIMIN follows from the fact that any algorithm may need to output 1/φ many items from the universe. Also, there is a trivial Ω(n log n) lower bound for (ε, ϕ)-LIST BORDA and (ε, ϕ)-LIST MAXIMIN because each stream item is a permutation on [n], hence requiring Ω(n log n) bits to read. We show now a space complexity lower bound of Ω( 1 ε log 1 φ ) bits for the ε-HEAVY HITTERS problem. Theorem 6.9. Suppose the size of universe n is at least 1/(εφµ) for any constant µ > 0 and that φ > 2ε. Any randomized one pass (ε, φ)-HEAVY HITTERS algorithm with success probability at least (1 − δ) must use Ω((1/ε) log 1/φ) bits of space, for constant δ ∈ (0, 1). Proof. Let µ > 0 be any constant. Without loss of generality, we can assume µ 6 1. We will show that, when n > 1/(εφµ), any ε-HEAVY HITTERS algorithm must use Ω((1/ε) log 1/φ) bits of memory, thereby proving the result. Consider the INDEXING1/φµ,1/ε problem where Alice is given a string x = (x1, x2, · · · , x1/ε) ∈ [1/φµ]1/ε and Bob is given an index i ∈ [1/ε]. The stream we generate is over [1/φµ] × [1/ε] ⊆ U (this is possible since U > 1/(εφµ)). Alice generates a stream of length m/2 in such a way that the frequency of every item in {(xj, j) : j ∈ [1/ε]} is at least ⌊εm/2⌋ and the frequency of any other item is 0. Alice now sends the memory content of the algorithm to Bob. Bob resumes the run of the algorithm by generating another stream of length m/2 in such a way that the frequency of every item in {(j, i) : j ∈ [1/φµ]} is at least ⌊φµm/2⌋ and the frequency of any other item is 0. The frequency of the item (xi, i) is at least ⌊εm/2 + φµm/2⌋ whereas the frequency of every other item is at most ⌊φµm/2⌋. Hence from the output of the (ε/5, φ/2)-HEAVY HITTERS algorithm Bob knows i with probability at least (1 − δ). Now the result follows from Lemma 6.5. 137 We now use the same idea as in the proof of Theorem 6.9 to prove an Ω( 1 ε log 1 ε ) space complexity lower bound for the ε-Maximum problem. Theorem 6.10. Suppose the size of universe n is at least 1 ε1+µ for any constant µ > 0. Any randomized one pass ε-MAXIMUM algorithm with success probability at least (1 − δ) must use Ω( 1 ε) bits of space, for constant δ ∈ (0, 1). ε log 1 ε1+µ , any ε-MAXIMUM algorithm must use Ω( 1 Proof. Let µ > 0 be any constant. Without loss of generality, we can assume µ 6 1. We will show that, when n > 1 ε ) bits of memory, thereby proving the result. Consider the INDEXING1/εµ,1/ε problem where Alice is given a string x = (x1, x2, · · · , x1/ε) ∈ [1/εµ]1/ε and Bob is given an index i ∈ [1/ε]. The stream we generate is over [1/εµ] × [1/ε] ⊆ U (this is possible since U > 1 ε1+µ ). Alice generates a stream of length m/2 in such a way that the frequency of every item in {(xj, j) : j ∈ [1/ε]} is at least ⌊εm/2⌋ and the frequency of any other item is 0. Alice now sends the memory content of the algorithm ε log 1 to Bob. Bob resumes the run of the algorithm by generating another stream of length m/2 in such a way that the frequency of every item in {(j, i) : j ∈ [1/εµ]} is at least ⌊εµm/2⌋ and the frequency of any other item is 0. The frequency of the item (xi, i) is at least ⌊εm/2 + εµm/2⌋ where as the frequency of every other item is at most ⌊εµm/2⌋. Hence the ε/5-MAXIMUM algorithm must output (xi, i) with probability at least (1 − δ). Now the result follows from Lemma 6.5. For ε-MINIMUM, we prove a space complexity lower bound of Ω(1/ε) bits. Theorem 6.11. Suppose the universe size n is at least 1/ε. Then any randomized one pass ε-MINIMUM algorithm must use Ω(1/ε) bits of space. Proof. We reduce from INDEXING2,5/ε to ε-MINIMUM thereby proving the result. Let the inputs to Alice and Bob in INDEXING2,5/ε be (x1, . . . , x5/ε) ∈ {0, 1}5/ε and an index i ∈ [5/ε] respectively. Alice and Bob generate a stream S over the universe [(5/ε) + 1]. Alice puts two copies of item j in S for every j ∈ U with xj = 1 and runs the ε-MINIMUM algorithm. Alice now sends the memory content of the algorithm to Bob. Bob resumes the run of the algorithm by putting two copies of every item in U \ {i, (5/ε) + 1} in the stream S. Bob also puts one copy of (5/ε) + 1 in S. Suppose the size of the support of (x1, . . . , x5/ε) be ℓ. Since 1/(2ℓ+(2/ε)−1) > ε/5, we have the following. If xi = 0, then the ε-MINIMUM algorithm must output i with probability at least (1 − δ). If xi = 1, then the ε-MINIMUM algorithm must output (5/ε) + 1 with probability at least (1 − δ). Now the result follows from Lemma 6.5. 138 We show next a Ω(n log(1/ε)) bits space complexity lower bound for ε-BORDA. Theorem 6.12. Any one pass algorithm for ε-BORDA must use Ω(n log(1/ε)) bits of space. Proof. We reduce ε-PERM to ε-BORDA. Suppose Alice has a permutation σ over [n] and Bob has an index i ∈ [n]. The item set of our reduced election is U = [n] ⊔ D, where D = {d1, d2, . . . , d2n}. Alice generates a vote v over the item set U from σ as follows. The vote v is B1 ≻ B2 ≻ · · · ≻ B1/ε where Bj for j = 1, . . . , 1/ε is defined as follows. Bj = d(j−1)2εn+1 ≻ d(j−1)2εn+2 ≻ · · · ≻ d(2j−1)εn ≻ σjεn+1 ≻ · · · ≻ σ(j+1)εn ≻ d(2j−1)ε+1 ≻ · · · ≻ d2jεn Alice runs the ε-BORDA algorithm with the vote v and sends the memory content to Bob. Let D−i = D \ {i}, −−→D−i be an arbitrary but fixed ordering of the items in D−i, and ←−−D−i be the reverse ordering of −−→D−i. Bob resumes the algorithm by generating two votes each of the form i ≻ −−→D−i and i ≻ ←−−D−i. Let us call the resulting election E. The number of votes m in E is 5. The Borda score of the item i is at least 12n. The Borda score of every item x ∈ U is at most 9n. Hence for ε < 1/15, the ε-BORDA algorithm must output the item i. Moreover, it follows from the construction of v that an εmn additive approximation of the Borda score of the item i reveals the block where i belongs in the ε-PERM instance. We next give a nearly-tight lower bound for the ε-MAXIMIN problem. Theorem 6.13. Any one-pass algorithm for ε-MAXIMIN requires Ω(n/ε2) memory bits of stor- age. Proof. We reduce from INDEXING. Let γ = 1/ε2. Suppose Alice has a string y of length (n−γ)·γ, partitioned into n−γ blocks of length γ each. Bob has an index ℓ = i+(j−γ−1)·γ where i ∈ [γ], j ∈ {γ + 1, . . . , n}. The INDEXING problem is to return yℓ for which there is a Ω(y) = Ω(n/ε2) lower bound (Lemma 6.5). The initial part of the reduction follows the construction in the proof of Theorem 6 in [VWWZ15], which we encapsulate in the following lemma. Lemma 6.9 (Theorem 6 in [VWWZ15]). Given y, Alice can construct a matrix P ∈ {0, 1}n×γ using public randomness, such that if Pi and Pj are the i'th and j'th rows of P respectively, then with probability at least 2/3, ∆(Pi, Pj) > γ 2 + √γ if yℓ = 1 and ∆(a, b) 6 γ 2 − √γ if yℓ = 0. 139 Let Alice construct P according to Lemma 6.9 and then adjoin the bitwise complement of the matrix P below P to form the matrix P′ ∈ {0, 1}2n×γ; note that each column of P′ has exactly n 1's and n 0's. Now, we interpret each row of P as a candidate and each column of P as a vote in the following way: for each v ∈ [γ], vote v has the candidates in {c : P′c,v = 1} in ascending order in the top n positions and the rest of the candidates in ascending order in the bottom n positions. Alice inserts these γ votes into the stream and sends the state of the ε-MAXIMIN algorithm to Bob as well as the Hamming weight of each row in P′. Bob inserts γ more votes, in each of which candidate i comes first, candidate j comes second, and the rest of the 2n − 2 candidates are in arbitrary order. Note that because of Bob's votes, the maximin score of j is the number of votes among the ones casted by Alice in which j defeats i. Since i < j, in those columns v where Pi,v = Pj,v, candidate i beats candidate j. Thus, the set of votes in which j defeats i is {v Pi,v = 0, Pj,v = 1}. The size of this set is 1 2(cid:0)∆(Pi, Pj) + Pj − Pi(cid:1). Therefore, if Bob can estimate the maximin score of j upto √γ/4 additive error, he can find ∆(Pi, Pj) upto √γ/2 additive error as Bob knows Pi and Pj. This is enough, by Lemma 6.9, to solve the INDEXING problem with probability at least 2/3. Finally, we show a space complexity lower bound that depends on the length of the stream m. Theorem 6.14. Any one pass algorithm for ε-HEAVY HITTERS, ε-MINIMUM, ε-BORDA, and ε- MAXIMIN must use Ω(log log m) memory bits, even if the stream is over a universe of size 2, for every ε < 1 4 . Proof. It is enough to prove the result only for ε-HEAVY HITTERS since the other three prob- lems reduce to ε-HEAVY HITTERS for a universe of size 2. Suppose we have a randomized one pass ε-HEAVY HITTERS algorithm which uses s(m) bits of space. Using this algorithm, we will show a communication protocol for the GREATER-THANm problem whose communication complexity is s(2m) thereby proving the statement. The universal set is U = {0, 1}. Alice gen- erates a stream of 2x many copies of the item 1. Alice now sends the memory content of the algorithm. Bob resumes the run of the algorithm by generating a stream of 2y many copies of the item 0. If x > y, then the item 1 is the only ε-winner; whereas if x < y, then the item 0 is the only ε-winner. 140 6.5 Conclusion In this work, we not only resolve a long standing fundamental open problem in the data streaming literature namely heavy hitters but also provide an optimal algorithm for a sub- stantial generalization of heavy hitters by introducing another parameter φ. We also initiate a promising direction of research on finding a winner of a stream of votes. In the next chapter, we study the scenario when voters are allowed to have incomplete preferences in the form of a partial order. 141 Chapter 7 Kernelization for Possible Winner and Coalitional Manipulation In the POSSIBLE WINNER problem in computational social choice theory, we are given a set of partial preferences and the question is whether a distinguished candidate could be made winner by extending the partial preferences to linear preferences. Previous work has provided, for many common voting rules, fixed parameter tractable algorithms for the POSSIBLE WINNER problem, with number of candidates as the parameter. However, the corresponding kernelization question is still open and in fact, has been mentioned as a key research challenge [BCF+14a]. In this work, we settle this open question for many common voting rules. We show that the POSSIBLE WINNER problem for maximin, Copeland, Bucklin, ranked pairs, and a class of scoring rules that includes the Borda voting rule do not admit a poly- nomial kernel with the number of candidates as the parameter. We show however that the COALITIONAL MANIPULATION problem which is an important special case of the POS- SIBLE WINNER problem does admit a polynomial kernel for maximin, Copeland, ranked pairs, and a class of scoring rules that includes the Borda voting rule, when the number of A preliminary version of the work in this chapter was published as [DMN15b]: Palash Dey, Neeldhara Misra, and Y. Narahari. Kernelization complexity of possible winner and coalitional manipulation problems in voting. In Proc. 2015 International Conference on Autonomous Agents and Multiagent Systems, AAMAS 2015, Istanbul, Turkey, May 4-8, 2015, pages 87-96, 2015. The full version of the work in this chapter was published as [DMN16c]: Palash Dey, Neeldhara Misra, and Y. Narahari. Kernelization complexity of possible winner and coalitional manipulation problems in voting. Theor. Comput. Sci., 616:111- 125, 2016. 142 manipulators is polynomial in the number of candidates. A significant conclusion of this work is that the POSSIBLE WINNER problem is harder than the COALITIONAL MANIPULA- TION problem since the COALITIONAL MANIPULATION problem admits a polynomial kernel whereas the POSSIBLE WINNER problem does not admit a polynomial kernel. 7.1 Introduction Usually, in a voting setting, it is assumed that the votes are complete orders over the can- didates. However, due to many reasons, for example, lack of knowledge of voters about some candidates, a voter may be indifferent between some pairs of candidates. Hence, it is both natural and important to consider scenarios where votes are partial orders over the candidates. When votes are only partial orders over the candidates, the winner cannot be determined with certainty since it depends on how these partial orders are extended to linear orders. This leads to a natural computational problem called the POSSIBLE WINNER [KL05] problem: given a set of partial votes P and a distinguished candidate c, is there a way to extend the partial votes to linear ones to make c win? The POSSIBLE WINNER problem has been studied extensively in the literature [LPR+07, PRVW07, Wal07, XC11, BHN09, BD09, CLMM10, BBN10, BRR11, LPR+12, FRRS14] following its definition in [KL05]. Betzler et al. [BD09] and Baumeister et al. [BR12] show that the POSSIBLE WINNER winner problem is NP-complete for all scoring rules except for the plurality and veto voting rules; the POS- SIBLE WINNER winner problem is in P for the plurality and veto voting rules. Moreover the POSSIBLE WINNER problem is known to be NP-complete for many common voting rules, for example, scoring rules, maximin, Copeland, Bucklin etc. even when the maximum number of undetermined pairs of candidates in every vote is bounded above by small constants [XC11]. Walsh showed that the POSSIBLE WINNER problem can be solved in polynomial time for all the voting rules mentioned above when we have a constant number of candidates [Wal07]. An important special case of the POSSIBLE WINNER problem is the COALITIONAL MANIPULATION problem [BTT89] where only two kinds of partial votes are allowed - complete preference and empty preference. The set of empty votes is called the manipulators' vote and is denoted by M. The COALITIONAL MANIPULATION problem is NP-complete for maximin, Copeland, and ranked pairs voting rules even when M > 2 [FHS08, FHS10, XZP+09]. The COALI- TIONAL MANIPULATION problem is in P for the Bucklin voting rule [XZP+09]. We refer to [XC11, Wal07, XZP+09] for detailed overviews. 143 7.1.1 Our Contribution Discovering kernelization algorithms is currently an active and interesting area of research in computational social choice theory [BBN10, Bet10, BFG+09, BCH+14, FVBNS13, BCF+14b, BBCN12, DS12]. Betzler et al. [BHN09] showed that the POSSIBLE WINNER problem ad- mits fixed parameter tractable algorithm when parameterized by the total number of candi- dates for scoring rules, maximin, Copeland, Bucklin, and ranked pairs voting rules. Yang et al. [YG13, Yan14] provides efficient fixed parameter tractable algorithms for the COALITIONAL MANIPULATION problem for the Borda, maximin, and Copeland voting rules. A natural and practical follow-up question is whether the POSSIBLE WINNER and COALITIONAL MANIPULA- TION problems admit a polynomial kernel when parameterized by the number of candidates. This question has been open ever since the work of Betzler et al. and in fact, has been mentioned as a key research challenge in parameterized algorithms for computational so- cial choice theory [BCF+14a]. Betzler et al. showed non-existence of polynomial kernel for the POSSIBLE WINNER problem for the k-approval voting rule when parameterized by (t, k), where t is the number of partial votes [Bet10]. The NP-complete reductions for the POSSI- BLE WINNER problem for scoring rules, maximin, Copeland, Bucklin, and ranked pairs voting rules given by Xia et al. [XZP+09] are from the EXACT 3 SET COVER problem. Their results do not throw any light on the existence of a polynomial kernel since EXACT 3 SET COVER has a trivial O(m3) kernel where m is the size of the universe. In this work, we show that there is no polynomial kernel (unless CoNP ⊆ NP/Poly) for the POSSIBLE WINNER problem, when pa- rameterized by the total number of candidates, with respect to maximin, Copeland, Bucklin, and ranked pairs voting rules, and a class of scoring rules that includes the Borda voting rule. These hardness results are shown by a parameter-preserving many-to-one reduction from the SMALL UNIVERSE SET COVER problem for which there does not exist any polynomial kernel parameterized by universe size unless CoNP ⊆ NP/Poly [DLS09]. On the other hand, we show that the COALITIONAL MANIPULATION problem admits a poly- nomial kernel for maximin, Copeland, and ranked pairs voting rules, and a class of scoring rules that includes the Borda voting rule when we have poly(m) number of manipulators – specifically, we exhibit an O(m2M) kernel for maximin and Copeland voting rules, and an O(m4M) kernel for the ranked pairs voting rule, where m is the number of candidates and M is the set of manipulators. The COALITIONAL MANIPULATION problem for the Bucklin voting rule is in P [XZP+09] and thus the kernelization question does not arise. 144 A significant conclusion of our work is that, although the POSSIBLE WINNER and COALI- TIONAL MANIPULATION problems are both NP-complete for many voting rules, the POSSIBLE WINNER problem is harder than the COALITIONAL MANIPULATION problem since the COALI- TIONAL MANIPULATION problem admits a polynomial kernel whereas the POSSIBLE WINNER problem does not admit a polynomial kernel. 7.2 Problem Definitions The POSSIBLE WINNER problem with respect to r is the following: POSSIBLE WINNER [r] Parameter: m Input: A set C of candidates and votes V, where each vote is a partial order over C, and a candidate c ∈ C. Question: Is there a linear extension of V for which c is the unique winner with respect to r? An important special case of the POSSIBLE WINNER problem is the COALITIONAL MANIPU- LATION problem where every partial vote is either an empty order or a complete order. We call the complete votes the votes of the non-manipulators and the empty votes the votes of the manipulators. Formally the COALITIONAL MANIPULATION problem is defined as follows. COALITIONAL MANIPULATION [r] Parameter: m Input: A set C of candidates, a set V of complete votes, an integer t corresponding to the number of manipulators, and a candidate c ∈ C. Question: Does there exist a set of votes V′ of size t such that c is the unique winner with respect to r for the voting profile (V, V′)? When the voting rule r is clear from the context, we often refer to the problems as POSSI- BLE WINNER and COALITIONAL MANIPULATION without any further qualification. We note that one might also consider the variant of the problem where the designated candidate c is only required to be a co-winner, instead of being the unique winner. All the results in this work can be easily adapted to this variant as well. We now briefly describe the framework in which we analyze the computational complexity of POSSIBLE WINNER and COALITIONAL MANIPULATION problems. 145 7.3 Kernelization Hardness of the Possible Winner Problem In this section, we show non-existence of polynomial kernels for the POSSIBLE WINNER prob- lem for the maximin, Copeland, Bucklin, and ranked pairs voting rules, and a class of scoring rules that includes the Borda voting rule. We do this by demonstrating polynomial parame- ter transformations from the SMALL UNIVERSE SET COVER problem, which is the classic SET COVER problem, but now parameterized by the size of the universe and the budget. SMALL UNIVERSE SET COVER Parameter: m + k Is there a subfamily H ⊆ F of size at most k such that every element of Input: A set U = {u1, . . . , um} and a family F = {S1, . . . , St}. Question: the universe belongs to at least one H ∈ H? It is well-known [DLS09] that RED-BLUE DOMINATING SET parameterized by k and the number of non-terminals does not admit a polynomial kernel unless CoNP ⊆ NP/Poly. It fol- lows, by the duality between dominating set and set cover, that SET COVER when parameter- ized by the solution size and the size of the universe (in other words, the SMALL UNIVERSE SET COVER problem defined above) does not admit a polynomial kernel unless CoNP ⊆ NP/Poly. We now consider the POSSIBLE WINNER problem parameterized by the number of can- didates for the maximin, Copeland, Bucklin, and ranked pairs voting rules, and a class of scoring rules that includes the Borda rule, and establish that they do not admit a polyno- mial kernel unless CoNP ⊆ NP/Poly, by polynomial parameter transformations from SMALL UNIVERSE SET COVER. 7.3.1 Results for the Scoring Rules We begin with proving the hardness of kernelization for the POSSIBLE WINNER problem for a class of scoring rules that includes the Borda voting rule. For that, we use the following lemma which has been used before [BRR11]. Lemma 7.1. Let C = {c1, . . . , cm} ⊎ D, (D > 0) be a set of candidates, and ~α a normalized score vector of length C. Then, for any given X = (X1, . . . , Xm) ∈ Zm, there exists λ ∈ R and a voting profile such that the ~α-score of ci is λ + Xi for all 1 6 i 6 m, and the score of candidates d ∈ D is less than λ. Moreover, the number of votes is O(poly(C ·Pm i=1 Xi)). With the above lemma at hand, we now show hardness of polynomial kernel for the class of strict scoring rules. 146 Theorem 7.1. The POSSIBLE WINNER problem for any strict scoring rule, when parameterized by the number of candidates, does not admit a polynomial kernel unless CoNP ⊆ NP/Poly. Proof. Let (U, F, k) be an instance of SMALL UNIVERSE SET COVER, where U = {u1, . . . , um} and F = {S1, . . . , St}. We use Ti to denote U \ Si for i ∈ [t]. We let ~α = (α1, α2, . . . , α2m+3) denote the score vector of length t, and let δi denote the difference (αi−αi+1) for i ∈ [2m+2]. Note that for a strict scoring rule, all the δi's will be strictly positive. We now construct an instance (C, V, c) of POSSIBLE WINNER as follows. Candidates C = U ⊎ V ⊎ {w, c, d}, where V := {v1, . . . , vm}. Partial Votes, P The first part of the voting profile comprises t partial votes, and will be denoted by P. Let Vj denote the set {v1, . . . , vj}. For each i ∈ [t], we first consider a profile built on a total order ηi: ηi := d ≻ Si ≻ Vj ≻ w ≻ others, where j = m − Si. Now we obtain a partial order λi based on ηi for every i ∈ [t] as follows: λi := ηi \ ({w} × ({d} ⊎ Si ⊎ Vj)) That is, λi is the partial vote where the order between the candidates x and y for x 6= w or y /∈ {d} ⊎ Si ⊎ Vj, is same as the order between x and y in ηi. Whereas, if x = w and y ∈ {d} ⊎ Si ⊎ Vj, then the order between x and y is unspecified. Let P′ be the set of votes {ηi i ∈ [t]} and P be the set of votes {λi i ∈ [t]}. Complete Votes, Q We now add complete votes, which we denote by Q, such that s(c) = s(ui), s(d) − s(c) = (k − 1)δ1, s(c) − s(w) = k(δ2 + δ3 +· · · + δm+1) + δ1, s(c) > s(vi) + 1 for all i ∈ [t], where s(a) is the score of candidate a from the combined voting profile P′ ⊎ Q. From the proof of Lemma 7.1, we can see that such votes can always be constructed. In particular, also note that the voting profile Q consists of complete votes. Note that the number of candidates is 2m + 3, which is polynomial in the size of the universe, as desired. We now claim that the candidate c is a possible winner for the voting profile P ⊎ Q with respect to the strict scoring rule ~α if and only if (U, F) is a YES instance of Set Cover. 147 In the forward direction, suppose, without loss of generality, that S1, . . . , Sk form a set cover. Then we propose the following extension for the partial votes λ1, . . . , λk: w > d > Si > Vj > others, and the following extension for the partial votes λk+1, . . . , λt: d > Si > Vj > w > others For i ∈ [k], the position of d in the extension of λi proposed above is one lower than its original position in ηi. Therefore, the score of d decreases by kδ1 making the final score of d less than the score of c. Similarly, since S1, . . . , Sk form a set cover, the score of ui decreases by at least minm i=2{δi} for every i ∈ [m], which is strictly positive as the scoring rule is strict. Finally, the score of w increase by at most k(δ2 + δ3 + · · · + δm+1), since there are at most k votes where the position of w in the extension of λi improved from it's original position in ηi for i ∈ [t]. Therefore, the score of c is greater than any other candidate, implying that c is a possible winner. For the reverse direction, notice that there must be at least k extensions where d is in the second position, since the score of d is (k − 1)δ1 more than the score of c. In these extensions, observe that w will be at the first position. On the other hand, placing w in the first position causes its score to increase by (δ2 + δ3 + · · · + δm+1), therefore, if w is in the first position in ℓ extensions, its score increases by ℓ(δ2 + δ3 + · · · + δm+1). Since the score difference between w and c is only k(δ2 + δ3 + · · · + δm+1) + 1, we can afford to have w in the first position in at most k votes. Therefore, apart from the extensions where d is in the second position, in all remaining extensions, w appears after Vj, and therefore the candidates from Si continue to be in their original positions. Moreover, there must be exactly k votes where d is at the second position. We now claim that the sets corresponding to the k votes where d is at the second position form a set cover. Indeed, if not, suppose the element ui is not covered. It is easily checked that the score of such a ui remains unchanged in this extension, and therefore its score is equal to c, contradicting our assumption that we started with an extension for which c was a winner. The proof of Theorem 7.1 can be generalized to a wider class of scoring rules as stated in the following corollary. 148 Corollary 7.1. Let r be a positional scoring rule such that there exists a polynomial function f : N → N, such that for every m ∈ N, there exists an index l in the f(m) length score vector ~α satisfying following, αi − αi+1 > 0 ∀l 6 i 6 l + m Then the POSSIBLE WINNER problem for r, when parameterized by the number of candidates, does not admit a polynomial kernel unless CoNP ⊆ NP/Poly. 7.3.2 Results for the Maximin Voting Rule We will need the following lemma in subsequent proofs. The lemma has been used before [McG53, XC11]. Lemma 7.2. Let f : C × C −→ Z be a function such that 1. ∀a, b ∈ C, f(a, b) = −f(b, a). 2. ∀a, b, c, d ∈ C, f(a, b) + f(c, d) is even. Then we can construct in time O(cid:16)CP{a,b}∈C×C f(a, b)(cid:17) an election E with n votes over the candidate set C such that for all a, b ∈ C, DE(a, b) = f(a, b). We now describe the reduction for the POSSIBLE WINNER problem for the maximin voting rule parameterized by the number of candidates. Theorem 7.2. The POSSIBLE WINNER problem for the maximin voting rule, when parameterized by the number of candidates, does not admit a polynomial kernel unless CoNP ⊆ NP/Poly. Proof. Let (U, F, k) be an instance of SMALL UNIVERSE SET COVER, where U = {u1, . . . , um} and F = {S1, . . . , St}. We use Ti to denote U \ Si. We now construct an instance (C, V, c) of the POSSIBLE WINNER as follows. Candidates C := U ⊎ W ⊎ {c, d, x} ⊎ L, where W := {w1, w2, . . . , wm, wx}, L := {l1, l2, l3}. Partial Votes, P The first part of the voting profile comprises t partial votes, and will be denoted by P. For each i ∈ [t], we first consider a profile built on a total order ηi. We denote the order w1 ≻ · · · ≻ wm ≻ wx by ~W. From this point onwards, whenever we place a set of candidates in some position of a partial order, we mean that the candidates in the set can 149 be ordered arbitrarily. For example, the candidates in Si can be ordered arbitrarily among themselves in the total order ηi below for every i ∈ [t]. ηi := L ≻ ~W ≻ x ≻ Si ≻ d ≻ c ≻ Ti Now we obtain a partial order λi based on ηi for every i ∈ [t] as follows: λi := ηi \ (W × ({c, d, x} ⊎ U)) The profile P consists of {λi 1 ∈ [t]}. Complete Votes, Q We now describe the remaining votes in the profile, which are linear orders designed to achieve specific pairwise difference scores among the candidates. This profile, denoted by Q, is defined according to Lemma 7.2 to contain votes such that the pairwise score differences of P ∪ Q satisfy the following. ⊲ D(c, w1) = −2k. ⊲ D(c, l1) = −t. ⊲ D(d, w1) = −2k − 2. ⊲ D(x, wx) = −2k − 2. ⊲ D(wi, ui) = −2t ∀ i ∈ [m]. ⊲ D(ai, l1) = D(wx, l1) = −4t. ⊲ D(l1, l2) = D(l2, l3) = D(l3, l1) = −4t. ⊲ D(l, r) 6 1 for all other pairs (l, r) ∈ C × C. We note that the for all c, c′ ∈ C, the difference D(c, c′) − DP(c, c′) is always even, as long as t is even and the number of sets in F that contain any element u ∈ U is always even. Note that the latter can always be ensured without loss of generality: indeed, if u ∈ U occurs in an odd number of sets, then we can always add the set {u} if it is missing and remove it if it is present, flipping the parity in the process. In case {u} is the only set containing the element u, then we remove the set from both F and U and decrease k by one. The number of sets t can 150 be assumed to be even by adding a dummy element and a dummy pair of sets that contains the said element. It is easy to see that these modifications always preserve the instance. Thus, the constructed instance of POSSIBLE WINNER is (C, V, c), where V := P ∪ Q. We now turn to the proof of correctness. In the forward direction, let H ⊆ F be a set cover of size at most k. Without loss of generality, let H = k (since a smaller set cover can always be extended artificially) and let H = {S1, . . . , Sk} (by renaming). If i 6 k, let: If k < i 6 t, let: λ∗i := L ≻ x ≻ Si ≻ d ≻ c ≻ ~W ≻ Ti λ∗i := L ≻ ~W ≻ x ≻ Si ≻ d ≻ c ≻ Ti Clearly λ∗i extends λi for every i ∈ [t]. Let V∗ denote the extended profile consisting of the votes {λ∗i i ∈ [t]}∪ Q. We now claim that c is the unique winner with respect to the maximin voting rule in V∗. Since there are k votes in V∗ where c is preferred over w1 and (t − k) votes where w1 is preferred to c, we have: DV∗(c, w1) = DV(c, w1) + k − (t − k) = −2k + k − (t − k) = −t It is easy to check that maximin score of c is −t. Also, it is straightforward to verify the following table. Therefore, c is the unique winner for the profile V∗. We now turn to the reverse direction. Let P∗ be an extension of P such that V∗ := P∗ ∪ Q admits c as a unique winner with respect to the maximin voting rule. We first argue that P∗ must admit a certain structure, which will lead us to an almost self-evident set cover for U. Let us denote by P∗C the set of votes in P∗ which are consistent with c ≻ w1, and let P∗W be the set of votes in P∗ which are consistent with w1 ≻ c. We first argue that P∗C has at most k votes. Claim 7.1. Let P∗C be as defined above. Then P∗C 6 k. 151 Candidate maximin score wi, ∀i ∈ {1, 2, . . . , m} ui, ∀i ∈ {1, 2, . . . , m} wx l1, l2, l3 x d < −t 6 −4t 6 −4t 6 −4t 6 −t − 2 6 −t − 2 Proof. Suppose, for the sake of contradiction, that more than k extensions are consistent with c ≻ w1. Then we have: DV∗(c, w1) > DV (c, w1) + k + 1 − (t − k − 1) = −2k + 2k − t + 2 = −t + 2 Since DV∗(c, l1) = −t, the maximin score of c is −t. On the other hand, we also have that the maximin score of d is given by DV∗(d, w1), which is now at least (−t): DV∗(d, w1) > DV (d, w1) + k + 1 − (t − k − 1) = −2k − 2 + 2k − t + 2 = −t Therefore, c is no longer the unique winner in V∗ with respect to the maximin voting rule, which is the desired contradiction. We next propose that a vote that is consistent with w1 ≻ c must be consistent with wx ≻ x. Claim 7.2. Let P∗W be as defined above. Then any vote in P∗W must respect wx ≻ x. 152 Proof. Suppose there are r votes in P∗C, and suppose that in at least one vote in P∗W where x ≻ wx. Notice that any vote in P∗C is consistent with x ≻ wx. Now we have: And further: DV∗(c, w1) = DV (c, w1) + r − (t − r) = −2k + 2r − t = −t − 2(k − r) DV∗(x, wx) > DV(x, wx) + (r + 1) − (t − r − 1) = −2k − 2 + 2r − t + 2 = −t − 2(k − r) It is easy to check that the maximin score of c in V∗ is at most −t − 2(k − r), witnessed by DV∗(c, w1), and the maximin score of x is at least −t − 2(k − r), witnessed by DV∗(x, wx). Therefore, c is no longer the unique winner in V∗ with respect to the maximin voting rule, and we have a contradiction. We are now ready to describe a set cover of size at most k for U based on V∗. Define J ⊆ [t] as being the set of all indices i for which the extension of λi in V∗ belongs to P∗C. Consider: H := {Si i ∈ J}. The set H is our proposed set cover. Clearly, H 6 k. It remains to show that H is a set cover. We assume, for the sake of contradiction, that there is an element ui ∈ U that is not covered by H. This means that we have ui ∈ Ti for all i ∈ J, and thus wi ≻ ui in the corresponding extensions of λi in V∗. Further, for all i /∈ J, we have that the extension of λi in V∗ is consistent with: w1 ≻ · · · ≻ wi ≻ · · · ≻ wx ≻ x ≻ Si ≻ c ≻ Ti, implying again that wi ≻ ui in these votes. Therefore, we have: DV∗(wi, ui) = DV(wi, ui) + k + (t − k) = −2t + t = −t. 153 We know that the maximin score of c is less than or equal to −t, since DV∗(c, l1) = −t, and we now have that the maximin score of wi is −t. This overrules c as the unique winner in V∗, contradicting our assumption to that effect. This completes the proof. 7.3.3 Results for the Copeland Voting Rule We now describe the result for the POSSIBLE WINNER problem for the Copeland voting rule parameterized by the number of candidates. Theorem 7.3. The POSSIBLE WINNER problem for the Copeland voting rule, when parameterized by the number of candidates, does not admit a polynomial kernel unless CoNP ⊆ NP/Poly. Proof. Let (U, F, k) be an instance of SMALL UNIVERSE SET COVER, where U = {u1, . . . , um} and F = {S1, . . . , St}. For the purpose of this proof, we assume (without loss of generality) that m > 6. We now construct an instance (C, V, c) of POSSIBLE WINNER as follows. Candidates C := U ⊎ {z, c, d, w}. Partial Votes, P be denoted by P. For each i ∈ [t], we first consider a profile built on a total order: The first part of the voting profile comprises of m partial votes, and will ηi := U \ Si ≻ z ≻ c ≻ d ≻ Si ≻ w Now we obtain a partial order λi based on ηi as follows for each i ∈ [t]: λi := ηi \ ({z, c} × (Si ⊎ {d, w})) The profile P consists of {λi i ∈ [t]}. Complete Votes, Q We now describe the remaining votes in the profile, which are linear orders designed to achieve specific pairwise difference scores among the candidates. This profile, denoted by Q, is defined according to Lemma 7.2 to contain votes such that the pairwise score differences of P ∪ Q satisfy the following. ⊲ D(c, d) = t − 2k + 1 ⊲ D(z, w) = t − 2k − 1 154 ⊲ D(c, ui) = t − 1 ⊲ D(c, z) = t + 1 ⊲ D(c, w) = −t − 1 ⊲ D(ui, d) = D(z, ui) = t + 1 ∀ i ∈ [m] ⊲ D(z, d) = t + 1 ⊲ D(ui, uj) = t + 1 ∀ j ∈ [i + 1 (mod ∗)m, i + ⌊m/2⌋ (mod ∗)m] We note that the difference D(c, c′) − DP(c, c′) is always even for all c, c′ ∈ C, as long as t is odd and the number of sets in F that contain any element a ∈ U is always odd. Note that the latter can always be ensured without loss of generality: indeed, if a ∈ U occurs in an even number of sets, then we can always add the set {a} if it is missing and remove it if it is present, flipping the parity in the process. In case {a} is the only set containing the element a, then we remove the set from both F and U and decrease k by one. The number of sets t can be assumed to be odd by adding a dummy element in U, adding a dummy set that contains the said element in F, and incrementng k by one. It is easy to see that these modifications always preserve the instance. Thus the constructed instance of POSSIBLE WINNER is (C, V, c), where V := P∪ Q. We now turn to the proof of correctness. In the forward direction, let H ⊆ F be a set cover of size at most k. Without loss of generality, let H = k (since a smaller set cover can always be extended artificially) and let H = {S1, . . . , Sk} (by renaming). If i 6 k, let: If k < i 6 t, let: λ∗i := U \ Si ≻ z ≻ c ≻ d ≻ Si ≻ w λ∗i := U \ Si ≻ d ≻ Si ≻ w ≻ z ≻ c Clearly λ∗i extends λi for every i ∈ [t]. Let V∗ denote the extended profile consisting of the votes {λ∗i i ∈ [t]}∪ Q. We now claim that c is the unique winner with respect to the Copeland voting rule in V∗. First, consider the candidate z. For every i ∈ [m], between z and ui, even if z loses to ui in λ∗j , for every j ∈ [t], because D(z, ui) = t + 1, z wins the pairwise election between z 155 and ui. The same argument holds between z and d. Therefore, the Copeland score of z, no matter how the partial votes were extended, is at least (m + 1). Further, note that all other candidates (apart from c) have a Copeland score of less than (m + 1), because they are guaranteed to lose to at least three candidates (assuming m > 6). In particular, observe that ui loses to at least ⌊m/2⌋ candidates, and d loses to ui (merely by its position in the extended votes), and w loses to ui (because of way the scores were designed) for every i ∈ [m]. Therefore, the Copeland score of all candidates in C \ {z, c} is strictly less than the Copeland score of z, and therefore they cannot be possible (co-)winners. Now we restrict our attention to the contest between z and c. First note that c beats ui for every i ∈ [m]: since the sets of H form a set cover, ui is placed in a position after c in some λ∗j for j ∈ [k]. Since the difference of score between c and ui was (t − 1), even if c suffered defeat in every other extension, we have the pairwise score of c and ui being at least t − 1 − (t − 1) + 1 = 1, which implies that c defeats every ui in their pairwise election. Note that c also defeats d by getting ahead of d in k votes, making its final score t − 2k + 1 + k − (t − k) = 1. Finally, c is defeated by w, simply by the preset difference score. Therefore, the Copeland score of c is (m + 2). Now all that remains to be done is to rule z out of the running. Note that z is defeated by w in their pairwise election: this is because z defeats w in k of the extended votes, and is defeated by w in the remaining. This implies that its final pairwise score with respect to w is at most t − 2k − 1 + k − (t − k) = −1. Also note that z loses to c because of its predefined difference score. Thus, the Copeland score of z in the extended vote is exactly (m + 1), and thus c is the unique winner of the extended vote. We now turn to the reverse direction. Let P∗ be an extension of P such that V∗ := P∗ ∪ Q admits c as a unique winner with respect to the Copeland voting rule. As with the argument for the maximin voting rule, we first argue that P∗ must admit a certain structure, which will lead us to an almost self-evident set cover for U. Let us denote by P∗C the set of votes in P∗ which are consistent with c ≻ d, and let P∗W be the set of votes in P∗ which are consistent with w ≻ z. Note that the votes in P∗C necessarily have the form: and those in P∗W have the form: λ∗i := U \ Si ≻ z ≻ c ≻ d ≻ Si ≻ w λ∗i := U \ Si ≻ d ≻ Si ≻ w ≻ z ≻ c 156 It is easy to check that this structure is directly imposed by the relative orderings that are fixed by the partial orders. Before we argue the details of the scores, let us recall that in any extension of P, z loses to c and z wins over d and all candidates in U. Thus the Copeland score of z is at least (m + 1). On the other hand, in any extension of P, c loses to w, and therefore the Copeland score of c is at most (m + 2). (These facts follow from the analysis in the forward direction.) Thus, we have the following situation. If z wins over w, then c cannot be the unique winner in the extended vote, because the score of z goes up to (m + 2). Similarly, c cannot afford to lose to any of U∪{d}, because that will cause its score to drop below (m+2), resulting in either a tie with z, or defeat. These facts will successively lead us to the correctness of the reverse direction. Now let us return to the sets P∗C and P∗W. If P∗C has more than k votes, then z wins over w: the final score of z is at least t − 2k − 1 + (k + 1) − (t − k − 1) = 1, and we have If P∗C has fewer than k votes, then c loses to d, with a score of at most a contradiction. t − 2k + 1 + (k − 1) − (t − k + 1) = −1, and we have a contradiction. Hence, P∗C must have exactly k votes. Finally, suppose the sets corresponding to the votes of P∗C do not form a set cover. Consider an element ui ∈ U not covered by the union of these sets. Observe that c now loses the pairwise election between itself and ui and is no longer in the running for being the unique winner in the extended vote. Therefore, the sets corresponding to the votes of P∗C form a set cover of size exactly k, as desired. 7.3.4 Results for the Bucklin Voting Rule We now describe the result for the POSSIBLE WINNER problem for the Bucklin voting rule parameterized by the number of candidates. Theorem 7.4. The POSSIBLE WINNER problem for the Bucklin voting rule, when parameterized by the number of candidates, does not admit a polynomial kernel unless CoNP ⊆ NP/Poly. Proof. Let (U, F, k) be an instance of SMALL UNIVERSE SET COVER, where U = {u1, . . . , um} and F = {S1, . . . , St}. Without loss of generality, we assume that t > k + 1, and that every set in F has at least two elements. We now construct an instance (C, V, c) of POSSIBLE WINNER as follows. 157 Candidates C := U⊎ {z, c, a}⊎ W⊎ D1⊎ D2⊎ D3, where D1, D2, and D3 are sets of "dummy candidates" such that D1 = m, D2 = 2m, and D3 = 2m. W := {w1, w2, . . . , w2m}. Partial Votes, P denoted by P. For each i ∈ [t], we first consider a profile built on a total order: The first part of the voting profile comprises of t partial votes, and will be ηi := U \ Si ≻ Si ≻ wi (mod ∗)m ≻ wi+1 (mod ∗)m ≻ z ≻ c ≻ D3 ≻ others Now we obtain a partial order λi based on ηi for every i ∈ [t] as follows: (mod ∗)m, wi+1 (mod ∗)m, z, c} ⊎ D3(cid:1) × Si(cid:1) λi := ηi \(cid:0)(cid:0){wi The profile P consists of {λi i ∈ [t]}. Complete Votes, Q t − k − 1 : D1 ≻ z ≻ c ≻ others 1 : D1 ≻ c ≻ a ≻ z ≻ others k − 1 : D2 ≻ others We now show that (U, F, k) is a YES instance if and only if (C, V, c) is a YES instance. Suppose {Sj : j ∈ J} forms a set cover. Then consider the following extension of P: (U \ Sj) ≻ wj (mod ∗)m ≻ wj+1 (mod ∗)m ≻ z ≻ c ≻ D3 ≻ Sj ≻ others, for j ∈ J (U \ Sj) ≻ Sj ≻ wj (mod ∗)m ≻ wj+1 (mod ∗)m ≻ z ≻ c ≻ D3 ≻ others, for j /∈ J We claim that in this extension, c is the unique winner with Bucklin score (m + 2). First, let us establish the score of c. The candidate c is already within the top (m + 1) choices in (t − k) of the complete votes. In all the sets that form the set cover, c is ranked within the first (m + 2) votes in the proposed extension of the corresponding vote (recall that every set has at least two elements). Therefore, there are a total of t votes where c is ranked within the top (m + 2) preferences. Further, consider a candidate v ∈ U. Such a candidate is not within the top (m + 2) choices of any of the complete votes. Let Si be the set that covers the element v. Note that in the extension of the vote λi, v is not ranked among the top (m + 2) spots, since 158 there are at least m candidates from D3 getting in the way. Therefore, v has strictly fewer than t votes where it is ranked among the top (m + 2) spots, and thus has a Bucklin score more than c. Now the candidate z is within the top (m + 2) ranks of at most (t − k − 1) votes among the complete votes. In the votes corresponding to the sets not in the set cover, z is placed beyond the first (m + 2) spots. Therefore, the number of votes where z is among the top (m + 2) candidates is at most (t − 1), which makes its Bucklin score strictly more than (m + 2). The candidates from W are within the top (m + 2) positions only in a constant number of votes. The candidates D1 ∪ {a} have (t − k) votes (among the complete ones) in which they are ranked among the top (m + 2) preferences, but in all extensions, these candidates have ranks below (m + 2). Finally, the candidates in D3 do not feature in the top (m + 2) positions of any of the complete votes, and similarly, the candidates in D2 do not feature in the top (m + 2) positions of any of the extended votes. Therefore, the Bucklin scores of all these candidates is easily seen to be strictly more than (m + 2), concluding the argument in the forward direction. Now consider the reverse direction. Suppose (C, V, c) is a YES instance. For the same reasons described in the forward direction, observe that only the following candidates can win depending upon how the partial preferences get extended - either one of the candidates in U, or one of z or c. Note that the Bucklin score of z in any extension is at most (m + 3). Therefore, the Bucklin score of c has to be (m + 2) or less. Among the complete votes Q, there are (t − k) votes where the candidate c appears in the top (m + 2) positions. To get majority within top (m + 2) positions, c should be within top (m + 2) positions for at least k of the extended votes in P. Let us call these set of votes P′. Now notice that whenever c comes within top (m + 2) positions in a valid extension of P, the candidate z also comes within top (m + 2) positions in the same vote. However, the candidate z is already ranked among the top (m + 2) candidates in (t − k − 1) complete votes. Therefore, z can appear within top (m + 2) positions in at most k extensions (since c is the unique winner), implying that P′ = k. Further, note that the Bucklin score of c cannot be strictly smaller than (m + 2) in any extension. Indeed, candidate c features in only one of the complete votes within the top (m + 1) positions, and it would have to be within the top (m + 1) positions in at least (t − 1) extensions. However, as discussed earlier, this would give z exactly the same mileage, and therefore its Bucklin score would be (m − 1) or even less; contradicting our assumption that c is the unique winner. 159 Now we claim that the Si's corresponding to the votes in P′ form a set cover for U. If not, there is an element x ∈ U that is uncovered. Observe that x appears within top m positions in all the extensions of the votes in P′, by assumption. Further, in all the remaining extensions, since z is not present among the top (m + 2) positions, we only have room for two candi- dates from W. The remaining positions must be filled by all the candidates corresponding to elements of U. Therefore, x appears within the top (m + 2) positions of all the extended votes. Since these constitute half the total number of votes, we have that x ties with c in this situation, a contradiction. 7.3.5 Results for the Ranked Pairs Voting Rule We now describe the reduction for POSSIBLE WINNER parameterized by the number of candi- dates, for the ranked pairs voting rule. Theorem 7.5. The POSSIBLE WINNER problem for the ranked pairs voting rule, when parameter- ized by the number of candidates, does not admit a polynomial kernel unless CoNP ⊆ NP/Poly. Proof. Let (U, F, k) be an instance of SMALL UNIVERSE SET COVER, where U = {u1, . . . , um} and F = {S1, . . . , St}. Without loss of generality, we assume that t is even. We now construct an instance (C, V, c) of POSSIBLE WINNER as follows. Candidates C := U ⊎ {a, b, c, w}. Partial Votes, P denoted by P. For each i ∈ [t], we first consider a profile built on a total order: The first part of the voting profile comprises of t partial votes, and will be ηi := U \ Si ≻ Si ≻ b ≻ a ≻ c ≻ others Now we obtain a partial order λi based on ηi for every i ∈ [t] as follows: λi := ηi \ ({a, c} × (Si ⊎ {b})) The profile P consists of {λi i ∈ [t]}. Complete Votes, Q We add complete votes such that along with the already determined pairs from the partial votes P, we have the following. 160 ⊲ D(ui, c) = 2 ∀ i ∈ [m] ⊲ D(c, b) = 4t ⊲ D(c, w) = t + 2 ⊲ D(b, a) = 2k + 4 ⊲ D(w, a) = 4t ⊲ D(a, c) = t + 2 ⊲ D(w, ui) = 4t ∀ i ∈ [m] We now show that (U, F, k) is a YES instance if and only if (C, V, c) is a YES instance. Suppose {Sj : j ∈ J} forms a set cover. Then consider the following extension of P : U \ Sj ≻ a ≻ c ≻ Sj ≻ b ≻ others ∀j ∈ J U \ Sj ≻ Sj ≻ b ≻ a ≻ c ≻ others ∀j /∈ J We claim that the candidate c is the unique winner in this extension. Note that the pairs (w ≻ a) and (w ≻ ui) for every i ∈ [t] get locked first (since these differences are clearly the highest and unchanged). The pair (c, b) gets locked next, with a difference score of (3t + 2k). Now since the votes in which c ≻ b are based on a set cover of size at most k, the pairwise difference between b and a becomes at least 2k + 4 − k + (t − k) = t + 4. Therefore, the next pair to get locked is b ≻ a. Finally, for every element ui ∈ U, the difference D(ui, c) is at most 2 + (t − 1) = t + 1, since there is at least one vote where c ≻ ui (given that we used a set cover in the extension). It is now easy to see that the next highest pairwise difference is between c and w, so the ordering c ≻ w gets locked, and at this point, by transitivity, c is superior to w, b, a and all ui. It follows that c wins the election irrespective the sequence in which pairs are considered subsequently. Now suppose (C, V, c) is a YES instance. Notice that, irrespective of the extension of the votes in P, c ≻ b, w ≻ a, w ≻ ui ∀i ∈ [m] are locked first. Now if b ≻ c in all the extended votes, then it is easy to check that b ≻ a gets locked next, with a difference score of 2k+4+t; leaving us with D(ui, c) = t + 2 = D(c, w), where ui ≻ c could be a potential lock-in. This implies the possibility of a ui being a winner in some choice of tie-breaking, a contradiction to the assumption that c is the unique winner. Therefore, there are at least some votes in the 161 extended profile where c ≻ b. We now claim that there are at most k such votes. Indeed, if there are more, then D(b, a) = 2k+4−(k+1)+(t−k−1) = t+2. Therefore, after the forced lock-ins above, we have D(b, a) = D(c, w) = D(a, c) = t + 2. Here, again, it is possible for a ≻ c to be locked in before the other choices, and we again have a contradiction. Finally, we have that c ≻ b in at most k many extensions in P. Call the set of indices of these extensions J. We claim that {Sj : j ∈ J} forms a set cover. If not, then suppose an element ui ∈ U is not covered by {Sj : j ∈ J}. Then the candidate ui comes before c in all the extensions which makes D(ui, c) become (t + 2), which in turn ties with D(c, w). This again contradicts the fact that c is the unique winner. Therefore, if there is an extension that makes c the unique winner, then we have the desired set cover. 7.4 Polynomial Kernels for the Coalitional Manipulation Problem We now describe a kernelization algorithm for every scoring rule which satisfies certain prop- erties mentioned in Theorem 7.6 below. Note that the Borda voting rule satisfies these prop- erties. Theorem 7.6. For m ∈ N, let (α1, . . . , αm) and (α′1, . . . , α′m+1) be the normalized score vectors for a scoring rule r for an election with m and (m+1) candidates respectively. Let α′1 = poly(m) and αi = α′i+1 for every i ∈ [m]. Then the COALITIONAL MANIPULATION problem for r admits a polynomial kernel when the number of manipulators is poly(m). Proof. Let c be the candidate whom the manipulators aim to make winner. Let M be the set of manipulators and C the set of candidates. Let sNM(x) be the score of candidate x from the votes of the non-manipulators. Without loss of generality, we assume that, all the manipulators place c at top position in their votes. Hence, the final score of c is sNM(c) + Mα1, which we denote by s(c). Now if sNM(x) > s(c) for any x 6= c, then c cannot win and we output no. Hence, we assume that sNM(x) < s(c) for all x 6= c. Now let us define s∗NM(x) as follows. s∗NM(x) := max{sNM(x), sNM(c)} Also define s∗NM(c) as follows. s∗NM(c) := sNM(c) − M(α′1 − α1) 162 We define a COALITIONAL MANIPULATION instance with (m + 1) candidates as (C′, NM, M, c), where C′ = C⊎ {d} is the set of candidates, M is the set of manipulators, c is the distinguished candidate, and NM is the non-manipulators' vote such that it generates score of x ∈ C to be K + (s∗NM(x) − sNM(c)), where K ∈ N is same for x ∈ C, and the score of d is less than K − α′1M. The existence of such a voting profile NM of size poly(m) is due to Lemma 7.1 and the fact that α′1 = poly(m). Hence, once we show the equivalence of these two instances, we have a kernel whose size is polynomial in m. The equivalence of the two instances is due to the following facts: (1) The new instance has (m + 1) candidates and c is always placed at the top position without loss of generality. The candidate c recieves M(α′1 − α1) score more than the initial instance and this is compensated in s∗NM(c). (2) The relative score difference from the final score of c to the current score of every x ∈ C \ {c} is same in both the instances. (3) In the new instance, we can assume without loss of generality that the candidate d will be placed in the second position in all the manipulators' votes. We now move on to the voting rules that are based on the weighted majority graph. The reduction rules modify the weighted majority graph maintaining the property that there exists a set of votes that can realize the modified weighted majority graph. In particular, the final weighted majority graph is realizable with a set of votes. Theorem 7.7. The COALITIONAL MANIPULATION problem for the maximin voting rule admits a polynomial kernel when the number of manipulators is poly(m). Proof. Let c be the distinguished candidate of the manipulators. Let M be the set of all manipulators. We can assume that M > 2 since for M = 1, the problem is in P [BTT89]. Define s to be minx∈C\{c} D(V\M)(c, x). So, s is the maximin score of the candidate c from the votes except from M. Since the maximin voting rule is monotone, we can assume that the voters in M put the candidate c at top position of their preferences. Hence, c's final maximin score will be s + M. This provides the following reduction rule. Reduction rule 7.1. If s + M > 0, then output YES. In the following, we will assume s + M is negative. Now we propose the following reduction rules on the weighted majority graph. Reduction rule 7.2. If D(V\M)(ci, cj) < 0 and D(V\M)(ci, cj) > 2M + s, then make D(V\M)(ci, cj) either 2M + s + 1 or 2M + s + 2 whichever keeps the parity of D(V\M)(ci, cj) unchanged. 163 If D(V\M)(ci, cj) > 2M + s, then DV(ci, cj) > M + s irrespective of the way the manip- ulators vote. Hence, given any votes of the manipulators, whether or not the maximin score of ci and cj will exceed the maximin score of c does not gets affected by this reduction rule. Hence, Reduction rule 7.1 is sound. Reduction rule 7.3. If D(V\M)(ci, cj) < s, then make D(V\M)(ci, cj) either s − 1 or s − 2 whichever keeps the parity of D(V\M)(ci, cj) unchanged. The argument for the correctness of Reduction rule 7.3 is similar to the argument for Reduction rule 7.1. Here onward, we may assume that whenever D(V\M)(ci, cj) < 0, s − 2 6 D(V\M)(ci, cj) 6 2M + s + 2 Reduction rule 7.4. If s < −4M then subtract s + 5M from D(V\M)(x, y) for every x, y ∈ C, x 6= y. The correctness of Reduction rule 7.4 follows from the fact that it adds linear fixed offsets to all the edges of the weighted majority graph. Hence, if there a voting profile of the voters in M that makes the candidate c win in the original instance, the same voting profile will make c win the election in the reduced instance and vice versa. Now we have a weighted majority graph with O(M) weights for every edge. Also, all the weights have uniform parity and thus the result follows from Lemma 7.2. We next present a polynomial kernel for the COALITIONAL MANIPULATION problem for the Copeland voting rule. Theorem 7.8. The COALITIONAL MANIPULATION problem for the Copeland voting rule admits a polynomial kernel when the number of manipulators is poly(m). Proof. We apply the following reduction rule. Reduction rule 7.1. If D(V\M)(x, y) > M for x, y ∈ C, then make D(V\M)(x, y) either M + 1 or M + 2 whichever keeps the parity of D(V\M)(x, y) unchanged. Given any votes of M, we have DV(x, y) > 0 in the original instance if and only if DV(x, y) > 0 in the reduced instance for every x, y ∈ C. Hence, each candidate has the same Copeland score and thus the reduction rule is correct. Now we have a weighted majority graph with O(M) weights for every edges. Also, all the weights have uniform parity. From Lemma 7.2, we can realize the weighted majority graph using O(m2M) votes. 164 Now we move on to the ranked pairs voting rule. Theorem 7.9. The COALITIONAL MANIPULATION problem for the ranked pairs voting rule admits a polynomial kernel when the number of manipulators is poly(m). Proof. Consider all non-negative D(V\M)(ci, cj) and arrange them in non-decreasing order. Let the ordering be x1, x2, . . . , xl where l =(cid:0)m till possible. Define x0 = 0. 2(cid:1). Now keep applying following reduction rule Reduction rule 7.1. If there exist any i such that, xi − xi−1 > M + 2, subtract an even offset to all xi, xi+1, . . . , xl such that xi becomes either (xi−1 + M + 1) or (xi−1 + M + 2). The reduction rule is correct since for any set of votes by M, for any four candidates a, b, x, y ∈ C, D(a, b) > D(x, y) in the original instance if and only if D(a, b) > D(x, y) in the reduced instance. Now we have a weighted majority graph with O(m2M) weights for every edges. Also, all the weights have uniform parity and hence can be realized with O(m4M) votes by Lemma 7.2. 7.5 Conclusion Here we showed that the POSSIBLE WINNER problem does not admit a polynomial kernel for many common voting rules under the complexity theoretic assumption that CoNP ⊆ NP/Poly is not true. We also showed the existence of polynomial kernels for the COALITIONAL MA- NIPULATION problem for many common voting rules. This shows that the POSSIBLE WINNER problem is a significantly harder problem than the COALITIONAL MANIPULATION problem, al- though both the problems are NP-complete. With this, we conclude the winner determination part of the thesis. We now move on to the last part of the thesis which study computational complexity of various form of election control. 165 Part III Election Control In this part of the thesis, we present our results on the computational complexity of various problems in the context of election control. We have the following chapters in this part. ⊲ In Chapter 8 – Manipulation with Partial Votes – we show that manipulating an election becomes a much harder problem when the manipulators only have a partial knowledge about the votes of the other voters. Hence, manipulating an election, although feasible in theory, may often be harder in practice. ⊲ In Chapter 9 – Manipulation Detection – we initiate the work on detecting possible instances of manipulation behavior in elections. Our work shows that detecting possible instances of manipulation may often be a much easier problem than manipulating the election itself. ⊲ In Chapter 10 – Frugal Bribery – we show that the computational problem of bribery in an election remains an intractable problem even with a much weaker notion of bribery which we call frugal bribery. Hence, our results strengthen the intractability results from the literature on bribery. 166 Chapter 8 Manipulation with Partial Votes The Coalitional Manipulation problem has been studied extensively in the literature for many voting rules. However, most studies have focused on the complete informa- tion setting, wherein the manipulators know the votes of the non-manipulators. While this assumption is reasonable for purposes of showing intractability, it is unrealistic for algorithmic considerations. In most real-world scenarios, it is impractical for the manip- ulators to have accurate knowledge of all the other votes. In this work, we investigate manipulation with incomplete information. In our framework, the manipulators know a partial order for each voter that is consistent with the true preference of that voter. In this setting, we formulate three natural computational notions of manipulation, namely weak, opportunistic, and strong manipulation. We say that an extension of a partial order is viable if there exists a manipulative vote for that extension. We propose the following notions of manipulation when manipulators have incomplete information about the votes of other voters. 1. WEAK MANIPULATION: the manipulators seek to vote in a way that makes their preferred candidate win in at least one extension of the partial votes of the non- manipulators. 2. OPPORTUNISTIC MANIPULATION: the manipulators seek to vote in a way that makes their preferred candidate win in every viable extension of the partial votes of the non-manipulators. A preliminary version of the work in this chapter was published as [DMN16a]: Palash Dey, Neeldhara Misra, and Y. Narahari. Complexity of manipulation with partial information in voting. In Proc. Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI 2016, New York, NY, USA, 9-15 July 2016, pages 229-235, 2016. 168 3. STRONG MANIPULATION: the manipulators seek to vote in a way that makes their pre- ferred candidate win in every extension of the partial votes of the non-manipulators. We consider several scenarios for which the traditional manipulation problems are easy (for instance, Borda with a single manipulator). For many of them, the correspond- ing manipulative questions that we propose turn out to be computationally intractable. Our hardness results often hold even when very little information is missing, or in other words, even when the instances are very close to the complete information setting. Our results show that the impact of paucity of information on the computational complexity of manipulation crucially depends on the notion of manipulation under consideration. Our overall conclusion is that computational hardness continues to be a valid obstruction to manipulation, in the context of a more realistic model. 8.1 Introduction A central issue in voting is the possibility of manipulation. For many voting rules, it turns out that even a single vote, if cast differently, can alter the outcome. In particular, a voter manipulates an election if, by misrepresenting her preference, she obtains an outcome that she prefers over the "honest" outcome. In a cornerstone impossibility result, Gibbard and Satterthwaite [Gib73, Sat75] show that every unanimous and non-dictatorial voting rule with three candidates or more is manipulable. We refer to [BCE+15] for an excellent introduction to various strategic issues in computational social choice theory. Considering that voting rules are indeed susceptible to manipulation, it is natural to seek ways by which elections can be protected from manipulations. The works of Bartholdi et al. [BTT89, BO91] approach the problem from the perspective of computational intractability. They exploit the possibility that voting rules, despite being vulnerable to manipulation in theory, may be hard to manipulate in practice. Indeed, a manipulator is faced with the following decision problem: given a collection of votes P and a distinguished candidate c, does there exist a vote v that, when tallied with P, makes c win for a (fixed) voting rule r? The manipulation problem has subsequently been generalized to the problem of COALITIONAL MANIPULATION by Conitzer et al. [CSL07], where one or more manipulators collude together and try to make a distinguished candidate win the election. The manipulation problem, fortunately, turns out to be NP-hard in several settings. This established the success of the approach of demonstrating a computational barrier to manipulation. 169 However, despite having set out to demonstrate the hardness of manipulation, the initial results in [BTT89] were to the contrary, indicating that many voting rules are in fact easy to manipulate. Moreover, even with multiple manipulators involved, popular voting rules like plurality, veto, k-approval, Bucklin, and Fallback continue to be easy to manipulate [XZP+09]. While we know that the computational intractability may not provide a strong barrier [PR06, PR07, FKN08, XC08a, XC08b, FHH10, Wal10, Wal11b, IKM12, Dey15, DMN15b, DMN16c, DMN15a, DN14, DN15a] even for rules for which the coalitional manipulation problem turns out to be NP-hard, in all other cases the possibility of manipulation is a much more serious concern. 8.1.1 Motivation and Problem Formulation In our work, we propose to extend the argument of computational intractability to address the cases where the approach appears to fail. We note that most incarnations of the manipu- lation problem studied so far are in the complete information setting, where the manipulators have complete knowledge of the preferences of the truthful voters. While these assumptions are indeed the best possible for the computationally negative results, we note that they are not reflective of typical real-world scenarios. Indeed, concerns regarding privacy of informa- tion, and in other cases, the sheer volume of information, would be significant hurdles for manipulators to obtain complete information. Motivated by this, we consider the manipu- lation problem in a natural partial information setting. In particular, we model the partial information of the manipulators about the votes of the non-manipulators as partial orders over the set of candidates. A partial order over the set of candidates will be called a partial vote. Our results show that several of the voting rules that are easy to manipulate in the com- plete information setting become intractable when the manipulators know only partial votes. Indeed, for many voting rules, we show that even if the ordering of a small number of pairs of candidates is missing from the profile, manipulation becomes an intractable problem. Our results therefore strengthen the view that manipulation may not be practical if we limit the information the manipulators have at their disposal about the votes of other voters [CWX11]. We introduce three new computational problems that, in a natural way, extend the ques- tion of manipulation to the partial information setting. In these problems, the input is a set of partial votes P corresponding to the votes of the non-manipulators, a non-empty set of manipulators M, and a preferred candidate c. The task in the WEAK MANIPULATION (WM) problem is to determine if there is a way to cast the manipulators' votes such that c wins 170 the election for at least one extension of the partial votes in P. On the other hand, in the STRONG MANIPULATION (SM) problem, we would like to know if there is a way of casting the manipulators' votes such that c wins the election in every extension of the partial votes in P. We also introduce the problem of OPPORTUNISTIC MANIPULATION (OM), which is an "in- termediate" notion of manipulation. Let us call an extension of a partial profile viable if it is possible for the manipulators to vote in such a way that the manipulators' desired candidate wins in that extension. In other words, a viable extension is a YES-instance of the standard COALITIONAL MANIPULATION problem. We have an opportunistic manipulation when it is possible for the manipulators to cast a vote which makes c win the election in all viable extensions. Note that any YES-instance of STRONG MANIPULATION is also a YES-instance of OPPORTUNISTIC MANIPULATION, but this may not be true in the reverse direction. As a par- ticularly extreme example, consider a partial profile where there are no viable extensions: this would be a NO-instance for STRONG MANIPULATION, but a (vacuous) YES-instance of OPPORTUNISTIC MANIPULATION. The OPPORTUNISTIC MANIPULATION problem allows us to explore a more relaxed notion of manipulation: one where the manipulators are obliged to be successful only in extensions where it is possible to be successful. Note that the goal with STRONG MANIPULATION is to be successful in all extensions, and therefore the only interesting instances are the ones where all extensions are viable. It is easy to see that YES instance of STRONG MANIPULATION is also a YES instance of OPPORTUNISTIC MANIPULATION and WEAK MANIPULATION. Beyond this, we remark that all the three problems are questions with different goals, and neither of them render the other redundant. We refer the reader to Figure 8.1 for a simple example distinguishing these scenarios. All the problems above generalize COALITIONAL MANIPULATION, and hence any computa- tional intractability result for COALITIONAL MANIPULATION immediately yields a correspond- ing intractability result for WEAK MANIPULATION, STRONG MANIPULATION, and OPPORTUNIS- TIC MANIPULATION under the same setting. For example, it is known that the COALITIONAL MANIPULATION problem is intractable for the maximin voting rule when we have at least two manipulators [XZP+09]. Hence, the WEAK MANIPULATION, STRONG MANIPULATION, and OP- PORTUNISTIC MANIPULATION problems are intractable for the maximin voting rule when we have at least two manipulators. 171 Figure 8.1: An example of a partial profile. Consider the plurality voting rule with one manipulator. If the favorite candidate is A, then the manipulator simply has to place A on the top his vote to make A win in any extension. If the favorite candidate is B, there is no vote that makes B win in any extension. Finally, if the favorite candidate is C, then with a vote that places C on top, the manipulator can make C win in the only viable extension (Extension 2). 8.1.2 Related Work A notion of manipulation under partial information has been considered by Conitzer et al. [CWX11]. They focus on whether or not there exists a dominating manipulation and show that this problem is NP-hard for many common voting rules. Given some partial votes, a dominating manipulation is a non-truthful vote that the manipulator can cast which makes the winner at least as preferable (and sometimes more preferable) as the winner when the manipulator votes truthfully. The dominating manipulation problem and the WEAK MANIPU- LATION, OPPORTUNISTIC MANIPULATION, and STRONG MANIPULATION problems do not seem to have any apparent complexity-theoretic connection. For example, the dominating manipu- lation problem is NP-hard for all the common voting rules except plurality and veto, whereas, the STRONG MANIPULATION problem is easy for most of the cases (see Table 8.1). However, the results in [CWX11] establish the fact that it is indeed possible to make manipulation in- tractable by restricting the amount of information the manipulators possess about the votes of the other voters. Elkind and Erd´elyi [EE12] study manipulation under voting rule uncertainty. However, in our work, the voting rule is fixed and known to the manipulators. Two closely related problems that have been extensively studied in the context of incom- plete votes are POSSIBLE WINNER and NECESSARY WINNER [KL05]. In the POSSIBLE WINNER problem, we are given a set of partial votes P and a candidate c, and the question is whether 172 there exists an extension of P where c wins, while in the NECESSARY WINNER problem, the question is whether c is a winner in every extension of P. Following the work in [KL05], a number of special cases and variants of the POSSIBLE WINNER problem have been studied in the literature [CLMM10, BBF10, BRR11, BRR+12, GNNW14, XC11, DL13a, NW14, BFLR12, ML15]. The flavor of the WEAK MANIPULATION problem is clearly similar to POSSIBLE WIN- NER. However, we emphasize that there are subtle distinctions between the two problems. A more elaborate comparison is made in the next section. 8.1.3 Our Contribution Our primary contribution in this work is to propose and study three natural and realistic generalizations of the computational problem of manipulation in the incomplete information setting. We summarize the complexity results in this work in Table 8.1. Our results provides the following interesting insights on the impact of lack of information on the computational difficulty of manipulation. We note that the number of undetermined pairs of candidates per vote are small constants in all our hardness results. ⊲ We observe that the computational problem of manipulation for the plurality and veto voting rules remains polynomial time solvable even with lack of information, irrespec- tive of the notion of manipulation under consideration [Proposition 8.1, Theorem 8.11 and 8.15, and observation 8.4]. We note that the plurality and veto voting rule also remain vulnerable under the notion of dominating manipulation [CWX11]. ⊲ The impact of absence of information on the computational complexity of manipulation is more dynamic for the k-approval, k-veto, Bucklin, Borda, and maximin voting rules. Only the WEAK MANIPULATION and OPPORTUNISTIC MANIPULATION problems are com- putationally intractable for the k-approval [Theorem 8.1 and 8.5], k-veto [Theorem 8.2 and 8.6], Bucklin [Theorem 8.3 and 8.10], Borda [Observation 8.3 and Theorem 8.7], and maximin [Observation 8.3 and Theorem 8.8] voting rules, whereas the STRONG MANIPULATION problem remains computationally tractable [Theorem 8.11 to 8.14]. ⊲ Table 8.1 shows an interesting behavior of the fallback voting rule. The Fallback vot- ing rule is the only voting rule among the voting rules we study here for which the WEAK MANIPULATION problem is NP-hard [Theorem 8.3] but both the OPPORTUNIS- TIC MANIPULATION and STRONG MANIPULATION problems are polynomial time solvable 173 [Theorem 8.13 and observation 8.4]. This is because the OPPORTUNISTIC MANIPULA- TION problem can be solved for the fallback voting rule by simply making manipulators vote for their desired candidate. ⊲ Our results show that absence of information makes all the three notions of manipula- tions intractable for the Copelandα voting rule for every rational α ∈ [0, 1] \ {0.5} for the WEAK MANIPULATION problem [Observation 8.3] and for every α ∈ [0, 1] for the OPPORTUNISTIC MANIPULATION and STRONG MANIPULATION problems [Theorem 8.4 and 8.9]. Our results (see Table 8.1) show that whether lack of information makes the manipulation problems harder, crucially depends on the notion of manipulation applicable to the situation under consideration. All the three notions of manipulations are, in our view, natural extension of manipulation to the incomplete information setting and tries to capture different behaviors of manipulators. For example, the WEAK MANIPULATION problem may be applicable to an optimistic manipulator whereas for an pessimistic manipulator, the STRONG MANIPULATION problem may make more sense. 8.1.4 Problem Definitions We now formally define the three problems that we consider in this work, namely WEAK MANIPULATION, OPPORTUNISTIC MANIPULATION, and STRONG MANIPULATION. Let r be a fixed voting rule. We first introduce the WEAK MANIPULATION problem. Definition 8.1. r-WEAK MANIPULATION Given a set of partial votes P over a set of candidates C, a positive integer ℓ (> 0) denoting the number of manipulators, and a candidate c, do there exist votes ≻1, . . . , ≻ℓ ∈ L(C) such that there exists an extension ≻∈ L(C)P of P with r(≻, ≻1, . . . , ≻ℓ) = c? To define the OPPORTUNISTIC MANIPULATION problem, we first introduce the notion of an (r, c)-opportunistic voting profile, where r is a voting rule and c is any particular candidate. Definition 8.2. (r, c)-Opportunistic Voting Profile Let ℓ be the number of manipulators and P a set of partial votes. An ℓ-voter profile (≻i)i∈[ℓ] ∈ L(C)ℓ is called an (r, c)-opportunistic voting profile if for each extension P of P for which there exists an ℓ-vote profile (≻′i)i∈[ℓ] ∈ L(C)ℓ with r(cid:16)P ∪ (≻′i)i∈[ℓ](cid:17) = c, we have r(cid:16)P ∪ (≻i)i∈[ℓ](cid:17) = c. 174 Plurality Veto k-Approval k-Veto Bucklin Fallback Borda maximin Copelandα WM, ℓ = 1 WM OM, ℓ = 1 OM SM, ℓ = 1 SM P P NP-complete coNP-hard P P NP-complete coNP-hard P NP-hard coNP-hard Table 8.1: Summary of Results (ℓ denotes the number of manipulators). The results in white follow immediately from the literature (Observation 8.1 to 8.3). Our results for the Copelandα voting rule hold for every rational α ∈ [0, 1] \ {0.5} for the WEAK MANIPULA- TION problem and for every α ∈ [0, 1] for the OPPORTUNISTIC MANIPULATION and STRONG MANIPULATION problems. 175 In other words, an ℓ-vote profile is (r, c)-opportunistic with respect to a partial profile if, when put together with the truthful votes of any extension, c wins if the extension is viable to begin with. We are now ready to define the OPPORTUNISTIC MANIPULATION problem. Definition 8.3. r-OPPORTUNISTIC MANIPULATION Given a set of partial votes P over a set of candidates C, a positive integer ℓ (> 0) denoting the number of manipulators, and a candidate c, does there exist an (r, c)-opportunistic ℓ-vote profile? We finally define the STRONG MANIPULATION problem. Definition 8.4. r-STRONG MANIPULATION Given a set of partial votes P over a set of candidates C, a positive integer ℓ (> 0) denoting the number of manipulators, and a candidate c, do there exist votes (≻i)i∈ℓ ∈ L(C)ℓ such that for every extension ≻∈ L(C)P of P, we have r(≻, (≻i)i∈[ℓ]) = c? We use (P, ℓ, c) to denote instances of WEAK MANIPULATION, OPPORTUNISTIC MANIPULA- TION, and STRONG MANIPULATION, where P denotes a profile of partial votes, ℓ denotes the number of manipulators, and c denotes the desired winner. For the sake of completeness, we provide the definitions of the COALITIONAL MANIPULA- TION and POSSIBLE WINNER problems below. Definition 8.5. r-COALITIONAL MANIPULATION Given a set of complete votes ≻ over a set of candidates C, a positive integer ℓ (> 0) denoting the number of manipulators, and a candidate c, do there exist votes (≻i)i∈ℓ ∈ L(C)ℓ such that r(cid:16)≻, (≻i)i∈[ℓ](cid:17) = c? Definition 8.6. r-POSSIBLE WINNER Given a set of partial votes P and a candidate c, does there exist an extension ≻ of the partial votes in P to linear votes such that r(≻) = c? 8.1.5 Comparison with Possible Winner and Coalitional Manipulation Problems For any fixed voting rule, the WEAK MANIPULATION problem with ℓ manipulators reduces to the POSSIBLE WINNER problem. This is achieved by simply using the same set as truthful votes and introducing ℓ empty votes. We summarize this in the observation below. 176 Observation 8.1. The WEAK MANIPULATION problem many-to-one reduces to the POSSIBLE WINNER problem for every voting rule. Proof. Let (P, ℓ, c) be an instance of WEAK MANIPULATION. Let Q be the set consisting of ℓ many copies of partial votes {∅}. Clearly the WEAK MANIPULATION instance (P, ℓ, c) is equiva- lent to the POSSIBLE WINNER instance (P ∪ Q). However, whether the POSSIBLE WINNER problem reduces to the WEAK MANIPULATION problem or not is not clear since in any WEAK MANIPULATION problem instance, there must exist at least one manipulator and a POSSIBLE WINNER instance may have no empty vote. From a technical point of view, the difference between the WEAK MANIPULATION and POSSI- BLE WINNER problems may look marginal; however we believe that the WEAK MANIPULATION problem is a very natural generalization of the COALITIONAL MANIPULATION problem in the partial information setting and thus worth studying. Similarly, it is easy to show, that the COALITIONAL MANIPULATION problem with ℓ manipulators reduces to WEAK MANIPULATION, OPPORTUNISTIC MANIPULATION, and STRONG MANIPULATION problems with ℓ manipulators, since the former is a special case of the latter ones. Observation 8.2. The COALITIONAL MANIPULATION problem with ℓ manipulators many-to-one reduces to WEAK MANIPULATION, OPPORTUNISTIC MANIPULATION, and STRONG MANIPULA- TION problems with ℓ manipulators for all voting rules and for all positive integers ℓ. Proof. Follows from the fact that every instance of the COALITIONAL MANIPULATION problem is also an equivalent instance of the WEAK MANIPULATION, OPPORTUNISTIC MANIPULATION, and STRONG MANIPULATION problems. Finally, we note that the COALITIONAL MANIPULATION problem with ℓ manipulators can be reduced to the WEAK MANIPULATION problem with just one manipulator, by introducing ℓ − 1 empty votes. These votes can be used to witness a good extension in the forward direction. In the reverse direction, given an extension where the manipulator is successful, the extension can be used as the manipulator's votes. This argument leads to the following observation. Observation 8.3. The COALITIONAL MANIPULATION problem with ℓ manipulators many-to-one reduces to the WEAK MANIPULATION problem with one manipulator for every voting rule and for every positive integer ℓ. 177 Proof. Let (P, ℓ, c) be an instance of COALITIONAL MANIPULATION. Let Q be the set of con- sisting of ℓ − 1 many copies of partial vote {c ≻ others}. Clearly the WEAK MANIPULATION instance (P ∪ Q, 1, c) is equivalent to the COALITIONAL MANIPULATION instance (P, ℓ, 1). This observation can be used to derive the hardness of WEAK MANIPULATION even for one manipulator whenever the hardness for COALITIONAL MANIPULATION is known for any fixed number of manipulators (for instance, this is the case for the voting rules such as Borda, maximin and Copeland). However, determining the complexity of WEAK MANIPULATION with one manipulator requires further work for voting rules where COALITIONAL MANIPULATION is polynomially solvable for any number of manipulators (such as k-approval, Plurality, Bucklin, and so on). 8.2 Hardness Results for WEAK MANIPULATION, OPPOR- TUNISTIC MANIPULATION, and STRONG MANIPULATION Problems In this section, we present our hardness results. While some of our reductions are from the POSSIBLE WINNER problem, the other reductions in this section are from the EXACT COVER BY 3-SETS problem, also referred to as X3C. This is a well-known NP-complete [GJ79] problem, and is defined as follows. Definition 8.7 (Exact Cover by 3-Sets (X3C)). Given a set U and a collection S = {S1, S2, . . . , St} of t subsets of U with Si = 3 ∀i = 1, . . . , t, does there exist a T ⊂ S with T = U 3 such that ∪X∈TX = U? We use X3C to refer to the complement of X3C, which is to say that an instance of X3C is a YES instance if and only if it is a NO instance of X3C. The rest of this section is organized according to the problems being addressed. 8.2.1 Weak Manipulation Problem To begin with, recall that the COALITIONAL MANIPULATION problem is NP-complete for the Borda [DKNW11, BNW11], maximin [XZP+09], and Copelandα [FHS08, FHHR09, FHS10] voting rules for every rational α ∈ [0, 1] \{0.5}, when we have two manipulators. Therefore, it 178 follows from Observation 8.3 that the WEAK MANIPULATION problem is NP-complete for the Borda, maximin, and Copelandα voting rules for every rational α ∈ [0, 1] \ {0.5}, even with one manipulator. For the k-approval and k-veto voting rules, we reduce from the corresponding POSSIBLE WINNER problems. While it is natural to start from the same voting profile, the main challenge is in undoing the advantage that the favorite candidate receives from the manipulator's vote, in the reverse direction. 8.2.1.1 Result for the k-Approval Voting Rule We begin with proving that the WEAK MANIPULATION problem is NP-complete for the k- approval voting rule even with one manipulator and at most 4 undetermined pairs per vote. Theorem 8.1. The WEAK MANIPULATION problem is NP-complete for the k-approval voting rule even with one manipulator for any constant k > 1, even when the number of undetermined pairs in each vote is no more than 4. Proof. For simplicity of presentation, we prove the theorem for 2-approval. We reduce from the POSSIBLE WINNER problem for 2-approval which is NP-complete [XC11], even when the number of undetermined pairs in each vote is no more than 4. Let P be the set of partial votes in a POSSIBLE WINNER instance, and let C = {c1, . . . , cm, c} be the set of candidates, where the goal is to check if there is an extension of P that makes c win. For developing the instance of WEAK MANIPULATION, we need to "reverse" any advantage that the candidate c obtains from the vote of the manipulator. Notice that the most that the manipulator can do is to increase the score of c by one. Therefore, in our construction, we "artificially" increase the score of all the other candidates by one, so that despite of the manipulator's vote, c will win the new election if and only if it was a possible winner in the POSSIBLE WINNER instance. To this end, we introduce (m + 1) many dummy candidates d1, . . . , dm+1 and the complete votes: wi = ci ≻ di ≻ others, for every i ∈ {1, . . . , m} Further, we extend the given partial votes of the POSSIBLE WINNER instance to force the dummy candidates to be preferred least over the rest - by defining, for every vi ∈ P, the corresponding partial vote v′i as follows. v′i = vi ∪ {C ≻ {d1, . . . , dm+1}}. 179 This ensures that all the dummy candidates do not receive any score from the modified partial votes corresponding to the partial votes of the POSSIBLE WINNER instance. Notice that since the number of undetermined pairs in vi is no more than 4, the number of undetermined pairs in v′i is also no more than 4. Let (C′, Q, c) denote this constructed WEAK MANIPULATION instance. We claim that the two instances are equivalent. In the forward direction, suppose c is a possible winner with respect to P, and let P be an extension where c wins. Then it is easy to see that the manipulator can make c win in some extension by placing c and dm+1 in the first two positions of her vote (note that the partial score of dm+1 is zero in Q). Indeed, consider the extension of Q obtained by mimicking the extension P on the "common" partial votes, {v′i vi ∈ P}. Notice that this is well-defined since vi and v′i have exactly the same set of incomparable pairs. In this extension, the score of c is strictly greater than the scores of all the other candidates, since the scores of all candidates in C is exactly one more than their scores in P, and all the dummy candidates have a score of at most one. In the reverse direction, notice that the manipulator puts the candidates c and dm+1 in the top two positions without loss of generality. Now suppose the manipulator's vote c ≻ dm+1 ≻ others makes c win the election for an extension Q of Q. Then consider the extension P obtained by restricting Q to C. Notice that the score of each candidate in C in this extension is one less than their scores in Q. Therefore, the candidate c wins this election as well, concluding the proof. The above proof can be imitated for any other constant values of k by reducing it from the POSSIBLE WINNER problem for k-approval and introducing (m+1)(k−1) dummy candidates. 8.2.1.2 Result for the k-Veto Voting Rule Theorem 8.2. The WEAK MANIPULATION problem for the k-veto voting rule is NP-complete even with one manipulator for any constant k > 1. Proof. We reduce from the POSSIBLE WINNER problem for the k-veto voting rule which is known to be NP-complete [BD09]. Let P be the set of partial votes in a POSSIBLE WINNER problem instance, and let C = {c1, . . . , cm, c} be the set of candidates, where the goal is to check if there is an extension that makes c win with respect to k-veto. We assume without loss of generality that c's position is fixed in all the partial votes (if not, then we fix the position of c as high as possible in every vote). 180 We introduce k + 1 many dummy candidates d1, . . . , dk, d. The role of the first k dummy candidates is to ensure that the manipulator is forced to place them at the "bottom k" posi- tions of her vote, so that all the original candidates get the same score from the additional vote of the manipulator. The most natural way of achieving this is to ensure that the dummy candidates have the same score as c in any extension (note that we know the score of c since c's position is fixed in all the partial votes). This would force the manipulator to place these k candidates in the last k positions. Indeed, doing anything else will cause these candidates to tie with c, even when there is an extension of P that makes c win. To this end, we begin by placing the dummy candidates in the top k positions in all the partial votes. Formally, we modify every partial vote as follows: w = di ≻ others, for every i ∈ {1, . . . , k} At this point, we know the scores of c and di, for every i ∈ {1, . . . , k}. Using Lemma 7.1, we add complete votes such that the final score of c is the same with the score of every di and the score of c is strictly more than the score of d. The relative score of every other candidate remains the same. This completes the description of the construction. We denote the augmented set of partial votes by P. We now argue the correctness. In the forward direction, if there is an extension of the votes that makes c win, then we repeat this extension, and the vote of the manipulator puts the candidate di at the position m + i + 2; and all the other candidates in an arbitrary fashion. Formally, we let the manipulator's vote be: v = c ≻ c1 ≻ · · · ≻ cm ≻ d ≻ d1 ≻ · · · ≻ dk. By construction c wins the election in this particular setup. In the reverse direction, consider a vote of the manipulator and an extension Q of P in which c wins. Note that the manipulator's vote necessarily places the candidates di in the bottom k positions - indeed, if not, then c cannot win the election by construction. We extend a partial vote w ∈ P by mimicking the extension of the corresponding partial vote w′ ∈ P, that is, we simply project the extension of w′ on the original set of candidates C. Let Q denote this proposed extension of P. We claim that c wins the election given by Q. Indeed, suppose not. Let ci be a candidate whose score is at least the score of c in the extension Q. Note that the scores of ci and c in the extension Q are exactly the same as their scores in Q, except for a constant offset - importantly, their 181 scores are offset by the same amount. This implies that the score of ci is at least the score of c in Q as well, which is a contradiction. Hence, the two instances are equivalent. 8.2.1.3 Result for the Bucklin Voting Rule We next prove, by a reduction from X3C, that the WEAK MANIPULATION problem for the Bucklin and simplified Bucklin voting rules is NP-complete even with one manipulator and at most 16 undetermined pairs per vote. Theorem 8.3. The WEAK MANIPULATION problem is NP-complete for Bucklin, simplified Buck- lin, Fallback, and simplified Fallback voting rules, even when we have only one manipulator and the number of undetermined pairs in each vote is no more than 16. Proof. We reduce the X3C problem to WEAK MANIPULATION for simplified Bucklin. Let (U = {u1, . . . , um}, S := {S1, S2, . . . , St}) be an instance of X3C, where each Si is a subset of U of size three. We construct a WEAK MANIPULATION instance based on (U, S) as follows. Candidate set: C = W ∪ X ∪ D ∪ U ∪ {c, w, a, b}, where W = m − 3, X = 4, D = m + 1 We first introduce the following partial votes P in correspondence with the sets in the family as follows. W ≻ X ≻ Si ≻ c ≻ (U \ Si) ≻ D \ ({X × ({c} ∪ Si)}) , ∀i 6 t Notice that the number of undetermined pairs in every vote in P is 16. We introduce the following additional complete votes Q: ⊲ t copies of U ≻ c ≻ others ⊲ m/3 − 1 copies of U ≻ a ≻ c ≻ others ⊲ m/3 + 1 copies of D ≻ b ≻ others The total number of voters, including the manipulator, is 2t + 2m/3 + 1. Now we show equiv- alence of the two instances. In the forward direction, suppose we have an exact set cover T ⊂ S. Let the vote of the manipulator v be c ≻ D ≻ others. We consider the following extension P of P. W ≻ Si ≻ c ≻ X ≻ (U \ Si) ≻ D 182 On the other hand, if Si ∈ S \ T, then we have: W ≻ X ≻ Si ≻ c ≻ (U \ Si) ≻ D We claim that c is the unique simplified Bucklin winner in the profile (P, W, v). Notice that the simplified Bucklin score of c is m + 1 in this extension, since it appears in the top m + 1 positions in the m/3 votes corresponding to the set cover, t votes from the complete profile Q and one vote v of the manipulator. For any other candidate ui ∈ U, ui appears in the top m + 1 positions once in P and t + m 3 − 1 times in Q. Thus, ui does not get majority in top m + 1 positions making its simplified Bucklin score at least m + 2. Hence, c is the unique simplified Bucklin winner in the profile (P, W, v). Similarly, the candidate w1 appears only t times in the top m + 1 positions. The same can be argued for the remaining candidates in D, W, and w. In the reverse direction, suppose the WEAK MANIPULATION is a YES instance. We may assume without loss of generality that the manipulator's vote v is c ≻ D ≻ others, since the simplified Bucklin score of the candidates in D is at least 2m. Let P be the extension of P 3 + 1 votes in Q, for c to win, c ≻ wm−2 must hold in at least m such that c is the unique winner in the profile (P, Q, v). As w1 is ranked within top m + 2 positions in t + m 3 votes in P. In those votes, all the candidates in Si are also within top m + 2 positions. Now if any candidate in U is within top m + 1 positions in P more than once, then c will not be the unique winner. Hence, the Si's corresponding to the votes where c ≻ wm−2 in P form an exact set cover. The reduction above also works for the Bucklin voting rule. Specifically, the argument for the forward direction is exactly the same as the simplified Bucklin above and the argument for the reverse direction is as follows. The candidate w1 is ranked within top m + 2 positions in t + m 3 + 1 votes in Q and c is never placed within top m + 2 positions in any vote in Q. Hence, for c to win, c ≻ wm−2 must hold in at least m 3 votes in P. In those votes, all the candidates in Si are also within top m positions. Notice that c never gets placed within top m positions in any vote in (P, Q). Now if any candidate x ∈ U is within top m positions in P more than once, then x gets majority within top m positions and thus c cannot win. The result for the Fallback and simplified Fallback voting rules follow from the corre- sponding results for the Bucklin and simplified Bucklin voting rules respectively since every Bucklin and simplified Bucklin election is also a Fallback and simplified Fallback election respectively. 183 8.2.2 Strong Manipulation Problem We know that the COALITIONAL MANIPULATION problem is NP-complete for the Borda, max- imin, and Copelandα voting rules for every rational α ∈ [0, 1] \ {0.5}, when we have two manipulators. Thus, it follows from Observation 8.2 that STRONG MANIPULATION is NP-hard for Borda, maximin, and Copelandα voting rules for every rational α ∈ [0, 1] \ {0.5} for at least two manipulators. For the case of one manipulator, STRONG MANIPULATION turns out to be polynomial-time solvable for most other voting rules. For Copelandα, however, we show that the problem is co- NP-hard for every α ∈ [0, 1] for a single manipulator, even when the number of undetermined pairs in each vote is bounded by a constant. This is achieved by a careful reduction from X3C. We have following intractability result for the STRONG MANIPULATION problem for the Copelandα rule with one manipulator and at most 10 undetermined pairs per vote. Theorem 8.4. STRONG MANIPULATION is co-NP-hard for Copelandα voting rule for every α ∈ [0, 1] even when we have only one manipulator and the number of undetermined pairs in each vote is no more than 10. Proof. We reduce X3C to STRONG MANIPULATION for Copelandα rule. Let (U = {u1, . . . , um}, S = {S1, S2, . . . , St}) is an X3C instance. We assume, without loss of general- ity, t to be an even integer (if not, replicate any set from S). We construct a corresponding WEAK MANIPULATION instance for Copelandα as follows. Candidate set C = U ∪ {c, w, z, d} Partial votes P: ∀i 6 t, (U \ Si) ≻ c ≻ z ≻ d ≻ Si ≻ w \ {{z, c} × (Si ∪ {d, w})} Notice that the number of undetermined pairs in every vote in P is 10. Now we add a set Q of complete votes with Q even and Q = poly(m, t) using Lemma 7.2 to achieve the following margin of victories in pairwise elections. ⊲ DQ(d, z) = DQ(z, c) = DQ(c, d) = DQ(w, z) = 4t ⊲ DQ(ui, d) = DQ(c, ui) = 4t ∀ui ∈ U ⊲ DQ(z, ui) = t ∀ui ∈ U 184 ⊲ DQ(c, w) = t − 2q 3 − 2 ⊲ DQ(ui, ui+1 (mod ∗)q) = 4t ∀ui ∈ U ⊲ DQ(a, b) = 0 for every a, b ∈ C, a 6= b, not mentioned above We have only one manipulator who tries to make c winner. Notice that the number of votes in the STRONG MANIPULATION instance (P∪Q, 1, c) including the manipulator's vote is odd (since P and Q are even integers). Therefore, DP∗∪Q∪{v∗}(a, b) is never zero for every a, b ∈ C, a 6= b in every extension P∗ of P and manipulators vote v∗ and consequently the particular value of α does not play any role in this reduction. Hence, we assume, without loss of generality, α to be zero from here on and simply use the term Copeland instead of Copelandα. Now we show that the X3C instance (U, S) is a YES instance if and only if the STRONG MANIPULATION instance (P ∪ Q, 1, c) is a NO instance (a STRONG MANIPULATION instance is a NO instance if there does not exist a vote of the manipulator which makes c the unique winner in every extension of the partial votes). We can assume without loss of generality that manipulator puts c at first position and z at last position in her vote v. Assume that the X3C instance is a YES instance. Suppose (by renaming) that S1, . . . , S m 3 forms an exact set cover. We claim that the following extension P of P makes both z and c Copeland co-winners. Extension P of P: i 6 m 3 , (U \ Si) ≻ c ≻ z ≻ d ≻ Si ≻ w i > m 3 + 1, (U \ Si) ≻ d ≻ Si ≻ w ≻ c ≻ z We have summarize the pairwise margins between z and c and the rest of the candidates from the profile (P ∪ Q ∪ v) in Table 8.2. The candidates z and c are the co-winners with Copeland score (m + 1). C \ {z} DP∪Q∪v(z, ·) c w, d ui ∈ U > 3t 6 −3t 1 C \ {c} DP∪Q∪v(c, ·) z, ui ∈ U > 3t w d −1 6 −3t Table 8.2: DP∪Q∪v(z, ·) and DP∪Q∪v(c, ·) 185 For the other direction, notice that Copeland score of c is at least m + 1 since c defeats d and every candidate in U in every extension of P. Also notice that the Copeland score of z can be at most m + 1 since z loses to w and d in every extension of P. Hence the only way c cannot be the unique winner is that z defeats all candidates in U and w defeats c. This requires w ≻ c in at least t − m 3 extensions of P. We claim that the sets Si in the remaining of the extensions where c ≻ w forms an exact set cover for (U, S). Indeed, otherwise some candidate ui ∈ U is not covered. Then, notice that ui ≻ z in all t votes, making D(z, ui) = −1. 8.2.3 Opportunistic Manipulation Problem All our reductions for the co-NP-hardness for OPPORTUNISTIC MANIPULATION start from X3C. We note that all our hardness results hold even when there is only one manipulator. Our overall approach is the following. We engineer a set of partial votes in such a way that the manipulator is forced to vote in a limited number of ways to have any hope of making her favorite candidate win. For each such vote, we demonstrate a viable extension where the vote fails to make the candidate a winner, leading to a NO instance of OPPORTUNISTIC MANIPULATION. These extensions rely on the existence of an exact cover. On the other hand, we show that if there is no exact set cover, then there is no viable extension, thereby leading to an instance that is vacuously a YES instance of OPPORTUNISTIC MANIPULATION. 8.2.3.1 Result for the k-Approval Voting Rule Our first result on OPPORTUNISTIC MANIPULATION shows that the OPPORTUNISTIC MANIPU- LATION problem is co-NP-hard for the k-approval voting rule for constant k > 3 even when the number of manipulators is one and the number of undetermined pairs in each vote is no more than 15. Theorem 8.5. The OPPORTUNISTIC MANIPULATION problem is co-NP-hard for the k-approval voting rule for constant k > 3 even when the number of manipulators is one and the number of undetermined pairs in each vote is no more than 15. Proof. We reduce X3C to OPPORTUNISTIC MANIPULATION for k-approval rule. Let (U = {u1, . . . , um}, S = {S1, S2, . . . , St}) is an X3C instance. We construct a corresponding OPPOR- TUNISTIC MANIPULATION instance for k-approval voting rule as follows. We begin by intro- ducing a candidate for every element of the universe, along with k − 3 dummy candidates 186 (denoted by W), and special candidates {c, z1, z2, d, x, y}. Formally, we have: Candidate set C = U ∪ {c, z1, z2, d, x, y} ∪ W. Now, for every set Si in the universe, we define the following total order on the candidate set, which we denote by P′i: W ≻ Si ≻ y ≻ z1 ≻ z2 ≻ x ≻ (U \ Si) ≻ c ≻ d Using P′i, we define the partial vote Pi as follows: Pi = P′i \ ({{y, x, z1, z2} × Si} ∪ {(z1, z2), (x, z1), (x, z2)}). We denote the set of partial votes {Pi : i ∈ [t]} by P and {P′i : i ∈ [t]} by P′. We remark that the number of undetermined pairs in each partial vote Pi is 15. We now invoke Lemma 1 from [DMN16c], which allows to achieve any pre-defined scores on the candidates using only polynomially many additional votes. Using this, we add a set Q of complete votes with Q = poly(m, t) to ensure the following scores, where we denote the k-approval score of a candidate from a set of votes V by sV(·): sQ(z1) = sQ(z2) = sQ(y) = sQ(c)−m/3; sQ(d), sQ(w) 6 sQ(c)−2t ∀w ∈ W; sQ(x) = sQ(c)−1; sP′∪Q(uj) = sQ(c)+1 ∀j ∈ [m]. Our reduced instance is (P ∪ Q, 1, c). The reasoning for this score configuration will be apparent as we argue the equivalence. We first argue that if we had a YES instance of X3C (in other words, there is no exact cover), then we have a YES instance of OPPORTUNISTIC MANIP- ULATION. It turns out that this will follow from the fact that there are no viable extensions, because, as we will show next, a viable extension implies the existence of an exact set cover. To this end, first observe that the partial votes are constructed in such a way that c gets no additional score from any extension. Assuming that the manipulator approves c (without loss of generality), the final score of c in any extension is going to be sQ(c) + 1. Now, in any viable extension, every candidate uj has to be "pushed out" of the top k positions at least once. Observe that whenever this happens, y is forced into the top k positions. Since y is behind the score of c by only m/3 votes, Si's can be pushed out of place in only m/3 votes. For every uj to lose one point, these votes must correspond to an exact cover. Therefore, if there is no exact cover, then there is no viable extension, showing one direction of the reduction. 187 On the other hand, suppose we have a NO instance of X3C – that is, there is an exact cover. We will now use the exact cover to come up with two viable extensions, both of which require the manipulator to vote in different ways to make c win. Therefore, there is no single manipulative vote that accounts for both extensions, leading us to a NO instance of OPPORTUNISTIC MANIPULATION. First, consider this completion of the partial votes: i = 1, W ≻ y ≻ x ≻ z1 ≻ z2 ≻ Si ≻ (U \ Si) ≻ c ≻ d 2 6 i 6 m/3, W ≻ y ≻ z1 ≻ z2 ≻ x ≻ Si ≻ (U \ Si) ≻ c ≻ d m/3 + 1 6 i 6 t, W ≻ Si ≻ y ≻ z1 ≻ z2 ≻ x ≻ (U \ Si) ≻ c ≻ d Notice that in this completion, once accounted for along with the votes in Q, the score of c is tied with the scores of all uj's, z1, x and y, while the score of z2 is one less than the score of c. Therefore, the only k candidates that the manipulator can afford to approve are W, the candidates c, d and z2. However, consider the extension that is identical to the above except with the first vote changed to: W ≻ y ≻ x ≻ z2 ≻ z1 ≻ Si ≻ (U \ Si) ≻ c ≻ d Here, on the other hand, the only way for c to be an unique winner is if the manipulator approves W, c, d and z1. Therefore, it is clear that there is no way for the manipulator to provide a consolidated vote for both these profiles. Therefore, we have a NO instance of OPPORTUNISTIC MANIPULATION. 8.2.3.2 Result for the k-Veto Voting Rule We next move on to the k-veto voting rule and show that the OPPORTUNISTIC MANIPULATION problem for the k-veto is co-NP-hard for every constant k > 4 even when the number of manipulators is one and the number of undetermined pairs in each vote is no more than 9. Theorem 8.6. The OPPORTUNISTIC MANIPULATION problem is co-NP-hard for the k-veto voting rule for every constant k > 4 even when the number of manipulators is one and the number of undetermined pairs in each vote is no more than 9. 188 Proof. We reduce X3C to OPPORTUNISTIC MANIPULATION for k-veto rule. Let (U = {u1, . . . , um}, S = {S1, S2, . . . , St}) is an X3C instance. We construct a corresponding OPPOR- TUNISTIC MANIPULATION instance for k-veto voting rule as follows. Candidate set C = U ∪ {c, z1, z2, d, x, y} ∪ A ∪ W, where A = {a1, a2, a3}, W = k − 4 For every i ∈ [t], we define P′i as follows: ∀i 6 t, c ≻ A ≻ (U \ Si) ≻ d ≻ Si ≻ y ≻ x ≻ z1 ≻ z2 ≻ W Using P′i, we define partial vote Pi = P′i \ ({{y, x, z1, z2} × Si} ∪ {(z1, z2), (x, z1), (x, z2)}) for every i ∈ [t]. We denote the set of partial votes {Pi : i ∈ [t]} by P and {P′i : i ∈ [t]} by P′. We note that the number of undetermined pairs in each partial vote Pi is 9. Using Lemma 7.1, we add a set Q of complete votes with Q = poly(m, t) to ensure the following. We denote the k-veto score of a candidate from a set of votes W by sW(·). ⊲ sP′∪Q(z1) = sP′∪Q(z2) = sP′∪Q(c) − m/3 ⊲ sP′∪Q(ai) = sP′∪Q(uj) = sP′∪Q(w) = sP′∪Q(c) ∀ai ∈ A, uj ∈ U, w ∈ W ⊲ sP′∪Q(y) = sP′∪Q(c) − m/3 − 1 ⊲ sP′∪Q(x) = sP′∪Q(c) − 2 We have only one manipulator who tries to make c winner. Now we show that the X3C instance (U, S) is a YES instance if and only if the OPPORTUNISTIC MANIPULATION instance (P ∪ Q, 1, c) is a NO instance. In the forward direction, let us now assume that the X3C instance is a YES instance. Suppose (by renaming) that S1, . . . , Sm/3 forms an exact set cover. Let us assume that the manipulator's vote v disapproves every candidate in W ∪ A since otherwise c can never win uniquely. We now show that if v does not disapprove z1 then, v is not a c-optimal vote. Suppose v does not disapprove z1. Then we consider the following extension P of P. i = 1, c ≻ A ≻ (U \ Si) ≻ d ≻ y ≻ z1 ≻ x ≻ z2 ≻ Si ≻ W 2 6 i 6 m/3, c ≻ A ≻ (U \ Si) ≻ d ≻ y ≻ z1 ≻ z2 ≻ x ≻ Si ≻ W m/3 + 1 6 i 6 t, c ≻ A ≻ (U \ Si) ≻ d ≻ Si ≻ y ≻ x ≻ z1 ≻ z2 ≻ W 189 We have the following scores sP∪Q(c) = sP∪Q(z1) = sP∪Q(z2)+1 = sP∪Q(x)+1 = sP∪Q(uj)+ 1 ∀uj ∈ U. Hence, both c and z1 win for the votes P ∪ Q ∪ {v}. However, the vote v′ which disapproves a1, a2, a3, z1 makes c a unique winner for the votes P ∪ Q ∪ {v′}. Hence, v is not a c-optimal vote. Similarly, we can show that if the manipulator's vote does not disapprove z2 then, the vote is not c-optimal. Hence, there does not exist any c-optimal vote and the OPPORTUNISTIC MANIPULATION instance is a NO instance. In the reverse direction, we show that if the X3C instance is a NO instance, then there does not exist a vote v of the manipulator and an extension P of P such that c is the unique winner for the votes P ∪ Q ∪ {v′} thereby proving that the OPPORTUNISTIC MANIPULATION instance is vacuously YES (and thus every vote is c-optimal). Notice that, there must be at least m/3 votes P1 in P where the corresponding Si gets pushed in bottom k positions since sP′∪Q(uj) = sP′∪Q(c) ∀ai ∈ A, uj ∈ U. However, in each vote in P1, y is placed within top m − k many position and thus we have P1 is exactly m/3 since sP′∪Q(y) = sP′∪Q(c) − m/3 − 1. Now notice that there must be at least one candidate u ∈ U which is not covered by the sets Sis corresponding to the votes P1 because the X3C instance is a NO instance. Hence, c cannot win the election uniquely irrespective of the manipulator's vote. Thus every vote is c-optimal and the OPPORTUNISTIC MANIPULATION instance is a YES instance. 8.2.3.3 Result for the Borda Voting Rule We show next similar intractability result for the Borda voting rule too with only at most 7 undetermined pairs per vote. Theorem 8.7. The OPPORTUNISTIC MANIPULATION problem is co-NP-hard for the Borda voting rule even when the number of manipulators is one and the number of undetermined pairs in every vote is no more than 7. Proof. We reduce X3C to OPPORTUNISTIC MANIPULATION for the Borda rule. Let (U = {u1, . . . , um}, S = {S1, S2, . . . , St}) is an X3C instance. Without loss of generality we assume that m is not divisible by 6 (if not, then we add three new elements b1, b2, b3 to U and a set {b1, b2, b3} to S). We construct a corresponding OPPORTUNISTIC MANIPULATION instance for the Borda voting rule as follows. Candidate set C = U ∪ {c, z1, z2, d, y} For every i ∈ [t], we define P′i as follows: 190 ∀i 6 t, y ≻ Si ≻ z1 ≻ z2 ≻ (U \ Si) ≻ d ≻ c Using P′i, we define partial vote Pi = P′i \ ({({y}∪ Si)× {z1, z2}}∪ {(z1, z2)}) for every i ∈ [t]. We denote the set of partial votes {Pi : i ∈ [t]} by P and {P′i : i ∈ [t]} by P′. We note that the number of undetermined pairs in each partial vote Pi is 7. Using Lemma 7.1, we add a set Q of complete votes with Q = poly(m, t) to ensure the following. We denote the Borda score of a candidate from a set of votes W by sW(·). ⊲ sP′∪Q(y) = sP′∪Q(c) + m + m/3 + 3 ⊲ sP′∪Q(z1) = sP′∪Q(c) − 3⌊m/6⌋ − 2 ⊲ sP′∪Q(z2) = sP′∪Q(c) − 5⌊m/6⌋ − 3 ⊲ sP′∪Q(ui) = sP′∪Q(c) + m + 5 − i ∀i ∈ [m] ⊲ sP′∪Q(d) 6 sP′∪Q(c) − 5m We have only one manipulator who tries to make c winner. Now we show that the X3C instance (U, S) is a YES instance if and only if the OPPORTUNISTIC MANIPULATION instance (P ∪ Q, 1, c) is a NO instance. Notice that we can assume without loss of generality that the manipulator places c at the first position, d at the second position, the candidate ui at (m + 5 − i)th position for every i ∈ [m], and y at the last position, since otherwise c can never win uniquely irrespective of the extension of P (that it, the manipulator's vote looks like c ≻ d ≻ {z1, z2} ≻ um ≻ um−1 ≻ · · · ≻ u1 ≻ y). In the forward direction, let us now assume that the X3C instance is a YES instance. Suppose (by renaming) that S1, . . . , Sm/3 forms an exact set cover. Let the manipulator's vote v be c ≻ d ≻ z1 ≻ z2 ≻ um ≻ · · · ≻ u1 ≻ y. We now argue that v is not a c-optimal vote. The other case where the manipulator's vote v′ be c ≻ d ≻ z2 ≻ z1 ≻ um ≻ · · · ≻ u1 ≻ y can be argued similarly. We consider the following extension P of P. 1 6 i 6 ⌊m/6⌋, z2 ≻ y ≻ Si ≻ z1 ≻ (U \ Si) ≻ d ≻ c ⌈m/6⌉ 6 i 6 m/3, z1 ≻ y ≻ Si ≻ z2 ≻ (U \ Si) ≻ d ≻ c m/3 + 1 6 i 6 t, y ≻ Si ≻ z1 ≻ z2 ≻ (U \ Si) ≻ d ≻ c 191 We have the following Borda scores sP∪Q∪{v}(c) = sP∪Q∪{v}(y) + 1 = sP∪Q∪{v}(z2) + 6 = sP∪Q∪{v}(z1) = sP∪Q∪{v}(ui) + 1 ∀i ∈ [m]. Hence, c does not win uniquely for the votes P ∪ Q ∪ {v}. However, c is the unique winner for the votes P ∪ Q ∪ {v′}. Hence, there does not exist any c-optimal vote and the OPPORTUNISTIC MANIPULATION instance is a NO instance. In the reverse direction, we show that if the X3C instance is a NO instance, then there does not exist a vote v of the manipulator and an extension P of P such that c is the unique winner for the votes P ∪ Q ∪ {v′} thereby proving that the OPPORTUNISTIC MANIPULATION instance is vacuously YES (and thus every vote is c-optimal). Notice that the score of y must decrease by at least m/3 for c to win uniquely. However, in every vote v where the score of y decreases by at least one in any extension P of P, at least one of z1 or z2 must be placed at top position of the vote v. However, the candidates z1 and z2 can be placed at top positions of the votes in P at most m/3 many times while ensuring c does not lose the election. Also, even after manipulator places the candidate ui at (m + 5 − i)th position for every i ∈ [m], for c to win uniquely, the score of every ui must decrease by at least one. Hence, altogether, there will be exactly m/3 votes (denoted by the set P1) in any extension of P where y is placed at the second position. However, since the X3C instance is a NO instance, the Sis corresponding to the votes in P1 does not form a set cover. Let u ∈ U be an element not covered by the Sis corresponding to the votes in P1. Notice that the score of u does not decrease in the extension P and thus c does not win uniquely irrespective of the manipulator's vote. Thus every vote is c-optimal and thus the OPPORTUNISTIC MANIPULATION instance is a YES instance. Thus every vote is c-optimal and the OPPORTUNISTIC MANIPULATION instance is a YES instance. 8.2.3.4 Result for the Maximin Voting Rule For the maximin voting rule, we show intractability of OPPORTUNISTIC MANIPULATION with one manipulator even when the number of undetermined pairs in every vote is at most 8. Theorem 8.8. The OPPORTUNISTIC MANIPULATION problem is co-NP-hard for the maximin voting rule even when the number of manipulators is one and the number of undetermined pairs in every vote is no more than 8. Proof. We reduce X3C to OPPORTUNISTIC MANIPULATION for the maximin rule. Let (U = {u1, . . . , um}, S = {S1, S2, . . . , St}) is an X3C instance. We construct a corresponding OPPOR- TUNISTIC MANIPULATION instance for the maximin voting rule as follows. Candidate set C = U ∪ {c, z1, z2, z3, d, y} 192 For every i ∈ [t], we define P′i as follows: ∀i 6 t, Si ≻ x ≻ d ≻ y ≻ (U \ Si) ≻ z1 ≻ z2 ≻ z3 Using P′i, we define partial vote Pi = P′i \ ({({x}∪ Si)× {d, y}}) for every i ∈ [t]. We denote the set of partial votes {Pi : i ∈ [t]} by P and {P′i : i ∈ [t]} by P′. We note that the number of undetermined pairs in each partial vote Pi is 8. We define another partial vote p as follows. p = (z1 ≻ z2 ≻ z3 ≻ others ) \ {(z1, z2), (z2, z3), (z1, z3)} Using Lemma 7.2, we add a set Q of complete votes with Q = poly(m, t) to ensure the following pairwise margins (notice that the pairwise margins among z1, z2, and z3 does not include the partial vote p). ⊲ DP′∪Q∪{p}(d, c) = 4t + 1 ⊲ DP′∪Q∪{p}(x, d) = 4t + 2m/3 + 1 ⊲ DP′∪Q∪{p}(y, x) = 4t − 2m/3 + 1 ⊲ DP′∪Q∪{p}(d, uj) = 4t − 1 ∀uj ∈ U ⊲ DP′∪Q(z1, z2) = DP′∪Q(z2, z3) = DP′∪Q(z3, z1) = 4t + 2 ⊲ DP′∪Q∪{p}(a, b) 6 1 for every a, b ∈ C not defined above. We have only one manipulator who tries to make c winner. Now we show that the X3C instance (U, S) is a YES instance if and only if the OPPORTUNISTIC MANIPULATION instance (P ∪ Q ∪ {p}, 1, c) is a NO instance. Notice that we can assume without loss of generality that the manipulator's vote prefers c to every other candidate, y to x, x to d, and d to uj for every uj ∈ U. In the forward direction, let us now assume that the X3C instance is a YES instance. Sup- pose (by renaming) that S1, . . . , Sm/3 forms an exact set cover. Notice that the manipulator's vote must prefer either z2 to z1 or z1 to z3 or z3 to z2. We show that if the manipulator's vote v prefers z2 to z1, then v is not a c-optimal vote. The other two cases are symmetrical. Consider the following extension P of P and p of p. 1 6 i 6 m/3, d ≻ y ≻ Si ≻ x ≻ (U \ Si) ≻ z1 ≻ z2 ≻ z3 193 m/3 + 1 6 i 6 t, Si ≻ x ≻ d ≻ y ≻ (U \ Si) ≻ z1 ≻ z2 ≻ z3 p = z2 ≻ z3 ≻ z1 ≻ others From the votes in P ∪ Q ∪ {v, p}, the maximin score of c is −4t, of d, x, uj ∀uj ∈ U are −4t − 2, of z1, z3 are at most than −4t − 2, and of z2 is −4t. Hence, c is not the unique maximn winner. However, the manipulator's vote c ≻ z1 ≻ z2 ≻ z3 ≻ other makes c the unique maximin winner. Hence, v is not a c-optimal vote. For the reverse direction, we show that if the X3C instance is a NO instance, then there does not exist a vote v of the manipulator and an extension P of P such that c is the unique winner for the votes P ∪ Q ∪ {v′} thereby proving that the OPPORTUNISTIC MANIPULATION instance is vacuously YES (and thus every vote is c-optimal). Consider any extension P of P. Notice that, for c to win uniquely, y ≻ x must be at least m/3 of the votes in P; call these set of votes P1. However, d ≻ x in every vote in P1 and d ≻ x can be in at most m/3 votes in P for c to win uniquely. Hence, we have P1 = m/3. Also for c to win, each d ≻ uj must be at least one vote of P and d ≻ uj is possible only in the votes in P1. However, the sets Sis corresponding to the votes in P1 does not form a set cover since the X3C instance is a NO instance. Hence, there must exist a uj ∈ U for which uj ≻ d in every vote in P and thus c cannot win uniquely irrespective of the vote of the manipulator. Thus every vote is c-optimal and the OPPORTUNISTIC MANIPULATION instance is a YES instance. 8.2.3.5 Result for the Copelandα Voting Rule Our next result proves that the OPPORTUNISTIC MANIPULATION problem is co-NP-hard for the Copelandα voting rule too for every α ∈ [0, 1] even with one manipulator and at most 8 undetermined pairs per vote. Theorem 8.9. The OPPORTUNISTIC MANIPULATION problem is co-NP-hard for the Copelandα voting rule for every α ∈ [0, 1] even when the number of manipulators is one and the number of undetermined pairs in each vote is no more than 8. Proof. We reduce X3C to OPPORTUNISTIC MANIPULATION for the Copelandα voting rule. Let (U = {u1, . . . , um}, S = {S1, S2, . . . , St}) is an X3C instance. We construct a corresponding OPPORTUNISTIC MANIPULATION instance for the Copelandα voting rule as follows. Candidate set C = U ∪ {c, z1, z2, z3, d1, d2, d3, x, y} 194 For every i ∈ [t], we define P′i as follows: ∀i 6 t, Si ≻ x ≻ y ≻ c ≻ others Using P′i, we define partial vote Pi = P′i \ ({({x}∪ Si)× {c, y}}) for every i ∈ [t]. We denote the set of partial votes {Pi : i ∈ [t]} by P and {P′i : i ∈ [t]} by P′. We note that the number of undetermined pairs in each partial vote Pi is 8. We define another partial vote p as follows. p = (z1 ≻ z2 ≻ z3 ≻ others ) \ {(z1, z2), (z2, z3), (z1, z3)} Using Lemma 7.2, we add a set Q of complete votes with Q = poly(m, t) to ensure the following pairwise margins (notice that the pairwise margins among z1, z2, and z3 does not include the partial vote p). ⊲ DP′∪Q∪{p}(uj, c) = 2 ∀uj ∈ U ⊲ DP′∪Q∪{p}(x, y) = 2m/3 ⊲ DP′∪Q∪{p}(c, y) = DP′∪Q∪{p}(x, c) = DP′∪Q∪{p}(di, c) = DP′∪Q∪{p}(zk, c) = DP′∪Q∪{p}(uj, x) = DP′∪Q∪{p}(x, zk) = DP′∪Q∪{p}(di, x) = DP′∪Q∪{p}(y, uj) = DP′∪Q∪{p}(di, y) = DP′∪Q∪{p}(y, zk) = DP′∪Q∪{p}(zk, uj) = DP′∪Q∪{p}(uj, di) = DP′∪Q∪{p}(zk, d1) = DP′∪Q∪{p}(zk, d2) = DP′∪Q∪{p}(d3, zk) = 4t ∀i, k ∈ [3], j ∈ [m] ⊲ DP′∪Q∪{p}(uj, uℓ) = −4t for at least m/3 many uℓ ∈ U ⊲ DP′∪Q(z1, z2) = DP′∪Q(z2, z3) = DP′∪Q(z3, z1) = 1 ⊲ DP′∪Q∪{p}(a, b) 6 1 for every a, b ∈ C not defined above. We have only one manipulator who tries to make c winner. Now we show that the X3C instance (U, S) is a YES instance if and only if the OPPORTUNISTIC MANIPULATION instance (P∪ Q∪ {p}, 1, c) is a NO instance. Since the number of voters is odd, α does not play any role in the reduction and thus from here on we simply omit α. Notice that we can assume without loss of generality that the manipulator's vote prefers c to every other candidate and x to y. In the forward direction, let us now assume that the X3C instance is a YES instance. Suppose (by renaming) that S1, . . . , Sm/3 forms an exact set cover. Suppose the manipulator's vote v order z1, z2, and z3 as z1 ≻ z2 ≻ z3. We will show that v is not a c-optimal vote. 195 Symmetrically, we can show that the manipulator's vote ordering z1, z2, and z3 in any other order is not c-optimal. Consider the following extension P of P and p of p. 1 6 i 6 m/3, y ≻ c ≻ Si ≻ x ≻ others m/3 + 1 6 i 6 t, Si ≻ x ≻ y ≻ c ≻ others p = z1 ≻ z2 ≻ z3 ≻ others From the votes in P ∪ Q ∪ {v, p}, the Copeland score of c is m + 4 (defeating y, zk, uj ∀k ∈ [3], j ∈ [m]), of y is m+3 (defeating zk, uj ∀k ∈ [3], j ∈ [m]), of uj is at most 2m/3+4 (defeating x, di ∀i ∈ [3] and at most 2m/3 many uℓ ∈ U), of x is 5 (defeating c, y, zk ∀l ∈ [3]), of d1, d2 is 2 (defeating y and c), of d3 is 5 (defeating y, c, zk ∀k ∈ [3]). of z3 is m + 3 (defeating di, uj∀i ∈ [3], j ∈ [m]) for every k ∈ [3], of z3 is m + 2 (defeating d1, d2, uji ∈ [3], j ∈ [m]), z2 is m + 3 (defeating d1, d2, z3, uji ∈ [3], j ∈ [m]), z1 is m + 4 (defeating d1, d2, z2, z3, uji ∈ [3], j ∈ [m]). Hence, c co-wins with z1 with Copeland score m+4. However, the manipulator's vote c ≻ z3 ≻ z2 ≻ z1 makes c win uniquely. Hence, v is not a c-optimal vote and thus the OPPORTUNISTIC MANIPULATION instance is a NO instance. For the reverse direction, we show that if the X3C instance is a NO instance, then there does not exist a vote v of the manipulator and an extension P of P such that c is the unique winner for the votes P ∪ Q ∪ {v′} thereby proving that the OPPORTUNISTIC MANIPULATION instance is vacuously YES (and thus every vote is c-optimal). Consider any extension P of P. Notice that, for c to win uniquely, c must defeat each uj ∈ U and thus c is preferred over uj in at least one vote in P; we call these votes P1. However, in every vote in P1, y is preferred over x and thus P1 6 m/3 because x must defeat y for c to win uniquely. Since the X3C instance is a NO instance, there must be a candidate u ∈ U which is not covered by the sets corresponding to the votes in P1 and thus u is preferred over c in every vote in P. Hence, c cannot win uniquely irrespective of the vote of the manipulator. Thus every vote is c-optimal and the OPPORTUNISTIC MANIPULATION instance is a YES instance. 8.2.3.6 Result for the Bucklin Voting Rule For the Bucklin and simplified Bucklin voting rules, we show intractability of the OPPOR- TUNISTIC MANIPULATION problem with at most 15 undetermined pairs per vote and only one manipulator. 196 Theorem 8.10. The OPPORTUNISTIC MANIPULATION problem is co-NP-hard for the Bucklin and simplified Bucklin voting rules even when the number of manipulators is one and the number of undetermined pairs in each vote is no more than 15. Proof. We reduce X3C to OPPORTUNISTIC MANIPULATION for the Bucklin and simplified Buck- lin voting rules. Let (U = {u1, . . . , um}, S = {S1, S2, . . . , St}) is an X3C instance. We assume without loss of generality that m is not divisible by 6 (if not, we introduce three elements in U and a set containing them in S) and t is an even integer (if not, we duplicate any set in S). We construct a corresponding OPPORTUNISTIC MANIPULATION instance for the Bucklin and simplified Bucklin voting rules as follows. Candidate set C = U ∪ {c, z1, z2, x1, x2, d} ∪ W, where W = m − 3 For every i ∈ [t], we define P′i as follows: ∀i 6 t, (U \ Si) ≻ Si ≻ d ≻ x1 ≻ x2 ≻ z1 ≻ z2 ≻ others Using P′i, we define partial vote Pi = P′i \ ({({d}∪ Si)× {x1, x2, z1, z2}}∪ {(z1, z2)}) for every i ∈ [t]. We denote the set of partial votes {Pi : i ∈ [t]} by P and {P′i : i ∈ [t]} by P′. We note that the number of undetermined pairs in each partial vote Pi is 15. We introduce the following additional complete votes Q: ⊲ t/2 − ⌊m/6⌋ − 1 copies of W ≻ z1 ≻ z2 ≻ x1 ≻ c ≻ others ⊲ t/2 − ⌊m/6⌋ − 1 copies of W ≻ z1 ≻ z2 ≻ x2 ≻ c ≻ others ⊲ 2⌈m/6⌉ copies of W ≻ z1 ≻ z2 ≻ d ≻ c ≻ others ⊲ ⌊m/6⌋ copies of W ≻ z1 ≻ d ≻ x1 ≻ c ≻ others ⊲ ⌊m/6⌋ copies of W ≻ z1 ≻ d ≻ x2 ≻ c ≻ others ⊲ 2⌈m/6⌉ − 1 copies of U ≻ x1 ≻ others ⊲ One U ≻ c ≻ others We have only one manipulator who tries to make c winner. Now we show that the X3C instance (U, S) is a YES instance if and only if the OPPORTUNISTIC MANIPULATION instance (P∪Q, 1, c) is a NO instance. The total number of voters in the OPPORTUNISTIC MANIPULATION 197 instance is 2t + 2m/3 + 1. We notice that within top m + 1 positions of the votes in P′ ∪ Q, c appears t + m/3 times, z1 and z2 appear t + ⌊m/6⌋ times, x1 appears t/2 + m/3 − 1 times, x2 appears t/2 − 1 times, every candidate in W appears t + m/3 − 1 times, every candidate in U appears t + m/3 + 1 times. Also every candidate in U appears t + m/3 + 1 times within top m positions of the votes in P ∪ Q. Hence, for both Bucklin and simplified Bucklin voting rules, we can assume without loss of generality that the manipulator puts c, every candidate in W, x1, x2, and exactly one of z1 and z2. In the forward direction, let us now assume that the X3C instance is a YES instance. Suppose (by renaming) that S1, . . . , Sm/3 forms an exact set cover. Suppose the manipulator's vote v puts c, every candidate in W, x1, x2, and z1 within top m + 1 positions. We will show that v is not c-optimal. The other case where the manipulator's vote v′ puts c, every candidate in W, x1, x2, and z2 within top m + 1 positions is symmetrical. Consider the following extension P of P: 1 6 i 6 ⌊m/6⌋, (U \ Si)d ≻ x1 ≻ x2 ≻ z2 ≻ Si ≻≻ z1 ≻ others ⌈m/6⌉ 6 i 6 m/3, (U \ Si)d ≻ x1 ≻ x2 ≻ z1 ≻ Si ≻≻ z2 ≻ others m/3 + 1 6 i 6 t, (U \ Si) ≻ Si ≻ d ≻ x1 ≻ x2 ≻ z1 ≻ z2 ≻ others For both Bucklin and simplified Bucklin voting rules, c co-wins with z1 for the votes in P ∪ Q ∪ {v}. However, c wins uniquely for the votes in P ∪ Q ∪ {v′}. Hence, v is not a c-optimal vote and thus the OPPORTUNISTIC MANIPULATION instance is a NO instance. For the reverse direction, we show that if the X3C instance is a NO instance, then there does not exist a vote v of the manipulator and an extension P of P such that c is the unique winner for the votes P ∪ Q ∪ {v′} thereby proving that the OPPORTUNISTIC MANIPULATION instance is vacuously YES (and thus every vote is c-optimal). Consider any extension P of P. Notice that, for c to win uniquely, every candidate must be pushed out of top m + 1 positions in at least one vote in P; we call these set of votes P1. Notice that, P1 > m/3. However, in every vote in P1, at least one of z1 and z2 appears within top m + 1 many positions. Since, the manipulator has to put at least one of z1 and z2 within its top m + 1 positions and z1 and z2 appear t + ⌊m/6⌋ times in the votes in P′ ∪ Q, we must have P1 6 m/3 and thus P1 = m/3, for c to win uniquely. However, there exists a candidate u ∈ U not covered by the Sis corresponding to the votes in P1. Notice that u gets majority within top m positions of the votes and c can never get majority within top m + 1 positions of the votes. Hence, c 198 cannot win uniquely irrespective of the vote of the manipulator. Thus every vote is c-optimal and the OPPORTUNISTIC MANIPULATION instance is a YES instance. 8.3 Polynomial Time Algorithms for WEAK MANIPULATION, STRONG MANIPULATION, and OPPORTUNISTIC MANIPULA- TION Problems We now turn to the polynomial time cases depicted in Table 8.1. This section is organized in three parts, one for each problem considered. 8.3.1 Weak Manipulation Problem Since the POSSIBLE WINNER problem is in P for the plurality and the veto voting rules [BD09], it follows from Observation 8.1 that the WEAK MANIPULATION problem is in P for the plurality and veto voting rules for any number of manipulators. Proposition 8.1. The WEAK MANIPULATION problem is in P for the plurality and veto voting rules for any number of manipulators. Proof. The POSSIBLE WINNER problem is in P for the plurality and the veto voting rules [BD09]. Hence, the result follows from Observation 8.1. 8.3.2 Strong Manipulation Problem We now discuss our algorithms for the STRONG MANIPULATION problem. The common flavor in all our algorithms is the following: we try to devise an extension that is as adversarial as possible for the favorite candidate c, and if we can make c win in such an extension, then roughly speaking, such a strategy should work for other extensions as well (where the situation only improves for c). However, it is challenging to come up with an extension that is globally dominant over all the others in the sense that we just described. So what we do instead is we consider every potential nemesis w who might win instead of c, and we build profiles that are "as good as possible" for w and "as bad as possible" for c. Each such profile leads us to constraints on how much the manipulators can afford to favor w (in terms of which positions among the manipulative votes are safe for w). We then typically show that 199 we can determine whether there exists a set of votes that respects these constraints, either by using a greedy strategy or by an appropriate reduction to a flow problem. We note that the overall spirit here is similar to the approaches commonly used for solving the NECESSARY WINNER problem, but as we will see, there are non-trivial differences in the details. We begin with the k-approval and k-veto voting rules. Theorem 8.11. The STRONG MANIPULATION problem is in P for the k-approval and k-veto voting rules, for any k and any number of manipulators. Proof. For the time being, we just concentrate on non-manipulators' votes. For each candidate NM (c, c′) = sNM(c′) − sNM(c) from c′ ∈ C \ {c}, calculate the maximum possible value of smax non-manipulators' votes, where sNM(a) is the score that candidate a receives from the votes of the non-manipulators. This can be done by checking all possible O(m2) pairs of positions for c and c′ in each vote v and choosing the one which maximizes sv(c′) − sv(c) from that vote. We now fix the position of c at the top position for the manipulators' votes and we check if it is possible to place other candidates in the manipulators' votes such that the final NM (c, c′) + sM(c′) − sM(c) is negative which can be solved easily by reducing it to value of smax the max flow problem which is polynomial time solvable. We now prove that the STRONG MANIPULATION problem for scoring rules is in P for one manipulator. Theorem 8.12. The STRONG MANIPULATION problem is in P for any scoring rule when we have only one manipulator. NM (c, c′) using same technique described in Proof. For each candidate c′ ∈ C \ {c}, calculate smax the proof of Theorem 8.11. We now put c at the top position of the manipulator's vote. For each candidate c′ ∈ C \ {c}, c′ can be placed at positions i ∈ {2, . . . , m} in the manipulator's NM (c, c′) + αi − α1 negative. Using this, construct a bipartite graph with vote which makes smax C \ {c} on left and {2, . . . , m} on right and there is an edge between c′ and i iff the candidate c′ can be placed at i in the manipulator's vote according to the above criteria. Now solve the problem by finding existence of perfect matching in this graph. Our next result proves that the STRONG MANIPULATION problem for the Bucklin, simplified Bucklin, fallback, and simplified fallback voting rules are in P. Theorem 8.13. The STRONG MANIPULATION problem is in P for the Bucklin, simplified Bucklin, fallback, and simplified fallback voting rules, for any number of manipulators. 200 Proof. Let (C, P, M, c) be an instance of STRONG MANIPULATION for simplified Bucklin, and let m denote the total number of candidates in this instance. Recall that the manipulators have to cast their votes so as to ensure that the candidate c wins in every possible extension of P. We use Q to denote the set of manipulating votes that we will construct. To begin with, without loss of generality, the manipulators place c in the top position of all their votes. We now have to organize the positioning of the remaining candidates across the votes of the manipulators to ensure that c is a necessary winner of the profile (P, Q). To this end, we would like to develop a system of constraints indicating the overall number of times that we are free to place a candidate w ∈ C \ {c} among the top ℓ positions in the profile Q. In particular, let us fix w ∈ C \ {c} and 2 6 ℓ 6 m. Let ηw,ℓ be the maximum number of votes of Q in which w can appear in the top ℓ positions. Our first step is to compute necessary conditions for ηw,ℓ. We use Pw,ℓ to denote a set of complete votes that we will construct based on the given partial votes. Intuitively, these votes will represent the "worst" possible extensions from the point of view of c when pitted against w. These votes are engineered to ensure that the manipulators can make c win the elections Pw,ℓ for all w ∈ C \ {c} and ℓ ∈ {2, . . . , m}, if, and only if, they can strongly manipulate in favor of c. More formally, there exists a voting profile Q of the manipulators so that c wins the election Pw,ℓ∪ Q, for all w ∈ C \ {c} and ℓ ∈ {2, . . . , m} if and only if c wins in every extension of the profile P ∪ Q. We now describe the profile Pw,ℓ. The construction is based on the following case analysis, where our goal is to ensure that, to the extent possible, we position c out of the top ℓ − 1 positions, and incorporate w among the top ℓ positions. ⊲ Let v ∈ P be such that either c and w are incomparable or w ≻ c. We add the complete vote v′ to Pw,ℓ, where v′ is obtained from v by placing w at the highest possible position and c at the lowest possible position, and extending the remaining vote arbitrarily. ⊲ Let v ∈ P be such that c ≻ w, but there are at least ℓ candidates that are preferred over w in v. We add the complete vote v′ to Pw,ℓ, where v′ is obtained from v by placing c at the lowest possible position, and extending the remaining vote arbitrarily. ⊲ Let v ∈ P be such that c is forced to be within the top ℓ − 1 positions, then we add the complete vote v′ to Pw,ℓ, where v′ is obtained from v by first placing w at the highest possible position followed by placing c at the lowest possible position, and extending the remaining vote arbitrarily. 201 ⊲ In the remaining votes, notice that whenever w is in the top ℓ positions, c is also in the top ℓ − 1 positions. Let P∗w,ℓ denote this set of votes, and let t be the number of votes in P∗w,ℓ. We now consider two cases. Let dℓ(c) be the number of times c is placed in the top ℓ − 1 positions in the profile Pw,ℓ ∪ Q, and let dℓ(w) be the number of times w is placed in the top ℓ positions in the profile Pw,ℓ. Let us now formulate the requirement that in Pw,ℓ ∪ Q, the candidate c does not have a majority in the top ℓ − 1 positions and w does have a majority in the top ℓ positions. Note that if this requirement holds for any w and ℓ, then strong manipulation is not possible. Therefore, to strongly manipulate in favor of c, we must ensure that for every choice of w and ℓ, we are able to negate the conditions that we derive. The first condition from above simply translates to dℓ(c) 6 n/2. The second condition amounts to requiring first, that there are at least n/2 votes where w appears in the top ℓ positions, that is, dℓ(w) + ηw,ℓ + t > n/2. Further, note that the gap between dℓ(w) + ηw,ℓ and majority will be filled by using votes from P∗w,ℓ to "push" w forward. However, these votes contribute equally to w and c being in the top ℓ and ℓ − 1 positions, respectively. Therefore, the difference between dℓ(w) + ηw,ℓ and n/2 must be less than the difference between dℓ(c) and n/2. Summarizing, the following conditions, which we collectively denote by (⋆), are sufficient to defeat c in some extension: dℓ(c) 6 n/2, dℓ(w)+ηw,ℓ+t > n/2, n/2−dℓ(w)+ηw,ℓ < n/2 − dℓ(c). From the manipulator's point of view, the above provides a set of constraints to be sat- isfied as they place the remaining candidates across their votes. Whenever dℓ(c) > n/2, the manipulators place any of the other candidates among the top ℓ positions freely, because c already has majority. On the other hand, if dℓ(c) 6 n/2, then the manipulators must respect at least one of the following constraints: ηw,ℓ 6 n/2 − t − dℓ(w) and ηw,ℓ 6 dℓ(c) − dℓ(w). Extending the votes of the manipulator while respecting these constraints (or concluding that this is impossible to do) can be achieved by a natural greedy strategy - construct the manipulators' votes by moving positionally from left to right. For each position, consider each manipulator and populate her vote for that position with any available candidate. We output the profile if the process terminates by completing all the votes, otherwise, we say NO. We now argue the proof of correctness. Suppose the algorithm returns NO. This implies that there exists a choice of w ∈ C \ {c} and ℓ ∈ {2, . . . , m} such that for any voting profile Q of the manipulators, the conditions in (⋆) are satisfied. (Indeed, if there exists a voting profile that violated at least one of these conditions, then the greedy algorithm would have 202 discovered it.) Therefore, no matter how the manipulators cast their vote, there exists an extension where c is defeated. In particular, for the votes in P \ P∗w,ℓ, this extension is given by Pw,ℓ. Further, we choose n/2 − ηw,ℓ − dℓ(w) votes among the votes in P∗w,ℓ and extend them by placing w in the top ℓ positions (and extending the rest of the profile arbitrary). We extend the remaining votes in P∗w,ℓ by positioning w outside the top ℓ positions. Clearly, in this extension, c fails to achieve majority in the top ℓ − 1 positions while w does achieve majority in the top ℓ positions. On the other hand, if the algorithm returns YES, then consider the voting profile of the manipulators. We claim that c wins in every extension of P∪ Q. Suppose, to the contrary, that there exists an extension R and a candidate w such that the simplified Bucklin score of c is no more than the simplified Bucklin score of w in R. In this extension, therefore, there exists ℓ ∈ {2, . . . , m} for which w attains majority in the top ℓ positions and c fails to attain majority in the top ℓ − 1 positions. However, note that this is already impossible in any extension of the profile Pw,l ∪ P∗w,ℓ, because of the design of the constraints. By construction, the number of votes in which c appears in the top ℓ − 1 positions in R is only greater than the number of times c appears in the top ℓ − 1 positions in any extension of Pw,l ∪ P∗w,ℓ (and similarly for w). This leads us to the desired contradiction. For the Bucklin voting rule, we do the following modifications to the algorithm. If dℓ(c) > dℓ(w) for some w ∈ C \ {c} and ℓ < m, then we make ηw,ℓ = ∞. The proof of correctness for the Bucklin voting rule is similar to the proof of correctness for the simplified Bucklin voting rule above. For Fallback and simplified Fallback voting rules, we consider the number of candidates each voter approves while computing ηw,ℓ. We output YES if and only if ηw,ℓ > 0 for every w ∈ C \ {c} and every ℓ 6 m, since we can assume, without loss of generality, that the manipulator approves the candidate c only. Again the proof of correctness is along similar lines to the proof of correctness for the simplified Bucklin voting rule. We next show that the STRONG MANIPULATION problem for the maximin voting rule is polynomial-time solvable when we have only one manipulator. Theorem 8.14. The STRONG MANIPULATION problem for the maximin voting rules are in P, when we have only one manipulator. Proof. For the time being, just concentrate on non-manipulators' votes. Using the algorithm for NW for maximin in [XC11], we compute for all pairs w, w′ ∈ C, N(w,w′)(w, d) and 203 N(w,w′)(c, w′) for all d ∈ C \ {c}. This can be computed in polynomial time. Now we place c at the top position in the manipulator's vote and increase all N(w,w′)(c, w′) by one. Now we place a candidate w at the second position if for all w′ ∈ C, N′(w,w′)(w, d) < N(w,w′)(c, w′) for all d ∈ C \ {c}, where N′(w,w′)(w, d) = N(w,w′)(w, d) of the candidate d has already been assigned some position in the manipulator's vote, and N′(w,w′)(w, d) = N(w,w′)(w, d) + 1 else. The correctness argument is in the similar lines of the classical greedy manipulation algorithm of [BTT89]. 8.3.3 Opportunistic Manipulation Problem For the plurality, fallback, and simplified fallback voting rules, it turns out that the voting profile where all the manipulators approve only c is a c-opportunistic voting profile, and therefore it is easy to devise a manipulative vote. Observation 8.4. The OPPORTUNISTIC MANIPULATION problem is in P for the plurality and fallback voting rules for a any number of manipulators. For the veto voting rule, however, a more intricate argument is needed, that requires building a system of constraints and a reduction to a suitable instance of the maximum flow problem in a network, to show polynomial time tractability of OPPORTUNISTIC MANIPULA- TION. Theorem 8.15. The OPPORTUNISTIC MANIPULATION problem is in P for the veto voting rule for a constant number of manipulators. Proof. Let (P, ℓ, c) be an input instance of OPPORTUNISTIC MANIPULATION. We may assume without loss of generality that the manipulators approve c. We view the voting profile of the manipulators as a tuple (na)a∈C\{c} ∈ (N∪ {0})m−1 with Pa∈C\{c} na = ℓ, where the na many manipulators disapprove a. We denote the set of such tuples as T and we have T = O((2m)ℓ) which is polynomial in m since ℓ is a constant. A tuple (na)a∈C\{c} ∈ T is not c-optimal if there exists another tuple (n′a)a∈C\{c} ∈ T and an extension P of P with the following properties. We denote the veto score of a candidate from P by s(·). For every candidate a ∈ C \ {c}, we define two quantities w(a) and d(a) as follows. ⊲ s(c) > s(a) for every a ∈ C\{c} with na = n′a = 0 and we define w(a) = s(c)−1, d(a) = 0 204 ⊲ s(c) > s(a) − n′a for every a ∈ C \ {c} with na > n′a and we define w(a) = s(c) − n′a − 1, d(a) = 0 ⊲ s(a) − na > s(c) > s(a) − n′a for every a ∈ C \ {c} with na < n′a and we define w(a) = s(c) − n′a, d(a) = s(a) − na We guess the value of s(c). Given a value of s(c), we check the above two conditions by reducing this to a max flow problem instance as follows. We have a source vertex s and a sink t. We have a vertex for every a ∈ C (call this set of vertices Y) and a vertex for every vote v ∈ P (call this set of vertices X). We add an edge from s to each in X of capacity one. We add an edge of capacity one from a vertex x ∈ X to a vertex y ∈ Y if the candidate corresponding to the vertex y can be placed at the last position in an extension of the partial vote corresponding to the vertex x. We add an edge from a vertex y to t of capacity w(a), where a is the voter corresponding to the vertex y. We also set the demand of every vertex y d(a) (that is the total amount of flow coming into vertex y must be at least d(a)), where a is the voter corresponding to the vertex y. Clearly, the above three conditions are met if and only if there is a feasible P amount of flow in the above flow graph. Since s(c) can have only P + 1 possible values (from 0 to P) and T = O((2m)ℓ), we can iterate over all possible pairs of tuples in T and all possible values of s(c) and find a c-optimal voting profile if there exists a one. 8.4 Conclusion We revisited many settings where the complexity barrier for manipulation was non-existent, and studied the problem under an incomplete information setting. Our results present a fresh perspective on the use of computational complexity as a barrier to manipulation, particularly in cases that were thought to be dead-ends (because the traditional manipulation problem was polynomially solvable). To resurrect the argument of computational hardness, we have to relax the model of complete information, but we propose that the incomplete informa- tion setting is more realistic, and many of our hardness results work even with very limited amount of incompleteness in information. In the next chapter, we will see how possible instances of manipulation can be detected for various voting rules. 205 Chapter 9 Manipulation Detection Manipulation is a problem of fundamental importance in voting theory in which the voters exercise their votes strategically instead of voting honestly to make an alternative that is more preferred to her, win the election. The classical Gibbard-Satterthwaite theo- rem shows that there is no strategy-proof voting rule that simultaneously satisfies certain combination of desirable properties. Researchers have attempted to get around the im- possibility result in several ways such as domain restriction and computational hardness of manipulation. However, these approaches are known to have fundamental limitations. Since prevention of manipulation seems to be elusive even after substantial research ef- fort, an interesting research direction therefore is detection of manipulation. Motivated by this, we initiate the study of detecting possible instances of manipulation in elections. We formulate two pertinent computational problems in the context of manipulation detection - Coalitional Possible Manipulators (CPM) and Coalitional Possible Manipulators given Winner (CPMW), where a suspect group of voters is provided as input and we have to find whether they can be a potential coalition of manipulators. In the absence of any suspect group, we formulate two more computational problems namely Coalitional Possible Manipulators Search (CPMS) and Coalitional Possible Manipulators Search given Winner (CPMSW). We provide polynomial time algorithms for these problems, for several popular voting rules. For a few other voting rules, we show that these problems are A preliminary version of the work in this chapter was published as [DMN15a]: Palash Dey, Neeldhara Misra, and Y. Narahari. Detecting possible manipulators in elections. In Proc. 2015 International Conference on Autonomous Agents and Multiagent Systems, AAMAS 2015, Istanbul, Turkey, May 4-8, 2015, pages 1441-1450, 2015. 206 NP-complete. We observe that detecting possible instances of manipulation may be easy even when the actual manipulation problem is computationally intractable, as seen for example, in the case of the Borda voting rule. 9.1 Introduction A basic problem with voting rules is that the voters may vote strategically instead of voting honestly, leading to the selection of a candidate which is not the actual winner. We call a candidate actual winner if it wins the election when every voter votes truthfully. This phenomenon of strategic voting is called manipulation in the context of voting. The Gibbard- Satterthwaite (G-S) theorem [Gib73, Sat75] proves that manipulation is unavoidable for any unanimous and non-dictatorial voting rule if we have at least three candidates. A voting rule is called unanimous if whenever any candidate is most preferred by all the voters, such a candidate is the winner. A voting rule is called non-dictatorial if there does not exist any voter whose most preferred candidate is always the winner irrespective of the votes of other voters. The problem of manipulation is particularly relevant for multiagent systems since agents have computational power to determine strategic votes. There have been several attempts to bypass the impossibility result of the G-S theorem. Economists have proposed domain restriction as a way out of the impossibility impli- cations of the G-S theorem. The G-S theorem assumes all possible preference profiles as the domain of voting rules. In a restricted domain, it has been shown that we can have voting rules that are not vulnerable to manipulation. A prominent restricted domain is the domain of single peaked preferences, in which the median voting rule provides a sat- isfactory solution [MCWG95]. To know more about other domain restrictions, we refer to [MCWG95, Gae01]. This approach of restricting the domain, however, suffers from the re- quirement that the social planner needs to know the domain of preference profiles of the voters, which is often impractical. 9.1.1 Related Work Researchers in computational social choice theory have proposed invoking computational intractability of manipulation as a possible work around for the G-S theorem. Bartholdi et al. [BO91, BTT89] first proposed the idea of using computational hardness as a barrier 207 against manipulation. Bartholdi et al. defined and studied the computational problem called manipulation where a set of manipulators have to compute their votes that make their pre- ferred candidate win the election. The manipulators know the votes of the truthful voters and the voting rule that will be used to compute the winner. Following this, a large body of re- search [NWX11, DKNW11, XZP+09, XCP10, CSL07, OEH11, EL05, FHH13, NW13, GKNW13, OE12, FHH10, ZLR11, DN14, FRRS14, EE12] shows that the manipulation problem is NP- complete for many voting rules. However, Procaccia et al. [PR06, PR07] showed average case easiness of manipulation assuming junta distribution over the voting profiles. Friedgut et al. [FKN08] showed that any neutral voting rule which is sufficiently far from being dic- tatorial is manipulable with non-negligible probability at any uniformly random preference profile by a uniformly random preference. The above result holds for elections with three candidates only. A voting rule is called neutral if the names of the candidates are immaterial. Isaksson et al. [IKM12] generalize the above result to any number of candidates which has been further generalized to all voting rules which may not be neutral by Mossel and Racz in [MR15]. Walsh [Wal10] empirically shows ease of manipulating an STV (single transfer- able vote) election – one of the very few voting rules where manipulation, even by one voter, is NP-complete [BO91]. In addition to the results mentioned above, there exist many other results in the literature that emphasize the weakness of considering computational complexity as a barrier against manipulation [CS06, XC08b, XC08a, FP10, Wal11a]. Hence, the barrier of computational hardness is ineffective against manipulation in many settings. 9.1.2 Motivation In a situation where multiple attempts for prevention of manipulation fail to provide a fully satisfactory solution, detection of manipulation is a natural next step of research. There have been scenarios where establishing the occurrence of manipulation is straightforward, by ob- servation or hindsight. For example, in sport, there have been occasions where the very struc- ture of the rules of the game have encouraged teams to deliberately lose their matches. Ob- serving such occurrences in, for example, football (the 1982 FIFA World Cup football match played between West Germany and Austria) and badminton (the quarter-final match between South Korea and China in the London 2012 Olympics), the relevant authorities have subse- quently either changed the rules of the game (as with football) or disqualified the teams in question (as with the badminton example). The importance of detecting manipulation lies in the potential for implementing corrective measures in the future. For reasons that will be 208 evident soon, it is not easy to formally define the notion of manipulation detection. Assume that we have the votes from an election that has already happened. A voter is potentially a manipulator if there exists a preference ≻, different from the voter's reported preference, which is such that the voter had an "incentive to deviate" from the ≻. Specifically, suppose the candidate who wins with respect to this voter's reported preference is preferred (in ≻) over the candidate who wins with respect to ≻. In such a situation, ≻ could potentially be the voter's truthful preference, and the voter could be refraining from being truthful because an untruthful vote leads to a more favorable outcome with respect to ≻. Note that we do not (and indeed, cannot) conclusively suggest that a particular voter has manipulated an elec- tion. This is because the said voter can always claim that she voted truthfully; since her actual preference is only known to her, there is no way to prove or disprove such a claim. Therefore, we are inevitably limited to asking only whether or not a voter has possibly manipulated an election. Despite this technical caveat, it is clear that efficient detection of manipulation, even if it is only possible manipulation, is potentially of interest in practice. We believe that, the information whether a certain group of voters have possibly manipulated an election or not would be useful to social planners. For example, the organizers of an event, say London 2012 Olympics, may be interested to have this information. Also, in settings where data from many past elections (roughly over a fixed set of voters) is readily available, it is con- ceivable that possible manipulation could serve as suggestive evidence of real manipulation. Aggregate data about possible manipulations, although formally inconclusive, could serve as an important evidence of real manipulation, especially in situations where the instances of possible manipulation turn out to be statistically significant. Thus, efficient detection of pos- sible manipulation would provide an useful input to a social planner for future elections. We remark that having a rich history is typically not a problem, particularly for AI related appli- cations, since the data generated from an election is normally kept for future requirements (for instance, for data mining or learning). For example, several past affirmatives for possible manipulation is one possible way of formalizing the notion of erratic past behavior. Also, applications where benefit of doubt may be important, for example, elections in judiciary systems, possible manipulation detection may be useful. Thus the computational problem of detecting possible manipulation is of definite interest in many settings. 209 9.1.3 Our Contribution The novelty of this work is in initiating research on detection of possible manipulators in elec- tions. We formulate four pertinent computational problems in this context: ⊲ CPM: In the coalitional possible manipulators problem, we are interested in whether or not a given subset of voters is a possible coalition of manipulators [Definition 9.4]. ⊲ CPMW: The coalitional possible manipulators given winner is the CPM problem with the additional information about who the winner would have been if the possible manipu- lators had all voted truthfully [Definition 9.2]. ⊲ CPMS, CPMSW: In CPMS (Coalitional Possible Manipulators Search), we want to know, whether there exists any coalition of possible manipulators of a size at most k [Defini- tion 9.6]. Similarly, we define CPMSW (Coalitional Possible Manipulators Search given Winner) [Definition 9.5]. Our specific findings are as follows. ⊲ We show that all the four problems above, for scoring rules and the maximin voting rule, are in P when the coalition size is one [Theorem 9.1 and 9.4]. ⊲ We prove that all the four problems, for any coalition size, are in P for a wide class of scoring rules which include the Borda voting rule [Theorem 9.2, Theorem 9.3 and Corollary 9.1]. ⊲ We show that, for the Bucklin voting rule [Theorem 9.6], both the CPM and CPMW problems are in P, for any coalition size. The CPMS and CPMSW problems for the Bucklin voting rule are also in P, when we have maximum possible coalition size k = O(1). ⊲ We show that both the CPM and the CPMW problems are NP-complete for the STV voting rule [Theorem 9.7 and Corollary 9.2], even for a coalition of size one. We also prove that the CPMW problem is NP-complete for maximin voting rule [Theorem 9.5], for a coalition of size two. We observe that all the four problems are computationally easy for many voting rules that we study in this work. This can be taken as a positive result. The results for the CPM and the CPMW problems are summarized in Table 9.1. 210 Voting Rule CPM, k = 1 CPM CPMW, k = 1 CPMW Scoring Rules Borda k-approval Maximin Bucklin P P P P P ? P P ? P P P P P P ? P P NP-complete P STV NP-complete NP-complete NP-complete NP-complete Table 9.1: Results for CPM and CPMW (k denotes coalition size). The '?' mark means that the problem is open. 9.2 Problem Formulation Consider an election that has already happened in which all the votes are known and thus the winner x ∈ C is also known. We call the candidate x the current winner of the election. The authority may suspect that the voters belonging to a subset M ⊂ V of the set of voters have formed a coalition among themselves and manipulated the election by voting non-truthfully. The authority believes that other voters who do not belong to M, have voted truthfully. We denote M, the size of the coalition, by k. Suppose the authority has auxiliary information, may be from some other sources, which says that the actual winner should have been some candidate y ∈ C other than x. We call a candidate actual winner if it wins the election where all the voters vote truthfully. This means that the authority thinks that, had the voters in M voted truthfully, the candidate y would have been the winner. We remark that there are practical situations, for example, 1982 FIFA World cup or 2012 London Olympics, where the authority knows the actual winner. This situation is formalized below. Definition 9.1. Let r be a voting rule, and (≻i)i∈V be a voting profile of a set V of n voters. Let x be the winning candidate with respect to r for this profile. For a candidate y 6= x, M ⊂ V is called a coalition of possible manipulators against y with respect to r if there exists a M-voters' profile (≻′j)j∈M ∈ L(C)M such that x ≻′j y, ∀j ∈ M, and further, r((≻j)j∈V\M, (≻′i)i∈M) = y. Using the notion of coalition of possible manipulators, we formulate a computational problem called Coalitional Possible Manipulators given Winner (CPMW) as follows. Let r be any voting rule. Definition 9.2. (r–CPMW Problem) Given a preference profile (≻i)i∈V of a set of voters V over a set of candidates C, a subset of voters 211 M ⊂ V, and a candidate y, determine if M is a coalition of possible manipulators against y with respect to r. In the CPMW problem, the actual winner is given in the input. However, it may very well happen that the authority does not have any other information to guess the actual winner – the candidate who would have won the election had the voters in M voted truthfully. In this situation, the authority is interested in knowing whether there is a M-voter profile which along with the votes in V \ M makes some candidate y ∈ C the winner who is different from the current winner x ∈ C and all the preferences in the M-voters' profile prefer x to y. If such a M-voter profile exists for the subset of voters M, then we call M a coalition of possible manipulators and the corresponding computational problem is called Coalitional Possible Manipulators (CPM). These notions are formalized below. Definition 9.3. Let r be a voting rule, and (≻i)i∈V be a voting profile of a set V of n voters. A subset of voters M ⊂ V is called a coalition of possible manipulators with respect to r if M is a coalition of possible manipulators against some candidate y with respect to r. Definition 9.4. (r–CPM Problem) Given a preference profile (≻i)i∈V of a set of voters V over a set of candidates C, and a subset of voters M ⊂ V, determine if M is a coalition of possible manipulators with respect to r. In both the CPMW and CPM problems, a subset of voters which the authority suspect to be a coalition of manipulators, is given in the input. However, there can be situations where there is no specific subset of voters to suspect. In those scenarios, it may still be useful to know, what are the possible coalition of manipulators of size less than some number k. Towards that end, we extend the CPMW and CPM problems to search for a coalition of potential possible manipulators and call them Coalitional Possible Manipulators Search given Winner (CPMSW) and Coalitional Possible Manipulators Search (CPMS) respective. Definition 9.5. (r–CPMSW Problem) Given a preference profile (≻i)i∈V of a set of voters V over a set of candidates C, a candidate y, and an integer k, determine whether there exists any M ⊂ V with M 6 k such that M is a coalition of possible manipulators against y. Definition 9.6. (r–CPMS Problem) Given a preference profile (≻i)i∈V of a set of voters V over a set of candidates C, and an integer k, determine whether there exists any M ⊂ V with M 6 k such that M is a coalition of possible manipulators. 212 9.2.1 Discussion The CPMW problem may look very similar to the manipulation problem [BTT89, CSL07] – in both the problems a set of voters try to make a candidate winner. However, in the CPMW problem, the actual winner must be less preferred to the current winner in every manipula- tor's vote. Although it may look like a subtle difference, it changes the nature and complexity theoretic behavior of the problem completely. For example, we show that all the four prob- lems have an efficient algorithm for a large class of voting rules that includes the Borda voting rule, for any coalition size. However, the manipulation problem for the Borda voting rule is NP-complete, even when we have at least two manipulators [DKNW11, BNW11]. Another important difference is that the manipulation problem, in contrast to the problems studied in this work, does not take care of manipulators' preferences. We believe that there does not exist any formal reduction between the CPMW problem and the manipulation problem. On the other hand, the CPMS problem is similar to the margin of victory problem de- fined by Xia [Xia12], where also we are looking for changing the current winner by changing at most some k number of votes, which in turn identical to the destructive bribery prob- lem [FHH09]. Whereas, in the CPMS problem, the vote changes can occur in a restricted fashion. An important difference between the two problems is that the margin of victory problem has the hereditary property which the CPMS problem does not possess (there is no coalition of possible manipulators of size n in any election for all the common voting rules). These two problems do not seem to have any obvious complexity theoretic implications. Now we explore the connection among the four problems that we study here. Notice that, a polynomial time algorithm for the CPM and the CPMW problems gives us a polynomial time algorithm for the CPMS and the CPMSW problems for any maximum possible coalition size k = O(1). Also, observe that, a polynomial time algorithm for the CPMW (respectively CPMSW) problem implies a polynomial time algorithm for the CPM (respectively CPMS) problem. Hence, we have the following observations. Observation 9.1. For every voting rule, if the maximum possible coalition size k = O(1), then, CPMW ∈ P ⇒ CPM, CPMSW, CPMS ∈ P Observation 9.2. For every voting rule, CPMSW ∈ P ⇒ CPMS ∈ P 213 9.3 Results for the CPMW, CPM, CPMSW, and CPMS Prob- lems In this section, we present our algorithmic results for the CPMW, CPM, CPMSW, and CPMS problems for various voting rules. 9.3.1 Scoring Rules Below we have certain lemmas which form a crucial ingredient of our algorithms. To begin with, we define the notion of a manipulated preference. Let r be a scoring rule and ≻:= (≻i , ≻−i) be a voting profile of n voters. Let ≻′i be a preference such that r(≻) >′i r(≻′i, ≻−i) Then we say that ≻′i is a (≻, i)-manipulated preference with respect to r. We omit the reference to r if it is clear from the context. Lemma 9.1. Let r be a scoring rule and ≻:= (≻i, ≻−i) be a voting profile of n voters. Let a and b be two candidates such that score≻−i(a) > score≻−i(b), and let ≻′i be (≻, i)-manipulated preference where a precedes b: ≻′i:= · · · > a > · · · > b > · · · If a and b are not winners with respect to either (≻′i, ≻−i) or ≻, then the preference ≻′′i obtained from ≻′i by interchanging a and b is also (≻, i)-manipulated. Proof. Let x := r(≻′i, ≻−i). If suffices to show that x continues to win in the proposed profile (≻′′i , ≻−i). To this end, it is enough to argue the scores of a and b with respect to x. First, consider the score of b in the new profile: (b) + score≻−i(b) (a) + score≻−i(a) score(≻′′i ,≻−i)(b) = score≻′′i < score≻′i = score(≻′i,≻−i)(a) 6 score(≻′i,≻−i)(x) = score(≻′′i ,≻−i)(x) 214 (a) and score≻−i(b) < score≻−i(a). The second line uses the fact that score≻′′i The fourth line comes from the fact that x is the winner and the last line follows from the fact (b) = score≻′i that the position of x is same in both profiles. Similarly, we have the following argument for the score of a in the new profile (the second line below simply follows from the definition of scoring rules). (a) + score≻−i(a) (a) + score≻−i(a) score(≻′′i ,≻−i)(a) = score≻′′i 6 score≻′i = score(≻′i,≻−i)(a) 6 score(≻′i,≻−i)(x) = score(≻′′i ,≻−i)(x) Since the tie breaking rule is according to some predefined fixed order ≻t∈ L(C) and the candidates tied with winner in (≻′′i , ≻−i) also tied with winner in (≻′i, ≻−i), we have the following, r(≻) >′′i r(≻′′i , ≻−i) We now show that, if there is some (≻, i)-manipulated preference with respect to a scoring rule r, then there exists a (≻, i)-manipulated preference with a specific structure. Lemma 9.2. Let r be a scoring rule and ≻:= (≻i, ≻−i) be a voting profile of n voters. If there is some (≻, i)-manipulated preference with respect to r, then there also exists a (≻, i)-manipulated preference ≻′i where the actual winner y immediately follows the current winner x: ≻′i:= · · · > x > y > · · · and the remaining candidates are in nondecreasing ordered of their scores from ≻−i. Proof. Let ≻′′ be a (≻, i)-manipulated preference with respect to r. Let x := r(≻), y := r(≻′′ , ≻−i). From Lemma 9.1, without loss of generality, we may assume that, all candidates except x, y are in nondecreasing order of score≻−i(.) in the preference ≻′′. If ≻′′i := · · · ≻ x ≻ · · · ≻ y ≻ · · · ≻ · · · , we define ≻′i:= · · · ≻ x ≻ y ≻ · · · ≻ · · · from ≻′′i where y is moved to the position following x and the position of the candidates in between x and y in ≻′′i is 215 deteriorated by one position each. The position of the rest of the candidates remain same in both ≻′′i and ≻′i. Now we have following, score(≻′i,≻−i)(y) = score≻′i > score≻′′i = score(≻′′i ,≻−i)(y) (y) + score≻−i(y) (y) + score≻−i(y) We also have, score(≻′i,≻−i)(a) 6 score(≻′′i ,≻−i)(a), ∀a ∈ C \ {y} Since the tie breaking rule is according to some predefined order ≻t∈ L(C), we have the following, r(≻) >′i r(≻′, ≻−i) Using Lemma 9.1 and 9.2, we now present our results for the scoring rules. Theorem 9.1. The CPMW, CPM, CPMSW, and CPMS problems for scoring rules are in P for a coalition of size 1 (that is, the coalition size k = 1). Proof. From Observation 9.1, it is enough to give a polynomial time algorithm for the CPMW problem. So consider the CPMW problem. We are given the actual winner y and we compute the current winner x with respect to r. Let ≻[j] be a preference where x and y are in positions j and (j + 1) respectively, and the rest of the candidates are in nondecreasing order of the score that they receive from ≻−i. For j ∈ {1, 2, . . . , m − 1}, we check if y wins with the profile (≻−i, ≻[j]). If we are successful with at least one j we report YES, otherwise we say NO. The correctness follows from Lemma 9.2. Thus we have a polynomial time algorithm for CPMW when k = 1. Now we present our results for the CPMW and the CPM problems when k > 1. If m = O(1), then both the CPMW and the CPM problems for any anonymous and efficient voting rule r can be solved in polynomial time by iterating over all possible (cid:0)m!+k−1 the manipulators can have actual preferences. A voting rule is called efficient if winner de- m! (cid:1) ways termination under it is in P. 216 Theorem 9.2. For scoring rules with α1 − α2 6 αi − αi+1, ∀i, the CPMW and the CPM problems are in P, for any coalition size. Proof. We provide a polynomial time algorithm for the CPMW problem in this setting. Let x be the current winner and y be the given actual winner. Let M be the given subset of voters. Let ((≻i)i∈M, (≻j)j∈V \M) be the reported preference profile. Without loss of generality, we assume that x is the most preferred candidate in every ≻i, i ∈ M. Let us define ≻′i, i ∈ M, by moving y to the second position in the preference ≻i. In the profile ((≻′i)i∈M, (≻j)j∈V \M), the winner is either x or y since only y's score has increased. We claim that M is a coalition of possible manipulators with respect to y if and only if y is the winner in preference profile ((≻′i)i∈M, (≻j)j∈V \M). This can be seen as follows. Suppose there exist preferences ≻′′i , with x ≻′′i y, i ∈ M, for which y wins in the profile ((≻′′i )i∈M, (≻j)j∈V \M). Now without loss of generality, we can assume that y immediately follows x in all ≻′′i , i ∈ M, and α1 − α2 6 αi − αi+1, ∀i implies that we can also assume that x and y are in the first and second positions respectively in all ≻′′i , i ∈ M. Now in both the profiles, ((≻′i)i∈M, (≻j)j∈V \M) and ((≻′′i )i∈M, (≻j)j∈V \M), the score of x and y are same. But in the first profile x wins and in the second profile y wins, which is a contradiction. We now prove a similar result for the CPMSW and CPMS problems. Theorem 9.3. For scoring rules with α1 − α2 6 αi − αi+1, ∀i, the CPMSW and the CPMS problems are in P, for any coalition size. Proof. From Observation 9.2, it is enough to prove that CPMSW ∈ P. Let x be the current winner, y be the given actual winner and s(x) and s(y) be their current respective scores. For each vote v ∈ V, we compute a number ∆(v) = α2 − αj − α1 + αi, where x and y are receiving scores αi and αj respectively from the vote v. Now, we output yes iff there are k votes vi, 1 6 i 6 k such that, Pk i=1 ∆(vi) > s(x)−s(y), which can be checked easily by sorting the ∆(v)'s in nonincreasing order and checking the condition for the first k ∆(v)'s, where k is the maximum possible coalition size specified in the input. The proof of correctness follows by exactly in the same line of argument as the proof of Theorem 9.2. For the k-approval voting rule, we can solve all the problems easily using max flow. Hence, from Theorem 9.2 and Theorem 9.3, we have the following result. Corollary 9.1. The CPMW, CPM, CPMSW, and CPMS problems for the Borda and k-approval voting rules are in P, for any coalition size. 217 9.3.2 Maximin Voting Rule For the maximin voting rule, we show that all the four problems are in P, when we have a coalition of size one. Theorem 9.4. The CPMW, CPM, CPMSW, and CPMS problems for maximin voting rule are in P for any coalition size k = 1 (for CPMW and CPM) or maximum possible coalition size k = 1 (for CMPWS and CPMS). Proof. Given a n-voters' profile ≻∈ L(C)n and a voter vi, let the current winner be x := r(≻) and the given actual winner be y. We will construct ≻′= (≻′i, ≻−i), if it exists, such that r(≻) >′i r(≻′) = y, thus deciding whether vi is a possible manipulator or not. Now, the maximin score of x and y in the profile ≻′ can take one of values from the set {score≻−i(x)±1} and {score≻−i(y) ± 1}. The algorithm is as follows. We first guess the maximin score of x and y in the profile ≻′. There are only four possible guesses. Suppose, we guessed that x's score will decrease by one and y's score will decrease by one assuming that this guess makes y win. Now notice that, without loss of generality, we can assume that y immediately follows x in the preference ≻′i since y is the winner in the profile ≻′. This implies that there are only O(m) many possible positions for x and y in ≻′i. We guess the position of x and thus the position of y in ≻′i. Let B(x) and B(y) be the sets of candidates with whom x and respectively y performs worst. Now since, x's score will decrease and y's score will decrease, we have the following constraint on ≻′i. There must be a candidate each from B(y) and B(x) that will precede x. We do not know a-priori if there is one candidate that will serve as a witness for both B(x) and B(y), or if there separate witnesses. In the latter situation, we also do not know what order they appear in. Therefore we guess if there is a common candidate, and if not, we guess the relative ordering of the distinct candidates from B(x) and B(y). Now we place any candidate at the top position of ≻′i if this action does not make y lose the election. If there are many choices, we prioritize in favor of candidates from B(x) and B(y) - in particular, we focus on the candidates common to B(x) and B(y) if we expect to have a common witness, otherwise, we favor a candidate from one of the sets according to the guess we start with. If still there are multiple choices, we pick arbitrarily. After that we move on to the next position, and do the same thing (except we stop prioritizing explicitly for B(x) and B(y) once we have at least one witness from each set). The other situations can be handled similarly with minor modifications. In this way, if it is able to get a complete preference, then it checks whether vi is a possible manipulator or not using this preference. If yes, then it returns YES. Otherwise, it 218 tries other positions for x and y and other possible scores of x and y. After trying all possible guesses, if it cannot find the desired preference, then it outputs NO. Since there are only polynomial many possible guesses, this algorithm runs in a polynomial amount of time. The proof of correctness follows from the proof of Theorem 1 in [BTT89]. We now show that the CPMW problem for the maximin voting rule is NP-complete when we have k > 1. Towards that, we use the fact that the unweighted coalitional manipulation (UCM) problem for the maximin voting rule is NP-complete [XZP+09], when we have k > 1. The UCM problem is as follows. Let r be any voting rule. Definition 9.7. (r–UCM Problem) Given a set of manipulators M ⊂ V, a profile of non-manipulators' vote (≻i)i∈V\M, and a candidate z ∈ C, we are asked whether there exists a profile of manipulators' votes (≻′j)j∈M such that r((≻i)i∈V\M, (≻′j)j∈M) = z. Assume that ties are broken in favor of z. We define a restricted version of the UCM problem called R-UCM as follows. Definition 9.8. (r–R-UCM Problem) This problem is the same as the UCM problem with a given guarantee - let k := M. The candidate z loses pairwise election with every other candidate by 4k votes. For any two candidates a, b ∈ C, either a and b ties or one wins pairwise election against the other one by margin of either 2k + 2 or of 4k or of 8k. We denote the margin by which a candidate a defeats b, by d(a, b). The R-UCM problem for the maximin voting rule is NP-complete [XZP+09], when we have k > 1. Theorem 9.5. The CPMW problem for the maximin voting rule is NP-complete, for a coalition of size at least 2. Proof. Clearly the CPMW problem for maximin voting rule is NP. We provide a many-one reduction from the R-UCM problem for the maximin voting rule to it. Given a R-UCM problem instance, we define a CPMW problem instance Γ = (C′, (≻′i)i∈V′, M′) as follows. C′ := C ∪ {w, d1, d2, d3} We define V′ such that d(a, b) is the same as the R-UCM instance, for all a, b ∈ C and d(d1, w) = 2k + 2, d(d1, d2) = 8k, d(d2, d3) = 8k, d(d3, d1) = 8k. The existence of such 219 a V′ is guaranteed from Lemma 7.2. Moreover, Lemma 7.2 also ensures that V′ is O(mc). The votes of the voters in M is w ≻ . . . . Thus the current winner is w. The actual winner is defined to be z. The tie breaking rule is ≻t= w ≻ z ≻ . . . , where z is the candidate whom the manipulators in M want to make winner in the R-UCM problem instance. Clearly this reduction takes polynomial amount of time. Now we show that, M is a coalition of possible manipulators iff z can be made a winner. The if part is as follows. Let ≻i, i ∈ M be the votes that make z win. We can assume that z is the most preferred candidate in all the preferences ≻i, i ∈ M. Now consider the preferences for the voters in M is follows. ≻′i:= d1 ≻ d2 ≻ d3 ≻ w ≻i, i ∈ M The score of every candidate in C is not more than z. The score of z is −3k. The score of w is −3k − 2 and the scores of d1, d2, and d3 are less than −3k. Hence, M is a coalition of possible manipulators with the actual preferences ≻′i:= d1 ≻ d2 ≻ d3 ≻ w ≻i, i ∈ M. The only if part is as follows. Suppose M is a coalition of possible manipulators with actual preferences ≻′i, i ∈ M. Consider the preferences ≻′i, i ∈ M, but restricted to the set C only. Call them ≻i, i ∈ M. We claim that ≻i, i ∈ M with the votes from V makes z win the election. If not then, there exists a candidate, say a ∈ C, whose score is strictly more than the score of z - this is so because the tie breaking rule is in favor of z. But this contradicts the fact that z wins the election when the voters in M vote ≻′i, i ∈ M along with the votes from V′. 9.3.3 Bucklin Voting Rule In this subsection, we design polynomial time algorithms for both the CPMW and the CPM problems for the Bucklin voting rule. Again, we begin by showing that if there are profiles witnessing manipulation, then there exist profiles that do so with some additional structure, which we will exploit subsequently in our algorithm. Lemma 9.3. Consider a preference profile (≻i)i∈V, where x is the winner with respect to the Bucklin voting rule. Suppose a subset of voters M ⊂ V forms a coalition of possible manipulators. Let y be the actual winner. Then there exist preferences (≻′i)i∈M such that y is a Bucklin winner in ((≻i)i∈V\M, (≻′i)i∈M), and further: 220 1. y immediately follows x in each ≻′i. 2. The rank of x in each ≻′i is in one of the following - first, b(y) − 1, b(y), b(y) + 1, where b(y) be the Bucklin score of y in ((≻i)i∈V\M, (≻′i)i∈M). Proof. From Definition 9.3, y's rank must be worse than x's rank in each ≻′i. We now ex- change the position of y with the candidate which immediately follows x in ≻′i. This process does not decrease Bucklin score of any candidate except possibly y's, and x's score does not increase. Hence y will continue to win and thus ≻′i satisfies the first condition. Now to begin with, we assume that ≻′i satisfies the first condition. If the position of x in ≻′i is b(y) − 1 or b(y), we do not change it. If x is above b(y) − 1 in ≻′i, then move x and y at the first and second positions respectively. Similarly if x is below b(y) + 1 in ≻′i, then move x and y at the b(y) + 1 and b(y) + 2 positions respectively. This process does not decrease score of any candidate except y because the Bucklin score of x is at least b(y). The transformation cannot increase the score y since its position has only been improved. Hence y continues to win and thus ≻′i satisfies the second condition. Lemma 9.3 leads us to the following theorem. Theorem 9.6. The CPMW problem and the CPM problems for Bucklin voting rule are in P for any coalition of size. Therefore, by Observation 9.1, the CPMSW and the CPMS problems are in P when the maximum coalition size k = O(1). Proof. Observation 9.1 says that it is enough to prove that the CPMW problem is in P. Let x be the current winner and y be the given actual winner. For any final Bucklin score b(y) of y, there are polynomially many possibilities for the positions of x and y in the profile of ≻i, i ∈ M, since Bucklin voting rule is anonymous. Once the positions of x and y is fixed, we try to fill the top b(y) positions of each ≻′i - place a candidate in an empty position above b(y) in any ≻′i if doing so does not make y lose the election. If we are able to successfully fill the top b(y) positions of all ≻′i for all i ∈ M, then M is a coalition of possible manipulators. If the above process fails for all possible above mentioned positions of x and y and all possible guesses of b(y), then M is not a coalition of possible manipulators. Clearly the above algorithm runs in poly(m,n) time. The proof of correctness is as follows. If the algorithm outputs that M is a coalition of possible manipulators, then it actually has constructed ≻′i for all i ∈ M with respect to which they form a coalition of possible manipulators. On the other hand, if they form a coalition of 221 possible manipulators, then Lemma 9.3 ensures that our algorithm explores all the sufficient positions of x and y in ≻′i for all i ∈ M. Now if M is a possible coalition of manipulators, then the corresponding positions for x and y have also been searched. Our greedy algorithm must find it since permuting the candidates except x and z which are ranked above b(y) in ≻′i cannot stop y to win the election since the Bucklin score of other candidates except y is at least b(y). 9.3.4 STV Voting Rule Next we prove that the CPMW and the CPM problems for STV rule is NP-complete. To this end, we reduce from the Exact Cover by 3-Sets Problem (X3C), which is known to be NP-complete [GJ79]. The X3C problem is as follows. Definition 9.9. (X3C Problem) Given a set S of cardinality n and m subsets S1, S2, . . . , Sm ⊂ S with Si = 3, ∀i = 1, . . . , m, does there exist an index set I ⊆ {1, . . . , m} with I = S 3 such that ∪i∈ISi = S. Theorem 9.7. The CPM problem for STV rule is NP-complete even for a coalition of size 1. Proof. Clearly the problem is NP. To show NP hardness, we show a many-one reduction from the X3C problem to it. The reduction is analogous to the reduction given in [BO91]. Given an X3C instance, we construct an election as follows. The unspecified positions can be filled in any arbitrary way. The candidate set is as follows. C = {x, y} ∪ {a1, . . . , am} ∪ {a1, . . . , am} ∪ {b1, . . . , bm} ∪ {b1, . . . , bm} ∪ {d0, . . . , dn} ∪ {g1, . . . , gm} The votes are as follows. ⊲ 12m votes for y ≻ x ≻ . . . ⊲ 12m − 1 votes for x ≻ y ≻ . . . ⊲ 10m + 2n 3 votes for d0 ≻ x ≻ y ≻ . . . ⊲ 12m − 2 votes for di ≻ x ≻ y ≻ . . . , ∀i ∈ [n] ⊲ 12m votes for gi ≻ x ≻ y ≻ . . . , ∀i ∈ [m] 222 ⊲ 6m + 4i − 5 votes for bi ≻ bi ≻ x ≻ y ≻ . . . , ∀i ∈ [m] ⊲ 2 votes for bi ≻ dj ≻ x ≻ y ≻ . . . , ∀i ∈ [m], ∀j ∈ Si ⊲ 6m + 4i − 1 votes for bi ≻ bi ≻ x ≻ y ≻ . . . , ∀i ∈ [m] ⊲ 2 votes for bi ≻ d0 ≻ x ≻ y ≻ . . . , ∀i ∈ [m] ⊲ 6m + 4i − 3 votes for ai ≻ gi ≻ x ≻ y ≻ . . . , ∀i ∈ [m] ⊲ 1 vote for ai ≻ bi ≻ gi ≻ x ≻ y ≻ . . . , ∀i ∈ [m] ⊲ 2 votes for ai ≻ ai ≻ gi ≻ x ≻ y ≻ . . . , ∀i ∈ [m] ⊲ 6m + 4i − 3 votes for ai ≻ gi ≻ x ≻ y ≻ . . . , ∀i ∈ [m] ⊲ 1 vote for ai ≻ bi ≻ gi ≻ x ≻ y ≻ . . . , ∀i ∈ [m] ⊲ 2 votes for ai ≻ ai ≻ gi ≻ x ≻ y ≻ . . . , ∀i ∈ [m] The tie breaking rule is ≻t= · · · ≻ x. The vote of v is x ≻ · · · . We claim that v is a possible manipulator iff the X3C is a yes instance. Notice that, of the first 3m candidates to be eliminated, 2m of them are a1, . . . , am and a1, . . . , am. Also exactly one of bi and bi will be eliminated among the first 3m candidates to be eliminated because if one of bi, bi then the other's score exceeds 12m. We show that the winner is either x or y irrespective of the vote of one more candidate. Let J := {j : bj is eliminated before bj}. If J is an index of set cover then the winner is y. This can be seen as follows. Consider the situation after the first 3m eliminations. Let i ∈ Sj for some j ∈ J. Then bj has been eliminated and thus the score of di is at least 12m. Since J is an index of a set cover, every di's score is at least 12m. Notice that bj has been eliminated for all j /∈ J. Thus the revised score of d0 is at least 12m. After the first 3m eliminations, the remaining candidates are x, y, {di : i ∈ [n]}, {gi : i ∈ [m]}, {bj : j /∈ J}, {bj : j ∈ J}. All the remaining candidates except x has score at least 12m and x's score is 12m − 1. Hence x will be eliminated next which makes y's score at least 24m − 1. Next di's will get eliminated which will in turn make y's score (12n + 36)m − 1. At this point gi's score is at most 32m. Also all the remaining bi and bi's score is at most 32m. Since each of the remaining candidate's scores gets transferred to y once they are eliminated, y is the winner. Now we show that, if J is not an index of set cover then the winner is x. This can be seen 3 , then the number of bj that gets eliminated in the first 3m iterations as follows. If J > n 223 is less than m − n 3 . This makes the score of d0 at most 12m − 2. Hence d0 gets eliminated before x and all its scores gets transferred to x. This makes the elimination of x impossible before y and makes x the winner of the election. If J 6 n 3 and there exists an i ∈ S that is not covered by the corresponding set cover, then di gets eliminated before x with a score of 12m − 2 and its score gets transferred to x. This makes x win the election. Hence y can win iff X3C is a yes instance. Also notice that if y can win the election, then it can do so with the voter v voting a preference like · · · ≻ x ≻ y ≻ · · · . From the proof of the above theorem, we have the following corollary by specifying y as the actual winner for the CPMW problem. Corollary 9.2. The CPMW problem for STV rule is NP-complete even for a coalition of size 1. 9.4 Conclusion In this work, we have initiated a promising research direction for detecting possible instances of manipulation in elections. We have proposed the notion of possible manipulation and explored several concrete computational problems, which we believe to be important in the context of voting theory. These problems involve identifying if a given set of voters are possible manipulators (with or without a specified candidate winner). We have also studied the search versions of these problems, where the goal is to simply detect the presence of possible manipulation with the maximum coalition size. We believe there is theoretical as well as practical interest in studying the proposed problems. We have provided algorithms and hardness results for these problems for many common voting rules. It is our conviction that both the problems that we have studied here have initiated an interesting research direction with significant promise and potential for future work. In the next chapter of the thesis, we study another interesting form of election control called bribery. 224 Chapter 10 Frugal Bribery Bribery in elections is an important problem in computational social choice theory. We introduce and study two important special cases of the classical $BRIBERY problem, namely, FRUGAL-BRIBERY and FRUGAL-$BRIBERY where the briber is frugal in nature. By this, we mean that the briber is only able to influence voters who benefit from the sug- gestion of the briber. More formally, a voter is vulnerable if the outcome of the election improves according to her own preference when she accepts the suggestion of the briber. In the FRUGAL-BRIBERY problem, the goal is to make a certain candidate win the election by changing only the vulnerable votes. In the FRUGAL-$BRIBERY problem, the vulnerable votes have prices and the goal is to make a certain candidate win the election by changing only the vulnerable votes, subject to a budget constraint. We further formulate two nat- ural variants of the FRUGAL-$BRIBERY problem namely UNIFORM-FRUGAL-$BRIBERY and NONUNIFORM-FRUGAL-$BRIBERY where the prices of the vulnerable votes are, respectively, all the same or different. We observe that, even if we have only a small number of candidates, the problems are intractable for all voting rules studied here for weighted elections, with the sole exception of the FRUGAL-BRIBERY problem for the plurality voting rule. In contrast, we have poly- nomial time algorithms for the FRUGAL-BRIBERY problem for plurality, veto, k-approval, k-veto, and plurality with runoff voting rules for unweighted elections. However, the FRUGAL-$BRIBERY problem is intractable for all the voting rules studied here barring the A preliminary version of the work in this chapter was published as [DMN16b]: Palash Dey, Neeldhara Misra, and Y. Narahari. Frugal bribery in voting. In Proc. Thirtieth AAAI Conference on Artificial Intelligence, February 12-17, 2016, Phoenix, Arizona, USA., pages 24662472, 2016. 226 plurality and the veto voting rules for unweighted elections. These intractability results demonstrate that bribery is a hard computational problem, in the sense that several spe- cial cases of this problem continue to be computationally intractable. This strengthens the view that bribery, although a possible attack on an election in principle, may be infeasible in practice. 10.1 Introduction Activities that try to influence voter opinions, in favor of specific candidates, are very common during the time that an election is in progress. For example, in a political election, candidates often conduct elaborate campaigns to promote themselves among a general or targeted au- dience. Similarly, it is not uncommon for people to protest against, or rally for, a national committee or court that is in the process of approving a particular policy. An extreme illus- tration of this phenomenon is bribery - here, the candidates may create financial incentives to sway the voters. Of course, the process of influencing voters may involve costs even with- out the bribery aspect; for instance, a typical political campaign or rally entails considerable expenditure. All situations involving a systematic attempt to influence voters usually have the following aspects: an external agent, a candidate that the agent would like to be the winner, a budget constraint, a cost model for a change of vote, and knowledge of the existing election. The formal computational problem that arises from these inputs is the following: is it possible to make a distinguished candidate win the election in question by incurring a cost that is within the budget? This question, with origins in [FHH06, FHH09, FHHR09], has been sub- sequently studied intensely in computational social choice literature. In particular, bribery has been studied under various cost models, for example, uniform price per vote which is known as $BRIBERY [FHH06], nonuniform price per vote [Fal08], nonuniform price per shift of the distinguished candidate per vote which is called SHIFT BRIBERY, nonuniform price per swap of candidates per vote which is called SWAP BRIBERY [EFS09]. A closely related problem known as campaigning has been studied for various vote models, for example, truncated bal- lots [BFLR12], soft constraints [PRV13], CP-nets [DK16], combinatorial domains [MPVR12] and probabilistic lobbying [BEF+14]. The bribery problem has also been studied under vot- ing rule uncertainty [EHH14]. Faliszewski et al. [FRRS14] study the complexity of bribery in Bucklin and Fallback voting rules. Xia [Xia12] studies destructive bribery, where the goal 227 of the briber is to change the winner by changing minimum number of votes. Dorn et al. [DS12] studies the parameterized complexity of the SWAP BRIBERY problem and Bred- ereck et al. [BCF+14b] explores the parameterized complexity of the SHIFT BRIBERY problem for a wide range of parameters. We recall again that the costs and the budgets involved in all the bribery problems above need not necessarily correspond to actual money traded between voters and candidates. They may correspond to any cost in general, for example, the amount of effort or time that the briber needs to spend for each voter. 10.1.1 Motivation In this work, we propose an effective cost model for the bribery problem. Even the most gen- eral cost models that have been studied in the literature fix absolute costs per voter-candidate combination, with no specific consideration to the voters' opinions about the current winner and the distinguished candidate whom the briber wants to be the winner. In our proposed model, a change of vote is relatively easier to effect if the change causes an outcome that the voter would find desirable. Indeed, if the currently winning candidate is, say, a, and a voter is (truthfully) promised that by changing her vote from c ≻ d ≻ b ≻ a to d ≻ b ≻ c ≻ a, the winner of the election would change from a to d, then this is a change that the voter is likely to be happy to make. While the change does not make her most favorite candidate win the election, it does improve the result from her point of view. Thus, given the circumstances (namely that of her least favorite candidate winning the election), the altered vote serves the voter better than the original one. We believe this perspective of voter influence is an important one to study. The cost of a change of vote is proportional to the nature of the outcome that the change promises - the cost is low or nil if the change results in a better outcome with respect to the voter's original ranking, and high or infinity otherwise. A frugal agent only approaches voters of the former category, thus being able to effectively bribe with minimal or no cost. Indeed the behavior of agents in real life is often frugal. For example, consider campaigners in favor of a relatively smaller party in a political election. They may actually target only vulnerable voters due to lack of human and other resources they have at their disposal. More formally, let c be the winner of an election and p (other than c) the candidate whom the briber wishes to make the winner of the election. Now the voters who prefer c to p will be reluctant to change their votes, and we call these votes non-vulnerable with respect to p - we do not allow these votes to be changed by the briber, which justifies the frugal nature of 228 the briber. On the other hand, if a voter prefers p to c, then it may be very easy to convince her to change her vote if doing so makes p win the election. We name these votes vulnerable with respect to p. When the candidate p is clear from the context, we simply call these votes non-vulnerable and vulnerable, respectively. The computational problem is to determine whether there is a way to make a candidate p win the election by changing only those votes that are vulnerable with respect to p. We call this problem FRUGAL-BRIBERY. Note that there is no cost involved in the FRUGAL-BRIBERY problem - the briber does not incur any cost to change the votes of the vulnerable votes. We also extend this basic model to a more general setting where each vulnerable vote has a certain nonnegative integer price which may correspond to the effort involved in approaching these voters and convincing them to change their votes. We also allow for the specification of a budget constraint, which can be used to enforce auxiliary constraints. This leads us to define the FRUGAL-$BRIBERY problem, where we are required to find a subset of vulnerable votes with a total cost that is within a given budget, such that these votes can be changed in some way to make the candidate p win the election. Note that the FRUGAL-$BRIBERY problem can be either uniform or nonuniform depending on whether the prices of the vulnerable votes are all identical or different. If not mentioned otherwise, the prices of the vulnerable votes will be assumed to be nonuniform. We remind that the briber is not allowed to change the non-vulnerable votes in both the FRUGAL-BRIBERY and the FRUGAL-$BRIBERY problems. 10.1.2 Our Contribution Our primary contribution in this work is to formulate and study two important and natural models of bribery which turn out to be special cases of the well studied $BRIBERY problem in elections. Our results show that both the FRUGAL-BRIBERY and the FRUGAL-$BRIBERY prob- lems are intractable for many commonly used voting rules for weighted as well as unweighted elections, barring a few exceptions. These intractability results can be interpreted as an ev- idence that the bribery in elections is a hard computational problem in the sense that even many of its important and natural special cases continue to be intractable. Thus bribery, al- though a possible attack on elections in principle, may be practically not viable. From a more theoretical perspective, our intractability results strengthen the existing hardness results for the $BRIBERY problem. On the other hand, our polynomial time algorithms exhibit interesting tractable special cases of the $BRIBERY problem. 229 Our Results for Unweighted Elections We have the following results for unweighted elections. ⊲ The FRUGAL-BRIBERY problem is in P for the k-approval, Bucklin, and plurality with runoff voting rules. Also, the FRUGAL-$BRIBERY problem is in P for the plurality and veto voting rules. In contrast, the FRUGAL-$BRIBERY problem is NP-complete for the Borda, maximin, Copeland, and STV voting rules [Observation 10.3]. ⊲ The FRUGAL-BRIBERY problem is NP-complete for the Borda voting rule [Theorem 10.1]. The FRUGAL-$BRIBERY is NP-complete for the k-approval for any constant k > 5 [Theo- rem 10.2], k-veto for any constant k > 3 [Theorem 10.3], and a wide class of scoring rules [Theorem 10.5] even if the price of every vulnerable vote is either 1 or ∞. More- over, the UNIFORM-FRUGAL-$BRIBERY is NP-complete for the Borda voting rule even if all the vulnerable votes have a uniform price of 1 and the budget is 2 [Theorem 10.6]. ⊲ The FRUGAL-$BRIBERY problem is in P for the k-approval, Bucklin, and plurality with runoff voting rules when the budget is a constant [Theorem 10.4]. Our Results for Weighted Elections We have the following results for weighted elections. ⊲ The FRUGAL-BRIBERY problem is in P for the maximin and Copeland voting rules when we have only three candidates [Observation 10.4], and for the plurality voting rule for any number of candidates [Theorem 10.7]. ⊲ The FRUGAL-BRIBERY problem is NP-complete for the STV [Theorem 10.10], plurality with runoff [Corollary 10.1], and every scoring rule except the plurality voting rule [Observation 10.5] for three candidates. The FRUGAL-$BRIBERY problem is NP-complete for the plurality voting rule for three candidates [Theorem 10.8]. ⊲ When we have only four candidates, the FRUGAL-BRIBERY problem is NP-complete for the maximin [Theorem 10.9], Bucklin [Theorem 10.12], and Copeland [Theo- rem 10.13] rules. We summarize the results in the Table 10.1. 230 Voting Rules Plurality Veto k-approval k-veto Borda Runoff Maximin Copeland STV Unweighted Weighted FRUGAL-BRIBERY FRUGAL-$BRIBERY FRUGAL-BRIBERY FRUGAL-$BRIBERY P P P NP-complete [Observation 10.1] [Observation 10.2] [Theorem 10.7] [Theorem 10.8] P P NP-complete NP-complete [Observation 10.1] [Observation 10.2] [Observation 10.5] [Observation 10.5] P [Observation 10.1] P [Observation 10.1] NP-complete [Theorem 10.1] P [Observation 10.1] NP-complete⋆ [Theorem 10.2] NP-complete• [Theorem 10.3] NP-complete† [Theorem 10.5] ? NP-complete⋄ NP-complete [Observation 10.5] [Observation 10.5] NP-complete⋄ NP-complete [Observation 10.5] [Observation 10.5] NP-complete NP-complete [Observation 10.5] [Observation 10.5] NP-complete NP-complete [Corollary 10.1] [Corollary 10.1] ? ? ? NP-complete NP-complete NP-complete [Observation 10.3] [Theorem 10.9] [Theorem 10.9] NP-complete NP-complete NP-complete [Observation 10.3] [Theorem 10.13] [Theorem 10.13] NP-complete NP-complete NP-complete [Observation 10.3] [Theorem 10.10] [Theorem 10.10] Table 10.1: ⋆- The result holds for k > 5. •- The result holds for k > 3. †- The result holds for a much wider class of scoring rules. ⋄- The results do not hold for the plurality voting rule. ?- The problem is open. 231 10.1.3 Related Work The pioneering work of [FHH06] defined and studied the $BRIBERY problem wherein, the input is a set of votes with prices for each vote and the goal is to make some distinguished candidate win the election, subject to a budget constraint of the briber. The FRUGAL-$BRIBERY problem is the $BRIBERY problem with the restriction that the price of every non-vulnerable vote is infinite. Also, the FRUGAL-BRIBERY problem is a special case of the FRUGAL-$BRIBERY problem. Hence, whenever the $BRIBERY problem is computationally easy in a setting, both the FRUGAL-BRIBERY and the FRUGAL-$BRIBERY problems are also computationally easy (see Proposition 10.1 for a more formal proof). However, the $BRIBERY problem is computation- ally intractable in most of the settings. This makes the study of important special cases such as FRUGAL-BRIBERY and FRUGAL-$BRIBERY, interesting. We note that a notion similar to vulnera- ble votes has been studied in the context of dominating manipulation by [CWX11]. Hazon et al. [HLK13] introduced and studied PERSUASION and k-PERSUASION problems where an ex- ternal agent suggests votes to vulnerable voters which are beneficial for the vulnerable voters as well as the external agent. It turns out that the PERSUASION and the k-PERSUASION prob- lems Turing reduce to the FRUGAL-BRIBERY and the FRUGAL-$BRIBERY problems respectively (see Proposition 10.3). Therefore, the polynomial time algorithms we propose in this work imply polynomial time algorithms for the persuasion analog. On the other hand, since the reduction in Proposition 10.3 from PERSUASION to FRUGAL-BRIBERY is a Turing reduction, the existing NP-completeness results for the persuasion problems do not imply NP-completeness results for the corresponding frugal bribery variants. We refer to [RR67] for Turing reduc- tions. 10.2 Problem Definition In all the definitions below, r is a fixed voting rule. We define the notion of vulnerable votes as follows. Intuitively, the vulnerable votes are those votes whose voters can easily be persuaded to change their votes since doing so will result in an outcome that those voters prefer over the current one. Definition 10.1. (Vulnerable votes) Given a voting rule r, a set of candidates C, a profile of votes ≻= (≻1, . . . , ≻n), and a distin- guished candidate p, we say a vote ≻i is p-vulnerable if p ≻i r(≻). 232 Recall that, whenever the distinguished candidate is clear from the context, we drop it from the notation. With the above definition of vulnerable votes, we formally define the FRUGAL-BRIBERY problem as follows. Intuitively, the problem is to determine whether a par- ticular candidate can be made winner by changing only the vulnerable votes. Definition 10.2. (r-FRUGAL-BRIBERY) Given a preference profile ≻= (≻1, . . . , ≻n) over a candidate set C, and a candidate p, determine if there is a way to make p win the election by changing only the vulnerable votes. Next we generalize the FRUGAL-BRIBERY problem to the FRUGAL-$BRIBERY problem which involves prices for the vulnerable votes and a budget for the briber. Intuitively, the price of a vulnerable vote v is the cost the briber incurs to change the vote v. Definition 10.3. (r-FRUGAL-$BRIBERY) Let ≻= (≻1, . . . , ≻n) be a preference profile over a candidate set C. We are given a candidate p, a finite budget b ∈ N, and a price function c : [n] −→ N ∪ {∞} such that c(i) = ∞ if ≻i is not a p-vulnerable vote. The goal is to determine if there exist p vulnerable votes ≻i1, . . . , ≻iℓ∈≻ and votes ≻′i1 (a) the total cost of the chosen votes is within the budget, that is, Pℓ (b) the new votes make the desired candidate win, that is, r(≻[n]\{i1,...,iℓ}, ≻′i1 , . . . , ≻′iℓ∈ L(C) such that: j=1 c(ij) 6 b, and , . . . , ≻′iℓ ) = p. The special case of the problem when the prices of all the vulnerable votes are the same is called UNIFORM-FRUGAL-$BRIBERY. We refer to the general version as NONUNIFORM-FRUGAL- $BRIBERY. If not specified, FRUGAL-$BRIBERY refers to the nonuniform version. The above problems are important special cases of the well studied $BRIBERY problem. Also, the COALITIONAL-MANIPULATION problem [BTT89, CSL07], one of the classic problems in computational social choice theory, turns out to be a special case of the FRUGAL-$BRIBERY problem [see Proposition 10.1]. For the sake of completeness, we include the definitions of these problems here. Definition 10.4. (r-$BRIBERY) [FHH09] Given a preference profile ≻= (≻1, . . . , ≻n) over a set of candidates C, a distinguished candidate p, a price function c : [n] −→ N ∪ {∞}, and a budget b ∈ N, determine if there a way to make p win the election. 233 Definition 10.5. (COALITIONAL-MANIPULATION) [BTT89, CSL07] Given a preference profile ≻t= (≻1, . . . , ≻n) of truthful voters over a set of candidates C, an integer ℓ, and a distinguished candidate p, determine if there exists a ℓ voter preference profile ≻ℓ such that the candidate p wins uniquely (does not tie with any other candidate) in the profile (≻t, ≻ℓ). The following proposition shows the relationship among the above problems. Proposi- tion 10.1 to 10.3 below hold for both weighted and unweighted elections. Proposition 10.1. For every voting rule, FRUGAL-BRIBERY 6P UNIFORM-FRUGAL-$BRIBERY 6P NONUNIFORM-FRUGAL-$BRIBERY 6P $BRIBERY. Also, COALITIONAL-MANIPULATION 6P NONUNIFORM-FRUGAL-$BRIBERY. Proof. In the reductions below, let us assume that the election to start with is a weighted election. Since we do not change the weights of any vote in the reduction and since there is a natural one to one correspondence between the votes of the original instance and the reduced instance, the proof also works for unweighted elections. Given a FRUGAL-BRIBERY instance, we construct a UNIFORM-FRUGAL-$BRIBERY instance by defining the price of every vulnerable vote to be zero and the budget to be zero. Clearly, the two instances are equivalent. Hence, FRUGAL-BRIBERY 6P UNIFORM-FRUGAL-$BRIBERY. UNIFORM-FRUGAL-$BRIBERY 6P NONUNIFORM-FRUGAL-$BRIBERY 6P $BRIBERY follows from the fact that UNIFORM-FRUGAL-$BRIBERY is a special case of NONUNIFORM-FRUGAL- $BRIBERY which in turn is a special case of $BRIBERY. Given a COALITIONAL-MANIPULATION instance, we construct a NONUNIFORM-FRUGAL- $BRIBERY instance as follows. Let p be the distinguished candidate of the manipulators and ≻f= p ≻ others be any arbitrary but fixed ordering of the candidates given in the COALITIONAL-MANIPULATION instance. Without loss of generality, we can assume that p does not win if all the manipulators vote ≻f (Since, this is a polynomially checkable case of COALITIONAL-MANIPULATION). We define the vote of the manipulators to be ≻f, the distin- guished candidate of the campaigner to be p, the budget of the campaigner to be zero, the price of the manipulators to be zero (notice that all the manipulators' votes are p-vulnerable), and the price of the rest of the vulnerable votes to be one. Clearly, the two instances are equivalent. Hence, COALITIONAL-MANIPULATION 6P NONUNIFORM-FRUGAL-$BRIBERY. Also, the FRUGAL-BRIBERY problem reduces to the COALITIONAL-MANIPULATION problem by simply making all vulnerable votes to be manipulators. 234 Proposition 10.2. For every voting rule, FRUGAL-BRIBERY 6P COALITIONAL-MANIPULATION. We can also establish the following relationship between the PERSUASION (respectively k-PERSUASION) problem and the FRUGAL-BRIBERY (respectively FRUGAL-$BRIBERY) problem. The persuasions differ from the corresponding frugal bribery variants in that the briber has her own preference order, and desires to improve the outcome of the election with respect to her preference order. The following proposition is immediate from the definitions of the problems. Proposition 10.3. For every voting rule, there is a Turing reduction from PERSUASION (respec- tively k-PERSUASION) to FRUGAL-BRIBERY (respectively FRUGAL-$BRIBERY). Proof. Given an algorithm for the FRUGAL-BRIBERY problem, we iterate over all possible dis- tinguished candidates to have an algorithm for the persuasion problem. Given an algorithm for the FRUGAL-$BRIBERY problem, we iterate over all possible distin- guished candidates and fix the price of the corresponding vulnerables to be one to have an algorithm for the k-persuasion problem. 10.3 Results for Unweighted Elections Now we present the results for unweighted elections. We begin with some easy observations that follow from known results. Observation 10.1. The FRUGAL-BRIBERY problem is in P for the k-approval voting rule for any k, Bucklin, and plurality with runoff voting rules. Proof. The COALITIONAL-MANIPULATION problem is in P for these voting rules [XZP+09]. Hence, the result follows from Proposition 10.2. Observation 10.2. The FRUGAL-$BRIBERY problem is in P for the plurality and veto voting rules. Proof. The $BRIBERY problem is in P for the plurality [FHH06] and veto [Fal08] voting rules. Hence, the result follows from Proposition 10.1. Observation 10.3. The FRUGAL-$BRIBERY problem is NP-complete for Borda, maximin, Copeland, and STV voting rules. 235 Proof. The COALITIONAL-MANIPULATION problem is NP-complete for the above voting rules. Hence, the result follows from Proposition 10.1. We now present our main results. We begin with showing that the FRUGAL-BRIBERY prob- lem for the Borda voting rule and the FRUGAL-$BRIBERY problem for various scoring rules are NP-complete. To this end, we reduce from the PERMUTATION SUM problem, which is known to be NP-complete [YHL04]. The PERMUTATION SUM problem is defined as follows. PERMUTATION SUM Input: n integers Xi, i ∈ [n] with 1 6 Xi 6 2n for every i ∈ [n] and Pn i=1 Xi = n(n + 1). Question: Do there exist two permutations π and σ of [n] such that π(i) + σ(i) = Xi for every i ∈ [n]? We now prove that the FRUGAL-BRIBERY problem is NP-complete for the Borda voting rule, by a reduction from PERMUTATION SUM. Our reduction is inspired by the reduction used by Davies et al. [DKNW11] and Betzler et al. [BNW11] to prove NP-completeness of the COALITIONAL-MANIPULATION problem for the Borda voting rule. Theorem 10.1. The FRUGAL-BRIBERY problem is NP-complete for the Borda voting rule. Proof. The problem is clearly in NP. To show NP-hardness, we reduce an arbitrary instance of the PERMUTATION SUM problem to the FRUGAL-BRIBERY problem for the Borda voting rule. Let (X1, . . . , Xn) be an instance of the PERMUTATION SUM problem. Without loss of generality, let us assume that n is an odd integer – if n is an even integer, then we consider the instance (X1, . . . , Xn, Xn+1 = 2(n + 1)) which is clearly equivalent to the instance (X1, . . . , Xn). We define a FRUGAL-BRIBERY instance (C, P, p) as follows. The candidate set is: C = X ⊎ D ⊎ {p, c}, where X = {xi : i ∈ [n]} and D = 3n − 1 Note that the total number of candidates is 4n + 1, and therefore the Borda score of a candidate placed at the top position is 4n. Before describing the votes, we give an informal overview of how the reduction will pro- ceed. The election that we define will consist of exactly two vulnerable votes. Note that when placed at the top position in these two votes, the distinguished candidate p gets a score of 8n (4n from each vulnerable vote). We will then add non-vulnerable votes, which will be 236 designed to ensure that, among them, the score of xi is 8n−Xi more than the score of the can- didate p. Using the "dummy candidates", we will also be able to ensure that the candidates xi receive (without loss of generality) scores between 1 and n from the modified vulnerable votes. Now suppose these two vulnerable votes can be modified to make p win the election. Let s1 and s2 be the scores that xi obtains from these altered vulnerable votes. It is clear that for p to emerge as a winner, s1 + s2 must be at most Xi. Since the Borda scores for the candidates in X range from 1 to n in the altered vulnerable votes, the total Borda score that all the candidates in X can accumulate from two altered vulnerable votes is n(n + 1). On the other hand, since the sum of the Xi's is also n(n + 1), it turns out that s1 + s2 must in fact be equal to Xi for the candidate p to win. From this point, it is straightforward to see how the permutations σ and π can be inferred from the modified vulnerable votes: σ(i) is given by the score of the candidate xi from the first vote, while π(i) is the score of the candidate xi from the second vote. These functions turn out to be permutations because these n candidates receive n distinct scores from these votes. We are now ready to describe the construction formally. We remark that instead of 8n−Xi, as described above, we will maintain a score difference of either 8n − Xi or 8n − Xi − 1 depending on whether Xi is even or odd respectively - this is a minor technicality that comes from the manner in which the votes are constructed and does not affect the overall spirit of the reduction. Let us fix any arbitrary order ≻f among the candidates in X⊎D. For any subset A ⊂ X⊎D, let −→A be the ordering among the candidates in A as defined in ≻f and ←−A the reverse order of −→A . For each i ∈ [n], we add two votes vj i as follows for every j ∈ [4]. Let ℓ denote D = 3n − 1. Also, for d ∈ D, let Di, Dℓ/2 ⊂ D \ {d} be such that: i and vj′ Di = ℓ/2 + n + 1 − ⌈Xi/2⌉ and Dℓ/2 = ℓ/2. vj vj′ i :  c ≻ p ≻ d ≻ −−−−−−−−−−−−−−−→ xi ≻ ←−Di ≻ ←−−−−−−−−−−−−−−−  i :  c ≻ p ≻ d ≻ −−−−−−−−−−−−−−−−→ xi ≻ ←−−Dℓ/2 ≻ ←−−−−−−−−−−−−−−−−  C \ ({d, c, p, xi} ⊎ Di) ≻ xi ≻ −→Di C \ ({d, c, p, xi} ⊎ Di) ≻ c ≻ p ≻ d for 3 6 j 6 4 C \ ({d, c, p, xi} ⊎ Dℓ/2) ≻ xi ≻ −−→Dℓ/2 for 1 6 j′ 6 2 C \ ({d, c, p, xi} ⊎ Dℓ/2) ≻ c ≻ p ≻ d for 3 6 j′ 6 4 for 1 6 j 6 2 237 It is convenient to view the votes corresponding to j = 3, 4 as a near-reversal of the votes in j = 1, 2 (except for candidates c, d and xi). Let P1 = {vj i : i ∈ [n], j ∈ [4]}. Since there are 8n votes in all, and c always appears immediately before p, it follows that the score of c i, vj′ is exactly 8n more than the score of the candidate p in P1. We also observe that the score of the candidate xi is exactly 2(ℓ + n + 1) − Xi = 8n − Xi more than the score of the candidate p in P1 for every i ∈ [n] such that Xi is an even integer. On the other hand, the score of the candidate xi is exactly 2(ℓ + n + 1) − Xi − 1 = 8n − Xi − 1 more than the score of the candidate p in P1 for every i ∈ [n] such that Xi is an odd integer. i′ and vj′ Note that for i′ ∈ [n] \ {i}, p and xi receive the same Borda score from the votes vj i′ (where j, j′ ∈ [4]). We now add the following two votes µ1 and µ2. µ1 : p ≻ c ≻ others µ2 : p ≻ c ≻ others Let P = P1 ⊎ {µ1, µ2}, Xo = {xi : i ∈ [n], Xi is odd}, and Xe = X \ Xo. We recall that the distinguished candidate is p. The tie-breaking rule is according to the order Xo ≻ p ≻ others. We claim that the FRUGAL-BRIBERY instance (C, P, p) is equivalent to the PERMUTATION SUM instance (X1, . . . , Xn). In the forward direction, suppose there exist two permutations π and σ of [n] such that π(i) + σ(i) = Xi for every i ∈ [n]. We replace the votes µ1 and µ2 with respectively µ′1 and µ′2 as follows. µ′1 : p ≻ D ≻ xπ−1(n) ≻ xπ−1(n−1) ≻ · · · ≻ xπ−1(1) ≻ c µ′2 : p ≻ D ≻ xσ−1(n) ≻ xσ−1(n−1) ≻ · · · ≻ xσ−1(1) ≻ c We observe that, the candidates c and every x ∈ Xe receive same score as p, every candi- date x′ ∈ Xo receives 1 score less than p, and every candidate in D receives less score than p in P1 ⊎ {µ′1, µ′2}. Hence p wins in P1 ⊎ {µ′1, µ′2} due to the tie-breaking rule. Thus (C, P, p) is a YES instance of FRUGAL-BRIBERY. To prove the other direction, suppose the FRUGAL-BRIBERY instance is a YES instance. Notice that the only vulnerable votes are µ1 and µ2. Let µ′1 and µ′2 be two votes such that the candidate p wins in the profile P1 ⊎ {µ′1, µ′2}. We assume, without loss of generality, that 238 candidate p is placed at the first position in both µ′1 and µ′2. Since c receives 8n scores more than p in P1, c must be placed at the last position in both µ′1 and µ′2 since otherwise p cannot win in P1 ⊎ {µ′1, µ′2}. We also assume, without loss of generality, that every candidate in D is preferred over every candidate in X since otherwise, if x ≻ d in either µ′1 or µ′2 for some x ∈ X and d ∈ D, then we can exchange the positions of x and d and p continues to win since no candidate in D receives more score than p in P1. Hence, every x ∈ X receives some score between 1 and n in both the µ′1 and µ′2. Let us define two permutations π and σ of [n] as follows. For every i ∈ [n], we define π(i) and σ(i) to be the scores the candidate xi receives in µ′1 and µ′2 respectively. The fact that π and σ, as defined above, is indeed a permutation of [n] follows from the structure of the votes µ′1, µ′2 and the Borda score vector. Since p wins in P1 ⊎ {µ′1, µ′2}, we have π(i) + σ(i) 6 Xi. We now have the following. n(n + 1) = n X i=1 (π(i) + σ(i)) 6 n X i=1 Xi = n(n + 1) Hence, we have π(i) + σ(i) = Xi for every i ∈ [n] and thus (X1, . . . , Xn) is a YES instance of PERMUTATION SUM. We will use Lemma 7.1 in subsequent proofs. Theorem 10.2. The FRUGAL-$BRIBERY problem is NP-complete for the k-approval voting rule for any constant k > 5, even if the price of every vulnerable vote is either 1 or ∞. Proof. The problem is clearly in NP. To show NP-hardness, we reduce an arbitrary instance of X3C to FRUGAL-$BRIBERY. Let (U, {S1, . . . , St}) be an instance of X3C. We define a FRUGAL- $BRIBERY instance as follows. The candidate set is C = U ⊎ D ⊎ {p, q}, where D = k − 1. For each Si, 1 6 i 6 t, we add a vote vi as follows. vi : p ≻ q ≻ Si } 5 candidates {z ≻ D ≻ others By Lemma 7.1, we can add poly(U) many additional votes to ensure the following scores (denoted by s(·)). s(q) = s(p) + U/3, s(x) = s(p) + 1, ∀x ∈ U, s(d) < s(p) − U/3, ∀d ∈ D 239 The tie-breaking rule is "p ≻ others". The winner is q. The distinguished candidate is p and thus all the votes in {vi : 1 6 i 6 t} are vulnerable. The price of every vi is 1 and the price of every other vulnerable vote is ∞. The budget is U/3. We claim that the two instances are equivalent. Suppose there exists an index set I ⊆ [t] with I = U/3 such that ⊎i∈ISi = U. We replace the votes vi with v′i, i ∈ I, which are defined as follows. v′i : p ≻ D {z } k candidates ≻ others This makes the score of p not less than the score of any other candidate and thus p wins. To prove the result in the other direction, suppose the FRUGAL-$BRIBERY instance is a YES instance. Then notice that there will be U/3 votes in {vi : 1 6 i 6 t} where the candidate q should not be placed within the top k positions since s(p) = s(q) − U/3 and the budget is U/3. We claim that the Si's corresponding to the vi's that have been changed must form an exact set cover. Indeed, otherwise, there will be a candidate x ∈ U, whose score never decreases which contradicts the fact that p wins the election since s(p) = s(x) − 1. We next present a similar result for the k-veto voting rule. Theorem 10.3. The FRUGAL-$BRIBERY problem is NP-complete for the k-veto voting rule for any constant k > 3, even if the price of every vulnerable vote is either 1 or ∞. Proof. The problem is clearly in NP. To show NP-hardness, we reduce an arbitrary instance of X3C to FRUGAL-$BRIBERY. Let (U, {S1, S2, . . . , St}) be any instance of X3C. We define a FRUGAL-$BRIBERY instance as follows. The candidate set is C = U ⊎ Q ⊎ {p, a1, a2, a3, d}, where Q = k − 3. For each Si, 1 6 i 6 t, we add a vote vi as follows. vi : p ≻ others ≻ Si ≻ Q {z } k candidates By Lemma 7.1, we can add poly(U) many additional votes to ensure following scores (de- noted by s(·)). s(p) > s(d), s(p) = s(x) + 2, ∀x ∈ U, s(p) = s(q) + 1, ∀q ∈ Q, s(p) = s(ai) − U/3 + 1, ∀i = 1, 2, 3 240 The tie-breaking rule is "a1 ≻ · · · ≻ p". The winner is a1. The distinguished candidate is p and thus all the votes in {vi : 1 6 i 6 t} are vulnerable. The price of every vi is one and the price of any other vote is ∞. The budget is U/3. We claim that the two instances are equivalent. In the forward direction, suppose there exists an index set I ⊆ {1, . . . , t} with I = U/3 such that ⊎i∈ISi = U. We replace the votes vi with v′i, i ∈ I, which are defined as follows. v′i : others ≻ a1 ≻ a2 ≻ a3 ≻ Q } k candidates {z The score of each ai decreases by U/3 and their final scores are s(p) − 1, since the score of p is not affected by this change. Also the final score of each x ∈ U is s(p) − 1 since I forms an exact set cover. This makes p win the election. To prove the result in the other direction, suppose the FRUGAL-$BRIBERY instance is a YES instance. Then, notice that there will be exactly U/3 votes in vi, 1 6 i 6 t, where every aj, j = 1, 2, 3, should come in the last k positions since s(p) = s(aj) − U/3 + 1 and the budget is U/3. Notice that candidates in Q must not be placed within top m − k positions since s(p) = s(q) + 1, for every q ∈ Q. Hence, in the votes that have been changed, a1, a2, a3 and all the candidates in Q must occupy the last k positions. We claim that the Si's corresponding to the vi's that have been changed must form an exact set cover. If not, then, there must exist a candidate x ∈ U and two votes vi and vj such that, both vi and vj have been replaced by v′i 6= vi and v′j 6= vj and the candidate x was present within the last k positions in both vi and vj. This makes the score of x at least the score of p which contradicts the fact that p wins. However, we show the existence of a polynomial time algorithm for the FRUGAL-$BRIBERY problem for the k-approval, Bucklin, and plurality with runoff voting rules, when the budget is a constant. The result below follows from the existence of a polynomial time algorithm for the COALITIONAL-MANIPULATION problem for these voting rules for a constant number of manipulators [XZP+09]. Theorem 10.4. The FRUGAL-$BRIBERY problem is in P for the k-approval, Bucklin, and plurality with runoff voting rules, if the budget is a constant. Proof. Let the budget b be a constant. Then, at most b many vulnerable votes whose price is not zero can be changed since the prices are assumed to be in N. Notice that we may assume, without loss of generality, that all the vulnerable votes whose price is zero will be 241 changed. We iterate over all the O(nb) many possible vulnerable vote changes and we can solve each one in polynomial time since the COALITIONAL-MANIPULATION problem is in P for these voting rules [XZP+09]. We show that the FRUGAL-$BRIBERY problem is NP-complete for a wide class of scor- ing rules as characterized in the following result. Our next result shows that, the FRUGAL- $BRIBERY problem is NP-complete for a wide class of scoring rules that includes the Borda voting rule. Theorem 10.5 can be proved by a reduction from the X3C problem. Theorem 10.5. For any positional scoring rule r with score vectors {−→si : i ∈ N}, if there exists a polynomial function f : N −→ N such that, for every m ∈ N, f(m) > 2m and in the score vector (α1, . . . , αf(m)), there exists a 1 6 ℓ 6 f(m) − 5 satisfying the following condition: αi − αi+1 = αi+1 − αi+2 > 0, ∀ℓ 6 i 6 ℓ + 3 then the FRUGAL-$BRIBERY problem is NP-complete for r even if the price of every vulnerable vote is either 1 or ∞. Proof. Since the scoring rules remain unchanged if we multiply every αi by any constant λ > 0 and/or add any constant µ, we can assume the following without loss of generality. αi − αi+1 = αi+1 − αi+2 = 1, ∀ℓ 6 i 6 ℓ + 3 The problem is clearly in NP. To show NP-hardness, we reduce an arbitrary instance of X3C to FRUGAL-$BRIBERY. Let (U, {S1, . . . , St}) be an instance of X3C. We define a FRUGAL-$BRIBERY instance as follows. The candidate set is C = U ⊎ Q ⊎ {p, a, d}, where Q = f(U) − ℓ − 4. For each Si = {x, y, z}, 1 6 i 6 t, we add a vote vi as follows. vi : p ≻ d ≻ others ≻ a ≻ x ≻ y ≻ z ≻ Q } l candidates {z By Lemma 7.1, we can add poly(U) many additional votes to ensure the following scores (denoted by s(·)). Note that the proof of Lemma 7.1 in [BRR11] also works for the normal- ization of α defined in the beginning of the proof. s(d) < s(p), s(x) = s(p) − 2, ∀x ∈ U, 242 s(a) = s(p) + U/3 − 1, s(q) = s(p) + 1 The tie-breaking rule is "· · · ≻ p". The distinguished candidate is p. The price of every vi is 1 and the price of every other vulnerable vote is ∞. The budget is U/3. We claim that the two instances are equivalent. In the forward direction, there exists an index set I ⊆ [t], I = U/3, such that ⊎i∈ISi = U. We replace the votes vi with v′i, i ∈ I, which are defined as follows. v′i : p ≻ d ≻ others ≻ x ≻ y ≻ z ≻ a ≻ Q This makes the score of p at least one more than the score of every other candidate and thus p wins. To prove the result in the other direction, suppose there is a way to make p win the election. Notice that the candidates in Q cannot change their positions in the changed votes and must occupy the last positions due to their score difference with p. Now we claim that there will be exactly U/3 votes where the candidate a must be placed at the (l + 4)th position since s(p) = s(a)− U/3+1 and the budget is U/3. We claim that the Si's corresponding to the changed votes must form an exact set cover. If not, then there must exist a candidate x ∈ U whose score has increased by at least two contradicting the fact that p wins the election. For the sake of concreteness, an example of a function f, stated in Theorem 10.5, that works for the Borda voting rule is f(m) = 2m. Theorem 10.5 shows that the FRUGAL- $BRIBERY problem is intractable for the Borda voting rule. However, the following theorem shows the intractability of the UNIFORM-FRUGAL-$BRIBERY problem for the Borda voting rule, even in a very restricted setting. Theorem 10.6 can be proved by a reduction from the COALI- TION MANIPULATION problem for the Borda voting rule for two manipulators which is known to be NP-complete [BNW11, DKNW11]. Theorem 10.6. The UNIFORM-FRUGAL-$BRIBERY problem is NP-complete for the Borda voting rule, even when every vulnerable vote has a price of 1 and the budget is 2. Proof. The problem is clearly in NP. To show NP-hardness, we reduce an arbitrary instance of the COALITIONAL-MANIPULATION problem for the Borda voting rule with two manipulators to an instance of the UNIFORM-FRUGAL-$BRIBERY problem for the Borda voting rule. Let (C, ≻t , 2, p) be an arbitrary instance of the COALITIONAL-MANIPULATION problem for the Borda voting rule. The corresponding FRUGAL-$BRIBERY instance is as follows. The candidate set is 243 C′ = C ⊎ {d, q}. For each vote vi ∈≻t, we add a vote v′i : vi ≻ d ≻ q. Corresponding to the two manipulators', we add two more votes ν1, ν2 : −−−−→C \ {p} ≻ d ≻ p ≻ q, where −−−−→C \ {p} is an arbitrary but fixed order of the candidates in C \ {p}. We add more votes to ensure following score differences (s(·) and s′(·) are the score functions for the COALITIONAL-MANIPULATION and the UNIFORM-FRUGAL-$BRIBERY instances respectively). s′(p) = λ + s(p) − 2, s′(x) = λ + s(x) for every x ∈ C, s′(q) = s′(p) − 2m + 1, s′(p) > s′(d) + 2m for some λ ∈ Z This will be achieved as follows. For any two arbitrary candidates a and b, the following two votes increase the score of a by one more than the rest of the candidates except b whose score increases by one less. This construction has been used before [XCP10, DKNW11]. C \ {a, b} a ≻ b ≻ −−−−−−→ ←−−−−−− C \ {a, b} ≻ a ≻ b Also, we can ensure that candidate p is always in (m−1/2, m+1/2) positions and the candidate q never immediately follows p in these new votes. The tie-breaking rule is "others ≻ p". The distinguished candidate is p. The price of every vulnerable vote is one and the budget is two. We claim that the two instances are equivalent. In the forward direction, suppose the COALITIONAL-MANIPULATION instance is a YES in- stance. Let u1, u2 be the manipulators' votes that make p win. In the FRUGAL-$BRIBERY instance, we replace νi by ν′i : p ≻ d ≻ ui ≻ q for i = 1, 2. This makes p win the election. In the reverse direction, recall that in all the vulnerable votes except ν1 and ν2, the candidate q never immediately follows candidate p. Therefore, changing any of these votes can never make p win the election since s′(q) = s′(p) − 2m + 1 and the budget is two. Hence, the only way p can win the election, if at all possible, is by changing the votes ν1 and ν2. Let a vote ν′i replaces νi for i = 1, 2. We can assume, without loss of generality, that p and d are at the first and the second positions respectively in both ν′1 and ν′2. Let ui be the order ν′i restricted only to the candidates in C. This makes p winner of the COALITIONAL-MANIPULATION instance since, s′(p) = λ + s(p) − 2, s′(x) = λ + s(x) for every x ∈ C. 244 10.4 Results for Weighted Elections Now we turn our attention to weighted elections. As before, we begin with some easy obser- vations that follow from known results. Observation 10.4. The FRUGAL-BRIBERY problem is in P for the maximin and the Copeland voting rules for three candidates. Proof. The MANIPULATION problem is in P for the maximin, Copeland voting rules for three candidates [CSL07]. Hence, the result follows from Proposition 10.2. Observation 10.5. The FRUGAL-BRIBERY problem is NP-complete for any scoring rule except plurality for three candidates. Proof. The same proof for Theorem 6 of [CSL07] would work here. Theorem 10.7. The FRUGAL-BRIBERY problem is in P for the plurality voting rule. Proof. Let p be the distinguished candidate of the campaigner. The greedy strategy of just replacing every vulnerable vote by p ≻ others solves the problem due to the monotonicity property of the plurality voting rule. Our hardness results in this section are based on the PARTITION problem, which is known to be NP-complete [GJ79], and is defined as follows. Definition 10.6. (PARTITION Problem) Given a finite multi-set W of positive integers with Pw∈W w = 2K, does there exist a subset W′ ⊂ W such that Pw∈W′ w = K? An arbitrary instance of PARTITION is denoted by (W, 2K). 4 -PARTITION as below. We prove that 1 4 - We define another problem which we call 1 PARTITION is also NP-complete. We will use this fact in the proof of Theorem 10.10. Definition 10.7. (The 1 4-PARTITION Problem) Given a finite multi-set W of positive integers with Pw∈W w = 4K, does there exist a subset W′ ⊂ W such that Pw∈W′ w = K? An arbitrary instance of 1 4 -PARTITION is denoted by (W, 4K). Lemma 10.1. 1 4 -PARTITION problem is NP-complete. 245 Proof. The problem is clearly in NP. To show NP-hardness, we reduce the PARTITION problem to it. Let (W, 2K) be an arbitrary instance of the PARTITION problem. We can assume, without loss of generality, that 2K /∈ W, since otherwise the instance is trivially a no instance. The corresponding 1 4 -PARTITION problem instance is defined by (W1, 4K), where W1 = W ∪ {2K}. We claim that the two instances are equivalent. Suppose the PARTITION instance is a YES instance and thus there exists a set W′ ⊂ W such that Pw∈W′ w = K. This W′ gives a 4 -PARTITION instance. To prove the result in the other direction, suppose there is a set W′ ⊂ W1 such that Pw∈W′ w = K. This W′ gives a solution to the PARTITION problem instance since 2K /∈ W′. solution to the 1 In the rest of this section, we present the hardness results in weighted elections for the following voting rules: plurality, maximin, STV, Copelandα, and Bucklin. For plurality, recall that the FRUGAL-BRIBERY problem is in P, and we will show that FRUGAL-$BRIBERY is NP- complete. For all the other rules, we will establish that even FRUGAL-BRIBERY is NP-complete. Theorem 10.8. The FRUGAL-$BRIBERY problem is NP-complete for the plurality voting rule for three candidates. Proof. The problem is clearly in NP. We reduce an arbitrary instance of PARTITION to an in- and Pn stance of FRUGAL-$BRIBERY for the plurality voting rule. Let (W, 2K), with W = {w1, . . . , wn} i=1 wi = 2K, be an arbitrary instance of the PARTITION problem. The candidates are p, a, and b. We will add votes in such a way that makes b win the election. The distinguished candidate is p. For every i ∈ [n], there is a vote a ≻ p ≻ b of both weight and price wi. There are two votes b ≻ p ≻ a of weight 3K (we do not need to define the price of this vote since it is non-vulnerable) and p ≻ a ≻ b of both weight and price 2K + 1. The tie-breaking rule is "a ≻ b ≻ p". We define the budget to be K. We claim that the two instances are equivalent. Suppose there exists a W′ ⊂ W such that Pw∈W′ w = K. We change the votes corresponding to the weights in W′ to p ≻ a ≻ b. This makes p win the election with a score of 3K + 1. To prove the other direction, for p to win, its score must increase by at least K. Also, the prices ensure that p's score can increase by at most K. Hence, p's score must increase by exactly by K and the only way to achieve this is to increase its score by changing the votes corresponding to the weights in W. Thus, p can win only if there exists a W′ ⊂ W such that Pw∈W′ w = K. Next we show the hardness result for the maximin voting rule. 246 Theorem 10.9. The FRUGAL-BRIBERY problem is NP-complete for the maximin voting rule for four candidates. Proof. The problem is clearly in NP. We reduce an arbitrary instance of PARTITION to an instance of FRUGAL-BRIBERY for the maximin voting rule. Let (W, 2K), with W = {w1, . . . , wn} and Pn i=1 wi = 2K, be an arbitrary instance of the PARTITION problem. The candidates are p, a, b, and c. For every i ∈ [n], there is a vote p ≻ a ≻ b ≻ c of weight wi. There is one vote c ≻ a ≻ b ≻ p, one b ≻ c ≻ a ≻ p, and one a ≻ c ≻ b ≻ p each of weight K. The tie-breaking rule is "p ≻ a ≻ b ≻ c". The distinguished candidate is p. Let T denotes the set of votes corresponding to the weights in W and the rest of the votes S. Notice that only the votes in T are vulnerable. We claim that the two instances are equivalent. Suppose there exists a W′ ⊂ W such that Pw∈W′ w = K. We change the votes corre- sponding to the weights in W′ to p ≻ a ≻ b ≻ c. We change the rest of the votes in T to p ≻ b ≻ c ≻ a. The maximin score of every candidate is −K and thus due to the tie-breaking rule, p wins the election. On the other hand, suppose there is a way to change the vulnerable votes, that is the votes in T , that makes p win the election. Without loss of generality, we can assume that all the votes in T place p at top position. First notice that the only way p could win is that the vertices a, b, and c must form a cycle in the weighted majority graph. Otherwise, one of a, b, and c will be a Condorcet winner and thus the winner of the election. Now we show that the candidate b must defeat the candidate c. If not, then c must defeat b by a margin of K since the maximin score of p is fixed at −K. Also, a must defeat c by a margin of K, otherwise the maximin score of c will be more than −K. This implies that all the votes in T must be p ≻ a ≻ c ≻ b which makes a defeat b. This is a contradiction since the vertices a, b, and c must form a cycle in the weighted majority graph. Hence b must defeat c by a margin of K. This forces every vote in T to prefer b over c. Hence, without loss of generality, we assume that all the votes in T are either p ≻ a ≻ b ≻ c or p ≻ b ≻ c ≻ a, since whenever c is right after a, we can swap a and c and this will only reduce the score of a without affecting the score of any other candidates. If the total weight of the votes p ≻ a ≻ b ≻ c in T is more than K, then DE(c, a) < K, thereby making the maximin score of a more than the maximin score of p. If the total weight of the votes p ≻ a ≻ b ≻ c in T is less than K, then DE(a, b) < K, thereby making the maximin score of b more than the maximin score of p. Thus the total weight of the votes p ≻ a ≻ b ≻ c in T should be exactly K which corresponds to a partition of W. 247 We now prove the hardness result for the STV voting rule. Theorem 10.10. The FRUGAL-BRIBERY problem is NP-complete for the STV voting rule for three candidates. Proof. The problem is clearly in NP. We reduce an arbitrary instance of 1 4 -PARTITION to an instance of FRUGAL-BRIBERY for the STV voting rule. Let (W, 4K), with W = {w1, . . . , wn} and Pn i=1 wi = 4K, be an arbitrary instance of the 1 4-PARTITION problem. The candidates are p, a, and b. For every i ∈ [n], there is a vote p ≻ a ≻ b of weight wi. There is a vote a ≻ p ≻ b of weight 3K − 1 and a vote b ≻ a ≻ p of weight 2K. The tie-breaking rule is "a ≻ b ≻ p". The distinguished candidate is p. Let T denotes the set of votes corresponding to the weights in W and the rest of the votes be S. Notice that only the votes in T are vulnerable. We claim that the two instances are equivalent. Suppose there exists a W′ ⊂ W such that Pw∈W′ w = K. We change the votes corre- sponding to the weights in W′ to b ≻ p ≻ a. We do not change the rest of the votes in T . This makes p win the election. For the other direction, suppose there is a way to change the votes in T that makes p win the election. First Notice that p can win only if b qualifies for the second round. Hence, the total weight of the votes in T that put b at the first position must be at least K. On the other hand, if the total weight of the votes in T that put b at the first position is strictly more than K, then p does not qualify for the second round and thus cannot win the election. Hence the total weight of the votes in T that put b at the first position must be exactly equal to K which constitutes a 1 4-partition of W. For three candidates, the STV voting rule is the same as the plurality with runoff voting rule. Hence, we have the following corollary. Corollary 10.1. The FRUGAL-BRIBERY problem is NP-complete for the plurality with runoff voting rule for three candidates. We turn our attention to the Copelandα voting rule next. Theorem 10.11. The FRUGAL-BRIBERY problem is NP-complete for the Copelandα voting rule for four candidates, whenever α ∈ [0, 1). Proof. The problem is clearly in NP. We reduce an arbitrary instance of PARTITION to an in- stance of FRUGAL-BRIBERY for the Copelandα voting rule. Let (W, 2K), with W = {w1, . . . , wn} 248 and Pn i=1 wi = 2K, be an arbitrary instance of the PARTITION problem. The candidates are p, a, b, and c. For every i ∈ [n], there is a vote p ≻ a ≻ b ≻ c of weight wi. There are two votes a ≻ p ≻ b ≻ c and c ≻ b ≻ a ≻ p each of weight K + 1. The tie-breaking rule is "a ≻ b ≻ c ≻ p". The distinguished candidate is p. Let T denotes the set of votes corresponding to the weights in W and the rest of the votes be S. Notice that only the votes in T are vulnerable. We claim that the two instances are equivalent. Suppose there exists a W′ ⊂ W such that Pw∈W′ w = K. We change the votes corre- sponding to the weights in W′ to p ≻ c ≻ b ≻ a. We change the rest of the votes in T to p ≻ b ≻ c ≻ a. This makes p win the election with a Copelandα score of two. On the other hand, suppose there is a way to change the votes in T that makes p win the election. Without loss of generality, we can assume that all the votes in T place p at top position. We will show that one of the three pairwise elections among a, b, and c must be a tie. Suppose not, then a must lose to both b and c, otherwise a wins the election due to the tie-breaking rule. Now consider the pairwise election between b and c. If b defeats c, then b wins the election due to the tie-breaking rule. If c defeats b, then c wins the election again due to the tie-breaking rule. Hence, one of the pairwise elections among a, b, and c must be a tie. Without loss of generality suppose a and b ties. Then the total weight of the votes that prefer a to b in T must be K which constitutes a partition of W. Finally, we show that the FRUGAL-BRIBERY problem for the Bucklin voting rule is NP- complete. Theorem 10.12. The FRUGAL-BRIBERY problem is NP-complete for the Bucklin voting rule for four candidates. Proof. The problem is clearly in NP. We reduce an arbitrary instance of PARTITION to an instance of FRUGAL-BRIBERY for the Bucklin voting rule. Let (W, 2K), with W = {w1, . . . , wn} and Pn i=1 wi = 2K, be an arbitrary instance of the PARTITION problem. The candidates are p, a, b, and c. For every i ∈ [n], there is a vote p ≻ a ≻ b ≻ c of weight wi. There are two votes a ≻ b ≻ p ≻ c and c ≻ b ≻ a ≻ p each of weight K. The tie-breaking rule is "p ≻ a ≻ b ≻ c". The distinguished candidate is p. Let T denote the set of votes corresponding to the weights in W and the rest of the votes be S. Notice that only the votes in T are vulnerable. We claim that the two instances are equivalent. 249 Suppose there exists a W′ ⊂ W such that Pw∈W′ w = K. We change the votes corre- sponding to the weights in W′ to p ≻ c ≻ b ≻ a. This makes p win the election with a Bucklin score of three. To prove the result in the other direction, suppose there is a way to change the votes in T that makes p win the election. Without loss of generality, we can assume that all the votes in T place p at the first position. First Notice that the Bucklin score of p is already fixed at three. In the votes in T , the candidate b can never be placed at the second position since that will make the Bucklin score of b to be two. Also the total weight of the votes in T that place a in their second position can be at most K. The same holds for c. Hence, the total weight of the votes that place a in their second position will be exactly equal to K which constitutes a partition of W. We also have the following results for the Copelandα and Bucklin voting rules by reducing from PARTITION. Theorem 10.13. The FRUGAL-BRIBERY problem is NP-complete for the Copelandα and Bucklin voting rules for four candidates, whenever α ∈ [0, 1). From Proposition 10.1, Observation 10.5, Theorem 10.8 to 10.10, 10.12 and 10.13, and Corollary 10.1, we get the following corollary. Corollary 10.2. The UNIFORM-FRUGAL-$BRIBERY and the NONUNIFORM-FRUGAL-$BRIBERY problems are NP-complete for the scoring rules except plurality, STV, and the plurality with runoff voting rules for three candidates and for the maximin, Copeland, and Bucklin voting rules for four candidates. 10.5 Conclusion We proposed and studied two important special cases of the $BRIBERY problem where the briber is frugal. Our results show that even for these special cases, the bribery problem continues to be intractable, thus subsuming known hardness results in the literature. Our results reinforce that bribery is a rather hard computational problem, because of the hardness of several important special cases. This also strengthens the view that bribery, although a possible attack on an election in principle, may be infeasible in practice. 250 Chapter 11 Summary and Future Directions In this chapter, we summarize our work in this thesis and provide interesting future directions of research. In this thesis, we studied computational complexity of three fundamental aspects of vot- ing. We began with studying efficient strategies for eliciting preferences of voters in the first part of the thesis. We then moved on to study the problem of finding a winner under vari- ous interesting circumstances in the second part of the thesis. Finally, we showed interesting complexity theoretic results for the computational problem of controlling an election system in various forms. We now summarize our work in this thesis. 11.1 Summary of Contributions 11.1.1 Part I: Preference Elicitation Chapter 3: Preference Elicitation for Single Peaked Profiles on Trees In this work, we presented algorithms for eliciting the preferences of a set of voters when the preferences are single peaked on a tree. Moreover, our algorithms ask minimum number of comparison queries up to constant factors. We also presented algorithms for finding a weak Condorcet winner from a set of preferences which are single peaked on a tree by asking minimum number of comparison queries up to constant factors. We observed that, the query complexity of finding a weak Condorcet is much less than the query complexity for preference elicitation. 251 Chapter 4: Preference Elicitation for Single Crossing Profiles In this work, we presented preference elicitation algorithm for single crossing preference profiles. We studied this problem when an ordering of the voters with respect to which the profile is single crossing is known and when it is unknown. We also considered different access models: when the votes can be accessed at random, as opposed to when they are coming in a predefined sequence. In the sequential access model, we distinguished two cases when the ordering is known: the first is that sequence in which the votes appear is also a single-crossing order, versus when it is not. Our algorithms ask for minimum number of comparison queries up to constant factors for all the above situations except one when we have a large number of voters. 11.1.2 Part II: Winner Determination Chapter 5: Winner Prediction and Margin of Victory Estimation We presented efficient algorithms for predicting the winner of an election as well as estimat- ing the margin of victory of an election. We also showed interesting lower bounds for sample complexity of these problems which establish that our algorithms are often optimal up to constant factors. Chapter 6: Streaming Algorithms for Winner Determination In this work, we studied the space complexity for determining approximate winners in the setting where votes are inserted continually into a data stream. We showed that allowing randomization and approximation indeed allows for much more space-efficient algorithms. Moreover, our bounds are tight in certain parameter ranges. 11.1.3 Part III: Election Control Chapter 7: Kernelization for Possible Winner and Coalitional Manipulation In this work, we proved that the possible winner problem does not admit any efficient pre- processing rules, more formally any kernelization algorithms for many common voting rules including scoring rules, maximin, Copeland, ranked pairs, and Bucklin when parameterized 252 by the number of candidates. However, we showed that the coalitional manipulation prob- lem which is an important special case of the possible winner problem does admit polynomial time kernelization algorithms parameterized by the number of candidates. Chapter 8: Manipulation with Partial Votes In this chapter, we pursued a comprehensive study of manipulation with incomplete votes. We proposed three natural extension of manipulation in the usual complete information setting to the incomplete information setting namely, weak manipulation, opportunistic manipulation, and strong manipulation. We completely resolved computational complexity of all the three problems for many common voting rules including plurality, veto, k-approval, k-veto, Borda, maximin, Copeland, Bucklin, and Fallback voting rules. Chapter 9: Manipulation Detection In this work, we initiated a promising direction of research namely detecting instances of manipulation in elections. We showed that detecting possible instances of manipulation can often be a much easier computational problem than the corresponding problem of manipu- lating election itself as seen for the case of the Borda voting rule. Chapter 10: Frugal Bribery In this work, we studied the classical problem of bribery under a weak notion of briber namely when the briber if frugal in nature. We proved that the bribery problems remain intractable even with this weak briber thereby strengthening the intractability results from the literature on bribery. Hence, although theoretically possible, bribery may not be easy to do in practice. 11.2 Future Directions of Research We next discuss some of the interesting directions of research from this thesis. Chapter 3: Preference Elicitation for Single Peaked Profiles on Trees ⊲ One can generalize the notion of single peaked profiles on trees for preferences that are not necessarily a complete order. Indeed, voters often are indifferent between two or 253 more candidates and there are interesting domains in this setting [EL15]. Eliciting such incomplete preference is an interesting direction of research to pursue. ⊲ The domain of single peaked profiles on trees can further be generalized to single peaked profiles on forests. It would be interesting to study this both as a domain it- self and from the point of view of existence of efficient preference elicitation strategies. ⊲ Can we reduce the query complexity for preference elicitation further by assuming more on their preferences, for example, a social network structure on the voters? ⊲ In this work, we assume complete knowledge of single peaked tree. How the query complexity would change if we only assume the knowledge of the structure of the single peaked tree without the identity of the candidate associated with each node of the tree? Chapter 4: Preference Elicitation for Single Crossing Profiles ⊲ An immediate direction of research is to close the gap between upper and lower bound on query complexity for preference elicitation when we know a single crossing order and voters are allowed to be queried randomly. ⊲ Another interesting direction is to study preference elicitation assuming a social network structure among the voters where neighbors tend to have similar preferences. Chapter 5: Winner Prediction and Margin of Victory Estimation ⊲ Is there an axiomatic characterization of the voting rules for which the sample com- plexity is independent of m and n? We note that a similar problem in graph property testing was the subject of intense study [AFNS06, BCL+06]. ⊲ Specifically for scoring rules, is the sample complexity determined by some natural property of the score vector, such as its sparsity? ⊲ Is it worthwhile for the algorithm to elicit only part of the vote from each sampled voter instead of the full vote? As mentioned in the Introduction, vote elicitation is a well- trodden area, but as far as we know, it has not been studied how assuming a margin of victory can change the number of queries. 254 ⊲ How can knowledge of a social network on the voters be used to minimize the number of samples made? Some initial progress in this direction has been made by Dhamal and Narahari [DN13] and by Agrawal and Devanur (private communication). Chapter 6: Streaming Algorithms for Winner Determination ⊲ An immediate future direction of research is to find optimal algorithms for heavy hitters variants for other voting rule. ⊲ It may be interesting to implement these streaming algorithms for use in practice (say, for participatory democracy experiments or for online social networks) and investigate how they perform. ⊲ Finally, instead of having the algorithms which passive observes a few random votes, could we improve performance of the algorithm by actively querying voters as they appear in the stream? Chapter 7: Kernelization for Possible Winner and Coalitional Manipula- tion ⊲ There are other interesting parameterizations of these problems for which fixed param- eter tractable algorithms are known but the corresponding kernelization questions are still open. One such parameter is the total number of pairs s in all the votes for which an ordering has not been specified. With this parameter, a simple O(2s. poly(m, n)) al- gorithm is known [BHN09]. However, the corresponding kernelization question is still open. ⊲ Another interesting problem in the context of incomplete votes is the necessary winner problem which asks for a candidate which wins in every extension of the partial votes. Necessary winner is known to be intractable for Copeland, ranked pairs, voting trees, and STV voting rules [XC11]. Studying parameterized complexity of the necessary winner problem is also another interesting direction of research to pursue in future. 255 Chapter 8: Manipulation with Partial Votes ⊲ we leave open the problem of completely establishing the complexity of strong, oppor- tunistic, and weak manipulations for all the scoring rules. It would be interesting to resolve it. ⊲ Other fundamental forms of manipulation and control do exist in voting, such as de- structive manipulation and control by adding candidates. It would be interesting to investigate the complexity of these problems in a partial information setting. ⊲ Another exciting direction is the study of average case complexity, as opposed to the worst case results that we have pursued. These studies have already been carried out in the setting of complete information [PR06, FP10, Wal10]. Studying the problems that we propose in the average-case model would reveal further insights on the robustness of the incomplete information setting as captured by our model involving partial orders. Chapter 9: Manipulation Detection ⊲ In this work, we considered elections with unweighted voters only. An immediate future research direction is to study the complexity of these problems in weighted elections. ⊲ Verifying the number of false manipulators that this model catches in a real or synthetic data set, where, we already have some knowledge about the manipulators, would be interesting. Chapter 10: Frugal Bribery ⊲ A potential and natural direction for future work is to study these problems under various other settings. One obvious setting is to restrict the campaigner's knowledge about the votes and/or the candidates who will actually turn up. The uncertainty can also arise from the voting rule that will eventually be used among a set of voting rules. ⊲ Studying these bribery problems when the pricing model for vulnerable votes is similar to swap bribery would be another interesting future direction. 256 References [ABW03] Arvind Arasu, Shivnath Babu, and Jennifer Widom. CQL: A language for contin- uous queries over streams and relations. In Proc. 9th International Workshop on Database Programming Languages DBPL, pages 1–19, 2003. 109 [AFNS06] Noga Alon, Eldar Fischer, Ilan Newman, and Asaf Shapira. A combinatorial characterization of the testable graph properties: it's all about regularity. In Proc. 38th Annual ACM Symposium on Theory of Computing (STOC), pages 251– 260, 2006. 254 [AM01] Javed A Aslam and Mark Montague. Models for metasearch. In Proc. 24th Annual international ACM SIGIR conference on Research and Development in In- formation Retrieval, pages 276–284. ACM, 2001. 115 [Arr50] Kenneth J Arrow. A difficulty in the concept of social welfare. J. Polit. Econ., pages 328–346, 1950. 31 [AS94] Rakesh Agrawal and Ramakrishnan Srikant. Fast algorithms for mining associa- tion rules in large databases. In Proc. 20th International Conference on Very Large Data Bases, pages 487–499, 1994. 109 [AT05] Gediminas Adomavicius and Alexander Tuzhilin. Toward the next generation of recommender systems: A survey of the state-of-the-art and possible extensions. IEEE Trans. Knowl. Data Eng., 17(6):734–749, 2005. 115 [BBCN12] Nadja Betzler, Robert Bredereck, Jiehua Chen, and Rolf Niedermeier. The multi- variate algorithmic revolution and beyond. pages 318–363, Berlin, Heidelberg, 2012. Springer-Verlag. 144 257 REFERENCES [BBCV09] Paolo Boldi, Francesco Bonchi, Carlos Castillo, and Sebastiano Vigna. Voting in social networks. In Proc. 18th ACM Conference on Information and Knowledge Mmanagement, pages 777–786. ACM, 2009. 78 [BBF10] Yoram Bachrach, Nadja Betzler, and Piotr Faliszewski. Probabilistic possible win- ner determination. In International Conference on Artificial Intelligence (AAAI), volume 10, pages 697–702, 2010. 79, 173 [BBHH15] Felix Brandt, Markus Brill, Edith Hemaspaandra, and Lane A Hemaspaandra. Bypassing combinatorial protections: Polynomial-time algorithms for single- peaked electorates. J. Artif. Intell. Res., pages 439–496, 2015. 31 [BBN10] Nadja Betzler, Robert Bredereck, and Rolf Niedermeier. Partial kernelization for rank aggregation: theory and experiments. In International Symposium on Parameterized and Exact Computation (IPEC), pages 26–37. Springer, 2010. 143, 144 [BBN14] Nadja Betzler, Robert Bredereck, and Rolf Niedermeier. Theoretical and empir- ical evaluation of data reduction for exact kemeny rank aggregation. Auton. Agent Multi Agent Syst., 28(5):721–748, 2014. 4 [BCE+15] Felix Brandt, Vincent Conitzer, Ulle Endriss, J´erome Lang, and Ariel Procaccia. Handbook of computational social choice, 2015. 30, 115, 169 [BCF+14a] Robert Bredereck, Jiehua Chen, Piotr Faliszewski, Jiong Guo, Rolf Niedermeier, and Gerhard J. Woeginger. Parameterized algorithmics for computational so- cial choice: Nine research challenges. In Tsinghua Science and Technology, vol- ume 19, pages 358–373. IEEE, 2014. 9, 142, 144 [BCF+14b] Robert Bredereck, Jiehua Chen, Piotr Faliszewski, Andr´e Nichterlein, and Rolf Niedermeier. Prices matter for the parameterized complexity of shift bribery. In Proc. 28th International Conference on Artificial Intelligence (AAAI), pages 1398– 1404, 2014. 144, 228 [BCH+14] Robert Bredereck, Jiehua Chen, Sepp Hartung, Stefan Kratsch, Rolf Niedermeier, Ondrej Such, and Gerhard J. Woeginger. A multivariate complexity analysis of lobbying in multiple referenda. J. Artif. Intell. Res. (JAIR), 50:409–446, 2014. 144 258 REFERENCES [BCIW16] Vladimir Braverman, Stephen R. Chestnut, Nikita Ivkin, and David P. Woodruff. Beating countsketch for heavy hitters in insertion streams. In Proc. 48th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2016, Cambridge, MA, USA, June 18-21, 2016, pages 740–753, 2016. 112 [BCL+06] Christian Borgs, Jennifer T. Chayes, L´aszl´o Lov´asz, Vera T. S´os, Bal´azs Szegedy, and Katalin Vesztergombi. Graph limits and parameter testing. In Proc. 38th Annual ACM Symposium on Theory of Computing (STOC), pages 261–270, 2006. 254 [BD09] Nadja Betzler and Britta Dorn. Towards a dichotomy of finding possible winners in elections based on scoring rules. In Mathematical Foundations of Computer Science (MFCS), pages 124–136. Springer, 2009. 143, 180, 199 [BDW16] Arnab Bhattacharyya, Palash Dey, and David P. Woodruff. An optimal algorithm for l1-heavy hitters in insertion streams and related problems. In Proc. 35th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, PODS '16, pages 385–400, San Francisco, California, USA, 2016. 8, 108 [BEF+14] Daniel Binkele-Raible, G´abor Erd´elyi, Henning Fernau, Judy Goldsmith, Nicholas Mattei, and Jorg Rothe. The complexity of probabilistic lobbying. In Al- gorithmic Decision Theory, volume 11, pages 1–21. Discrete Optimization, 2014. 227 [Bet10] Nadja Betzler. On problem kernels for possible winner determination under the k-approval protocol. In Mathematical Foundations of Computer Science (MFCS), pages 114–125. Springer, 2010. 144 [BF12] Markus Brill and Felix A. Fischer. The price of neutrality for the ranked pairs method. In Proc. Twenty-Sixth AAAI Conference on Artificial Intelligence, July 22- 26, 2012, Toronto, Ontario, Canada., 2012. 18 [BFG+09] Nadja Betzler, Michael R Fellows, Jiong Guo, Rolf Niedermeier, and Frances A Rosamond. Fixed-parameter algorithms for kemeny rankings. THEOR COMPUT SCI, 410(45):4554–4570, 2009. 144 259 REFERENCES [BFLR12] Dorothea Baumeister, Piotr Faliszewski, J´erome Lang, and Jorg Rothe. Cam- paigns for lazy voters: truncated ballots. In International Conference on Au- tonomous Agents and Multiagent Systems, AAMAS 2012, Valencia, Spain, June 4-8, 2012 (3 Volumes), pages 577–584, 2012. 173, 227 [BGS01] Philippe Bonnet, Johannes Gehrke, and Praveen Seshadri. Towards sensor database systems. In Proc. 2nd International Conference on Mobile Data Man- agement, MDM, pages 3–14, 2001. 109 [BHN09] Nadja Betzler, Susanne Hemmann, and Rolf Niedermeier. A Multivariate Com- plexity Analysis of Determining Possible Winners given Incomplete Votes. In Proc. International Joint Conference on Artificial Intelligence (IJCAI), volume 9, pages 53–58, 2009. 143, 144, 255 [BICS10] Radu Berinde, Piotr Indyk, Graham Cormode, and Martin J. Strauss. Space- optimal heavy hitters with strong error bounds. ACM Trans. Database Syst., 35(4):26:1–26:28, October 2010. 110, 113 [BITT89] John Bartholdi III, Craig A Tovey, and Michael A Trick. Voting schemes for which it can be difficult to tell who won the election. Soc. Choice Welf., 6(2):157–165, 1989. 31, 78 [Bla48] Duncan Black. On the rationale of group decision-making. J. Polit. Econ., pages 23–34, 1948. 31 [BLOP14] Craig Boutilier, J´erome Lang, Joel Oren, and H´ector Palacios. Robust win- ners and winner determination policies under candidate uncertainty. In Proc. Twenty-Eighth AAAI Conference on Artificial Intelligence, AAAI'14, pages 1391– 1397. AAAI Press, 2014. 79 [BNM+58] Duncan Black, Robert Albert Newing, Iain McLean, Alistair McMillan, and Burt L Monroe. The theory of committees and elections. Springer, 1958. 31 [BNW11] Nadja Betzler, Rolf Niedermeier, and Gerhard J Woeginger. Unweighted coali- tional manipulation under the borda rule is NP-hard. In IJCAI, volume 11, pages 55–60, 2011. 178, 213, 236, 243 260 REFERENCES [BO91] J.J. Bartholdi and J.B. Orlin. Single transferable vote resists strategic voting. Soc. Choice Welf., 8(4):341–354, 1991. 169, 207, 208, 222 [bor] Borda count. https://en.wikipedia.org/wiki/Borda_count. 2 [BR99] Kevin S. Beyer and Raghu Ramakrishnan. Bottom-up computation of sparse and iceberg cubes. In Proc. ACM SIGMOD International Conference on Management of Data, pages 359–370, 1999. 109 [BR12] Dorothea Baumeister and Jorg Rothe. Taking the final step to a full dichotomy of the possible winner problem in pure scoring rules. Inf. Process. Lett., 112(5):186– 190, 2012. 143 [BRR11] Dorothea Baumeister, Magnus Roos, and Jorg Rothe. Computational complexity of two variants of the possible winner problem. In The 10th International Con- ference on Autonomous Agents and Multiagent Systems (AAMAS), pages 853–860, 2011. 143, 146, 173, 242 [BRR+12] Dorothea Baumeister, Magnus Roos, Jorg Rothe, Lena Schend, and Lirong Xia. The possible winner problem with uncertain weights. In ECAI, pages 133–138, 2012. 173 [BS09] Steven J Brams and M Remzi Sanver. Voting systems that combine approval and preference. In The mathematics of preference, choice and order, pages 215–237. Springer, 2009. 17 [BTT89] J.J. Bartholdi, C.A. Tovey, and M.A. Trick. The computational difficulty of ma- nipulating an election. Soc. Choice Welf., 6(3):227–241, 1989. 143, 163, 169, 170, 204, 207, 213, 219, 233, 234 [BTY09] Hans L. Bodlaender, St´ephan Thomass´e, and Anders Yeo. Kernel Bounds for Dis- joint Cycles and Disjoint Paths. In Amos Fiat and Peter Sanders, editors, Proc. 17th Annual European Symposium,on Algorithms (ESA 2009), Copenhagen, Den- mark, September 7-9, 2009., volume 5757 of Lecture Notes in Computer Science, pages 635–646. Springer, 2009. 19, 20 261 REFERENCES [BY03] Ziv Bar-Yossef. Sampling lower bounds via information theory. In Proc. 35th Annual ACM Symposium on Theory of Computing (STOC), pages 335–344. ACM, 2003. 81 [BYJKS02] Ziv Bar-Yossef, TS Jayram, Ravi Kumar, and D Sivakumar. An information statis- tics approach to data stream and communication complexity. In Proc. 43rd An- nual IEEE Symposium on Foundations of Computer Science, pages 209–218. IEEE, 2002. 135 [BYKS01] Ziv Bar-Yossef, Ravi Kumar, and D Sivakumar. Sampling algorithms: lower bounds and applications. In Proc. 33rd Annual ACM Symposium on Theory of Computing (STOC), pages 266–275. ACM, 2001. 81 [Car11] David Cary. Estimating the margin of victory for instant-runoff voting. In Proceedings of the 2011 Conference on Electronic Voting Technology/Workshop on Trustworthy Elections, EVT/WOTE'11, pages 3–3, Berkeley, CA, USA, 2011. USENIX Association. 80 [CCFC04] Moses Charikar, Kevin Chen, and Martin Farach-Colton. Finding frequent items in data streams. Theor. Comput. Sci., 312(1):3–15, 2004. 110 [CEG95] Ran Canetti, Guy Even, and Oded Goldreich. Lower bounds for sampling algorithms for estimating the average. Information Processing Letters (IPL), 53(1):17–25, 1995. 74, 75, 80, 81 [CFM09] Yousra Chabchoub, Christine Fricker, and Hanene Mohamed. Analysis of a bloom filter algorithm via the supermarket model. In Proc. 21st International Teletraffic Congress, ITC, pages 1–8, 2009. 110 [CH08] Graham Cormode and Marios Hadjieleftheriou. Finding frequent items in data streams. Proc. VLDB Endow., 1(2):1530–1541, 2008. 109 [CKMS08] Graham Cormode, Flip Korn, S. Muthukrishnan, and Divesh Srivastava. Finding hierarchical heavy hitters in streaming data. ACM Trans. Knowl. Discov. Data, 1(4):2:1–2:48, February 2008. 109 [CLMM10] Yann Chevaleyre, J´erome Lang, Nicolas Maudet, and J´erome Monnot. Possible winners when new candidates are added: The case of scoring rules. In Proc. 262 REFERENCES International Conference on Artificial Intelligence (AAAI), pages 762–767, 2010. 143, 173 [CM05] Graham Cormode and S Muthukrishnan. An improved data stream summary: the count-min sketch and its applications. J. Algorithms, 55(1):58–75, 2005. 110 [Con09] Vincent Conitzer. Eliciting single-peaked preferences using comparison queries. J. Artif. Intell. Res., 35:161–191, 2009. 6, 31, 32, 33, 34, 35, 37, 45, 46, 49, 52, 79 [Cor09] Thomas H Cormen. Introduction to algorithms. MIT press, 2009. 25, 37, 38, 57 [Cor12] Graham Cormode. Sketch techniques for massive data. In Graham Cormode, Minos Garofalakis, Peter J. Haas, and Chris Jermaine, editors, Synopses for Mas- sive Data: Samples, Histograms, Wavelets, Sketches, volume 4 of Foundations and Trends in Databases, pages 1–294. Now Publishers Inc., Hanover, MA, USA, Jan- uary 2012. 109 [CP06] Ben Carterette and Desislava Petkova. Learning a ranking from pairwise prefer- ences. In Proc. 29th Annual International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 629–630. ACM, 2006. 115 [CP11] Ioannis Caragiannis and Ariel D. Procaccia. Voting almost maximizes social wel- fare despite limited communication. Artif. Intell., 175(9–10):1655 – 1671, 2011. 111 [CPS14] Ioannis Caragiannis, Ariel D Procaccia, and Nisarg Shah. Modal ranking: A uniquely robust voting rule. In Proc. 28th AAAI Conference on Artificial Intelli- gence (AAAI), pages 616–622, 2014. 73 [CRT06] E. J. Candes, J. Romberg, and T. Tao. Stable signal recovery from incomplete and inaccurate measurements. Commun. Pur. Appl. Math., 59:1207–1223, 2006. 109 [CRX09] Vincent Conitzer, Matthew Rognlie, and Lirong Xia. Preference functions that score rankings and maximum likelihood estimation. In Proc. 21st International 263 REFERENCES Joint Conference on Artificial Intelligence (IJCAI), volume 9, pages 109–115, 2009. 18 [CS02] Vincent Conitzer and Tuomas Sandholm. Vote elicitation: Complexity and strategy-proofness. In Eighteenth National Conference on Artificial Intelligence (AAAI), pages 392–397, 2002. 30, 35, 52, 79 [CS05] Vincent Conitzer and Tuomas Sandholm. Communication complexity of com- mon voting rules. In Proc. 6th ACM conference on Electronic Commerce (EC), pages 78–87. ACM, 2005. 35, 52, 111 [CS06] Vincent Conitzer and Tuomas Sandholm. Nonexistence of voting rules that are usually hard to manipulate. In International Conference on Artificial Intelligence (AAAI), volume 6, pages 627–634, 2006. 208 [CSL07] V. Conitzer, T. Sandholm, and J. Lang. When are elections with few candidates hard to manipulate? J. ACM, 54(3):14, 2007. 169, 208, 213, 233, 234, 245 [CSS99] William W. Cohen, Robert E. Schapire, and Yoram Singer. Learning to order things. J. Artif. Int. Res., 10(1):243–270, May 1999. 4 [CT12] Thomas M Cover and Joy A Thomas. Elements of information theory. John Wiley & Sons, 2012. 23 [CWX11] Vincent Conitzer, Toby Walsh, and Lirong Xia. Dominating manipulations in vot- ing with partial information. In International Conference on Artificial Intelligence (AAAI), volume 11, pages 638–643, 2011. 170, 172, 173, 232 [DB15] Palash Dey and Arnab Bhattacharyya. Sample complexity for winner prediction in elections. In Proc. 2015 International Conference on Autonomous Agents and Multiagent Systems, AAMAS 2015, Istanbul, Turkey, May 4-8, 2015, pages 1421– 1430, 2015. 7, 71, 74, 111, 116, 133 [Dem82] Gabrielle Demange. Single-peaked orders on a tree. Math. Soc. Sci, 3(4):389– 396, 1982. 32, 36 [Dey15] Palash Dey. Computational complexity of fundamental problems in social choice theory. In Proc. 2015 International Conference on Autonomous Agents and Mul- 264 REFERENCES tiagent Systems, pages 1973–1974. International Foundation for Autonomous Agents and Multiagent Systems, 2015. 170 [DF99] Rod G Downey and Michael Ralph Fellows. Parameterized Complexity, volume 3. springer Heidelberg, 1999. 19 [DK16] Britta Dorn and Dominikus Kruger. On the hardness of bribery variants in voting with cp-nets. Ann. Math. Artif. Intell., 77(3-4):251–279, 2016. 227 [DKNS01] Cynthia Dwork, Ravi Kumar, Moni Naor, and D. Sivakumar. Rank aggregation methods for the web. In Proc. 10th International Conference on World Wide Web, WWW '01, pages 613–622, New York, NY, USA, 2001. ACM. 4 [DKNW11] J. Davies, G. Katsirelos, N. Narodytska, and T. Walsh. Complexity of and al- gorithms for borda manipulation. In Proc. International Conference on Artificial Intelligence (AAAI), pages 657–662, 2011. 178, 208, 213, 236, 243, 244 [DKW56] A Dvoretzky, J Kiefer, and J Wolfowitz. Asymptotic minimax character of the sample distribution function and of the classical multinomial estimator. Ann. Math. Stat., 27(3):642 – 669, 1956. 89, 118 [DL13a] Ning Ding and Fangzhen Lin. Voting with partial information: what questions to ask? In Proc. 12th International Conference on Autonomous Agents and Multi- agent Systems (AAMAS), pages 1237–1238. International Foundation for Au- tonomous Agents and Multiagent Systems, 2013. 35, 52, 173 [DL13b] Ning Ding and Fangzhen Lin. Voting with partial information: What questions to ask? In Proceedings of the 2013 International Conference on Autonomous Agents and Multi-agent Systems, AAMAS '13, pages 1237–1238, Richland, SC, 2013. International Foundation for Autonomous Agents and Multiagent Systems. 79 [DLC14] John A Doucette, Kate Larson, and Robin Cohen. Approximate winner selection in social choice with partial preferences. In Proc. 12th International Conference on Autonomous Agents and Multiagent Systems (AAMAS). International Founda- tion for Autonomous Agents and Multiagent Systems, 2014. 79 265 REFERENCES [DLOM02] Erik D Demaine, Alejandro L´opez-Ortiz, and J Ian Munro. Frequency estimation of internet packet streams with limited space. In Proc. 10th Annual European Symposium on Algorithms, pages 348–360. Springer, 2002. 109, 110, 132 [DLS09] M. Dom, D. Lokshtanov, and S. Saurabh. Incompressibility through colors and IDs. In Automata, Languages and Programming (ICALP), 36th International Col- loquium, Part I, volume 5555 of LNCS, pages 378–389, 2009. 144, 146 [DM16a] Palash Dey and Neeldhara Misra. Elicitation for preferences single peaked on trees. In Proc. Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI 2016, New York, NY, USA, 9-15 July 2016, pages 215–221, 2016. 6, 29, 52, 79 [DM16b] Palash Dey and Neeldhara Misra. Preference elicitation for single crossing do- main. In Proc. Twenty-Fifth International Joint Conference on Artificial Intelli- gence, IJCAI 2016, New York, NY, USA, 9-15 July 2016, pages 222–228, 2016. 7, 51, 79 [DMN15a] Palash Dey, Neeldhara Misra, and Y. Narahari. Detecting possible manipulators in elections. In Proc. 2015 International Conference on Autonomous Agents and Multiagent Systems, AAMAS 2015, Istanbul, Turkey, May 4-8, 2015, pages 1441– 1450, 2015. 10, 170, 206 [DMN15b] Palash Dey, Neeldhara Misra, and Y. Narahari. Kernelization complexity of pos- sible winner and coalitional manipulation problems in voting. In Proc. 2015 International Conference on Autonomous Agents and Multiagent Systems, AAMAS 2015, Istanbul, Turkey, May 4-8, 2015, pages 87–96, 2015. 9, 79, 142, 170 [DMN16a] Palash Dey, Neeldhara Misra, and Y. Narahari. Complexity of manipulation with partial information in voting. In Proc. Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI 2016, New York, NY, USA, 9-15 July 2016, pages 229–235, 2016. 10, 168 [DMN16b] Palash Dey, Neeldhara Misra, and Y. Narahari. Frugal bribery in voting. In Proc. Thirtieth AAAI Conference on Artificial Intelligence, February 12-17, 2016, Phoenix, Arizona, USA., pages 2466–2472, 2016. 11, 226 266 REFERENCES [DMN16c] Palash Dey, Neeldhara Misra, and Y. Narahari. Kernelization complexity of pos- sible winner and coalitional manipulation problems in voting. Theor. Comput. Sci., 616:111–125, 2016. 9, 79, 142, 170, 187 [DN13] Swapnil Dhamal and Y Narahari. Scalable preference aggregation in social net- works. In First AAAI Conference on Human Computation and Crowdsourcing (HCOMP), pages 42–50, 2013. 79, 255 [DN14] Palash Dey and Y Narahari. Asymptotic collusion-proofness of voting rules: the case of large number of candidates. In Proc. 13th International Conference on Au- tonomous Agents and Multiagent Systems (AAMAS), pages 1419–1420. Interna- tional Foundation for Autonomous Agents and Multiagent Systems, 2014. 170, 208 [DN15a] Palash Dey and Y Narahari. Asymptotic collusion-proofness of voting rules: The case of large number of candidates. Studies in Microeconomics, 3(2):120–139, 2015. 170 [DN15b] Palash Dey and Y. Narahari. Estimating the margin of victory of an election using sampling. In Proc. Twenty-Fourth International Joint Conference on Artificial Intelligence, IJCAI 2015, Buenos Aires, Argentina, July 25-31, 2015, pages 1120– 1126, 2015. 8, 71 [Dod76] Charles Lutwidge Dodgson. A method of taking votes on more than two issues. 1876. 31 [DS12] Britta Dorn and Ildik´o Schlotter. Multivariate complexity analysis of swap bribery. Algorithmica, 64(1):126–151, 2012. 144, 228 [Dur10] Rick Durrett. Probability: theory and examples. Cambridge university press, 2010. 21 [EE12] Edith Elkind and G´abor Erd´elyi. Manipulation under voting rule uncertainty. In Proc. 11th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 627–634. International Foundation for Autonomous Agents and Multiagent Systems, 2012. 172, 208 267 REFERENCES [EFS09] Edith Elkind, Piotr Faliszewski, and Arkadii Slinko. Swap bribery. In Proc. 2nd International Symposium on Algorithmic Game Theory (SAGT 2009), pages 299– 310. Springer, 2009. 227 [EHH14] Gabor Erdelyi, Edith Hemaspaandra, and Lane A Hemaspaandra. Bribery and voter control under voting-rule uncertainty. In Proc. 13th International Confer- ence on Autonomous Agents and Multiagent Systems (AAMAS), pages 61–68. In- ternational Foundation for Autonomous Agents and Multiagent Systems, 2014. 227 [EJS10] Funda Ergun, Hossein Jowhari, and Mert Saglam. Periodicity in streams. In Proc. 14th Workshop on Randomization and Computation -(RANDOM 2010), pages 545–559. Springer, 2010. 135 [EL05] Edith Elkind and Helger Lipmaa. Hybrid voting protocols and hardness of ma- nipulation. In Algorithms and Computation, pages 206–215. Springer, 2005. 208 [EL14] U Endriss and J Leite. The margin of victory in schulze, cup, and copeland elections: Complexity of the regular and exact variants. In STAIRS 2014: Proc. 7th European Starting AI Researcher Symposium, volume 264, pages 250–259. IOS Press, 2014. 80 [EL15] Edith Elkind and Martin Lackner. Structure in dichotomous preferences. In Proc. Twenty-Fourth International Joint Conference on Artificial Intelligence, IJCAI 2015, Buenos Aires, Argentina, July 25-31, 2015, pages 2019–2025, 2015. 254 [ER91] E. Ephrati and J.S. Rosenschein. The Clarke tax as a consensus mechanism among automated agents. In Proc. Ninth International Conference on Artificial Intelligence (AAAI), pages 173–178, 1991. 78 [ER93] Eithan Ephrati and Jeffrey S. Rosenschein. Multi-agent planning as a dynamic search for social consensus. In Proc. Thirteenth International Joint Conference on Artificial Intelligence, pages 423–429, Chambery, France, August 1993. 4 [EV03] Cristian Estan and George Varghese. New directions in traffic measurement and accounting: Focusing on the elephants, ignoring the mice. Theor. Comput. Syst., 21(3):270–313, 2003. 109, 110 268 REFERENCES [Fal08] Piotr Faliszewski. Nonuniform bribery. In Proce. 7th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 1569–1572. In- ternational Foundation for Autonomous Agents and Multiagent Systems, 2008. 227, 235 [FG06] Jorg Flum and Martin Grohe. Parameterized Complexity Theory, volume 3. Springer, 2006. 19 [FHH06] Piotr Faliszewski, Edith Hemaspaandra, and Lane A Hemaspaandra. The com- plexity of bribery in elections. In Proc. 21st International Conference on Artificial Intelligence (AAAI), volume 6, pages 641–646, 2006. 80, 227, 232, 235 [FHH09] Piotr Faliszewski, Edith Hemaspaandra, and Lane A. Hemaspaandra. How hard is bribery in elections? J. Artif. Int. Res., 35(1):485–532, July 2009. 80, 213, 227, 233 [FHH10] Piotr Faliszewski, Edith Hemaspaandra, and Lane A Hemaspaandra. Using com- plexity to protect elections. Commun ACM, 53(11):74–82, 2010. 170, 208 [FHH13] Piotr Faliszewski, Edith Hemaspaandra, and Lane A Hemaspaandra. Weighted electoral control. In Proc. 12th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 367–374. International Foundation for Autonomous Agents and Multiagent Systems, 2013. 208 [FHHR09] Piotr Faliszewski, Edith Hemaspaandra, Lane A. Hemaspaandra, and Jorg Rothe. Llull and copeland voting computationally resist bribery and constructive con- trol. J. Artif. Intell. Res., 35:275–341, 2009. 178, 227 [FHS08] P. Faliszewski, E. Hemaspaandra, and H. Schnoor. Copeland voting: Ties mat- ter. In Proc. 7th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 983–990. International Foundation for Autonomous Agents and Multiagent Systems, 2008. 143, 178 [FHS10] P. Faliszewski, E. Hemaspaandra, and H. Schnoor. Manipulation of copeland elections. In Proc. 9th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 367–374. International Foundation for Au- tonomous Agents and Multiagent Systems, 2010. 143, 178 269 REFERENCES [FKN08] E. Friedgut, G. Kalai, and N. Nisan. Elections can be manipulated often. In IEEE 49th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 243–249. IEEE, 2008. 170, 208 [FKS03] Ronald Fagin, Ravi Kumar, and D. Sivakumar. Efficient similarity search and classification via rank aggregation. In Proc. 2003 ACM SIGMOD International Conference on Management of Data, SIGMOD '03, pages 301–312, New York, NY, USA, 2003. ACM. 4 [Fla85] Philippe Flajolet. Approximate counting: a detailed analysis. BIT Numer. Math., 25(1):113–134, 1985. 134 [FMT12] Dvir Falik, Reshef Meir, and Moshe Tennenholtz. On coalitions and stable win- ners in plurality. In 8th International Workshop on Internet and Network Eco- nomics (WINE), pages 256–269. Springer, 2012. 79 [FP10] Piotr Faliszewski and Ariel D Procaccia. Ai's war on manipulation: Are we win- ning? AI Magazine, 31(4):53–64, 2010. 208, 256 [FRRS14] Piotr Faliszewski, Yannick Reisch, Jorg Rothe, and Lena Schend. Complexity of manipulation, bribery, and campaign management in bucklin and fallback vot- ing. In Proc. 13th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 1357–1358. International Foundation for Autonomous Agents and Multiagent Systems, 2014. 143, 208, 227 [FSG+98] Min Fang, Narayanan Shivakumar, Hector Garcia-Molina, Rajeev Motwani, and Jeffrey D. Ullman. Computing iceberg queries efficiently. In Proc. 24rd Interna- tional Conference on Very Large Data Bases, pages 299–310, 1998. 109 [FVBNS13] Vincent Froese, Ren´e Van Bevern, Rolf Niedermeier, and Manuel Sorge. A pa- rameterized complexity analysis of combinatorial feature selection problems. In Mathematical Foundations of Computer Science (MFCS), pages 445–456. Springer, 2013. 144 [Gae01] Wulf Gaertner. Domain Conditions in Social Choice Theory. Cambridge University Press, 2001. 207 270 REFERENCES [Gib73] A. Gibbard. Manipulation of voting schemes: a general result. Econometrica, pages 587–601, 1973. 4, 31, 169, 207 [GJ79] Michael R Garey and David S Johnson. Computers and Intractability, volume 174. freeman New York, 1979. 178, 222, 245 [GKNW13] Serge Gaspers, Thomas Kalinowski, Nina Narodytska, and Toby Walsh. Coali- tional manipulation for schulze's rule. In Proc. 12th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 431–438. Interna- tional Foundation for Autonomous Agents and Multiagent Systems, 2013. 208 [GN07] Jiong Guo and Rolf Niedermeier. Invitation to data reduction and problem ker- nelization. ACM SIGACT News, 38(1):31–45, 2007. 19 [GNNW14] Serge Gaspers, Victor Naroditskiy, Nina Narodytska, and Toby Walsh. Possi- ble and necessary winner problem in social polls. In Proc. 13th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 613– 620. International Foundation for Autonomous Agents and Multiagent Systems, 2014. 173 [GSTV07] Anna C. Gilbert, Martin J. Strauss, Joel A. Tropp, and Roman Vershynin. One sketch for all: fast algorithms for compressed sensing. In Proc. 39th Annual ACM Symposium on Theory of Computing, San Diego, California, USA, June 11-13, 2007, pages 237–246, 2007. 109 [HAKW08] Noam Hazon, Yonatan Aumann, Sarit Kraus, and Michael Wooldridge. Evalua- tion of election outcomes under uncertainty. In Proc. 7th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 959–966. Inter- national Foundation for Autonomous Agents and Multiagent Systems, 2008. 79 [Hei93] Katherine Heinrich. Path decomposition. Le matematiche, 47(2):241–258, 1993. 23 [HHR97] Edith Hemaspaandra, Lane A Hemaspaandra, and Jorg Rothe. Exact analysis of dodgson elections: Lewis carroll's 1876 voting system is complete for parallel access to np. Journal of the ACM (JACM), 44(6):806–825, 1997. 31, 78 271 REFERENCES [HHS94] Tin Kam Ho, Jonathan J Hull, and Sargur N Srihari. Decision combination in multiple classifier systems. IEEE Trans. Pattern Anal. Mach. Intell., 16(1):66–75, 1994. 115 [Hid99] Christian Hidber. Online association rule mining. In Proc. ACM SIGMOD Inter- national Conference on Management of Data, pages 145–156, 1999. 109 [HKTR04] Jonathan L Herlocker, Joseph A Konstan, Loren G Terveen, and John T Riedl. Evaluating collaborative filtering recommender systems. ACM Trans. Inf. Syst., 22(1):5–53, 2004. 115 [HLK13] Noam Hazon, Raz Lin, and Sarit Kraus. How to change a groups collective decision? In Proc. 23rd International Joint Conference on Artificial Intelligence (IJCAI), pages 198–205, 2013. 232 [HM97] Mel vin J Hinich and Michael C Munger. Analytical politics. Cambridge University Press, 1997. 31 [HPDW01] Jiawei Han, Jian Pei, Guozhu Dong, and Ke Wang. Efficient computation of iceberg cubes with complex measures. In Proc. 2001 ACM SIGMOD International Conference on Management of Data,, pages 1–12, 2001. 109 [HPY00] Jiawei Han, Jian Pei, and Yiwen Yin. Mining frequent patterns without candidate generation. In Proc. 2000 ACM SIGMOD International Conference on Management of Data, pages 1–12, 2000. 109 [HSST05] John Hershberger, Nisheeth Shrivastava, Subhash Suri, and Csaba D. T´oth. Space complexity of hierarchical heavy hitters in multi-dimensional data streams. In Proc. Twenty-fourth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, pages 338–347, 2005. 109 [HSV05] Edith Hemaspaandra, Holger Spakowski, and Jorg Vogel. The complexity of kemeny elections. THEOR COMPUT SCI, 349(3):382–391, 2005. 31, 78 [HUA83] John E Hopcroft, Jeffrey David Ullman, and Alfred Vaino Aho. Data structures and algorithms, volume 175. Addison-Wesley Boston, MA, USA:, 1983. 40 272 REFERENCES [IKM12] M. Isaksson, G. Kindler, and E. Mossel. The geometry of manipulation - a quan- titative proof of the gibbard-satterthwaite theorem. Combinatorica, 32(2):221– 250, 2012. 170, 208 [JMP+14] Albert Jiang, Leandro Soriano Marcolino, Ariel D Procaccia, Tuomas Sandholm, Nisarg Shah, and Milind Tambe. Diverse randomized agents vote to win. In Proc. Annual Conference on Neural Information Processing Systems, pages 2573–2581, 2014. 115 [JSA08] Benjamin G. Jackson, Patrick S. Schnable, and Srinivas Aluru. Consensus genetic maps as median orders from inconsistent sources. IEEE/ACM Trans. Comput. Biology Bioinform., 5(2):161–171, 2008. 4 [Kem59] John G Kemeny. Mathematics without numbers. Daedalus, 88(4):577–591, 1959. 31 [KKMO07] Subhash Khot, Guy Kindler, Elchanan Mossel, and Ryan O'Donnell. Optimal in- approximability results for max-cut and other 2-variable csps? SIAM J. Comput., 37(1):319–357, April 2007. 5 [KL51] Solomon Kullback and Richard A Leibler. On information and sufficiency. Ann. Math. Stat., pages 79–86, 1951. 21 [KL05] Kathrin Konczak and J´erome Lang. Voting procedures with incomplete prefer- ences. In Proc. International Joint Conference on Artificial Intelligence-05 Mul- tidisciplinary Workshop on Advances in Preference Handling, volume 20, 2005. 143, 172, 173 [KN97] Eyal Kushilevitz and Noam Nisan. Communication Complexity. Cambridge Uni- versity Press, New York, NY, USA, 1997. 20, 135 [KNR99] Ilan Kremer, Noam Nisan, and Dana Ron. On randomized one-round communi- cation complexity. Comput. Complex., 8(1):21–49, 1999. 111, 136 [KSP03] Richard M Karp, Scott Shenker, and Christos H Papadimitriou. A simple algo- rithm for finding frequent elements in streams and bags. ACM Trans. Database Syst., 28(1):51–55, 2003. 110 273 REFERENCES [KTW11] Peter Kellner, Joe Twyman, and Anthony Wells. Polling voting intentions. In Political Communication in Britain, pages 94–108. Springer, 2011. 115 [KX06] Abhishek Kumar and Jun (Jim) Xu. Sketch guided sampling - using on-line esti- mates of flow size for adaptive data collection. In Proc. 25th IEEE International Conference on Computer Communications, Joint Conference of the IEEE Computer and Communications Societies, 2006. 110 [LB11a] Tyler Lu and Craig Boutilier. Robust approximation and incremental elicitation in voting protocols. In Proc. 22nd International Joint Conference on Artificial Intelligence (IJCAI), volume 22, pages 287–293, 2011. 35, 52, 79 [LB11b] Tyler Lu and Craig Boutilier. Vote elicitation with probabilistic preference mod- els: Empirical estimation and cost tradeoffs. In Algorithmic Decision Theory, pages 135–149. Springer, 2011. 35, 52, 79 [LB13] Tyler Lu and Craig Boutilier. Multi-winner social choice with incomplete pref- erences. In Proc. 23rd International Joint Conference on Artificial Intelligence (IJCAI), pages 263–270. AAAI Press, 2013. 79 [Li14] Hang Li. Learning to rank for information retrieval and natural language pro- cessing. In Synthesis Lectures on Human Language Technologies, volume 7, pages 1–121. Morgan & Claypool Publishers, 2014. 115 [Lin91] Jianhua Lin. Divergence measures based on the shannon entropy. IEEE Trans. Inf. Theory, 37(1):145–151, 1991. 21 [LN06] Alessandra Lumini and Loris Nanni. Detector of image orientation based on borda count. Pattern Recogn. Lett., 27(3):180–186, 2006. 115 [LNNT16] Kasper Green Larsen, Jelani Nelson, Huy Le Nguyen, and Mikkel Thorup. Heavy hitters via cluster-preserving clustering. arXiv:1604.01357, April 2016. 112 [LPR+07] J´erome Lang, Maria Silvia Pini, Francesca Rossi, Kristen Brent Venable, and Toby Walsh. Winner determination in sequential majority voting. In Proc. 20th In- ternational Joint Conference on Artificial Intelligence (IJCAI), volume 7, pages 1372–1377, 2007. 143 274 REFERENCES [LPR+12] J´erome Lang, Maria Silvia Pini, Francesca Rossi, Domenico Salvagnin, Kris- ten Brent Venable, and Toby Walsh. Winner determination in voting trees with incomplete preferences and weighted votes. Auton. Agent Multi Agent Syst., 25(1):130–157, 2012. 143 [MAE05] Ahmed Metwally, Divyakant Agrawal, and Amr El Abbadi. Efficient computation of frequent and top-k elements in data streams. In Proc. 10th International Con- ference on Database Theory, ICDT'05, pages 398–412, Berlin, Heidelberg, 2005. Springer-Verlag. 110 [MBC+16] Herv´e Moulin, Felix Brandt, Vincent Conitzer, Ulle Endriss, J´erome Lang, and Ariel D Procaccia. Handbook of Computational Social Choice. Cambridge Univer- sity Press, 2016. 5, 52, 79 [MBG04] Am´elie Marian, Nicolas Bruno, and Luis Gravano. Evaluating top-k queries over web-accessible databases. ACM Trans. Database Syst., 29(2):319–362, 2004. 111 [McG53] David C McGarvey. A theorem on the construction of voting paradoxes. Econo- metrica, pages 608–610, 1953. 149 [MCWG95] Andreu Mas-Collel, Michael D Whinston, and Jerry Green. Microeconomic the- ory, 1995. 46, 207 [MG82] Jayadev Misra and David Gries. Finding repeated elements. Sci. Comput. Pro- gram., 2(2):143–152, 1982. 110, 121 [MG09] Md Maruf Monwar and Marina L Gavrilova. Multimodal biometric system using rank-level fusion approach. IEEE Trans. Syst. Man. Cybern. B, Cybern., 39(4):867–878, 2009. 115 [Mir71] James A Mirrlees. An exploration in the theory of optimum income taxation. Rev. Econ. Stud., pages 175–208, 1971. 52 [ML15] Vijay Menon and Kate Larson. Complexity of manipulation in elections with partial votes. CoRR, abs/1505.05900, 2015. 173 275 REFERENCES [MM02] Gurmeet Singh Manku and Rajeev Motwani. Approximate frequency counts over data streams. In Proc. 28th International Conference on Very Large Data Bases, pages 346–357. VLDB Endowment, 2002. 110 [MNSW98] Peter Bro Miltersen, Noam Nisan, Shmuel Safra, and Avi Wigderson. On data structures and asymmetric communication complexity. J. Comput. Syst. Sci., 57(1):37–49, 1998. 136 [Moo81] J. Strother Moore. J. Algorithm, June 1981. p. 208–209. 115 [MOO05] Elchanan Mossel, Ryan O'Donnell, and Krzysztof Oleszkiewicz. Noise stability of functions with low in.uences invariance and optimality. In Proc. 46th Annual IEEE Symposium on Foundations of Computer Science (FOCS 2005), 23-25 October 2005, Pittsburgh, PA, USA, Proceedings, pages 21–30, 2005. 5 [Mor78] Robert Morris. Counting large numbers of events in small registers. Commun. ACM, 21(10):840–842, 1978. 134 [Mou91] Hervi Moulin. Axioms of cooperative decision making. Number 15. Cambridge University Press, 1991. 31 [MPC12] Andrew Mao, Ariel D. Procaccia, and Yiling Chen. Social Choice for Human Computation. In Proc. Fourth Workshop on Human Computation (HCOMP-12), 2012. 115 [MPC13] Andrew Mao, Ariel D. Procaccia, and Yiling Chen. Better Human Computation Through Principled Voting. In Proc. 27th Conference on Artificial Intelligence (AAAI'13), AAAI'13, pages 1142–1148. AAAI Press, 2013. 115 [MPVR12] Nicholas Mattei, Maria Silvia Pini, K Brent Venable, and Francesca Rossi. Bribery in voting over combinatorial domains is easy. In Proc. 11th International Con- ference on Autonomous Agents and Multiagent Systems (AAMAS), pages 1407– 1408. International Foundation for Autonomous Agents and Multiagent Sys- tems, 2012. 227 [MR81] Allan Meltzer and Scott F Richard. A rational theory of the size of government. J Public Econ, 89(5):914–27, 1981. 52 276 REFERENCES [MR91] D.J. Mullen and B. Roth. Decision making: Its logic and practice. Savage, MD: Rowman and Littlefield Publishers, Inc., 1991. 115 [MR15] Elchanan Mossel and Mikl´os Z R´acz. A quantitative gibbard-satterthwaite theo- rem without neutrality. Combinatorica, 35(3):317–387, 2015. 208 [MRSW11] Thomas R Magrino, Ronald L Rivest, Emily Shen, and David Wagner. Computing the margin of victory in IRV elections. In Proceedings of the 2011 Conference on Electronic Voting Technology/Workshop on Trustworthy Elections, EVT/WOTE'11, pages 4–4, Berkeley, CA, USA, 2011. USENIX Association. 80 [Mut05] Shanmugavelayutham Muthukrishnan. Data streams: Algorithms and applica- tions. Now Publishers Inc, 2005. 109 [MYCC07] Nikos Mamoulis, Man Lung Yiu, Kit Hung Cheng, and David W. Cheung. Efficient top-k aggregation of ranked inputs. ACM Trans. Database Syst, 32(3):19–64, 2007. 111 [NC06] Rabia Nuray and Fazli Can. Automatic ranking of information retrieval systems using data fusion. Inf. Process Manag., 42(3):595–614, 2006. 115 [Nel12] Jelani Nelson. Sketching and streaming algorithms for processing massive data. XRDS: Crossroads, The ACM Magazine for Students, 19(1):14–19, 2012. 109 [Nie02] Rolf Niedermeier. Invitation to fixed-parameter algorithms. Habilitationschrift, University of Tubingen, 2002. 19 [NL07] Lawrence Norden and Samuelson Law. Post-election audits: Restoring trust in elections. University of California, Berkeley School of Law Boalt Hall, 2007. 73, 74 [NW13] Nina Narodytska and Toby Walsh. Manipulating two stage voting rules. In Proc. 12th International Conference on Autonomous Agents and Multiagent Systems (AA- MAS), pages 423–430. International Foundation for Autonomous Agents and Multiagent Systems, 2013. 208 [NW14] Nina Narodytska and Toby Walsh. The computational impact of partial votes on strategic voting. In Proc. 21st European Conference on Artificial Intelligence, 277 REFERENCES 18-22 August 2014, Prague, Czech Republic - Including Prestigious Applications of Intelligent Systems (PAIS 2014), pages 657–662, 2014. 173 [NWX11] N. Narodytska, T. Walsh, and L. Xia. Manipulation of nanson's and baldwin's rules. In Proc. International Conference on Artificial Intelligence (AAAI), pages 713–718, 2011. 208 [O'D14] Ryan O'Donnell. Analysis of Boolean Functions. Cambridge University Press, New York, NY, USA, 2014. 5 [OE12] Svetlana Obraztsova and Edith Elkind. Optimal manipulation of voting rules. In Proc. 11th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 619–626. International Foundation for Autonomous Agents and Multiagent Systems, 2012. 208 [OEH11] Svetlana Obraztsova, Edith Elkind, and Noam Hazon. Ties matter: Complexity of voting manipulation revisited. In The 10th International Conference on Au- tonomous Agents and Multiagent Systems (AAMAS), pages 71–78. International Foundation for Autonomous Agents and Multiagent Systems, 2011. 208 [OFB13] Joel Oren, Yuval Filmus, and Craig Boutilier. Efficient vote elicitation under candidate uncertainty. In Proc. 23rd International Joint Conference on Artificial Intelligence (IJCAI), pages 309–316. AAAI Press, 2013. 79 [PE16] Dominik Peters and Edith Elkind. Preferences single-peaked on nice trees. In Proc. 30th International Conference on Artificial Intelligence (AAAI), pages 594– 600, 2016. 32 [PHG00] David M. Pennock, Eric Horvitz, and C. Lee Giles. Social choice theory and recommender systems: Analysis of the axiomatic foundations of collaborative filtering. In Proc. Seventeenth National Conference on Artificial Intelligence and Twelfth Conference on on Innovative Applications of Artificial Intelligence, July 30 - August 3, 2000, Austin, Texas, USA., pages 729–734, 2000. 4, 78 [plu] Plurality voting system. https://en.wikipedia.org/wiki/Plurality_voting_system. 2 278 REFERENCES [PPR15] Adarsh Prasad, Harsh Pareek, and Pradeep Ravikumar. Distributional rank ag- gregation, and an axiomatic analysis. In Proc. 32nd International Conference on Machine Learning (ICML-15), pages 2104–2112, 2015. 115 [PR06] A.D. Procaccia and J.S. Rosenschein. Junta distributions and the average-case complexity of manipulating elections. In Proc. Fifth International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 497–504. ACM, 2006. 170, 208, 256 [PR07] Ariel D. Procaccia and Jeffrey S. Rosenschein. Average-case tractability of ma- nipulation in voting via the fraction of manipulators. In Proc. 6th International Joint Conference on Autonomous Agents and Multiagent Systems (AAMAS 2007), Honolulu, Hawaii, USA, May 14-18, 2007, pages 718–720, 2007. 170, 208 [PRV13] Maria Silvia Pini, Francesca Rossi, and Kristen Brent Venable. Bribery in voting with soft constraints. In Proc. International Conference on Artificial Intelligence (AAAI), AAAI'13, pages 803–809. AAAI Press, 2013. 227 [PRVW07] Maria Silvia Pini, Francesca Rossi, Kristen Brent Venable, and Toby Walsh. In- completeness and incomparability in preference aggregation. In Proc. 20nd In- ternational Joint Conference on Artificial Intelligence (IJCAI), volume 7, pages 1464–1469, 2007. 143 [RGMT06] Michel Regenwetter, Bernard Grofman, Anthony Marley, and Ilia Tsetlin. Behav- ioral social choice. Cambridge University Press, 13:58–68, 2006. 73 [Rob77] Kevin Roberts. Voting over income tax schedules. J Public Econ, 8(3):329–340, 1977. 52 [Ron01] Dana Ron. Property testing. Combinatorial Optimization-Dordrecht, 9(2):597– 643, 2001. 79 [RR67] Hartley Rogers and H Rogers. Theory of recursive functions and effective com- putability, volume 126. McGraw-Hill New York, 1967. 232 [RSW+07] Marko A Rodriguez, Daniel J Steinbock, Jennifer H Watkins, Carlos Gershenson, Johan Bollen, Victor Grey, and Brad Degraf. Smartocracy: Social networks for 279 REFERENCES collective decision making. In In 40th Annual Hawaii International Conference on Systems Science (HICSS'07). Waikoloa, pages 90–99. IEEE, 2007. 78 [RV97] Paul Resnick and Hal R Varian. Recommender systems. Commun. ACM, 40(3):56–58, 1997. 115 [Sat75] M.A. Satterthwaite. Strategy-proofness and Arrow's conditions: Existence and correspondence theorems for voting procedures and social welfare functions. J. Econ. Theory, 10(2):187–217, 1975. 4, 31, 169, 207 [SBAS04] Nisheeth Shrivastava, Chiranjeeb Buragohain, Divyakant Agrawal, and Subhash Suri. Medians and beyond: new aggregation techniques for sensor networks. In Proc. 2nd International Conference on Embedded Networked Sensor Systems, pages 239–249, 2004. 109 [SCS11] Anand Sarwate, Stephen Checkoway, and Hovav Shacham. Risk-limiting audits for nonplurality elections. Technical report, DTIC Document, 2011. 74 [Smi88] D. Smirnov. Shannon's information methods for lower bounds for probabilistic communication complexity. Master's thesis, Moscow University, 1988. 136 [SON95] Ashok Savasere, Edward Omiecinski, and Shamkant B. Navathe. An efficient algorithm for mining association rules in large databases. In Proc. 21th Interna- tional Conference on Very Large Data Bases, pages 432–444, 1995. 109 [Sta08a] Philip B Stark. Conservative statistical post-election audits. Ann. Appl. Stat., pages 550–581, 2008. 74 [Sta08b] Philip B Stark. A sharper discrepancy measure for post-election audits. Ann. Appl. Stat., pages 982–985, 2008. 74 [Sta09] Philip B Stark. Efficient post-election audits of multiple contests: 2009 california tests. In CELS 2009 4th Annual Conference on Empirical Legal Studies Paper, 2009. 74 [SW15] Xiaoming Sun and David P. Woodruff. Tight bounds for graph problems in inser- tion streams. In Proc. 18th. International Workshop on Approximation Algorithms for Combinatorial Optimization Problems (APPROX 2015), pages 435–448, 2015. 135 280 REFERENCES [SYE13] Dmitry Shiryaev, Lan Yu, and Edith Elkind. On elections with robust winners. In Proc. 12th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 415–422. International Foundation for Autonomous Agents and Multiagent Systems, 2013. 73, 79 [Toi96] Hannu Toivonen. Sampling large databases for association rules. In Proc. 22th International Conference on Very Large Data Bases, pages 134–145, 1996. 109 [Tri89] Michael A Trick. Recognizing single-peaked preferences on a tree. Math. Soc. Sci, 17(3):329–334, 1989. 32 [VWWZ15] Dirk Van Gucht, Ryan Williams, David P Woodruff, and Qin Zhang. The commu- nication complexity of distributed set-joins with applications to matrix multipli- cation. In Proc. 34th ACM Symposium on Principles of Database Systems, pages 199–212. ACM, 2015. 139 [VZ14] Maksims N Volkovs and Richard S Zemel. New learning methods for supervised and unsupervised preference aggregation. J. Mach. Learn. Res., 15(1):1135– 1176, 2014. 115 [Wag15] Bo Waggoner. Lp testing and learning of discrete distributions. In Proc. 2015 Conference on Innovations in Theoretical Computer Science, ITCS '15, pages 347– 356, New York, NY, USA, 2015. ACM. 89 [Wal07] Toby Walsh. Uncertainty in preference elicitation and aggregation. In Proc. International Conference on Artificial Intelligence (AAAI), volume 22, pages 3–8, 2007. 143 [Wal10] T. Walsh. An empirical study of the manipulability of single transferable voting. In Proc. 19th European Conference on Artificial Intelligence (ECAI), pages 257– 262, 2010. 170, 208, 256 [Wal11a] Toby Walsh. Is computational complexity a barrier to manipulation? Ann Math Artif Intell, 62(1-2):7–26, 2011. 208 [Wal11b] Toby Walsh. Where are the hard manipulation problems? J. Artif. Intell. Res., pages 1–29, 2011. 170 281 REFERENCES [WL04] Gang Wang and Frederick H Lochovsky. Feature selection with conditional mu- tual information maximin in text categorization. In Proc. 13th ACM International Conference on Information and Knowledge Management, pages 342–349. ACM, 2004. 115 [WWH+10] Scott Wolchok, Eric Wustrow, J Alex Halderman, Hari K Prasad, Arun Kankipati, Sai Krishna Sakhamuri, Vasavya Yagati, and Rop Gonggrijp. Security analysis of india's electronic voting machines. In Proc. 17th ACM Conference on Computer and Communications Security, pages 1–14. ACM, 2010. 73 [XC08a] Lirong Xia and Vincent Conitzer. Generalized scoring rules and the frequency of coalitional manipulability. In Proc. 9th ACM conference on Electronic Commerce (EC), pages 109–118. ACM, 2008. 170, 208 [XC08b] Lirong Xia and Vincent Conitzer. A sufficient condition for voting rules to be frequently manipulable. In Proc. 9th ACM conference on Electronic Commerce (EC), pages 99–108. ACM, 2008. 170, 208 [XC11] Lirong Xia and Vincent Conitzer. Determining possible and necessary winners under common voting rules given partial orders. volume 41, pages 25–67. AI Access Foundation, 2011. 143, 149, 173, 179, 203, 255 [XCP10] Lirong Xia, Vincent Conitzer, and Ariel D Procaccia. A scheduling approach to coalitional manipulation. In Proc. 11th ACM conference on Electronic Commerce (EC), pages 275–284. ACM, 2010. 208, 244 [Xia12] Lirong Xia. Computing the margin of victory for various voting rules. In Proc. 13th ACM Conference on Electronic Commerce (EC), pages 982–999. ACM, 2012. 78, 79, 91, 104, 111, 213, 227 [XZP+09] Lirong Xia, Michael Zuckerman, Ariel D Procaccia, Vincent Conitzer, and Jef- frey S Rosenschein. Complexity of unweighted coalitional manipulation under some common voting rules. In Proc. 21st International Joint Conference on Arti- ficial Intelligence (IJCAI), volume 9, pages 348–352, 2009. 143, 144, 170, 171, 178, 208, 219, 235, 241, 242 [Yan14] Yongjie Yang. Election attacks with few candidates. In ECAI 2014 - 21st European Conference on Artificial Intelligence, 18-22 August 2014, Prague, Czech Republic - 282 REFERENCES Including Prestigious Applications of Intelligent Systems (PAIS 2014), pages 1131– 1132, 2014. 144 [Yao79] Andrew Chi-Chih Yao. Some complexity questions related to distributive com- puting (preliminary report). In Proc. eleventh annual ACM symposium on Theory of computing, pages 209–213. ACM, 1979. 20 [YCE13] Lan Yu, Hau Chan, and Edith Elkind. Multiwinner elections under preferences that are single-peaked on a tree. In Proc. Twenty-Third International Joint Con- ference on Artificial Intelligence (IJCAI), pages 425–431. AAAI Press, 2013. 32 [YG13] Yongjie Yang and Jiong Guo. Exact algorithms for weighted and unweighted borda manipulation problems. In Proc. 2013 International Conference on Au- tonomous Agents and Multi-agent Systems, AAMAS '13, pages 1327–1328, Rich- land, SC, 2013. International Foundation for Autonomous Agents and Multia- gent Systems. 144 [YHL04] Wenci Yu, Han Hoogeveen, and Jan Karel Lenstra. Minimizing makespan in a two-machine flow shop with delays and unit-time operations is np-hard. J. of Scheduling, 7(5):333–348, September 2004. 236 [You77] H Peyton Young. Extending condorcet's rule. J. Econ. Theory, 16(2):335–353, 1977. 31 [ZLR11] Michael Zuckerman, Omer Lev, and Jeffrey S Rosenschein. An algorithm for the coalitional manipulation problem under maximin. In The 10th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 845– 852. International Foundation for Autonomous Agents and Multiagent Systems, 2011. 208 283
1901.11453
2
1901
2019-02-02T09:33:29
The SuperM-Tree: Indexing metric spaces with sized objects
[ "cs.DS" ]
A common approach to implementing similarity search applications is the usage of distance functions, where small distances indicate high similarity. In the case of metric distance functions, metric index structures can be used to accelerate nearest neighbor queries. On the other hand, many applications ask for approximate subsequences or subsets, e.g. searching for a similar partial sequence of a gene, for a similar scene in a movie, or for a similar object in a picture which is represented by a set of multidimensional features. Metric index structures such as the M-Tree cannot be utilized for these tasks because of the symmetry of the metric distance functions. In this work, we propose the SuperM-Tree as an extension of the M-Tree where approximate subsequence and subset queries become nearest neighbor queries. In order to do this, we introduce metric subset spaces as a generalized concept of metric spaces. Various metric distance functions can be extended to metric subset distance functions, e.g. the Euclidean distance (on windows), the Hausdorff distance (on subsets), the Edit distance and the Dog-Keeper distance (on subsequences). We show that these examples subsume the applications mentioned above.
cs.DS
cs
The SuperM-Tree: Indexing metric spaces with sized objects Jorg P. Bachmann1 1 [email protected] February 5, 2019 Abstract subsume the applications mentioned above. A common approach to implementing similarity search applications is the usage of distance func- tions, where small distances indicate high simi- larity. In the case of metric distance functions, metric index structures can be used to acceler- ate nearest neighbor queries. On the other hand, many applications ask for approximate subse- quences or subsets, e. g. searching for a similar partial sequence of a gene, for a similar scene in a movie, or for a similar object in a picture which is represented by a set of multidimensional features. Metric index structures such as the M- Tree cannot be utilized for these tasks because of the symmetry of the metric distance functions. In this work, we propose the SuperM-Tree as an extension of the M-Tree where approximate subsequence and subset queries become nearest neighbor queries. In order to do this, we intro- duce metric subset spaces as a generalized con- cept of metric spaces. Various metric distance functions can be extended to metric subset dis- tance functions, e. g. the Euclidean distance (on windows), the Hausdorff distance (on subsets), the Edit distance and the Dog-Keeper distance (on subsequences). We show that these examples 1 Introduction common index structure used The most systems in relational database management (RDBMSs) is the B+-Tree [8], which provides fast range queries on linearly ordered data. The R∗-Tree [3] is the usual index structure used to index multi dimensional data and offers the ca- pability for fast multi dimensional range queries. Numerous specific index structures exist to offer more expressive queries on more complex data types. This includes index structures for sets and set containment joins [12, 13, 16], for strings and similarity search regarding the Edit distance [15], and for nearest neighbor queries in any metric space [7, 6, 5, 14]. On the other hand, metric index structures are more generic and support range queries on a wide range of different complex data types. Examples are the Euclidean distance on se- quences of the same length, the Edit distance (ED) and the Dog-Keeper distance (DK) on se- quences or multi-dimensional trajectories of ar- bitrary lengths [1, 2], and the Hausdorff distance on sets (e. g. on sets of integers and sets of fea- 1 ture vectors). However, the symmetry of a met- ric strongly constrains the expressiveness of the queries and prevents containment queries which ask for subsequences, subsets, and the like. SuperM-Tree on three different subset distance functions and show that the speedup against a linear scan search algorithm increases with in- creasing size of the datasets. In order to support approximate subset queries, we need to disregard the symmetry of the metric axioms and we need a relation regard- ing the size of the objects. Hence, we introduce the metric subset space (M, d,(cid:118)) consisting of a set of objects M, an (asym-) metric function d and a total preorder (cid:118) ordering the objects by their size. We also reduce the necessity of the triangle inequality, such that the triangle in- equality d(x, z) (cid:54) d(x, y) + d(y, z) only needs to hold for objects x, y, z ∈ M with x (cid:118) y (cid:118) z. Based on the M-Tree, we propose the SuperM- Tree which indexes metric subset spaces. The SuperM-Tree supports k nearest neighbor and ε nearest neighbor queries: Given a query object q, the result of a sub query consists of objects p, such that p (cid:118) q (p is not larger than q) and p is similar to a part of q (regarding the met- ric subset distance function). As a demonstra- tion of the generality of metric subset spaces, we provide several examples including approxi- mate set containment queries and subsequence queries with various distance functions, such as the Euclidean distance (on windows), the Haus- dorff distance (on subsets), and the Dog-Keeper distance (on subsequences). In summary, we propose a general index struc- ture for database systems, which supports natu- ral types of queries for a wide range of multime- dia data types. The rest of the paper is structured as follows: We describe the concept of subset metrics in Sec- tion 2 including examples. Section 3 introduces the datastructure of the SuperM-Tree and the al- gorithms for insertion and searching of objects. In Section 4 we evaluate the efficiency of the 2 1.1 Notation A defines B is denoted by A := B or A :⇔ B. For finite sequences T , T denotes the number of elements in that sequence and Ti denotes the i-th element in the sequence. Subsequences of T starting at i with a length of (cid:96) are denoted by T (cid:96) i . Positive integers including zero are denoted by N and positive real numbers including zero are denoted by R(cid:62)0. 2 Metric Subset Spaces Consider a set of objects M, for example sequences of arbitrary lengths or sets of k- dimensional vectors. Natural queries put objects in a certain "containment" relationship when they ask for subsets or subsequences. We de- scribe this containment relationship by a total preorder (denoted with '(cid:118)'). Intuitively, this re- lationship requires for each pair of objects x and y, that x is either not larger, not smaller, or nei- ther larger nor smaller than y. We also relax the triangle inequality by only asking for it on transitive chains, i. e. d(x, z) (cid:54) d(x, y) + d(y, z) if x (cid:118) y (cid:118) z. Definition 1 (Total Preorder). A total preorder on M is a relation (cid:118) on M × M, such that ∀x ∈ M :x (cid:118) x ∀x, y ∈ M :x (cid:118) y ∨ y (cid:118) x ∀x, y, z ∈ M :x (cid:118) y ∧ y (cid:118) z −→ x (cid:118) z Note that a total preorder defines an equiva- lence relation ≡ via x ≡ y ⇐⇒ x (cid:118) y ∧ y (cid:118) x Examples for total preorders include the com- parison of the length of time series or the cardi- nality of finite sets. Definition 2 (Metric Subset Space). A metric subset space is a 3-tuple (M,(cid:118), d) consisting of a set M, a total preorder (cid:118) on M, and a function d : M × M → R(cid:62)0 which satisfies the following axioms: S1) ∀x, y, z ∈ M : x (cid:118) y (cid:118) z −→ d(x, z) (cid:54) d(x, y) + d(y, z) S2) ∀x, y ∈ M : d(x, y) = 0 ←→ x = y Compared to metric spaces, S1 relaxes the tri- angle inequality and the symmetry is missing completely. Hence, metric subset spaces general- ize metric spaces in that each metric space with a total preorder also is a metric subset space. The following Corollary 3 claims, that we can switch the parameters for the total preorder as well as the distance function and we still have a metric subset space. Intuitively spoken, this con- verts subset ordering to superset ordering and vice versa. Corollary 3. Let (M,(cid:118), d) be a metric subset space, y (cid:119) x :⇐⇒ x (cid:118) y, and d(y, x) := d(x, y). Then, (M,(cid:119), d) is a metric subset space. The following three common examples show the generality of this approach. 2.1 L2 distance on subsequences Let M be a set of real valued sequences (i. e. time series) and S, T ∈ M be such two se- quences. The canonnical total preorder for sub- sequence search is the "shorter or equal than" Figure 1: Sketch for variables choice in proof of Proposition 4. The striped lines indicate the best matches of the subsequences. relation, i. e. S (cid:118) T :⇐⇒ S (cid:54) T. For se- quences with S (cid:118) T , a common approach for subsequence search is the windowing approach with the Euclidean distance: d2(S, T ) := min j (Si − Ti+j)2. (cid:115)(cid:88) i We show that this model for subsequence dis- tances yields a metric subset space. Proposition 4. (M,(cid:118), d2) is a metric subset space. The proposition even holds for subsequences of elements from another metric space (e. g. n- dimensional vectors). Proof. Consider three sequences S, T, U ∈ M with S (cid:118) T (cid:118) U and fix s, t ∈ N such that d2(S, T ) = d2 d2(T, U ) = d2 In order to prove the triangle inequality, we need three intermediate inequalities. (cid:17) (cid:17) S, T S s T t T, U (cid:16) (cid:16) (cid:17) 1: Since d2 is a metric on common length se- quences, the following triangle inequality holds: (cid:16) (cid:16) S, T S s + d2 T S s S t+s , U (cid:17) (1) d2(S, U S t+s) (cid:54) d2 3 tt+sSTU 2: The monotonicity of d2 regarding the length yields the second inequality: (cid:16) T S s S t+s , U d2 (Ti, Ut+i)2 (2) (cid:17) s+S−1(cid:88) T−1(cid:88) (cid:16) i=0 i=s = (cid:54) (Ti, Ut+i)2 (cid:17) = d2 T T, U t (3) (4) consider the Dog-Keeper distance (DK): DK(S,∅) := ∞ DK(∅, T ) := ∞ DK(∅,∅) := 0 DK(S, T ) :=  max max (cid:110)S1 − T1, DK (cid:110)S1 − T1, DK (cid:110)S1 − T1, DK (cid:16) (cid:16) (cid:16) (cid:17)(cid:111) (cid:17)(cid:111) (cid:17)(cid:111) T−1 S−1 , T 1 1 T−1 S 0 , T 1 S−1 T , T 0 1 S S S min max Although this function is defined recursively, common algorithms use dynamic programming to compute the distance with quadratic complex- ity [10]. Since DK is able to stretch the "time" axis, we generalize the windowing approach to windows of arbitrary length in order to support subse- quence comparison: (cid:16) (cid:17) (5) SDK(S, T ) := min j,(cid:96) DK S, T (cid:96) j 3: The last inequality uses the properties of the windowing approach, which is looking for the best match: (cid:16) S S, U j (cid:17) (cid:54) d2 (cid:16) S t+s S, U (cid:17) d2 (S, U ) = min j d2 Combining inequalities (1),(4), and (5) proves the proposition: (cid:16) (cid:16) (cid:16) (cid:17) (cid:17) (cid:17) S t+s d2(S, U ) (cid:54) d2 (cid:54) d2 (cid:54) d2 = d2(S, T ) + d2(T, U ) S, U S, T S S, T S + d2 + d2 s s (cid:16) (cid:16) (cid:17) S t+s (cid:17) s T S , U T T, U t 2.2 Dog-Keeper distance on subse- quences Again, let M be a set of real valued sequences, S, T ∈ M, and (cid:118) the length comparison. We 4 The difference to the windowing approach from Section 2.1 is that the length of the subsequence in T is not bound to the length S. Similar to the windowed Euclidean distance, SDK yields a metric subset space. Proposition 5. (M,(cid:118), SDK) is a metric subset space. to Proposition 4, suffices Proof. Similar to prove the triangle inequality for arbitrary S, T, U ∈ M with S (cid:118) T (cid:118) U . We fix sa, s(cid:96), ta, t(cid:96) ∈ N such that it SDK(T, U ) = DK SDK(S, T ) = DK(cid:0)S, T s(cid:96) T, U t(cid:96) ta sa (cid:17) (cid:1) (cid:16) (cid:17) (cid:16) For the following thoughts, remember that the computation of DK maps elements of one T to elements of U and thus each subsequence T, U t(cid:96) ta A (cid:118) B :⇐⇒ A (cid:54) B. The Hausdorff distance is a common metric distance function on sets of the same size: (cid:26) Hausdorff(A, B) := max max a∈A min b∈B a − b, max b∈B min a∈A a − b (cid:27) In more general, the Hausdorff is a metric for sets of arbitrary elements from any other met- ric space including Euclidean vector spaces. We stick to sets of real values to keep the examples simple. In the case of subset comparison, we don't need the symmetry of the Hausdorff distance. Omitting the second part already yields a subset distance function (SHD) with similar semantics to that of Hausdorff: (cid:17) (6) SHD(A, B) := max a∈A min b∈B a − b to match A to a subset the original Hausdorff distance does i. e. Hausdorff(A, B) = While SHD tries of B, both directions, max{SHD(A, B), SHD(B, A)}. Proposition 6. (M,(cid:118), SHD) is a metric subset space. Proof. As in the proofs of Proposition 4 and 5, it suffices to prove the triangle inequality for arbi- trary A, B, C ∈ M with A (cid:118) B (cid:118) C. Therefore, fixiate mappings f : A → B and g : B → C, such that ∀a ∈ A : f (a) = min b∈B ∀b ∈ B : f (b) = min c∈C a − b b − c i. e. f and g map all elements to their corre- sponding nearest neighbor. Hence, SHD(A, B) = maxa∈A a − f (a) and SHD(B, C) = maxb∈B b − Figure 2: Sketch for variables choice in proof of Proposition 5. The striped lines indicate the best matches of the subsequences. (cid:16) of T to a certain subsequence of U . Fixiating ua, u(cid:96) such that the subsequence T s(cid:96) sa is mapped to U u(cid:96) . ua For these subsequences, the following inequality holds since DK is a metric distance function [1]. implies DK(cid:0)T s(cid:96) (cid:1) (cid:54) DK(cid:0)S, T s(cid:96) DK(cid:0)S, U u(cid:96) sa , U u(cid:96) ua T, U t(cid:96) ta (cid:1) sa , U u(cid:96) ua ua sa The first summand of the right hand side of In- equality 6 equals to SDK(S, T ) by choice of sa and s(cid:96). As pointed out before, the second sum- T, U t(cid:96) mand is a lower bound to DK . Hence, ta the triangle inequality for SDK holds: (cid:17) (cid:1) (cid:54) DK (cid:1) + DK(cid:0)T s(cid:96) (cid:16) (cid:1) (cid:1) + DK(cid:0)T s(cid:96) (cid:16) (cid:1) + DK SDK(S, U ) (cid:54) DK(cid:0)S, U u(cid:96) (cid:54) DK(cid:0)S, T s(cid:96) (cid:54) DK(cid:0)S, T s(cid:96) ua sa sa (cid:1) (cid:17) sa , U u(cid:96) ua T, U t(cid:96) ta = SDK (S, T ) + DK (T, U ) 2.3 Hausdorff distance on subsets To provide an example for metric subset spaces from another data domain, let the members of M be sets of real values. Our total preorder compares the cardinalities of sets A, B ∈ M, i. e. 5 STUttusuaaallsl including the split and merge strategies need to be adapted in order to respect the ordering condition. Due to space limitations, we do not present the algorithms for deletion. 3.1 Structure of SuperM-Tree Nodes Since the structure of a SuperM-Tree is de- rived from the M-Tree [7], we use the same notation. Leaf nodes store the indexed (key) objects, whereas internal nodes store routing objects which help in pruning and navigating through the tree. Each routing object Or is associated with a pointer to the root node T (Or) of its subtree, called the covered tree of Or. Additionally to the M-Tree, the SuperM-Tree expects that Or (cid:118) Oj for each object Oj in its covered tree. The routing objects are also associated with a radius r(Or) (cid:62) 0 called the covering radius of Or, as well as the distance d(P (Or), Or) to their parent P (Or). All indexed objects in the covered tree of Or are within the distance r(Or) from Or. Leaf nodes only store the objects Oj themselves and their distance to the parent d(P (Oj), Oj). In real world scenarios, additional information (e. g. data pointer or tuple identi- fier) can be stored per object. 3.2 Similarity Queries The SuperM-Tree supports range queries and nearest neighbor queries. Since nearest neigh- bor queries simply adapt the search radius anal- ogously to the M-Tree while traversing the tree, we only discuss the range queries here. For an object Q ∈ M, the range query N N (Q, r(Q)) selects all database objects Oj with d(Oj, Q) (cid:54) r(Q) and Oj (cid:118) Q. Algorithm 1 provides the pseudo code for the range query. It Figure 3: Sketch for variables choice in proof of Proposition 6. The striped lines indicate the best matches of the subsequences. g(b). The triangle inequality is a result of the following observation: ∀a ∈ A : min c∈C a − c (cid:54) a − g(f (a)) (cid:54)a − f (a) + f (a) − g(f (a)) (cid:54)SHD(A, B) + SHD (f (A), C) (cid:54)SHD(A, B) + SHD(B, C) 3 The SuperM-Tree The SuperM-Tree is derived from the M-Tree [7] and differs in that it indexes metric subset spaces (M,(cid:118), d) instead of metric spaces. It is a balanced tree with nodes of a certain capac- ity (which can be either fixed size or variable sized as in [4]). Inner nodes contain routing ob- jects which cover an area of the metric subset space. The covered area includes all objects in the corresponding subtree. Leaf nodes contain the actual entries. Additionally, the SuperM-Tree needs the ob- jects to be ordered according to the total pre- order of the metric subset space along each path from the root to the leafs. That way, it assures that the triangle inequality holds to prune cer- tain subtrees. The insert and delete algorithms 6 STU uses Lemma 7 and 8 to prune subtrees. Algorithm 1 Range query d(Oj, Q) (cid:62) d(Or, Q)−r(Or). Thus, if d(Or, Q) > r(Q) + r(Or), then d(Oj, Q) > r(Q) + r(Or) − r(Or) = r(Q). search radius r(Q) 1 Input: node N , query object Q, 2 R := ∅ 3 if N is a leaf node 4 if Oj (cid:118) Q and d(Oj, Q) (cid:54) r(Q) for each Oj ∈ N R := R ∪ {Oj} 5 6 11 return R skip // prune by ''size'' 7 8 // else 9 for each Or in N if not Or (cid:118) Q 10 if r(Q) < d(Op, Q) − d(Or, Op) − r(Or) if r(Q) < d(Or, Q) − r(Or) skip // pruned using Lemma 7 R := R ∪ search(T (Or), Q, r(Q)) skip // pruned using Lemma 8 13 16 17 return R 12 14 15 Lemma 7. If d(Or, Q) > r(Q) + r(Or), then d(Oj, Q) > r(Q) holds for each object Oj with Oj (cid:118) Q in the covered subtree of Or. Remark that, since all objects Oj with Oj (cid:54)(cid:118) Q are not included in the search anyways, Lemma 7 implies that the covered subtree with root T (Or) can be safely pruned from the search. Proof. Let Oj be an arbitrary but fixed object in the covered tree of Or with Oj (cid:118) Q. The ordering Or (cid:118) Oj (cid:118) Q holds by definition of the structure of a SuperM-Tree. Now, by defini- tion of metric subset spaces, the triangle inequal- ity d(Or, Q) (cid:54) d(Or, Oj) + d(Oj, Q) holds. The structure of a SuperM-Tree requires d(Or, Oj) (cid:54) r(Or), thus d(Or, Q) (cid:54) r(Or) + d(Oj, Q), i. e. 7 Lemma 8. If d(Op, Q) > r(Q) + r(Or) + d(Op, Or), then d(Oj, Q) > r(Q) holds for each object Oj with Oj (cid:118) Q in the covered subtree of Or. Proof. Let Oj be an arbitrary but fixed object in the covered tree of Or with Oj (cid:118) Q. The order- ing Op (cid:118) Or (cid:118) Oj (cid:118) Q holds by definition of the structure of a SuperM-Tree. Hence, the triangle inequality d(Op, Q) (cid:54) d(Op, Or) + d(Or, Oj) + d(Oj, Q) holds. Since d(Or, Oj) (cid:54) r(Or) and d(Op, Q) > r(Q) + r(Or) + d(Op, Or), we have r(Q) + r(Or) + d(Op, Or) < d(Op, Or) + r(Or) + d(Oj, Q) and thus r(Q) < d(Oj, Q). 3.3 Building the SuperM-Tree The SuperM-Tree is a generalized search tree (GiST [11]), i. e. algorithms for insertion and deletion of objects manage overflow and under- flow of nodes using split and merge operations. The Insert algorithm recursively descends the SuperM-Tree down to a leaf node in which to insert the object. At each inner node, we follow the routing object with the smallest distance to the new object. Two events may occur: 1. The chosen path might violate the total preorder of the metric subset space, thus an exchange of the routing object is necessary. 2. The node might be overfilled, thus the insertion triggers a split of the node. Also, at each routing object of the in- sertion path, we have to assure that the covering radius r(Or) covers the newly inserted element. Algorithm 2 provides the pseudo code for the insert algorithm. Algorithm 2 Insert Algorithm 3 Split 1 Input: node N , object O 2 if N is a leaf node 3 insert O to N return 4 5 Or := arg min{d(Or, O) Or (cid:118) O}∪ {d(O, Or) O (cid:118) Or} 6 7 insert(T (Or), O) 8 if not Or (cid:118) O exchange Or with O for each object Oc in T (Or) update dist to parent d(Or, Oc) r(Or) := maxOc∈T (Or) {d(Or, Oc) + r(Oc)} 12 13 if split(T (Or)) 14 9 10 11 15 16 exchange Or with promoted objects if N is overfilled root node add new root node with promoted objects 3.3.1 Split Management As any other GiST tree, the SuperM-Tree pro- vides a split strategy consisting of a Promotion and Partition algorithm (see Algorithm 3). Spliting a node N creates a new node N(cid:48). The partition algorithm partitions the elements of the node N among these two nodes. We present the generalized hyperplane strategy, which puts each object to its nearest neighbor (cf. Al- gorithm 4). The promote algorithm provides two routing objects (one for each new parti- tion) which replace the old routing object in the parent node. If N was the root node, a new node filled with the two promoted routing ob- jects serves as new root node of the tree. A combination of a specific implementation for the promote and partition algorithm is called a split policy. Although we studied different pro- 1 Input: node N , object O 2 if N (cid:54) capacity return false 3 (O1, O2) := promote(N ) 4 5 if promote(N ) did not find promotion objects: 6 return false (N1, N2) := partition(N, O1, O2) 7 8 return true, O1, N1, O2, N2 motion and partition strategies, we only present the most promising. Algorithm 4 Partition O1, O2 1 Input: node N , routing objects 2 N1 := {Oj ∈ N d(O1, Oj) < d(O2, Oj)} 3 N2 := N \ N1 return N1, N2 4 3.3.2 Promotion strategies This subsection explains the details of our pro- motion strategy, shown in Algorithm 5. Note, al- though the implementation calls the partition algorithm multiple times, our final implementa- tion in C++ actually merges both functions. The motivation for our promotion strategy is based on the following fact: Minimizing the over- lap of covering areas in a node turned out to be crucial for the performance of multidimen- index structures including the R∗-Tree sional [3] and the M-Tree [7]. Considering a node N with two routing objects S and T in an M- Tree, the distance between both covering areas is 8 Figure 4: Example for two very distinct time series (T and U ) being similar to a third one (S). d(S, T )− r(S)− r(T ). When this value becomes negative, both covering areas overlap. The over- lap gets larger when this value shrinks. Fur- thermore, the probability increases that a query overlaps both covering areas. Minimizing the overlap decreases the probability of having to de- scend both paths. Since we don't have the concept of volume of overlap in metric spaces, we consider the nega- tive of this value as overlap, i. e. overlap(S, T ) = r(S) + r(T ) − d(S, T ). Virtual distance and overlap: Since a met- ric subset distance function is not symmetric, the concept of overlap is not transferable to met- ric subset spaces directly: Consider the sketched time series S, T, U in Figure 4. While T and U are not similar at all (and thus might yield no overlap), S had a small distance to both routing objects if they became the promoted objects. In this case, a query for a time series Q "containing" S would need to traverse both paths through the new routing objects T and U . Motivated by this example, we introduce the concept of virtual distances regarding a set of third party objects. Definition 9. Let R be a set of metric subset ob- jects and S, T be two metric subset objects. Then vR(S, T ) := min R∈R,S,T(cid:118)R {d(T, R) + d(S, R)} is called the virtual distance of S and T . Choosing two routing objects S and T with large virtual distance vR(S, T ) decreases the probability that a query object Q is similar to objects from both sub trees. This approach fol- lows the idea of minimizing the overlap. Thus, we promote a pair of objects minimizing the vir- tual overlap r(S) + r(T ) − vR(S, T ) where r(S) and r(T ) are the radii after partitioning and R is the set of (routing) objects within the node (cf. Line 11). Algorithm 5 Promote 1 Input: node N 2 C := {O ∀Oi ∈ N : O (cid:118) Oi} 3 if C = 1 // make sure C (cid:62) 2 5 ϕ := ∞ 6 for each pair Oa, Ob ∈ C C := C ∪ {O ∀Oj ∈ N \ C : I (cid:118) Oj} 4 7 8 9 10 11 12 13 Na, Nb := partition(N, Oa, Ob) if large nodes allowed and Na (cid:54) 1 or Nb (cid:54) 1 skip and ignore Oa, Ob p = r(Oa) + r(Ob) − vN (Oa, Ob) if p < ϕ O1 := Oa; O2 := Ob; N1 := Na; N2 := Nb 14 return O1, O2 Strict order in insertion paths: The SuperM-Tree maintains the strict order T (cid:118) P In order to re- for objects T with parent P . spect this property, the promotion strategy only chooses two of the smallest elements of a node (cf. Line 6). 9 STU 3.3.3 Partition strategy Although numerous possibilities exist for design- ing partitioning stratregies, we chose the geo- metric approach for a simple reason: The trees built with the geometric approach (cf. gener- alized hyperplane in [7]) are superior in query performance compared to trees built with the balanced strategy (i. e. spliting to partitions of equal size). Since this insight is the same as in [7], we omit presenting experimental results. However, we observed the following effect in our examples: Given a very small object (e. g. a time series of length 1) and a larger object, the first one has a lower expected distance to a third object than the second one. When promot- ing two objects, one of them is usually smaller than the other. Hence, most other objects of the node are more similar to the smaller object and the partitioning became more and more unbal- anced. At some point, partitions even degraded, such that only one object (the larger promoted object) is split from the rest of the node. The resulting tree degraded to a large trunk with lots of very thin branches resulting in bad query per- formance. We could prevent this behaviour by ignoring the maximum capacity of a node: Instead of strictly splitting nodes which exceed the capac- ity, we look at the resulting partitions and only perform the split, if the partitions are not degen- erated (cf. Line 8). In Section 4, we show that this strategy outperforms the strict split execu- tion. 4 Evaluation In this section we provide experimental results on the performance in building and querying the SuperM-Tree. A second goal is to evaluate the flexibility of the concept of metric subset spaces. Therefore we tested three modular metric subset distance functions, namely the L2 distance on windows, the Dog-Keeper distance on subsequences, and the Hausdorff distance on subsets. For each application we compared both split policies de- scribed in Section 3.3 against a linear scan query algorithm. Runtime comparisons: In order to under- stand the influence of different properties of the datasets as well as parameters of the tree, most experiments were based on synthetic datasets. For the sequence based distance functions (d2 and DK), we generated random sequences of uni- formly distributed lengths between 1 and 128. For the set based distance function, we generated random sets of uniformly distributed cardinality between 1 and 32. We varied the dataset size from 28 to 223. The elements of all sequences and sets are uniformly distributed over a fixed finite interval. Results regarding query perfor- mance are averaged over 100 queries. Since the node capacity had no big impact on the perfor- mance (i. e. runtimes were stable for capacities between 64 and 512), we fixed the capacity to 128. Figure 5 shows the time needed for build- ing the tree with successive insert operations and Figure 6 shows the average query times. Hereby, the linear scan has been improved with lower bounds already (cf. [2]). We ran the same experiments for bot sequence based applications on the well known UCR time series benchmark dataset [9]. We built the trees with each training set respectively and averaged the query times for all samples from the test training set. To achieve similar properties as in the synthetic datasets, we cropped the training 10 Figure 5: Building time for synthetic data in seconds (top: L2, center: SDK, bottom: SHD). Figure 6: Average query time of 100 1-NN queries on synthetic data(top: L2, center: SDK, bottom: SHD). 11 10-410-310-210-1100101102103104105106102103104105106107Insertion Timenumber of data objectsfixed capacity nodeslarge nodes10-410-310-210-1100101102103104105106102103104105106107Insertion Timenumber of data objectsfixed capacity nodeslarge nodes10-410-310-210-1100101102103104105106102103104105106107Insertion Timenumber of data objectsfixed capacity nodeslarge nodes10-410-310-210-1100101103104105106time in secondsnumber of data objectslinear scanfixed capacity nodeslarge nodes10-410-310-210-1100101103104105106time in secondsnumber of data objectslinear scanfixed capacity nodeslarge nodes10-610-510-410-310-210-1100103104105106time in secondsnumber of data objectslinear scanfixed capacity nodeslarge nodes The effect of dimensionality: The curse of dimensionality is a well studied effect and oc- curs in the SuperM-Tree as well. The effect ap- pears as seen in all other multi-dimensional index structures. Due to space limitations we omit pre- senting experimental results. TODO: reference! Variance of object's size: As mentioned ear- lier, we cropped the sequences down to subse- quences of random lengths. We could observe, that there was no speedup against the linear scan at all if we did not do that. Hence, the performance strongly depends on having small elements in the dataset. While spliting overfilled nodes, the smaller el- ements are being promoted as routing objects. In the higher levels of the tree (closer to the root), these elements form a space with lower di- mensionality. Thus, pruning works better in the higher levels already and the overall number of pruned elements increases. On the other hand, datasets with only large objects form a high di- mensional space in the higher levels already and thus the curse of dimensionality affects the query performance. Extending the metric subset space with a func- tion generating smaller (promotion) objects from a given set of objects could solve that problem. Alternatively, small random elements could be inserted as meta elements manually before or during the whole insertion process. However, this opens new research areas for each metric subset space respectively. 5 Conclusion We introduced metric subset spaces as a seman- tic extension of metric spaces. Three applica- tions from different fields show the flexibility of Figure 7: Average Speedup against linear scan on UCR datasets with L2 (top) and SDK (bot- tom) sequences down to random subsequences with a uniformly distributed length between 1 and 128. Figure 7 shows that the speedup follows the same trend as in the experiments with the synthetic datasets. Fixed capacity vs. large nodes: Figures5 shows that the dynamic capacity split policy (large nodes) outperforms the static capacity split policy (fixed capacity) by more than one order of magnitude while building the tree. By keeping track of the size of the partitions with the fixed capacity strategy, we could observe a drastic fall down towards a mean of 1 for small datasets already (i. e. a few thousand ob- jects). This observation confirmed our assump- tion that the tree degenerates as explained in Section 3.3.3. 12 10-1100101102102103104speedupsize of datasetSpeedup with ED10-1100101102102103104speedupsize of datasetSpeedup with SDK this concept. We proposed the SuperM-Tree, a data struc- ture for metric subset spaces derived from the M- Tree. The SuperM-Tree provides nearest neigh- bor queries searching for subobjects (e. g. sub- sequences or subsets). Our experiments show, that the index structures outperform the linear scan by multiple orders of magnitude, growing with the size of the dataset. However, we also observed, that we need small elements in the dataset which act as low dimensional routing ob- jects. These small elements could be inserted as meta elements manually or generated in a new promotion strategy depending on the spe- cific metric subset space. References [1] Jorg P. Bachmann and Johann-Christoph Freytag. Dynamic time warping and the (windowed) dog-keeper distance. In Chris- tian Beecks, Felix Borutta, Peer Kroger, and Thomas Seidl, editors, Similarity Search and Applications - 10th Interna- tional Conference, SISAP 2017, Munich, Germany, October 4-6, 2017, Proceedings, volume 10609 of Lecture Notes in Computer Science, pages 127 -- 140. Springer, 2017. [2] Jorg P. Bachmann and Johann-Christoph Freytag. An analytical approach to improv- ing time warping on multidimensional time series. CoRR, abs/1811.11076, 2018. [3] Norbert Beckmann, Hans-Peter Kriegel, Ralf Schneider, and Bernhard Seeger. The r*-tree: An efficient and robust access method for points and rectangles. SIGMOD Rec., 19(2):322 -- 331, May 1990. [4] Stefan Berchtold, Daniel A. Keim, and Hans-Peter Kriegel. The x-tree: An index structure for high-dimensional data. pages 28 -- 39, 1996. [5] Alina Beygelzimer, Sham Kakade, and John Langford. Cover trees for nearest neigh- bor. In Proceedings of the 23rd international conference on Machine learning, ICML '06, pages 97 -- 104, New York, NY, USA, 2006. ACM. [6] Tolga Bozkaya Distance-based dimensional metric spaces. Rec., 26(2):357 -- 368, jun 1997. and Meral Ozsoyoglu. indexing high- SIGMOD for [7] Paolo Ciaccia, Marco Patella, and Pavel Zezula. M-tree: An efficient access method for similarity search in metric spaces. In Proceedings of the 23rd International Con- ference on Very Large Data Bases, VLDB '97, pages 426 -- 435, San Francisco, CA, USA, 1997. Morgan Kaufmann Publishers Inc. [8] Douglas Comer. Ubiquitous b-tree. ACM Comput. Surv., 11(2):121 -- 137, June 1979. [9] Dua Dheeru and Efi Karra Taniskidou. UCI machine learning repository, 2017. [10] Thomas Eiter and Heikki Mannila. Com- puting discrete fr´echet distance. Technical report, Technische Universitat Wien, 1994. [11] Joseph M. Hellerstein, Jeffrey F. Naughton, and Avi Pfeffer. Generalized search trees for database systems. In Proceedings of the 21th International Conference on Very Large Data Bases, VLDB '95, pages 562 -- 573, San Francisco, CA, USA, 1995. Morgan Kaufmann Publishers Inc. 13 [12] Ravindranath Jampani and Vikram Pudi. Using prefix-trees for efficiently computing set joins. In Proceedings of the 10th Interna- tional Conference on Database Systems for Advanced Applications, DASFAA'05, pages 761 -- 772, Berlin, Heidelberg, 2005. Springer- Verlag. [13] Anja Kunkel, Astrid Rheinlander, Christo- pher Schiefer, Sven Helmer, Panagiotis Bouros, and Ulf Leser. Piejoin: Towards parallel set containment joins. In Proceed- ings of the 28th International Conference on Scientific and Statistical Database Manage- ment, SSDBM '16, pages 11:1 -- 11:12, New York, NY, USA, 2016. ACM. [14] D. Novak and M. Batko. Metric index: An efficient and scalable solution for similarity search. In 2009 Second International Work- shop on Similarity Search and Applications, pages 65 -- 73, Aug 2009. [15] Sebastian Wandelt, Johannes Starlinger, Marc Bux, and Ulf Leser. Rcsi: Scalable similarity search in thousand(s) of genomes. Proc. VLDB Endow., 6(13):1534 -- 1545, Au- gust 2013. [16] Jianye Yang, Wenjie Zhang, Shiyu Yang, Ying Zhang, Xuemin Lin, and Long Yuan. Efficient set containment join. The VLDB Journal, 27(4):471 -- 495, Aug 2018. 14
1207.5696
1
1207
2012-07-24T13:34:31
Beyond Max-Cut: \lambda-Extendible Properties Parameterized Above the Poljak-Turz\'{i}k Bound
[ "cs.DS", "cs.CC", "math.CO" ]
Poljak and Turz\'ik (Discrete Math. 1986) introduced the notion of \lambda-extendible properties of graphs as a generalization of the property of being bipartite. They showed that for any 0<\lambda<1 and \lambda-extendible property \Pi, any connected graph G on n vertices and m edges contains a subgraph H \in {\Pi} with at least \lambda m+ (1-\lambda)/2 (n-1) edges. The property of being bipartite is 1/2-extendible, and thus this bound generalizes the Edwards-Erd\H{o}s bound for Max-Cut. We define a variant, namely strong \lambda-extendibility, to which the bound applies. For a strongly \lambda-extendible graph property \Pi, we define the parameterized Above Poljak- Turz\'ik (APT) (\Pi) problem as follows: Given a connected graph G on n vertices and m edges and an integer parameter k, does there exist a spanning subgraph H of G such that H \in {\Pi} and H has at least \lambda m + (1-\lambda)/2 (n - 1) + k edges? The parameter is k, the surplus over the number of edges guaranteed by the Poljak-Turz\'ik bound. We consider properties {\Pi} for which APT (\Pi) is fixed- parameter tractable (FPT) on graphs which are O(k) vertices away from being a graph in which each block is a clique. We show that for all such properties, APT (\Pi) is FPT for all 0<\lambda<1. Our results hold for properties of oriented graphs and graphs with edge labels. Our results generalize the result of Crowston et al. (ICALP 2012) on Max-Cut parameterized above the Edwards-Erd\H{o}s bound, and yield FPT algorithms for several graph problems parameterized above lower bounds, e.g., Max q-Colorable Subgraph problem. Our results also imply that the parameterized above-guarantee Oriented Max Acyclic Digraph problem is FPT, thus solving an open question of Raman and Saurabh (Theor. Comput. Sci. 2006).
cs.DS
cs
Beyond Max-Cut: λ-Extendible Properties Parameterized Above the Poljak-Turzík Bound Matthias Mnich1, Geevarghese Philip∗2, Saket Saurabh†3, and Ondřej Suchý‡4 1 Cluster of Excellence, Saarbrücken, Germany. [email protected] 2 MPII, Saarbrücken, Germany. [email protected] 3 The Institute of Mathematical Sciences, Chennai, India. [email protected] 4 Technische Universität Berlin, Berlin, Germany. [email protected] Abstract Poljak and Turzík (Discrete Math. 1986) introduced the notion of λ-extendible properties of graphs as a generalization of the property of being bipartite. They showed that for any 0 < λ < 1 and λ-extendible property Π, any connected graph G on n vertices and m edges contains a spanning subgraph H ∈ Π with at least λm+ 1−λ 2 (n−1) edges. The property of being bipartite is λ-extendible for λ = 1/2, and thus the Poljak-Turzík bound generalizes the well-known Edwards- Erdős bound for Max-Cut. We define a variant, namely strong λ-extendibility, to which the Poljak-Turzík bound applies. For a strongly λ-extendible graph property Π, we define the parameterized Above Poljak- Turzík (Π) problem as follows: Given a connected graph G on n vertices and m edges and an integer parameter k, does there exist a spanning subgraph H of G such that H ∈ Π and H has 2 (n − 1) + k edges? The parameter is k, the surplus over the number of edges at least λm + 1−λ guaranteed by the Poljak-Turzík bound. We consider properties Π for which the Above Poljak-Turzík (Π) problem is fixed- parameter tractable (FPT) on graphs which are O(k) vertices away from being a graph in which each block is a clique. We show that for all such properties, Above Poljak-Turzík (Π) is FPT for all 0 < λ < 1. Our results hold for properties of oriented graphs and graphs with edge labels. (ICALP 2012) on Max-Cut parameterized above the Edwards-Erdős bound, and yield FPT algorithms for several graph problems parameterized above lower bounds. For instance, we get that the above-guarantee Max q-Colorable Subgraph problem is FPT. Our results also imply that the parameterized above-guarantee Oriented Max Acyclic Digraph problem is FPT, thus solving an open question of Raman and Saurabh (Theor. Comput. Sci. 2006). Our results generalize the recent result of Crowston et al. Keywords and phrases Algorithms and data structures; fixed-parameter algorithms; bipartite graphs; acyclic graphs. Introduction 1 A number of interesting graph problems can be phrased as follows: Given a graph G as input, find a subgraph H of G with the largest number of edges such that H satisfies a specified property Π. Prominent among these is the Max-Cut problem, which asks for a bipartite subgraph with the maximum number of edges. A cut of a graph G is a partition of the vertex ∗ Supported by the Indo-German Max Planck Center for Computer Science(IMPECS). † Part of this work was done while visiting MPII supported by IMPECS. ‡ Part of this work was done while with the Saarland University, supported by the DFG Cluster of Excellence MMCI and the DFG project DARE (GU 1023/1-2), and while visiting IMSC Chennai supported by IMPECS. Leibniz International Proceedings in Informatics Schloss Dagstuhl -- Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany 2 1 0 2 l u J 4 2 ] S D . s c [ 1 v 6 9 6 5 . 7 0 2 1 : v i X r a 2 Beyond Max-Cut: Parameterizing above the Poljak-Turzík Bound set of G into two parts, and the size of the cut is the number of edges which cross the cut; that is, those which have their end points in distinct parts of the partition. Max-Cut Input: Question: A graph G and an integer k. Does G have a cut of size at least k? The Max-Cut problem is among Karp's original list of 21 NP-complete problems [14], and it has been extensively investigated from the point of view of various algorithmic paradigms. Thus, for example, Goemans and Williamson showed [12] that the problem can be approximated in polynomial-time within a multiplicative factor of roughly 0.878, and Khot et al. showed that this is the best possible assuming the Unique Games Conjecture [15]. Our focus in this work is on the parameterized complexity of a generalization of the Max-Cut problem. The central idea in the parameterized complexity analysis [7, 11] of NP-hard problems is to associate a parameter k with each input instance of size n, and then to ask whether the resulting parameterized problem can be solved in time f(k) · nc where c is a constant and f is some computable function. Parameterized problems which can be solved within such time bounds are said to be fixed-parameter tractable (FPT). The standard parameterization of the Max-Cut problem sets the parameter to be the size k of the cut being sought. This turns out to be not very interesting for the following reason: Let m be the number of edges in the input graph G. By an early result of Erdős [10], we know that every graph with m edges contains a cut of size at least m/2. Therefore, if k ≤ m/2 then we can immediately answer YES. In the remaining case k > m/2, and there are less than 2k edges in the input graph. It follows from this bound on the size of the input that any algorithm -- even a brute-force method -- which solves the problem runs in FPT time on this instance. The best lower bound known on the size of a largest cut for connected loop-less graphs on n vertices and m edges is m 4 , as proved by Edwards [8, 9]. This is called the Edwards-Erdős bound, and it is the best possible in the sense that it is tight for an infinite family of graphs, for example, the class of cliques of odd order n. A more interesting parameterization of Max-Cut is, therefore, the following: 2 + n−1 Max-Cut Above Tight Lower Bound (Max-Cut ATLB) Input: Parameter: Question: A connected graph G, and an integer k. k Does G have a cut of size at least m 2 + n−1 4 + k? In the work which introduced the notion of "above-guarantee" parameterization, Mahajan 2 + k is FPT and Raman [16] showed that the problem of asking for a cut of size at least m parameterized by k, and stated the fixed-parameter tractability of Max-Cut ATLB as an open problem. This question was resolved quite recently by Crowston et al. [5], who showed that the problem is in fact FPT. We generalize the result of Crowston et al. by extending it to apply to a special case of the so-called λ-extendible properties. Roughly stated1, for a fixed 0 < λ < 1 a graph property Π is said to be λ-extendible if: Given a graph graph G = (V, E) ∈ Π, an "extra" edge uv not in G, and any set F of "extra" edges each of which has one end point in {u, v} and the other in V , there exists a graph H ∈ Π which contains (i) all of G, (ii) the edge uv, and (iii) at 1 See subsection 1.2 and section 2 for the definitions of various terms used in this section. Matthias Mnich, Geevarghese Philip, Saket Saurabh and Ondřej Suchý 3 least a λ fraction of the edges in F. The notion was introduced by Poljak and Turzík who showed [18] that for any λ-extendible property Π and edge-weighting function c : E → R+, any connected graph G = (V, E) contains a spanning subgraph H = (V, F) ∈ Π such that c(F) ≥ λ · c(E) + 1−λ 2 c(T). Here c(X) denotes the total weight of all the edges in X, and T is the set of edges in a minimum-weight spanning tree of G. It is not difficult to see that the property of being bipartite is λ-extendible for λ = 1/2, and so -- once we assign unit weights to all edges -- the Poljak and Turzík result implies the Edwards-Erdős bound. Other examples of λ-extendible properties -- with different values of λ -- include q-colorability and acyclicity in oriented graphs. In this work we study the natural above-guarantee parameterized problem for λ-extendible properties Π, which is: given a connected graph G = (V, E) and an integer k as input, does G contain a spanning subgraph H = (V, F) ∈ Π such that c(F) = λ · c(E) + 1−λ 2 c(T) + k? To derive a generic FPT algorithm for this class of problems, we use the "reduction" rules of Crowston et al. To make these rules work, however, we need to make a couple of concessions. Firstly, we slightly modify the notion of lambda extendibility; we define a (potentially) stronger notion which we name strong λ-extendibility. Every strongly λ-extendible property is also λ-extendible by definition, and so the Poljak-Turzík bound applies to strongly λ- extendible properties as well. Observe that for each way of assigning edge-weights, the Poljak and Turzík result yields a (potentially) different lower bound on the weight of the subgraph. Following the spirit of the question posed by Mahajan and Raman and solved by Crowston et al., we choose from among these the lower bound implied by the unit-edge-weighted case. This is our second simplification, and for this "unweighted" case the Poljak and Turzík result becomes: for any strongly λ-extendible property Π, any connected graph G = (V, E) contains a spanning subgraph H = (V, F) ∈ Π such that F = λ · E + 1−λ 2 (V − 1). The central problem which we discuss in this work is thus the following; here 0 < λ < 1, and Π is an arbitrary -- but fixed -- strongly λ-extendible property: Above Poljak-Turzík (Π) (APT(Π)) Input: Parameter: Question: A connected graph G = (V, E) and an integer k. k Is there a spanning subgraph H = (V, F ) ∈ Π of G such that F ≥ λE + 1−λ 2 (V − 1) + k? 1.1 Our Results and their Implications We show that that the Above Poljak-Turzík (Π) problem is FPT for every strongly λ-extendible property Π for which APT(Π) is FPT on a class of "almost-forests of cliques". Informally, this is a class of graphs which are a small number (O(k)) of vertices away from being a graph in which each block is a clique. This requirement is satisfied by the properties underlying a number of interesting problems, including Max-Cut, Max q-Colorable Subgraph, and Oriented Max Acyclic Digraph. The following is the main result of this paper. (cid:73) Theorem 1. The Above Poljak-Turzík (Π) problem is fixed-parameter tractable for a λ-extendible property Π of graphs if Π is strongly λ-extendible and Above Poljak-Turzík (Π) is FPT on almost-forests of cliques. This also holds for such properties of oriented and/or labelled graphs. We prove Theorem 1 using the classical "Win/Win" approach of parameterized complexity. 4 Beyond Max-Cut: Parameterizing above the Poljak-Turzík Bound To wit: given an instance (G, k) of a strongly λ-extendible property Π, in polynomial time we either (i) show that (G, k) is a yes instance, or (ii) find a vertex subset S of G of size at most 6k/(1 − λ) such deleting S from G leaves a "forest of cliques". To prove this we use the "reduction" rules used by Crowston et al [5] in the context of Max-Cut. Our main technical contribution is the proof that these rules are sufficient to show that every NO instance of APT(Π) is at a vertex-deletion distance of O(k) from a forest of cliques. This proof requires several new ideas: a result which holds for all strongly λ-extendible properties Π is a significant step forward from Max-Cut. Our main result unifies and generalizes known results and implies new ones. Among these are Max-Cut, finding a q-colorable subgraph of the maximum size, and finding a maximum-size acyclic subdigraph in an oriented graph. Using our theorem we also get a linear vertex kernel for maximum acyclic subdigraph, complementing the quadratic arc kernel by Gutin et al. [13]. Related Work The notion of parameterizing above (or below) some kind of "guaranteed" values -- lower and upper bounds, respectively -- was introduced by Mahajan and Raman [16]. It has proven to be a fertile area of research, and Max-Cut is now just one of a host of interesting problems for which we now have FPT results for such questions [19, 17, 13, 1, 3, 5, 4, 2]. 1.2 Preliminaries We use "graph" to denote simple graphs without self-loops, directions, or labels, and use standard graph terminology used by Diestel [6] for the terms which we do not explicitly define. We use V (G) and E(G) to denote the vertex and edge sets of graph G, respectively. For S ⊆ V (G), we use (i) G[S] to denote the subgraph of G induced by the set S, (ii) G \ S to denote G[V (G) \ S], (iii) δ(S) to denote the set of edges in G which have exactly one end-point in S, and (iv) eG(S) to denote E(G[S]); we omit the subscript G if it is clear from the context. A clique in a graph G is a set of vertices C such that between any pair of vertices in C there is an edge in E(G). A block of graph G is a maximal 2-connected subgraph of G and a graph G is a forest of cliques, if the vertices of each of its blocks form a clique. Thus a graph is a forest of cliques if and only if the vertex set of any cycle in the graph forms a clique. A leaf clique of a forest of cliques is a block of the graph, which corresponds to a leaf in its block forest. In other words, it is a block which contains at most one cut vertex of the graph. For F ⊆ E(G), (i) we use G \ F to denote the graph (V (G), E(G) \ F), and (ii) for a weight function c : E(G) → R+, we use c(F) to denote the sum of the weights of all the edges in F. A graph property is a collection of graphs. For i, j ∈ N we use Ki to denote the complete graph on i vertices, and Ki,j to denote the complete bipartite graph in which the two parts of vertices are of sizes i, j. Our results also apply to graphs with oriented edges, and those with edge labels. Subgraphs of an oriented or labelled graph G inherit the orientation or labelling -- as is the case -- of G in the natural manner: each surviving edge keeps the same orientation/labelling as it had in G. For a graph G of any kind, we use GS to denote the simple graph obtained by removing all orientations and labels from G; we say that G is connected (or contains a clique, and so forth) if GS is connected (or contains a clique, and so forth). Matthias Mnich, Geevarghese Philip, Saket Saurabh and Ondřej Suchý 5 2 Definitions The following notion is a variation on the concept of λ-extendibility defined by Poljak and Turzík [18]. (cid:73) Definition 2 (Strong λ-extendibility). Let G be the class of (possibly oriented and/or labelled) graphs, and let 0 < λ < 1. A property Π ⊆ G is strongly λ-extendible if it satisfies the following: Inclusiveness {G ∈ G GS ∈ {K1, K2}} ⊆ Π Block additivity G ∈ G belongs to Π if and only if each block of G belongs to Π. Strong λ-subgraph extension Let G ∈ G and S ⊆ V (G) be such that G[S] ∈ Π and G \ S ∈ Π. For any weight function c : E(G) → R+ there exists an F ⊆ δ(S) with c(F) ≥ λ · c(δ(S)), such that G \ (δ(S) \ F) ∈ Π. The strong λ-subgraph extension requirement can be rephrased as follows: Let V (G) = X ] Y be a cut of graph G such that G[X], G[Y ] ∈ Π, and let F be the set of edges which cross the cut. For any weight function c : F → R+, there exists a subset F 0 ⊆ F such that (i) c(F 0) ≤ (1 − λ) · c(F), and (ii) (G \ F 0) ∈ Π. Informally, one can pick a λ-fraction of the cut and delete the rest to obtain a graph which belongs to Π. We recover Poljak and Turzík's definition of λ-extendibility from the above definition by replacing strong λ-subgraph extension with the following property: λ-edge extension Let G ∈ G and S ⊆ V (G) be such that GS[S] is isomorphic to K2 and G \ S ∈ Π. For any weight function c : E(G) → R+ there exists an F ⊆ δ(S) with c(F) ≥ λ · c(δ(S)), such that G \ (δ(S) \ F) ∈ Π. Observe from the definitions that any graph property which is strongly λ-extendible is also λ-extendible. It follows that Poljak and Turzík's result for λ-extendible properties applies also to strongly λ-extendible properties. [18] Let G be a class of (possibly oriented and/or (cid:73) Theorem 3 (Poljak-Turzík bound). labelled) graphs. Let 0 < λ < 1, and let Π ⊆ G be a strongly λ-extendible property. For any connected graph G ∈ G and weight function c : E(G) → R+, there exists a spanning subgraph H ∈ Π of G such that c(E(H)) ≥ λ · c(E(G)) + 1−λ 2 c(T), where T is the set of edges in a minimum-weight spanning tree of GS. When all edges are assigned weight 1, we get: (cid:73) Corollary 4. Let G, λ, Π be as in Theorem 3. Any connected graph G ∈ G on n vertices and m edges has a spanning subgraph H ∈ Π with at least λm + 1−λ 2 (n − 1) edges. Our results apply to properties which satisfy the additional requirement of being FPT on almost-forests of cliques. (cid:73) Definition 5 (FPT on almost-forests of cliques). Let 0 < λ < 1, and let Π be a strongly λ-extendible property (of graphs with or without orientations/labels). The Structured Above Poljak-Turzík (Π) problem is a variant of the Above Poljak-Turzík (Π) problem in which, along with the graph G and k ∈ N, the input contains a set S ⊆ V (G) such that S = O(k) and G \ S is a forest of cliques. We say that the property Π is FPT on almost-forests of cliques if the Structured Above Poljak-Turzík (Π) problem is FPT. In other words, a λ-extendible property Π is FPT on almost-forests of cliques, if for any constant q there is an algorithm that, given a connected graph G, k and a set S ⊆ V (G) of size at most q · k such that G \ S is a forest of cliques, correctly decides whether (G, k) is a yes-instance of APT(Π) in O(f(k) · nO(1)) time, for some computable function f. 6 Beyond Max-Cut: Parameterizing above the Poljak-Turzík Bound Fixed-Parameter Algorithms for Above Poljak-Turzík (Π) 3 We now prove Theorem 1 using the approach which Crowston et al. used for Max-Cut [5]. The crux of their approach is a polynomial-time procedure which takes the input (G, k) of Max-Cut and finds a subset S ⊆ V (G) such that (i) G \ S is a forest of cliques, and (ii) if (G, k) is a NO instance, then S ≤ 3k. Thus if S > 3k, then one can immediately answer YES; otherwise one solves the problem in FPT time using the fact that Max-Cut is FPT on almost-forests of cliques (Definition 5). The nontrivial part of our work consists of proving that the procedure for Max-Cut applies also to the much more general family of strongly λ-extendible problems, where the bound on the size of S depends on λ. To do this, we show that each of the four rules used for Max-Cut is safe to apply for any strongly λ-extendible property. From this we get (cid:73) Lemma 6. Let 0 < λ < 1, and let Π be a strongly λ-extendible graph property. Given a connected graph G with n vertices and m edges and an integer k, in polynomial time we can do one of the following: 2 (n − 1) + k 1. Decide that there is a spanning subgraph H ∈ Π of G with at least λm + 1−λ edges, or; 1−λ k vertices in G such that G \ S is a forest of cliques. 2. Find a set S of at most This also holds for strongly λ-extendible properties of oriented and/or labelled graphs. 6 We give an algorithmic proof of Lemma 6. Let (G, k) be an instance of Above Poljak- Turzík (Π). The algorithm initially sets G := G, S := ∅, k := k, and then applies a series of rules to the tuple ( G, S, k). Each application of a rule to ( G, S, k) produces a tuple (G0, S0, k0) such that (i) if G \ S is connected then so is G0 \ S0, and (ii) if ( G \ S, k) is a NO instance of APT(Π) then so is (G0 \ S0, k0); the converse may not hold. The algorithm then sets G := G0, S := S0, k := k0, and repeats the process, till none of the rules applies. These rules -- but for minor changes -- and the general idea of "preserving a NO instance" are due to Crowston et al. [5]. 2(1 − λ) so that λ + 2λ0 = 1. We now state the four rules and show that they suffice to prove Lemma 6. We assume throughout that λ and Π are as in Lemma 6. For brevity we assume that the empty graph is in Π, and we let λ0 = 1 (cid:73) Rule 1. Let G \ S be connected. If v ∈ (V ( G) \ S) and X ⊆ (V ( G) \ ( S ∪ {v})) are such that (i) G[X] is a connected component of G \ ( S ∪ {v}), and (ii) X ∪ {v} is a clique in G, then delete X from G to get G0; set S0 = S, k0 = k. (cid:73) Rule 2. Let G \ S be connected. Suppose Rule 1 does not apply, and let X1, . . . , X' be the connected components of G \ ( S ∪ {v}) for some v ∈ V ( G) \ S. If at least one of the Xis is a clique, and at most one of them is not a clique, then Delete all the Xis which are cliques -- let these be d in number -- to get G0, and Set S0 := S ∪ {v} and k0 := k − dλ0. (cid:73) Rule 3. Let G \ S be connected. If a, b, c ∈ V ( G) \ S are such that {a, b},{b, c} ∈ E( G), {a, c} /∈ E( G), and G \ ( S ∪ {a, b, c}) is connected, then Set S0 := S ∪ {a, b, c} and k0 := k − λ0. (cid:73) Rule 4. Let G \ S be connected. Suppose Rule 3 does not apply, and let x, y ∈ V ( G) \ S be such that 1. {x, y} /∈ E( G); Matthias Mnich, Geevarghese Philip, Saket Saurabh and Ondřej Suchý 7 2. Let C1, . . . , C' be the connected components of G \ ( S ∪ {x, y}). There is at least one Ci such that both V (Ci) ∪ {x} and V (Ci) ∪ {y} are cliques in G \ S, and there is at most one Ci for which this does not hold. Then Delete all the Cis which satisfy condition (2) to get G0, and, Set S0 := S ∪ {x, y}, k0 := k − λ0. Let (G?, S, k?) be the tuple which we get by applying these rules exhaustively to the input tuple (G,∅, k). To prove Lemma 6, it is sufficient to prove the following claims: (i) the rules can be exhaustively applied in polynomial time; (ii) G \ S is a forest of cliques; (iii) the rules transform NO-instances to NO-instances; and, (iv) if (G, k) is a NO instance, then S ≤ q(λ)k. We now proceed to prove these over several lemmata. Our rules are identical to those of Crowston et al. in how the rules modify the graph; the only difference is in how we change the parameter k. The first two claims thus follow directly from their work. (cid:73) Lemma 7. [?]2 Rules 1 to 4 can be exhaustively applied to an instance (G, k) of Above Poljak-Turzík (Π) in polynomial time. The resulting tuple (G?, S, k?) has V (G?)\ S ≤ 1. (cid:73) Lemma 8. [5, Lemma 8] Let (G?, S, k?) be the tuple obtained by applying Rules 1 to 4 exhaustively to an instance (G, k) of Above Poljak-Turzík (Π). Then G \ S is a forest of cliques. The correctness of the remaining two claims is a consequence of the λ-extendibility of property Π, and we make critical use of this fact in building the rest of our proof. This is the one place where this work is significantly different from the work of Crowston et al.; they could take advantage of the special characteristics of one specific property, namely bipartitedness, to prove the analogous claims for Max-Cut. We say that a rule is safe if it preserves NO instances. (cid:73) Definition 9. Let ( G, S, k) be an arbitrary tuple to which one of the rules 1, 2, 3, or 4 applies, and let (G0, S0, k0) be the resulting tuple. We say that the rule is safe if, whenever (G0 \ S0, k0) is a YES instance of Above Poljak-Turzík (Π), then so is ( G \ S, k). We now prove that each of the four rules is safe. For a graph G we use val(G) to denote the maximum number of edges in a subgraph H ∈ Π of G, and pt(G) to denote the Poljak-Turzík bound for G. Thus if G is connected and has n vertices and m edges then pt(G) = λm + λ0(n − 1), and Corollary 4 can be written as val(G) ≥ pt(G). For each rule we assume that G0 \ S0 has a spanning subgraph H0 ∈ Π with at least pt(G0 \ S0) + k0 edges, and show that G \ S has a spanning subgraph H ∈ Π with at least pt( G \ S) + k edges. We first derive a couple of lemmas which describe how contributions from subgraphs of a graph G add up to yield lower bounds on val(G). (cid:73) Lemma 10. [?] Let v be a cut vertex of a connected graph G, and let C = C1, C2, . . . Cr; r ≥ 2 be sets of vertices of G such that for every i 6= j we have Ci ∩ Cj = {v}, there is no edge 1≤i≤r Ci = V (G). For 1 ≤ i ≤ r, let Hi ∈ Π be a i=1 E(Hi)). Then H is a between Ci \ {v} and Cj \ {v} and S subgraph of G[Ci] with pt(G[Ci]) + ki edges, and let H = (V (G),Sr subgraph of G, H ∈ Π, and E(H) ≥ pt(G) +Pr i=1 ki. 2 Proofs of results marked with a ? have been moved to Appendix A. 8 Beyond Max-Cut: Parameterizing above the Poljak-Turzík Bound (cid:73) Lemma 11. [?] Let G be a graph, and let S ⊆ V (G) be such that there exists a subgraph HS ∈ Π of G[S] with at least pt(G[S]) + λ0 + kS edges, and a subgraph H ∈ Π of G \ S with at least pt(G \ S) + λ0 + k edges. Then there is a subgraph H ∈ Π of G with at least pt(G) + λ0 + kS + k edges. This lemma has a useful special case which we state as a corollary: (cid:73) Corollary 12. Let G be a graph, and let S ⊆ V (G) be such that there exists a subgraph HS ∈ Π of G[S] with at least pt(G[S]) + λ0 + kS edges, and the subgraph G \ S has a perfect matching. Then there is a subgraph H ∈ Π of G with at least pt(G) + λ0 + kS edges. Proof. Recall that the graph K2 is in Π by definition, and observe that pt(K2) = λ+λ0. Thus K2 has pt(K2) + λ0 edges. The corollary now follows by repeated application of Lemma 11, (cid:74) each time considering a new edge of the matching as the graph H. The safeness of Rule 1 is now a consequence of the block additivity property. (cid:73) Lemma 13. Rule 1 is safe. Proof. Let C1 = X ∪ {v} and C2 = V ( G) \ ( S ∪ X) = V (G0) \ S0. Observe that (i) v is a cut vertex of G \ S, C1 ∩ C2 = {v}, there are no edges between C1 \ {v} and C2 \ {v} by assumptions of the rule, and C1 ∪ C2 = V ( G) \ S. Also by assumption, there is a spanning subgraph H1 ∈ Π of G0 \ S0 = G[C2] such that E(H1) ≥ pt(G0 \ S0) + k0. By Corollary 4 there is a subgraph H2 ∈ Π of G[C2] with E(H2) ≥ pt( G[C2]). Hence Lemma 10 applies and G \ S has a spanning subgraph H ∈ Π with E(H) ≥ pt( G \ S) + k0 = pt( G \ S) + k. (cid:74) We now prove some useful facts about certain simple graphs, in the context of strongly λ-extendible properties. Observe that every block of a forest is one of {K1, K2}, which are both in Π. From this and the block additivity property of Π we get (cid:73) Observation 14. Every forest (with every orientation and labeling) is in Π. The graph K2,1 is a useful special case. (cid:73) Observation 15. The graph K2,1 -- also with any kind of orientation or labelling -- is in Π, and it has pt(K2,1) + λ0 + λ0 edges. The graph obtained by removing one edge from K4 is another useful object, since it always has more edges than its Poljak-Turzík bound. (cid:73) Lemma 16. [?] Let G be a graph formed from the graph K4 -- also with any kind of orientation or labelling -- by removing one edge. Then (i) val(G) ≥ 3, (ii) val(G) ≥ 4 if λ > 1/3, and (iii) val(G) = 5 if λ > 1/2. As a consequence,  val(G) ≥ pt(G) + λ0 + (1 − 3λ) (2 − 3λ) (3 − 3λ) if λ ≤ 1/3, if 1/3 < λ ≤ 1/2, and, if λ > 1/2. (1) The above lemmata help us prove that Rules 2 and 3 are safe. (cid:73) Lemma 17. [?] Rule 2 is safe. Following the notation of Rule 3, observe that for the vertex subset T = {a, b, c} ⊆ V ( G\ S) we have -- from Observation 15 -- that G[T] ∈ Π and val(T) ≥ pt(T) + λ0 + λ0. Since G0 \ S0 = ( G \ S) \ T, if val(G0 \ S0) ≥ pt(G0 \ S0) + k0 then applying Lemma 11 we get that val( G \ S) ≥ pt( G \ S) + λ0 + k0 = pt( G \ S) + k. Hence we get Matthias Mnich, Geevarghese Philip, Saket Saurabh and Ondřej Suchý 9 (cid:73) Lemma 18. Rule 3 is safe. To show that Rule 4 is safe, we need a number of preliminary results. We first observe that -- while the rule is stated in a general form -- the rule only ever applies when it can delete exactly one component. (cid:73) Observation 19. [?] Whenever Rule 4 applies, there is exactly one component to be deleted, and this component has at least 2 vertices. Our next few lemmas help us further restrict the structure of the subgraph to which Rule 4 applies. We start with a result culled from Crowston et al.'s analysis of the four rules. [5][?] If none of Rules 1, 2, and 3 applies to ( G, S, k), and Rule 4 does (cid:73) Lemma 20. apply, then one can find A vertex r ∈ V ( G \ S) and a set X ⊆ V ( G \ S) such that X is a connected component of G \ ( S ∪ {r}), and the graph ( G \ S)[X ∪ {r}] is 2-connected; Vertices x, y ∈ X such that {x, y} /∈ E( G) and ( G \ S) \ {x, y} has exactly two components G0, C, r ∈ G0; C ∪ {x}, C ∪ {y} are cliques, and each of x, y is adjacent to some vertex in G0 From this we get the following. (cid:73) Lemma 21. [?] Suppose Rules 1, 2, and 3 do not apply, and Rule 4 applies. Then we can apply Rule 4 in such a way that if x, y are the vertices to be added to S and C the clique to be deleted, then N(x) ∪ N(y) \ (C ∪ S) contains at most one vertex z such that G \ ( S ∪ {z}) is disconnected. We now show that in such a case N(x) \ (C ∪ S) = N(y) \ (C ∪ S) = {r}, and so the graph G \ ( S ∪ {r}) is not connected. First we need the following simple lemma. (cid:73) Lemma 22. [?] Whenever Rule 4 applies, with x, y the vertices to be added to S and C the clique to be deleted, every u in N(x) \ (C ∪ S) is a cut vertex in G \ ( S ∪ {x}) and every u in N(y) \ (C ∪ S) is a cut vertex in G \ ( S ∪ {y}). This allows us to enforce a very special way of applying Rule 4. (cid:73) Lemma 23. [?] Suppose Rules 1, 2, and 3 do not apply, and Rule 4 applies. Then we can apply Rule 4 in such a way that if x, y are the vertices to be added to S and C the clique to be deleted, then N(x) \ (C ∪ S) = N(y) \ (C ∪ S) = {z}, and G \ ( S ∪ {z}) is disconnected. These lemmas help us prove that Rule 4 is safe. (cid:73) Lemma 24. [?] Rule 4 is safe. The next lemma gives us a bound on the size of the set S which we compute. (cid:73) Lemma 25. [?] Let G be a connected graph, S ⊆ V ( G), and k ∈ N, and let one application of Rule 1, 2, 3, or 4 to ( G, S, k) result in the tuple (G0, S0, k0). Then S0 \ S ≤ 3(k − k0)/λ0. Now we are ready to prove Lemma 6, and thence our main theorem. Proof (of Lemma 6). Let (G, k) be an input instance of Above Poljak-Turzík (Π), and let (G?, S, k?) be the tuple which we get by applying the four rules exhaustively to the tuple (G,∅, k). From Lemma 7 we know that this can be done in polynomial time, and that the resulting graph satisfies V (G?) \ S ≤ 1. 10 Beyond Max-Cut: Parameterizing above the Poljak-Turzík Bound Thus G? \ S is either K1 or the empty graph, and so G? \ S ∈ Π and pt(G? \ S) = 0,E(G? \ S) = 0. Hence if k? ≤ 0 then (G? \ S, k?) is a YES instance of Above Poljak- Turzík (Π). Since all the four rules are safe -- Lemmas 13, 17, 18, and 24 -- we get that in this case (G, k) is a YES instance, and we can return YES. On the other hand if k? > 0 then we know -- using Lemma 25 -- that S < 3k/λ0 = 6k/(1− λ), and -- from Lemma 8 -- that G \ S is a forest of cliques. This completes the proof. (cid:74) Proof (of Theorem 1). From Lemma 6 we know that in polynomial time we can either answer YES, or find a set S such that S ≤ 6 1−λ k and G\ S is a forest of cliques. In the latter case we have reduced the original problem instance to an instance of Structured Above Poljak-Turzík (Π) (See Definition 5). The theorem follows since -- by assumption -- this (cid:74) latter problem is FPT. Applications 4 In this section we use Theorem 1 to show that Above Poljak-Turzík (Π) is FPT for almost all natural examples of λ-extendible properties listed by Poljak and Turzík [18]. For want of space, we defer the definitions and all proofs to Appendix B. 4.1 Application to Partitioning Problems First we focus on properties specified by a homomorphism to a vertex transitive graph. As a graph is h-colorable if and only if it has a homomorphism to Kh, searching for a maximal h-colorable subgraph is one of the problems resolved in this section. In particular, a maximum cut equals a maximum bipartite subgraph and, hence, is also one of the properties studied in this section. We use G to denote the class of graphs -- oriented or edge-labelled -- to which the property in question belongs. It is not difficult to see that every vertex-transitive graph G is a regular graph. In particular, if G allows labels and/or orientations, then for every label and every orientation each vertex of a vertex transitive graph is incident to the same number of edges of the given label and the given orientation. (cid:73) Lemma 26. [?] Let G0 be a vertex-transitive graph with at least one edge of every label and orientation allowed in G. Then the property "to have a homomorphism to G0" is strongly d/n0-extendible in G, where n0 is the number of vertices of G0 and d is the minimum number of edges of the given label and the given orientation incident to any vertex of G0 over all labels and orientations allowed in G. Note that while the above lemma poses no restrictions on the graphs considered, we can prove the following only for simple graphs. (cid:73) Lemma 27. [?] If G0 is an unoriented unlabeled graph, then the property "to have a homomorphism into G0" is FPTon almost-forests of cliques. Lemma 26 and Lemma 27, together with Theorem 1 immediately imply the following corollary. (cid:73) Corollary 28. The problem APT("to have a homomorphism into G0") is fixed-parameter tractable for every unoriented unlabeled vertex transitive graph G0. In particular, by setting G0 = Kq we get the following result. Matthias Mnich, Geevarghese Philip, Saket Saurabh and Ondřej Suchý 11 (cid:73) Corollary 29. Given a graph G with m edges and n vertices and an integer k, it is FPT to decide, whether G has an q-colorable subgraph with at least m · (q − 1)/q + (n − 1)/(2q) + k edges. This shows that the Max q-Colorable Subgraph problem is FPT when parameterized above the Poljak and Turzík bound [18]. 4.2 Finding Acyclic Subgraphs of Oriented Graphs In this section we show how to apply our result to the problem of finding a maximum-size directed acyclic subgraph of an oriented graph, where the size of the subgraph is defined as the number of arcs in the subgraph. Recall that an oriented graph is a directed graph where between any two vertices there is at most one arc. We show that Theorem 1 applies to this problem. To this end we need the following two lemmata. (cid:73) Lemma 30. [?] The property Π : "acyclic oriented graphs" is strongly 1/2-extendible in the class of oriented graphs. (cid:73) Lemma 31. [?] The property "acyclic oriented graphs" is FPT on almost-forests of cliques. Combining Lemmata 30 and 31 with Theorem 1 we get the following corollary. (cid:73) Corollary 32. The problem APT("acyclic oriented graphs") is fixed-parameter tractable. To put this result in some context, we recall a couple of open problems posed by Raman and Saurabh [19]: Are the following questions FPT parameterized by k? Given an oriented directed graph on n vertices and m arcs, does it have a subset of at least m/2 + 1/2(dn − 1/2e) + k arcs that induces an acyclic subgraph? Given a directed graph on n vertices and m arcs, does it have a subset of at least m/2 + k arcs that induces an acyclic subgraph ? In the first question, a "more correct" lower bound is the one of Poljak and Turzík, i.e., m/2 + 1/2(n − 1)/2, and the lower bound is true only for connected graphs. Corollary 32 answers the corrected question. Without the connectivity requirement, one can show by adding sufficient number of disjoint oriented 3-cycles that the problem is NP-hard already for k = 0. For the second question, observe that each maximal acyclic subgraph contains exactly one arc from every pair of opposite arcs. Hence we can remove these pairs from the digraph without changing the relative solution size, as exactly half of the removed arcs can be added to any solution to the modified instance. Thus, we can we can restrict ourselves to oriented graphs. Now suppose that the oriented graph we are facing is disconnected. It is easy to check that picking two vertices from different connected components and identifying them does not change the solution size, as this way we never create a cycle from an acyclic graph. After applying this reduction rule exhaustively, the digraph becomes an oriented connected graph, and the parameter is unchanged. But then if k ≤ (n − 1)/4 then m/2 + k ≤ m/2 + (n − 1)/4 and we can answer YES due to Corollary 4. Otherwise n ≤ 4k, we have a linear vertex kernel, and we can solve the problem by the well known dynamic programming on the kernel [20]. The total running time of this algorithm is O(24k · k2 + m). The smallest kernel previously known for this problem is by Gutin et al., and has a quadratic number of arcs [13]. 12 Beyond Max-Cut: Parameterizing above the Poljak-Turzík Bound 5 Conclusion and Open Problems In this paper we studied a generalization of the graph property of being bipartite, from the point of view of parameterized algorithms. We showed that for every strongly λ-extendible property Π which satisfies an additional "solvability" constraint, the Above Poljak-Turzík (Π) problem is FPT. As an illustration of the usefulness of this result, we obtained FPT algorithms for the above-guarantee versions of three graph problems. Note that for each of the three problems -- Max-Cut,Max q-Colorable Subgraph, and Oriented Max Acyclic Digraph -- for which we used Theorem 1 to derive FPT algorithms for the above-guarantee question, we needed to device a separate FPT algorithm which works for graphs that are at a vertex deletion distance of O(k) from forests of cliques. We leave open the important question of finding a right logic that captures these examples, and of showing that any problem expressible in this logic is FPT parameterized by deletion distance to forests of cliques. We also leave open the kernelization complexity question for λ-extendible properties. References 1 N. Alon, G. Gutin, E. J. Kim, S. Szeider, and A. Yeo. Solving Max-r-Sat above a tight 10 9 C. S. Edwards. An improved lower bound for the number of edges in a largest bipartite subgraph. In Recent Advances in Graph Theory, pages 167 -- 181. 1975. P. Erdős. On some extremal problems in graph theory. Israel Journal of Mathematics, 3:113 -- 116, 1965. J. Flum and M. Grohe. Parameterized Complexity Theory. Springer-Verlag, 2006. 11 12 M. X. Goemans and D. P. Williamson. Improved approximation algorithms for maximum cut and satisfiability problems using semidefinite programming. J. ACM, 42:6, 1995. 13 G. Gutin, E. J. Kim, S. Szeider, and A. Yeo. A probabilistic approach to problems para- meterized above or below tight bounds. J. Comp. Sys. Sci., 77(2):422 -- 429, 2011. 14 R. M. Karp. Reducibility among combinatorial problems. In Complexity of Computer Communications, pages 85 -- 103, 1972. S. Khot, G. Kindler, E. Mossel, and R. O'Donnell. Optimal inapproximability results for max-cut and other 2-variable CSPs? SIAM Journal on Computing, 37(1):319 -- 357, 2007. 16 M. Mahajan and V. Raman. Parameterizing above guaranteed values: MaxSat and MaxCut. 15 Journal of Algorithms, 31(2):335 -- 354, 1999. 17 M. Mahajan, V. Raman, and S. Sikdar. Parameterizing above or below guaranteed values. Journal of Computer and System Sciences, 75:137 -- 153, 2009. lower bound. Algorithmica, 61(3):638 -- 655, 2011. 2 B. Bollobas and A. Scott. Better bounds for max cut. Contemporary Combinatorics, Bolyayi Society Mathematical Studies, 10:185 -- 246, 2002. 3 R. Crowston, M. R. Fellows, G. Gutin, M. Jones, F. A. Rosamond, S. Thomassé, and A. Yeo. Simultaneously satisfying linear equations over F2: MaxLin2 and Max-r-Lin2 parameterized above average. In FSTTCS 2011, volume 13 of LIPIcs, pages 229 -- 240. 4 R. Crowston, G. Gutin, M. Jones, V. Raman, and S. Saurabh. Parameterized complexity of MaxSat above average. In LATIN 2012, volume 7256 of LNCS, pages 184 -- 194, 2012. 5 R. Crowston, M. Jones, and M. Mnich. Max-cut parameterized above the Edwards-Erdős bound. In ICALP 2012, volume 7391 of LNCS, pages 242 -- 253. 2012. 6 R. Diestel. Graph Theory, volume 173 of Graduate Texts in Mathematics. Springer, 2010. 7 R. G. Downey and M. R. Fellows. Parameterized Complexity. Springer, 1999. 8 C. S. Edwards. Some extremal properties of bipartite subgraphs. Canadian Journal of Mathematics, 25:475 -- 483, 1973. Matthias Mnich, Geevarghese Philip, Saket Saurabh and Ondřej Suchý 13 18 S. Poljak and D. Turzík. A polynomial time heuristic for certain subgraph optimization problems with guaranteed worst case bound. Discrete Mathematics, 58(1):99 -- 104, 1986. 19 V. Raman and S. Saurabh. Parameterized algorithms for feedback set problems and their duals in tournaments. Theoretical Computer Science, 351(3):446 -- 458, 2006. 20 V. Raman and S. Saurabh. Improved fixed parameter tractable algorithms for two "edge" problems: MAXCUT and MAXDAG. Information Processing Letters, 104(2):65 -- 72, 2007. J. Spencer. Optimal ranking of tournaments. Networks, 1(2):135 -- 138, 1971. 21 14 Beyond Max-Cut: Parameterizing above the Poljak-Turzík Bound A Deferred Proofs (cid:73) Lemma 7. Rules 1 to 4 can be exhaustively applied to an instance (G, k) of Above Poljak-Turzík (Π) in polynomial time. The resulting tuple (G?, S, k?) has V (G?)\ S ≤ 1. Proof. Let ( G, S, k), (G0, S0, k0) be as in the description above. It is not difficult to verify that (i) each rule can be applied once in polynomial time, (ii) for each application of a rule, if G \ S is connected then so also is G0 \ S0, and (iii) each rule strictly reduces the size of the graph G \ S -- either by deleting vertices from G, or by adding vertices to S. Crowston et al. have shown [5, Lemma 7] that if G \ S is a connected graph with at least two vertices, then at least one of these four rules apply to the tuple ( G, S, k). Since none of the conditions for applying a reduction rule depends on the value of k, and since the only difference between our set of rules and theirs is the way in which k is modified, their result implies this lemma. (cid:74) (cid:73) Lemma 10. Let v be a cut vertex of a connected graph G, and let C = {C1, C2, . . . Cr}; r ≥ 2 be a family of sets of vertices of G such that for every i 6= j we have Ci ∩ Cj = {v}, there is 1≤i≤r Ci = V (G). For 1 ≤ i ≤ r, let Hi ∈ Π be i=1 E(Hi)). Then H is no edge between Ci \ {v} and Cj \ {v} andS a subgraph of G[Ci] with pt(G[Ci]) + ki edges, and let H = (V (G),Sr a subgraph of G, H ∈ Π, and E(H) ≥ pt(G) +Pr Proof. Since there are no edges between Ci\{v} and Cj\{v} for i 6= j, andS 1≤i≤r Ci = V (G), every edge of G is in exactly one G[Ci]. Therefore, H is a subgraph of G. Also as v is a cut vertex in G, it is a cut vertex in H and the blocks of H are exactly the blocks of Hi's. Since each Hi is in Π it follows from the block additivity property of Π that H ∈ Π. i=1 ki. Since pt(G[Ci]) = λeG(Ci) + λ0(Ci − 1), we get E(H) = E(Hi) = (pt(G[Ci]) + ki) = λ Ci − 1 + ki rX rX i=1 i=1 = λE(G) + λ0(V (G) − 1) + rX i=1 eG(Ci) + λ0 rX rX i=1 ki. ki = pt(G) + rX rX i=1 i=1 i=1 (cid:74) (cid:73) Lemma 11. Let G be a graph, and let S ⊆ V (G) be such that there exists a subgraph HS ∈ Π of G[S] with at least pt(G[S]) + λ0 + kS edges, and a subgraph H ∈ Π of G \ S with at least pt(G \ S) + λ0 + k edges. Then there is a subgraph H ∈ Π of G with at least pt(G) + λ0 + kS + k edges. Proof. Let F = δ(S), and consider the subgraph G0 = (V (G), E(HS) ∪ E(H) ∪ F). Observe that G0[S] = HS ∈ Π, and G0 \ S = H ∈ Π. Thus the strong λ-subgraph extension property of Π applies to the pair (G0, S), and for the weight function which assigns unit weights to all edges in G0, we get that the graph G0 has a spanning subgraph H ∈ Π which contains all the edges in E(HS) ∪ E(H) and at least a λ-fraction of the edges in F. Thus E(H) ≥ E(HS) + E(H) + λF ≥ pt(G[S]) + λ0 + kS + pt(G \ S) + λ0 + k + λF = λ(E(G[S]) + E(G \ S) + F) + λ0(S + V (G) \ S) + kS + k = λE(G) + λ0V (G) + kS + k = pt(G) + λ0 + kS + k (cid:74) Matthias Mnich, Geevarghese Philip, Saket Saurabh and Ondřej Suchý 15 (cid:73) Lemma 16. Let G be a graph formed from the graph K4 -- also with any kind of orientation or labelling -- by removing one edge. Then (i) val(G) ≥ 3, (ii) val(G) ≥ 4 if λ > 1/3, and (iii) val(G) = 5 if λ > 1/2. As a consequence, val(G) ≥ pt(G) + λ0 + (1 − 3λ) (2 − 3λ) (3 − 3λ) if λ ≤ 1/3, if 1/3 < λ ≤ 1/2, and, if λ > 1/2. (2)  Proof. A spanning tree of G has three edges, and so claim (i) follows from Observation 14. Let V (G) = {x, y, u, v}, and let {x, y} /∈ E(G). Consider the vertex subset S = {x, v}, for which G[S] = K2 ∈ Π, G \ S = G[{y, u}] = K2 ∈ Π, and δ(S) = 3. Applying the strong λ-subgraph extension property -- for unit edge weights -- on the set S we get that there exists a subgraph H0 ∈ Π of G which has at least 2 + 3λ edges. Since λ > 1/3 =⇒ 2 + 3λ > 3, we get claim (ii). Now consider the subgraph G0 = G[{x, u, v}], and its vertex subset S0 = {x}. We apply the strong λ-subgraph extension property -- again for unit edge weights -- to the pair (G0, S0). Since G0[S0] = K1 ∈ Π, G0 \ S0 = K2 ∈ Π and δ(S0) = 2, there exists a subgraph H00 ∈ Π of G0 which has at least 1 + 2λ edges. For λ > 1/2 this is at least 3 edges, and so in this case H00 = G0 and G[{x, u, v}] ∈ Π. Hence we can use the strong λ-subgraph extension property for G and S = {y} to get a subgraph of G with at least 3 + 2λ edges. For λ > 1/2 this means all the five edges of G, proving claim (iii). The second part of the lemma follows from these claims since 2λ + 4λ0 = 2. (cid:74) (cid:73) Lemma 17. Rule 2 is safe. Proof. We reuse the notation of the rule. Let X1, . . . , Xd be the cliques deleted by the rule, and let Xd+1 be the remaining component (if any) of G \ ( S ∪ {v}). For 1 ≤ i ≤ d + 1 let Ci = Xi ∪ {v}. Since G[Cd+1] = G0 \ S0, by assumption we have that val( G[Cd+1]) = val(G0 \ S0) ≥ pt(G0 \ S0) + k0 = pt( G[Cd+1]) + k0. As we show below, for 1 ≤ i ≤ d we have that val( G[Ci]) ≥ pt( G[Ci]) + λ0. Applying Lemma 10 to the graph G \ S and the family C = {C1, . . . , Cd+1}, we get val( G \ S) ≥ pt( G \ S) + dλ0 + k0 = pt( G \ S) + k, where the last equality uses the fact that k0 + dλ0 = k. To complete the proof it is sufficient to show that val( G[Ci]) ≥ pt( G[Ci]) + λ0; 1 ≤ i ≤ d. Consider a deleted clique Xi. Since (i) G \ S is connected, and (ii) Rule 1 does not apply, it follows that there exist x, y ∈ Xi such that x is adjacent to v and y is not adjacent to v in G \ S. We now consider two cases. If Xi is even, then consider the vertex subset T = {v, x, y}. The subgraph G[T] = K2,1 ∈ Π of G[Ci] has pt( G[T])+ λ0 + λ0 edges (Observation 15). Since Ci\ T = Xi\{x, y} is a clique in G[Ci] with an even number of vertices, it contains a perfect matching. Therefore we get from Corollary 12 that the graph G[Ci] has a subgraph H ∈ Π with at least pt( G[Ci]) + 2λ0 edges. If Xi is odd, then let T = {x, v}. Now the subgraph G[T] = K2 ∈ Π of G[Ci] has at least pt( G[T]) + λ0 edges. Also, Ci \ T = Xi \ {x} is a clique in G[Ci] with an even number of vertices and hence has a perfect matching. Once again using Corollary 12, we get that G[Ci] has a subgraph H ∈ Π with at least pt( G[Ci]) + λ0 edges. (cid:74) (cid:73) Observation 19. Whenever Rule 4 applies, there is exactly one component to be deleted, and this component has at least 2 vertices. 16 Beyond Max-Cut: Parameterizing above the Poljak-Turzík Bound Proof. Suppose the rule can be applied, and there are at least 2 components to be deleted. Pick two vertices u and v in two such distinct components. If the graph G \ ( S ∪ {x}) is disconnected, then there is a component Cx of this graph which is not connected to y. Similarly, if G \ ( S ∪ {y}) is disconnected, then there is a component Cy of this graph which is not connected to x. But if either of these happens, then since neither Cx ∪ {y} nor Cy ∪ {x} is a clique, the rule does not apply -- a contradiction. Hence we get that the graph G \ ( S ∪ {x}) is connected. But then so is the graph G \ ( S ∪ {u, x, v}), and as we have {u, x},{x, v} ∈ E( G), {u, v} /∈ E( G), Rule 3 applies -- a contradiction. So there is exactly one component to be deleted. Now if the only component to be deleted has only one vertex v, then G \ ( S ∪ {x, v, y}) is connected, we have {x, v},{v, y} ∈ E( G), {x, y} /∈ E( G), and (cid:74) so Rule 3 applies, a contradiction. (cid:73) Lemma 20. then one can find If none of Rules 1, 2, and 3 applies to ( G, S, k), and Rule 4 does apply, A vertex r ∈ V ( G \ S) and a set X ⊆ V ( G \ S) such that X is a connected component of G \ ( S ∪ {r}), and the graph ( G \ S)[X ∪ {r}] is 2-connected; Vertices x, y ∈ X such that {x, y} /∈ E( G) and ( G \ S) \ {x, y} has exactly two components G0, C, r ∈ G0, and C ∪ {x}, C ∪ {y} are cliques, and, Each of x, y is adjacent to some vertex in G0 Proof. Crowston et al. show [5, Lemma 7] that to any connected graph with at least one edge, at least one of Rules 1 -- 4 applies. Our lemma corresponds directly to case 1.(b).iii.C of their case analysis, by setting a = x, c = y. For the last point, observe that if one of x, y is (cid:74) not adjacent to any vertex in G0, then Rule 2 would apply. (cid:73) Lemma 21. Suppose Rules 1, 2, and 3 do not apply, and Rule 4 applies. Then we can apply Rule 4 in such a way that if x, y are the vertices to be added to S and C the clique to be deleted, then N(x) ∪ N(y) \ (C ∪ S) contains at most one vertex z such that G \ ( S ∪ {z}) is disconnected. Proof. In the application of Rule 4 we set x, y, C as in Lemma 20. Further, let r, X be as in Lemma 20. Then since x, y ∈ X and X is a connected component of G \ ( S ∪ {r}), we have that (N(x) ∪ N(y)) ⊆ X ∪ {r}. Since ( G \ S)[X ∪ {r}] is 2-connected, it follows that r is the only vertex in X ∪ {r} which could possibly be a cut vertex of ( G \ S). (cid:74) (cid:73) Lemma 22. Whenever Rule 4 applies, with x, y the vertices to be added to S and C the clique to be deleted, every u in N(x) \ (C ∪ S) is a cut vertex in G \ ( S ∪ {x}) and every u in N(y) \ (C ∪ S) is a cut vertex in G \ ( S ∪ {y}). Proof. We only prove the first part, and the second part follows by symmetry. Assume that for some u ∈ N(x)\(C ∪ S) the graph G\( S∪{x, u}) is connected, and let w be a vertex of C. Since C ≥ 2, the graph G \ ( S ∪ {x, u, w}) is also connected and as {x, u},{x, w} ∈ E and {u, w} /∈ E, Rule 3 applies to G\ S -- a contradiction. Hence G\ ( S ∪{x, u}) is disconnected for every u ∈ N(x) \ (C ∪ S). (cid:74) (cid:73) Lemma 23. Suppose Rules 1, 2, and 3 do not apply, and Rule 4 applies. Then we can apply Rule 4 in such a way that if x, y are the vertices to be added to S and C the clique to be deleted, then N(x) \ (C ∪ S) = N(y) \ (C ∪ S) = {z}, and G \ ( S ∪ {z}) is disconnected. Matthias Mnich, Geevarghese Philip, Saket Saurabh and Ondřej Suchý 17 Proof. In the application of Rule 4 we set x, y, C as in Lemma 20. Then Lemma 21 applies to this application. Let G0 be as in Lemma 20. Then G0 = G \ ( S ∪ C ∪ {x, y}), and from the last point of Lemma 20 we get that N(x) \ (C ∪ S) 6= ∅ and N(y) \ (C ∪ S) 6= ∅. First, observe that if N(x) \ (C ∪ S) = {z}, then G \ ( S ∪ {x, z}) is disconnected only if G \ ( S ∪ {z}) is disconnected and so from Lemma 22 we get that z is a cut vertex of G \ S. By a similar argument, if N(y) \ (C ∪ S) = {z} then z is a cut vertex of G \ S. Now if N(x) \ (C ∪ S) = N(y) \ (C ∪ S) = 1 and N(x) \ (C ∪ S) 6= N(y) \ (C ∪ S), then we have two different cut vertices of G \ S adjacent to vertices x and y, contradicting Lemma 21. So if N(x) \ (C ∪ S) = N(y) \ (C ∪ S) = 1 then there is nothing more to prove. Next we consider the case N(x)\(C∪ S) ≥ 2. Let Z = N(x)\(C∪ S), Gx = G\( S∪{x}). We claim that there exist two vertices a1 6= a2 ∈ Z and two vertex subsets A1, A2 ⊆ V (Gx) such that (i) A1 is a connected component of Gx \ {a1}, (ii) A2 is a connected component of Gx \ {a2}, and (iii) neither A1 nor A2 contains a vertex of Z. To see this, recall that by Lemma 22 each vertex in Z is a cut vertex of Gx. Hence each vertex in Z is an internal node in the block graph B of Gx. Root the tree B at an arbitrary internal node, and mark all the internal nodes which are in Z. Say that an internal node u ∈ Z of B is good if there is at least one subtree T of B rooted at a child node of u such that no node of T is marked. Consider the operation of repeatedly deleting unmarked leaves from B. Exhaustively applying this operation results in a subtree of B whose leaves are all good nodes in Z. Since we started with at least two marked nodes, we end up with at least two good nodes. Let a1, a2 be two of these good nodes. For i ∈ {1, 2}, let Ai denote the subgraph of Gx represented by a subtree rooted at some child node of ai. Then a1, a2, A1, A2 satisfy the claim. By Lemma 21 at least one of {a1, a2}, say a1, is not a cut vertex of G\ S. Since a1 is a cut vertex of Gx = G \ ( S ∪ {x}) and A1 is a component of Gx \ {a1}, we get that in the graph G \ S there is an edge from the vertex x to some vertex in A1. As Z ∩ A1 = ∅, this implies A1 ∩ C 6= ∅, from which it follows -- since deleting vertex a1 does not affect the connectedness of G[C ∪ {y}] -- that C ∪ {y} ⊆ A1. Then N(y) ⊆ A1 ∪ {a1} and, in particular, y is not adjacent to a2. Also, since A1 ∩ A2 = ∅ by construction, we get that A2 ∩ (C ∪ {y}) = ∅. Since -- again by construction -- A2 ∩ Z = ∅, we have that N(x) ∩ A2 = ∅. From this and from the fact that A2 is a connected component of Gx \ {a2}, we get that A2 is a connected component of G \ ( S ∪ {a2}). Thus a2 is a cut vertex of G \ S which is adjacent to x and not to y. If N(y) \ (C ∪ S) = {z} then -- as shown above -- z is a cut vertex of G \ S which is adjacent to y. But then z and a2 are two different cut vertices of G \ S, both adjacent to x or y, which contradicts Lemma 21. On the other hand, if N(y) \ (C ∪ S) ≥ 2, then we can repeat the above argument to get a cut vertex b2 of G \ S which is adjacent to y and not adjacent to x. Hence b2 6= a2 and, again, we get a contradiction with Lemma 21. Therefore, indeed N(x) \ (C ∪ S) = N(y) \ (C ∪ S) = {z} and z is a cut vertex in G \ S. (cid:74) (cid:73) Lemma 24. Rule 4 is safe. Proof. We follow the notation used in the rule. We assume -- as for all safeness proofs -- that val(G0 \ S0) ≥ pt(G0 \ S0) + k0, and prove that val( G \ S) ≥ pt( G \ S) + k. Recall that for this rule k = k0 + λ0. By Observation 19 there is exactly one component Ci which satisfies condition (2) of the rule and which is removed by the rule. Further, C = V (Ci) is a clique with at least 2 vertices. Let u, v ∈ C. If C is odd, then consider the vertex subset T = {x, u, y}. The subgraph G[T] = K2,1 ∈ Π has pt( G[T])+λ0+λ0 edges (Observation 15). Since C\{u} is a clique with an even number of vertices, it has a perfect matching. So we get from Corollary 12 that the graph G[C ∪ {x, y}] 18 Beyond Max-Cut: Parameterizing above the Poljak-Turzík Bound has a subgraph H ∈ Π with at least pt( G[C ∪ {x, y}]) + λ0 + λ0 edges. Observe that G0 \ S0 = ( G\ S)\ (C ∪{x, y}). Applying Lemma 11 to the graph G\ S and its vertex subset C ∪ {x, y} we get val( G \ S) ≥ pt( G \ S) + λ0 + k0 = pt( G \ S) + k, as required. If C is even, then let T = {x, y, u, v}. The subgraph G[T] is a graph formed from K4 by removing an edge, and Lemma 16 gives λ-dependent lower bounds for val( G[T]). Applying Corollary 12 to the graph G[C ∪ {x, y}] and its subgraphs G[T] and G[C \ {u, v}] -- which forms a clique on an even number of vertices and thus has a perfect matching -- we get the following lower bounds: (1 − 3λ) (2 − 3λ) (3 − 3λ) if λ ≤ 1/3, if 1/3 < λ ≤ 1/2, and, if λ > 1/2. (3) val( G[C ∪ {x, y}]) ≥ pt( G[C ∪ {x, y}]) + λ0 +  By Lemma 23 we can assume that there is a vertex z in G \ S such that C ∪ {x, y} is a connected component of G \ ( S ∪ {z}) and z is adjacent to both x and y. We now apply the strong λ-subgraph extension property of Π to the subgraph G[C ∪ {x, y, z}] and the subset {z}. Since there are exactly two edges from z to G[C ∪{x, y, z}], we gain at least 2λ edges in this process. Note that this implies a gain of both the edges if λ > 1/2, and at least one edge otherwise. From this and using the fact that pt( G[C ∪{x, y, z}]) = pt( G[C ∪{x, y}])+2λ+ λ0 we get from Equation 3 that val( G[C ∪ {x, y, z}]) ≥ pt( G[C ∪ {x, y}]) + λ0 for all 0 < λ < 1. Applying Lemma 10 to the graph G \ S, cut vertex z and vertex subsets V ( G) \ ( S ∪ C ∪ {x, y} = V (G0\S0)) and C∪{x, y, z}, we get val( G\ S) ≥ pt( G\ S)+k0+λ0 = pt( G\ S)+k. (cid:74) (cid:73) Lemma 25. Let G be a connected graph, S ⊆ V ( G), and k ∈ N, and let one application of Rule 1, 2, 3, or 4 to ( G, S, k) result in the tuple (G0, S0, k0). Then S0 \ S ≤ 3(k − k0)/λ0. Proof. We distinguish the rule applied. For Rule 1, S = S0 and k = k0. For Rule 2 we have S0 \ S = 1, while k − k0 ≥ λ0. Hence S0 \ S ≤ (k − k0) · 1/λ0. Similarly, for Rule 3 we have S0 \ S = 3, k − k0 = λ0, and S0 \ S ≤ (k − k0)· 3/λ0. Finally, for Rule 4 we have S0 \ S = 2 and k − k0 = λ0, and S0 \ S ≤ (k − k0) · 2/λ0. (cid:74) Applications B (cid:73) Definition 33 (Graph homomorphisms). A homomorphism from a graph G to a graph H is a mapping φ : V (G) → V (H) such that for each edge {u, v} ∈ E(G) the pair {φ(u), φ(v)} is an edge in H, if {u, v} has a label, then {φ(u), φ(v)} has the same label and if (u, v) is an oriented edge of G, then (φ(u), φ(v)) is an oriented edge of H. The set of all homomorphisms from G to H will be denoted HOM(G, H), and hom(G, H) = HOM(G, H). (cid:73) Definition 34 (Graph automorphisms and vertex-transitive graphs). For a graph G, a bijection φ : V (G) → V (G) is an automorphism of G if it is a homomorphism from G to itself. A graph G is vertex-transitive if for any two vertices u, v ∈ V (G) there is an automorphism φ of G such that φ(u) = v. (cid:73) Lemma 26. Let G0 be a vertex-transitive graph with at least one edge of every label and orientation allowed in G. Then the property "to have a homomorphism to G0" is strongly d/n0-extendible in G, where n0 is the number of vertices of G0 and d is the minimum number of edges of the given label and the given orientation incident to any vertex of G0 over all labels and orientations allowed in G. Matthias Mnich, Geevarghese Philip, Saket Saurabh and Ondřej Suchý 19 Proof. Let H ⊆ G be the set of graphs which have a homomorphism to G0. We show that the set H satisfies all the three requirements for being strongly d/n0-extendible. A map which takes the single vertex in K1 to any vertex of G0 is a homomorphism from K1 to G0. Let G be K2 possibly with some orientation and label and (u0, v0) be an edge in G0 of the same orientation and label. A map which takes the two vertices in G to u0, v0, respectively, is a homomorphism from G to G0. Thus both K1 and K2 with all orientations and labels are in H. Lemma 36 shows that H has the block additivity property, and from Lemma 38 we get that H has the strong λ-subgraph extension property for λ = d/n0. (cid:74) (cid:73) Observation 35. Let G, H be two graphs such that there is a homomorphism φ from G to H, and (ii) H is vertex-transitive. Then for any two vertices u ∈ V (G), v ∈ V (H), there is a homomorphism ϕ from G to H which maps u to v. Proof. Let φ(u) = x, and let θ be an automorphism of H such that θ(x) = v. Since H is vertex-transitive, such an automorphism exists. Set ϕ := θ ◦ φ. (cid:74) (cid:73) Lemma 36. Let G0 be a vertex-transitive graph. Then the property "to have a homo- morphism to G0" has the block-additivity property. Proof. Let H be the set of graphs which have a homomorphism to G0. Let H be a graph in H, and let φ be a homomorphism from H to G0. Let Hi be a block of H. Observe that any edge (u, v) in Hi is present in H as well, and therefore (φ(u), φ(v)) is an edge in G0. Thus φ restricted to Hi -- in the natural way -- is a homomorphism from Hi to G0, and so Hi is in H. For the converse, let {Hi 1 ≤ i ≤ t} be the blocks of a graph H, and let each Hi be in H. Then there is a homomorphism from each graph Hi to the graph G0. We now show how to construct a homomorphism from H to G0. We assume -- without loss of generality; see below -- that the graph H is connected. Recall that the vertex set of the block graph TH of H consists of the blocks and cut vertices of H, and that a block B and a cut vertex c of H are adjacent in TH exactly when c is a vertex in B. We root the tree TH at some (arbitrary) cut vertex r of H. Each level of TH then consists entirely of either cut vertices or blocks. We now define a mapping ϕ from H to G0 by starting from the root of the block graph TH, and going down level by level. We set ϕ(r) to be some arbitrary vertex of G0. We now consider each level L in TH which consists entirely of blocks, in increasing order of levels. For each block Hi in L, we do the following. Let c be the cut vertex which is the parent of Hi in TH. Note that ϕ(c) has already been defined; let ϕ(c) = d. Let φi be a homomorphism from Hi to G0 which maps c to the vertex d; Observation 35 guarantees that such a homomorphism exists. For each vertex x of Hi, we set ϕ(x) = φi(x). Consider a cut vertex v of H. The above procedure maps v to some vertex of G0 exactly once: If v = r, then this mapping is done explicitly at the very beginning of the procedure; otherwise, this is done when the procedure assigns images for the vertices in the unique parent block Hi of v. Now consider a vertex v of H which is not a cut vertex. The procedure maps v to some vertex of G0 exactly once, when it assigns images to the unique block to which v belongs. Thus the map ϕ is a function. Since no edge of H appears -- by definition -- in two different blocks of H, and since the mapping for each block is a homomorphism to G0, it follows that ϕ is a homomorphism from H to G0. If H is not connected, then we apply this procedure separately to each connected component of H, and this yields a homomorphism from H to G0. This completes (cid:74) the proof. 20 Beyond Max-Cut: Parameterizing above the Poljak-Turzík Bound (cid:73) Lemma 37. Let G0 be a vertex-transitive graph, and let G be any graph. For vertices u in G and x in G0, let HOM(G, G0, u, x) denote the set of all homomorphisms from G to G0 which map u to x, and let hom(G, G0, u, x) = HOM(G, G0, u, x). Then for any vertex u in G and any two vertices x0, y0 in G0, hom(G, G0, u, x0) = hom(G, G0, u, y0). Proof. Let φ be an automorphism of G0 which takes x0 to y0. The automorphism φ defines a map from HOM(G, G0, u, x0) to HOM(G, G0, u, y0), which takes ϕ ∈ HOM(G, G0, u, x0) to φ ◦ ϕ ∈ HOM(G, G0, u, x0). This map is one-one: if ϕ1, ϕ2 ∈ HOM(G, G0, u, x0), then φ◦ϕ1 = φ◦ϕ2 =⇒ φ−1◦φ◦ϕ1 = φ−1◦φ◦ϕ2 =⇒ ϕ1 = ϕ2. In a similar fashion, the inverse automorphism φ−1 defines a one-one map from HOM(G, G0, u, y0) to HOM(G, G0, u, x0). It (cid:74) follows that hom(G, G0, u, x0) = hom(G, G0, u, y0). (cid:73) Lemma 38. Let G0 be a vertex-transitive graph on n0 vertices and d be the minimum number of edges of the given label and the given orientation incident to any vertex of G0 over all labels and orientations allowed in G Then the property Π : "to have a homomorphism to G0 " has the strong λ-subgraph extension property in G for λ = d/n0. Proof. This proof is based on a similar argument by Poljak and Turzík [18, Theorem 2]. Let H be the set of graphs which have a homomorphism to G0. Let G be a graph, let c : E(G) → R+ be a weight function, and let S ⊆ V (G) be such that G[S] ∈ H and G\S ∈ H. Let δ(S) denote the set of edges in G which have exactly one end-point in S, and let w be the sum of the weights of the edges in δ(S). Let φ be a homomorphism from G \ S to G0. Call a mapping ϕ : V (G) → V (G0) a proper extension of φ if ϕS is a homomorphism from G[S] to G0 and ϕ(V (G)−S) is identical to φ. Observe that ϕ need not be a homomorphism from G to G0. Note that the number of proper extensions of φ is equal to hom(G[S], G0). Consider an edge {x, u} of V (G) \ S with u ∈ S and φ(x) = x0. There are exactly hom(G[S], G0) · d/n0 proper extensions ϕ of φ such that {ϕ(x), ϕ(u)} is an edge of G0 with the same label and orientation: the vertex x0 is incident to exactly d such edges in G0, and from Lemma 37 there are exactly hom(G[S], G0)/n0 homomorphisms from G[S] to G0 which map the vertex u to any given neighbor of x0. From an easy averaging argument, it follows that there exists a proper extension ϕ of φ and a subset F ⊆ δ(S) of edges with total weight at least dw/n0 such that ϕ maps each edge in F to an edge in G0 with the same label an (cid:74) orientation. This completes the proof. (cid:73) Lemma 27. homomorphism into G0" is FPTon almost-forests of cliques. If G0 is an unoriented unlabeled graph, then the property "to have a Proof. Let G be an unlabeled unoriented graph, k an integer, and S a set of vertices of G such that S ≤ qk and G \ S is a forest of cliques. For every mapping ϕ : S → V (G0) the algorithm proceeds as follows. We want to count the number rϕ of edges a subgraph of G homomorphic to G0 with the homomorphism extending ϕ can have. Denote by eϕ(S) the number of edges {u, v} in E(G(S)) such {ϕ(u), ϕ(v)} is an edge of G0. We use a table Tab to store for each vertex v of G \ S and for each vertex v0 of G0 roughly speaking how many edges we could get into the constructed subgraph, if the vertex v was mapped to the vertex v0. We initialize the tables by setting Tab[v, v0] = {u ∈ S {ϕ(u), v0} ∈ E(G0)}, G0 = G \ S and rϕ = eϕ(S). Our aim is to remove the leaf cliques of G0 one by one (except possibly for the cut vertex also contained in other cliques) as long as the graph G0 is non-empty. The edges incident to deleted vertices are captured either by increasing rϕ if the clique was a connected component of G0 or by updating the table of the cut vertex, which separates the clique from the rest of its component. Matthias Mnich, Geevarghese Philip, Saket Saurabh and Ondřej Suchý 21 numbers (nu)u∈V (G0) such thatP numbers nu we compute the number of edges inside C that we get asP{u,v}∈E(G0) nu · nv. Let C be leaf clique of G0 and let us first assume that C forms a connected component of G0. Next we guess how many vertices of the clique are mapped to individual vertices of G0. For a vertex u ∈ V (G0) we denote this number nu. Thus for every V (G0)-tuple of u∈V (G0) nu = C we continue as follows. Based on the It remains to maximize the number of edges we get between C and S. For that purpose consider an auxiliary edge-weighted complete bipartite graph B with one partition formed by C and the other partition being C many vertices, out of which nu are labeled with u for every u ∈ V (G0). An edge from v ∈ C to a vertex labeled u is assigned the weight Tab[v, u]. Now every mapping of vertices of C to vertices of G0 corresponds to a perfect matching in B and vice versa. Moreover, the number of edges between C and S that we can keep if we want to turn such a mapping into a homomorphism is exactly equal to the weight of the corresponding perfect matching. Hence it is enough to compute the maximum weight perfect matching in B. It is well known that this can be done in time polynomial in the size of B which is 2C. Let us denote t the maximum over all V (G0)-tuples of numbers (nu)u∈V (G0) with P u∈V (G0) nu = C of the sum b +P{u,v}∈E(G0) nu · nv, where b is the size of the maximum weight perfect matching for the graph B as computed for the tuple. The algorithm increases rϕ by t and removes the vertices of C from G0. If G0 is non-empty, it continues with another leaf clique. Now let C be a leaf clique, which doesn't form a connected component of G0 and let v be the cut vertex which disconnects C from the rest of its component. For every v0 ∈ V (G0) u∈V (G0) nu = C we want to compute how many edges we get, if v is mapped to v0 and nu vertices out of C \ {v} are mapped to u. For that purpose we again use an auxiliary bipartite graph, this time with C − 1 vertices in each partition. and for every V (G0)-tuple of numbers (nu)u∈V (G0) such thatP Let t(v0) be the maximum over all V (G0)-tuples of numbers (nu)u∈V (G0) withP C − 1 of the sum b +P{u,v}∈E(G0) nu · nv +P{u,v0}∈E(G0) nu, where b is the size of the maximum weight perfect matching for the graph B as computed for the tuple (nu)u∈V (G0) and v0, the second term counts the number of edges we got inside C \ {v} and the last one counts the edges between c and C \{v}. The algorithm increases Tab[v, v0] by t(v0) for every v0 ∈ V (G0) and removes the vertices of C \ {v} from G0. If G0 is non-empty, it continues with another leaf clique. Finally, if G0 is empty, then rϕ contains the maximum number of edges we get for the initial mapping ϕ. Then the maximum number r of edges in subgraph of G homomorphic to G0 is the maximum of rϕ computed by the algorithm taken over all possible mappings ϕ : S → V (G0). It is enough to compare r with d/n0 ·E(G)+(n0 − d)/2n0 ·(V (G)−1)+ k and answer accordingly. · GO(n0)) = It is easy to check that the algorithm is correct and that it works in O(n 0)k · GO(n0)) time. (cid:74) O((nq (cid:73) Lemma 30. The property Π : "acyclic oriented graphs" is strongly 1/2-extendible in the class of oriented graphs. u∈V (G0) nu = S 0 Proof. Obviously, K1 and both orientations of K2 are directed acyclic graphs, hence in Π. If an oriented graph is acyclic, then clearly each of its blocks is acyclic. On the other hand, each cycle is within one block of a graph, and hence, if every block is acyclic, then the graph itself is acyclic. Finally, if G and S are such that G[S] is acyclic and G \ S then both the graph formed by removing from G all edges oriented from S to V (G) \ S and the one formed 22 Beyond Max-Cut: Parameterizing above the Poljak-Turzík Bound by removing edges oriented from V (G) \ S to S are acyclic and one of them is removing less than half of the edges between S and V (G) \ S, finishing the proof. (cid:74) (cid:73) Lemma 31. The property "acyclic oriented graphs" is FPT on almost-forests of cliques. Proof. Let G = (V, E) be an unlabeled oriented graph, k an integer, and S a set of vertices of G such that S ≤ qk and G \ S is a forest of cliques. Cliques in this case are in fact tournaments. We first show that if any of the tournaments in G \ S is very big, then we can answer yes. Spencer [21] showed that any tournament on n vertices contains a directed acyclic subgraph can achieve c > 0.15. Therefore, for every k there is b0(k) such that c· b0(k)3/2 ≥ b0(k)/4 + k and every tournament on b vertices with b ≥ b0 contains a directed acyclic subgraph with at (cid:1)/2 + c · n3/2 arcs for some absolute positive constant c, and claimed that he (cid:1)/2 + (b − 1)/4 + k + 1/4 arcs. Note that if k ≥ (5/4c)2, then it is enough to take with at least(cid:0)n least(cid:0)b 2 2 b0(k) = k and hence, we have b0(k) = O(k). If C is a set of b ≥ b0(k) vertices inducing a tournament in G\ S, then G[C] has a directed acyclic subgraph with eG(C)/2 + (C − 1)/4 + k + 1/4 arcs, G \ C has a directed acyclic subgraph with eG(V \ C)/2 + (V − C − 1)/4 arcs by Corollary 4, and by Lemma 11, G has a directed acyclic subgraph with E/2 + (V − 1)/4 + k arcs and we can answer yes. Hence, from now on we assume that the largest tournament in G \ S has size at most b0(k). We want to find a linear order ≺ on V which maximizes the number of arcs (u, v) ∈ E such that u ≺ v. We say that such arcs are along the order. As for a directed acyclic graph there is an order in which all the arcs are along the order, the maximum size of a directed acyclic subgraph can be found in this way. We proceed similarly to the proof of Lemma 27. For every linear order (cid:108) on S the algorithm proceeds as follows. We want to count the maximum number r(cid:108) of arcs that are along any ≺, where ≺ is an extension of (cid:108). Denote by e(cid:108)(S) the number of arcs in E(G(S)) that are along (cid:108). We use a table Tab to store for each vertex v of G \ S and for each extension (cid:108)0 of (cid:108) to S ∪ {v} how many arcs we could get if the constructed order ≺ extends (cid:108)0. We initialize the tables by setting Tab[v, (cid:108)0] = {u ∈ S ((u, v) ∈ E ∧ u (cid:108)0 v) ∨ ((v, u) ∈ E ∧ v (cid:108)0 u)}, G0 = G \ S and r(cid:108) = e(cid:108)(S). Our aim is to remove the leaf cliques of G0 one by one (except possibly for the cut vertex also contained in other cliques) as long as the graph G0 is non-empty. The arcs incident to deleted vertices are captured either by increasing r(cid:108) if the clique was a connected component of G0 or by updating the table of the cut vertex, which separates the clique from the rest of its component. For every linear order ≺ on C ∪ S extending (cid:108) we let t(≺) =P Let C be leaf clique of G0 and let us first assume that C forms a connected component of G0. v∈C Tab(v,≺S∪{v})+{u, v ∈ C (u, v) ∈ E ∧ u ≺ v}. Here the first term counts the arcs got by the placement of each individual vertex of C relatively to the vertices of S and the second one counts the arcs along the order inside C. The algorithm increases r(cid:108)0 by the maximum t(≺) over all extensions ≺ of (cid:108) to C ∪ S and removes the vertices of C from G0. If G0 is non-empty, it continues with another leaf clique. ≺ on C ∪ S extending (cid:108) we let t(≺) =P Now let C be a leaf clique, which doesn't form a connected component of G0 and let v be the cut vertex which disconnects C from the rest of its component. For every linear order u∈C,u6=v Tab(u,≺S∪{u}) + {u, w ∈ C (u, w) ∈ E ∧ u ≺ w}. For every extension (cid:108)0 of (cid:108) to S ∪ {v} we increase Tab(v, (cid:108)0) by max≺ t(≺), where the maximum is taken over all ≺ extending (cid:108)0 to S ∪ C. Then the algorithm removes the vertices of C \ {v} from G0 and, if G0 is non-empty, it continues with another leaf clique. Matthias Mnich, Geevarghese Philip, Saket Saurabh and Ondřej Suchý 23 Finally, if G0 is empty, then r(cid:108) contains the maximum number of arcs we get for the initial order (cid:108). Then the maximum number r of edges in a directed acyclic subgraph of G is the maximum of r(cid:108) computed by the algorithm taken over all possible linear orders (cid:108) on S. It is enough to compare r with E(G)/2 + (V (G) − 1)/4 + k and answer accordingly. It is easy to check that the algorithm is correct. As to the running time, there are at most (qk)! = kO(k) linear orders of S. The algorithm tests linear orders for C ∪ S, but since each clique is of size at most b0(k) = O(k), there are also at most kO(k) of these. It takes O(k2) time to process each linear order. The block decomposition of G \ S can be found in O(V + E) time and by keeping the list of leaves and adding the neighboring block of the currently processed leaf to the list if it becomes leaf after removal of the current leaf, it takes O(V ) time to find the cliques over the whole run of the algorithm. It follows that the algorithm works in O(kO(k) · V + E) time. (cid:74)
1110.4882
5
1110
2016-06-06T10:17:21
Strongly polynomial algorithm for a class of minimum-cost flow problems with separable convex objectives
[ "cs.DS", "cs.DM", "cs.GT" ]
A well-studied nonlinear extension of the minimum-cost flow problem is to minimize the objective $\sum_{ij\in E} C_{ij}(f_{ij})$ over feasible flows $f$, where on every arc $ij$ of the network, $C_{ij}$ is a convex function. We give a strongly polynomial algorithm for the case when all $C_{ij}$'s are convex quadratic functions, settling an open problem raised e.g. by Hochbaum [1994]. We also give strongly polynomial algorithms for computing market equilibria in Fisher markets with linear utilities and with spending constraint utilities, that can be formulated in this framework (see Shmyrev [2009], Devanur et al. [2011]). For the latter class this resolves an open question raised by Vazirani [2010]. The running time is $O(m^4\log m)$ for quadratic costs, $O(n^4+n^2(m+n\log n)\log n)$ for Fisher's markets with linear utilities and $O(mn^3 +m^2(m+n\log n)\log m)$ for spending constraint utilities. All these algorithms are presented in a common framework that addresses the general problem setting. Whereas it is impossible to give a strongly polynomial algorithm for the general problem even in an approximate sense (see Hochbaum [1994]), we show that assuming the existence of certain black-box oracles, one can give an algorithm using a strongly polynomial number of arithmetic operations and oracle calls only. The particular algorithms can be derived by implementing these oracles in the respective settings.
cs.DS
cs
A Strongly Polynomial Algorithm for a Class of Minimum-Cost Flow Problems with Separable Convex Objectives L´aszl´o A. V´egh ∗ May 24, 2018 Abstract A well-studied nonlinear extension of the minimum-cost flow problem is to minimize the objective Pij∈E Cij (fij ) over feasible flows f , where on every arc ij of the network, Cij is a convex function. We give a strongly polynomial algorithm for the case when all Cij 's are convex quadratic functions, settling an open problem raised e.g. by Hochbaum [16]. We also give strongly polynomial algorithms for computing market equilibria in Fisher markets with linear utilities and with spending constraint utilities, that can be formulated in this framework (see Shmyrev [33], Devanur et al. [2]). For the latter class this resolves an open question raised by Vazirani [37]. The running time is O(m4 log m) for quadratic costs, O(n4 + n2(m+ n log n) log n) for Fisher's markets with linear utilities and O(mn3 + m2(m + n log n) log m) for spending constraint utilities. All these algorithms are presented in a common framework that addresses the general prob- lem setting. Whereas it is impossible to give a strongly polynomial algorithm for the general problem even in an approximate sense (see Hochbaum [16]), we show that assuming the ex- istence of certain black-box oracles, one can give an algorithm using a strongly polynomial number of arithmetic operations and oracle calls only. The particular algorithms can be derived by implementing these oracles in the respective settings. 1 Introduction Let us consider an optimization problem where the input is given by N numbers. An algorithm for such a problem is called strongly polynomial (see [13]), if (i) it uses only elementary arithmetic operations (addition, subtraction, multiplication, division, and comparison); (ii) the number of these operations is bounded by a polynomial of N (iii) if all numbers in the input are rational, then all numbers occurring in the computations are rational numbers of size polynomially bounded in N and the maximum size of the input numbers. Here, the size of a rational number p/q is defined as ⌈log2(p + 1)⌉ + ⌈log2(q + 1)⌉. The flow polyhedron is defined on a directed network G = (V, E) by arc capacity and node demand constraints; throughout the paper, n = V and m = E. We study the minimum cost for feasible flows f , the objective is to minimize Pij∈E Cij(fij), convex separable flow problem: where on each arc ij ∈ E, Cij is a differentiable convex function. We give a strongly polynomial if Cij(α) = cijα2 + dijα with cij ≥ 0 algorithm for the case of convex quadratic functions, i.e. for every arc ij ∈ E. We also give strongly polynomial algorithms for Fisher's market with linear ∗Department of Mathematics, London School of Economics. E-mail: [email protected]. This work was done at the College of Computing, Georgia Institute of Technology, supported by NSF Grant CCF-0914732. This is a revision of the work published in STOC'12, May 19 - 22 2012, New York, NY, USA Copyright 2012 ACM 978-1-4503-1245- 5/12/05 1 utilities and with spending constraint utilities; these problems can be formulated as minimum cost convex separable flow problems, as shown respectively by Shmyrev [33] and by Devanur et al. [2]. The formulations involve linear cost functions and the function α(log α − 1) on certain arcs. These algorithms are obtained as special implementations of an algorithm that works for the general problem setting under certain assumptions. We assume that the functions are represented by oracles (the specific details are provided later), and two further black-box oracles are provided. We give a strongly polynomial algorithm in the sense that it uses only basic arithmetic operations and oracle calls; the total number of these operations is polynomial in n and m. We then verify our assumptions for convex quadratic objectives and the Fisher markets, and show that we can obtain strongly polynomial algorithms for these problems. Flows with separable convex objectives are natural convex extensions of minimum-cost flows with several applications such as matrix balancing or traffic networks, see [1, Chapter 14] for further references. Polynomial-time combinatorial algorithms were given by Minoux [26] in 1986, by Hochbaum and Shantikumar [18] in 1990, and by Karzanov and McCormick [22] in 1997. The latter two approaches are able to solve even more general problems of minimizing a separable (not necessarily differentiable) convex objective over a polytope given by a matrix with a bound on its largest subdeterminant. Both approaches give polynomial, yet not strongly polynomial algorithms. In contrast, for the same problems with linear objectives, Tardos [35, 36] gave strongly polyno- mial algorithms. One might wonder whether this could also be extended to the convex setting. This seems impossible for arbitrary convex objectives by the very nature of the problem: the optimal solution might be irrational, and thus the exact optimum cannot be achieved. Beyond irrationality, the result of Hochbaum [16] shows that it is impossible to find an ε- accurate solution1 in strongly polynomial time even for a network consisting of parallel arcs between a source and a sink node and the Cij's being polynomials of degree at least three. This is based on Renegar's result [31] showing the impossibility of finding ε-approximate roots of polynomials in strongly polynomial time. This is an unconditional impossibility result in a computation model allowing basic arithmetic operations and comparisons; it does not rely on any complexity theory assumptions. The remaining class of polynomial objectives with hope of strongly polynomial algorithms is where every cost function is convex quadratic. If all coefficients are rational, then the existence of a rational optimal solution is guaranteed. Granot and Skorin-Kapov [12] extended Tardos's method [36] to solving separable convex quadratic optimization problems with linear constraints, where the running time depends only on the entries of the constraint matrix and the coefficients of the quadratic terms in the objective. However, this algorithm is not strongly polynomial because of the dependence on the quadratic terms. The existence of a strongly polynomial algorithm for the quadratic flow problem thus remained an important open question (mentioned e.g. in [16, 4, 17, 12, 34]). The survey paper [17] gives an overview of special cases solvable in strongly polynomial time. These include a fixed number of suppliers (Cosares and Hochbaum, [4]), and series-parallel graphs (Tamir [34]). We resolve this question affirmatively, providing a strongly polynomial algorithm for the general problem in time O(m4 log m). There is an analogous situation for convex closure sets: [16] shows that no strongly polynomial algorithm may exist in general, but for quadratic cost functions, Hochbaum and Queyranne [15] gave a strongly polynomial algorithm. An entirely different motivation of our study comes from the study of market equilibrium algorithms. Devanur et al. [5] developed a polynomial time combinatorial algorithm for a classical 1A solution x is called ε-accurate if there exists an optimal solution x ∗ with x − x ∗∞ ≤ ε. 2 problem in economics, Fisher's market with linear utilities. This motivated a line of research to develop combinatorial algorithms for other market equilibrium problems. For a survey, see [28, Chapter 5] or [38]. All these problems are described by rational convex programs (see [38]). For the linear Fisher market problem, a strongly polynomial algorithm was given by Orlin [30]. To the extent of the author's knowledge, these rational convex programs have been considered so far as a new domain in combinatorial optimization. An explicit connection to classical flow problems was pointed out in the recent paper [39]. It turns out that the linear Fisher market problem, along with several other problems, is captured by a concave extension of the classical generalized flow problem, solvable by a polynomial time combinatorial algorithm. The paper [39] uses the convex programming formulation of linear Fisher markets by Eisenberg and Gale [7]. An alternative convex program for the same problem was given by Shmyrev [33]. This formulation turns out to be a convex separable minimum-cost flow problem. Consequently, equilibrium for linear Fisher market can be computed by the general algorithms [18, 22] (with a final transformation of a close enough approximate solution to an exact optimal one). The class of convex flow problems solved in this paper also contains the formulation of Shmyrev, yielding an alternative strongly polynomial algorithm for linear Fisher market. Devanur et al. [2] gave an analogous formulation for Fisher's market with spending constraint utilities, defined by Vazirani [37]. For this problem, we obtain the first strongly polynomial algorithm. Our running time bounds are O(n4 + n2(m + n log n) log n) for linear and O(mn3 + m2(m + n log n) log m) for spending constraint utilities, with m being the number of segments in the latter problem. For the linear case, Orlin [30] used the assumption m = O(n2) and achieved running time O(n4 log n), the same as ours under this assumption. So far, no extensions of [30] are known for other market settings. 1.1 Prior work For linear minimum-cost flows, the first polynomial time algorithm was the scaling method by Edmonds and Karp [6]. The current most efficient strongly polynomial algorithm, given by Orlin [29], is also based on this framework. On the other hand, Minoux extended [6] to the convex minimum-cost flow problem, first to convex quadratic flows [25], later to general convex objectives [26]. Our algorithm is an enhanced version of the latter algorithm, in the spirit of Orlin's technique [29]. However, there are important differences that make the nonlinear setting significantly harder. Let us remark that Orlin's strongly polynomial algorithm for linear Fisher market [30] is also based on the ideas of [29]. In what follows, we give an informal overview of the key ideas of these algorithms that motivated our result. For more detailed references and proofs, we refer the reader to [1]. The algorithm of Edmonds and Karp consists of ∆-phases for a scaling parameter ∆. Initially, ∆ is set to a large value, and decreases by at least a factor of two at the end of each phase. An optimal solution can be obtained for sufficently small ∆. The elementary step of the ∆-phase transports ∆ units of flow from a node with excess at least ∆ to another node with demand at least ∆. This is done on a shortest path in the ∆-residual network, the graph of residual arcs with capacity at least ∆. An invariant property maintained in the ∆-phase is that the ∆-residual network does not contain any negative cost cycles. When moving to the next phase, the flow on the arcs has to be slightly modified to restore the invariant property. Orlin's algorithm ([29], see also [1, Chapter 10.6]) works on a problem instance with no upper capacities on the arcs (every minimum-cost flow problem can be easily transformed to this form). The basic idea is that if the algorithm runs for infinite number of phases, then the solution converges to an optimal solution; furthermore, the total change of the flow value in the ∆-phase and all 3 subsequent phases is at most 4n∆ on every arc. Consequently, if an arc ij has flow > 4n∆ in the ∆-phase, then the flow on ij must be positive in some optimal solution. Using primal-dual slackness, this means that ij must be tight for an arbitrary dual optimal solution (that is, the corresponding dual inequality must hold with equality). It is shown that within O(log n) scaling phases, an arc ij with flow larger than 4n∆ appears. Based on this fact, [29] obtains the following simple algorithm. Let us start running the Edmonds-Karp algorithm on the input graph. Once there is an arc with flow larger than 4n∆, it is contracted and the Edmonds-Karp algorithm is restarted on the smaller graph. The method is iterated until the graph reduces to a single node. A dual optimal solution on the contracted graph can be easily extended to a dual optimal solution in the original graph by reversing the contrac- tion operations. Provided a dual optimal solution, a primal optimal solution can be obtained by a single maximum flow computation. The paper [29] (see also [1, Chapter 10.7]) also contains a second, more efficient algorithm. When an arc with "large" flow is found, instead of contracting and restarting, the arc is added to a special forest F . The scaling algorithm exploits properties of this forest and can thereby ensure that a new arc enters F in O(log n) phases. The running time can be bounded by O(m log n(m + n log n)), so far the most efficient minimum-cost flow algorithm known. Let us now turn to the nonlinear setting. By the Karush-Kuhn-Tucker (KKT) conditions, a feasible solution is optimal if and only if the residual graph contains no negative cycles with respect to the cost function C ′ ij(fij). Minoux's algorithm is a natural extension of the Edmonds- Karp scaling technique (see [25, 26], [1, Chapter 14.5]). In the ∆-phase it maintains the invariant that the ∆-residual graph contains no negative cycle with respect to the relaxed cost function (Cij(fij + ∆) − Cij(fij))/∆. When transporting ∆-units of flow on a shortest path with respect to this cost function, this invariant is maintained. A key observation is that when moving to the ∆/2-phase, the invariant can be restored by changing the flow on each arc by at most ∆/2. The role of the scaling factor ∆ is twofold: besides being the quantity of the transported flow, it also approximates optimality in the following sense. As ∆ approaches 0, the cost of ij converges to the derivative C ′ ij(fij). Consequently, the solution converges to a feasible optimal solution. A variant of this algorithm is outlined in Section 3. 1.2 Overview of the algorithm for convex quadratic flows To formulate the exact assumptions needed for the general algorithm, several notions have to be introduced. Therefore we postpone the formulation of our main result Theorem 4.5 to Section 4.2. Now we exhibit the main ideas on the example of convex quadratic functions. We only give an in- formal overview here without providing all technical details; the precise definitions and descriptions are given in the later parts of the paper. Then in Section 6.1, we show how the general framework can be adapted to convex quadratic functions. Let us assume that Cij(α) = cijα2 + dijα with cij > 0 for every arc ij ∈ E, and therefore all cost functions are strictly convex. This guarantees that the optimal solution is unique. This assumption is made only for the sake of this overview, and not used in the formal presentation starting in Section 2. However, it is useful as the uniqueness of the optimum enables certain technical simplifications. We discuss these simplifications at the end of the section. Our problem 4 can be formulated as follows. min Xij∈E cijf 2 ij+dijfij Xj:ji∈E fji − Xj:ij∈E fij = bi ∀i ∈ V f ≥ 0 In a more general formulation, one could have arbitrary upper and lower capacities on the arcs. However, this can be reduced to the above form, see Section 2. Let f ∗ be the optimal solution; it is unique by the strict convexity of the objective. Let F ∗ denote the support of f ∗. An optimal solution can be characterized using the Karush-Kuhn-Tucker for Lagrange multipliers π : V → R, we have πj − πi ≤ 2cij f ∗ conditions: ij + dij with equality ij > 0, that is, ij ∈ F ∗. Consequently, if F ∗ is provided, then we can obtain f ∗ as the whenever f ∗ unique solution to the following system of linear equations (see Section 6.1 for details). πj − πi = 2cijf ∗ ij + dij ∀ij ∈ F ∗ Xj:ji∈F ∗ ji − Xj:ij∈F ∗ f ∗ f ∗ ij = bi ∀i ∈ V f ∗ ij = 0 ∀ij ∈ E \ F ∗ (1) We will assume the existence of the subroutine Trial(F, b) (Oracle 2), where F ⊆ E is an arbitrary arc set and b : V → R such that the sum of the bi values is 0 in every undirected connected component of F . The subroutine solves the modification of (1) when F ∗ is substituted by F and b by b. The system is feasible under the above assumption on b, and a solution can be found in time O(n2.37) (see Lemma 6.1). Our starting point is a variant of Minoux's nonlinear scaling scheme as described above, with the only difference that the relaxed cost function is replaced by C ′ ij(fij + ∆) (see Section 3). Following Orlin [29], we can identify an arc carrying a "large" amount of flow in O(log n) steps. The required amount, (2n + m + 1)∆ at the end of the ∆-phase, is large enough that even if we run the algorithm forever and thereby converge to the optimal solution f ∗, this arc must remain positive. Consequently, it must be contained in F ∗. However, we cannot simply contract such an arc as in [29]. The reason is that the KKT-conditions give πj − πi = cijf ∗ ij + dij, a condition containing both primal and dual (more precisely, Lagrangian) variables simultaneously. In every phase of the algorithm, we shall maintain a set F ⊆ F ∗ of arcs, called revealed arcs. F will be extended by a new arc in every O(log n) phases; thus we find F ∗ in O(m log n) steps (see Theorem 5.5). Given a set F ⊆ F ∗, we introduce some technical notions; the precise definitions and detailed discussions are given in Section 4.1. First, we waive the nonnegativity requirement on the arcs in F : a vector E → R is called an F -pseudoflow, if fij ≥ 0 if ij ∈ E \ F but the arcs in F are unconstrained. For an F -pseudoflow f and a scaling factor ∆ > 0, the (∆, F )-residual graph EF f (∆) contains all residual arcs where f can be increased by ∆ so that it remains an F -pseudoflow (that is, all arcs in E, and all arcs ji where ij ∈ F , or ij ∈ E \ F and fij ≥ ∆.) We require that the flow f in this phase satisfies the (∆, F )-feasibility property: the graph EF f (∆) contains no negative cycles with respect to the cost function C ′ ij(fij + ∆). Let us now describe our algorithm. We start with F = ∅ and a sufficiently large ∆ value so that the initial flow f ≡ 0 is (∆, ∅)-feasible. We run the Minoux-type scaling algorithm sending flow on shortest paths in the (∆, F )-residual graph from nodes with excess at least ∆ to nodes with 5 deficiency at least ∆. If there exist no more such paths, we move to the ∆/2-phase, after a simple modification step that transforms the flow to a (∆/2, F )-feasible one, on the cost of increasing the total excess by at most m∆/2 (see subroutine Adjust in Section 4.1). We include in F every edge with fij > (2n + m + 1)∆ at the end of the ∆-phase. At the end of each phase when F is extended, we perform a special subroutine instead of simply moving to the ∆/2-phase. First, we compute the discrepancy DF (b) defined as follows. Let DF (b) = maxK Pi∈K bi, where K ranges over the undirected connected components of F . (Note that the requirement on b in the subroutine Trial(F, b) above was DF (b) = 0.) If the discrepancy DF (b) is large, then it can be shown that F will be extended within O(log n) phases as in Orlin's algorithm (see the first part of the proof of Theorem 5.5). If the discrepancy is small, the procedure Trial-and-Error is performed, consisting of two subroutines. First, we run the subroutine Trial(F, b), where b is a small modification of b satisfying DF (b) = 0. This returns an F -pseudoflow f , satisfying (1) with F in the place of F ∗. (This step be seen as "pretending" that F = F ∗ and trying to compute an optimal solution under this hypothesis.) The resulting f is optimal if and only if F = F ∗. Otherwise, we use a second subroutine Error( f , F ) (see Oracle 3), that returns the smallest value ∆ > 0 such that f is (F, ∆)-feasible. This subroutine can be reduced to a minimum cost-to-time ratio cycle problem (also known as the tramp streamer problem), see [1, Chapter 5.7]; a strongly polynomial time algorithm was given by Megiddo [23]. If ∆ < ∆/2, then we set ∆ as our next scaling value and f = f as the next F -pseudoflow - we can proceed since f is (F, ∆)-feasible. Otherwise, the standard transition to phase ∆/2 is done with keeping the same flow f . The analysis shows that a new arc shall be revealed in every O(log n) phases. The key Lemma 5.4 relies on the proximity of f and f , which implies that Trial-and- Error cannot return the same f if performed again after O(log n) phases. Consequently, the set F cannot be the same, and has been therefore extended. Since F ≤ m, this shows that the total number of scaling phases is O(m log n). Besides the impossibility of contraction, an important difference as compared ot Orlin's al- gorithm is that F cannot be assumed to be a forest (in the undirected sense). There are simple quadratic instances with the support of an optimal solution containing cycles. In Orlin's algorithm, progress is always made by connecting two components of F . This will also be an important event in our algorithm, but sometimes F shall be extended with arcs inside a component. The main difference when applied to Fisher markets instead of quadratic costs is the imple- mentation of the black boxes Trial and Error. These are implemented by a simple linear time algorithm and the Floyd-Warshall algorithm, respectively. The description above made the simpli- fying assumption that cij > 0 for all ij ∈ E, that is, all cost functions are strictly convex, and thus there is a unique optimal solution. This might not be true even for quadratic costs if cij = 0 is allowed on certain arcs. An important difference between the description and the general algorithm is that in the general algorithm, the set F ∗ has to be more carefully defined; in particular, it will contain the support of every optimal solution. We therefore have to introduce the additional notion of F -optimal solutions for F ⊆ F ∗. The algorithm will find F -optimal solutions instead of optimal ones; however, an F -optimal solution can be converted to an optimal solution via an additional maximum flow subroutine. The rest of the paper is organized as follows. Section 2 contains the basic definitions and notations. Section 3 presents the simple adaptation of the Edmonds-Karp algorithm for convex cost functions, following Minoux [26]. Our algorithm in Section 4 is built on this algorithm with the addition of the subroutine Trial-and-Error, that guarantees strongly polynomial running time. Analysis is given in Section 5. Section 6 adapts the general algorithm for quadratic utilities, 6 and for Fisher's market with linear and with spending constraint utilities. Section 7 contains a final discussion of the results and some open questions. An Appendix contains the description of the shortest path subroutines used. A table summarizing notation and concepts can be found at the end of the paper. 2 Preliminaries Let G = (V, E) be a directed graph, and let n = V , m = E. For notational convenience, we assume that the graph contains no parallel arcs and no pairs of oppositely directed arcs. Conse- quently, we can denote the arc from node i to node j by ij. All results straightforwardly extend to general graphs. We are given node demands b : V → R with Pi∈V bi = 0. The flow is re- stricted to be nonnegative on every arc, but there are no upper capacities. On each arc ij ∈ E, Cij : R → R ∪ {∞} is a convex function. We allow two types of arcs ij: • Free arcs: Cij is differentiable everywhere on R. • Restricted arcs: Cij(α) = ∞ if α < 0, Cij is differentiable on (0, ∞) and has a left derivative ij(0) = −∞ denote this left derivative. Let us use the convention in 0 that equals −∞; let C ′ C ′ ij(α) = −∞ for α < 0. By convexity, C ′ ij is continuous on R for free and on [ℓij, ∞) for restricted arcs. Restricted arcs will play a role in the Fisher market applications, where the function Cij(α) = α(log α − 1) will be used on certain arcs (with Cij(0) = 0 and Cij(α) = ∞ if α < 0.) The minimum-cost flow problem with separable convex objective is defined as follows. min Xij∈E Xj:ji∈E fji − Xj:ij∈E Cij(fij) fij = bi ∀i ∈ V (P) f ≥ 0 The problem is often defined with more general lower and upper capacities: ℓij ≤ fij ≤ uij. One can reduce general capacities to the above form via the following standard reduction (see e.g. [1, Sec 2.4]). For each arc ij ∈ E, let us add a new node k = kij, and replace ij by two arcs ik and jk. Let us set bk = uij − ℓij, Cik(α) = Cij(α + ℓij), Cjk ≡ 0. Furthermore, let us increase bi by ℓij and decrease bj by uij. It is easy to see that this gives an equivalent optimization problem, and if the original graph had n′ nodes and m′ arcs, the transformed instance has n = n′ + m′ nodes and m = 2m′ arcs. Further, we may assume without loss of generality that G = (V, E) is strongly connected and (P) is always feasible. Indeed, we can add a new node t with edges vt, tv for any v ∈ V , with extremely high (possibly linear) cost functions on the edges. This guarantees that an optimal solution shall not use such edges, whenever the problem is feasible. We will also assume n ≤ m. By a pseudoflow we mean a function f : E → R satisfying the capacity constraints. For the uncapacitated problem, it simply means f ≥ 0. Let ρf (i) := Xj:ji∈E fji − Xj:ij∈E fij, (2) 7 denote the flow balance at node i, and let Ex(f ) = Exb(f ) := Xi∈V max{ρf (i) − bi, 0} denote the total positive excess. For an arc set F , let arcs, and let ←→ F = F ∪ ←− ←− F := {ji : ij ∈ F } denote the set of reverse Following [18] and [22], we do not require the functions Cij to be given explicitly, but assume F . We shall use the vector norms x∞ = max xi and x1 = P xi. oracle access only. Oracle 1. We are given an oracle, that we will refer to as the differential oracle, satisfying either of the following properties. (a) For every arc ij ∈ E, the oracle returns the value C ′ ij(α) in O(1) time for every α ∈ R. If α is rational then C ′ ij(α) is also rational. (b) For every arc ij ∈ E, the oracle returns the value eC ′ ij (α) in O(1) time for every α ∈ R. If α is rational then eC ′ ij (α) is also rational. These two options are tailored to main the applications. The more natural Oracle 1(a) holds for quadratic objectives, where C ′ ij(α) = 2cij α + dij for the cost function Cij(α) = cijα2 + dij. Option (b) is needed for Fisher markets, where C ′ ij(α) = log α for cost functions of the form Cij(α) = α(log α − 1); and C ′ ij(α) = − log Uij for the other type of cost function, Cij(α) = −α log Uij, for a rational Uij. Note that we do not assume an evaluation oracle returning Cij(α) or eCij (α) - these values are not needed for the algorithm. The next assumption slightly restricts the class of functions Cij for technical reasons. Each cost function Cij(α) is either linear or strictly convex, that is, C ′ ij(α) is either constant or strictly monotone increasing. (⋆) Arcs with Cij(α) linear are called linear arcs, the rest is called nonlinear arcs. Let mL and mN denote their numbers, respectively. We use the terms linear and nonlinear for the corresponding reverse arcs as well. If Cij does not satisfy this restriction, R can be decomposed into intervals such that C ′ ij is either constant or strictly monotone increasing on each interval. We can replace ij by a set of paths of length two (to avoid adding parallel arcs) with appropriately chosen capacities and cost functions all of which satisfy the assumption. Indeed, the piecewise linear utility functions in Fisher markets with spending constraint utilities will be handled in a similar way. If the cost functions are explicitly given, for example, the slope of every linear segment is part of the input, then the size of the resulting network still only depends on the input size (that includes all numbers in the input). Hence a strongly polynomial algorithm on this instance will be strongly polynomial with respect to the original instance as well. This does not hold however if the functions Cij is given in some different, implicit way. 2.1 Optimality and ∆-feasibility Given a pseudoflow f , let us define the residual graph Ef as Ef := E ∪ {ij : ji ∈ E, fij > 0}. Arcs in E are called forward arcs, and those in the second set backward arcs. Recall our assumption that the graph contains no pairs of oppositely directed arcs, hence the backward arcs are not 8 contained in E. We will use the convention that on a backward arc ji, fji = −fij, and Cji(α) = Cij(−α), also convex and differentiable. The residual capacity is ∞ on forward arcs and fij on the backward arc ji. The Karush-Kuhn-Tucker conditions assert that the feasible solution f to (P) is optimal if and only if there exists a potential vector π : V → R such that πj − πi ≤ C ′ ij(fij) ∀ij ∈ Ef . (3) This is equivalent to asserting that the residual graph contains no negative cost directed cycles with respect to the cost function C ′ ij(fij). For a value ∆ > 0, let Ef (∆) = E ∪ {ij : ji ∈ E, fij ≥ ∆} denote the subset of arcs in Ef that have residual capacity at least ∆. We say that the pseudoflow f is ∆-feasible, if there exists a potential vector π : V → R such that πj − πi ≤ C ′ ij(fij + ∆) ∀ij ∈ Ef (∆). (4) Equivalently, f is ∆-feasible if and only if Ef (∆) contains no negative cycles with respect to the cost function C ′ ij(fij + ∆). If ji is a reverse arc, then (4) gives C ′ ij(fij − ∆) ≤ πj − πi. We note that our notion is different (and weaker) than the analogous conditions in [26] and in [18], where (Cij(fij + ∆) − Cij(fij))/∆ is used in the place of C ′ ij(fij + ∆). Algorithm 1 Subroutine Adjust(∆, ¯f) INPUT A 2∆-feasible pseudoflow ¯f and a potential vector π satisfying (4) with ¯f and 2∆. OUTPUT A ∆-feasible pseudoflow f such that π satisfies (4) with f and ∆. for all ij ∈ E do ij( ¯fij + ∆) < πj − πi then fij ← ¯fij + ∆. if C ′ elseif ¯fji ≥ ∆ and πj − πi < C ′ ij( ¯fij − ∆) then fij ← ¯fij − ∆. else fij ← ¯fij. return f . The subroutine Adjust(∆, f ) (see Algorithm 1) transforms a 2∆-feasible pseudoflow to a ∆- feasible pseudoflow by possibly changing the value of every arc by ±∆. Lemma 2.1. The subroutine Adjust(∆, f ) is well-defined and correct: it returns a ∆-feasible pseudoflow with (f, π) satisfying (4). Further, Ex(f ) ≤ Ex( ¯f ) + mN ∆ (recall that mN is the number of nonlinear arcs). Proof. First we observe that the "if" and "elseif" conditions cannot hold simultaneously: C ′ ∆) < πj − π < C ′ satisfying (4) with ¯f and 2∆. We prove that π satisfies (4) with f and ∆ as well. ij( ¯fij + ij( ¯fij − ∆) would contradict the convexity of Cij. Consider the potential vector π πj − πi ≤ C ′ First, take a forward arc ij ∈ E with C ′ ij( ¯fij + ∆) < πj − πi. By 2∆-feasibility we know ij( ¯fij + 2∆). These show that setting fij = ¯fij + ∆ satisfies (4) for both ij and ji, using ij(fij − ∆) ≤ C ′ ij( ¯fij + ∆) < πj − πi ≤ C ′ ij( ¯fij + 2∆) = C ′ ij(fij) = C ′ ij(fij + ∆). C ′ Next, assume ¯fji ≥ ∆ and πj − πi < C ′ ij( ¯fij − ∆). Note that fij satisfies (4) by πj − πi < ij( ¯fij − ∆) ≤ C ′ C ′ ij( ¯fij) = C ′ ij(fij + ∆). 9 If ji ∈ E ¯f (2∆) (that is, ¯fij ≥ 2∆), then we have C ′ ij(fij − ∆) = C ′ ij( ¯fij − 2∆) ≤ πj − πi, and thus (4) also holds for ji. If ji ∈ E ¯f (∆) − E ¯f (2∆), then ji /∈ Ef (∆). ij( ¯fij − ∆) ≤ πj − πi. To verify the last claim, observe that C ′ Finally, consider the case when fij = ¯fij. The condition (4) holds for ij as we assume πj − πi ≤ ij( ¯fij + ∆). Also, either fij = ¯fij < ∆ and thus ji /∈ Ef (∆), or fij = ¯fij ≥ ∆ and (4) holds for ji C ′ by the assumption C ′ ij is constant on every linear arc and therefore ¯fij = fij will be set on every linear arc. The flow change is ±∆ on every nonlinear arc; every such change may increase the excess of one of the endpoints of the arc by ∆. Consequently, Ex(f ) ≤ Ex( ¯f ) + mN ∆ follows. 3 The basic algorithm Algorithm 2 outlines a simple algorithm for minimum cost flows with separable convex objectives, to be referred as the "Basic algorithm". This is a modified version of Minoux's algorithm [26]. The algorithm returns a ε-accurate solution for a required precision ε > 0. That is, for output f , there is an optimal solution f ∗ such that kf − f ∗k∞ < ε. Algorithm 2 Algorithm Basic f ← 0; ∆ ← ∆0; do //∆-phase do //main part S(∆) ← {i ∈ V : ρf (i) − bi ≥ ∆}; T (∆) ← {i ∈ V : ρf (i) − bi ≤ −∆}; P ← shortest s − t path in Ef (∆) for the cost C ′ send ∆ units of flow on P from s to t; ij(fij + ∆) with s ∈ S(∆), t ∈ T (∆); while S(∆), T (∆) 6= ∅; Adjust(∆/2, f ); ∆ ← ∆/2; while ∆ > ε/(2n + mN + 1); Return f . We start with the pseudoflow f ≡ 0 and an initial value ∆ = ∆0. We assume that the value ∆0 is provided in the input so that 0 is a ∆0-feasible and Ex(0) ≤ (2n + m)∆0; in the enhanced algorithm we shall specify how such a ∆0 value can be determined. The algorithm consists of ∆-phases, with ∆ decreasing by a factor of two between two phases; the algorithm terminates once ∆ < ε/(2n + mN + 1). In the main part of phase ∆, let S(∆) = {i ∈ V : ρf (i) − bi ≥ ∆} and T (∆) = {i ∈ V : ρf (i) − bi ≤ −∆}, the set of nodes with excess and deficiency at least ∆. As long as S(∆) 6= ∅, T (∆) 6= ∅, send ∆ units of flow from a node s ∈ S(∆) to a node t ∈ T (∆) on a shortest path in Ef (∆) with respect to the cost function C ′ ij(fij + ∆). (Note that there must be a path connecting nodes in S(∆) and T (∆), due to our assumption that the graph G = (V, E) is strongly connected, and E ⊆ Ef (∆).) The main part finishes once S(∆) = ∅ or T (∆) = ∅. The ∆-phase terminates by performing Adjust(∆/2, f ) and proceeding to the next phase with scaling factor ∆/2. In the main part, we need to compute shortest paths in the graph Ef (∆) for the cost function 10 C ′ ij(fij + ∆). This can be done only if there is no negative cost cycle. ∆-feasibility is exactly this property and is maintained throughout (see Lemma 3.2 below). Details of the shortest path computation will be given in Section 5.1(ii), for the enhanced algorithm. 3.1 Analysis Theorem 3.1. The Basic algorithm delivers an ε-accurate solution in O(log((2n + mN + 1)∆0/ε) phases, and every phase comprises at most O(2n + mN ) flow augmentations. An appropriate ∆0 can be chosen to be polynomial in the input size, hence this gives a weakly polynomial running time bound. We now state the two simple lemmas needed to prove this theorem. The first lemma verifies the correctness and efficiency of the algorithm, showing that ∆-feasibility is maintained throughout and the number of flow augmentations is linear in every ∆-phase. We omit the proof; its analogous counterpart for the enhanced algorithm will be proved in Lemma 5.1. Lemma 3.2. (i) In the main part of the ∆-phase, the pseudoflow is an integer multiple of ∆ on each arc, and consequently, Ef (∆) = Ef . (ii) ∆-feasibility is maintained when augmenting on a shortest path. (iii) At the beginning of the main part, Ex(f ) ≤ (2n + mN )∆, and at the end, Ex(f ) ≤ n∆. (iv) The main part consists of at most 2n + mN flow augmentation steps. Our second lemma asserts the proximity of a current flow to all later flows during the algorithm. If we let the algorithm run without ever terminating, it will converge to an optimal solution. Hence the lemma justifies that the algorithm obtains an ε-accurate solution as claimed in Theorem 3.1. Moreover, it also helps to identify edges which must be contained in the support of an optimal solution. The proof is also omitted; see Lemma 5.2 and the first part of the proof of Theorem 5.5. This is essentially the same argument that was used by Orlin (e.g. [1, Lemma 10.21]). Lemma 3.3. Let f be the pseudoflow at the end of the main part of the ∆-phase and f ′ in an arbitrary later phase. Then f − f ′∞ ≤ (2n + m + 1)∆. If fij > (2n + m + 1)∆ at the end of the ∆-phase, then this property is maintained in all later phases, and there exists an optimal solution f ∗ with f ∗ ij > 0. For all such arcs, we can conclude πj − πi = C ′ ij) for an optimal solution f ∗. It will belong to the set of revealed arcs, defined in the next section. The overall aim of the algorithm is to identify a large enough set of revealed arcs containing the support of an optimal solution. The above lemma guarantees that the first such arc can be identified in a strongly polynomial number of steps in the Basic algorithm. We will however need to modify the algorithm in order to guarantee that the set of revealed arcs is always extended in a strongly polynomial number of steps. ij(f ∗ 4 The enhanced algorithm 4.1 Revealed arc sets Let F ∗ denote the set of arcs that are tight in every optimal solution (note that in general, we do not assume the uniqueness of the optimal solution). This arc set plays a key role in our algorithm. Formally, F ∗ := {ij ∈ E : πj − πi = C ′ ij(fij) holds ∀f optimal to (P), ∀π : V → R, s.t. (f, π) satisfies the inequalities (3)}. (5) 11 The next lemma shows that F ∗ contains the support of every optimal solution. Lemma 4.1. Let f be an arbitrary optimal solution to (P), and fij > 0 for some ij ∈ E. Then ij ∈ F ∗. The proof needs the following notion, also used later. Let x, y : E → R be two vectors. Let us define the difference graph Dx,y = (V, Ex,y) with ij ∈ Ex,y if ij ∈ E and xij > yij or if ji ∈ E and xji < yji. Using the convention xji = −xij, yji = −yij it follows that xij > yij for every ij ∈ Ex,y. We will need the following simple claim. Claim 4.2. Assume that for two vectors x, y : E → R, ρx = ρy holds (recall the definition of ρ in (2)). Then every arc in the difference graph Ex,y must be contained in a cycle in Ex,y. Proof. For ij ∈ Ex,y, let us set zij = xij − yij if xij > yij. The assumption ρx = ρy implies that zij is a circulation in Ex,y with positive value on every arc. As such, it can be written as a nonnegative combination of incidence vectors of cycles. Therefore every ij ∈ Ex,y must be contained in a cycle. Proof of Lemma 4.1. Let f ∗ be another arbitrary optimal solution, and consider potentials π and ij). Since (f ∗, π∗) π∗ with both (f, π) and (f ∗, π∗) satisfying (3). We shall prove that π∗ j − π∗ ij(f ∗ is chosen arbitrarily, this will imply ij ∈ F ∗. If f ∗ ij) must hold. ij(f ∗ ij > 0, then ji ∈ Ef ∗ and thus π∗ i = C ′ i = C ′ j −π∗ Assume now f ∗ ab and thus ab ∈ Ef ∗ and ba ∈ Ef . By (3), ij = 0. Consider the difference graph Df,f ∗ . Since fij > f ∗ ij, it follows that ij ∈ Ef,f ∗. Because of ρf ∗ ≡ ρf ≡ b, Claim 4.2 is applicable and provides a cycle C in Ef,f ∗ containing ij. For every arc ab ∈ C, fab > f ∗ a ≤ Xab∈C πa − πb ≤ Xab∈C ab give C ′ j − π∗ i = C ′ The convexity of Cab and fab > f ∗ must hold everywhere, implying π∗ ab). In the above inequalities, equality 0 = Xab∈C 0 = Xab∈C ba(fba) = − Xab∈C C ′ ab(fab) ≥ C ′ ij(f ∗ ij) as desired. ab(f ∗ C ′ ab(fab). π∗ b − π∗ C ′ ab(f ∗ ab) and We shall see that using Oracle 2 (to be described later), finding the set F ∗ enables us to compute an optimal solution in strongly polynomial time. In the Basic algorithm, F = {ij ∈ E : fij > (2n + m + 1)∆} is always a subset of F ∗ according to Lemmas 3.3 and 4.1. Furthermore, once an edge enters F , it stays there in all later phases. The Enhanced algorithm provides a modification of the basic algorithm with the guarantee that within every O(log n) phases, a new arc enters F . In each step of the enhanced algorithm, there will be an arc set F , called the revealed arc set, which is guaranteed to be a subset of F ∗. We remove the lower capacity 0 from arcs in F and allow also negative values here. Formally, for an edge set F ⊆ E, a vector f : E → R is an F -pseudoflow, if fij ≥ 0 for ij ∈ E \F (but it is allowed to be negative on F ). For such an f , let us define EF f := Ef ∪ ←− F = E ∪ ←− F ∪ {ji : ij ∈ E \ F, fij > 0}. (6) If ij ∈ F , then the residual capacity of ji is ∞. In every phase of the algorithm, we maintain an F -pseudoflow f for a revealed arc set F ⊆ F ∗. Provided the revealed arc set F ⊆ F ∗, we will aim for F -optimal solutions as defined below; we prove that finding an F -optimal solution is essentially equivalent to finding an optimal one. We 12 say that f : E → R is F -optimal, if it is an F -pseudoflow with ρf ≡ b and there exists a potential vector π : V → R with πj − πi ≤ C ′ ij(fij) ∀ij ∈ EF f . (7) This is stronger than the optimality condition (3) in that it also requires the inequality on arcs in ←− F . On the other hand, it does not imply optimality as it allows fij < 0 for ij ∈ F . Nevertheless, it is easy to see that every optimal solution f ∗ is also F -optimal for every F ⊆ F ∗. This is due to the definition of F ∗ as the set of arcs satisfying πj − πi = C ′ ij(fij) whenever (f, π) satisfies (3). Conversely, we shall prove that provided an F -optimal solution, we can easily find an optimal solution by a single feasible circulation algorithm, a problem equivalent to maximum flows (see [1, Chapters 6.2, 7]). Lemma 4.3. Assume that for a subset F ⊆ F ∗, an F -optimal solution f is provided. Then an optimal solution to (P) can be found by a feasible circulation algorithm. Further, ij ∈ F ∗ whenever fij > 0. Proof. Assume f and ¯f are both F -optimal solutions, that is, for some vectors π and ¯π, the pairs (f, π) and ( ¯f , ¯π) both satisfy (7). We prove that (i) fij = ¯fij whenever ij is a nonlinear arc; and (ii) if ij is a linear arc with fij 6= ¯fij, then πj − πi = C ′ ij( ¯fij) = ¯πj − ¯πi. ij(fij) = C ′ Note that (i) and (ii) immediately imply the second half of the claim as it can be applied for f and an arbitrary optimal (and consequently, F -optimal) solution ¯f . ←→ F ⊆ EF f ). By (7), f follows (using The proof uses the same argument as for Lemma 4.1. W.l.o.g. assume fij > ¯fij for an arc ij, and consider the difference graph Df, ¯f . Since ρf ≡ ρ ¯f ≡ b and fij > ¯fij, Claim 4.2 is applicable and shows that ij must be contained on a cycle C ⊆ Ef, ¯f . For every arc ab ∈ C, ab ∈ EF ¯f and ba ∈ EF ¯f ∩ EF ¯πb − ¯πa ≤ Xab∈C πa − πb ≤ Xab∈C ab( ¯fab) for all ab ∈ C. The condition (⋆) implies that all arcs in Now convexity yields C ′ C are linear, in particular, ij is linear. This immediately proves (i). To verify (ii), observe that all above inequalities must hold with equality. 0 = Xab∈C 0 = Xab∈C ab(fab) = C ′ ba(fba) = − Xab∈C C ′ ab( ¯fab) C ′ and C ′ ab(fab). This suggests the following simple method to transform an F -optimal solution f to an optimal ij = fij. Let H ⊆ E be the set of linear arcs ij(fij). Consider the solutions h of the following feasible circulation problem: f ∗ of (P). For every nonlinear arc ij, we must have f ∗ satisfying πj − πi = C ′ hij = fij ∀ij ∈ E \ H Xj:ji∈E hji − Xj:ij∈E hij = bi ∀i ∈ V h ≥ 0 We claim that the feasible solutions to this circulation problem are precisely the optimal solutions to (P). Indeed, if f ∗ is an optimal solution, then (i) and (ii) imply that f ∗ ij = fij for all ij ∈ E \ H and ij ∈ H for every arc with fij 6= f ∗ ij. The degree conditions are satisfied because of ρf ∗ ≡ ρf ≡ b. Conversely, every feasible circulation h is an optimal solution to (P), since (h, π) satisfies (3). 13 In every step of our algorithm we will have a scaling parameter ∆ ≥ 0 and a revealed arc set F ⊆ F ∗. The Basic algorithm used the notion of ∆-feasibility; it has to be modified according to F . Let EF f with residual capacity at least ∆. That is, f (∆) denote the set of arcs in EF EF f (∆) := Ef (∆) ∪ ←− F = E ∪ ←− F ∪ {ji : ij ∈ E \ F, fij ≥ ∆}. (8) We say that the F -pseudoflow f is (∆, F )-feasible, if there exists a potential vector π : V → R so that πj − πi ≤ C ′ This is equivalent to the property that EF function C ′ ij(fij + ∆). ij(fij + ∆) ∀ij ∈ EF f (∆). (9) f (∆) contains no negative cycle with respect to the cost In accordance with (∆, F )-feasibility, we have to modify the subroutine Adjust. The modified subroutine, denoted by Adjust(∆, f, F ) is shown in Algorithm 3. The only difference from Algo- rithm 1 is that the condition (4) is replaced by (9), and that in the second condition, " ¯fji ≥ ∆" is replaced by " ¯fji ≥ ∆ or ij ∈ F ". The following lemma can be proved by the same argument as Lemma 2.1. Algorithm 3 Subroutine Adjust(∆, ¯f, F ) INPUT A (2∆, F )-feasible pseudoflow ¯f and a potential vector π satisfying (9) with ¯f and 2∆. OUTPUT A (∆, F )-feasible pseudoflow f such that π satisfies (9) with f and ∆. for all ij ∈ E do ij( ¯fij + ∆) < πj − πi then fij ← ¯fij + ∆. if C ′ elseif ( ¯fji ≥ ∆ or ij ∈ F ) and πj − πi < C ′ ij( ¯fij − ∆) then fij ← ¯fij − ∆. else fij ← ¯fij. return f . Lemma 4.4. The subroutine Adjust(∆, f, F ) is well-defined and correct: feasible pseudoflow with (f, π) satisfying (9). Further, Ex(f ) ≤ Ex( ¯f ) + mN ∆. it returns a (∆, F )- Finally, we say that a set F ⊆ E is linear acyclic, if F does not contain any undirected cycles of linear arcs (that is, no cycle in F may consist of linear arcs and their reverse arcs). We shall maintain that the set of revealed arcs, F is linear acyclic. This notion is motivated by the following: assume there exists a cycle consisting of linear arcs and their reverses. Given an F -pseudoflow, we could modify it by sending an arbitrary amount of flow around this cycle. Hence we would not be able to derive our proximity result Lemma 5.6 and Lemma 5.4 that relies on it. On the other hand, we can pick an arbitrary arc on a cycle of linear arcs, remove it from F , an reroute its entire flow on the rest of the cycle. 4.2 Subroutine assumptions Given the set F ⊆ F ∗ of revealed arcs, we will try to find out whether F already contains the support of an optimal solution. This motivates the following definition. We say that the (not necessarily nonnegative) vector x : E → R is F -tight, if xij = 0 whenever ij /∈ F and there exists a potential vector π : V → R with πj − πi = C ′ ij(xij) ∀ij ∈ F. (10) 14 For example, any optimal solution is F ∗-tight by Lemma 4.1. Notice that an F -tight vector f is ←→ not necessarily F -optimal as (7) might be violated for edges in EF F and also since Exb(f ) > 0 is allowed (note that ρf ≡ b is equivalent to Exb(f ) = 0). Conversely, an F -optimal vector is not necessarily F -tight as it can be nonzero on E \ F . f \ Given F and some node demands b : V → R, we would like to find an F -tight x with Exb(x) = 0. This is equivalent to finding a feasible solution (x, π) to the following system: πj − πi = C ′ ij(xij) ∀ij ∈ F Xj:ji∈F xji − Xj:ij∈E xij = bi ∀i ∈ V xij = 0 ∀ij ∈ E \ F (11) bi over undirected connected Let us define the discrepancy Db(F ) of F as the maximum of Pi∈K components K of F . A trivial necessary condition for solvability is Db(F ) = 0: indeed, summing up the second set of equalities for a component K, we obtain 0 = Pi∈K Oracle 2. Assume we have a subroutine Trial(F, b) so that for any linear acyclic F ⊆ E and any vector b : V → R satisfying Db(F ) = 0, it delivers an F -tight solution x to (11) with ρx ≡ b in strongly polynomial running time ρT (n, m). bi. For quadratic cost functions and also for Fisher markets, this subroutine can be implemented by solving simple systems of equations (for quadratic, this was already outlined in Section 1.2). Consider now an F -tight vector f , and let errF (f ) := inf{∆ : f is (∆, F )-feasible}. (12) Recall the definition (8) of the edge set EF f (∆). As f is assumed to be F -tight and therefore fij > 0 ←− F . Consequently, EF only if ij ∈ F , we get that EF f (∆) = E ∪ f (∆) is independent of the value of ∆. Because of continuity, this infimum is actually a minimum whenever the set is nonempty. If f is not (∆, F )-feasible for any ∆, then let errF (f ) = ∞. f is F -optimal if and only if f is a feasible flow (that is, Exb(f ) = 0) and errF (f ) = 0. Oracle 3. Assume a subroutine Error(f, F ) is provided, that returns errF (f ) for any F -tight vector f in strongly polynomial running time ρE(n, m). Further, if err∅(0) = ∞, then (P) is unbounded. This subroutine seems significantly harder to implement for the applications: we need to solve a minimum cost-to-time ratio cycle problem for quadratic costs and all pairs shortest paths for the Fisher markets. Having formulated all necessary assumptions, we are finally in the position to formulate the main result of the paper. Theorem 4.5. Assume Oracles 1-3 are provided and (⋆) holds for the problem (P) in a network on n nodes and m arcs, mN among them having nonlinear cost functions. Let ρT (n, m) and ρE(n, m) denote the running time of Oracle 2 and Oracle 3, and let ρS(n, m) be the running time needed for a single shortest path computation for nonnegative arc lengths. Then an exact optimal solution can be found in O((n + mN )(ρT (n, m) + ρE(n, m)) + (n + mN )2ρS(n, m) log m) time. This gives an O(m4 log m) algorithm for quadratic convex objectives. For Fisher markets, we obtain O(n4 + n2(m + n log n) log n) running time for linear and O(mn3 + m2(m + n log n) log m) for spending constraint utilities. 15 4.3 Description of the enhanced algorithm Algorithm 4 Algorithm Enhanced Convex Flow Error(0, ∅); f ← 0; ∆ ← max{err∅(0), Exb(0)/(2n + mN )}; F ← ∅; repeat do //∆-phase //main part S(∆) ← {i ∈ V : ρf (i) − bi ≥ ∆}; T (∆) ← {i ∈ V : ρf (i) − bi ≤ −∆}; P ← shortest s − t path in EF send ∆ units of flow on P from s to t; f (∆) for the cost C ′ ij(fij + ∆) with s ∈ S(∆), t ∈ T (∆); while S(∆), T (∆) 6= ∅; Extend(∆, f, F ); if (F was extended) and (Db(F ) ≤ ∆) then Trial-and-Error(F ) else Adjust(∆/2, f, F ); ∆ ← ∆/2; Subroutine Extend(∆, f, F ) for all ij ∈ E \ F , fij > (2n + m + 1)∆ do if F ∪ {ij} is linear acyclic then F ← F ∪ {ij} else P ← path of linear arcs in send fij units of flow on P from i to j; fij ← 0; ←→ F between i and j; Algorithm 4 starts with f = 0, ∆ = max{err∅(0), Exb(0)/(2n + mN )} and F = ∅. The algorithm consists of ∆-phases. In the ∆-phase, we shall maintain a linear acyclic revealed arc set F ⊆ F ∗, and a (∆, F )-feasible F -pseudoflow f . The algorithm will always terminate during the subroutine Trial-and-Error. The main part of the ∆-phase is the same as in the Basic algorithm. Let S(∆) = {i ∈ V : ρf (i) − bi ≥ ∆} and T (∆) = {i ∈ V : ρf (i) − bi ≤ −∆}. As long as S(∆) 6= ∅, T (∆) 6= ∅, send ∆ units of flow from a node s ∈ S(∆) to a node t ∈ T (∆) on a shortest path in EF f (∆) with respect to the cost function C ′ ij(fij + ∆). (The existence of such a path P is guaranteed by our assumption that the graph G = (V, E) is strongly connected.) After the main part (the sequence of path augmentations) is finished, the subroutine Ex- tend(∆, f, F ) adds new arcs ij ∈ E \ F with fij > (2n + m + 1)∆ to F maintaining the linear acyclic property. This is achieved as follows: we first add all nonlinear such arcs to F . We add a linear arc to F if it does not create any (undirected) cycles in F . If adding the linear arc ij would create a cycle, we do not include it in F , but reroute the entire flow from ij using the (undirected) path in F between i and j. If no new arc enters F , then we perform Adjust(∆/2, f, F ) and move to the next scaling phase with the same f and set the scaling factor to ∆/2. This is done also if F is extended, but it has a high discrepancy: Db(F ) > ∆. Otherwise, the subroutine Trial-and-Error(F ) determines the next f and ∆. Based on the arc set F , we find a new F -pseudoflow f and scaling factor at most ∆/2. The subroutine may also 16 terminate with an F -optimal solution, which enables us to find an optimal solution to (P) by a maximum flow computation due to Lemma 4.3. Theorem 5.5 will show that this is guaranteed to happen within a strongly polynomial number of steps. The Trial-and-Error subroutine The subroutine assumes that the discrepancy of F is small: Db(F ) ≤ ∆. Step 1. First, modify b to b: in each (undirected) component K of F , pick a node j ∈ K and Trial(F, b) returns an F -tight vector f . change bj by −Pi∈K bi; leave all other bi values unchanged. Thus we get a b with Db(F ) = 0. Step 2. Call the subroutine Error( f , F ). If b = b and errF ( f ) = 0, then f is F -optimal. An optimal solution to (P) can be found by a single maximum flow computation, as described in the proof of Lemma 4.3. In this case, the algorithm terminates. If errF ( f ) ≥ ∆/2, then keep the original f , perform Adjust(∆/2, f, F ) and go to the next scaling phase with scaling factor ∆/2. Otherwise, set f = f and define the next scaling factor as ∆next = max{errF ( f ), Exb( f )/(2n + mN )}. 5 Analysis The details how the shortest path computations are performed will be discussed in Section 5.1; in the following analysis, we assume it can be efficiently implemented. At the initialization, err∅(0) must be finite or the problem is unbounded as assumed in Oracle 3. Trial-and-Error replaces f by f if errF ( f ) ≤ ∆/2 and keeps the same f otherwise. The first case will be called a successful trial, the latter is unsuccessful. The following is (an almost identical) counterpart of Lemma 3.2. Lemma 5.1. (i) In the main part of the ∆-phase, the F -pseudoflow f is an integer multiple of ∆ on each arc ij ∈ E \ F , and consequently, EF f (∆) = EF f . (ii) (∆, F )-feasibility is maintained in the main part and in subroutine Extend(∆, f, F ). (iii) At the beginning of the main part, Ex(f ) ≤ (2n + mN )∆, and at the end, Ex(f ) ≤ n∆. (iv) The main part consists of at most 2n + mN flow augmentation steps. (v) The scaling factor ∆ decreases by at least a factor of 2 between two ∆-phases. Proof. For (i), f is zero on every arc in E \ F at the beginning of the algorithm and after every successful trial. In every other case, the previous phase had scaling factor 2∆, and thus by induction, the flow is an integer multiple of 2∆ at the end of the main part of the 2∆-phase, a property also maintained by Extend(2∆, f, F ). The 2∆-phase finishes with Adjust(∆, f, F ), possibly modifying the flow on every arc by ±∆. In the main part of the ∆-phase, the shortest path augmentations also change the flow by ±∆. This implies EF f (∆) = EF f . For (ii), P is a shortest path if there exists a potential π satisfying (9) with πj −πi = C ′ ij(fij +∆) on each arc ij ∈ P (see also Section 5.1). We show that when augmenting on the shortest path P , (9) is maintained with the same π. If ij, ji /∈ P , then it is trivial as the flow is left unchanged on ij. Consider now an arc ij ∈ P ; the next argument applies both if ij is a forward or a reverse arc. The new flow value will be fij + ∆, hence we need πj − πi ≤ C ′ ij(fij + 2∆), obvious as C ′ f (∆). This gives ij is monotonely increasing. We next verify (9) for the backward arc ji ∈ EF 17 πi − πj ≤ C ′ monotonicity. ji((fji − ∆) + ∆), that is equivalent to C ′ ij(fij) ≤ πj − πi, again a consequence of In subroutine Extend, we reroute the flow fij from a linear arc ij if path P from i to j. This cannot affect feasibility since the C ′ note that arcs in ←→ F have infinite residual capacities. ←→ F contains a directed ij's are constant on linear arcs. Also For (iii), Ex(f ) ≤ n∆ as the main part terminates with either S(∆) = ∅ or T (∆) = ∅. Lemma 4.4 shows that Adjust(∆/2, f, F ) increases the excess by at most mN ∆/2. Consequently, Ex(f ) ≤ (2n + mN )(∆/2) at the beginning of the ∆/2-phase. The other possible case is that a successful trial replaces ∆ by ∆next. By definition, the new excess is at most (2n + mN )∆next. Further, (iii) implies (iv), as each flow augmentation decreases Ex(f ) by ∆. Finally (v) is straightforward if the next value of the scaling factor is set as ∆/2. This is always the case, except if Trial-and-Error is called and errF ( f ) ≤ ∆/2, when the next scaling factor is set as the maximum of errF ( f ) and Exb( f )/(2n + mN ). We show that this second term is also at most ∆/2. Indeed, f was obtained by Trial(F, b), and therefore ρ f (i) − bi = bi − bi ≤ ∆ due to the definition of b and Db(F ) ≤ ∆. It follows that Exb( f ) ≤ n∆, and thus Exb( f )/(2n + mN ) < ∆/2. Lemma 5.2. F ⊆ F ∗ holds in each step of the algorithm. Proof. The proof is by induction. A new arc ij may enter F if fij > (2n + m + 1)∆ after the main part of the ∆-phase. We shall prove that f ∗ ij > 0 for some F -optimal solution f ∗, and thus Lemma 4.3 gives ij ∈ F ∗. After the phase when ij entered, let us continue with the following modified algorithm: do not extend F and do not perform Trial-and-Error anymore, but always choose the next scaling factor as ∆/2, and keep the algorithm running forever. (This is almost the same as the Basic algorithm, with the difference that we have a revealed arc set F .) Let ∆0 = ∆ and ∆t = ∆/2t denote the scaling factor in the t'th phase of this algorithm (with phase 0 corresponding to the ∆-phase). Consider any ∆t-phase (t ≥ 1). The flow is modified by at most (2n + mN )∆t during the main part by Lemma 5.1(iv) and by ∆t/2 in Adjust(∆t/2, f, F ), amounting to a total modification ≤ (2n + mN + 1 2 )∆t. Consequently, the total modification in the ∆t phase and all later phases is bounded by (2n + mN + 1 k=t ∆k ≤ 2(2n + m + 1 We may conclude that when running forever, the flow f converges to an F -optimal solution f ∗. Indeed, let f (t) denote the F -pseudoflow at the end of the t'th phase. By the above observation, f (t) − f (t′)∞ ≤ 2(2n + m + 1 2 )∆t for any t′ ≥ t ≥ 0. Consequently, on every arc ij ∈ E, the sequence f (t) ij converges; let f ∗ denote the limit. We claim the f ∗ is F -optimal. 2 )P∞ 2 )∆t. Firstly, f ∗ is clearly an F -pseudoflow. Property (7) is equivalent to the property that EF not contain any negative cycle w.r.t. C ′ ij(f (t) contain any negative cycle w.r.t. C ′ limt→∞ Exb(f (t)) ≤ limt→∞ n∆t = 0, and therefore Exb(f ∗) = 0. ij(fij). This follows from the fact that EF f does f (∆t) does not ij ) due to the (∆t, F )-feasibility of f (t). Finally, Exb(f ∗) = To finish the proof, we observe that f ∗ Indeed, fij > (2n + m + 1)∆ after the main ij > 0. part of the ∆-phase, and hence fij > (2n + m + 1 2 )∆ at the end of the ∆-phase (after performing Adjust(∆/2, f, F )). By the above argument, the total change in all later phases is ≤ 2(2n + m + 1 2 )∆1 = (2n + m + 1 2 )∆, yielding the desired conclusion. Recall the characterization of arcs to free and restricted. Free arcs are differentiable on the ij(α) = −∞ for α < 0. Therefore we have to entire R, whereas for a restricted arc ij, we have C ′ avoid the flow value becoming negative even if ij ∈ F for a restricted arc. 18 Claim 5.3. fij ≥ 0 holds for every restricted arc ij during the entire algorithm, even if ij ∈ F . Proof. fij ≥ 0 holds at the initialization; consider the first ∆-phase when fij < 0 is attained. This can happen during a path augmentation or in the Adjust subroutine (Extend may not modify fij as ij is a nonlinear arc). In case of a path augmentation, ji is contained on the shortest path P , and therefore πj − πi = C ′ ij(fij − ∆) must hold for a potential π (see the proof of Lemma 5.1). This is a contradiction as fij − ∆ < 0 and thus C ′ ij(fij − ∆) = −∞. A similar argument works for Adjust. Lemma 5.4. When Trial-and-Error(F ) is performed in the ∆-phase, errF ( f ) ≤ 6(m + 1)2∆ holds. This lemma is of key importance. Before proving it, we show how it provides the strongly polynomial bound. The main idea is the following: in Trial-and-Error(F ), we replace f by f and ∆ by a new value instead of ∆/2 in case errF ( f ) < ∆/2; otherwise, we ignore f and proceed to the next phase as usual. Whereas errF ( f ) ≥ ∆/2 is possible, the lemma gives an upper bound in terms of ∆. Note also that the output of the subroutine Trial-and-Error(F ) depends only on the revealed arc set F . Consequently, if we had errF ( f ) ≥ ∆/2, then by the time the scaling factor reduces to a smaller value ∆′ such that 6(m + 1)2∆′ < ∆/2, the set F must have been extended. Theorem 5.5. The enhanced algorithm terminates in at most O((n + mN ) log m) scaling phases. Proof. The set of revealed arcs can be extended at most mN + n − 1 times, since there can be at most (n − 1) linear arcs because of the linear acyclic property. We shall show that after any ∆-phase, a new arc is revealed within 2⌈log2 T ⌉ phases, for T = 24(m + 1)2. As ∆ decreases by at least a factor of two between two phases, after ⌈log2 T ⌉ steps we have ∆T ≤ ∆/T . Assume that in the ∆T phase, we still have the same revealed arc set F as in the ∆-phase. Case I. Db(F ) > ∆. At the end of the main part of the ∆T -phase, Db(F ) > 24(m + 1)2∆T . Thus there is an undirected connected component K of F with Pi∈K bi > 24(m + 1)2∆T . Let ρf (K) denote the total f value on arcs entering K minus the value on arcs leaving K, that is, We have bi(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) α− = Pi∈K min{ρf (i) − bi, 0}, and γ = Exb(f ). The conditions hold since ρf (K) := Xij∈E:i /∈K,j∈K = (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ρf (i)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xi∈K In our setting, β = Pi∈K bi, α+ = Pi∈K max{ρf (i) − bi, 0}, max{ρf (i) − bi, 0} = −Xi∈V The last part is derived from the simple inequality β+α++α− ≥ β−γ, whenever α+, α−, β, γ ∈ R with −γ ≤ α− ≤ 0 ≤ α+ ≤ γ. fij − Xij∈E:i∈K,j /∈K ≥ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (ρf (i) − bi + bi)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xi∈K ρf (K) = (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xi∈K fij. − Exb(f ). γ = Exb(f ) = Xi∈V min{ρf (i) − bi, 0}. For the second equality, note that Pi∈V bi = Pi∈V ρf (i) = 0. Now we may conclude − Exb(f ) > 24(m + 1)2∆T − n∆T > (2n + m + 1)m∆T . ρf (K) ≥ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xi∈K bi(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 19 Consequently, there must be an arc ij entering or leaving K with fij > (2n + m + 1)∆T , a contradiction as at least one such arc must have been added to F in Extend(∆T , f, F ). Note that the first such arc examined during Extend(∆T , f, F ) does keep the linear acyclic property as it connects two separate connected components of F . Case II. Db(F ) ≤ ∆. We may assume that either we are at the very beginning of the algorithm with F = ∅, or in a phase when F just has been extended; otherwise, we could consider an earlier phase with this property. We can interpret the initial solution 0 and initial ∆ as the output of Trial-and-Error(∅). Case IIa. Db(F ) > ∆T . The argument of Case I, applied for ∆T instead of ∆, shows that within ⌈log2 T ⌉ phases after the ∆T phase, F shall be extended, showing that a new arc was revealed within 2⌈log2 T ⌉ phases after the ∆-phase. Case IIb. Db(F ) ≤ ∆T . Recall the assumption that F has not changed between phases ∆ and ∆T , and thus Db(F ) has not changed its value either. Let us apply the analysis of the Trial- and-Error subroutine for the ∆T -phase. (Even if the subroutine is not actually performed, its analysis is valid provided that Db(F ) ≤ ∆T .) Let f be the arc set found by Trial(F, b). Let us assume that b is modified to b always the same way for the same F ; with this assumption, the output of the subroutine is the same whether called in the ∆ or in the ∆T -phase. In the event of an unsuccessful trial in the ∆-phase, ∆/2 ≤ errF ( f ). Using Lemma 5.4 for the ∆T -phase, errF ( f ) ≤ 6(m + 1)2∆T ≤ ∆/4 ≤ errF ( f )/2, a contradiction. On the other hand, if we had a successful trial in the ∆-phase, then ∆T ≤ 2∆next/T , as ∆T is the scaling factor T − 1 phases after the ∆next-phase. Lemma 5.4 and Exb( f ) ≤ nDb(F ) ≤ n∆T together yield ∆next = max{errF ( f ), Exb( f )/(2n + mN )} ≤ 6(m + 1)2∆T ≤ ∆next/2, a contradiction again. Some preparation is needed to prove Lemma 5.4. We note that the linear acyclic property is important due to the following lemma; if F may contains undirected cycles of linear arcs, the claim is not true. Lemma 5.6. For a linear acylic arc set F ⊆ E, let x and y be two F -tight vectors. Then x−y∞ ≤ ρx − ρy1 holds. a cycle C ⊆ Ex,y, then we get 0 = Pab∈C C ′ Proof. First, we claim that the difference graph Dx,y = (V, Ex,y) is acyclic. Indeed, if there existed ab(yab) as in the proof of Lemma 4.1. Since xab > yab for every ab ∈ C, this is only possible if all arcs of C are linear (⋆), contradicting ←→ the linear acyclic property of F . (Note that Ex,y ⊆ F , since by definition, every F -tight vector is supported on F ). ab(xab) = Pab∈C C ′ Define the function z by zij = xij − yij > 0 for ij ∈ Ex,y (again with the convention xji = −xij, yji = −yij if ij ∈ E). ρz ≡ ρx − ρy, therefore we have to prove zij ≤ ρz1 for ij ∈ Ex,y. This property indeed holds for every positive z with acyclic support. Consider a reverse topological ordering v1, . . . , vn of V , where vavb ∈ Ex,y implies a > b. For the arc ij ∈ Ex,y, let i = vt′ and j = vt (t′ > t). Let Vt = {v1, . . . , vt}. Vt is a directed cut in Ex,y, thus Xp>t≥q zvpvq = Xp≤t ρz(vp). 20 for ij. As z is positive on all arcs, this implies zvavb ≤ Pp≤t ρz(vp) ≤ ρz1 for all such arcs, in particular, Claim 5.7. If f and f are F -pseudoflows with fij = 0 for ij ∈ E \ F , and f is (∆, F )-feasible, then f is (∆ + f − f ∞, F )-feasible. Proof. There is a potential π so that f and π satisfy (9), that is, πj −πi ≤ C ′ f (∆). For α = f − f ∞, we have fij + ∆ ≤ fij + ∆ + α. Consequently, (9) is satisfied for ( fij, π) and ∆ + α for every arc in EF ij(fij +∆) if ij ∈ EF f (∆). By the assumption that f is zero outside F , we have EF f the claim follows. (∆ + α) = E ∪ ←− F ⊆ EF f (∆) and thus Proof of Lemma 5.4. When Trial-and-Error is applied, f is (∆, F )-feasible with some potential π and Exb(f ) ≤ n∆. We claim that there is an F -tight ¯f so that ¯fij − fij ≤ ∆ for every ij ∈ F , and Exb( ¯f ) ≤ (2n + m + 2)m∆. Indeed, (∆, F )-feasibility gives C ′ ij(fij − ∆) ≤ πj − πi ≤ C ′ ij(fij + ∆) ∀ij ∈ F. If ij is a free arc (that is, differentiable on the entire R), then C ′ a value fij − ∆ ≤ β ≤ fij + ∆ with C ′ by Claim 5.3, fij ≥ 0 and C ′ us set ¯fij = β. This increases Exb(f ) by at most F ∆. ij is continuous, so there must be ij(β) = πj − πi. This also holds if ij is a restricted arc, since ij(0) = −∞. Let ij is continuous on (max{0, fij − ∆}, fij + ∆), and C ′ Let us set ¯fij = 0 for ij ∈ E \ F . Note that fij ≤ (2n + m + 1)∆ if ij /∈ F (every arc with fij > (2n + m + 1)∆ is either added to F or is modified to fij = 0 in the subroutine Extend). Further, Exb(f ) ≤ n∆, and thus we obtain an F -tight ¯f with Exb( ¯f ) ≤ n∆ + F ∆ + (2n + m + 1)(m − F )∆ ≤ (2n + m + 2)m∆. On the other hand, Exb( f ) ≤ nDb(F ) ≤ n∆, since Exb( f ) = 0 and b is obtained from b by modifying certain values by ≤ Db(F ). Consequently, ρ ¯f − ρ f 1 ≤ ρ ¯f − b1 + ρ f − b1 = 2Exb( ¯f ) + 2Exb( f ) ≤ 2(2n + m + 3)m∆ ≤ 6m(m + 1)∆. Applying Lemma 5.6 for x = ¯f and y = f gives f − ¯f ∞ ≤ 6m(m + 1)∆. We also have f − ¯f ∞ ≤ (2n + m + 1)∆ ≤ (3m + 1)∆ by the construction, and therefore f − f ∞ ≤ f − ¯f ∞ + ¯f − f ∞ < 6(m + 1)2∆ − ∆ Applying Claim 5.7 for f and f we conclude that f is 6(m + 1)2∆-feasible; recall that f was (∆, F ) feasible when we applied Trial-and-Error. Theorem 5.8. Let ρS(n, m) be the running time needed for one shortest path computation for nonnegative lengths. Then the running time of the algorithm is bounded by O((n + mN )(ρT (n, m) + ρE(n, m)) + (n + mN )2ρS(n, m) log m). Proof. By Theorem 5.5, there are at most (n + mN ) log m scaling phases, each dominated by O(n + mN ) shortest path computations. The subroutine Trial-and-Error is performed only when F is extended, that is, at most n + mN times, and comprises the subroutines Trial and Error. 21 5.1 Shortest path computations For the sake of efficiency, we shall maintain a potential vector π during the entire algorithm such that (f, π) satisfies the condition (9) on (∆, F )-feasibility. For the initial ∆ value, ∆ ≥ err∅(0), and the latter value is computed by Error(0, ∅). This means that f = 0 is (∆, ∅)-feasible. Similarly, after every successful trial we have a new flow f computed by Error(f, F ) and new scaling factor value ∆next ≥ errF ( f ). In the applications, this subroutine will also return a potential vector π such that (f, π) satisfies (9). Alternatively, such a potential vector may be obtained by the standard label correcting algo- f (∆) contains no ij(fij + ∆); we have access to these values via rithm (see [1, Chapter 5.5]), since it is a dual proof of the fact that the graph EF negative cycles with respect to the cost function C ′ the value oracle (Oracle 1). ij(fij + ∆) that may take negative values, we shall use C ′ In the main part of the ∆-phase, we may apply a variant of Dijkstra's algorithm (see [1, Chapter 4.5]) to compute shortest paths. This needs a nonnegative cost function, but instead of the original C ′ ij(fij + ∆) − πj + πi, a nonnegative function by (9); the set of shortest paths is identical for the two costs. This subroutine can be implemented by updating the potentials π, so that (∆, F )-feasibility is maintained, and we obtain C ′ ij(fij + ∆) = πj − πi on every arc of every shortest path. For the sake of completeness, we describe this subroutine in the Appendix. As shown in the proof of Lemma 5.1(ii), once we have a potential π such that C ′ ij(fij + ∆) = πj − πi on every arc of a shortest path P , then sending ∆-units of flow on P maintains (9) for (f, π). It is also maintained in Extend(∆, f, F ) since flow values are modified only on arcs with C ′ ij constant. Finally, Adjust(∆/2, f, F ) modifies the flow so that (9) is maintained for the same π and ∆/2 by Lemma 4.4. Let us now explore the relation to Oracle 1. In both applications, we shall verify that the subroutine Trial-and-error returns a rational flow vector f and a rational value ∆. Since flow will always be modified in units of ∆ in all other parts of the algorithm, we may conclude that a rational f will be maintained in all other parts. Under Oracle 1(a) (i.e., quadratic objectives), we shall maintain a rational potential vector π, while under Oracle 1(b) (i.e., Fisher markets), we shall maintain the rationality of the eπi values; during the computations, we shall use the representation of these values instead of the original π. For this aim, we will use a multiplicative variant of Dijkstra's algorithm, also described in the Appendix. We shall also verify that in the corresponding applications, the subroutine Error(f, F ) returns a potential vector π so that (f, π) satisfies (9), with the πi or the eπi values being rational, respectively. Finally, it is easy to verify that whereas we are working on a transformed uncapacitated instance, we may use the complexity bound of the original instance, as summarized in the following remark. Remark 5.9. A shortest path computation can be performed in time ρS(n, m) = O(m + n log n) using Fibonacci heaps, see [9]. Recall that the original problem instance was on n′ nodes and m′ arcs, and it was transformed to an uncapacitated instance on n = n′ + m′ nodes and m = 2m′ arcs. However, as in Orlin's algorithm [29], we can use the bound O(m′ + n′ log n′) instead of O(m′ + m′ log n′) because shortest path computations can be essentially performed on the original network. 22 6 Applications 6.1 Quadratic convex costs Assume that Cij(α) = cijα2 + dijα for each ij ∈ E, with cij ≥ 0. This clearly satisfies the assumption in Oracle 1(i) since C ′ ij(α) = 2cij α + dij. Also, (⋆) is satisfied: ij is linear if cij = 0. The subroutine Trial(F, b) can be implemented by solving a system of linear equations. πj − πi = 2cij xij + dij ∀ij ∈ F Xj:ji∈F xji − Xj:ij∈F xij = bi ∀i ∈ V xij = 0 ∀ij ∈ E \ F (13) The conditions in Oracle 2 is verified by the next claim. Lemma 6.1. Let F be linear acyclic (that is, there is no undirected cycle of arcs with cij = 0) with Db(F ) = 0. Then (13) is feasible and a solution can be found in ρT (n, m) = O(n2.37 + m) time. Proof. Clearly, we can solve the system separately on different undirected connected components of F . In the sequel, let us focus on a single connected component; for simplicity of notation, assume this component is the entire V . Consider first the case when all arcs are linear. Then we can solve the equalities corresponding to edges and nodes separately. As F is assumed to be linear acyclic, it forms a tree. If we fix one πj value arbitrarily, it determines all other πi values by moving along the edges in the tree. The xij's can be found by solving a flow problem on the same tree with the demands bi. This is clearly feasible by the assumption Db(F ) = 0, that is, Pi∈V bi = 0 (note that we do not have nonnegativity constraints on the arcs). Both tasks can be performed in linear time. Assume next both linear and nonlinear arcs are present, and let T be an undirected connected component of linear arcs. As above, all πj − πi values for i, j ∈ T are uniquely determined. If there is a nonlinear arc ij ∈ F with i, j ∈ T , then xij = (πj − πi − dij)/(2cij ) = α is also uniquely determined. We can remove this edge by replacing bi by bi + α and bj by bj − α. Hence we may assume that the components of linear arcs span no nonlinear arcs. Next, we can contract each such component T to a single node t by setting bt = Pi∈T bi and modifying the dij values on incident arcs as follows. Let t correspond to a fixed node in T , and consider an arc with i ∈ T , j /∈ T . Let α denote the sum of dab values on the t − i path in T ; let us add α to dij. Similarly for an arc ij entering T we must subtract the sum of the costs on the t − j path from dij. A solution to the contracted problem can be easily extended to the original instance. For the rest, we can assume all arcs are nonlinear, that is, cij > 0 for all ij ∈ F . Let A be the node-arc incidence matrix of F : Ai,ij = −1, Ai,ji = 1 for all ij ∈ F , and all other entries are 0. Let C be the F × F diagonal matrix with Cij,ij = −2cij. (13) can be written in the form (cid:18) AT C 0 A (cid:19) (π, x)T = (cid:18) d b (cid:19) . This can be transformed into (cid:18) AT C L 0 (cid:19) (π, x)T = (cid:18) d b′ (cid:19) , 23 where L is the weighted Laplacian matrix with Lii = Pj:ij∈ Lij = 0 otherwise, and b′ is an appropriate vector with Pi∈V b′ Pi∈V b′ The main task is to solve the system Lπ = b′. It is well-know (recall that V is assumed to be a single connected component) that L has rank V − 1 and the system is always feasible whenever i = 0. A solution can be found in O(n2.37) time [3]. All previously described operations (eliminating nonlinear arcs spanned in components of linear arcs, contracting components of linear arcs) can be done in O(m) time, hence the bound ρT (n, m) = O(n2.37 + m). , Lij = Lji = − 1 2cij if ij ∈ F and ←→ F 1 2cij i = 0. To implement Error(f, F ), we have an F -tight vector f , and we need to find the minimum ∆-value such that there exists a π potential with πj − πi ≤ (2cij fij + dij) + 2cij∆ ∀ij ∈ E ∪ ←− F . (14) We show that this can be reduced to the minimum-cost-to-time ratio cycle problem, defined as follows (see [1, Chapter 5.7]). In a directed graph, there is a cost function pij and a time τij ≥ 0 as- sociated with each arc. The aim is to find a cycle C minimizing (Pij∈C pij)/(Pij∈C τij). A strongly polynomial algorithm was given by Megiddo [23, 24] that solves the problem in min{O(n3 log2 n), O(n log n(n2 + m log log n))} time. The problem can be equivalently formulated as min µ s. t. there are no negative cycles for the cost function pij + µτij. (15) Our problem fits into this framework with pij = 2cijfij + dij and τij = 2cij. In (15), the optimal µ value is −∆. However, [23] defines the minimum ratio cycle problem with τij > 0 for every ij ∈ E. This property is not essential for Megiddo's algorithm, which uses a parametric search method for µ to solve (15) under the only (implicit) restriction that the problem is feasible. In our setting τij > 0 holds for nonlinear arcs, but τij = 0 for linear arcs. Also, there can be ←− cycles C with Pij∈C τij = 0. (This can happen even if F is linear acyclic, as C can be any cycle in F .) If we have such a cycle C with Pij∈C pij < 0, then (15) is infeasible. In every other case, E ∪ the problem is feasible and thus Megiddo's algorithm can be applied. For this reason, we first check whether there is a negative cycle with respect to the pij's in the ←− set of linear arcs in E ∪ F . This can be done via the label correcting algorithm in O(nm) time ([1, Chapter 5.5]). If there exists one, then (14) is infeasible, thus errF (f ) = ∆ = ∞, and (P) is unbounded as we can send arbitrary flow around this cycle. Otherwise, we have Pij∈C τij > 0 for every cycle with Pij∈C pij < 0, and consequently, there exists a finite ∆ satisfying (14). Consequently, ρT (n, m) = min{O(n3 log2 n), O(n log n(n2 + m log log n))}. Theorem 5.8 gives the following running time bound. Theorem 6.2. For convex quadratic objectives on an uncapacitated instance on n nodes and m arcs, the algorithm finds an optimal solution in O(m(n3 log2 n + m log m(m + n log n))) time. For a capacitated instance, the running time can be bounded by O(m4 log m). The bottleneck is clearly the m minimum-cost-to-time computations. As in Remark 5.9, it is likely that one can get the same running time O(m(n3 log2 n+m log m(m+n log n))) for capacitated instances via a deeper analysis of Megiddo's algorithm. Let us verify that the algorithm is strongly polynomial. It uses elementary arithmetic operations only, and the running time is polynomial in n and m, according to the above theorem. It is left to verify requirement (iii) on strongly polynomial algorithms (see the Introduction): if all numbers in 24 the input are rational, then every number occurring in the computations is rational and is of size polynomially bounded in the size of the input. At the initialization and in every successful trial, we compute a new flow f by solving (13) as described in Lemma 6.1, and compute the new ∆ and π values by Megiddo's algorithm. These are strongly polynomial subroutines and return rational values of size polynomially bounded in the input. Namely, solving (13) requires first contracting components of linear arcs and modifying costs and demands by additive terms. In the contracted instance, we need to solve a system of linear equations by exact arithmetics. This can be done by maintaining that the sizes of numbers in the output are polynomially bounded in the input size, see e.g. [32, Chapter 3]. The new ∆ and π are obtained using Megiddo's strongly polynomial parametric search algorithm. It is immediate that ∆ will be of polynomial encoding size, since it equals the cost-to-time ratio of a certain cycle, with both costs and times of polynomial encoding size. Consider now the phases between any two successful trials (or between the initialization and the first successful trial); the bound on the number of such phases is O(log m). The value of ∆ decreases by a factor of 2 at the end of each phases, and the value of f is modified by ±∆ in path augmentations and by ±∆/2 in the Adjust subroutine. Consequently, the flow remains an integer multiple of ∆ on the arcs ij ∈ E \ F up to the Adjust subroutine(see also Lemma 5.1(i)). On arcs ij ∈ F , it will be the sum of the value returned by Trial-and-Error, plus an integer multiple of ∆. The bound O(n + mN ) on the number of path augmentations, and the bound O(log m) on the number of phases guarantees that the numerators also remain polynomially bounded. 6.2 Fisher's market with linear utilities In the linear Fisher market model, we are given a set B of buyers and a set G of goods. Buyer i has a budget mi, and there is one divisible unit of each good to be sold. For each buyer i ∈ B and good j ∈ G, Uij ≥ 0 is the utility accrued by buyer i for one unit of good j. Let n = B + G; let E be the set of pairs (i, j) with Uij > 0 and let m = E. We assume that there is at least one edge in E incident to every buyer and to every good. An equilibrium solution consist of prices pj of the goods and allocations xij, so that (i) all goods are sold, (ii) all money of the buyers is spent, and (iii) each buyer i buys a best bundle of goods, that is, goods j maximizing Uij/pj. The classical convex programming formulation of this problem was given by Eisenberg and Gale [7]. Recently, Shmyrev [33] gave the following alternative formulation. The variable fij represents the money paid by buyer i for product j. minXj∈G pj(log pj − 1) − Xij∈E fij log Uij Xj∈G Xi∈B fij = mi ∀i ∈ B fij = pj ∀j ∈ G fij ≥ 0 ∀ij ∈ E Let us construct a network on node set B ∪ G ∪ {t} as follows. Add an arc ij for every ij ∈ E, and an arc jt for every j ∈ G. Set bi = −mi for i ∈ B, bj = 0 for j ∈ G and bt = Pi∈B mi. Let all lower arc capacities be 0 and upper arc capacities ∞. With pj representing the flow on arc jt, and fij the flow on arc ij, the above formulation is a minimum-cost flow problem with separable convex objective. (The arc jt is restricted, with extending the functions pj(log pj − 1) to take value 0 in 0 25 and ∞ on (−∞, 0). All other arcs are free; indeed, they are linear.) In this section, the convention pj = fjt shall be used for some pseudoflow f in the above problem. Let us justify that an optimal solution gives a market equilibrium. Let f be an optimal solution that satisfies (3) with π : B ∪ G ∪ {t} → R. We may assume πt = 0. C ′ jt(α) = log α implies πj = − log pj. On each ij ∈ E we have πj − πi ≤ − log Uij with equality if fij > 0. With βi = eπi, this is equivalent to Uij/pj ≤ βi, verifying that every buyer receives a best bundle of goods. Oracle 1(b) is a valid assumption, since the derivatives on arcs ij between buyers and goods are − log Uij, while on an arc jt it is log fjt. The property (⋆) is straightforward. Let us turn to Oracle 2. When the subroutine Trial is called, we transform b to b by changing the value at one node of each component K of F . For simplicity, let us always modify bt if t ∈ K, and on an arbitrary node for the other components. We shall verify the assumptions in Oracle 2 only for such b's; the argument can easily be extended to arbitrary b (although it is not necessary for the algorithm). Let us call the component K containing t the large component. In Trial(F ), we want to find a potential π : B ∪ G ∪ {t} → R ∪ {∞}, money allocations fij for ij ∈ F , i ∈ B, j ∈ G, and prices pj = fjt for jt ∈ F such that πj − πi = − log Uij ∀ij ∈ F, i ∈ B, j ∈ G πt − πj = log pj ∀jt ∈ F Xj∈G,ij∈F Xi∈B,ij∈F Xi∈B,ij∈F fij = bi ∀i ∈ B fij = pj ∀jt ∈ F fij = bj ∀jt ∈ E \ F We may again assume πt = 0. Let Pj = e−πj for j ∈ G and βi = eπi for i ∈ B. With this notation, Uij/Pj = βi for ij ∈ F . If jt ∈ F , then Pj = pj. Finding f and π can be done independently on the different components of F . For any com- ponent different from the large one, all edges are linear. Therefore we only need to find a feasible flow on a tree, and independently, Pj and βi values satisfying Uij/Pj = βi on arcs ij in this com- ponent. Both of these can be performed in linear time in the number of edges in the tree. Note that multiplying each Pj by a constant α > 0 and dividing each βi by the same α yields another feasible solution. Let T1, . . . , Tk be the components of the large component after deleting t. If Tℓ contains a single good j, then we set pj = Pj = 0 (πj = ∞). If Tℓ is nonsingular, then F restricted to Tℓ forms a spanning tree. The equalities Uij/Pj = βi uniquely define the ratio Pj/Pj ′ for any j, j′ ∈ G ∩ Tℓ. We have that pj = Pj and Pi∈B∩Tℓ pj by the constraints on the buyers in B ∩ Tℓ and goods in G∩ Tℓ; note that bi = −mi for all buyers in B ∩ Tℓ. Hence the prices in Tℓ are uniquely determined. Then the edges in F simply provide the allocations fij. All these computations can be performed in ρT (n, m) = O(m) time. mi = Pj∈G∩Tℓ For Oracle 3, we show that Error(f, F ) can be implemented based on the Floyd-Warshall algo- rithm (see [1, Chapter 5.6]). Let π be the potential witnessing that f is (∆, F )-feasible. Assuming πt = 0, and using again the notation Pj = e−πj for j ∈ G and βi = eπi for i ∈ B, we get Uij/Pj ≤ βi if i ∈ B, j ∈ G, ij ∈ E, with equality if ji ∈ EF f . (16) Furthermore, we have pj − ∆ ≤ Pj ≤ pj + ∆ if pj > 0 and Pj ≤ ∆ if pj = 0. 26 Let us now define γ : G × G → R as γjj ′ = max(cid:26) Uij ′ Uij : i ∈ B, ji, ij′ ∈ EF f (cid:27) . If no such i exists, define γjj ′ = 0; let γjj = 1 for every j ∈ G. Claim 6.3. Assume we are given some Pj values, j ∈ G. There exists βi values (i ∈ B) satisfying (16) if and only if Pj ′ ≥ Pjγjj ′ holds for every j, j′ ∈ G. Proof. The condition is clearly necessary by the definition of γjj ′. Conversely, if this condition holds, setting βi = maxj∈G Uij/Pj does satisfy (16). If there is a directed cycle C with Πab∈C γab > 1, then f cannot be (∆, F )-feasible for any ∆. Otherwise, we may compute γjj ′ as the maximum of Πab∈P γab over all directed paths P in EF f from j to j′ (setting the value 0 again if no such path exists). This can be done by the multiplicative version of the Floyd-Warshall algorithm in O(n3) time (note that this is equivalent to finding all-pair shortest paths for − log γab). For (∆, F )-feasibility, we clearly need to satisfy (pj − ∆)γjj ′ ≤ Pj γjj ′ ≤ Pj ′ ≤ pj ′ + ∆. Let us define ∆ as the smallest value satisfying all these inequalities, that is, ∆ = max(cid:26)0, max j,j ′∈G pj γjj ′ − pj ′ γjj ′ + 1 (cid:27) . (17) We claim that f is (∆, F )-feasible with the above choice. For each j ∈ G, let Pj = maxh∈G γhj(ph − ∆). It is easy to verify that these P values satisfy Pj ′ ≥ Pjγjj ′, and pj − ∆ ≤ Pj ≤ pj + ∆. The condition (16) follows by Claim 6.3. The complexity of Error(f, F ) is dominated by the Floyd-Warshall algorithm, O(n3) [8]. The problem is defined on an uncapacitated network, with the number of nonlinear arcs mN = G < n. Thus Theorem 5.8 gives the following. Theorem 6.4. For Fisher's market with linear utilities, the algorithm finds an optimal solution in O(n4 + n2(m + n log n) log n). The algorithm of Orlin [30] runs in O(n4 log n) time, assuming m = O(n2). Under this assump- tion, we get the same running time bound. To prove that the algorithm is strongly polynomial, let us verify the nontrivial requirement (iii) (see the Introduction). As discussed in Section 5.1, if the input is rational, we shall maintain that f , ∆ and the eπi values are rational; the latter are used in the computations instead of the πi's. At the initialization and in every successful trial, the subroutines described above are strongly polynomial and therefore return rational f , ∆ and eπi values, of size polynomially bounded in the input (note that the eπi values above are denoted by Pi for i ∈ G and βi for i ∈ B, and eπt = 1). Between two successful trials, we can use the same argument as in Section 6.1 for quadratic costs: there are O(log m) such iterations, ∆ is divided by two at the end of every phase, the path augmentations change f by ±∆ and Adjust by ±∆/2. The multiplicative Dijkstra algorithm described in the Appendix also maintains rational eπi values of polynomial encoding length. 27 6.3 Fisher's market with spending constraint utilities The spending constraint utility extension of linear Fisher markets was defined by Vazirani [37]. In this model, the utility of a buyer decreases as the function of the money spent on the good. Formally, for each pair i and j there is a sequence U 1 ij > 0 of utilities with numbers L1 ij for every unit of j he purchased by spending the first L1 ij dollars, etc. These ℓij intervals corresponding to the pair ij are called segments. ℓij = 0 is allowed, but we assume Pj∈G ℓij > 0 for all i ∈ B and Pi∈B ℓij > 0 for all j ∈ G. Let n = B + G denote the total number of buyers and goods, and m denote the total number of segments. Note that m > n2 is also possible. ij, . . . , Lℓj ij dollars on good j, U 2 ij > 0. Buyer i accrues utility U 1 ij for spending the next L2 ij > . . . > U ℓij ij > U 2 No extension of the Eisenberg-Gale convex program is known to capture this problem. The existence of a convex programming formulation is left as an open question in [37]. This was settled by Devanur et al. [2], giving a convex program based on Shmyrev's formulation. Let f k ij represent the money paid by buyer i for the k'th segment of product j, 1 ≤ k ≤ ℓij. f k ij log U k ij minXi∈G pj(log pj − 1) − Xi∈B,j∈G,1≤k≤ℓij Xj∈G,1≤k≤ℓij Xi∈B,1≤k≤ℓij f k ij = mi ∀i ∈ B f k ij = pj ∀j ∈ G 0 ≤ f k ij ≤ Lk ij ∀ij ∈ E. This gives a convex cost flow problem again on the node set B ∪ G ∪ {t}, by adding ℓij parallel arcs from i ∈ B to j ∈ G, and arcs jt for each j ∈ G. The upper capacity on the k'th segment for the pair ij is Lk ij. To apply our method, we first need to transform it to an equivalent problem without upper capacities. This is done by replacing the arc representing the k'th segment of ij by a new node (ij, k) and two arcs i(ij, k) and j(ij, k). The node demand on the new node is set to Lk ij, ij, the negative of the sum of capacities of all incident segments. The cost function on i(ij, k) is − log U k ijα, while the cost of j(ij, k) is 0. Let S denote the set of the new (ij, k) nodes. This modified graph has n′ = n + m + 1 nodes and m′ = 2m + G arcs. while on the good j, we replace the demand 0 by −Pi,k Lk Assumption (⋆) is clearly valid. Oracle 1(b) is satisfied the same way as for linear Fisher markets, using an oracle for the eC ′ ij (α) values. In Trial(F ), we want to find an F -tight flow f ′ on the extended network, witnessed by the potential π : B ∪ S ∪ G ∪ {t} → R. We may assume πt = 0. Let Pj = e−πj for j ∈ G and βi = eπi for i ∈ B and Sk ij = Pj if j(ij, k) ∈ F . ij = e−π(ij,k). For the k'th segment of ij, U k ij = βi if i(ij, k) ∈ F and Sk ij/Sk As for linear Fisher markets, if a component of F does not contain t, we can simply compute all potentials and flows as F is a spanning tree of linear edges in this component. For the component K with t ∈ K, let Tℓ be a component of K − t. F is a spanning tree of linear edges in Tℓ as well, therefore the ratio Pj/Pj ′ is uniquely defined for any j, j′ ∈ G∩ Tℓ. On the other hand, we must have Pj = pj, and we know that Pj∈G∩Tℓ bv by flow conservation. These determine the Pj = pj values, and thus all other βi and Sk ij values in the component as well. The support of the flow fij is a tree and hence it can also easily computed. The running time of Trial is again linear, ρT (n′, m′) = O(m′) = O(m). pj = −Pv∈Tℓ 28 Error(f, F ) can be implemented the same way as for the linear Fisher market. We shall define the values γ : G × G → R so that Pj ′ ≥ Pjγjj ′ must hold, and conversely, given Pj prices satisfying these conditions, we can define the βi and Sk ij values feasibly. Let γjj ′ = maxn U k′ ij ′ U k ij : i ∈ B, f o. j(ij, k), (ij, k)i, i(ij′ , k′), (ij′, k′)j′ ∈ EF Given these γjj ′ values, the γjj ′ values can be computed by the Floyd-Warshall algorithm and the optimal ∆ obtained by (17) as for the linear case. Finding the γjj ′ values can be done in O(m′) time, and the Floyd-Warshall algorithm runs in O(G3). This gives ρE(n′, m′) = O(m′ + G3) = O(m + n3). From Theorem 5.8, together with Remark 5.9, we obtain: Theorem 6.5. For an instance of Fisher's market with spending constraint utilities with n = B + G and m segments, the running time can be bounded by O(mn3 + m2(m + n log n) log m). It can be verified that the algorithm is strongly polynomial the same way as for the linear case. 7 Discussion We have given strongly polynomial algorithms for a class of minimum-cost flow problems with separable convex objectives. This gives the first strongly polynomial algorithms for quadratic convex cost functions and for Fisher's market with spending constraint utilities. For Fisher's market with linear utilities, we get the same complexity as in [30]. The bottleneck in complexity of all applications is the subroutine Trial. However, the exact value of errF (f ) is not needed: a constant approximation would also yield the same complexity bounds. Unfortunately, no such algorithm is known for the minimum cost-to-time ratio cycle problem that would have significantly better, strongly polynomial running time. Finding such an algorithm would immediately improve the running time for quadratic costs. A natural future direction could be to develop strongly polynomial algorithms for quadratic objectives and constraint matrices with bounded subdeterminants. This would be a counterpart of Tardos's result [36] for linear programs. Such an extension could be possible by extending our techniques to the setting of Hochbaum and Shantikumar [18]. The recent paper [39] shows that linear Fisher market, along with several extension, can be captured by a concave extension of the generalized flow model. A natural question is if there is any direct connection between the concave generalized flow model and the convex minimum cost flow model studied in this paper. Despite certain similarities, no reduction is known in any direction. Indeed, no such reduction is known even between the linear special cases, that is, generalized flows and minimum-cost flows. The perfect price discrimination model [11], and the Arrow-Debreu Nash-bargaining problem [38], are instances of the concave generalized flow model, but they are not known to be reducible to convex cost flows. On the other hand, the spending constraint utility model investigated in this paper is not known to be reducible to concave generalized flows. The algorithm in [39] is not strongly polynomial. Even for linear generalized flows, the first strongly polynomial algorithm was only given very recently [40]. One could try to extend this to a class of concave generalized flows in a similar manner as in the current paper, i.e. assuming certain oracles. This could lead to strongly polynomial algorithms for the market problems that fit into this model. 29 A related problem is finding a strongly polynomial algorithm for minimizing a separable convex objective over a submodular polyhedron. Fujishige [10] showed that for separable convex quadratic costs, this is essentially equivalent to submodular function minimization. Submodular utility al- location markets by Jain and Vazirani [21] also fall into this class, and are solvable in strongly polynomial time; see also Nagano [27]. Other strongly polynomially solvable special cases are given by Hochbaum and Hong [14]. A common generalization of this problem and ours is minimizing a separable convex objective over a submodular flow polyhedron. Weakly polynomial algorithms were given by Iwata [19] and by Iwata, McCormick and Shigeno [20]. One might try to develop strongly polynomial algorithms for some class of separable convex objectives; in particular, for separable convex quadratic functions. Acknowledgment The author is grateful to an anonymous referee for several suggestions that helped to improve the presentation. References [1] R. K. Ahuja, T. L. Magnanti, and J. B. Orlin. Network Flows: Theory, Algorithms, and Applications. Prentice-Hall, Inc., Upper Saddle River, New Jersey, feb 1993. [2] B. Birnbaum, N. R. Devanur, and L. Xiao. Distributed algorithms via gradient descent for Fisher markets. In Proceedings of ACM EC, pages 127–136, 2011. [3] D. Coppersmith and S. Winograd. Matrix multiplication via arithmetic progressions. Journal of Symbolic Computation, 9(3):251–280, 1990. [4] S. Cosares and D. S. Hochbaum. Strongly polynomial algorithms for the quadratic transporta- tion problem with a fixed number of sources. Mathematics of Operations Research, 19(1):94– 111, 1994. [5] N. R. Devanur, C. H. Papadimitriou, A. Saberi, and V. V. Vazirani. Market equilibrium via a primal–dual algorithm for a convex program. Journal of the ACM (JACM), 55(5):22, 2008. [6] J. Edmonds and R. M. Karp. Theoretical improvements in algorithmic efficiency for network flow problems. Journal of the ACM (JACM), 19(2):248–264, 1972. [7] E. Eisenberg and D. Gale. Consensus of subjective probabilities: The pari-mutuel method. The Annals of Mathematical Statistics, 30(1):165–168, 1959. [8] R. Floyd. Algorithm 97: shortest path. Communications of the ACM, 5(6):345, 1962. [9] M. L. Fredman and R. E. Tarjan. Fibonacci heaps and their uses in improved network opti- mization algorithms. Journal of the ACM (JACM), 34(3):596–615, 1987. [10] S. Fujishige. Submodular systems and related topics. Mathematical Programming at Oberwol- fach II, (22):113–131, 1984. [11] G. Goel and V. V. Vazirani. A perfect price discrimination market model with production, and a (rational) convex program for it. Mathematics of Operations Research, 36:762–782, 2011. 30 [12] F. Granot and J. Skorin-Kapov. Towards a strongly polynomial algorithm for strictly con- vex quadratic programs: An extension of Tardos' algorithm. Mathematical Programming, 46(1):225–236, 1990. [13] M. Grotschel, L. Lov´asz, and A. Schrijver. Geometric Algorithms and Combinatorial Opti- mizations. Springer-Verlag, 1993. [14] D. Hochbaum and S. Hong. About strongly polynomial time algorithms for quadratic opti- mization over submodular constraints. Mathematical Programming, 69(1):269–309, 1995. [15] D. Hochbaum and M. Queyranne. Minimizing a convex cost closure set. SIAM Journal on Discrete Mathematics, 16:192, 2003. [16] D. S. Hochbaum. Lower and upper bounds for the allocation problem and other nonlinear optimization problems. Mathematics of Operations Research, 19(2):390–409, 1994. [17] D. S. Hochbaum. Complexity and algorithms for nonlinear optimization problems. Annals of Operations Research, 153(1):257–296, 2007. [18] D. S. Hochbaum and J. G. Shanthikumar. Convex separable optimization is not much harder than linear optimization. Journal of the ACM (JACM), 37(4):843–862, 1990. [19] S. Iwata. A capacity scaling algorithm for convex cost submodular flows. Mathematical Pro- gramming, 76(2):299–308, 1997. [20] S. Iwata, S. McCormick, and M. Shigeno. Fast cycle canceling algorithms for minimum cost submodular flow. Combinatorica, 23(3):503–525, 2003. [21] K. Jain and V. V. Vazirani. Eisenberg-Gale markets: Algorithms and game-theoretic proper- ties. Games and Economic Behavior, 70(1):84–106, 2010. [22] A. V. Karzanov and S. T. McCormick. Polynomial methods for separable convex optimization in unimodular linear spaces with applications. SIAM J. Comput., 26(4):1245–1275, 1997. [23] N. Megiddo. Combinatorial optimization with rational objective functions. Mathematics of Operations Research, 4(4):414–424, 1979. [24] N. Megiddo. Applying parallel computation algorithms in the design of serial algorithms. Journal of the ACM (JACM), 30(4):852–865, 1983. [25] M. Minoux. A polynomial algorithm for minimum quadratic cost flow problems. European Journal of Operational Research, 18(3):377–387, 1984. [26] M. Minoux. Solving integer minimum cost flows with separable convex cost objective polyno- mially. Mathematical Programming Study, 25:237, 1985. [27] K. Nagano. On convex minimization over base polytopes. Integer Programming and Combi- natorial Optimization, pages 252–266, 2007. [28] N. Nisan, T. Roughgarden, E. Tardos, and V. Vazirani. Algorithmic Game Theory. Cambridge University Press New York, NY, USA, 2007. [29] J. B. Orlin. A faster strongly polynomial minimum cost flow algorithm. Operations Research, 41(2):338–350, 1993. 31 [30] J. B. Orlin. Improved algorithms for computing Fisher's market clearing prices. In Proceedings of the 42nd ACM Symposium on Theory of Computing (STOC), pages 291–300. ACM, 2010. [31] J. Renegar. On the worst-case arithmetic complexity of approximating zeros of polynomials. Journal of Complexity, 3(2):90–113, 1987. [32] A. Schrijver. Theory of Linear and Integer Programming. John Wiley & Sons, 1998. [33] V. I. Shmyrev. An algorithm for finding equilibrium in the linear exchange model with fixed budgets. Journal of Applied and Industrial Mathematics, 3(4):505–518, 2009. [34] A. Tamir. A strongly polynomial algorithm for minimum convex separable quadratic cost flow problems on series-parallel networks. Mathematical Programming, 59:117–132, 1993. [35] ´E. Tardos. A strongly polynomial minimum cost circulation algorithm. Combinatorica, 5(3):247–255, 1985. [36] ´E. Tardos. A strongly polynomial algorithm to solve combinatorial linear programs. Operations Research, 34(2):250–256, 1986. [37] V. V. Vazirani. Spending constraint utilities with applications to the adwords market. Math- ematics of Operations Research, 35(2):458–478, 2010. [38] V. V. Vazirani. The notion of a rational convex program, and an algorithm for the Arrow- Debreu Nash bargaining game. Journal of ACM (JACM), 59(2), 2012. [39] L. A. V´egh. Concave generalized flows with applications to market equilibria. Mathematics of Operations Research, 39(2):573–596, 2014. [40] L. A. V´egh. Strongly polynomial algorithm for generalized flow maximization. In Proceedings of the 46th ACM Symposium on Theory of Computing (STOC), 2014. Appendix In this Appendix we describe two variants of Dijkstra's algorithm that are used for the shortest path computations in our algorithm. This is an equivalent description of the well-known algorithm, see e.g. [1, Chapter 4.5]. The first, standard version is shown in Algorithm 5. We start from a cost function c on a digraph D = (V, A) and a potential vector π with cij − πj + πi ≥ 0 for every arc, and two designated subsets S and T . The set R is initialized as R = S, and denotes in every iteration the set of nodes that can be reached from S on a tight path, that is, all arcs of the path satisfying cij − πj + πi = 0. Every iteration increases the potential on V \ R until some new tight arcs enter. We terminate once R contains a node in T ; a shortest path between S and T can be recovered using the pointers pred(i). In our algorithm, this subroutine will be applied if Oracle 1(a) holds. In the ∆-phase, we apply it for the digraph EF ij(fij + ∆), and the potential π as in the algorithm. Note that if the initial π is rational, and all cij values are rational, the algorithm terminates with a π that is also rational. Oracle 1(a) guarantees that if fij and ∆ are rational numbers, then so is cij. f (∆) and the cost function cij = C ′ Algorithm 6 shows a multiplicative variant of the previous algorithm; they are identical after substituting cij = log γij and πi = log µi. This variant shall be applied under Oracle 1(b). We shall 32 assume that every eπi value is rational, and set µi = eπi, and γij = eC ′ ij (fij +∆). The assumption guarantees that if fij and ∆ are rational numbers, then so is γij. Consequently, the rationality of the eπi values is maintained during the computations. 33 Algorithm 5 Subroutine Shortest Paths INPUT A digraph D = (V, A), disjoint subsets S, T ⊆ V , a cost function c : A → R and a potential vector π : V → R with cij − πj + πi ≥ 0 for every ij ∈ A. OUTPUT A shortest path P between a node in S and a node in T and a π′ : V → R with cij − π′ j + π′ i ≥ 0 for every ij ∈ A, and equality on every arc of P . R ← S; for i ∈ S do pred(i) ← N U LL; while R ∩ T = ∅ do α ← min{cij − πj + πi : ij ∈ A, i ∈ R, j ∈ V \ R}; for j ∈ V \ R do πj ← πj + α; Z ← {j ∈ V \ R : ∃ij ∈ A, i ∈ R such that cij − πj + πi = 0}; for j ∈ Z do pred(j) ← i ∈ R such that ∃ij ∈ A : cij − πj + πi = 0; R ← R ∪ Z; π′ ← π; Algorithm 6 Subroutine Multiplicative Shortest Paths INPUT A digraph D = (V, A), disjoint subsets S, T ⊆ V , a cost function γ : A → R and a potential vector µ : V → R with γij ≥ 1 for every ij ∈ A. µi µj OUTPUT A shortest path P between a node in S and a node in T and a µ′ : V → R with γij µ′ i µ′ j ≥ 1 for every ij ∈ A, and equality on every arc of P . R ← S; for i ∈ S do pred(i) ← N U LL; while R ∩ T = ∅ do µi µj = 1}; = 1; µi µj µi µj : ij ∈ A, i ∈ R, j ∈ V \ R}; α ← min{γij for j ∈ V \ R do µj ← αµj; Z ← {j ∈ V \ R : ∃ij ∈ A, i ∈ R such that γij for j ∈ Z do pred(j) ← i ∈ R such that ∃ij ∈ A : γij R ← R ∪ Z; µ′ ← µ; 34 Table of notation and concepts f , EF Section Sec 2, after (⋆) Sec 2, (2) Sec 2.1, above (3)/(4) Sec 4.1, (6)/(8) Sec 4.1, (5) Sec 4.2, (12) Sec 2 Notation/concept mL, mN ρf (i), Ex(f ) Ef , Ef (∆) EF f (∆) F ∗ errF (f ) free/restricted arcs linear/nonlinear arcs Sec 2, after (⋆) end of Sec 4.1 linear acyclic arc set Sec 2, above (2) pseudoflow Sec 4.1, above (6) F -pseudoflow ∆-feasible Sec 2.1, (4) Sec 4.1, (9) (∆, F )-feasible Sec 4.1, (7) F -optimal F -tight Sec 4.2, (10) Description number of linear/nonlinear arcs net flow amount in node i/total excess residual graph/ ∆-residual graph F -residual graph/ (∆, F )-residual graph set of arcs tight in every optimal solution "error measure" 35
1807.05377
1
1807
2018-07-14T11:05:25
SAT encodings for sorting networks, single-exception sorting networks and $\epsilon-$halvers
[ "cs.DS" ]
Sorting networks are oblivious sorting algorithms with many practical applications and rich theoretical properties. Propositional encodings of sorting networks are a key tool for proving concrete bounds on the minimum number of comparators or depth (number of parallel steps) of sorting networks. In this paper, we present new SAT encodings that reduce the number of variables and clauses of the sorting constraint of optimality problems. Moreover, the proposed SAT encodings can be applied to a broader class of problems, such as the search of optimal single-exception sorting networks and $\epsilon-$halvers. We obtain optimality results for single-exception sorting networks on $n \le 10$ inputs.
cs.DS
cs
SAT encodings for sorting networks, single-exception sorting networks and ǫ−halvers.✩ Jos´e A. R. Fonollosa Department of Signal Theory and Communications, Universitat Polit`ecnica de Catalunya, Barcelona, Spain 8 1 0 2 l u J 4 1 ] S D . s c [ 1 v 7 7 3 5 0 . 7 0 8 1 : v i X r a Abstract Sorting networks are oblivious sorting algorithms with many practical applications and rich theoretical properties. Propositional encodings of sorting networks are a key tool for proving concrete bounds on the minimum number of comparators or depth (number of parallel steps) of sorting networks. In this paper, we present new SAT encodings that reduce the number of variables and clauses of the sorting constraint of optimality problems. Moreover, the proposed SAT encodings can be applied to a broader class of problems, such as the search of optimal single-exception sorting networks and ǫ−halvers. We obtain optimality results for single-exception sorting networks on n ≤ 10 inputs. 1. Introduction A sorting algorithm is data-independent or oblivious if the sequence of comparisons does not depend on the input list. Sorting networks are oblivious sorting algorithms with many practical applications and rich theoretical properties [14]. From the practical point of view, sorting networks are the usual choice for simple parallel implementations in both hardware and software such as Graphics Processing Units (GPUs). Moreover, sorting networks are also of interest for secure computing methods like secure multi-party com- putation, circuit garbling and homomorphic encryption [3]. Other applications include median filtering, switching circuits, and encoding cardinality constraints in propositional satisfiability problems (SAT)[1]. Interestingly, we use this cardinality constraint in [12] to obtain optimal sorting networks and here to search optimal single-exception sorting networks. From the theoretical point of view comparator networks can be studied using the combinatorial and algebraic properties of permutations [4, 10], as well as constrained boolean monotone circuits using the zero-one principle [14, p. 223]. In the usual representation, the n input values are fed into networks of n channels connected by comparators that swap unordered inputs from two channels. The sequence of data- independent comparisons can be parallelized grouping independent comparators in layers. The depth of a comparator network is the number of layers, i.e., the delay in a parallel implementation. The typical graphical representation of a comparator network is depicted in Figure 1. Figure 1: Comparator network of depth 3 with 5 comparators. SAT encodings of sorting networks has been recently used to obtain new optimal-size [9] and optimal- depth sorting networks [5, 11, 8], as well as joint size and depth optimality results [12] ✩Supported by the Spanish MINECO project TEC2015-69266-P (FEDER, UE) Email address: [email protected] (Jos´e A. R. Fonollosa) Preprint July 17, 2018 In this paper we propose new SAT encodings of sorting networks that assigns a variable to each possible input or output vector after each comparator. In this encoding framework, a sorting networks is a network in which the set of unsorted outputs is empty, or that sorts of all its inputs. Moreover, the propositional encoding based on the set of unsorted inputs can also be used to characterize networks that sorts all zero-one inputs (bit-strings) except one (called single-exception sorting networks) or merging networks. While the propositional encoding based on the set of unsorted outputs can be used to characterize perfect halvers and ǫ−halvers [2]. Single-exception sorting networks has been studied by Chung and Ravikumar [6, 7], and Parberry [15, 16] as the key component of the proof that the sorting network verification problem is coNP complete. In [16] Parberry conjectured that D1(n), the minimum-depth of an n−channel single-exception sorting network was equal to D(n), the minimum depth of a n−channel sorting network. We show that the conjecture is true for n = 4 and 6 ≤ n ≤ 10. However, D1(n) = D(n) − 1 for n = 5 and the trivial cases n = 2 and n = 3. We also study the minimum size of single-exception sorting networks. A (perfect) halver on n = 2m channels is a comparator network that split the input vector in 2 blocks. At the output, the m smallest inputs are in the first m channels and the m largest inputs in the other channels. Perfect halvers must have a depth greater than log2(m). However, there are approximate halvers (ǫ−halvers) of constant-depth (dependent on the approximation factor ǫ but not in the number of channels n). ǫ−halvers are important comparator networks because they are the basic blocks of the asymptotically optimal AKS sorting network [2] and more recent variants such as [13]. 2. Preliminaries A comparator network C is a set of channels connected by a sequence of comparators as illustrated in Figure 1. Channels are depicted as horizontal lines (with the first channel at the top). Each comparator (i,j) compares the input values (ini, inj) of the two connected channels (1 ≤ i < j ≤ n) and if necessary rearrange them such that outi = min(ini, inj) and outj = max(ini, inj). The sequence of comparators can be grouped in maximal sets of independent comparators (layers) whose output can be computed in parallel. The depth of a comparator network is the number of layers. A sorting network is a comparator network that sorts all input sequences. A key tool for the proof of correctness of sorting networks is the 0-1-principle [14]: if a sorting network for n channels sorts all 2n sequences of 0's and 1's, then it sorts every arbitrary sequence of values. Let C be a comparator network, x = (x1 . . . xn) ∈ {0, 1}n an input vector, and vk = (vk n) the i carried by channel i after layer k propagates through C 1 . . . vk output of the network after layer k. The value vk as follows. v0 i = xi, and for 0 < k ≤ d: j , vk−1 ) , vk−1 ) i i min(vk−1 max(vk−1 vk−1 i j if there is a comparator between channels i and j > i if there is a comparator between channels j and i > j otherwise vk i =  The output of the network for input x is C(x) = vd, and outputs(C) = (cid:8) C(x)(cid:12)(cid:12) x ∈ {0, 1}n (cid:9). The comparator network C is a sorting network if all elements of outputs(C) are sorted. A comparator network does not change the input values (the number of 1's and 0's). Hence, the minimum cardinality of outputs(C) in n + 1, and a comparator networks is a sorting network if and only if it achieves this cardinality. An ǫ−halver is a comparator network on n = 2m channels such that, for any k ≤ m, at most ǫk of the largest k inputs will be in the upper half of the output and at most ǫk of the smallest k inputs will be in the lower half of the output, where ǫ ≥ 0. 3. Propositional encodings for fixed-size comparator networks In this section we derive two new SAT encodings of interest for the optimal-size problem of sorting networks and other comparator networks. 2 A comparator network C = (c1 . . . cs) of size s on n channels is a sequence of s comparators represented i,j indicating if the kth by a set of Boolean variables C s comparator connects channels i and j, i.e., ck = (i, j). A comparator formed by a contiguous subsequence of the comparators in C is denoted as C a:b = (ca . . . cb) i,j(cid:12)(cid:12) 1 ≤ i < j ≤ n, 1 ≤ k ≤ s (cid:9), the value of gk n =(cid:8) gk 3.1. Validity encodings A valid network with s comparators has only one comparator for each k. We can use any one-hot encoding over gk i,j for each k. AtMostOneSize k(C s (¬gk i,j ∨ ¬gk l,m) AtLeastOneSizek(C s 1≤i<j≤n,i<l<m≤n n) = ^ n) = _1≤i<j≤n n) = ^1≤k≤n gk i,j ValidSize(C s AtMostOneSizek(C s n) ∧ AtLeastOneSizek(C s n) In the following subsections we present two alternative sorting constraints. The first one is based on encoding outputsk(C) =(cid:8) C1:k(x)(cid:12)(cid:12) x ∈ {0, 1}n (cid:9), the set of output vectors after the kth comparator. 3.2. Fixed-size forward encoding (SFWD) We encode each possible vector vk = (vk n) at the output of comparator k with a Boolean variable ok m, with 0 ≤ k ≤ s, 0 ≤ m < 2n, where m is the integer with binary representation vk, with vk 1 the least significant bit and vk n the most significant bit. Let the expression m = ci,j(w), with 0 ≤ m, w < 2n, denote that a comparator (i, j) transforms a vector with the binary representation of the integer w into the binary representation of the integer m. And m = sorted(w) that the binary representation of m is the sorted version of the binary representation of w. 1 . . . vk The set outputsk(C) is defined by the variables ok m indicating if the corresponding binary representation of m is an element of that set. We can now encode the relation between the vectors in outputsk(C) and the vectors at the output of the previous comparator, outputsk−1(C), as follows: FwdUpdate k m(C s ForwardSize(C s n) = ^1≤i<j≤n(cid:16)gk ^1≤k≤s,0≤m<2n n) = i,j → Fwd k i,j,m(cid:17) FwdUpdate k m(C s n) where Fwd k i,j,m =  m ∨ ok−1 w m ↔ ok−1 ok m ↔ ok−1 ok ¬ok m m if ∃w 6= m, such that m = ci,j (w) if m = ci,j(m) and ∄w 6= m, such that m = ci,j(w) if m 6= ci,j(m) and ∄w 6= m, such that m = ci,j(w) The FwdUpdate k m, and the ForwardSize equation includes the FwdUpdate constraints for all the vectors and comparators in the network. m constraint describes the impact of each comparator on the Boolean variable ok A sorting network for n channels with s comparators exists if and only if there is a solution in which outputs(C) = outputss(C) does not contain any unsorted vector: ϕf s (n, s) = ValidSize(C s n) ∧ ForwardSize(C s n) ∧ AllInputs n ∧ NoUnsortedOutputss n (1) with 3 AllInputs n = ^0≤m<2n o0 m NoUnsortedOutputss n = ^m6=sorted(m) ¬os m 3.3. Fixed-size backward encoding (SBCK) We can also analyze the behavior of a comparator network studying the set of inputs that are not sorted by the network, i.e., the set notsorted(C) = { x C(x) 6= sorted(x) }. The Boolean variable qk m is used in this case to indicate if the corresponding vector is an element of notsortedk(C) = { x C k+1:s(x) 6= sorted(x) }, the set of inputs that are not sorted by the last s − k comparators of the network. We can now relate the vectors in notsortedk−1(C) with the vectors in notsortedk(C) as follows: Bck k i,j,m = qk−1 m ↔ qk w, with w = ci,j(m) BckUpdate k m(C s BackwardSize (C s BckUpdate k m(C s n) i,j → Bck k i,j,m(cid:17) n) = ^1≤i<j≤n(cid:16)gk ^1≤k≤s,0≤m<2n n) = In this case, a sorting network for n channels with s comparators exists if and only if there is a solution in which all the (unsorted) inputs are sorted, i.e., if notsorted(C) = notsorted0(C) is empty: ϕb s(n, s) = ValidSize(C s n) ∧ BackwardSize (C s n) ∧ Outputss n ∧ NoUnsortedInputs n (2) with Outputss n = ^m6=sorted(m) qs m ∧ ^m=sorted(m) ¬qs m NoUnsortedInputs n = ^0≤m<2n ¬q0 m The backward encoding is also useful for single-exception sorting networks, since we can easily encode the single-exception constraint with any one-hot encoding of q0 m: AtMostOneUnsorted n = ^0≤m<w<2n AtLeastOneUnsorted n = _0≤m<2n q0 m (¬q0 m ∨ ¬q0 w) SingleUnsortedInput n =AtMostOneUnsorted n ∧ AtLeastOneUnsorted n The resulting encoding of fixed-size single-exception networks is: ϕ1 s(n, s) = ValidSize(C s n) ∧ BackwardSize (C s n) ∧ Outputss n ∧ SingleUnsortedInput n (3) 4. Propositional encodings for fixed-depth comparator networks In this section we adapt the previous results to derive SAT encodings for fixed-depth comparator net- works. We fix the number of layers to d, and the comparators are represented by a set of Boolean variables C d n =(cid:8) gk i,j(cid:12)(cid:12) 1 ≤ i < j ≤ n, 1 ≤ k ≤ d (cid:9). 4 4.1. Validity encodings In a valid network the comparators of each layer are independent, i.e., each channel may be used only once: AtMostOneDepthk i (C d min(i,j),max(i,j) ∨ ¬gk min(i,l),max(i,l)(cid:17) ValidDepth(C d AtMostOneDepth k i (C d n) n) = ^1≤i6=j6=l≤n(cid:16)¬gk n) = ^1≤k≤d,1≤i≤n 4.2. Fixed-depth forward encoding (DFWD) We divide each layer in n− 1 sublayers with at most one comparator in each of them. Then, we apply the forward coding of subsection 3.2 to each sublayer. Each possible binary vector at the output of the sublayer i of layer k (outputsk,i(C)) is represented with a Boolean variable pk,i m , with 0 ≤ k ≤ d, 1 ≤ i < n, 0 ≤ m < 2n, and we propagate pk,i m sublayer by sublayer. For each layer k, the sublayer i contains the comparator connecting channel i with another channel j > i, or is empty if there is not such comparator in that layer. Sublayer k,i(C d FwdSublayerUpdate k,i m (C d gk i,j n) = _i<j≤n n) =(cid:16)¬Sublayer k,i(C d ForwardDepth(C d n) = 1≤k≤d,1≤i<n,0≤m<2n ^ n) → Fwd0 k,i m (cid:17) ∧ ^i<j≤n(cid:16)gk i,j → Fwd k,i j,m(cid:17) FwdSublayerUpdate k,i m (C d n) where and Fwd k,i j,m =   Fwd0 k,i m =(pk,i m ↔ pk−1,n−1 m ↔ pk,i−1 pk,i m m if i = 1 otherwise ∨ pk−1,n−1 w m m m ↔ pk−1,n−1 pk,i m ↔ pk−1,n−1 pk,i m ↔ pk,i−1 pk,i m ↔ pk,i−1 pk,i ¬pk,i m m m ∨ pk,i−1 w if i = 1 and ∃w 6= m, such that m = ci,j(w) if i = 1 and m = ci,j(m) and ∄w 6= m, such that m = ci,j(w) if i > 1 and ∃w 6= m, such that m = ci,j(w) if i > 1 and m = ci,j(m) and ∄w 6= m, such that m = ci,j(w) if m 6= ci,j(m) and ∄w6=m, such that m = ci,j(w) A sorting network for n channels with d layers exists if and only if there is a solution in which outputs(C) = outputsd,n−1(C) does not contain any unsorted vector: ϕf d (n, d) = ValidDepth(C d n) ∧ ForwardDepth(C d n) ∧ AllInputs n ∧ NoUnsortedOutputsd n (4) with AllInputs n = ^0≤m<2n p0,n−1 m NoUnsortedOutputsd n = ^m6=sorted(m) ¬pd,n−1 m In this encoding framework, we can easily consider other comparator networks defined in terms of valid outputs such as halvers and ǫ−halvers. We just need to replace the m 6= sorted(m) index selection in the NoUnsortedOutputsd n equation with a generic invalid(m) that forbids invalid outputs. 5 4.3. Fixed-depth backward encoding (DBCK) We can use the same sublayers idea to derive the fixed-depth version of the backward encoding from the fixed-size backward equations. The Boolean variable rk,i m , with 0 ≤ k ≤ d, 1 ≤ i < n, 0 ≤ m < 2n indicates if the binary representation of m is an element of notsortedk,i(C), the set of vectors that are not sorted by the sequence of comparators after the sublayer i of layer k. The equations that relate each sublayer are: BckSublayerUpdate k,i m (C d n) =(cid:16)¬Sublayer k,i(C d n) → Bck0 k,i m (cid:17) ∧ ^i<j≤n(cid:16)gk i,j → Bck k,i j,m(cid:17) BackwardDepth (C d n) = 1≤k≤s,1≤i<n,0≤m<2n ^ BckSublayerUpdate k,i m (C d n) where and Bck0 k,i m =(rk−1,n−1 m rk,i−1 m ↔ rk,i m ↔ rk,i m if i = 1 otherwise Bck k,i j,m =(rk−1,n−1 m rk,i−1 m ↔ rk,i w with w = ci,j (m) ↔ rk,i w with w = ci,j(m) if i = 1 otherwise A fixed-depth sorting network for n channels with d layers exists if and only if there is a solution in which all the (unsorted) inputs are sorted, i.e., if notsorted(C) = notsorted0,n−1(C) is empty: ϕb d(n, d) = ValidDepth(C d n) ∧ BackwardDepth (C d n) ∧ Outputsd n ∧ NoUnsortedInputs n with Outputs d n = ^m6=sorted(m) rd,n−1 m ∧ ^m=sorted(m) ¬rd,n−1 m NoUnsortedInputs n = ^0≤m<2n ¬r0,n−1 m For single-exception fixed-depth sorting networks, we replace NoUnsortedInputsn with Single n: AtMostOneUnsorted n = ^0≤m<w<2n AtLeastOneUnsorted n = _0≤m<2n r0,n−1 m (¬r0,n−1 m ∨ ¬r0,n−1 w ) Single n =AtMostOneUnsorted n ∧ AtLeastOneUnsorted n to obtain: 5. Results ϕ1 d(n, d) = ValidDepth(C d n) ∧ BackwardDepth(C d n) ∧ Outputsd n ∧ Single n (5) (6) In this section, we apply the new family of SAT encodings to three different optimality problems: optimal- size sorting networks, ǫ−halvers and single-exception sorting networks. All the SAT tests are performed with the single-threaded version of the Glucose SAT solver 1. The software used for these experiments is available at github: https://github.com/jarfo/sort. 1http://www.labri.fr/perso/lsimon/glucose 6 5.1. Comparison of fixed-size encodings of sorting networks For fixed-size formulations, the new forward and backward encodings for the sorting constraint still have the expected exponential size, but they are significantly smaller that the previously proposed encodings [9] based on boolean circuit propagation (SCIR). The plain SCIR sorting constraint requires ns2n variables, while the proposed SFWD and SBCK sorting constraints need only s2n variables. In this first experiment we compare the total number of clauses and variables, including the shared validity constraints, and the solving time of SAT encodings for the optimal-size sorting network problem. encoding SCIR SFWD SBCK optimal-size sorting network (SAT) SAT time s #clauses #vars 40 6510 2128 14 6 2172 108736 37394 78763 16 16 16 smaller network (UNSAT) s′ #clauses #vars 6048 15 15 1979 2023 15 101361 34795 73496 SAT time 80127 2591 4339 Table 1: SAT-solving size and time for size-s sorting networks on n = 7 channels. SAT-solving time in seconds (single-threaded glucose solver ). Table 1 clearly shows the important solving-time reduction for optimal-size sorting network problems. The proposed SFWD encoding is 30 times faster that the SCIR encoding proving that there is not sorting network on 7 channels with s ≤ 15 comparators. However, the proposed encodings are still insufficient to give new optimality results with current SAT solvers, and they cannot easily take advantage of fixed network prefixes as the SCIR encoding. 5.2. Optimal ǫ−halvers In this experiment we show two examples of the application of the fixed-depth forward encoding (DFWD) to the design of small optimal-depth ǫ−halvers. In the first case we obtain that the optimal depth of a 1/4−halver for n = 12 channels is 4. Including additional size constraints [12], we can also find that the optimal number of comparators for that depth is 17 (Figure 2). Figure 2: An optimal depth-size 1/4−halver on 12 channels with 4 layers and 17 comparators. In the second case we include additional validity constraints to consider only comparators of channels on the upper half with channels on the lower half. Figure 3 show the resulting 1/4−halver on 18 channels. 7 Figure 3: A 1/4−halver on 18 channels with 4 layers and 36 comparators 5.3. Single-exception sorting networks In this experiment we compare single-exception sorting networks with sorting networks in terms of minimum depth and size. Using the fixed-depth backward encoding (DBCK) of single-exception sorting networks ϕ1 d(n, d) we can obtain optimality results for n ≤ 10 in a few minutes with current state-of-the-art SAT solvers. Table 2 compares the optimal depth of single-exception sorting networks D1(n) and sorting networks D(n). Both optimal depths are equal for n = 4 and 6 ≤ n ≤ 10, but D1(n) = D(n) − 1 for n = 5 and for the trivial cases n = 2 and n = 3. n D1(n) D(n) 2 0 1 3 2 3 4 3 3 5 4 5 6 5 5 7 6 6 8 6 6 9 7 7 10 7 7 Table 2: Optimal depth of single-exception sorting networks D1(n) and sorting networks D(n) We also study the size, and joint size and depth optimization of single-exception sorting networks using the same DBCK encoding with additional size constraints [12]. The following tables compare the obtained results for single-exception sorting networks with the previously known results for sorting networks. Note that we can always add a single comparator to a single-exception sorting network to obtain a sorting network. Hence, D(n) ≤ D1(n) + 1 and S(n) ≤ S1(n) + 1. n 2 S1(n) ≤ 0 S1(n) ≥ 0 1 S(n) 3 2 2 3 4 5 5 5 5 8 8 9 6 12 12 12 7 15 15 16 8 20 18 19 9 24 24 25 10 29 28 29 Table 3: Optimal size of single-exception sorting networks S1(n) and sorting networks S(n) 8 n (S, D)1(n) (S, D)(n) 2 (0,0) (1,1) 3 (2,2) (3,3) 4 (5,3) (5,3) 5 (8,4) (9,5) 6 (12,5) (12,5) 7 (15,6) (16,6) 8 (20,6) (19,6) 9 (24,7) (25,7) 10 (29,8),(31,7) (29,8),(31,7) Table 4: Optimal (size,depth) combinations of single-exception sorting networks (S, D)1(n) and sorting networks (S, D)(n) for n ≤ 10. 6. Conclusions This paper presents new propositional encodings for the design of optimal comparator networks. In the proposed SAT encodings Boolean variables represent the elements of the set of output vectors after each comparator (or the set of unsorted input vectors), while the clauses encode the effect of each comparator on those sets. The resulting encodings can be easily applied to sorting networks and other comparator networks defined in terms of the set of invalid output vectors such as ǫ−halvers, or the number of unsorted inputs such as single-exception sorting networks. The experiments show that the proposed encodings can be used to obtain efficient SAT encodings for sorting networks. We also present results of their application to obtain concrete bounds of small ǫ−halvers and single-exception sorting networks. References References [1] Ignasi Ab´ıo, Robert Nieuwenhuis, Albert Oliveras, and Enric Rodr´ıguez-Carbonell. A parametric approach for smaller and better encodings of cardinality constraints. In International Conference on Principles and Practice of Constraint Programming, pages 80–96. Springer, 2013. [2] M. Ajtai, J. Koml´os, and E. Szemer´edi. Sorting in c log n parallel steps. Combinatorica, 3(1):1–19, January 1983. [3] Dan Bogdanov, Sven Laur, and Riivo Talviste. A practical analysis of oblivious sorting algorithms for secure multi-party In Karin Bernsmed and Simone Fischer-Hubner, editors, Secure IT Systems, pages 59–74, Cham, 2014. computation. Springer International Publishing. [4] N.G. De Bruijn. Sorting by means of swappings. Discrete Mathematics, 9(4):333 – 339, 1974. [5] Daniel Bundala, Michael Codish, Lu´ıs Cruz-Filipe, Peter Schneider-Kamp, and Jakub Z´avodn´y. Optimal-depth sorting networks. CoRR, abs/1412.5302, 2014. [6] M Chung and B Ravikumar. On the size of test sets for sorting and related problems. In Proc. 1987 International Conference on Parallel Processing, 1987. [7] Moon Jung Chung and B. Ravikumar. Strong nondeterministic turing reduction-a technique for proving intractability. Journal of Computer and System Sciences, 39(1):2 – 20, 1989. [8] Michael Codish, Lu´ıs Cruz-Filipe, Thorsten Ehlers, Mike Muller, and Peter Schneider-Kamp. Sorting networks: To the end and back again. Journal of Computer and System Sciences, 2016. [9] Michael Codish, Lu´ıs Cruz-Filipe, Michael Frank, and Peter Schneider-Kamp. Sorting nine inputs requires twenty-five comparisons. Journal of Computer and System Sciences, 82(3):551–563, 2016. [10] N.G. de Bruijn. Sorting arrays by means of swaps. Indagationes Mathematicae (Proceedings), 86(2):125 – 132, 1983. [11] Thorsten Ehlers and Mike Muller. New bounds on optimal sorting networks. In Conference on Computability in Europe, pages 167–176. Springer, 2015. [12] J. A. R. Fonollosa. Joint Size and Depth Optimization of Sorting Networks. ArXiv e-prints, June 2018. [13] Michael T Goodrich. Zig-zag sort: A simple deterministic data-oblivious sorting algorithm running in o (n log n) time. In Proceedings of the forty-sixth annual ACM symposium on Theory of computing, pages 684–693. ACM, 2014. [14] Donald E. Knuth. The Art of Computer Programming, Volume 3: (2Nd Ed.) Sorting and Searching. Addison Wesley Longman Publishing Co., Inc., Redwood City, CA, USA, 1998. [15] Ian Parberry. Single-exception sorting networks and the computational complexity of optimal sorting network verification. Mathematical systems theory, 23(1):81–93, 1990. [16] Ian Parberry. On the computational complexity of optimal sorting network verification. In International Conference on Parallel Architectures and Languages Europe, pages 252–269. Springer, 1991. 9 Figure 4: Optimal single exception sorting networks on 3, 4, and 5 channels Figure 5: Optimal single exception sorting network on 6 channels with 5 layers and 12 comparators Figure 6: Optimal single exception sorting network on 7 channels with 6 layers and 15 comparators Figure 7: Optimal single exception sorting network on 8 channels with 6 layers and 20 comparators Figure 8: Optimal single exception sorting network on 9 channels with 7 layers and 24 comparators 10 Figure 9: Optimal single exception sorting network on 10 channels with 8 layers and 29 comparators Figure 10: Optimal single exception sorting network on 10 channels with 7 layers and 31 comparators 11
1502.06370
1
1502
2015-02-23T10:18:16
A framework for space-efficient string kernels
[ "cs.DS" ]
String kernels are typically used to compare genome-scale sequences whose length makes alignment impractical, yet their computation is based on data structures that are either space-inefficient, or incur large slowdowns. We show that a number of exact string kernels, like the $k$-mer kernel, the substrings kernels, a number of length-weighted kernels, the minimal absent words kernel, and kernels with Markovian corrections, can all be computed in $O(nd)$ time and in $o(n)$ bits of space in addition to the input, using just a $\mathtt{rangeDistinct}$ data structure on the Burrows-Wheeler transform of the input strings, which takes $O(d)$ time per element in its output. The same bounds hold for a number of measures of compositional complexity based on multiple value of $k$, like the $k$-mer profile and the $k$-th order empirical entropy, and for calibrating the value of $k$ using the data.
cs.DS
cs
A framework for space-efficient string kernels Djamal Belazzougui1,2 and Fabio Cunial1,2 1Department of Computer Science, University of Helsinki, Finland.∗ 2Helsinki Institute for Information Technology, Finland. August 7, 2018 Abstract String kernels are typically used to compare genome-scale sequences whose length makes alignment impractical, yet their computation is based on data structures that are either space-inefficient, or incur large slowdowns. We show that a number of exact string kernels, like the k-mer kernel, the substrings ker- nels, a number of length-weighted kernels, the minimal absent words kernel, and kernels with Markovian corrections, can all be computed in O(nd) time and in o(n) bits of space in addition to the input, using just a rangeDistinct data structure on the Burrows-Wheeler transform of the input strings, which takes O(d) time per element in its output. The same bounds hold for a number of measures of compositional complexity based on multiple value of k, like the k-mer profile and the k-th order empirical entropy, and for calibrating the value of k using the data. 1 Introduction Given two strings T 1 and T 2, a kernel is a function that simultaneously converts T 1 and T 2 into vectors T1 and T2 in Rn for some n > 0, and computes a similarity or a distance measure between T1 and T2, without building and storing Ti explicitly [14]. Kernels are often the method of choice for comparing extremely long strings, like genomes, read sets, and metagenomic samples, whose size makes alignment infeasible, yet their computation is typically based on space-inefficient data structures, like (truncated) suffix trees, or on space-efficient data structures with large slowdowns, like compressed suffix trees (see e.g. [1, 9] and references therein). The (possibly infinite) dimensions of Ti are, for example, all strings of a specific family on the alphabet of T 1 and T 2, and the value assigned to vector Ti along dimension W corresponds to the number of occurrences of string W in T i, often rescaled and corrected in domain-specific ways. Ti is often called composition vector, and a large number of its components can be zero in practice. In this paper we focus on space- and time-efficient algorithms for computing the cosine of the angle between two composition vectors T1 and T2, i.e. on computing the kernel κ(T1, T2) = N/√D1D2 ∈ [−1..1], where N = PW T1[W ]T2[W ] and Di = PW Ti[W ]2. This measure of similarity can be converted into a distance d(T1, T2) = (1 − κ(T1, T2))/2 ∈ [0..1], and the algorithms we describe can be applied to compute norms of vector T1−T2, like the p-norm and the infinity norm. When T1 and T2 are bitvectors, we are more interested in interpreting them as sets and in computing the Jaccard distance J(T1, T2) = T1 ∧ T2/T1 ∨ T2 = T1 ∧ T2/(T1 + T2 + T1 ∧ T2), where ∧ and ∨ are the bitwise AND and OR operators, and where · measures the number of ones in a bitvector. Given a data structure that supports rangeDistinct queries on the Burrows-Wheeler transform of each string in input, we show that a number of popular string kernels, like the k-mer kernel, the substrings kernels, a number of length-weighted kernels, the minimal absent words kernel, and kernels with Markovian ∗This work was partially supported by Academy of Finland under grant 250345 (Center of Excellence in Cancer Genetics Research). 1 corrections, can all be computed in O(nd) time and in o(n) bits of space in addition to the input, all in a single pass over the BWTs of the input strings, where d is the time taken by the rangeDistinct query per element in its output. The same bounds hold for computing a number of measures of compositional complexity for multiple values of k at the same time, like the k-mer profile and the k-th order empirical entropy, and for choosing the value of k used in k-mer kernels from the data. All these algorithms become O(n) using the rangeDistinct data structure described in [4], and concatenating this setup to the BWT construction algorithm described in [3], we can compute all such kernels and complexity measures from the input strings in randomized O(n) time and in O(n log σ) bits of space in addition to the input. Finally, we show that measures of expectation based on Markov models are related to the left and right extensions of maximal repeats. 2 Preliminaries T (W ) the set of characters {a ∈ [0..σ] : fT (aW ) > 0} and by Σr 2.1 Strings Let Σ = [1..σ] be an integer alphabet, let # = 0, #1 = −1 and #2 = −2 be distinct separators not in Σ, and let T = [1..σ]n−1# be a string. We assume σ ∈ o(√n/ log n) throughout the paper. A k-mer is any string W ∈ [1..σ] of length k > 0. We denote by fT (W ) the number of (possibly overlapping) occurrences of a string W in the circular version of T , and we use the shorthand pT (W ) = fT (W )/(n − W) to denote an approximation of the empirical probability of observing W in T , assuming that all positions of T except the last W ones are equally probable starting positions for W . A repeat W is a string that satisfies fT (W ) > 1. We denote by Σℓ T (W ) the set of characters {b ∈ [0..σ] : fT (W b) > 0}. A repeat W is right-maximal (respectively, left-maximal ) iff Σr T (W ) > 1 (respectively, iff Σℓ T (W ) > 1). It is well known that T can have at most n− 1 right-maximal substrings and at most n−1 left-maximal substrings. A maximal repeat of T is a repeat that is both left- and right-maximal. For reasons of space we assume the reader to be familiar with the notion of suffix tree STT of a string T , and with the notion of generalized suffix tree of two strings, which we do not define here. We denote by ℓ(v) the string label of a node v in a suffix tree. It is well known that a substring W of T is right-maximal iff W = ℓ(v) for some internal node v of STT . We assume the reader to be familiar with the notion of suffix link connecting a node v with ℓ(v) = aW for some a ∈ [0..σ] to a node w with ℓ(w) = W : we say that w = suffixLink(v) in this case. Here we just recall that suffix links and internal nodes of STT form a tree, called the suffix-link tree of T and denoted by SLTT , and that inverting the direction of all suffix links yields the so-called explicit Weiner links. Given an internal node v and a symbol a ∈ [0..σ], it might happen that string aℓ(v) does occur in T , but that it is not right-maximal, i.e. it is not the label of any internal node of STT : all such left extensions of internal nodes that end in the middle of an edge are called implicit Weiner links. An internal node v of STT can have more than one outgoing Weiner link, and all such Weiner links have distinct labels: in this case, ℓ(v) is a maximal repeat. It is known that the number of suffix links (or, equivalently, of explicit Weiner links) is upper-bounded by 2n − 2, and that the number of implicit Weiner links can be upper-bounded by 2n − 2 as well. 2.2 Enumerating right-maximal substrings and maximal repeats For reasons of space we assume the reader to be familiar with the notion and uses of the Burrows-Wheeler transform of T , including the C array, the rank function, and backward searching. In this paper we use BWTT to denote the BWT of T , we use range(W ) = [sp(W )..ep(W )] to denote the lexicographic interval of a string W in a BWT that is implicit from the context, and we use Σi,j to denote the set of distinct characters that occur inside interval [i..j] of a string that is implicit from the context. We also denote by rangeDistinct(i, j) the function that returns the set of tuples {(c, rank(c, pc), rank(c, qc)) : c ∈ Σi,j}, where pc and qc are the first and the last occurrence of c inside interval [i..j], respectively. Here we focus on a specific application of BWTT : enumerating all the right-maximal substrings of T , or equivalently all the internal nodes of STT . In particular, we use the algorithm described in [3] (Section 4.1), which we sketch 2 here for completeness. If aiW is right-maximal, i.e. Given a substring W of T , let b1 < b2 < ··· < bk be the sorted sequence of all the distinct char- acters in Σr(W ), and let a1, a2, . . . , ah be the list of all the characters in Σℓ(W ), not necessarily sorted. Assume that we represent a substring W of T as a pair repr(W ) = (chars[1..k], first[1..k + 1]), where chars[i] = bi, range(W bi) = [first[i]..first[i + 1] − 1] for i ∈ [1..k], and range() refers to BWTT . Note that range(W ) = [first[1]..first[k + 1] − 1], since it coincides with the concatenation of the intervals of the right extensions of W in lexicographic order. If W is not right-maximal, array chars in repr(W ) has length one. Given a data structure that supports rangeDistinct queries on BWTT , and given the C array of T , there is an algorithm that converts repr(W ) into the sequence a1, . . . , ah and into the corresponding sequence repr(a1W ), . . . , repr(ahW ), in O(de) time and O(σ2 log n) bits of space in addition to the input and the output [3], where d is the time taken by the rangeDistinct operation per element in its output, and e is the number of distinct strings aiW bj that occur in the circular version of T , where i ∈ [1..h] and j ∈ [1..k]. We encapsulate this algorithm into a function that we call extendLeft. if array chars in repr(aiW ) has length greater than one, we push pair (repr(aiW ),W + 1) onto a stack S. In the next iteration we pop the representation of a string from the stack and we repeat the process, until the stack itself becomes empty. This process is equivalent to following all the explicit Weiner links from the node v of STT with ℓ(v) = W , not necessarily in lexicographic order. Thus, running the algorithm from a stack initialized with repr(ε) is equivalent to performing a depth-first (but not necessarily a preorder) traversal of the suffix-link tree of T , which guarantees to enumerate all the right-maximal substrings of T . Every operation performed by the algorithm can be charged to a distinct node or Weiner link of STT , thus the algorithm runs in O(nd) time. The depth of the stack is O(log n) rather than O(n), since at every iteration we push the pair (repr(aiW ),aiW) with largest range(aiW ) first. Every suffix-link tree level in the stack contains at most σ pairs, and each pair takes at most σ log n bits of space, thus the total space used by the stack is O(σ2 log2 n) bits. The following theorem follows from our assumption that σ ∈ o(√n/ log n): Theorem 1 ([3]). Let T ∈ [1..σ]n−1# be a string. Given a data structure that supports rangeDistinct queries on BWTT , we can enumerate all the right-maximal substrings W of T , and for each of them we can return W, repr(W ), the sequence a1, a2, . . . , ah of all characters in Σℓ T (W ) (not necessarily sorted), and the sequence repr(a1W ), . . . , repr(ahW ), in O(nd) time and in o(n) bits of space in addition to the input and the output, where d is the time taken by the rangeDistinct operation per element in its output. Theorem 1 does not specify the order in which the right-maximal substrings must be enumerated, nor the order in which the left extensions of a right-maximal substring must be returned. The algorithm we just described can be adapted to return all the maximal repeats of T , with the same bounds, by outputting a right-maximal string W iff rangeDistinct(sp(W ), ep(W )) > 1. A version of the same algorithm can also enumerate all the internal nodes of the generalized suffix tree of two string T 1 and T 2, using BWTT 1 and BWTT 2 : in this case, a string W is represented as a quadruple repr′(W ) = (chars1[1..k1], first1[1..k1 + 1], chars2[1..k2], first2[1..k2 + 1]), and we assume that firsti[1] = 0 iff W does not occur in T i. We call extendLeft′ the function that maps repr′(W ) to the list of its left extensions repr′(aiW ). Theorem 2 ([3]). Let T 1 ∈ [1..σ]n1−1#1 and T 2 ∈ [1..σ]n2−1#2 be two strings. Given two data struc- tures that support rangeDistinct queries on BWTT 1 and on BWTT 2 , respectively, we can enumerate all the right-maximal substrings W of T = T 1T 2, and for each of them we can return W, repr′(W ), the sequence a1, a2, . . . , ah of all characters in Σℓ in O(nd) time and in o(n) bits of space in addition to the input and the output, where n = n1 + n2 and d is the time taken by the rangeDistinct operation per element in its output. T 1T 2 (W ) (not necessarily sorted), and the sequence repr′(a1W ), . . . , repr′(ahW ), For reasons of space, we assume throughout the paper that d is the time per element in the output of a rangeDistinct data structure that is implicit from the context. We also replace T i by i in subscripts, or we waive subscripts completely whenever they are clear from the context. 3 3 Kernels and complexity measures on k-mers Given a string T ∈ [1..σ]n−1# and a length k > 0, let vector Tk = [1..σk] be such that Tk[W ] = fT (W ) for every W ∈ [1..σ]k. The k-mer complexity Ck(T ) of string T is the number of nonzero components of Tk. The k-mer kernel of two strings T 1 and T 2 is κ(T1 k). Recall that Theorem 1 and 2 enumerate all nodes of a suffix tree in no specific order. In this section we describe algorithms to compute Ck(T ) and κ(T1 k, T2 k) in a way that does not depend on the order in which the nodes of a suffix tree are enumerated: we can thus implement such algorithms on top of Theorem 1 and 2. The main idea behind our approach is a telescoping strategy that works by adding and subtracting terms in a sum, as described below: Theorem 3. Let T ∈ [1..σ]n−1# be a string. Given an integer k and a data structure that supports rangeDistinct queries on BWTT , we can compute Ck(T ) in O(nd) time and in o(n) bits of space in addition to the input. k, T2 Proof. A k-mer of T can either be the label of a node of STT , or it could end in the middle of an edge (u, v) of ST. In the latter case, we assume that the k-mer is represented by its locus v, which might be a leaf. Let Ck(T ) be initialized to n − k, i.e. to the number of leaves that correspond to suffixes of T of length at least k + 1. We enumerate the internal nodes of ST using Theorem 1, and every time we enumerate a node v we proceed as follows: if ℓ(v) < k we leave Ck(T ) unaltered, otherwise we increment Ck(T ) by one and we decrement Ck(T ) by the number of children of v in ST, which is the length of array chars in repr(ℓ(v)). In this way, every internal node v of ST that is located at string depth at least k and that is not the locus of a k-mer is both added to Ck(T ) (when the algorithm visits v) and subtracted from Ck(T ) (when the algorithm visits parent(v)). Leaves at depth at least k + 1 that are not the locus of a k-mer are added by the initialization of Ck(T ), and they are subtracted during the enumeration. Conversely, every locus v of a k-mer of T (including leaves) is just added to Ck(T ), since ℓ(parent(v)) < k. We can apply the same telescoping strategy to compute κ(T1 k, T2 k): Theorem 4. Let T 1 ∈ [1..σ]n1−1#1 and T 2 ∈ [1..σ]n2−1#2 be strings. Given an integer k and two data structures that support rangeDistinct queries on BWTT 1 and on BWTT 2 , respectively, we can compute κ(T1 k) in O(nd) time and in o(n) bits of space in addition to the input, where n = n1 + n2. k, T2 k, T2 k[W ]T2 k) = N/√D1D2, where N = PW T1 k[W ], Di = PW Ti k[W ]2, and W ∈ Proof. Recall that κ(T1 [1..σ]k. We initially set N = 0 and Di = ni − k, since these are the contributions of all the leaves at depth at least k + 1 in the generalized suffix tree of T 1 and T 2. Then, we enumerate every internal node u of the generalized suffix tree, using Theorem 2: if ℓ(u) < k we keep all variables unchanged, otherwise we set N to N + f1(ℓ(u)) · f2(ℓ(u)) − Pv f1(ℓ(v)) · f2(ℓ(v)) and we set Di to Di + fi(ℓ(u))2 − Pv fi(ℓ(v))2, where v ranges over all children of u in the generalized suffix tree. Clearly fi(ℓ(u)) = firsti[ki + 1]− firsti[1] where ki is the size of array charsi in repr′(ℓ(u)), and fi(ℓ(v)) = fi(ℓ(u)bj) = firsti[j + 1] − firsti[j] for some j ∈ [1..ki]. In analogy to Lemma 3, the contribution of the loci of the distinct k-mers of T 1, of T 2, or of both, is added to the three temporary variables and never subtracted, while the contribution of every other node u at depth at least k in the generalized suffix tree is both added (when the algorithm visits u, or when N and Di are initialized) and subtracted (when the algorithm visits parent(u)). An even more specific notion of compositional complexity is Ck,f (T ), the number of distinct k-mers that occur exactly f times in T . In the k-mer profiling problem [6, 7] we are given a string T , an interval [k1..k2] of lengths and an interval [f1..f2] of frequencies, and we are asked to compute the matrix profile[k1..k2, f1..f2] defined as follows: profile[i, j] = Ci,j(T ) if j < f2, and profile[i, j] = Ph≥j Ci,h(T ) if j = f2. Note that column j of profile can have nonzero cells only if fj is the frequency of some internal node of STT . In practice profile is often computed by running a k-mer extraction algorithm k2 − k1 + 1 times, and by scanning the output of all such runs (see e.g. [6] and references therein). The following lemma shows that we can compute profile in just one pass over the BWT of the input string, and in linear time in the size of profile: 4 Theorem 5. Let T ∈ [1..σ]n−1# be a string. Given ranges [k1..k2] and [f1..f2], and given a data structure that supports rangeDistinct queries on BWTT , we can compute matrix profile[k1..k2, f1..f2] in O(nd + (k2 − k1)(f2 − f1)) time and in o(n) bits of space in addition to the input and the output. Proof. We use Theorem 1 again. Assume that, for every internal node u of STT with string depth at least k1 and with frequency at least f1, and for every k ∈ [k1.. min{ℓ(v), k2}], we increment profile[k, min{f (u), f2}] by one and we decrement profile[k, min{f (v), f2}] by one for every child v of u in ST such that f (v) ≥ f1. This would take O(n2) total updates to profile. However, we can perform all of these updates in batch, as follows: for every node u of ST with f (u) ≥ f1 and with ℓ(u) ≥ k1, we just increment profile[min{ℓ(u), k2}, min{f (u), f2}] by one, and we just decrement profile[min{ℓ(u), k2}, min{f (v), f2}] by one for every child v of u in ST such that f (v) ≥ f1. After having traversed all the internal nodes of ST, we scan profile as follows: for every j ∈ [f1..f2], we traverse all values of i in the decreasing order k2− 1, . . . , k1, and we set profile[i, j] = profile[i, j]+ profile[i + 1, j]. If f1 = 1, at the end of this process the first column of profile contains negative numbers, since Theorem 1 does not enumerate the leaves of ST. Thus, before returning, we add to profile[i, 1] the number of leaves with string depth at least ki + 1, i.e. value n − ki, for all i ∈ [k1..k2]. A similar algorithm allows computing κ(T1 k) for all k in a user-specified range [k1..k2] in O(nd+k2−k1) time. Matrix profile can be used to determine a range of values of k to be used in k-mer kernels. The smallest number in this range is typically the value of k that maximizes the number of distinct k-mers that occur at least twice in T [15]. The largest number in the range is typically determined using some measure of expectation: we cover this computation in Section 5. k, T2 A related notion of compositional complexity is the k-th order empirical entropy of T , defined as Hk(T ) = (1/T) · PW Pa∈Σr(W ) fT (W a) · log(fT (W )/fT (W a)), where W ranges over all strings in [1..σ]k. Clearly only the internal nodes of STT contribute to some Hk(T ) [9], thus our methods allow computing Hk(T ) for a user-specified range of lengths [k1..k2] in O(nd) time, using just one pass over BWTT . 4 Kernels and complexity measures on all substrings Given a string T ∈ [1..σ]n−1#, consider the infinite-dimensional vector T∞ indexed by all distinct substrings W ∈ [1..σ]+, such that T∞[W ] = fT (W ). The substring complexity C∞(T ) of T is the number of nonzero components of T∞. The substring kernel of two strings T 1 and T 2 is the cosine of composition vectors T1 ∞ and T2 ∞. Computing substring complexity and substring kernel amounts to applying the same telescoping strategy described in Theorem 3 and 4, but with different contributions: Corollary 1. Let T ∈ [1..σ]n−1# be a string. Given a data structure that supports rangeDistinct queries on BWTT , we can compute C∞(T ) in O(nd) time and in o(n) bits of space in addition to the input. Proof. The substring complexity of T coincides with the number of characters in [1..σ] that occur on all edges of STT . We can thus proceed as in Lemma 3, initializing C∞(T ) to (n − 1)n/2, or equivalently to the sum of the lengths of all suffixes of T [1..n − 1]. Whenever we visit a node v of ST, we add to C∞(T ) the quantity ℓ(v), and we subtract from C∞(T ) the quantity ℓ(v) · children(v). The net effect of all such operations coincides with summing the lengths of all edges of ST, discarding all occurrences of character #. Note that ℓ(u) is provided by Theorem 1, and children(v) is the size of array chars in repr(ℓ(v)). Corollary 2. Let T 1 ∈ [1..σ]n1−1#1 and T 2 ∈ [1..σ]n2−1#2 be strings. Given data structures that support rangeDistinct queries on BWTT 1 and on BWTT 2 , respectively, we can compute κ(T1 ∞) in O(nd) time and in o(n) bits of space in addition to the input, where n = n1 + n2. Proof. We proceed as in Theorem 4, setting again N = 0 and Di = (ni − 1)ni/2 at the beginning of the algorithm. When we visit a node u of the generalized suffix tree of T 1 and T 2, we set N to N + ℓ(u) · (f1(ℓ(u))f2(ℓ(u)) − Pv f1(ℓ(v))f2(ℓ(v))) and we set Di to Di + ℓ(u) · (fi(ℓ(u))2 − Pv fi(ℓ(v))2), where v ranges over all children of u in the generalized suffix tree. ∞, T2 5 ∞,g a weighted version of the infinite-dimensional vector Ti In a substring kernel it is common to weight a substring W by a user-specified function of its length: typical choices are ǫW for a given constant ǫ, or indicators that select only substrings within a specific range of lengths [16]. We denote by Ti ∞ in which Ti ∞[W ] = g(W) · fT i (W ) and where g is any user-specified function. We assume that the number of bits required to represent the output of g with sufficient precision is O(log n). It is easy to adapt Corollary 2 to support this type of composition vector: Corollary 3. Let T 1 ∈ [1..σ]n1−1#1 and T 2 ∈ [1..σ]n2−1#2 be strings. Given a function g(k) that can be evaluated in constant time, and given data structures that support rangeDistinct queries on BWTT 1 and on BWTT 2 , respectively, we can compute κ(T1 ∞,g) in O(nd) time and in o(n) bits of space in addition to the input, where n = n1 + n2. ∞,g, T2 Proof. We modify Corollary 2 as follows. Assume that we are processing an internal node v of the generalized suffix tree, let ℓ(v) = W , and assume that we have computed repr′(aW ) for all the left extensions aW of W . In addition to pushing repr′(aW ) onto the stack, we also push value prefixSum(aW ) = PW +1 g(i)2 with it, where prefixSum(aW ) = prefixSum(W ) + g(W + 1)2. When we pop repr′(aW ), we compute its contributions to N and Di as described in Corollary 2, but replacing aW by prefixSum(aW ). We initialize Di to Pni−1 j=1 g(j)2. i=1 Corollary 3 can clearly support distinct weight functions for T 1 and T 2. For some functions, like ǫW , prefix sums can be computed in closed form [16], thus there is no need to push prefixSum values on the stack. Another frequent weighting scheme for a string W associates a score q(c) to every character c of W , and it weights W by e.g. q(W ) = QW In this case we could just push prefixSum(V ) = PV j=1 q(V [j])2 onto the stack, where V = aW and prefixSum(V ) = q(a)2 · (1 + prefixSum(W )). A similar weighting scheme can be used for k-mers as well. Let Tk,q be a version of Tk such that Tk,q[W ] = fT (W ) − (T − W)q(W ) for every W ∈ [1..σ]k, and consider the following distances defined in [13]: i=1 q(W [i]). i=1 Qi Ds 2(T1 k,q, T2 k,q) = X W D∗ 2(T1 k,q, T2 k,q) = X W T1 k,q[W ]T2 k,q[W ]/q(T1 k,q[W ])2 + (T2 k,q[W ])2 T1 k,q[W ]T2 k,q[W ]/(cid:16)p(n1 − k)(n2 − k) · q(W )(cid:17) k,p, T2 where W ranges over all strings in [1..σ]k. We can compute such distances using just a minor modification to Theorem 4: Corollary 4. Let T 1 ∈ [1..σ]n1−1#1 and T 2 ∈ [1..σ]n2−1#2 be strings. Given an integer k and data structures that support rangeDistinct queries on BWTT 1 and on BWTT 2 , respectively, we can compute 2(T1 Ds k,p) in O(nd) time and in λ log σ + o(n) bits of space in addition to the input, where n = n1 + n2 and λ is the length of the longest repeat in T 1T 2. Proof. We proceed as in Theorem 4, pushing on the stack value q(W, k) = Qk j=1 q(W [j]) in addition to repr′(W ), and maintaining a separate stack of characters to represent the string we are processing during the depth-first traversal of the generalized suffix-link tree. We set q(aW, k) = q(a) · q(W, k)/q(b), where b is the kth character from the top of the character stack when we are processing W . k,p) and D∗ k,p, T2 2(T1 An orthogonal way to measure the similarity between T 1 and T 2 consists in comparing the repertoire of all strings that do not appear in T 1 and in T 2. Given a string T and two frequency thresholds τ1 < τ2, a string W is a minimal rare word of T if τ1 ≤ fT (W ) < τ2 and if fT (V ) ≥ τ2 for every proper substring V of W . Setting τ1 = 0 and τ2 = 1 gives the well-known minimal absent words (see e.g. [10, 5] and references therein), whose total number can be Θ(σn) [8]. Setting τ1 = 1 and τ2 = 2 gives the so-called shortest unique substrings (see e.g. [11] and references therein), whose total number is O(n), like the number of strings obtained by any other setting of τ1 ≥ 1. In what follows we focus on minimal absent words, but our algorithms can be generalized to other settings of the thresholds. 6 To decide whether aW b is a minimal absent word of T , where a and b are characters, it clearly suffices to check whether fT (aW b) = 0 and whether both fT (aW ) ≥ 1 and fT (W b) ≥ 1. It is well known that only a maximal repeat of T can be the infix W of a minimal absent word aW b, and this applies to any setting of τ1 and τ2. To enumerate all the minimal absent words, for example to count their total number C−(T ), we can thus iterate over all nodes of STT associated with maximal repeats, as described below: Theorem 6. Let T ∈ [1..σ]n−1# be a string. Given a data structure that supports rangeDistinct queries on BWTT , we can compute C−(T ) in O(nd) time and in o(n) bits of space in addition to the input. Proof. For clarity, we first describe how to enumerate all the distinct minimal absent words of T : we specialize this algorithm to counting at the end of the proof. We use Theorem 1 to enumerate all nodes v of STT associated with maximal repeats, as described in Section 2.2. Let {a1, . . . , ah} be the set of distinct left extensions of string ℓ(v) in T returned by operation extendLeft(repr(v)), let extensions[1..σ + 1, 0..σ] be a boolean matrix initialized to all zeros, and let leftExtensions[1..σ + 1] be an array initialized to all zeros. Let h′ be a pointer initialized to one. Operation extendLeft allows following all the Weiner links from v, not necessarily in lexicographic order: for every string aiℓ(v) obtained in this way, we set leftExtensions[h′] = ai, we enumerate its right extensions {c1, . . . , ck′} using array chars of repr(aiℓ(v)), we set extensions[h′, cj] = 1 for all j ∈ [1..k′], and we finally increment h′ by one. Note that only the columns of extensions that correspond to the right extensions of ℓ(v) are updated by this procedure. Then, we enumerate all the right extensions {b1, . . . , bk} of ℓ(v) using array chars of repr(ℓ(v)), and for every such extension bj we report all pairs (ai, bj) such that ai = chars[x], x ∈ [1..h′], and extensions[x, bj] = 0. This process takes time proportional to the number of Weiner links from v, plus the number of children of v, plus the number of Weiner links from v multiplied by σ. When applied to all nodes of ST, this takes in total O(nσ) time, which is optimal in the size of the output. The matrices and vectors used by this process can be reset to all zeros after processing each node: the total time spent in such reinitializations in O(n). If we just need C−(T ), rather than storing the temporary matrices extensions and leftExtensions, we store just a number area which we initialize to hk before processing node v. Whenever we observe a right extension cj of a string aiℓ(v), we decrease area by one. Before moving to the next node, we increment C−(T ) by area. Let T− be the infinite-dimensional vector indexed by all distinct substrings W ∈ [1..σ]+, such that T−[W ] = 1 iff W is a minimal absent word of T . Theorem 6 can be adapted to compute the Jaccard distance between the composition vectors of two strings: Corollary 5. Let T 1 ∈ [1..σ]n1−1#1 and T 2 ∈ [1..σ]n2−1#2 be strings. Given data structures that support rangeDistinct queries on BWTT 1 and on BWTT 2 , respectively, we can compute J(T1 −) in O(nd) time and in o(n) bits of space in addition to the input, where n = n1 + n2. −, T2 Proof. We apply the strategy of Theorem 6 to the internal nodes of the generalized suffix tree of T 1 and T 2 whose label is a maximal repeat of T 1 and a maximal repeat of T 2: such strings are clearly maximal repeats of T 1T 2 as well. We enumerate such nodes as described in Section 2.2. We keep a global variable intersection and a bitvector sharedRight[1..σ]. For every node v that corresponds to a maximal repeat of T 1 and of T 2, we merge the sorted arrays chars1 and chars2 of repr′(ℓ(v)), we set sharedRight[c] = 1 for every character c that belongs to the intersection of the two arrays, and we cumulate in a variable k′ the number of ones in sharedRight. Then, we scan every left extension ai provided by extendLeft′, we determine in constant time whether it occurs in both T 1 and T 2, and if so we increment a variable h′ by one. Finally, we initialize a variable area to h′k′, and we process again every left extension ai provided by extendLeft′: if aiℓ(v) occurs in both T 1 and T 2, we compute the union of arrays chars1 and chars2 of repr′(aiℓ(v)), and for every character c in the union such that sharedRight[c] = 1, we decrement area by − ∨ T2 one. At the end of this process, we add area to the global variable intersection. To compute T1 − we apply Theorem 6 to T 1 and T 2 separately. It is easy to extend Corollary 5 to compute κ(T1 −, T2 −), as well as to support weighting schemes based on the length and on the characters of minimal absent words. 7 5 Markovian corrections In some applications it is desirable to assign to component W ∈ [1..σ]k of composition vector T∞ an estimate of the statistical significance of observing fT (W ) occurrences of W in T : intuitively, strings whose frequency departs from its expected value are more likely to carry "information", and they should be weighted more [12]. Assume that T is generated by a Markov random process of order k−2 or smaller, that produces strings on alphabet [1..σ] according to a probability distribution P. It is well known that the probability of observing W in a string generated by such random process is P(W ) = P(W [1..k − 1]) · P(W [2..k])/P(W [2..k − 1]). We can estimate P(W ) using the empirical probability pT (W ), obtaining the following approximation for P(W ): pT (W ) = pT (W [1..k − 1]) · pT (W [2..k])/pT (W [2..k − 1]) if pT (W [2..k − 1]) 6= 0, and pT (W ) = 0 otherwise. We can thus estimate the significance of the event that substring W has empirical probability pT (W ) in string T using the following score: zT (W ) = (pT (W ) − pT (W ))/pT (W ) if pT (W ) 6= 0, and zT (W ) = 0 if pT (W ) = 0 [12]. After elementary manipulations [2], zT (W ) becomes: zT (W ) = g(n, k) · g(x, y) = (x − y + 2)2/(x − y + 1)(x − y + 3) fT (W ) · fT (W [2..k − 1]) fT (W [1..k − 1]) · fT (W [2..k]) − 1 Since g(x, y) ∈ [1..1.125], we temporarily assume g(x, y) = 1 in what follows, removing this assumption later. Let Tz be a version of the infinite-dimensional vector T∞ in which Tz[W ] = zT (W ). Among all strings that occur in T , only strings aW b such that a and b are characters in [0..σ] and such that W is a maximal repeat of T can have Tz[aW b] 6= 0. Similarly, among all strings that do not occur in T , only the minimal absent words of T have a nonzero component in Tz: specifically, Tz[aW b] = −1 for all minimal absent words aW b of T , where a and b are characters in [0..σ] [2]. Given two strings T 1 and T 2, we can thus compute κ(T1 Theorem 7. Let T 1 ∈ [1..σ]n1−1#1 and T 2 ∈ [1..σ]n2−1#2 be strings. Given data structures that support rangeDistinct queries on BWTT 1 and on BWTT 2 , respectively, and assuming g(x, y) = 1 for all settings of x and y, we can compute κ(T1 z) in O(nd) time and in o(n) bits of space in addition to the input, where n = n1 + n2. z) using the same strategy as in Corollary 5: z, T2 z, T2 z, T2 Proof. We focus here on computing component N of κ(T1 z): computing Di follows a similar algorithm on BWTT i. We keep again a bitvector sharedRight[1..σ], and we enumerate all the internal nodes of the generalized suffix tree of T 1 and T 2 whose label is a maximal repeat of T 1T 2, as described in Section 2.2. For every such node v, we merge the sorted arrays chars1 and chars2 of repr′(ℓ(v)), we set sharedRight[c] = 1 for every character c that belongs to the intersection of the two arrays, and we cumulate in a variable k′ the number of ones in sharedRight. Then, we scan every left extension ai provided by extendLeft′, we determine in constant time whether it occurs in both T 1 and T 2, and if so we increment a variable h′ by one. Finally, we initialize a variable area to h′k′, and we process again every left extension ai provided by extendLeft′. If aiℓ(v) occurs in both T 1 and T 2, we merge arrays chars1 and chars2 of repr′(aiℓ(v)): for every character b in the intersection of chars1 and chars2, we add to N value z1(aiℓ(v)b) · z2(aiℓ(v)b), retrieving the corresponding frequencies from repr′(aiℓ(v)) and from repr′(ℓ(v)), and we decrement area by one. For every character b that occurs only in chars1, we test whether sharedRight[b] = 1: if so, aiW b is a minimal absent word of T 2 that occurs in T 1, thus we decrement area by one and we add to N value −z1(aiℓ(v)b). We proceed symmetrically if b occurs only in chars2. At the end of this process, area counts the number of minimal absent words with infix ℓ(v) that are shared by T 1 and T 2: thus, we add area to N . It is easy to remove the assumption that g(x, y) is always equal to one. There are only two differences from the previous case. First, the score of the substrings W of T i that have a maximal repeat of T i as an infix changes, but g(ni,W) can be immediately computed from W, which is included in both repr(W ) and repr′(W ). Second, the score of all substrings W of T i that do not have a maximal repeat as an infix changes from zero to g(ni,W) − 1: we can take into account all such contributions by pushing prefix-sums 8 z, T2 to the stack, as in Corollary 3. For example, to compute component N of κ(T1 z), we can first assume that all substring W that occur both in T 1 and in T 2 have score g(ni,W) − 1, by pushing to the stack the prefix-sums described in [2] and by enumerating only nodes v of the generalized suffix tree of T 1 and T 2 such that ℓ(v) occurs both in T 1 and in T 2. Then, we can run the algorithm in Theorem 7, subtracting quantity (g(n1,W + 2) − 1) · (g(n2,W + 2) − 1) from the contribution to N of every string aiW b that occurs both in T 1 and in T 2. Finally, recall that in Section 3 we mentioned the problem of determining an upper bound on the values of k to be used in k-mer kernels. Let Tk be the composition vector indexed by all strings in [1..σ]k such that Tk[W ] = pT (W ), and let Tk be a similar composition vector with Tk[W ] = pT (W ), where pT (W ) is defined as in the beginning of this section. It makes sense to disregard values of k for which Tk and Tk are very similar, and more formally whose Kullback-Leibler divergence KL(Tk, Tk) = PW Tk[W ] · (log(Tk[W ]) − log( Tk[W ])) is small, where W ranges over all strings in [1..σ]k. Thus, we could use as an upper bound on k the minimum value k∗ such that P∞ k′=k∗ KL(Tk′ , Tk′ ) < τ for some user-specified threshold τ [15]. Note again that only strings aW b such that a and b are characters in [0..σ] and W is a maximal repeat of T contribute to KL(TW +2, TW +2). We can thus adapt Theorem 7 to compute the KL divergence for a user-specified range of lengths [k1..k2], using just one pass over BWTT , in O(nd) time and in o(n) bits of space in addition to the input and the output. The same approach can be used to compute the KL-divergence kernel κ(T1 KL), where Ti KL[W ] = KLT i (W ) and KLT i (W ) = Pa,b∈Σ pT i(aW b) · (log(pT i(aW b)) − log(pT i (aW b))). KL, T2 References [1] Alberto Apostolico. Maximal words in sequence comparisons based on subword composition. In Algo- rithms and Applications, pages 34 -- 44. Springer, 2010. [2] Alberto Apostolico and Olgert Denas. Fast algorithms for computing sequence distances by exhaustive substring composition. Algorithms for Molecular Biology, 3(1):13, 2008. [3] Djamal Belazzougui. Linear time construction of compressed text indices in compact space. In Sym- posium on Theory of Computing, STOC 2014, New York, NY, USA, May 31 - June 03, 2014, pages 148 -- 193, 2014. [4] Djamal Belazzougui, Gonzalo Navarro, and Daniel Valenzuela. Improved compressed indexes for full- text document retrieval. Journal of Discrete Algorithms, 18:3 -- 13, January 2013. [5] Supaporn Chairungsee and Maxime Crochemore. Using minimal absent words to build phylogeny. Theoretical Computer Science, 450:109 -- 116, 2012. [6] Rayan Chikhi and Paul Medvedev. Informed and automated k-mer size selection for genome assembly. Bioinformatics, 30(1):31 -- 37, 2014. [7] Benny Chor, David Horn, Nick Goldman, Yaron Levy, Tim Massingham, et al. Genomic DNA k-mer spectra: models and modalities. Genome Biology, 10(10):R108, 2009. [8] Maxime Crochemore, Filippo Mignosi, and Antonio Restivo. Automata and forbidden words. Informa- tion Processing Letters, 67(3):111 -- 117, 1998. [9] Simon Gog. Compressed suffix trees: Design, construction, and applications. PhD thesis, University of Ulm, Germany, 2011. [10] Julia Herold, Stefan Kurtz, and Robert Giegerich. Efficient computation of absent words in genomic sequences. BMC Bioinformatics, 9(1):167, 2008. [11] Atalay Mert Ileri and Bojian Xu. Shortest unique substring query revisited. In Combinatorial Pattern Matching, pages 172 -- 181, 2014. 9 [12] Ji Qi, Bin Wang, and Bai-Iin Hao. Whole proteome prokaryote phylogeny without sequence alignment: a k-string composition approach. Journal of Molecular Evolution, 58(1):1 -- 11, 2004. [13] Gesine Reinert, David Chew, Fengzhu Sun, and Michael S Waterman. Alignment-free sequence com- parison (I): statistics and power. Journal of Computational Biology, 16(12):1615 -- 1634, 2009. [14] John Shawe-Taylor and Nello Cristianini. Kernel methods for pattern analysis. Cambridge university press, 2004. [15] Gregory E Sims, Se-Ran Jun, Guohong A Wu, and Sung-Hou Kim. Alignment-free genome comparison with feature frequency profiles (FFP) and optimal resolutions. Proceedings of the National Academy of Sciences, 106(8):2677 -- 2682, 2009. [16] Alex J. Smola and S.v.n. Vishwanathan. Fast kernels for string and tree matching. In S. Becker, S. Thrun, and K. Obermayer, editors, Advances in Neural Information Processing Systems 15, pages 585 -- 592. MIT Press, 2003. 10
1512.07263
1
1512
2015-12-22T21:11:43
General Graph Identification By Hashing
[ "cs.DS" ]
A method for identifying graphs using MD5 hashing is presented. This allows fast graph equality comparisons and can also be used to facilitate graph isomorphism testing. The graphs can be labeled or unlabeled. The method identifies vertices by hashing the graph configuration in their neighborhoods. With each vertex hashed, the entire graph can be identified by hashing the vertex hashes.
cs.DS
cs
General Graph Identification By Hashing Tom Portegys Email: [email protected] Abstract A method for identifying graphs using MD5 hashing is presented. This allows fast graph equality comparisons and can also be used to facilitate graph isomorphism testing. The graphs can be labeled or unlabeled. The method identifies vertices by hashing the graph configuration in their neighborhoods. With each vertex hashed, the entire graph can be identified by hashing the vertex hashes. Introduction Numerous uses could be found for unique and concise graph identifiers: graphs could then be counted, sorted, compared and verified more easily. For example, chemical compounds could be specified by identifying their constituent molecules represented by graphs of spacial and bonding relationships between atoms. The problem with developing a method for identifying graphs is that graphs are very general objects. Uniquely identifying vertices and edges solves the problem but begs the question, since the problem then becomes how to arrive at these identifiers in a uniform fashion (Sayers and Karp, 2004). The method proposed here identifies vertices by computing an MD5 hash (Rivest, 1992) for the graph configuration in their neighborhoods in an iteratively expanding manner. Once each vertex has a unique hash or is fully expanded, the vertex hashes are sorted and hashed to yield a hash for the graph, a technique similar to that used by Melnik and Dunham (2001). Description Graph format Using a pseudo-C++ notation, the following define a graph vertex and edge: Vertex { int label; Edge edges[]; }; Edge { int label; Vertex source; Vertex target; bool directed; }; This general scheme allows for a number of graph variations: labeled/unlabeled (using null labels), directed/undirected (for undirected, source and target are synonymous), and multigraphs. An edge is stored with both vertices; but only once when an edge connects a vertex to itself. A set of vertices and edges comprises a graph, which may be connected or not. Algorithm The following object is used to construct MD5 hash codes based on vertex graph neighborhoods: VertexCoder { Vertex vertex; Edge parentEdge; unsigned char code[MD5_SIZE]; VertexCoder children[]; VertexCoder creator; bool expanded; int generation; hashmap vertexMap[(Vertex, Edge) => VertexCoder]; void generateCode(bool); void expand(); }; The algorithm iteratively expands each vertex in the graph into an acyclic directed subgraph of coder objects representing the vertices and edges in its neighborhood until each vertex either has a distinct code or is fully expanded, implying that there may be vertices with identical codes. The graph hash code is then constructed by sorting and hashing the vertex codes. // Generate code. // The boolean argument allows labels to be included in the // hash calculation. void generateCode(bool hashLabels) { // The graph (root) coder has a null vertex and a child // for each vertex. if (vertex == null) { // Iteratively expand children and generate // codes without labels to encode structure. for (i = 0; i < children.length; i++) { children[i].expand(); children[i].generateCode(false); // All vertices are distinct? } // Continue until fully expanded or all hashes // are distinct. while (true) { // All vertices are fully expanded? for (i = 0; i < children.length; i++) { if (!children[i].expanded) break; } if (i == children.length) break; sort(children); for (i = 0; i < children.length - 1; i++) { if ((!children[i].expanded !children[i + 1].expanded) && children[i] == children[i + 1]) break; } if (i == children.length - 1) break; // Expand and generate codes for range of // equivalent children. for (j = i + 1; j < children.length && children[i] == children[j]; j++) {} for (; i < j; i++) { if (!children[i].expanded) { children[i].expand(); children[i].generateCode(false); } } } } // Recursively generate code. oldCode = code; for (i = 0; i < children.length; i++) { children[i].generateCode(hashLabels); } sort(children); // Codify the parent edge type. // Construct code from vertex, parent edge, and // childrens’ codes. if (vertex != null) { if (hashLabels) content += vertex.label; if (parentEdge != null) { if (hashLabels) content += parentEdge.label; if (parentEdge.directed) { if (parentEdge.source == vertex) { content += 0; } else { content += 1; } } else // Undirected edge. { content += 2; } } } for (i = 0; i < children.length; i++) { content += children[i].code; } // Create code by hashing the content. code = md5(content); // Mark vertex as expanded if code not changed. if (oldCode == code) expanded = true; } // Expand coder one level deeper. void expand() { if (expanded) return; if (children.length == 0) { // Expand this vertex. for (i = 0; i < vertex.edges.length; i++) if (child == null) { if (vertex == vertex.edges[i].source) { child = vertexMap.find(vertex.edges[i].target, vertex.edges[i]); { // vertex = edge target, parent edge = // edge, creator = this coder, // generation + 1. child = new VertexCoder( vertex.edges[i].target, // Create a new child coder: vertex.edges[i], this, generation + 1); children.append(child); vertexMap[vertex.edges[i].target, vertex.edges[i]] = child; } else { // Share next generation coder. if (child.generation == generation + 1) { children.append(child); } } } else // Vertex is target. { child = vertexMap.find(vertex.edges[i].source, vertex.edges[i]); { // vertex = edge source, parent edge = // edge, creator = this coder, // generation + 1. child = new VertexCoder( vertex.edges[i].source, // Create a new child coder: if (child == null) vertex.edges[i], this, generation + 1); children.append(child); vertexMap[vertex.edges[i].source, vertex.edges[i]] = child; } else { // Share next generation coder. if (child.generation == generation + 1) { children.append(child); } } } } } else { // Expand deeper. for (i = 0; i < children.length; i++) { // duplicate expansion. if (children[i].creator == this) children[i].expand(); } } } // Only coder creator can expand to prevent Graph hash example The method is illustrated through an example. Consider the simple directed graph shown in Figure 1. The vertices and edges are labeled for illustrative purposes, but the algorithm works for unlabeled vertices and edges as well as undirected edges. Figure 1 – A simple directed graph. The hash coding algorithm will create the vertex coder graph shown in Figure 2 for the graph in Figure 1. The vertex coder graph is an acyclic directed graph (although the source graph need not be). The root of the vertex coder graph represents the entire source graph, and will contain the hash code for the source graph after processing is complete. The (f) and (b) notation on the edges represent a directed edge in the source graph in the forward and backward direction respectively. Figure 2 – Graph vertex coder Before the first call to generateCode(), the coder is configured as in Figure 3. This configuration reveals nothing about the edges in the graph, and thus must always be expanded. Moreover, it should be noted that a graph is initially encoded without regard to vertex and edge labels. If the graph is labeled the labels are incorporated into the hash code in a final pass. The reason for this is that the algorithm terminates when the vertex codes are all unique; using labels could prematurely result in graphs that have differing edge configurations computing the same hash code. Each child of root is also initialized with its own map (vertexMap) used in subgraph expansion to detect and prevent cycles. Figure 3 – Initial coder configuration. After the first expansion, the coder appears as in Figure 4. Note that for vertex 0, there are 2 forward edges to vertices 1 and 2. For vertex 1, there is a forward and backward edge to vertex 2, and a backward edge to vertex 0. Vertex 2 has a forward and backward edge to vertex 1, and a backward edge to vertex 0. Considering that the algorithm is actually disregarding labels at this point, it can be seen that vertex 0’s subgraph structure is distinct from that of vertex 1 and 2, both of which have identical structures. This fact is discovered after sorting and scanning the vertex hash codes, and for this reason vertex 1 and 2 must be expanded. Figure 4 – First expansion. Refer back to Figure 2 for the results of the next expansion of vertices 1 and 2. Several new coders become “shared” children, representing common states of expansion. What occurs during processing is that one parent initially creates the child, which is then detected by the vertexMap data structure during the expansion of the other parents. The generation member of the child distinguishes this as a valid child instead of a loop to a previous coder. In order to avoid duplicate expansions of a shared child, the only parent allowed to expand the child is the one indicated by the creator member of the child. It can be seen that the subgraphs for these vertices are still structurally identical, which, looking at the source graph, is exactly the case. A subsequent call to expand() will result in no further subgraph expansion, since cycles will be detected by the vertexMap data structure. Because of this, the hash codes remain unchanged, marking the vertices as expanded and unavailable for further expansion. Graph isomorphism The vertex coder graph can be used in determining isomorphism between labeled graphs, a task that is possibly NP-complete. Graphs are isomorphic if there is a consistent mapping between their labeled vertices. If the two candidate graphs are first hashed without regard to labels, the hash codes of the vertex coders can be used to constrain the vertex correspondences between the two graphs, since only those that have the same hash can possibly correspond. Performance The performance of the algorithm was measured with a graph comparison task against the Ullman (1976) and Schmidt-Druffel (1976) algorithms. The Ullmann algorithm is one of the most commonly used for graph isomorphism because of its generality and effectiveness (Cordella, et. al., 2001). The results are shown in Table 1. For each setting of vertices/edges from 10/100 to 100/10000, 1000 directed and unlabeled randomly connected graphs were generated. To compare, each graph was cloned and the ordering of the vertices and edges randomly scrambled in the clone to prevent artifactual timings; so each pair was isomorphic but differently organized internally. The results are given as the average of the measured times in milliseconds to do the comparisons. For the hash algorithm, the time to hash both graphs and compare the hashes for equality was measured. The tests were conducted on a SUN UltraSPARC III workstation. Schmidt-Druffel Hash 0.01 19.06 64.92 2.00 138.43 6.00 238.93 12.13 21.82 389.99 576.34 34.40 775.20 51.13 72.23 1076.49 1386.25 98.26 129.45 1840.11 Table 1 – Graph comparison times (ms). Ullmann 0.0 1.09 1.96 3.84 6.25 9.53 13.69 18.99 25.67 33.62 Vertices/Edges 10/100 20/400 30/900 40/1600 50/2500 60/3600 70/4900 80/6400 90/8100 100/10000 These timings can be used to estimate when the use of hashing is advantageous. For example, for categorizing graphs, a set of graphs is compared against a set of exemplars that grows as unmatched graphs are encountered. With hashing, the comparison can be done with a binary search or use of a hash space (hashing the graph hashes) to increase speed. For N exemplars, and using a binary search, the tipping point can be expressed as follows: Where: Ullmann is Ullmann algorithm comparison time. Hash is the time to hash a graph. CMP is the time to compare MD5 hashes. Using the data in Table 1, the hashing method is preferable when N > 150. Additional measurements were taken to confirm an expected increase in hashing time for “symmetrical” graphs, i.e. graphs that have numerous structurally identical vertex coder subgraphs. As expected, this significantly increased the processing time as well as the memory needed to hold the larger subgraphs. For example, the time to hash a 100-vertex fully interconnected graph was 48.867 seconds. Conclusion A method for identifying graphs using MD5 hashing has been presented. The algorithm grew out of a need for identifying molecules in a chemistry simulation constructed by the author. A simpler initial method was later elaborated into the one given here. HashCMPNNUllmann2log2 Measurements indicate that the method shows promise as an effective means of comparing graphs. References L. P. Cordella, P. Foggia, C. Sansone, and M. Vento (2001), An Improved Algorithm for Matching Large Graphs, Proceedings of International Workshop on Graph-based Representation in Pattern Recognition, Ischia, Italy, pp. 149 - 159. S. Melnik (2001), RDF API draft: Cryptographic digests of RDF models and statements, http://www-db.stanford.edu/~melnik/rdf/api.html#digest. R. Rivest (1992), RFC 1321 The MD5 Message-Digest Algorithm, http://tools.ietf.org/html/rfc1321. C. Sayers and A. H. Karp (2004), RDF Graph Digest Techniques and Potential Applications, Mobile and Media Systems Laboratory, HP Laboratories Palo Alto, HPL- 2004-95. D. C. Schmidt and L. E. Druffel (1976), A Fast Backtracking Algorithm to Test Directed Graphs for Isomorphism Using Distance Matrices, Journal of the Association for Computing Machinery, 23, pp. 433-445. J. R. Ullmann (1976), An Algorithm for Subgraph Isomorphism, Journal of the Association for Computing Machinery, vol. 23, pp. 31-42.
1506.04383
2
1506
2015-08-10T04:33:40
Drawing Large Graphs by Multilevel Maxent-Stress Optimization
[ "cs.DS", "cs.CG" ]
Drawing large graphs appropriately is an important step for the visual analysis of data from real-world networks. Here we present a novel multilevel algorithm to compute a graph layout with respect to a recently proposed metric that combines layout stress and entropy. As opposed to previous work, we do not solve the linear systems of the maxent-stress metric with a typical numerical solver. Instead we use a simple local iterative scheme within a multilevel approach. To accelerate local optimization, we approximate long-range forces and use shared-memory parallelism. Our experiments validate the high potential of our approach, which is particularly appealing for dynamic graphs. In comparison to the previously best maxent-stress optimizer, which is sequential, our parallel implementation is on average 30 times faster already for static graphs (and still faster if executed on one thread) while producing a comparable solution quality.
cs.DS
cs
Drawing Large Graphs by Multilevel Maxent-Stress Optimization Henning Meyerhenke, Martin Nöllenburg, Christian Schulz Institute of Theoretical Informatics Karlsruhe Institute of Technology (KIT), Karlsruhe, Germany Email: {meyerhenke, noellenburg, christian.schulz}@kit.edu Abstract. Drawing large graphs appropriately is an important step for the visual analysis of data from real-world networks. Here we present a novel multilevel algorithm to compute a graph layout with respect to a recently proposed metric that combines layout stress and entropy. As opposed to previous work, we do not solve the linear systems of the maxent-stress metric with a typical numerical solver. Instead we use a simple local iterative scheme within a multilevel ap- proach. To accelerate local optimization, we approximate long-range forces and use shared-memory parallelism. Our experiments validate the high potential of our approach, which is particularly appealing for dynamic graphs. In comparison to the previously best maxent-stress optimizer, which is sequential, our parallel implementation is on average 30 times faster already for static graphs (and still faster if executed on one thread) while producing a comparable solution quality. 1 Introduction Drawing large networks (or graphs, we use both terms interchangeably) with hundreds of thousands of nodes and edges has a variety of relevant applications. One of them can be interactive visualization, which helps humans working on graph data to gain insights about the properties of the data. If a very large high-end display is not available for such purpose, a hierarchical approach allows the user to select an appropriate zoom level [1]. Moreover, drawings of large graphs can also be used as a preprocessing step in high-performance applications [2]. One very promising class of layout algorithms in this context is based on the stress of a graph. Such algorithms can for instance be used for drawing graphs with fixed dis- tances between vertex pairs, provided a priori in a distance matrix [3]. More recently, Gansner et al. [4] proposed a similar model that includes besides the stress an additional entropy term (hence its name maxent-stress). While still using shortest path distances, this model often results in more satisfactory layouts for large networks. The optimiza- tion problem can be cast as solving Laplacian linear systems successively. Since each right-hand side in this succession depends on the previous solution, many linear systems need to be solved until convergence – more details can be found in Section 2.3. Motivation. We want to employ this maxent-stress model for drawing large net- works quickly. Yet, solving many large Laplacian linear systems can be quite costly. A conjugate gradient solver (used in [4]) is easy to implement but has superlinear running Fig. 1. Drawings of bcsstk31. Left to right: PivotMDS [8], Maxent [4], MulMent (new). time. Solvers with provably nearly-linear running time exist but are not yet competitive with established methods in practice (see [5] for an experimental comparison). Multi- grid methods [6,7] for Laplacian systems may seem appealing in this context, but their setup phase building the multigrid hierarchy can be expensive for large graphs. Gansner et al. [4] also suggested (but did not use) a simpler iterative refinement procedure for solving their optimization problem. This procedure would be slow to converge if used unmodified. However, if designed and implemented appropriately, it has the potential for fast convergence even on large graphs. Moreover, as already ob- served in [4], it has high potential for parallelism and should work well on dynamic graphs by profiting from previous solutions. Outline and Contribution. The main contribution of this paper is to make the alter- native iterative local optimizer suggested by Gansner et al. [4] (for details on this and other related work see Section 2) usable and fast in practice. To this end, we design and implement a multilevel algorithm tailored to large networks (see Section 3). The employed coarsening algorithm for building the multilevel hierarchy can control the trade-off between the number of hierarchy levels and convergence speed of the local optimizer. One property of the local optimizer we exploit is its high degree of paral- lelism. Further acceleration is obtained by approximating long-range forces. To this end, we use coarser representatives stored in the multilevel hierarchy. Our experimental results in Section 4 first reveal that force approximation rarely af- fects the layout quality significantly – in terms of maxent-stress values as well as visual quality, also see Figure 1 and Appendix. The parallel implementation of our multilevel algorithm MulMent with force approximation is, however, on average 30 times faster than the reference implementation [4] – and even our sequential approximate algorithm is faster than the reference. A contribution besides higher speed is that, in contrast to [4], our approach does not require input coordinates to optimize the maxent-stress measure. 2 Preliminaries 2.1 Basic Concepts Consider an undirected, connected graph G = (V, E, c, ω, d) with node weights c : V → R≥0, edge weights ω : E → R≥0, target edge lengths d : E → R>0, n = V , and m = E. Often the function d models the required distance between two adjacent vertices. By default, our initial inputs will have unit edge length d ≡ 1 as well as unit node weights and edge weights c ≡ 1, ω ≡ 1. However, we will encounter weighted problems in the course of our multilevel algorithm. Let N (v) := {u : {v, u} ∈ E} 2 denote the set of neighbors of v. A clustering of a graph is a set of blocks (= clusters) of nodes {V1, . . . , Vk} that partition V , i.e., V1 ∪ ··· ∪ Vk = V and Vi ∩ Vj = ∅ for i (cid:54)= j. A layout of a graph is represented as a coordinate vector x, where xv is the two- dimensional coordinate of vertex v. Since edges are drawn as straight-line segments between their incident nodes, x is sufficient to define the complete graph layout. 2.2 Related Work Most general-purpose layout algorithms for arbitrary undirected graphs are based on physical analogies and can be grouped, according to Hu and Shi [9], into two main classes: algorithms in the spring-electrical model and algorithms in the stress model. Both classes of algorithms often yield aesthetically pleasing graph layouts that empha- size symmetries and avoid edge crossings at least in sparse graphs. Recent surveys of algorithms in these models are given by Hu and Shi [9] and by Kobourov [10]. In the spring-electrical model, first presented by Eades in 1984 [11], the analogy is to represent nodes as electrically charged particles that repel each other while edges are represented as springs exerting attraction forces to adjacent nodes. A graph layout is then seen as a physical system of forces and the goal is to find an optimal layout corresponding to a minimum energy state. Spring-electrical algorithms are also known as spring embedders, with the algorithm by Fruchterman and Reingold [12] being one of the most widely used spring embedder algorithms. It simulates the physical system of attractive and repulsive forces and iteratively moves each node into the direction of the resulting force. Each iteration requires, however, a quadratic number of force computations due to the repulsive forces between all pairs of nodes, which limits the scalability of the original approach. A faster approximative force calculation method based on quadtrees, aggregating especially the long-range forces, has been proposed by Barnes and Hut [13] and yields running times of O(n log n) under certain assumptions. The (full) stress model is closely related to multidimensional scaling [14], and was introduced in graph drawing by Kamada and Kawai [15]. It is based on defining ideal distances duv not only between adjacent vertices but between all vertex pairs (u, v) ∈ u(cid:54)=v wuv(xu−xv−duv)2, where wuv uv. Often, the distance duv between is a weight factor typically chosen as wuv = 1/d2 adjacent nodes is set to 1, while the distance of non-adjacent nodes is the shortest- path distance in the graph. Solving this model is typically done by iteratively solving a series of linear systems [3]. The need to compute all-pairs shortest paths and to store a quadratic number of distances again defeats the scalability of this original approach for large graphs. One of the fastest algorithms for approximatively solving the stress model instead is PivotMDS [8], which requires distance calculations from each vertex only to a small set of k (cid:28) n suitably chosen pivot vertices. V ×V and then minimizing the layout stress(cid:80) The stress model prescribes target distances not only for edges but for all vertex pairs. While this is a reasonable approach, it still brings artificial information into the layout process. An interesting alternative has been proposed by Gansner et al. [4]. Their algorithm (called Maxent) uses the sparse stress model, which only contains the stress terms for the edges of the graph. In order to deal with the remaining degrees of freedom in the layout, they suggest using the maximum entropy principle instead. Since our algorithm is closely related to Maxent, we discuss the latter in more detail in Section 2.3. 3 A general approach for speeding up layout computations for large graphs is the multilevel technique, which has been used in the spring-electrical [16,17] and in the stress model [18]. A multilevel algorithm computes a sequence of increasingly coarse but structurally related graphs as abstractions of the original graph. Starting from a layout of the coarsest graph, incremental refinement steps using the previous layout as a scaffold eventually produce a layout of the entire input graph, where the refinement steps are fast due to the good initial layouts. In addition to sequential algorithms for drawing large graphs, there is previous research in parallel layout algorithms, particularly using a graphics processing unit (GPU). Frishman and Tal [19] presented a multilevel force-based layout algorithm and implemented it using GPU-based parallelization. Ingram et al. [20] also exploit parallel GPU computations and presented a multilevel stress-based layout algorithm. 2.3 Maxent-stress optimization Gansner et al. [4] proposed the maxent-stress model that combines a sparse stress model with an entropy term to resolve the degrees of freedom for non-adjacent vertex pairs. The entropy term itself is optimized when all nodes are spread out uniformly, similar to the repulsive forces in the spring-electrical model. Gansner et al. [4] showed that the maxent-stress model performs well on several measures of layout quality in distance- based embeddings and avoids typical shortcomings of other stress models, particularly for non-rigid graphs. Formally, the maxent-stress M (x) of a layout x is defined1 as M (x) = wuv(xu − xv − duv)2 − α lnxu − xv, (1) (cid:88) {u,v}(cid:54)∈E (cid:88) {u,v}∈E where duv is the target distance between nodes u and v and wuv is a weight factor uv. Throughout the paper, we use this as a weight factor. typically chosen as wuv = 1/d2 The scaling factor α is used to modulate the strength of the entropy term and is gradually reduced in the implementation. Gansner et al. minimize the maxent-stress using a technique that repeatedly solves Laplacian linear systems that additionally include a repulsive force vector which is approximated following the quadtree method of Barnes and Hut [13]. Alternatively, they proposed (but did not implement) the following local iterative force-based scheme to solve the maxent-stress model: xu ← 1 ρu wuv xv + duv {u,v}∈E where ρu = (cid:80){u,v}∈E wuv. Note that sometimes we use the abbreviation r(u, v) := {u,v} /∈E xu − xv (cid:107)xu − xv(cid:107) + α ρu xu − xv (cid:107)xu − xv(cid:107)2 , (2) xu−xv (cid:107)xu−xv(cid:107)2 and shortly call these values r-values. (cid:19) (cid:88) (cid:88) (cid:18) 1 In fact, Gansner et al. define a slightly more general model that considers the stress term for arbitrary supersets S ⊇ E and allows variations of the entropy term. Our algorithm also works for the general model; to simplify the description, we restrict ourselves to the default model. 4 3 Multilevel Maxent-stress Optimization As mentioned, a successful (meta)heuristic for graph drawing (and other optimization problems on large graphs) is the multilevel approach. We employ it for maxent-stress optimization also for other reasons: (i) Some graphs (such as road networks) feature a hierarchical structure, which can be exploited to some extent by a multilevel approach and (ii) the computed hierarchy may be useful later on for multiscale visualization. Before going into the details, we briefly sketch our algorithmic approach: The method for creating the graph hierarchy is based on fast graph clustering with con- trollable cluster sizes. Each cluster computed on one hierarchy level is contracted into a new supervertex for the next level. After computing an initial layout on the coars- est hierarchy level, we improve the drawing on each finer level by iterating Eq. (2). Additionally, this process exploits the hierarchy and draws vertices that are densely connected with each other (i. e. which are in the same cluster) close to each other. 3.1 Coarsening and Initial Layout To compute the clustering that is contracted in the manner described above, we adapt size-constrained label propagation (SCLaP) [21], an algorithm originally developed for coarsening and local improvement during multilevel graph partitioning. SCLaP itself is based on the graph clustering algorithm label propagation [22]. The latter starts with a singleton clustering (i. e. each node is a cluster). The algorithm then works in rounds. Roughly speaking, in each round the algorithm visits all nodes in random order and assigns each node to the predominant cluster in its neighborhood (illustrated in Figure 3 in the appendix). This way, cluster IDs (= labels) propagate through the graph and nodes in a dense cluster usually agree on a common label. However, clusters with unconstrained sizes are not desirable here since they would hamper convergence of the local improvement phase. The trade-off between this con- vergence speed and the number of hierarchy levels needs to be chosen properly for a fast overall running time. That is why SCLaP constrains cluster sizes, i. e. it introduces an upper bound U := max(maxv c(v), W ) on the cluster sizes (W is specified below). Consequently, in each SCLaP round, nodes are assigned to the predominant cluster that is not overloaded after the label change. In our implementation, based on preliminary experiments, we set the parameter W V f ), where b and f are tuning parameters and h is the level in the hierarchy to min(bh, that we are currently working on. The intuition behind this choice is that we want the contraction process not to be too strong on the fine levels in order two allow fast con- vergence of local improvement algorithms, whereas we allow stronger contractions on coarser levels. If the contracted graph is not more than 10% smaller than the graph on the current level, we decrease the value of f and set it to 0.7f. While the original label propagation algorithm repeats the process until conver- gence, SCLaP performs at most (cid:96) rounds, where (cid:96) is a tuning parameter. One round of the algorithm can be implemented to run in O(n + m) time. Contracting a clustering works as follows: each block of the clustering is contracted into a single node. The weight of the node is set to the sum of the weight of all nodes in the original block. There is an edge between two nodes u(cid:48) and v(cid:48) in the contracted 5 graph if the two corresponding blocks in the clustering are adjacent to each other in G, i. e. block u(cid:48) and block v(cid:48) are connected by at least one edge. The weight of an edge (u(cid:48), v(cid:48)) is set to the sum of the weight of edges that run between block u(cid:48) and block v(cid:48) of the clustering. An example contraction is shown in Figure 4 in the appendix. Initial Layout. The process of computing a size-constrained clustering and contracting it is repeated recursively. Then an initial layout is drawn, meaning that each of the two nodes of the coarsest graph is assigned to a position. We place the vertices such that the distance is optimal. The optimal distance of the two vertices is defined and motivated in the next section. 3.2 Uncoarsening and Local Improvement When the initial layout has been computed, the solution is successively prolongated to the next finer level, where a local maxent-stress minimizer is used to improve the layout. For undoing the contraction, nodes that have been in a cluster are drawn at a random position around the location of its coarse representative. More precisely, let v be a (fine) vertex that is represented by the coarse supervertex v(cid:48) at P = (x, y). We place v at a random position in a circle around P with radius r :=(cid:112)c(v(cid:48)). We do this by picking an angle uniformly at random in [0, 2π] and a distance to P uniformly at random in [0, r]. These two values are then used as a polar coordinate for v with respect to the origin P . Local Improvement. Our local improvement tries to minimize the maxent-stress on each level of the hierarchy based on Eq. (2). Note, however, that simply iterating Eq. (2) on each level is not sensible since coarse vertices represent a multitude of vertices. These vertices need space to be drawn on the next finer level. Now let u and v be two vertices on the same fixed level. We adjust distances duv on the current level in the hierarchy under consideration to(cid:112)c(u) +(cid:112)c(v) with the intuition that vertices represented by u should be drawn in a circle around u with radius(cid:112)c(u) (similarly for v). As Gansner et al. [4], we adjust the value of α in Eq. (2) during the process. Since we want to approximate the maxent-stress, the value should be small. However, it cannot be too small initially since one would only solve a sparse stress model in this case. Hence, following Gansner et al. [4], we set α to one initially and gradually reduce it by α := 0.3 · α until αmin = 0.008 is reached. We call a single update step of the coordinates of all vertices using Eq. (2) an itera- tion. Multiple iterations with the same value of α are called round. The current iteration uses the coordinates that have been computed in the previous iteration. We perform at most a iterations with the same value of α in one round. Then we reduce α as described above. If the relative change x(cid:96)+1 − x(cid:96)/x(cid:96) in the layout is smaller than some threshold , we directly reduce the value of α and continue with the next round. Faster Local Improvement. The local optimization algorithm presented above has a theoretical running time of O(n2) per iteration. To speed this up, one can use approxi- mations for the distances in the entropy term in Eq. (2). We do this by taking the cluster structure computed during coarsening into account: Let V1∪. . .∪Vk be the correspond- ing clustering and M : V → V (cid:48) = {1, . . . , k} be the mapping that maps a node v ∈ V 6 to its coarse representative. The first term in Eq. (2) is computed as before and the sec- ond term is approximated by using the coordinates of the corresponding coarse vertex. As formula the second term written without the multiplicative factor α ρu becomes ν(v(cid:48)) xu − x(cid:48) v(cid:48) (cid:107)xu − x(cid:48) v(cid:48)(cid:107)2 − (cid:88) {u,v}∈E r(u, v), (3) (cid:88) (cid:88) r(u, v) + u(cid:54)=v M (u)=M (v) v(cid:48)∈V (cid:48) v(cid:48)(cid:54)=M (u) where x(cid:48) maps a coarse vertex to its coordinates and ν(v(cid:48)) is the number of nodes that the coarse vertex represents on the current finer level. Roughly speaking, we reduced the necessary amount of computation to add up the values of r by summing up the correct values of r for all vertices that are in a sense close and using approximations for vertices that are far away. In our context, a vertex is close if it is in the same cluster as the currently processed vertex. If a vertex is not close, we use the coordinate of its coarse representative instead. We avoid unnecessary computation by scaling the approximated value of r with the number ν(v(cid:48)) of vertices it represents and adding approximated value of r only once. The last term in Eq. (3) subtracts values of r for {u, v} ∈ E that have been added in good faith in the first two summations. Note that if M is the identity, then the term in Eq. (3) is the same as in the original Eq. 2. In this case the first two summations add up the r-values for all pairs of vertices and the last sum subtracts the r-values for pairs that are in E. After the update of the vertices on the current level, we update the coordinates of the vertices on the coarser level used for approximation. We set the coordinate of a vertex v(cid:48) on the coarser level to the weighted midpoint of the vertices represented by v(cid:48). Note that one obtains even faster algorithms by using a coarser version of the graph that is multiple levels beneath the current level in the graph hierarchy. That means in- stead of using the next coarser graph, we use the contracted graph which is h > 1 levels beneath the current graph in the hierarchy – if there is such. Otherwise, we use the coarsest graph in the hierarchy. Obviously this yields a trade-off between solution quality and running time. Also note that this introduces an additional error. To see this, let the coarser vertices that have the same coarse representative on the level used for approximating values of r be called M-vertices (merged vertices). Now, for a vertex on the current level, the r-values of M-vertices are not accounted for in Eq. (3). Hence, we look at the parameter h carefully in Section 4 and evaluate its impact on running time and solution quality. We call our algorithms MulMent and denote by MulMenth the algorithm that uses an h-level approximation of the r-values. With h if h = 0 we denote the quadratic-time algorithm. A rough analysis in Appendix B yields: Proposition 1. Under the assumption of equal cluster sizes, the running time of one iteration of algorithm MulMenth, h ≥ 0, is O(m + n h+1 ), respectively. h+2 Properly implemented, multilevel algorithms lead to fast convergence of their local optimizers. Moreover, the overall work performed by the multilevel approach is only a constant factor times the one on the finest level. This leads us to the initial appraisal that the same asymptotic running times may hold for the respective complete algorithms. 7 Shared-memory Parallelization. Our shared-memory parallelization of an iteration of the local optimizer uses OpenMP and works as follows: Since new coordinates of the vertices in the same iteration can be computed independently, we use multiple threads to do so. The relative change in the layout x(cid:96)+1 − x(cid:96)/x(cid:96) can be computed in parallel using a reduce operation. Parallelism is also used analogously when working on different levels for the distance approximations in the entropy term. Other parts of the overall algorithm could potentially be parallelized, too – such as coarsening. However, already on medium sized graphs coarsening consumes less than 5% of the algorithm’s overall running time. Moreover, the relative running time of coarsening decreases even more with increasing graph size so that the effort does not seem worth it. 4 Experimental Evaluation two metrics. The first metric is the full stress measure, F (x) = (cid:80) Methodology. We implemented2 the algorithm described above using C++. Paralleliza- tion of our algorithm has been done using OpenMP. We compiled our programs using g++ 4.9 -O3 and OpenMP 3.1. Executables for PivotMDS (PMDS) [8] and MaxEnt (GHN, for clarity we use the author names as acronym) [4] have been kindly provided by Yifan Hu. When comparing layouts computed by different algorithms, we evaluate u,v∈V wuv(xu − xv − duv)2, and the second one is the maxent-stress function M (x) as defined in Eq. (1) at the final penalty level of α = 0.008. The latter is of primary importance since that is what GHN and MulMent optimize for. The implementations PMDS and GHN sometimes compute vertices that are on the same position. Hence, we add small random noise to the coordinates of these layouts in order to be able to compute the maxent- stress. More precisely, for each of the components of the 2D-coordinate of a node, we randomly add or subtract a random value from the interval [10−7, 10−4]. This changes the full stress measure by less than 10−4 percent on average. We follow the methodol- ogy of Gansner et al. [4] and scale the layout of all algorithms to minimize the stress to u,v∈V wuv(sxu − xv − duv)2 be fair to all methods: We find a scalar s such that(cid:80) is minimized for a given layout x. Machine. Our machine has four Octa-Core Intel Xeon E5-4640 (Sandy Bridge) pro- cessors (32 cores, 64 with hyperthreading active) which run at a clock speed of 2.4 GHz. It has 512 GB local memory, 20 MB L3-Cache and 8x256 KB L2-Cache. Unless otherwise mentioned, our algorithms use all 64 cores (hyperthreading) of that machine. Since PMDS and GHN are sequential algorithms, they use one core of that machine. Algorithm Configuration. After an extensive evaluation of the parameters, we fixed the cluster coarsening parameters f to 20 and b to 2. The initial value of the penalty parameter α is set to 1. We perform at most a = 2 iterations with the same value of α, while it has not reached its minimum value of 0.008. When it has reached its minimum value, we iterate until the relative error x(cid:96)+1 − x(cid:96)/x(cid:96) is smaller than 0.0001. Yet, our experiments indicate that our algorithm is not very sensitive about the choice of these parameters. We evaluate the influence of the approximation level h in Section 4.1. 2 We will release the implementation of our algorithms as open source. 8 Instances. We use the instances 1138_bus, USpowerGrid, bcsstk31, commanche and luxembourg employed in [4] and extend the set to include larger instances. We excluded the graphs gd, qh882 and lp_ship04l from [4] from our experiments since the graphs are either not undirected or the corresponding matrix is rectangular. Most of the instances taken from [4] are available at the Florida Sparse Matrix Collection [23]. The graphs 3elt, bcsstk31, fe_pwt and auto are available at the Walshaw benchmark archive [24]. The graphs delX are Delaunay triangulations of 2X random points in the unit square [25]. Moreover, the graphs nyc and luxembourg are road networks. These graphs have been taken from the benchmark set of the 9th and 10th DIMACS Imple- mentation Challenge [26,27]. A summary of the basic properties of these instances can be found in Table 1 in the appendix. In any case, we draw the largest connected com- ponent if the graph has more than one. We assume unit length distance for all graphs. 4.1 Influence of Coarse Graph Approximation and Scalability In this section, we investigate the influence of the parameter h on layout quality and running time (algorithmic speedup) as well as the scalability of our algorithms with varying number of threads (parallel speedup). We perform detailed experiments on our medium sized networks (using 64 threads) and present parallel speedups on the largest graphs auto and del20. We report absolute running times and parallel speedups for the graphs auto and del20 in Figures 2 and 5 and present detailed data for the medium size networks in Table 2 in the appendix. We do not report layout quality metrics for auto and del20 since the size of the network makes it infeasible to compute them and the result of the algorithm is independent of the number of threads used. We now investigate the influence of the parameter h. In general, the larger the graphs get, the larger the algorithmic speedups obtained with increasing h. On the smallest graph in this collection, we obtain an algorithmic speedup of about 3 with h = 6 (fe_pwt) over MulMent0. On the largest two instances in this section, we obtain an algorithmic speedup of 30 with h = 9 (auto) and of 122 with h = 10 (del20). In addi- tion, the precise choice of the parameter does not seem to have a very large impact on solution quality on these graphs. This is also due to the size of the networks. As appar- ent from Tables 2 and 3 in the appendix, the graphs on which full stress measure slightly increases are luxembourg and bcsstk31 (7% and 15% respectively). The metric actually under consideration, maxent-stress, always remains comparable. On all instances under consideration, we observe a locally optimal value for h in terms of running time. It is around seven and seems to get larger with increasing graph size. This is due to the fact that too large values of h provide less precision and slower convergence. On del20, the scalability with the number of threads is almost perfect for small values of h. With enabled hyperthreading, we achieve slightly superlinear speedups for MulMent0. As less work has to be done for increasing h, speedups get smaller. The smallest speedup on this graph has been observed for MulMent10. In this case, we achieve a speedup of 11.5 using 64 threads over MulMent10 using one thread. With even larger h speedups increase again. The parallel scalability on auto is similar. Another interesting way to look at the data is the overall speedup – algorithmic and parallel speedup combined – achieved over MulMent0 using only one thread. The largest overall speedup is obtained by MulMent10 using 64 threads. In this case, the 9 Fig. 2. Running times and parallel speedups of our algorithms on del20. overall speedup is larger than 4000 – reducing the running time of the algorithm from 30 hours to 27 seconds. Speedups over PMDS and GHN are found in the next section. 4.2 Comparison to other Drawing Algorithms We now compare MulMent to the two implementations PMDS [8] and GHN [4]. We do this on all networks but only report quality metrics for small and medium sized graphs since it is infeasible to compute quality metrics for the large graphs. We report detailed data in Tables 3 and 4 in the appendix. Most importantly, although MulMent sometimes performs a few percent worse than GHN, the maxent-stress of all layouts is more or less similar. PMDS performs slightly worse in this metric. Intriguingly, the alternative full stress metric is consistently better on small networks for MulMent than the results obtained by PMDS (except for h = 10). On the other hand, full stress obtained by our algorithms is comparable to the layout computed by GHN on four out of nine instances. On the three largest medium sized networks, we obtain worse full stress than PMDS and GHN. However, this is not astonishing since our algorithm does not optimize for full stress – in contrast to PMDS. And GHN at least starts with a PMDS solution and improves maxent-stress afterwards. Our implementations of MulMent7,10 are always faster than GHN, both of them a factor 30 on average. Also, MulMent7,10 outperform even PMDS in terms of running time as soon as the graphs get large enough (medium and large sized graphs). On the large graphs, MulMent10 is a factor of 2 to 3 faster than PMDS and a factor of 32 to 63 faster than GHN. In addition, MulMent7,10 are also several times faster than GHN when using one thread only (see Appendix Table 5). 4.3 Dynamic Networks One of the main advantages of the iterative scheme is its ability to use an existing layout for computing a new one, e. g. for a graph that has changed over time. We perform experiments with dynamic graphs obtained by modifying our medium sized networks. Often one is interested in drawing graphs that have more or less good locality. Hence, we define a random model that modifies the edges of a graph by removing random edges and inserting edges between vertices that are not too far apart. To be more precise, we start with an input graph G and perform a breadth first search from a random start node to compute a random spanning tree. We then remove x% undirected non-tree edges at random in the beginning. Note that this ensures that 10 1021031041051061248163264total time [s]number of PEs pMulMent0MulMent1MulMent2MulMent3MulMent4MulMent5MulMent6MulMent7MulMent8MulMent9MulMent10MulMent11124816321248163264Spnumber of PEs pMulMent0MulMent1MulMent2MulMent3MulMent4MulMent5MulMent6MulMent7MulMent8MulMent9MulMent10MulMent11 the graph stays connected. Afterwards, we insert x% new edges as follows. We pick a random node and insert an undirected edge to a random node that has distance 1 < d ≤ D in the original graph G, where D is a tuning parameter. We denote the graph that results out of this process as Q. We compute two layouts of Q. The first one updates coordinates given by an initial layout of G (update algorithm). The second layout is computed by our algorithm from scratch (scratch algorithm), i. e. discarding the initial layout. In the first case, we start directly at the penalty level α = 0.008 and only update coordinates on the finest level of the hierarchy. We compute the graph hierarchy as before but stop the coarsening process after the computation of h levels. Coordinates of the vertices on the approximation level are set to the middle point of the vertices in the corresponding cluster initially. We vary x ∈ {1, 5}, D ∈ {2, 16} and h ∈ {0, 7}, and present detailed data in Table 6 in the appendix. As expected, the running time of the update algorithm (tdyn) is always smaller than the running time of the scratch algorithm (tscratch). As MulMent7 performs less work than MulMent0, algorithmic speedups are always larger for the latter. For h = 0, the update algorithm is a factor of 4 faster than the scratch algorithm on average. On the other hand, for h = 7 the update algorithm saves about 50% time on average over the scratch algorithm. Solution quality is not influenced much. On average, the full stress measure of the update algorithm is 9% larger and maxent-stress improves by 1% compared to the scratch algorithm. The increase in full stress is mostly due to the Delaunay instance and D = 16, in which the full stress of the layout of the update algorithm is a factor of two larger. The algorithmic speedup does not seem to be largely influenced by D. However, we expect that much larger values of D will decrease the speedup of the update algorithm over the scratch algorithm. 5 Conclusions We have presented a new multilevel algorithm for iteratively and approximatively opti- mizing the maxent-stress model, a model proposed by Gansner et al. [4] to avoid typical pitfalls of other stress models. From the experimental evaluation we conclude that our parallel algorithm produces layouts with similar visual quality and maxent-stress values as the reference implementation [4]. At the same time it is on average 30 times faster, even more for dynamic graphs. Moreover, our algorithm is even up to twice as fast as the fastest stress-based algorithm PivotMDS [8]. It thus combines the high speed of PivotMDS with the high visual quality of Maxent in a single algorithm, at least if a multicore system is available. Acknowledgements. Financial support by DFG is acknowledged (DFG grants ME 3619/3-1 and SA 933/10-1). We thank Yifan Hu for providing us the codes from [4]. References 1. Abello, J., van Ham, F., Krishnan, N.: ASK-GraphView: A large scale graph visualization system. IEEE Trans. Visualization and Computer Graphics 12(5) (2006) 669–676 2. Kirmani, S., Raghavan, P.: Scalable parallel graph partitioning. In: High Performance Com- puting, Networking, Storage and Analysis (SC’13), ACM (2013) 51:1–51:10 11 16. Walshaw, C.: A multilevel algorithm for force-directed graph-drawing. J. Graph Algorithms Processing Letters 31 (1989) 7–15 Appl. 7(3) (2003) 253–285 3. Gansner, E.R., Koren, Y., North, S.C.: Graph drawing by stress majorization. In: Graph Drawing (GD’04). Volume 3383 of LNCS., Springer (2005) 239–250 4. Gansner, E.R., Hu, Y., North, S.C.: A maxent-stress model for graph layout. IEEE Trans. Visualization and Computer Graphics 19(6) (2013) 927–940 5. Hoske, D., Lukarski, D., Meyerhenke, H., Wegner, M.: Is nearly-linear the same in theory and practice? A case study with a combinatorial laplacian solver. In: Experimental Algo- rithms (SEA 2015). LNCS, Springer (2015) to appear. 6. Koutis, I., Miller, G.L., Tolliver, D.: Combinatorial preconditioners and multilevel solvers for problems in computer vision and image processing. Computer Vision and Image Under- standing 115(12) (2011) 1638–1646 7. Livne, O.E., Brandt, A.: Lean algebraic multigrid (LAMG): fast graph Laplacian linear solver. SIAM J. Scientific Computing 34(4) (2012) 8. Brandes, U., Pich, C.: Eigensolver methods for progressive multidimensional scaling of large data. In: Graph Drawing (GD’06). Volume 4372 of LNCS., Springer (2007) 42–53 9. Hu, Y., Shi, L.: Visualizing large graphs. Wiley Int. Rev.: Comp. Stat. 7(2) (2015) 115–136 10. Kobourov, S.G.: Force-directed drawing algorithms. In: Handbook of Graph Drawing and Visualization. CRC Press (2013) 383–408 11. Eades, P.: A heuristic for graph drawing. Congressus numerantium 42 (1984) 146–160 12. Fruchterman, T.M.J., Reingold, E.M.: Graph drawing by force-directed placement. Soft- ware: Practice and experience 21(11) (1991) 1129–1164 13. Barnes, J., Hut, P.: A hierarchical O(n log n) force-calculation algorithm. Nature 324 (1986) 446–449 14. Kruskal, J.B.: Multidimensional scaling by optimizing goodness of fit to a nonmetric hy- pothesis. Psychometrika 29(1) (1964) 1–27 15. Kamada, T., Kawai, S.: An algorithm for drawing general undirected graphs. Information 17. Quigley, A., Eades, P.: FADE: Graph drawing, clustering, and visual abstraction. In Marks, J., ed.: Graph Drawing (GD’00). Volume 1984 of LNCS., Springer (2001) 197–210 18. Gajer, P., Kobourov, S.G.: GRIP: Graph drawing with intelligent placement. J. Graph Algo- rithms Appl. 6(3) (2002) 202–224 19. Frishman, Y., Tal, A.: Multi-level graph layout on the GPU. IEEE Trans. Visualization and Computer Graphics 13(6) (2007) 1310–1319 20. Ingram, S., Munzner, T., Olano, M.: Glimmer: Multilevel MDS on the GPU. IEEE Trans. Visualization and Computer Graphics 15(2) (2009) 249–261 21. Meyerhenke, H., Sanders, P., Schulz, C.: Partitioning Complex Networks via Size- In: Experimental Algorithms (SEA’14). Volume 8504 of LNCS, constrained Clustering. Springer (2014) 351–363 22. Raghavan, U.N., Albert, R., Kumara, S.: Near Linear Time Algorithm to Detect Community Structures in Large-Scale Networks. Physical Review E 76(3) (2007) 23. Davis, T.: The University of Florida Sparse Matrix Collection 24. Soper, A.J., Walshaw, C., Cross, M.: A Combined Evolutionary Search and Multilevel Opti- misation Approach to Graph-Partitioning. J. of Global Optimization 29(2) (2004) 225–241 25. Holtgrewe, M., Sanders, P., Schulz, C.: Engineering a Scalable High Quality Graph Parti- tioner. Parallel & Distributed Processing (IPDPS’10). IEEE (2010) 1–12 26. Demetrescu, C., Goldberg, A.V., Johnson, D.S.: The Shortest Path Problem: 9th DIMACS Implementation Challenge. Volume 74. AMS (2009) 27. Bader, D.A., Meyerhenke, H., Sanders, P., Schulz, C., Kappes, A., Wagner, D.: Benchmark- ing for Graph Clustering and Partitioning. In: Encyclopedia of Social Network Analysis and Mining, Springer (2014) 73–82 12 A Additional Figures → Fig. 3. An example round of the label propagation graph clustering algorithm. Initially each node is in its own block. The algorithm scans all vertices in a random order and moves a node to the block with the strongest connection in its neighborhood. Fig. 4. Contraction of a clustering (colors indicate cluster labels). Each cluster of the graph on the left corresponds to a node (= supervertex) in the graph on the right. Fig. 5. Running times and parallel speedups of our algorithms on auto. 13 Scan......101021031041051248163264total time [s]number of PEs pMulMent0MulMent1MulMent2MulMent3MulMent4MulMent5MulMent6MulMent7MulMent8MulMent9MulMent10MulMent11124816321248163264Spnumber of PEs pMulMent0MulMent1MulMent2MulMent3MulMent4MulMent5MulMent6MulMent7MulMent8MulMent9MulMent10MulMent11 B Running Time Proof Sketch √ We start with sketching the running time on the finest level of the hierarchy for h = 1. To simplify the analysis of our algorithm, we assume that our clustering algorithm always computes clusters of equal size, i. e. each cluster contains exactly c vertices. In this (admittedly not overly realistic case), there are n/c clusters. It is easy to see that we need O(d(v) + c + n/c) time to evaluate Eq. (3) for a vertex v. The optimal value n and can be found by simple analysis. Summing over all vertices, yields for c is O(m + n3/2) overall time per iteration. If we use the graph that is h levels beneath the current level for approximating r values, we need O(d(v) + c + n/ch) time to compute the new coordinate for a vertex v. Here we assume again that each cluster in the hierarchy contains c vertices. As before, h+1 . Summing over all vertices, a simple analysis yields that the optimal value for c is n yields O(m + n h+1 ) overall time. h+2 1 C Basic Properties of the Benchmark Set Table 1. Basic properties of the benchmark set with a rough type classification. graph btree 1138_bus USpowerGrid 3elt commanche bcsstk31 fe_pwt del16 luxembourg nyc auto del20 n m Small Graphs 1 023 1 138 4 941 4 960 7 920 1 022 1 358 6 594 13 722 11 880 Medium Graphs Type Ref. Binary Tree [23] Power System [23] US Power Grid [23] Airfoil [24] Helicopter [23] 35 586 36 519 65 536 114 599 572 913 Automobile Component [24] 144 794 Structural Problem [24] 196 575 Delaunay Triangulation [25] 119 666 Road Network [27] Large Graphs 264 346 365 050 448 695 3 314 611 Road Network [26] Automobile [24] 1 048 576 3 145 686 Delaunay Triangulation [25] 14 D Detailed Experimental Results F (x) M (x) t[s] h graph 31 507K −14 925K 5.69 0 bcsstk31 31 547K −14 921K 4.16 1 bcsstk31 31 887K −14 931K 2.77 2 bcsstk31 30 938K −14 935K 2.28 3 bcsstk31 31 449K −14 933K 2.01 4 bcsstk31 31 819K −14 921K 1.88 5 bcsstk31 31 894K −14 919K 1.81 6 bcsstk31 32 156K −14 912K 1.82 7 bcsstk31 33 574K −14 888K 1.88 8 bcsstk31 34 306K −14 877K 1.86 9 bcsstk31 35 316K −14 861K 1.86 10 bcsstk31 36 086K −14 850K 2.09 11 bcsstk31 51 501K −23 850K 4.44 0 fe_pwt 50 329K −23 867K 2.64 1 fe_pwt 50 926K −23 855K 1.67 2 fe_pwt 50 317K −23 864K 1.11 3 fe_pwt 49 620K −23 874K 0.88 4 fe_pwt 50 420K −23 861K 0.77 5 fe_pwt 50 927K −23 852K 0.69 6 fe_pwt 50 885K −23 850K 0.59 7 fe_pwt 49 889K −23 862K 0.68 8 fe_pwt 50 174K −23 857K 0.63 9 fe_pwt 49 464K −23 867K 0.74 10 fe_pwt 48 727K −23 879K 0.80 11 fe_pwt 716 997K −58 137K 13.76 0 del16 716 391K −58 146K 7.71 1 del16 724 073K −58 031K 4.40 2 del16 727 549K −57 980K 2.69 3 del16 728 283K −57 968K 1.95 4 del16 729 923K −57 940K 1.47 5 del16 733 832K −57 884K 1.14 6 del16 729 503K −57 948K 1.17 7 del16 725 548K −58 005K 0.96 8 del16 722 181K −58 052K 0.99 9 del16 718 768K −58 097K 1.20 10 del16 715 560K −58 138K 1.41 11 del16 0 luxembourg 503 465K −310 576K 41.02 1 luxembourg 502 360K −310 585K 22.86 2 luxembourg 501 632K −310 615K 12.64 3 luxembourg 502 340K −310 596K 6.85 4 luxembourg 498 744K −310 659K 4.04 5 luxembourg 505 175K −310 546K 2.46 6 luxembourg 518 992K −310 370K 1.73 7 luxembourg 521 771K −310 331K 1.35 8 luxembourg 528 333K −310 215K 1.24 9 luxembourg 534 015K −310 148K 1.25 10 luxembourg 537 286K −310 106K 1.48 11 luxembourg 539 427K −310 072K 2.01 Table 2. Influence of parameter h. Smaller values are better. F measures full stress, M measures maxent-stress. Values marked with a K are given in thousands. 15 −9 128 −9 086 −9 102 −9 110 −15M −24M −58M −15M −24M −64M −15M −24M −58M −15M −24M −61M −15M −24M −58M graph GHN MulMent0 MulMent1 MulMent2 MulMent7 MulMent10 PMDS −7 231 −9 134 −9 688 btree −10 973 −11 917 −11 312 −11 280 −11 223 −11 236 −11 226 1138_bus USpowerG −260 708 −265 352 −262 664 −262 597 −262 411 −262 067 −260 938 −276 808 −280 535 −280 004 −280 154 −280 169 −279 721 −276 893 3elt commanche −950 570 −954 624 −962 521 −962 851 −963 107 −956 300 −956 237 −15M −15M bcsstk31 −24M −24M fe_pwt −58M −58M del16 −310M luxembourg −313M −314M −310M −310M −311M −310M 85 786 85 916 btree 62 786 1138_bus 62 337 USpowerG 1 123 582 1 016 164 1 065 936 1 071 829 1 073 659 1 098 712 1 155 798 752 865 3elt 580 314 1 834 976 commanche 1 935 570 2 051 361 1 483 059 1 460 357 1 446 978 1 830 875 35M 32M bcsstk31 49M 51M fe_pwt del16 73M 72M luxembourg 54M 52M Table 3. Maxent stress M (x) (top) and full stress F (x) (bottom) for small and medium sized graphs. Smaller is better. Values marked with an M are in millions. PMDS and GHN use one core/thread, MulMent∗ use 32 cores (64 threads). Values with an marked with an M are shown in million. Recall that GHN and MulMent optimize for M (x). 32M 51M 72M 50M 33M 24M 27M 28M 636 240 581 770 580 001 568 919 562 558 32M 50M 72M 50M 32M 52M 72M 50M 136 070 77 834 63 721 44 822 31M 22M 50M 23M 86 285 60 364 87 099 60 631 87 478 64 323 graph btree 1138_bus USpowerG 3elt commanche bcsstk31 fe_pwt del16 luxembourg nyc auto del20 PMDS GHN MulMent0 MulMent1 MulMent2 MulMent7 MulMent10 0.02 0.11 1.14 0.04 1.41 0.11 0.14 0.18 3.82 0.16 0.17 3.45 0.24 0.18 5.42 3.44 48.48 1.82 1.49 0.66 31.60 2.86 1.10 61.42 3.10 1.39 96.10 3.70 9.03 233.94 41.80 665.67 20.70 27.01 53.80 1125.03 0.10 0.15 0.29 0.21 0.32 5.63 4.46 13.63 40.94 216.27 613.51 3303.82 0.17 0.13 0.23 0.19 0.27 3.97 2.67 7.75 22.87 119.33 329.08 1749.77 0.11 0.10 0.18 0.16 0.18 2.70 1.62 4.38 12.53 64.19 179.24 922.10 0.11 0.11 0.15 0.17 0.15 1.75 0.57 1.01 1.31 4.68 23.64 51.35 Table 4. Running times in seconds per graph. Smaller is better. PivotMDS and GHN use one thread (sequential codes), the MulMent∗ algorithms use 32 cores (64 threads). Running times of GHN are without the time of PMDS (which yields input coordinates to GHN). 16 graph btree 1138_bus USpowerG 3elt commanche bcsstk31 fe_pwt del16 luxembourg nyc auto del20 GHN MulMent7 MulMent10 PMDS 1.14 0.12 0.02 0.21 1.41 0.04 1.20 3.82 0.14 0.70 3.45 0.16 5.42 1.16 0.24 7.79 48.48 3.44 5.92 31.60 1.49 10.95 61.42 2.86 96.10 22.32 3.10 53.24 233.94 9.03 118.65 41.80 665.67 53.80 1125.03 310.29 0.07 0.10 0.30 0.18 0.49 4.41 2.62 6.35 16.51 78.34 207.37 1101.82 Table 5. Running times in seconds per graph. Smaller is better. All of the algorithms use one core. Running times of GHN are without the time of PMDS (which yields input coordinates to GHN). 17 FG(x) FQ(x) dyn FQ(x) scratch MG(x) MQ(x) dyn MQ(x) scratch h x D graph bcsstk31 31 514K 30 731K 0 1 2 bcsstk31 74 746K 30 731K 0 1 16 bcsstk31 30 680K 30 731K 0 5 2 bcsstk31 77 916K 30 731K 0 5 16 bcsstk31 33 517K 32 421K 7 1 2 bcsstk31 74 908K 32 421K 7 1 16 bcsstk31 32 638K 32 421K 7 5 2 bcsstk31 32 421K 78 223K 7 5 16 del16 0 1 2 668 857K 664 866K del16 0 1 16 668 857K 492 192K del16 0 5 2 668 857K 662 893K del16 0 5 16 668 857K 458 453K del16 7 1 2 657 691K 653 806K del16 7 1 16 657 691K 484 715K del16 7 5 2 657 691K 651 547K del16 7 5 16 657 691K 451 676K 51 015K fe_pwt 42 517K 0 1 2 51 015K fe_pwt 0 1 16 30 982K 51 015K fe_pwt 37 268K 0 5 2 51 015K fe_pwt 33 316K 0 5 16 49 563K fe_pwt 41 148K 7 1 2 49 563K fe_pwt 30 930K 7 1 16 49 563K 36 242K fe_pwt 7 5 2 49 563K fe_pwt 7 5 16 32 843K luxembourg 0 1 2 511 117K 522 212K luxembourg 0 1 16 511 117K 549 426K luxembourg 0 5 2 511 117K 788 036K luxembourg 0 5 16 511 117K 619 716K luxembourg 7 1 2 516 248K 526 999K luxembourg 7 1 16 516 248K 551 360K luxembourg 7 5 2 516 248K 789 014K luxembourg 7 5 16 516 248K 617 187K 32 867K −14 932K −13 914K 71 772K −14 932K −7 878K 32 271K −14 932K −13 123K 75 695K −14 932K −6 559K 32 888K −14 903K −13 882K 71 692K −14 903K −7 869K 31 702K −14 903K −13 092K 78 906K −14 903K −6 543K 737 076K −58 842K −58 687K 250 399K −58 842K −48 309K 701 075K −58 842K −57 787K 250 483K −58 842K −40 845K 728 689K −58 998K −58 841K 250 234K −58 998K −48 389K 715 301K −58 998K −57 946K 242 099K −58 998K −40 918K 40 472K −23 858K −23 283K 27 235K −23 858K −17 935K 38 068K −23 858K −22 543K 29 371K −23 858K −15 423K 38 419K −23 870K −23 295K 27 818K −23 870K −17 932K 36 014K −23 870K −22 551K 30 130K −23 870K −15 426K 526 761K −310 488K −311 406K 556 099K −310 488K −307 121K 881 315K −310 488K −318 330K 551 834K −310 488K −297 447K 546 575K −310 400K −311 324K 592 054K −310 400K −307 071K 883 948K −310 400K −318 323K 552 312K −310 400K −297 457K tG tdyn tscratch −13 896K 5.87 1.64 5.73 −7 975K 5.94 3.14 10.18 −13 098K 5.93 2.43 6.62 −6 649K 5.92 3.25 14.28 −13 894K 1.86 1.51 1.72 −7 975K 1.87 1.61 1.97 −13 098K 1.87 1.69 1.90 −6 565K 1.96 2.10 2.94 −57 623K 14.31 2.81 14.04 −51 443K 14.21 5.27 14.45 −57 234K 14.28 2.82 14.07 −43 516K 14.30 7.73 18.88 −57 746K 1.24 0.68 1.02 −51 455K 1.24 0.74 1.13 −57 015K 1.16 0.69 1.04 −43 650K 1.27 0.88 1.28 −23 305K 4.67 1.00 4.57 −17 985K 4.67 1.01 4.59 −22 530K 4.72 1.01 4.59 −15 477K 4.73 1.78 4.68 −23 328K 0.67 0.41 0.58 −17 974K 0.76 0.42 0.63 −22 551K 0.72 0.43 0.64 −15 473K 0.76 0.52 0.68 −311 292K 42.60 7.69 42.31 −307 076K 42.50 7.71 42.49 −317 828K 42.60 7.69 42.39 −298 532K 42.49 7.71 42.57 −311 045K 1.37 0.55 1.23 −306 588K 1.48 0.56 1.31 −317 740K 1.38 0.53 1.26 −298 503K 1.35 0.58 1.29 Table 6. Detailed per instances results for dynamic graph experiments. Smaller values are better. Values are given in thousands. F∗ measures full stress, M∗ measures maxent-stress, dyn refers to the algorithm that updates the given coordinates, scratch to the algorithm that discards the given coordinates and updates the layout. Running times are given in seconds. Values marked with a K are given in thousand. 18 E Additional Drawings Fig. 6. Drawings of the largest connected components of fe_pwt (LHS) and bcsstk31 (RHS). From top to bottom: PMDS, MaxEnt, MulMent 19 Fig. 7. Drawings of the largest connected components of commanche (LHS) and 3elt (RHS). From top to bottom: PMDS, MaxEnt, MulMent 20 Fig. 8. Drawings of the largest connected components of btree (LHS) and 1138_bus (RHS). From top to bottom: PMDS, MaxEnt, MulMent 21
1008.2849
2
1008
2010-09-06T10:41:11
Faster Radix Sort via Virtual Memory and Write-Combining
[ "cs.DS", "cs.PF" ]
Sorting algorithms are the deciding factor for the performance of common operations such as removal of duplicates or database sort-merge joins. This work focuses on 32-bit integer keys, optionally paired with a 32-bit value. We present a fast radix sorting algorithm that builds upon a microarchitecture-aware variant of counting sort. Taking advantage of virtual memory and making use of write-combining yields a per-pass throughput corresponding to at least 88 % of the system's peak memory bandwidth. Our implementation outperforms Intel's recently published radix sort by a factor of 1.5. It also compares favorably to the reported performance of an algorithm for Fermi GPUs when data-transfer overhead is included. These results indicate that scalar, bandwidth-sensitive sorting algorithms remain competitive on current architectures. Various other memory-intensive applications can benefit from the techniques described herein.
cs.DS
cs
Faster Radix Sort via Virtual Memory and Write-Combining Jan Wassenberg Fraunhofer IOSB Peter Sanders KIT [email protected] October 9, 2018 Abstract Sorting algorithms are the deciding factor for the per- formance of common operations such as removal of duplicates or database sort-merge joins. This work focuses on 32-bit integer keys, optionally paired with a 32-bit value. We present a fast radix sorting al- gorithm that builds upon a microarchitecture-aware variant of counting sort. Taking advantage of virtual memory and making use of write-combining yields a per-pass throughput corresponding to at least 88 % of the system's peak memory bandwidth. Our im- plementation outperforms Intel's recently published radix sort by a factor of 1.5. It also compares favorably to the reported performance of an al- gorithm for Fermi GPUs when data-transfer over- head is included. These results indicate that scalar, bandwidth-sensitive sorting algorithms remain com- petitive on current architectures. Various other memory-intensive applications can benefit from the techniques described herein. applications can often replace large records with a pointer or index [1]. The radix sort algorithm is com- monly used in such cases due to its O(N ) complex- ity. In this preliminary report, we show a 1.5-fold performance increase over results recently published by Intel [2]. The remaining sections are organized in a bottom- up fashion, with Section 2 dedicated to the basic real- ities of current and future microarchitectures that af- fect memory-intensive programs and motivate our ap- proach. We build upon this foundation in Section 3, showing how to speed up counting sort by taking advantage of virtual memory and write-combining. Section 4 applies this technique towards our main contribution, a novel variant of radix sort. The per- formance of our implementation is evaluated in Sec- tion 5. Bandwidth measurements indicate the per- pass throughput is nearly optimal for the given hard- ware. Its two CPUs outperform a Fermi GPU when accounting for data-transfer overhead. 1 Introduction 2 Software Write-Combining Sorting is a fundamental operation that is a time- critical component of various applications such as databases and search engines. The well-known lower bound of Ω(n·log n) for comparison-based algorithms no longer applies when special properties of the keys can be assumed. In this work, we focus on 32-bit integer keys, optionally paired with a 32-bit value (though larger sizes are possible). This simplifies the implementation without loss of generality, since We begin with a description of basic microarchitec- tural realities that are likely to have a serious impact on applications with numerous memory accesses, and show how to avoid performance penalties by means of Software Write-Combining. These topics are not new, but we believe they are often not adequately addressed. The first problem arises when writing items to mul- tiple streams. An ideal cache with at least as many 1 lines could exploit the writes' spatial locality and en- tirely avoid noncompulsory misses. However, perfect hit rates are not achievable in practice due to lim- ited ways of associativity a [3]. Since only a lines can be mapped to a cache set, any further alloca- tions from that set result in the eviction of one of the previous lines. If possible, applications should avoid writing to many different streams. Otherwise, the various write positions should map to different sets to avoid thrashing and conflict misses. For current L1 caches with a = 8 ways, size C = 32 KiB and lines of B = 64 bytes, there are S = C a·B = 64 sets, and bits [lg B, lg B + lg S) of the destination addresses should differ (e.g. by ensuring the write positions are not a multiple of S · B = 4 KiB apart). A second issue is provoked by a large number of write-only accesses. Even if an entire cache line is to be written, the previous destination memory must first be read into the cache. While the correspond- ing latency may be partially hidden via prefetching, the cache line allocations remain problematic due to capacity constraints and eviction policy. Instead of displacing write-only lines that are not accessed after having been filled, the widespread (pseudo-)Least- Recently-Used strategy displaces previously cached data due to their older timestamp. An attempt to avoid these evictions by explicitly invalidating cache lines (e.g. with the IA-32 CLFLUSH instruction) did not yield meaningful improvements. Instead, appli- cations should avoid 'cache pollution' by writing di- rectly to memory via non-temporal streaming stores. single memory accesses involve significant bus overhead. The architecture therefore combines neighboring non- temporal writes into a single burst transfer. How- ever, currently microarchitectures only provide four to ten write-combine (WC) buffers [4]. Non-temporal writes to multiple streams may force these buffers to be flushed to memory via 'partial writes' before they are full. The application can prevent this by making use of Software Write-Combining [5]. The data to be written is first placed into temporary buffers, which almost certainly reside in the cache because they are frequently accessed. When full, a buffer is copied to the actual destination via consecutive non-temporal writes, which are guaranteed to be combined into a This leads directly to the next concern: single burst transfer. This scheme avoids reading the destination mem- ory, which may incur relatively expensive Read-For- Ownership transactions and would only pollute the cache. It works around the limited number of WC buffers by using L1 cache lines for that purpose. In- terestingly, this is tantamount to direct software con- trol of the transparently managed cache. We recommend the use of such Software Write- Combining whenever a core's active write destina- tions outnumber its write-combine buffers. Fortu- nately, this can be done at a fairly high level, since only the buffer copying requires special vector loads and non-temporal stores (which are best expressed by the SSE2 intrinsics built into the major compilers). 3 Virtual-Memory Counting Sort We now review Counting Sort and describe an im- proved variant that makes use of virtual memory and write-combining. The naıve algorithm first generates a histogram of the N keys. After computing the prefix sum to yield the starting output location for each key, each value is written at its key's output position, which is sub- sequently incremented. Our first optimization goal is to avoid the initial counting pass. We could instead insert each value into a per-key container, e.g. a list of buckets. How- ever, this incurs some overhead for checking whether the current bucket is full. A large array of M pre- allocated buckets is more efficient, because items can simply be written to the next free position (c.f. Al- gorithm 1, introduced in [6]). This algorithm only Algorithm 1: Single-pass counting sort storage := ReserveAddressSpace(N · M ); for i := 0 to M do next [i] := i · N ; foreach key,value do storage [next [key]] := value; next [key] := next [key] + 1; writes and reads each item once, a feat that comes at 2 the price of N · M space. While this appears prob- lematic in the Random-Access-Machine model, it is easily handled by 64-bit CPUs with paged virtual memory. Physical memory is only mapped to pages when they are first accessed,1 thus reducing the ac- tual memory requirements to O(N + M · pageSize). The remainder of the initial allocation only occupies address space, of which multiple terabytes are avail- able on 64-bit systems. Having avoided the initial counting pass, we now show how to efficiently write values to storage us- ing the write-combining technique described in Sec- tion 2. Our implementation initializes the next point- ers to consecutive, naturally aligned, cache-line-sized buffers. A buffer is full when its (post-incremented) position is evenly divisible by its size. When that happens, an unrolled loop of non-temporal writes copies the buffer to its key's current output position within storage. These output positions are also stored in an array of pointers. 4 Radix Sort After a brief review of radix sorting, we introduce a new variant based on the virtual-memory counting sort described in Section 3. A radix sort successively examines D-bit 'digits' of the K-bit keys. They are characterized by the or- der in which digits are processed: starting at the Least Significant Digit (LSD), or Most Significant Digit (MSD). An MSD radix sort partitions the items accord- ing to the current digit, then recursively sorts the resulting buckets. While it no longer needs to move items whose previously seen key digits are unique, this is not especially helpful when the number of passes K/D is small. In fact, the overhead of man- aging numerous (nearly empty) buckets makes MSD radix sort less suited for relatively small N . By contrast, each iteration of the LSD variant par- 1Accesses to non-present pages result in a page fault excep- tion. The application receives such events via signals (POSIX) or Vectored Exception Handling (Microsoft Windows) and re- acts by committing memory, after which the faulting instruc- tion is repeated. Algorithm 2: Parallel Radix Sort parallel foreach item do d := Digit(item, 3); buckets3 [d] := buckets3 [d] ∪ {item}; Barrier; foreach i ∈ (cid:2)0, 2D(cid:1) do bucketSizes [i] := PPE buckets3 [i]; outputIndices := PrefixSum(bucketSizes); parallel foreach bucket3 ∈ buckets3 do foreach item ∈ bucket3 ∀ PE do d := Digit(item, 0); buckets0 [d] := buckets0 [d] ∪ {item}; foreach bucket0 ∈ buckets0 do foreach item ∈ bucket0 do d := Digit(item, 1); buckets1 [d] := buckets1 [d] ∪ {item}; d := Digit(item, 2); histogram2 [d] := histogram2 [d] + 1; foreach bucket1 ∈ buckets1 do foreach item ∈ bucket1 do d := Digit(item, 2); i := outputIndices [d] + histogram2 [d]; histogram2 [d] := histogram2 [d] + 1; output [i] := item; titions all items into buckets by the current key digit. Since buckets are not recursively split, their sizes are nearly equal (under the assumption of a uniform key distribution) and the sort is stable (preserving the original relative order of values with equal keys). However, this comes at the cost of more copying. To reduce this overhead and also parallel communi- cation, we make use of "reverse sorting" [7], in which one or more MSD passes partition the data into buck- ets, which are then locally sorted via LSD. This turns out to be even more advantageous for Non-Uniform Memory Access (NUMA) systems because each pro- cessor is responsible for writing a contiguous range of outputs, thus ensuring the OS allocates those pages from the processor's NUMA node [8]. Let us now examine the pseudocode of the radix sort (Algorithm 2), choosing K = 32 for brevity and D = 8 to allow extracting key digits without mask- ing. Each Processing Element (PE) first uses count- 3 ing sort to partition its items into local buckets by the MSD (digit = 3). Note that items consist of a key and value, which are adjacent in memory (ideally within a native 64-bit word, but larger combinations are pos- sible in our implementation via larger user-defined types). After all are finished, the output index of the first item of a given MSD is computed via prefix sum. Each PE is assigned a range of MSD values, sorting the buckets from all PEs for each value. Note that skewed MSD distributions cause load imbalance, which can be resolved by one or more additional re- cursive MSD passes (left for future work). The local sort entails K/D − 1 iterations in LSD order. The first copies the other PE's buckets into local mem- ory. Pass K/D − 1 also computes the histogram of the final digit. This allows writing directly to the output positions in the final pass. Note that three sets of buckets are required, which makes heavy use of virtual memory (3·2D·P E = 6144 times the input size). While 64-bit Linux grants each process 128 TiB address space, Windows limits this to 8 TiB, which means only about 1 GiB of inputs can be sorted. This restriction can be lifted when the key distribution is known and each bucket does not need to pre-allocate storage for all N items. We briefly discuss additional system-specific con- siderations. The radix 2D was motivated by easy access to each digit, but is also limited by the cache and TLB size. Because of the many required TLB entries, we map the buckets with small pages, for which the Intel i7 microarchitecture has 512 second- level TLB entries. To increase TLB coverage, we use large pages for the inputs. The working set consists of 2D buffers, buffer pointers, output positions, and 32- bit histogram counters. This fits in a 32 KiB L1 data cache if the software write-combine buffers are limited to a single 64-byte cache line. To avoid associativity and aliasing conflicts, these arrays are contiguous in memory. Interestingly, these optimizations do not de- tract from the readability of the source code. Knowl- edge of the microarchitecture can also be applied to- wards middle-level languages and enables principled design decisions. 4 5 Performance Evaluation We characterize the performance of our sorting implementation by its throughput, defined as N , t1−t0 where N = 64 Mi and t0 and t1 are the earliest and latest start and finish times reported by any thread. The test platform consists of dual W5580 CPUs (3.2 GHz, 48 GiB DDR3-1066 memory) running Windows XP x64. Our implementation is compiled with ICC 11.1.082 /Ox /Og /Oi /Ot /Qipo /GA /EHsc /MD /GS- /fp:fast=2 /GR- /Qopenmp /QaxSSE4.2 /Quse-intel-optimized-headers. For uniformly distributed 32-bit keys generated by the WELL512 algorithm [9] and no associated values, the basic algorithm ('VM only') reaches a throughput of 334 M/s, as shown in the second column of Table 1. When write-combining is enabled ('VM+WC'), performance nearly doubles to 621 M/s. Intel has reported 240 M/s for the same task and a single but identical CPU [2]. For a fair com- parison with our dual-CPU system, we double the given throughput, which assumes their algorithm is NUMA-aware, scales perfectly and is not running at a lower memory clock (since DDR3-1066 is at the lower end of currently available frequencies). We must also divide by the given speedup of 1.2 due to hyperthreads, since those are disabled on our ma- chine. This ('Intel x2') yields 400 M/s; the proposed algorithm is therefore more than 1.5 times as fast. A separate publication has also presented results [10] for the Many Integrated Cores architecture. The Knights Ferry processor provides 32 cores, each with 4 threads and 16-wide SIMD. The simulation ('KNF MIC') shows a throughput of 560 M/s. Our scalar implementation is currently 1.1 times as fast when running on 8 cores. Recently, a throughput of 1005 M/s was reported on a GTX 480 (Fermi) GPU [11]. However, this ex- cludes driver and data-transfer overhead. For ap- plications in which the data is generated and con- sumed by the CPU, we must include at least the time required to read and write data over the PCIe 2.0 bus. Assuming the peak per-direction band- width of 8 GB/s is reached, the aggregate through- put ('GPU+PCIe') is 501 M/s. Our implementation, running on two CPUs, therefore outperforms this al- gorithm on the current top-of-the-line GPU by a fac- tor of 1.24 despite lower transistor counts (2 · 731 M vs. 3000 M) and thermal design power (2 · 130 W vs. 275..300 W). Algorithm K=32,V=0 K=32, V=32 VM only Intel x2 GPU+PCIe KNF MIC VM+WC 334 400 501 560 621 203 307 303 (unknown) 430 Table 1: Throughputs [million items per second] for 32-bit keys and optional 32-bit values. Similar measurements and extrapolations for the case of 32-bit keys associated with V = 32-bit values are given in the third column of Table 1. Since the slowdown is less than a factor of two, the implemen- tations are at least partially limited by computation and not bandwidth. Intel's algorithm is more effi- cient in this regard, with only a 1.3-fold decrease vs. our factor of 1.4. The additional data transfers over PCIe render the GPU algorithm uncompetitive. To better characterize performance, we measured the exact traffic at each socket's memory controller. Since this information is not available from current profilers such as VTune (which use per-core perfor- mance counters), we have developed a small kernel- mode driver to provide access to the model-specific performance counters in the Intel i7 uncore2. Un- cached writes constitute the bulk of the write com- biners' memory traffic and are therefore of particular interest. They are apparently reported as Invalid-To- Exclusive transitions and can thus be counted as the total number of reads minus 'normal' reads [12]. We find that 2041 MiB are written, which corresponds to 64 Mi items · 8 bytes per item · 4 passes (slightly less because our final pass cannot use non-temporal writes when the output position is not aligned). Sur- prisingly, 2272 MiB are read. The cause of the ad- ditional 10 % is unknown and will be investigated in future work. However, we can provide a conservative estimate of the bandwidth utilization. Given the pure read and write bandwidths (38687 MB/s and 28200 MB/s) measured by RightMark [13], the minimum time required to read and write the items' 2048 MiB is 132 ms, which is 88 % of the total measured time. Since this calculation does not include write-to-read turnaround [14, p. 486], there is even less room for improvement than indicated. 6 Conclusion We have introduced improvements to counting sort and a novel variant of radix sort for integer key/value pairs. Bandwidth measurements indicate our algo- rithm's throughput is within 12 % of the theoreti- cal optimum for the given hardware. It outperforms the recently published results of Intel's radix sort by a factor of 1.5 and also outpaces a Fermi GPU when data transfer overhead is included. These re- sults indicate that scalar, bandwidth-sensitive sort- ing algorithms still have their place on current ar- chitectures. We believe the general software write- combining technique can provide similar speedups for other memory-intensive applications. References [1] P. Bohannon, P. McIlroy, and R. Rastogi. Main- memory index structures with fixed-size partial keys. In SIGMOD Conference, pages 163 -- 174, 2001. [2] N. Satish, C. Kim, J. Chhugani, A. Nguyen, V. Lee, D. Kim, and P. Dubey. Fast sort on CPUs and GPUs: a case for bandwidth oblivious SIMD sort. In A. Elmagarmid and D. Agrawal, editors, SIGMOD Conference, pages 351 -- 362. ACM, 2010. [3] Mehlhorn and Sanders. Scanning multiple se- quences via cache memory. Algorithmica, 35, 2003. 2The part of the socket not associated with a particular core. [4] Intel. Intel Architecture Software Developer Manual, 2010. System Programming Guide. 5 [5] Intel Corporation. Intel 64 and IA-32 Architec- tures Optimization Reference Manual, Novem- ber 2009. [6] J. Wassenberg, W. Middelmann, and P. Sanders. An Efficient Parallel Algo- rithm for Graph-Based Image Segmentation. http://algo2.iti.uni-karlsruhe.de/wassenberg/wassenberg09parallelSegmentation.pdf, June 2009. [7] D. Jimenez-Gonzalez, J. Navarro, Fast parallel and in-memory J. Larriba-Pey. 64-bit sorting. the 2001 International Conference on Supercomputing (15th ICS'01), pages 114 -- 122, Sorrento, Napoli, Italy, June 2001. ACM. In Proceedings of [8] D. an Mey and C. Terboven. Affinity Matters! OpenMP on Multicore and ccNUMA Architec- tures. In Parallel Computing: Architectures, Al- gorithms and Applications, volume 15, February 2008. [9] F. Panneton, P. L'Ecuyer, and M. Matsumoto. Improved long-period generators based on lin- ear recurrences modulo 2. ACM Transactions on Mathematical Software, 32, 2006. [10] N. Satish, C. Kim, J. Chhugani, A. Nguyen, V. Lee, D. Kim, and P. Dubey. Fast sort on CPUs, GPUs and intel MIC architectures. Tech- nical report, Intel, 2010. [11] D. Merrill and A. Grimshaw. Revisiting sort- ing for GPGPU stream architectures. Technical Report 3, University of Virginia, February 2010. [12] D. Levinthal. Performance Analysis Guide for Intel Core i7 Processor and Intel Xeon 5500 pro- cessors. Intel. [13] D. Besedin. RightMark Memory Analyzer. http://cpu.rightmark.org. Accessed 2009-01-09. [14] B Jacob S. Ng D. Wang. Memory systems: cache, DRAM, disk. Morgan Kaufmann, 2007. 6
1705.02044
1
1705
2017-05-04T23:11:11
A Survey of Shortest-Path Algorithms
[ "cs.DS" ]
A shortest-path algorithm finds a path containing the minimal cost between two vertices in a graph. A plethora of shortest-path algorithms is studied in the literature that span across multiple disciplines. This paper presents a survey of shortest-path algorithms based on a taxonomy that is introduced in the paper. One dimension of this taxonomy is the various flavors of the shortest-path problem. There is no one general algorithm that is capable of solving all variants of the shortest-path problem due to the space and time complexities associated with each algorithm. Other important dimensions of the taxonomy include whether the shortest-path algorithm operates over a static or a dynamic graph, whether the shortest-path algorithm produces exact or approximate answers, and whether the objective of the shortest-path algorithm is to achieve time-dependence or is to only be goal directed. This survey studies and classifies shortest-path algorithms according to the proposed taxonomy. The survey also presents the challenges and proposed solutions associated with each category in the taxonomy.
cs.DS
cs
A Survey of Shortest-Path Algorithms Amgad Madkour1, Walid G. Aref1, Faizan Ur Rehman2, Mohamed Abdur Rahman2, Saleh Basalamah2 1 Purdue University, West Lafayette, USA 2 Umm Al-Qura University, Makkah, KSA May 8, 2017 Abstract A shortest-path algorithm finds a path containing the minimal cost between two vertices in a graph. A plethora of shortest-path algorithms is studied in the literature that span across multiple disciplines. This paper presents a survey of shortest-path algorithms based on a taxonomy that is introduced in the paper. One dimension of this taxonomy is the various flavors of the shortest-path problem. There is no one general algorithm that is capable of solving all variants of the shortest-path problem due to the space and time complexities associated with each algorithm. Other important dimensions of the taxonomy include whether the shortest-path algorithm operates over a static or a dynamic graph, whether the shortest-path algorithm produces exact or approximate answers, and whether the objective of the shortest-path algorithm is to achieve time-dependence or is to only be goal directed. This survey studies and classifies shortest-path algorithms according to the proposed taxonomy. The survey also presents the challenges and proposed solutions associated with each category in the taxonomy. 1 Introduction The shortest-path problem is one of the well-studied topics in computer science, specifically in graph theory. An optimal shortest-path is one with the minimum length criteria from a source to a destination. There has been a surge of research in shortest-path algorithms due to the problem's numerous and diverse applications. These applications include network routing protocols, route planning, traffic control, path finding in social networks, computer games, and transportation systems, to count a few. There are various graph types that shortest-path algorithms consider. A general graph is a mathe- matical object consisting of vertices and edges. An aspatial graph contains vertices where their positions are not interpreted as locations in space. On the other hand, a spatial graph contains vertices that have locations through the edge's end-points. A planar graph is plotted in two dimensions with no edges crossing and with continuous edges that need not be straight. There are also various settings in which a shortest-path can be identified. For example, the graph can be static, where the vertices and the edges do not change over time. In contrast, a graph can be dynamic, where vertices and edges can be introduced, updated or deleted over time. The graph contains either directed or undirected edges. The weights over the edges can either be negative or non-negative weights. The values can be real or integer numbers. This relies on the type of problem being issued. The majority of shortest-path algorithms fall into two broad categories. The first category is single- source shortest-path (SSSP), where the objective is to find the shortest-paths from a single-source vertex to all other vertices. The second category is all-pairs shortest-path (APSP), where the objective is to find the shortest-paths between all pairs of vertices in a graph. The computation of shortest-path can generate either exact or approximate solutions. The choice of which algorithm to use depends on the characteristics of the graph and the required application. For example, approximate shortest-path algorithms objective is 2 TAXONOMY 2 to produce fast answers even in the presence of a large input graph. A special sub-graph, called a spanner, can also be created from the main graph that approximates the distances so that a shortest-path can be computed over that sub-graph. Given the large body of literature on algorithms for computing the shortest-path, the objective of this survey is to present a breakdown of these shortest-path algorithms through an appropriate taxonomy. The taxonomy aims to help researchers, practitioners, and application developers understand how each shortest-path algorithm works and to help them decide which type or category of shortest-path algorithms to use given a specific scenario or application domain. Figure 1 illustrates the proposed taxonomy where each branch describes a specific category of shortest-path problem. Figure 1: Taxonomy of Shortest-Path Algorithms 2 Taxonomy As in Figure 1, the proposed taxonomy classifies the various shortest-path algorithms into multiple high- level branches. The static branch in Figure 1 lists algorithms that operate over graphs with fixed weights for each edge. The weights can denote distance, travel time, cost, or any other weighting criteria. Given that the weights are fixed, some static algorithms perform precomputations over the graph. The algorithms 3 RELATED WORK 3 try to achieve a trade-off between the query time compared to the precomputation and storage require- ments. Static algorithms consists of two classical algorithms for shortest-path fall under the two main categories (1) Single-source shortest-path (SSSP), and (2) All-pairs shortest-path (APSP). The SSSP algorithms compute the shortest-path from a given vertex to all other vertices. The APSP algorithms compute the shortest-paths between all pairs of vertices in the graph. Hierarchical algorithms break the shortest-path problem into a linear complexity problem. This can lead to enhanced performance in computation by orders of magnitude. Goal-directed algorithms optimize in terms of distance or time toward the target solution. Distance oracle algorithms include a preprocessing step to speed up the shortest-path query time. Distance oracle algorithms can either be exact or approximate. The dynamic branch in Figure 1 lists algorithms that process update or query operations on a graph over time. The update operation can insert or delete edges from the graph, or update the edge weights. The query operation computes the distance between source and destination vertices. Dynamic algorithms include both (APSP) and (SSSP) algorithms. Time-dependent algorithms target graphs that change over time in a predictable fashion. Stochastic shortest-path algorithms capture the uncertainty associated with the edges by modeling them as random variables. Parametric shortest-path algorithms compute a solutions based on all values of a specific parameter. Replacement path algorithms computes a solution that avoids a specified edge, for every edge between the source vertex and the destination vertex. Replacement paths algorithms achieve good performance by reusing the computations of each edge it avoids. On the other hand, alternative path algorithms also computes a shortest path between vertices that avoids a specified edge. The distinguishing factor between both categories is that replacement paths are not required to indicate a specific vertex or edge. On the other hand, alternative shortest-paths avoids the specified edge on the shortest-path. The weighted-regions problem finds the approximate shortest-path on weighted planar divisions. 3 Related Work Zwick [140] survey adopts a theoretical stand-point with regards to the exact and approximate shortest paths algorithms. Zwick's survey addresses single-source shortest-path (SSSP), all pairs shortest-path (APSP), spanners (a weighted graph variation), and distance oracles. The survey illustrates the various variations that each category adopts when handling negative and non-negative edge weights as well as directed and undirected graphs. Sen [121] surveys approximate shortest-paths algorithms with a focus on spanners and distance oracles. Sen's survey discusses how spanners and distance oracles algorithms are constructed and their practical applicability over a static all-pairs shortest-paths setting. Sommer [125] surveys query processing algorithms that trade-off the index size and the query time. Sommer's survey also introduce the transportation network class of algorithms, and include algorithms for general graphs as well as planar and complex graphs. Many surveys focus on algorithms that target traffic applications, especially route planning methods. In such related work, a network denotes a graph. Holzer et al. [81] classify variations of Dijkstra's algorithm according to the adopted speedup approaches. Their survey emphasizes on techniques that guarantee correctness. It argues that the effectiveness of speed-up techniques highly relies on the type of data. In addition, the best speedup technique depends on the layout, memory and tolerable preprocessing time. In contrast to optimal shortest-path algorithms, Fu et al. [60] survey algorithms that target heuristic shortest-path algorithms to quickly identify the shortest-path. Heuristic algorithms aim is to minimize computation time. The survey proposes the main distinguishing features of heuristic algorithms as well as their computational costs. Goldberg [66] investigates the performance of point-to-point shortest- path algorithms over road networks from a theoretical standpoint. Goldberg reviews algorithms, e.g., Dijkstra and A∗, and illustrates heuristic techniques for computing the shortest-path given a subset of the graph. The survey proves the good worst-case and average-case bounds over a graph. Also, it discusses reach-based pruning and illustrates how all-pairs shortest-path algorithms can be altered to compute reaches while maintaining the same time bound as their original counterparts. Delling and Wagner [37] survey route planning speedup techniques over some shortest-path problems including dynamic and time- dependent variants. For example, the authors argue that shortcuts used in static networks cannot work in 4 PROBLEM DEFINITION 4 a time-dependent network. In essence, they investigate which networks can existing techniques be adopted to. Bast [11] illustrates speed-up techniques for fast routing between road networks and transportation networks. Bast's survey argues that the algorithms for both networks are different and require specialized speed-up techniques for each. Also, the survey presents how the speed-up technique performs against Dijkstra's algorithm. Moreover, the survey presents two open questions, namely, (1) how to achieve speed-up despite the lack of a hierarchy in transportation networks, and (2) how to efficiently compute local searches, e.g., as in neighborhoods. Demetrescu and Italiano [39] survey algorithms that investigate fully dynamic directed graphs with emphasis on dynamic shortest-paths and dynamic transitive closures. The survey focuses on defining the algebraic and combinatorial properties as well as tools for dynamic techniques. The survey tackles two important questions, namely whether dynamic shortest-paths achieve a space complexity of O(n2), and whether single-source shortest path algorithms in a fully-dynamic setting be solved efficiently over general graphs. Nannicini and Liberti [105] survey techniques for dynamic graph weights and dynamic graph topology. They list classical and recent techniques for finding trees and shortest-paths in large graphs with dynamic weights. They target two versions of the problem, namely, time-dependence, and what they refer to as cost updates of the weights. Dean's survey [35] focuses on time-dependent techniques in a dynamic setting. It surveys one special case, namely, the First-In-First-Out (FIFO) network as it exposes structural properties that allow for the development of efficient polynomial-time algorithms. This survey presents these aspects that are different from all its predecessors. First, it presents a taxonomy that can aid in identifying the appropriate algorithm to use given a specific setting. Second, for each branch of the taxonomy, the algorithms are presented in chronological order that captures the evolution of the specific ideas and algorithms over time. Moreover, our survey is more comprehensive. We cover more recent algorithms that have been invented after the publication of the other surveys. 4 Problem Definition Given a set of vertices V , a source vertex s, a destination vertex d, where s, d ∈ V , and a set of weighted edges E, over the set V , find the shortest-path between s and d that has the minimum weight. The input to the shortest-path algorithm is a graph G that consists of a set of vertices V and edges E. The graph is defined as G = (V, E). The edges can be directed or undirected. The edges have explicit weights, where a weight is defined as w(e), where e ∈ E, or unweighted, where the implicit weight is considered to be 1. When calculating the algorithm complexity, we refer to the size of the set of vertices V as n and the size of the set of edges E as m. 5 Static Shortest-Path Algorithms In this section, we review algorithms for both the single-source shortest-path (SSSP) and all-pairs shortest- path (APSP) problems. 5.1 Single-Source Shortest-Path (SSSP) Definition: Given a Graph G = (V, E) and Source s ∈ V , compute all distances δ(s, v), where v ∈ V . The simplest case for SSSP is when the graph is unweighted. Cormen et al. [34] suggest that breadth- first search can be simply employed by starting a scan from a root vertex and inspecting all the neighboring vertices. For each neighboring vertex, it probes the non-visited vertices until the path with the minimum number of edges from the source to the destination vertex is identified. 5 STATIC SHORTEST-PATH ALGORITHMS 5 Dijkstra's algorithm [42] solves the single source shortest-path (SSSP) problem from a given vertex to all other vertices in a graph. Dijkstra's algorithm is used over directed graphs with non-negative weights. The algorithm identifies two types of vertices: (1) Solved and (2) Unsolved vertices. It initially sets the source vertex as a solved vertex and checks all the other edges (through unsolved vertices) connected to the source vertex for shortest-paths to the destination. Once the algorithm identifies the shortest edge, it adds the corresponding vertex to the list of solved vertices. The algorithm iterates until all vertices are solved. Dijkstra's algorithm achieves a time complexity of O(n2). One advantage of the algorithm is that it does not need to investigate all edges. This is particularly useful when the weights on some of the edges are expensive. The disadvantage is that the algorithm deals only with non-negative weighted edges. Also, it applies only to static graphs. Dijkstra's algorithm performs a brute-force search in order to find the optimum shortest-path and as such is known to be a greedy algorithm. Dijkstra's algorithm follows a successive approximation procedure based on Bellman Ford's optimality principle [17]. This implies that Dijkstra's algorithm can solve the dynamic programming equation through a method called the reaching method [41, 123, 124]. The advantage of dynamic programming is that it avoids the brute-force search process by tackling the sub-problems. Dynamic programming algorithms probe an exponentially large set of solutions but avoids examining explicitly all possible solutions. The greedy and the dynamic programming versions of Dijkstra's algorithm are the same in terms of finding the optimal solution. However, the difference is that both may get different paths to the optimal solutions. Fredman and Tarjan [56] improve over Dijkstra's algorithm by using a Fibonnaci heap (F-heap). This implementation achieves O(nlogn + m) running time because the total incurred time for the heap operations is O(n log n + m) and the other operations cost O(n + m). Fredman and Willard [57–59] introduce an extension that includes an O(m+n log n/loglog n) variant of Dijkstra's algorithm through a structure termed the AF-Heap. The AF-Heap provides constant amortized costs for most heap operations and O(log n/loglog n) amortized cost for deletion. Driscoll and Gabow [47] propose a heap termed the relaxed Fibonacci heap. A relaxed heap is a binomial queue that allows heap order to be violated. The algorithm provides a parallel implementation of Dijkstra's algorithm. Another line of optimization is through improved priority queue implementations. Boas [23] and Boas et al. [24] implementations are based on a stratified binary tree. The proposed algorithm enables online manipulation of a priority queue. The algorithm has a processing time complexity of O(loglog n) and storage complexity of O(n loglog n). A study by Thorup [128] indicates the presence of an analogy between sorting and the SSSP problem, where SSSP is no harder than sorting edge weights. Thorup [128] describes a priority queue giving a complexity of O(loglog n) per operation and O(m loglog n) complexity for the SSSP problem. The study examines the complexity of using a priority queue given memory with arbitrary word size. Following the same analogy, Han [70] proposes a deterministic integer sorting algorithm in linear space that achieves a time complexity of O(m loglog n logloglog n) for the SSSP problem. The approach by Han [70] illustrates that sorting arbitrarily large numbers can be performed by sorting on very small integers. Thorup [129] proposes a deterministic linear space and time algorithm by building a hierarchical bucketing structure that avoids the sorting operation. A bucketing structure is a dynamic set into which an element can be inserted or deleted. The elements from the buckets can be picked in an unspecified manner as in a doubly-linked list. The algorithm by Thorup [129] works by traversing a component tree. Hagerup [69] improves over the algorithm of Thorup, achieving a time complexity of O(n + m log w), where w is the width of the machine word. This is done through a deterministic linear time and space algorithm. Bellman, Ford, and Moore [18,53,100] develop an SSSP algorithm that is capable of handling negative weights unlike Dijkstra's algorithm. It operates in a similar manner to Dijkstra's, where it attempts to compute the shortest-path but instead of selecting the shortest distance neighbor edges with shortest distance, it selects all the neighbor edges. Then, it proceeds in n − 1 cycles in order to guarantee that all changes have been propagated through the graph. While it provides a faster solution than Bellman- Ford's algorithm, Dijkstra's algorithm is unable to detect negative cycles or operate with negative weights. 5 STATIC SHORTEST-PATH ALGORITHMS 6 However, if there is a negative cycle, then there is no shortest-path that can be computed. The reason is due to the lower total weight incurred due to the traversal cycle. Bellman-Ford's algorithm achieves a run-time complexity of O(nm). Its strong points include the ability to operate on negative weights and detect negative cycles. However, the disadvantages include its slower run-time when compared to Dijkstra's algorithm. Also, Bellman-Ford's algorithm does not terminate when the iterations do not affect the graph weights any further. Karp [84] addresses the issue of whether a graph contains a negative cycle or not. He defines a concept termed minimum cycle mean and indicates that finding the minimum cycle mean is similar to finding the negative cycle. Karp's algorithm achieves a time complexity of O(nm). Yen [137] proposes two performance modifications over Bellman Ford, and Moore [18, 53, 100]. The first involves the relaxation of edges. An edge is relaxed if the value of the vertex has changes. The second modification is dividing the edges based on a linear ordering over all vertices. Then, the set of edges are partitioned into one or more subsets. This is followed by performing comparisons between the two sets according to the proposed partitioning scheme. A slight improvement to what Yen [137] proposes has been introduced by Bannister and Eppstein [10] where instead of using an arbitrary linear ordering, they use a random ordering. The result is fewer number of iterations over both subsets. 5.2 All-Pairs Shortest-Path (APSP) Definition: Given a graph G = (V, E), compute all distances between a source vertex s and a destination v, where s and v are elements of the set V . The most general case of APSP is a graph with non-negative edge weights. In this case, Dijkstra's algorithm can be computed separately for each vertex in the graph. The time complexity will be O(mn + n2logn) [83]. A vast number of algorithms has been proposed that handle real edge-weights for the all-pairs shortest- path problem. Floyd-Warshall algorithm [52, 134] tries to find all pairs shortest-paths (APSP) in a weighted graph containing positive and negative weighted edges. Their algorithm can detect the existence of negative-weight cycles but it does not resolve these cycles. The complexity of Floyd-Warshall algorithm is O(n3), where n is the number of vertices. The detection of negative-weight cycle is done by probing the diagonal path matrix. Floyd-Warshall algorithm cannot find the exact shortest-paths between vertices pairs because it does not store the intermediate vertices while calculating. However, using a simple update, one can store this information within the algorithm steps. The space complexity of the algorithm is O(n3). However, this space complexity can reach O(n2) by using a single displacement array. The strong point of the algorithm is that it can handle negative-weight edges and can detect negative-weight cycles. The main drawback though is that the timing complexity for running Dijkstra's algorithm on all vertices (to convert it from SSSP to APSP) will be O(mn + n2logn). This timing complexity is lower than O(n3) if and only if m < n2 (i.e., having a sparse graph). Many studies have been proposed better running time over Floyd-Warshall's algorithm on real-valued edge weights. A notable enhancement has been proposed by Fredman [55] that relies on a matrix-oriented approach. His approach relies on the theorem proposed by Aho and Hopcroft [5] the complexity of an N xN matrix multiplication using a min/plus multiplication approach is similar to that of shortest- paths. He shows that O(N 5/2) comparisons suffices to solve the all-pairs shortest-paths (APSP) problem. The algorithm achieves a complexity of O(n3(loglogn)/logn1/3). Table 1 summarizes the enhancements proposed for real-valued edges up to this date. Table 1: Algorithms and complexities for real-valued edges 5 STATIC SHORTEST-PATH ALGORITHMS 7 Time Complexity n3 Author [52, 134] n3(loglogn)/logn1/3 n3(loglogn/logn)1/2 n3/(logn)1/2 n3(loglogn/logn)5/7 n3loglogn/logn n3(loglogn)1/2/logn n3/logn) n3(loglogn/logn)5/4 n3(loglogn)3/(logn)2 n3(loglogn)/(logn)2 [55] [126] [45] [71] [127] [141] [27] [72] [28] [73] The best result by Han and Takaoka [73] achieve O(loglogn)2 reduction factor when compared to the result of [28]. Their approach focuses on the distance product computation. First, an nxn matrix js divided into m sub-matrices, each having nxn/m dimensions, where m is determined based on a specific criterion. Then, the algorithm proceeds in a series of matrix manipulations, index building, encoding, and partitioning steps until it reaches the proposed bound. The best non-negative edge weight complexity is O(n2logn) [98]. First, the algorithm sorts all adjacency lists in an increasing weight fashion. Then, it performs an SSSP computation n times and proceeds in iterations. In the first phase, it uses the notion of potential over the edges of vertices and selects and labels the edge with the minimum potential. Potential derived from the potential-model is defined as a probability distribution on complete directed graphs with arbitrary edge lengths that contain no negative cycles. The algorithm runs in two main phases, each with a specific invariant and has an O(n2logn) complexity. The best positive integer edge weight complexity is O(nω + c) [110], where ω < 2.575 is the exponent being proposed by Coppersmith and Winograd [33]. Their proposed algorithm provides a transition between the fastest exact and approximate shortest-paths algorithms with a linear error rate. The algorithm focuses on directed graphs with small positive integer weights in order to obtain additive approximations. The approximations are polynomial given the actual distance between pairs of vertices. 5.3 Distance Oracles Definition: Given a graph G = (V, E), a distance oracle encompasses a (1) data structure or index that undergoes preprocessing, and a (2) query algorithm. The term distance oracle has been proposed by Thorup and Zwick [132]. It proposes a faster alternative to the SSSP and APSP algorithms. This can be achieved by preprocessing the graph and creating an auxiliary data structure to answer queries. Distance oracle operates in two phases, namely, a preprocessing phase and a query phase. In the preprocessing phase, information such as data structures or indexes are computed. In contrast, the query processing phase processes queries efficiently using the outcome from the preprocessing phase. Distance oracles may return exact or approximate distances. A distance oracle provides an efficient trade-off between space (in terms of data structure or index storage) and query time. 5.3.1 Exact Distances Fakcharoenphol and Rao [51] propose an algorithm for planar graphs that balances the trade-off between preprocessing and query time. The preprocessing complexity for both space and time is O(n), and the run-time complexity is O(√n). Their proposed approach creates a non-planar graph given a subset of vertices followed by the computation of the shortest-path tree. First, the graph is divided into a set 5 STATIC SHORTEST-PATH ALGORITHMS 8 of bipartite graphs. The distance matrices of the bipartite graph need to comply with a non-crossing condition referred to as the Monge condition. The proposed result of O(√n) holds as long as the non- crossing condition is enforced. Klein et al. [88] propose a linear-space algorithm with a fast preprocessing complexity of O(nlog2n), over a directed planar graph. The graph can include both positive and negative edges. Given a planar directed graph G, and a source vertex, the algorithm finds a curve known as a Jordan curve. A Jordan curve C is identified if it passes through O(√n) vertices. A boundary vertex is one that passes through C. Cutting the graph and duplicating the boundary vertices creates subgraphs Gi. The algorithm passes through five stages: (1) recursively compute the distances from r within a graph where r is an arbitrary boundary vertex, (2) compute all distances between boundary vertices, (3) use a variant of Bellman-Ford to compute the graph distances from the boundary vertex r to all other boundary vertices, (4) use Dijkstra's algorithm to compute the graph distances from the boundary vertex r to all other vertices, (5) use Dijkstra's algorithm to compute graph distances from the source Vertix. This requires time of O(nlogn). Djidjev [44] proposes a faster query time algorithm and proves that for any S ∈ [n, n2], a distance oracle can have a space complexity during preprocessing of O(S), and query time complexity of O(n2/S). Djidjev's objective is to have an algorithm in which the product of preprocessing-space and query-time is not greater than those of SSSP and APSP problems. The proposed algorithm provides a complexity of O(√n) for any class of directed graphs where the separator theorem holds. Cabello [25] improves the preprocessing time, and provides a theoretical proof that, for any S ∈ [n4/3, n2], a distance oracle can have O(S) preprocessing space complexity, and O(n/√S) query time complexity. This is slower than the algorithm proposed by Djidjev [44] by a logarithmic factor but still covers a wider range of S. The proposed approach constructs a data structure between any pair of vertices that can answer distance-based queries. Then, the algorithm queries the data structure with those pairs. Wulff-Nilsen [135] proposes a constant query-time algorithm for unweighted graphs, and proves that for any S ∈ [(logn/loglogn)2, n2/5], a distance oracle can have a space complexity of o(n2). The algorithm relies on the Wiener index of a graph. The Weiner index defines the sum of distances between all pairs of vertices in a graph. The proposed technique shows the existence of subquadratic time algorithms for computing the Wiener index. Computing the Wiener index has the same complexity as computing the average vertex pairs distances. Henzinger et al. [78] propose a SSSP algorithm requiring O(n4/3log(nL)) time, where L is the absolute value of an edge with the smallest negative value. The proposed algorithm also achieves a similar bound for planar graphs and planar bipartite graphs. They also propose a parallel and dynamic variant of the algorithm. The key component of their approach is the use of graph-decompositions based on planar separators. Mozes and Sommer [101] propose an algorithm to answer distance queries between pairs of vertices in planar graphs with non-negative edge weights. They prove that, for any S ∈ [nloglogn, n2], a distance oracle can have O(S) preprocessing time complexity, and O(S) space complexity. Distance queries can be answered in O(n/√S). The graph can be preprocessed in O(n) and the generated data structure will have a size of O(nloglogc). The query time will be O(c) where C is a cycle with c = O(√n) vertices. 5.3.2 Approximate Distances Approximate distance oracles algorithms attempt to compute shortest-paths by querying only some of the distances. It is important to note that algorithms that deal with finite metric spaces produce only approximate answers. Some algorithms create spanners, where a spanner is a sparse sub-graph that approximates the original graph. They can be regarded as a spanning tree that maintains the locality aspects of the graph. These locality aspects defines a stretch where a stretch is a multiplicative factor 5 STATIC SHORTEST-PATH ALGORITHMS 9 that indicates the amount distances increase in the graph. The stretch is a result of utilizing the spanner edges only [48]. Other algorithms approximate distances by triangulation using a concept called landmark or bea- con [125] that is selected by random sampling, where each vertex stores distances to all landmarks. Note that given the definition of approximate distance oracles, the actual shortest-path is still not guaranteed to be retrieved. Zwick [139] presents an APSP algorithm for directed graphs that utilizes a matrix multiplication where the approximate distance is computed in O((nω/ǫ)log(W/ǫ), where ǫ > 0 for any ǫ. They define the stretch as 1 + ǫ and W represents the largest weighted edge identified in the graph. Aingworth et al. [7] propose an APSP algorithm for undirected graphs with unweighted edges that does not adopt a matrix multiplication approach. A trade-off of not using fast matrix multiplication is a small additive error. They propose two algorithms; one that achieves an additive error of 2 in time O(n2.5√log n). They also provide an estimate of graph paths and distances in O(n5/2(log n)1/2) and another 2/3-approximation algorithm that achieves a query time of O(m(n log n)1/2). Dor et al. [46] improve on previous surplus results by proposing an APSP algorithm that computes the surplus 2 estimate in O(n3/2m1/2). They also show that, for any k, a surplus 2(k-1) estimate takes O(kn2−1/km1/k) to be computed. Their work relies on the one main observation that there is a set of vertices that represent vertices with high degree value. In other words, a set of vertices X is said to represent a set of Y if all vertices in X have a neighbor in Y . Cohen and Zwick [32] improve the work proposed by Dor et al. [46] for weighted undirected graphs by proposing an algorithm that computes the surplus 2 estimate of all distances in O(n3/2m1/2) and 3 estimate in O(n2). They show that finding the estimated distances between all-pairs in directed graphs is a hard problem, similar to the Boolean Matrix multiplication. This makes their proposed approximation algorithm only valid for undirected graphs. Their algorithm relies on two important aspects: partitioning of the graph with the assumption that it is directed and the use of an SSSP algorithm, e.g., Dijkstra's. Patrascu and Roditty [108] further improve the stretch bound of intermediate vertices on the expense of increasing the space requirements and achieve O(n2/3). This approach defines the notion of balls, defined as B, where balls around each vertex grow geometrically and stop based on a specific criteria. Given the vertices s and t, the worst-case happens when the balls do not intersect. Agarwal et al. [4] also propose a 2 estimate approach that can be implemented in a distributed fashion. The approach is mainly meant for compact routing protocols. It aims to characterize the space and time trade-off for approximate distance queries in sparse graphs. For both approaches above (i.e., [108] and [4]), the space versus query time trade-off depends on the number of edges. For spanners, Elkin and Peleg [48] propose a general (1 + ǫ, β)-spanner with space complexity of O(βn1+1/k), where β = β(κ, ǫ) is a constant when κ and ǫ are also constants. They claim that the stretch and spanners can be minimized in a simultaneous evaluation fashion. Baswana and Sen [13] propose a spanner with a (2k − 1) stretch that can be computed in O(km) and with a size of O(kn1+1/k), where k > 1. They provide a theoretical proof that a spanner with a (2k − 1) stretch can be computed without distance computation in linear time through a novel clustering technique. The proposed approach can take O(k) rounds. Each round explores an adjacency vertex list in order to determine the edges that need to be removed. The advantage of this approach is its applicability to various computational environments, e.g., the synchronous distributed model, the external memory model, and the CRCW PRAM model. For planar graphs, Thorup [130] proposes an (1 + ǫ)-approximate distance oracle. This approach provides a constant number of shortest-paths through separators in contrast to Lipton et al. [92]. For each vertex, it stores the shortest-path distances to a set of O(1/ǫ) landmarks per level. This process is performed recursively for O(logn) levels. 5 STATIC SHORTEST-PATH ALGORITHMS 10 Kawarabayashi et al. [86] propose a planar graph algorithm that provides tunable trade-offs, where a polylogarithmic query time can be achieved while maintaining a linear space requirement with respect to the graph size. The proposed approach achieves a preprocessing time complexity of O(nlog2n) and query time of O(ǫ−2log2n). It achieves faster running time than Thorup's approach that computes a set C of connections that covers all vertices of a graph with every vertex containing O(ǫ−1) connections [130]. In contrast, only a subset of vertices is covered using Kawarabayashi et al. approach. The approach is O(ǫ−1) times the number of paths in space complexity. For complex networks, Chen et al. [30] proposes a distance oracle over random power-law graphs [6] with 3 estimate that has a space complexity of O(n4/3). Their approach adopts the distance oracle proposed by Thorup and Zwick [132], where they use high-degree vertices as landmarks. The adaptation includes selecting vertices with the highest degree as landmarks. It encodes the shortest-paths in the vertex labels. 5.4 Goal-Directed Shortest-Paths A goal-directed shortest-path search algorithm is based on adding annotations to vertices or edges of the graph that consist of additional information. This information allows the algorithm to determine which part of the graph to prune in the search space. 5.4.1 Simple Goal-Directed Search Hart et al. [74] propose a simple goal-directed algorithm, termed A∗. The algorithm proposes a heuristic approach in finding the shortest-path. Unlike Dijkstra's algorithm, A∗ is an informed algorithm, where it searches the routes that lead to the A∗ final goal. A∗ is an optimal best-first-search greedy algorithm. But what sets A∗ aside from other algorithms is its ability to maintain the distance it traveled into account. A∗ always finds the shortest-path if an admissible heuristic function is used. The strong point of the algorithm is that it is meant to be faster than Dijkstra since it explores less number of vertices. On the downside, if A∗ does not use a good heuristic method, it will not reach the shortest-path. Some of the variants of the A∗ algorithm use landmarks and other techniques in order to achieve better performance than A∗ under various setups. Goldberg and Werneck [67] propose a preprocessing phase where initially a number of landmarks are selected followed by the computation of the shortest-path where it is stored between the vertices of all these landmarks. They propose a constant-time lower-bound technique using the computed distances in addition to the triangle inequality property. The lower-bound technique is based on the A∗ algorithm, the landmark chosen, and the triangle inequality. Gutman [68] offers a comparable solution to the problem, where his work is based on the concept of reach. Gutman's technique relies on storing a reach value and the Euclidean coordinates of all vertices. The advantage of Gutman's approach is that it can be combined with the A∗ algorithm when compared to the work by Goldberg and Werneck [67], Gutman's [68] outperforms their proposed technique given one landmark while it performs worse given sixteen landmarks. On the downside, Gutman's approach depends on domain-specific assumptions, longer preprocessing complexity, and inapplicability in a dynamic setting. Potamias et al. [109] propose an approximate landmark-based technique for point-to-point distance estimation over large networks. A theoretical proof is presented to indicate that the problem is NP-Hard and they propose heuristic solutions. In specific, they propose a smart landmark selection technique that can yield higher accuracy, reaching 250 times less space than selecting landmarks at random. Among their evaluated strategies, the Centrality is more robust than the Degree strategy. Also, strategies based on partitioning, e.g., Border/P exhibit better computational cost across datasets. Kleinberg et al. [89] propose an algorithm with provable performance guarantees for beacon-based tri- angulation and embedding. The beacon-based algorithms are basically designed for triangulation, where 5 STATIC SHORTEST-PATH ALGORITHMS 11 they use the triangle inequality to deduce the unmeasured distances. They indicate that a multiplicative error of 1 + δ on a 1 − ǫ fraction of distances can be achieved by triangulation-based reconstruction given a constant number of beacons. The algorithm also achieves a constant distortion over 1 − ǫ of distances. Maue2009 et al. [95] claim that Dijkstra's algorithm can be enhanced by precomputing the shortest- path distances. They propose to partition the graph into k non-overlapping clusters and perform two operations; (1) store the start and end point, (2) store the shortest connection between each pair of clusters. The proposed algorithm achieves a speed-up scaling factor of √k in contrast to Dijkstra's algorithm. 5.4.2 Advanced Goal-Directed Search Edge labels is an approach that relies on precomputing the information for an edge e and vertices M . The superset M (e) represents all the vertices on a shortest-path that start with an edge e. The graph is first partitioned into a set of regions of the same size alongside a precomputed set of boundary vertices. In order to compute the edge flags, an SSSP computation is done on the regions for all the boundary vertices. Various work, e.g., Kohler et al. [90], Schulz et al. [119], and Lauther [91] further present some of the edge-label variations. Mohring et al. [99] propose an algorithm for sparse directed graphs with non-negative edge weights, termed the arc-flag approach. The arc-flag approach preprocesses graph data to generate information that speeds up shortest-path queries by dividing the graph into regions and determining if an arc in a specific region lies on the shortest-path. Given a suitable partitioning scheme and a bi-directed search, the arc-flag approach 500 times faster than the standard Dijkstra's algorithm over a large graph. Schilling et al. [116] present a further improvement by searching once for each region. Their approach achieves speed-up of more than 1,470 on a subnetwork of 1 million vertices. Goldberg and Werneck [67] propose an A∗ based search Landmarks (ALT) algorithm that uses the triangle inequality. They show that precomputing the distances to a set of landmarks can bound the shortest path computational cost. They propose an average of 20 landmarks that are well-distributed over the corners of the graph. In turn, their approach leads to speed up for route planning. Bauer et al. [16] study how to systematically combine speed-up techniques proposed for Dijkstra's algorithm, e.g., adding goal-direction approaches to hierarchical approaches. They present generalized technique that demonstrates how speed-up performance can be improved. Their results show that High- way vertex Routing and Arc-Flags achieves the best speed-up while maintaining an adequate prepro- cessing cost. They also present a hierarchical A∗-based search Landmarks (ALT) algorithm on dense graphs. Delling et al. [36] present an algorithm termed round-based public transit router (RAPTOR). RAP- TOR is not based on Dijkstra's algorithm as it probes each route in the graph at most once. RAPTOR works in fully dynamic scenarios and can be extended to handle, for example, flexible departure times. Bauer and Delling [15] uses hierarchical based techniques to extend the edge flag approach, e.g., using contraction hierarchies during preprocessing, and hence tackling a main processing drawback of edge flags. The proposed work is termed (Shortcuts + Arc-Flags) or SHARC, for short. The key observation about SHARC is that it is enough to set sub-optimal edge flags to most edges, and this focuses the preprocessing on important edges only. Another observation is that SHARC incorporates hierarchical aspects implicitly. SHARC also extends the edge flag approach of Mohring et al. [99] to achieve a fast unidirectional query algorithm. Maue et al. [95] propose a goal-directed algorithm that utilizes precomputed cluster distances (PCD). The proposed approach first partitions the graph into clusters. This is followed by precomputing the shortest connections between the pairs of clusters U and V . PCDs produce bounding factors for distances that can be used to prune the search when compared with the A∗ algorithm. In turn, this achieves a 5 STATIC SHORTEST-PATH ALGORITHMS 12 speed-up comparable to ALT while using less space. 5.5 Hierarchical Shortest-Path Hierarchical shortest-path algorithms deal with generating a multi-layered vertex hierarchy in the pre- processing stage. A hierarchical structure is prominent in areas, e.g., road networks, where it exhibits hierarchical properties, e.g., ordering important streets, motorways, and urban streets [117]. In general, methods using contraction hierarchies provide low space complexity. Contraction hierar- chies contain many variants such as reach-based methods and highway hierarchies and vertex routing. On the other hand, Transit-vertex Routing and Hub Labels provide fast query-time [125]. The following sections discuss various algorithms that follow a hierarchical approach. 5.5.1 Highway Hierarchies Highway Hierarchies capture edge-based properties. For example, highway edges exhibit a better repre- sentation for shortest paths although they may not be located between the source and the destination vertices. The algorithm generates a hierarchy of graphs that enables fast query time with correctness guarantees. Sanders and Schultes [113, 114] propose a static undirected highway hierarchies algorithm around the notion of correctly defining local search and highway network appropriately. They define local search as one that visits H (tuning parameter) closest vertices from the source or target. A highway edge is created if it lies on the path from the source vertex to the destination vertex with that edge not being within the H closest vertices from the source or destination. Nannixini et al. [103] propose an algorithm that relies on time-dependent lengths. They extend the original algorithm by Sanders and Schultes [113] to the case of directed graphs. Their aim is to find the fastest paths on a large dynamic road network that have quasi real-time updates. 5.5.2 Contraction Hierarchies A contraction hierarchy has a level for each vertex reaching up to n levels. Hierarchical models can improve query performance as search can be conducted in an upwards manner only over the graph. This reduced the space complexity as edges are stored at their lower endpoints only. Geisberger et al. [62] propose contraction hierarchies, where vertices are initially ordered by impor- tance, and then a hierarchy is generated by contracting the least important vertices in an iterative manner. Contracting is the process of replacing the shortest-paths passing a vertex by what they call shortcuts. They propose a hierarchical algorithm that utilizes a bidirectional shortest-path search technique. Batz et al. [14] propose a time-dependent version of the algorithm. It tackles time-dependent road net- works where it proposes a fast and exact route planning algorithm. The issue it faces is space complexity. They tackle this problem by using approximations of piecewise-linear functions that lead to significant space reduction while preserving correctness. The proposed approach relies on approximating shortcuts and non-shortcuts to acquire time-dependent edge weights. Then, these weights can then be used with their bidirectional search algorithm to create a corridor of shortcuts that can be searched. Kieritzcite et al. [87] propose a distributed memory parallelization of time-dependent contraction hierarchies. The algorithm identifies vertices that can be contracted in every iteration. Parallelization is achieved when each process contracts its vertices independently and the vertices contractions do not overlap with each other. They attempt to approximate the ordering of the sequential algorithms used. 5 STATIC SHORTEST-PATH ALGORITHMS 13 Geisberger et al. [63] devise an algorithm based on contraction hierarchies to calculate continent-based shortest-paths. The preprocessing step relies on the hierarchical properties of road networks in order to add shortcut edges. They use a modified version of Dijkstra's algorithm that visits only a few hundred vertices that in turn makes it suitable to implement on mobile devices. 5.5.3 Multi-Level Graphs In a multi-level overlay graph, if a set of vertices lie at a specific level, then the shortest-paths in that level do not use vertex from the upper levels. In turn, this method depends on the correct selection of vertices to act as landmarks on the higher levels. Schulz et al. [120] propose a multi-level graph-based decomposition method that targets space reduc- tion. This method precomputed the shortest-paths and replaces the weights of single edges with a weight equal to the shortest-path length. The result is a subgraph that is smaller in size when compared with the original graph. The subgraph distances between a set of vertices is the same as the shortest-path graph distance between the same set of vertices in the original graph. Holzer et al. [80] introduce several vertex selection criteria on overlay graphs. These include criteria to determine a representative subset of the original graph. They investigate the criteria's effectiveness over multilevel overlay graphs and the speed-up achieved for shortest-path computation. 5.5.4 Transit vertex Routing Transit vertex routing precomputed the shortest paths to and from all landmarks identified in a graph. The algorithm requires extensive preprocessing but exhibits very fast query time as it requires a limited number of look-ups between landmarks located in different locations. Bast et al. [12] propose transit vertex routing. They suggest that a vertical and horizontal sweep are sufficient to compute the set of transit vertices. They also illustrate some techniques to make the approach more space-efficient. Arz et al. [8] propose a variant of contraction hierarchies that achieves an order of magnitude speeds up , similar to the time needed to find contraction hierarchies. They propose a graph-theoretical locality filter that does not affect the query time. 5.5.5 Hub Labeling Modeling road networks as a low-dimensional graph is a method used for computing the shortest paths. One method used for such modeling is the process of labeling. Algorithms for labeling have been intro- duced in the distributed computing field [61, 132]. In the labeling preprocessing stage, each vertex v is computed and assigned a forward label and a reverse label. The forward label encompasses a set of vertices w, where each vertex contains a computed distance dist(v, w) from v. The reverse label consists of a set of vertices u, where each vertex contains a computed distance dist(u, v) to v. These labels are later used in the query stage to determine the vertices that minimize the distance from source to destination. A label can be perceived as a set of hubs that a vertex v has a direct connection to. The labeling algorithm ensures that any two vertices have one hub in common when computing the shortest path. Hub labeling starts by preprocessing the vertices, where, for each vertex v, it precomputes the distance to a set of landmarks L(v) in the vertex label. The query algorithm is fast as long as the number of landmarks of the source and destination vertices is small. Storing the labels in a consecutive manner allows the algorithm to exhibit good locality. Abraham and Delling [1, 2] propose a labeling scheme that, given a vertex s and t, it considers the 6 DYNAMIC SHORTEST-PATH ALGORITHMS 14 sets of vertices visited by the forward contraction hierarchy from s and the reverse contraction hierarchy of t. The contraction hierarchies algorithm computes for the shortest-path the intersection of the forward and reverse sets that contain the maximum-rank vertex. Babenko et al. [9] propose an approximation algorithm for producing small labels. Their main target is to reduce the size of the maximum hub-label. This reduction process leads to unbalanced solutions as vertices will have a skewed label sizes. They propose an approximation algorithm for the maximum label size that runs in O(logn). The proposed approach reduces the the hub-labeling problem to a set-covering problem. Cohen et al. [31] propose a data structure for storing the reachability label using a 2-hops cover of all the paths in a graph. Each vertex vǫV precomputes the Label Lin and Lout ⊆ V such that, for any pair s and t, at least one vertex is in Lout(s) T Lin(t). The distance labeling query finds the shortest-path from source s to destination t by finding the minimum distance from (Lout(s), x) to (x, Lin(t)) for each label xǫ(Lout(s) T Lin(t)). The size of a label L is not guaranteed and the polynomial preprocessing time is approximately O(logn) for finding a 2-hop cover of the invariant paths whose size is larger than the set of all shortest-paths. Chang et al. [29] propose a multi-hop distance labeling with a size smaller than another 2-hop labeling approach [31]. In the preprocessing phase, the algorithm stores a parent function P that assigns the parent vertex to each vertex by avoiding the preprocessing of the all-pairs shortest-path. The proposed approach performs vertex separation on the graph G that divides G into multiple connected subgraphs. The graph is further decomposed into a minimal tree T (I, F ), where I ⊂ V represents the set of vertices and F is the set of edges. The approach uses the distance query to compute the minimum distance. The time complexity of query processing is O(tw ∗ h), where tw represents the width and h represents the height of the decomposed tree T . 5.5.6 Highway Node Routing The motivation behind using highway node routing is that prominent vertices that overlap various shortest-paths will generate sparse overlay graphs. The result would be faster query processing and lower space overhead. Schultes and Sanders [118] proposes a dynamic algorithm that is space-efficient and allows query time to be thousand times faster when compared to Dijkstra's algorithm. The choice of vertices is achieved by capitalizing on previous results in addition to using the required vertex sets defined by highway hierarchies algorithms. They simplify the complications of computation into the prepreprocessing step. This also leads to simplification of the query processing algorithm, especially the dynamic variants. Abraham [3] suggests that road networks do not necessarily have a significant highway dimension. The proposed algorithm relies on realizing balls of a specific radius r. For every r > 0, there exits a sparse set Sr where shortest-path of length more than r will have a vertex from the set Sr. If every ball having radius O(r) contains less number of vertices than Sr, then the set Sr is sparse. 6 Dynamic Shortest-Path Algorithms The main requirement of dynamic shortest-path algorithms is to process updates and query operations efficiently in an online fashion. In the update operation, edges are inserted or deleted from the graph. In the query operation, the distance between vertices is computed. Fully dynamic algorithms are those that can process insertions and deletions. Incremental algorithms can process insert operations, but not delete operations. Decremental algorithms can process delete operations, but not insert operations. This implies that incremental and decremental algorithms are 6 DYNAMIC SHORTEST-PATH ALGORITHMS 15 partially dynamic. The following section illustrates the algorithms that demonstrate the aforementioned differences. 6.1 All-Pairs Shortest-Path (APSP) The all-pairs shortest-paths algorithms reports the distances between any two vertices in a graph. The algorithms attempt to answer distance queries between any two vertices while dynamically maintaining changes that can occur to the graph such as inserts, deletes, and updates. Demetrescu and Italiano [38] propose a fully dynamic algorithm over directed graphs for all-pairs shortest-paths with real-valued edge weights. Every edge can have a predefined number of values. Their algorithm achieves an amortized time complexity of O(Sn2.5log3n) for update operations while achieving an optimal worst-case for query processing time. The proposed algorithm for the update operation inserts or deletes a vertex in addition to all its possible edges. The algorithm also maintains a complete distance matrix between updates. Thorup [131] improves over Demetrescu and Italiano [38] by reducing the fully-dynamic graph problem to a smaller set of decremental problems. Thorup adopts the idea of a fully-dynamic minimum spanning tree by utilizing the efficiency of the decremental algorithm to solve the fully-dynamic all-pairs shortest- paths problem. Bernstein [19] presents a (2 + ǫ)-approximation algorithm for APSP over an undirected graph with positive edge weights. Bernstein's algorithm achieves an update time that is almost linear and a query time of O(loglogn). The proposed query algorithm is deterministic while the update procedure is random- ized. The algorithm run-time behavior depends on the distance from the source vertex to the destination vertex. Since d(x, y) is not known beforehand, the algorithm relies on guessing several different values for d(x, y). Roditty and Zwick [111] propose a fully dynamic APSP algorithm for unweighted directed graphs. The algorithm is randomized and the correctness of the returned results are claimed to be high. The proposed algorithm passes through a set of phases that rely on the ideas of a decremental algorithm [77]. They demonstrate how the incremental and decremental versions of the SSSP problems are similar in terms of complexity to the the static all-pairs shortest-paths problem over directed or undirected graphs Bernstein [21] proposes an (1 + ǫ) approximate algorithm that improves over existing studies with respect to the delete operation and edge weight increase. The algorithm computes the decremental all-pairs shortest-paths on weighted graphs. The approach achieves an update time of o(mn2) using a randomized algorithm. Henzinger et al. [75] enhances over the fastest deterministic algorithm by Shiloach and Even [122] by achieving an update time of O(n5/2). It also achieves a constant query time. Also, they propose a deterministic algorithm with with an update time of O(mn) and a query time of O(loglogn). They introduce two techniques, namely a lazy Even-Shiloach tree algorithm. The proposed approach maintains a shortest-paths tree that is bounded by distance with a Even-Shiloach tree based de-randomization technique. 6.2 Single-Source Shortest-Path The single-source shortest-paths algorithm reports the distances from a given source vertex. The dynamic algorithm computes the update and query operations in an online fashion. The update operation inserts, deletes, or modify the edge's weight. The query operation probes for the distance from the source vertex to a given target vertex. Fakcharoenphol and Rao [51] propose an algorithm for planar graphs with real-valued edge weights. 7 TIME-DEPENDENT SHORTEST-PATH ALGORITHMS 16 It achieves a time complexity of O(nlog3n). It performs update and query operations in O(n4/5log13/5n) amortized time. The proposed algorithm uses Monge matrices [26] with a combination of Bellman-Ford and Dijkstra's algorithms for searching in sub-linear time. Bernstein and Roditty [22] propose a dynamic shortest-paths algorithm that can achieve an update time better than O(n) without sacrificing query time. In specific, they obtain O(n2+o(1)) total update time and constant query time. The main type of graphs that it can achieve this result on is moderately sparse graphs. Bernstein and Roditty propose two randomized decremental algorithms that operate over unweighted, undirected graph for two approximate shortest-path problems. Henzinger et al. [76] improve the update operation time of Bernstein and Roditty [22] to O(n1.8+o(1) + m1+o(1)) while maintaining a constant query time. The algorithm utilizes the center-cover data structure where, given a parameter h and a constant γ, maintains O(h) vertices, referred to as centers. The main property of the center-cover data structure is that every vertex within a specific distance is in a tree termed Even-Shiloach tree (ES-tree). The proposed algorithm has the same property of the center-cover data structure and is fastest when h is moderately small. 7 Time-Dependent Shortest-Path Algorithms A time-dependent shortest-path algorithm processes graphs that have edges associated with a function, known as an edge-delay function. The edge-delay function indicates how much time is needed to travel from one vertex to another vertex. The query operation probes for the the minimum-travel-time path from the source to the destination vertex over graph. The returned result represents the best departure time found in a given time interval. 7.1 Continuous-Time Algorithms Kanoulas et al. [82] propose an algorithm that finds a set of all fastest paths from source to destination given a specified time interval. The specified interval is defined by the user and represents the departure or arrival time. The query algorithm finds a partitioning scheme for the time interval and creates a set of sub-intervals where each sub-interval is assigned to a set of fastest paths. Unlike the A∗ algorithm, the proposed algorithm probes the graph only once instead of multiple times. Ding et al. [43] propose an algorithm that finds the departure time that minimizes the travel time over a road network. Also, the traffic conditions are dynamically changing in the road network. The algorithm is capable of operating on a variety of time-dependent graphs. George et al. [64, 65] propose a Time-Aggregated Graph (TAG) graph that changes its topology with time. In TAG, vertices and edges are modeled as time series. Apart from time dependence, it is also responsible for managing the edges and vertices that are absent during any instance in time. They propose two algorithms to compute shortest-path using time-aggregated network (SP-TAG) and best start-time shortest-path (BEST). SP-TAG finds the shortest-path at the time of given query using a greedy algorithm. On the other hand, BEST algorithm finds out the best start-time (i.e., earliest travel time) over the entire period using TAG. The time complexity of SP-TAG and BEST are O(e(logT +logn), and O(n2eT ), respectively, where e represents edges, n represents vertices, and T represents the time instance. Ding et al. [43] propose an algorithm for the shortest-path problem over a large time-dependent graph GT. Each edge has a delay function that denotes the time taken from the source vertex to the destination vertex at a given time. The user queries the least travel time (LTT). The proposed algorithm achieves a space complexity of O((n + m)α(T )) and a time complexity of O((nlogn + m)α(T )). 8 STOCHASTIC SHORTEST-PATH ALGORITHMS 17 7.2 Discrete-Time Algorithms Nannicini et al. [104] propose a bidirectional A∗ algorithm that restricts the A∗ search to a set of vertices that are defined by a time-independent algorithm. The bidirectional A∗ algorithm operates in two modes, where the first mode, namely theforward search algorithm, is run on the graph weighted by a specific cost function while the second mode, namely the backward search, is run on the graph weighted by a lower-bound function. Delling and Wagner [37] reanalyzes various time-dependent technique. The concluded that the most of the techniques that operate over time-dependent graphs guarantee correctness by augmenting the preprocessing and query phases subroutines. Foschini et al. [54] study the computational complexity of the shortest-paths problem over time- dependent graphs. They conclude that linear edge-cost functions causes the shortest path to the desti- nation changes nθ(logn) times. They study the complexity of the arrival time by mapping the problem to a parametric shortest-paths problem in order for it to be analyzed correctly. Demiryurek et al. [40] propose a technique to speed-up the fastest-path computation over time- dependent spatial graphs. They propose a technique based on the A∗ bidirectional time-dependent algorithm that operates in two main stages. The first stage is pre-computation, where it partitions the graph into a set of partitions that do not overlap. Next, they calculate a lower-bound distance label for vertices and borders. The second state is online, where it probes for the fastest path by utilizing a heuris- tic function based on the computed distance labels. The results indicate that the proposed technique decreases the computation time and reduces the storage complexity significantly. 8 Stochastic Shortest-Path Algorithms A stochastic shortest-path attempts to capture the uncertainty associated with the edges by modeling them as random variables. Then, the objective becomes to compute the shortest-paths based on the minimum expected costs. The two notable lines of research in this problem are adaptive and non- adaptive algorithms. The adaptive algorithms determine what the next best next hop would be based on the current graph at a certain time instance. The non-adaptive algorithms focus on minimizing the length of the path. 8.1 Adaptive Algorithms Miller-Hooks and Mahmassani [96] propose an algorithm to determine the apriori least-expected-time- paths from all source vertices to a single destination vertex. This computation is for done for each departure time during busy time of the graph. They also propose a lower-bound over these apriori least-expected-time-paths. Nikolova et al. [107] propose an algorithm that maximizes the probability without exceeding a specific threshold for the shortest-paths length. They define a probabilistic model where edge weights are drawn from a known probability distribution. The optimal path is the one with the maximum probability indicating a path that does not pass a specific threshold. 8.2 Non-Adaptive Algorithms Loui [93] proposes using a utility function with the length of the path, where the utility function is monotone and non-decreasing. When the utility function exhibits a linear or an exponential behavior, it 9 PARAMETRIC SHORTEST-PATH ALGORITHMS 18 becomes separable into the edge lengths. This allows the utility function to be identified using classical shortest-paths algorithms via paths that maximize the utility function. Nikolova et al. [106] propose an algorithm for optimal route planning under uncertainty. They define the target as a function of both the path length and the departure time starting from the source. They indicate that path and start time are jointly optimizable due to the penalizing behavior that they exhibit for late and early arrivals. They also indicated that this joint optimization is reducible to classic shortest- path algorithms. 9 Parametric Shortest-Path Algorithms Parametric shortest-paths objective is to compute the shortest-paths for all vertices based on a specific parameter. It probes for the parameter values known as breakpoints where the shortest-path tends to change. The edge value varies based on a linear function of the parameter value. Mulmuley and Shah [102] propose a model for lower-bound computation. It is a variant of the Parallel Random Access Machine. The proof starts with a lower-bound definition about the parametric complexity of the shortest-path problem. Plotting the weights of the shortest-path as a function results in an optimal cost graph that is piecewise-linear and concave. Breakpoints are defined as a fixed set of linear weight functions over a fixed graph. Young et al. [138] propose a model where the computed edge values makes it more tractable than its predecessors. This tractability allows obtaining shortest-paths in polynomial time. They use the algorithm proposed by Karp and Orlin [85] and modify it to use Fibonacci heaps instead in order to improve its performance. Erickson [50] proposes an algorithm for computing the maximum flow in planar graphs. The algorithm maintains three structures, namely an edge spanning tree, a predecessor dual vertex set, and the slack value of dual edge set. They compute the initial predecessor pointers and slacks in O(nlogn) using Dijkstra's algorithm. 10 Replacement Shortest-Path Algorithms Consider a Graph G = (V, E), where V is the set of vertices and E is the set of edges. For every Edge e ε E on the shortest-path from source s ε V to destination d ε V , the replacement path algorithm calculates the shortest-path from s to d that avoids e. Emek et al. [49] propose an algorithm that computes the replacement path in near-linear time. The algorithm requires O(nlog3n) time during the preprocessing stage and O(hloglogn) time to answer the replacement path query, where h is the number of hops in a weighted planar directed graph. Roditty and Zwick [112] propose a Monte-Carlo randomized algorithm that computes the replacement path in an unweighted directed graph. The run-time complexity of the algorithm is O(m√n). The Monte Carlo algorithm improves the run-time of the k-simple shortest-path and Vickrey pricing problems [79] by a factor of √n. Bernstein [20] proposes an approximate (1 + ǫ) replacement-path algorithm that computes the paths in O(ǫ−1log2n(m + nlog(nC/c)(m + nlogn)) = O(mlog(nC/c)/ǫ) time, where C/c is the ratio of largest and smallest edge-weights in the graph. Bernstein's algorithm achieves a running time of O(km√n) when applied over the k-th simple shortest-paths problem. 11 ALTERNATIVE SHORTEST-PATH ALGORITHMS 19 11 Alternative Shortest-Path Algorithms The alternative shortest-path problem reports paths that avoid a given vertex or edge, termed the un- wanted vertex or the unwanted edge. The key difference between the replacement-path and the alternative shortest-path is that the user is not required to specify the unwanted vertex or edge for replacement paths. The goal of the alternative path problem is reusing the previously computed results of the unwanted ver- tex or edge. In turn, this achieves better performance. Existing algorithms, e.g., all-pairs dynamic shortest-paths, do not solve the alternative shortest-path problem because of the high complexity of the update operation. Xie et al. [136] propose a storage schemed, termed iSPQF. It is an extension of the shortest-path quad-tree [115] that further reduces the number of quad-trees at each vertex. The space complexity of the shortest-path quad-tree into forest (SPQF) is O(n1.5). The SPQF algorithm can find the alternative shortest-path over a single source (from source s to destination d that avoids Vertex v) as well as all pairs (from set of sources X to set of destinations Y that avoid Vertex v) in O(n) time-complexity. 12 Weighted Region Shortest-Path Algorithms Mitchell and Papadimitriou [97] define the Weighted Region Problem (WRP) as a generalization of the two-dimensional shortest path problem with obstacles. The problem assumes that the plane is subdivided into weighted polygonal regions. The objective is to minimize the cost according to a weighted Euclidean metric. The study by Mitchell and Papadimitriou sheds light on the discriminating properties of the weighted region problem over planar divisions and proposes an algorithm that runs in O(n8L), where n is the number of vertices and L is the number of bits required to encode the problem instance. In specific, L = O(log(nN W/ǫW )), where N is the maximum integer representing vertices of the triangulation, and ǫ > 0 is a user-specified error value that can be tolerated. Mata and Mitchell [94] propose an algorithm to compute the approximate optimal-path for the weighted planar subdivision problem by constructing a sparse graph, termed the path-net. The ap- proach uses Snell's law of Refraction [133] to divide the vertices into cones that bound the path of a vertex. The worst-case complexity to build the path-net graph with O(kn) vertices is O(kn3), where k is the number of cones. After being scanned, it produces the paths that are within a factor of (1 + ǫ) from the optimal solution. 13 Conclusion In this paper, we devise a taxonomy for the shortest-path problem. For each branch of the taxonomy, we illustrate the discriminating features and highlight the state-of-the-art research. The taxonomy provides investigators of the shortest-path problem with a guideline on where a required problem definition maps within the current related work. Acknowledgements Walid G. Aref's research has been supported in part by the National Science Foundation under Grant IIS 1117766. REFERENCES References 20 [1] I. Abraham and D. Delling. A hub-based labeling algorithm for shortest paths in road net- works. Experimental Algorithms, 2011. [2] I. Abraham, D. Delling, A. Goldberg, and R. Werneck. Hierarchical hub labelings for shortest paths. AlgorithmsESA 2012, 2012. [3] I. Abraham, A. Fiat, A. V. Goldberg, and R. F. Werneck. Highway dimension, shortest paths, and provably efficient algorithms. Proceedings of the Twenty-First Annual ACM-SIAM Symposium on Discrete Algorithms, pages 782–793, 2010. [4] R. Agarwal, P. B. Godfrey, and S. Har-Peled. Approximate distance queries and compact routing in sparse graphs. IEEE INFOCOM, pages 1754–1762, 2011. [5] A. V. Aho and J. E. Hopcroft. The Design and Analysis of Computer Algorithms. Addison- Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1st edition, 1974. [6] W. Aiello, F. Chung, and L. Lu. A random graph model for massive graphs. STOC, 2000. [7] D. Aingworth, C. Chekuri, and R. Motwani. Fast Estimation of Diameter and Shortest Paths (without matrix multiplication). SODA, pages 547–553, 1996. [8] J. Arz, D. Luxen, and P. Sanders. Transit Node Routing Reconsidered. SEA, 2013. [9] M. Babenko, A. Goldberg, A. Gupta, and V. Nagarajan. Algorithms for hub label optimiza- tion. Automata, Languages, and Programming, 2013. [10] M. J. Bannister and D. Eppstein. Randomized Speedup of the Bellman-Ford Algorithm. ANALCO, 2011. [11] H. Bast. Car or public transport two worlds. Efficient Algorithms, pages 355–367, 2009. [12] H. Bast, S. Funke, D. Matijevic, P. Sanders, and D. Schultes. In Transit to Constant Time Shortest-Path Queries in Road Networks. ALENEX, 2007. [13] S. Baswana and S. Sen. A simple and linear time randomized algorithm for computing sparse spanners in weighted graphs. Random Structures and Algorithms, pages 532–563, 2007. [14] G. Batz, R. Geisberger, S. Neubauer, and P. Sanders. Time-dependent contraction hierarchies and approximation. Experimental Algorithms, pages 166–177, 2010. [15] R. Bauer and D. Delling. SHARC: Fast and robust unidirectional routing. Journal of Exper- imental Algorithmics (JEA), 2009. [16] R. Bauer, D. Delling, P. Sanders, D. Schieferdecker, D. Schultes, and D. Wagner. Combin- ing hierarchical and goal-directed speed-up techniques for dijkstra's algorithm. Journal of Experimental Algorithmics, pages 303–318, 2010. [17] R. Bellman. Dynamic Programming. Princeton University Press, 1957. [18] R. Bellman. On a routing problem. Quarterly of Applied Mathematics, 1958. [19] A. Bernstein. Fully Dynamic (2 + epsilon) Approximate All-Pairs Shortest Paths with Fast Query and Close to Linear Update Time. 2009 50th Annual IEEE Symposium on Foundations of Computer Science, pages 693–702, 2009. [20] A. Bernstein. A Nearly Optimal Algorithm for Approximating Replacement Paths and k Shortest Simple Paths in General Graphs. Proceedings of the Twenty-First Annual ACM- Siam Symposium on Discrete Algorithms, pages 742–755, 2010. REFERENCES 21 [21] A. Bernstein. Maintaining shortest paths under deletions in weighted directed graphs. STOC, page 725, 2013. [22] A. Bernstein and L. Roditty. Improved dynamic algorithms for maintaining approximate shortest paths under deletions. ACM-SIAM Symposium on Discrete Algorithms, pages 1355– 1365, 2011. [23] P. v. E. Boas. Preserving order in a forest in less than logarithmic time. pages 75–84, 1975. [24] P. v. E. Boas, R. Kaas, and E. Zijlstra. Design and implementation of an efficient priority queue. Mathematical Systems Theory, pages 99–127, 1976. [25] S. Cabello. Many distances in planar graphs. Algorithmica, pages 361–381, 2012. [26] K. Cechlrov and P. Szab. On the monge property of matrices. Discrete Mathematics, 81(2):123 – 128, 1990. [27] T. M. Chan. All-pairs shortest paths for unweighted undirected graphs in o(mn) time. Proceed- ings of the seventeenth annual ACM-SIAM symposium on Discrete algorithm, pages 514–523, 2006. [28] T. M. Chan. More algorithms for all-pairs shortest paths in weighted graphs. Proceedings of the thirty-ninth annual ACM symposium on Theory of computing, pages 590–598, 2007. [29] L. Chang, J. X. Yu, L. Qin, H. Cheng, and M. Qiao. The exact distance to destination in undirected world. The VLDB Journal, 21(6):869–888, 2012. [30] W. Chen, C. Sommer, S.-H. Teng, and Y. Wang. A compact routing scheme and approximate distance oracle for power-law graphs. ACM Transactions on Algorithms, pages 1–26, 2012. [31] E. Cohen, E. Halperin, H. Kaplan, and U. Zwick. Reachability and Distance Queries via 2-Hop Labels. SIAM Journal on Computing, 32:1338–1355, 2003. [32] E. Cohen and U. Zwick. All-Pairs Small-Stretch Paths. Journal of Algorithms, pages 335–353, 2001. [33] D. Coppersmith and S. Winograd. Matrix multiplication via arithmetic progressions. Journal of Symbolic Computation, pages 251 – 280, 1990. [34] T. H. Cormen, C. Stein, R. L. Rivest, and C. E. Leiserson. Introduction to Algorithms. McGraw-Hill Higher Education, 2nd edition, 2001. [35] B. Dean. Shortest paths in FIFO time-dependent networks: Theory and algorithms. Rapport technique, 2004. [36] D. Delling, T. Pajor, and R. Werneck. Round-based public transit routing. ALENEX'12, 2012. [37] D. Delling and D. Wagner. Time-dependent route planning. Robust and Online Large-Scale Optimization, 2:1–18, 2009. [38] C. Demetrescu and G. Italiano. A new approach to dynamic all pairs shortest paths. Journal of the ACM (JACM), pages 1–29, 2004. [39] C. Demetrescu and G. F. Italiano. Dynamic shortest paths and transitive closure: Algorithmic techniques and data structures. Journal of Discrete Algorithms, pages 353–383, 2006. [40] U. Demiryurek, F. Banaei-kashani, and C. Shahabi. Online Computation of Fastest Path in Time-Dependent. SSTD, pages 92–111, 2011. [41] E. V. Denardo. Dynamic Programming: Models and Applications. Dover Publications, 2003. REFERENCES 22 [42] E. W. Dijkstra. A note on two problems in connexion with graphs. Numerische Mathematik, pages 269–271, 1959. [43] B. Ding, J. X. Yu, and L. Qin. Finding time-dependent shortest paths over large graphs. Proceedings of the 11th international conference on Extending database technology Advances in database technology EDBT 08, page 205, 2008. [44] H. Djidjev. Efficient algorithms for shortest path queries in planar digraphs. Graph-Theoretic Concepts in Computer Science, pages 151–165, 1996. [45] W. Dobosiewicz. A more efficient algorithm for min-plus multiplication. Internat. J. Comput. Math, 1990. [46] D. Dor, S. Halperin, and U. Zwick. All-pairs almost shortest paths. SIAM Journal on Com- puting, 2000. [47] J. Driscoll and H. Gabow. Relaxed heaps: An alternative to Fibonacci heaps with applications to parallel computation. Communications of the ACM, pages 1343–1354, 1988. [48] M. Elkin and D. Peleg. (1+epsilon,beta)-spanner constructions for general graphs. SIAM Journal on Computing, pages 608–631, 2004. [49] Y. Emek, D. Peleg, and L. Roditty. A near-linear-time algorithm for computing replacement paths in planar directed graphs. ACM Transactions on Algorithms, 6:1–13, 2010. [50] J. Erickson. Maximum flows and parametric shortest paths in planar graphs. SIAM, 2010. [51] J. Fakcharoenphol and S. Rao. Planar graphs, negative weight edges, shortest paths, and near linear time. Journal of Computer and System Sciences, pages 868–889, 2006. [52] R. Floyd. Algorithm 97: Shortest Path. Communications of the ACM, pages 344–348, 1962. [53] L. R. Ford. Network flow theory. Report P-923, The Rand Corporation, 1956. [54] L. Foschini, J. Hershberger, and S. Suri. On the complexity of time-dependent shortest paths. Algorithmica, 2014. [55] M. Fredman. New bounds on the complexity of the shortest path problem. SIAM, pages 83–89, 1976. [56] M. Fredman and R. Tarjan. Fibonacci heaps and their uses in improved network optimization algorithms. Journal of the ACM (JACM), pages 338–346, 1987. [57] M. Fredman and D. Willard. Trans-dichotomous algorithms for minimum spanning trees and shortest paths. Proceedings [1990] 31st Annual Symposium on Foundations of Computer Science, pages 719–725, 1990. [58] M. Fredman and D. Willard. Surpassing the information theoretic bound with fusion trees. Journal of computer and system sciences, pages 424–436, 1993. [59] M. L. Fredman and D. E. Willard. BLASTING through the information theoretic barrier with FUSION TREES. Proceedings of the twenty-second annual ACM symposium on Theory of computing - STOC '90, pages 1–7, 1990. [60] L. Fu, D. Sun, and L. Rilett. Heuristic shortest path algorithms for transportation applications: State of the art. Computers & Operations Research, pages 3324–3343, 2006. [61] C. Gavoille, D. Peleg, S. P´erennes, and R. Raz. Distance labeling in graphs. J. Algorithms, pages 85–112, 2004. [62] R. Geisberger, P. Sanders, D. Schultes, and D. Delling. Contraction hierarchies: Faster and simpler hierarchical routing in road networks. Experimental Algorithms, pages 319–333, 2008. REFERENCES 23 [63] R. Geisberger, P. Sanders, D. Schultes, and C. Vetter. Exact routing in large road networks using contraction hierarchies. Transportation Science, pages 388–404, 2012. [64] B. George, S. Kim, and S. Shekhar. Spatio-temporal network databases and routing algo- rithms: A summary of results. Spatial and Temporal Databases, pages 460–477, 2007. [65] B. George and S. Shekhar. Time-Aggregated Graphs for Modeling. Advances in Conceptual Modelling, pages 85–99, 2006. [66] A. Goldberg. Point-to-point shortest path algorithms with preprocessing. SOFSEM, pages 9–12, 2007. [67] A. Goldberg and R. Werneck. Computing Point-to-Point Shortest Paths from External Mem- ory. ALENEX/ANALCO, 2005. [68] R. Gutman. Reach-Based Routing: A New Approach to Shortest Path Algorithms Optimized for Road Networks. ALENEX/ANALC, 2004. [69] T. Hagerup. Improved shortest paths on the word RAM. Automata, Languages and Program- ming, pages 61–72, 2000. [70] Y. Han. Improved Fast Integer Sorting in Linear Space. Information and Computation, pages 81–94, 2001. [71] Y. Han. Improved algorithm for all pairs shortest paths. Information Processing Letters, pages 245–250, 2004. [72] Y. Han. An o(n3 (loglogn/logn)5/4) time algorithm for all pairs shortest paths. Proceedings of the 14th conference on Annual European Symposium - Volume 14, pages 411–417, 2006. [73] Y. Han and T. Takaoka. An o(n3 log log n/ log2 n) time algorithm for all pairs shortest paths. Proceedings of the 13th Scandinavian conference on Algorithm Theory, pages 131–141, 2012. [74] P. Hart, N. Nilsson, and B. Raphael. Formal basis for the heuristic determination of minimum cost paths. Systems Science and Cybernetics, pages 100–107, 1968. [75] M. Henzinger, S. Krinninger, and D. Nanongkai. Dynamic Approximate All-Pairs Shortest Paths: Breaking the O(mn) Barrier and Derandomization. 2013 IEEE 54th Annual Sympo- sium on Foundations of Computer Science, pages 538–547, 2013. [76] M. Henzinger, S. Krinninger, and D. Nanongkai. A Subquadratic-Time Algorithm for Decre- mental Single-Source Shortest Paths. SODA, pages 1053–1072, 2014. [77] M. R. Henzinger and V. King. Fully Dynamic Biconnectivity. FOCS, pages 664–672, 1995. [78] M. R. Henzinger, P. Klein, S. Rao, and S. Subramanian. Faster Shortest-Path Algorithms for Planar Graphs. Journal of Computer and System Sciences, pages 3–23, 1997. [79] J. Hershberger and S. Suri. Vickrey prices and shortest paths: What is an edge worth? pages 252–, 2001. [80] M. Holzer, F. Schulz, and D. Wagner. Engineering multilevel overlay graphs for shortest-path queries. Journal of Experimental Algorithmics, 13(2):2.5, Feb. 2009. [81] M. Holzer, F. Schulz, D. Wagner, and T. Willhalm. Combining speed-up techniques for shortest-path computations. Journal of Experimental Algorithmics, 2005. [82] E. Kanoulas, Y. Du, T. Xia, and D. Zhang. Finding Fastest Paths on A Road Network with Speed Patterns. 22nd International Conference on Data Engineering (ICDE'06), pages 10–10, 2006. REFERENCES 24 [83] D. Karger, D. Koller, and S. Phillips. Finding the hidden path: time bounds for all-pairs shortest paths. Proceedings 32nd Annual Symposium of Foundations of Computer Science, pages 560–568, 1993. [84] R. Karp. A characterization of the minimum cycle mean in a digraph. Discrete mathematics, pages 309–311, 1978. [85] R. Karp and J. Orlin. Parametric shortest path algorithms with an application to cyclic staffing. Discrete Applied Mathematics, pages 37–45, 1981. [86] K.-i. Kawarabayashi, P. Klein, and C. Sommer. Linear-space approximate distance oracles for planar, bounded-genus and minor-free graphs. Automata, Languages and . . . , pages 135–146, 2011. [87] T. Kieritz, D. Luxen, P. Sanders, and C. Vetter. Distributed time-dependent contraction hierarchies. Experimental Algorithms, pages 1–11, 2010. [88] P. N. Klein, S. Mozes, and O. Weimann. Shortest Paths in Directed Planar Graphs with Negative Lengths : a Linear-Space O ( n log 2 n ) -Time Algorithm. ACM Transactions on Algorithms, 2010. [89] J. Kleinberg, a. Slivkins, and T. Wexler. Triangulation and Embedding Using Small Sets of Beacons. 45th Annual IEEE Symposium on Foundations of Computer Science, pages 444–453, 2004. [90] E. Kohler, R. Mohring, and H. Schilling. Acceleration of shortest path and constrained shortest path computation. Experimental and Efficient Algorithms, pages 1–17, 2005. [91] U. Lauther. An Extremely Fast, Exact Algorithm for Finding Short test Paths in Static Networks with Geographical Background. Geoinformation undMobilit at - von der Forschung zur praktischen Anwendung, pages 219–230, 2004. [92] R. Lipton, D. Rose, and R. Tarjan. Generalized nested dissection. SIAM journal on numerical analysis, (2):346–358, 1979. [93] R. Loui. Optimal paths in graphs with stochastic or multidimensional weights. Communica- tions of the ACM, 1983. [94] C. Mata and J. S. B. Mitchell. A new algorithm for computing shortest paths in weighted planar subdivisions. Proc. 13th Annu. ACM Sympos. Comput. Geom., pages 264–273, 1997. [95] J. Maue, P. Sanders, and D. Matijevic. Goal-directed shortest-path queries using precomputed cluster distances. Journal of Experimental Algorithmics, 2009. [96] E. Miller-Hooks and H. Mahmassani. Least expected time paths in stochastic, time-varying transportation networks. Transportation Science, pages 198–215, 2000. [97] J. Mitchell and C. Papadimitriou. The Weighted Region Problem: Finding Shortest Paths Through a Weighted Planar Subdivision. 1990. [98] A. Moffat and T. Takaoka. An all pairs shortest path algorithm with expected running time o(n2 log n). SIAM J Computing, page 10231031, 1987. [99] R. H. Mohring, H. Schilling, B. Schutz, D. Wagner, and T. Willhalm. Partitioning graphs to speedup Dijkstra's algorithm. Journal of Experimental Algorithmics, 2007. [100] E. F. Moore. The shortest path through a maze. Proceedings of the International Symposium of Switching Theory 1957, Part II, 1957. [101] S. Mozes and C. Sommer. Exact distance oracles for planar graphs. SODA, 2012. REFERENCES 25 [102] K. Mulmuley and P. Shah. A lower bound for the shortest path problem. Journal of Computer and System Sciences, 63:253–267, 2001. [103] G. Nannicini, P. Baptiste, G. Barbier, D. Krob, and L. Liberti. Fast paths in large-scale dynamic road networks. Computational Optimization and Applications, 2010. [104] G. Nannicini, D. Delling, L. Liberti, and D. Schultes. Bidirectional A search for time- dependent fast paths. Experimental Algorithms, pages 334–346, 2008. [105] G. Nannicini and L. Liberti. Shortest paths on dynamic graphs. International Transactions in Operational Research, pages 551–563, 2008. [106] E. Nikolova, M. Brand, and D. Karger. Optimal Route Planning under Uncertainty. ICAPS, 2006. [107] E. Nikolova, J. Kelner, M. Brand, and M. Mitzenmacher. Stochastic shortest paths via quasi- convex maximization. AlgorithmsESA 2006, 2006. [108] M. Patrascu and L. Roditty. Distance oracles beyond the Thorup-Zwick bound. Foundations of Computer Science, (1):815–823, 2010. [109] M. Potamias, F. Bonchi, C. Castillo, and A. Gionis. Fast shortest path distance estimation in large networks. Proceeding of the 18th ACM conference on Information and knowledge management - CIKM '09, page 867, 2009. [110] L. Roditty and A. Shapira. All-pairs shortest paths with a sublinear additive error. ACM Transactions on Algorithms, pages 1–12, 2011. [111] L. Roditty and U. Zwick. On Dynamic Shortest Paths Problems. Algorithmica, pages 389–401, 2010. [112] L. Roditty and U. Zwick. Simple shortest paths in unweighted directed graphs. ACM Trans- actions on Algorithms, 8(4):1–11, 2012. [113] P. Sanders and D. Schultes. Highway hierarchies hasten exact shortest path queries. Algo- rithmsEsa 2005, pages 568–579, 2005. [114] P. Sanders and D. Schultes. Engineering highway hierarchies. AlgorithmsESA 2006, pages 804–816, 2006. [115] J. Sankaranarayanan, H. Alborzi, and H. Samet. Efficient query processing on spatial networks. pages 200–209, 2005. [116] E. K. Schilling, R. H. Mohring, and Heiko. Fast point-to-point shortest path computations with arc-flags. DIMACS Challenge, 2006. [117] D. Schultes. Fast and exact shortest path queries using highway hierarchies. Master-Arbeit, Universitat des Saarlandes, . . . , 2005. [118] D. Schultes and P. Sanders. Dynamic highway-node routing. Experimental Algorithms, pages 66–79, 2007. [119] F. Schulz, D. Wagner, and K. Weihe. Dijkstra s Algorithm On Line : An Empirical Case Study from Public Railroad Transport. Vitter, J.S., Zaroliagis, C.D., 1999. [120] F. Schulz, D. Wagner, and C. Zaroliagis. Using multi-level graphs for timetable information in railway systems. Algorithm Engineering and Experiments, pages 43–59, 2002. [121] S. Sen. Approximating shortest paths in graphs. WALCOM: Algorithms and Computation, pages 32–43, 2009. REFERENCES 26 [122] Y. Shiloach and S. Even. An on-line edge-deletion problem. J. ACM, 1981. [123] M. Sniedovich. Dijkstra s algorithm revisited : the dynamic programming connexion. Journal of Control and Cybernetics, pages 599–620, 2006. [124] M. Sniedovich. Dynamic Programming: Foundations and Principles. Francis and Taylor, 2010. [125] C. Sommer. Shortest-path queries in static networks. ACM Computing Surveys, 2012. [126] T. Takaoka. A new upper bound on the complexity of the all pairs shortest path problem. Information Processing Letters, pages 195–199, 1992. [127] T. Takaoka. A faster algorithm for the all-pairs shortest path problem and its application. COCOON, pages 278–289, 2004. [128] M. Thorup. On RAM priority. SODA, pages 59–67, 1996. [129] M. Thorup. Undirected single-source shortest paths with positive integer weights in linear time. Journal of the ACM (JACM), pages 1–33, 1999. [130] M. Thorup. Compact oracles for reachability and approximate distances in planar digraphs. Journal of the ACM, 51:993–1024, 2004. [131] M. Thorup. Fully-dynamic all-pairs shortest paths: Faster and allowing negative cycles. Algorithm Theory-SWAT 2004, pages 384–396, 2004. [132] M. Thorup and U. Zwick. Approximate distance oracles. Journal of the ACM, 52:1–24, 2005. [133] W. Warntz. Transportation, social physics, and the law of refraction. The Professional Geographer, pages 2–7, 1957. [134] S. Warshall. A theorem on boolean matrices. Journal of the ACM (JACM), (1), 1962. [135] C. Wulff-Nilsen. Constant time distance queries in planar unweighted graphs with sub- quadratic preprocessing time. Computational Geometry, pages 831–838, 2013. [136] K. Xie, K. Deng, S. Shang, X. Zhou, and K. Zheng. Finding Alternative Shortest Paths in Spatial Networks. ACM Transactions on Database Systems, pages 1–31, 2012. [137] J. Y. Yen. An algorithm for finding shortest routes from all source nodes to a given destination in general networks. Quarterly of Applied Mathematics, 1970. [138] N. Young, R. Tarjant, and J. Orlin. Faster parametric shortest path and minimumbalance algorithms. Networks, 21, 2002. [139] U. Zwick. All pairs shortest paths in weighted directed graphs-exact and almost exact al- gorithms. Proceedings 39th Annual Symposium on Foundations of Computer Science (Cat. No.98CB36280), pages 310–319, 1998. [140] U. Zwick. Exact and approximate distances in graphsa survey. ESA, 2001. [141] U. Zwick. A slightly improved sub-cubic algorithm for the all pairs shortest paths problem with real edge lengths. pages 921–932, 2004.
1705.09438
1
1705
2017-05-26T05:40:54
Duel and sweep algorithm for order-preserving pattern matching
[ "cs.DS" ]
Given a text $T$ and a pattern $P$ over alphabet $\Sigma$, the classic exact matching problem searches for all occurrences of pattern $P$ in text $T$. Unlike exact matching problem, order-preserving pattern matching (OPPM) considers the relative order of elements, rather than their real values. In this paper, we propose an efficient algorithm for OPPM problem using the "duel-and-sweep" paradigm. Our algorithm runs in $O(n + m\log m)$ time in general and $O(n + m)$ time under an assumption that the characters in a string can be sorted in linear time with respect to the string size. We also perform experiments and show that our algorithm is faster that KMP-based algorithm. Last, we introduce the two-dimensional order preserved pattern matching and give a duel and sweep algorithm that runs in $O(n^2)$ time for duel stage and $O(n^2 m)$ time for sweeping time with $O(m^3)$ preprocessing time.
cs.DS
cs
Duel and sweep algorithm for order-preserving pattern matching Davaajav Jargalsaikhan1, Diptarama1, Ryo Yoshinaka1, and Ayumi Shinohara1 1Graduate School of Information Sciences, Tohoku University, 6-6-05 Aramaki Aza Aoba, Aoba-ku, Sendai, Japan, {davaajav@shino., diptarama@shino., ry@, ayumi@}ecei.tohoku.ac.jp August 24, 2018 Abstract Given a text T and a pattern P over alphabet Σ, the classic exact matching problem searches for all occurrences of pattern P in text T . Un- like exact matching problem, order-preserving pattern matching (OPPM) considers the relative order of elements, rather than their real values. In this paper, we propose an efficient algorithm for OPPM problem using the "duel-and-sweep" paradigm. Our algorithm runs in O(n + m log m) time in general and O(n + m) time under an assumption that the characters in a string can be sorted in linear time with respect to the string size. We also perform experiments and show that our algorithm is faster that KMP-based algorithm. Last, we introduce the two-dimensional order pre- served pattern matching and give a duel and sweep algorithm that runs in O(n2) time for duel stage and O(n2m) time for sweeping time with O(m3) preprocessing time. 1 Introduction The exact string matching problem is one of the most widely studied problems. Given a text and a pattern, the exact matching problem searches for all occur- rences positions of pattern in the text. Motivated by low level image processing, the two-dimensional exact matching problem has been extensively studied in re- cent decades. Given a text T of size n × n and a pattern P of size m × m over alphabet Σ of size σ = Σ, the exact matching problem on two-dimensional strings searches for all occurrence positions of P in T . Bird [4] and Baker [3] proposed two-dimensional exact matching using dictionary matching algorithm and Amir and Farach [2] proposed an algorithm that uses suffix trees. These algorithms require total ordering from the alphabet and run in O(n2 log σ) time with O(m2 log σ) preprocessing time. Amir et al. [1] also proposed alphabet independent approach to the problem that runs in O(m2 log σ) preprocessing time and O(n2) matching time. 1 Unlike the exact matching problem, order-preserving pattern matching (OPPM) considers the relative order of elements, rather than their real values. Order- preserving matching has gained much interest in recent years, due to its appli- cability in problems where the relative order is compared, rather than the exact value, such as share prices in stock markets, weather data or musical notes. Kubica et al. [15] and Kim et al. [14] proposed a solution based on KMP algo- rithm. These algorithms address the one-dimensional OPPM problem and have time complexity of O(n + m log m). Cho et al. [8] brought forward another algo- rithm based on the Horspool's algorithm that uses q-grams, which was proven to be experimentally fast. Crochemore et al. [10] proposed data structures for OPPM. On the other hand, Chhabra and Tarhio [7], Faro and Kulekci [11] proposed filtration methods which practically fast. Moreover, faster filtration algorithms by using SIMD (Single Instruction Multiple Data) instructions were proposed by Cantone et al. [5], Chhabra et al. [6] and Ueki et al. [16]. They showed that SIMD instructions are efficient in speeding up their algorithms. In this paper, we propose an algorithm that based on dueling technique [17] for OPPM. Our algorithm runs in O(n + m log m) time which is as fast as KMP based algorithm. Moreover, we perform experiments those compare the performance of our algorithm with the KMP-based algorithm. The experiment results show that our algorithm is faster that KMP-based algorithm. Last, we introduce the two-dimensional order preserved pattern matching and give a duel and sweep algorithm that runs in O(n2) time for duel stage and O(n2m) time for sweeping time with O(m3) preprocessing time. To the best of our knowledge, our solution is the first to address the two-dimensional order preserving patern matching problem. The rest of the paper is organized as follows. In Section 2, we give pre- liminaries on the problem. In Section 3, we describe the algorithm for OPPM problem. In Section 4 we will show some experiment results those compare the performance of our algorithm with the KMP-based algorithm. In Section 5, we extend the algorithm and describe the method for the two-dimensional OPPM problem. In Section 6, we conclude our work and discuss future work. 2 Preliminaries We use Σ to denote an alphabet of integer symbols such that the comparison of any two symbols can be done in constant time. Σ∗ denotes the set of strings over the alphabet Σ. For a string S ∈ Σ∗, we will denote i-th element of S by S[i] and a substring of S that starts at the location i and ends at the location j as S[i : j]. We say that two strings S and T of equal length n are order-isomorphic, written S ≈ T , if S[i] ≤ S[j] ⇐⇒ T [i] ≤ T [j] for all 1 ≤ i, j ≤ n. For instance, (12, 35, 5) ≈ (25, 30, 21) 6≈ (11, 13, 20). In order to check order-isomorphism of two strings, Kubica et al. [15] intro- duced 1 useful arrays Lmax S and Lmin S defined by Lmax S[i] = j if S[j] = max k<i Lmin S[i] = j if S[j] = min k<i {S[k] S[k] ≤ S[i]}, {S[k] S[k] ≥ S[i]}. (1) (2) 1Similar arrays PrevS and NextS are introduced in [13]. 2 Table 1: Z-array of a string S = (18, 22, 12, 50, 10, 17). For instance, ZS[3] = 3 because S[1 : 3] = (18, 22, 12) ≈ (12, 50, 10) = S[3 : 5] and S[1 : 4] = (18, 22, 12, 50) 6≈ (12, 50, 10, 17) = S[3 : 6]. Lmax S and Lmin S are also shown. S ZS Lmax S Lmin S 1 18 6 0 0 2 22 1 1 0 3 12 3 0 1 4 50 1 2 0 5 10 2 0 3 6 17 1 3 1 We use the rightmost (largest) j if there exist more than one such j. If there is no such j then we define Lmin S[i] = 0 and Lmax S[i] = 0, respectively. From the definition, we can easily observe the following properties. S[Lmax S[i]] = S[i] ⇐⇒ S[i] = S[Lmin s[i]], S[Lmax S[i]] < S[i] ⇐⇒ S[i] < S[Lmin s[i]]. (3) (4) Lemma 1 ([15]). For a string S, let sort(S) be the time required to sort the elements of S. Lmax S and Lmin S can be computed in O(sort(S) + S) time. Thus, Lmax S and Lmin S can be computed in O(S log S) time in general. Moreover, the computation can be done in O(S) time under a natural assump- tion [15] that the characters of S are elements of the set {1, . . . , SO(1)}. By using Lmax S and Lmin S, order-isomorphism of two strings can be decided as follow. Lemma 2 ([8]). For two strings S and T of length n, assume that S[1 : i] ≈ T [1 : i] for some i < n. Let imax = Lmax S[i + 1] and imin = Lmin S[i + 1]. Then S[1 : i + 1] ≈ T [1 : i + 1] if and only if either of the following two conditions holds. S[imax ] = S[i + 1] = S[imin ] ∧ T [imax ] = T [i + 1] = T [imin ], S[imax ] < S[i + 1] < S[imin ] ∧ T [imax ] < T [i + 1] < T [imin ]. (5) (6) We omit the corresponding equalities/inequalities if imax = 0 or imin = 0. Hasan et al. [13] proposed a modification to Z-function, which Gusfield [12] defined for ordinal pattern matching, to make it useful from the order-preserving point of view. For a string S, the (modified) Z-array of S is defined by ZS[i] = max {j S[1 : j] ≈ S[i : i + j − 1]} for each 1 ≤ i ≤ S. 1≤j≤S−i+1 In other words, ZS[i] is the length of the longest substring of S that starts at position i and is order-isomorphic with some prefix of S. An example of Z-array is illustrated in Table 1. Lemma 3. ([13]) For a string S, Z-array ZS can be computed in O(S) time, assuming that Lmax S and Lmin S are already computed. Note that in their original work, Hasan et al. [13] assumed that each charac- ter in S is distinct. However, we can extend their algorithm by using Lemma 2 to verify order-isomorphism even when S contains duplicate characters. 3 3 One-dimensional order-preserving matching In this section, we will propose an algorithm for one-dimensional OPPM using the "duel-and-sweep" paradigm [1]. In the dueling stage, all possible pairs of candidates "duel" with each other. The surviving candidates are further pruned during the sweeping stage, leaving the candidates that are order-isomorphic with the pattern. Prior to the dueling stage, the pattern is preprocessed to construct a witness table that contains witness pairs for all possible offsets. Definition 1 (1d-OPPM problem). The one-dimensional order-preserving match- ing problem is defined as follows, Input: A text T ∈ Σ∗ of length n and a pattern P ∈ Σ∗ of length m, Output: All occurrences of substrings of T that are order-isomorphic with P . 3.1 Pattern preprocessing Let a > 0 be an integer such that when P is superimposed on itself with the offset a, the overlap regions are not order-isomorphic. We say that a pair hi, ji of locations is a witness pair for the offset a if either of the following holds: • P [i] = P [j] and P [i + a] 6= P [j + a], • P [i] > P [j] and P [i + a] ≤ P [j + a], • P [i] < P [j] and P [i + a] ≥ P [j + a]. Next, we describe how to construct a witness table for P , that stores witness pairs for all possible offsets a (0 < a < m). For the one-dimensional problem, the witness table WITP is an array of length m − 1, such that WITP [a] is a witness pair for offset a. In the case when there are multiple witness pairs for offset a, we take the pair hi, ji with the smallest value of j and i < j. When the overlap regions are order-isomorphic for offset a, which implies that no witness pair exists for a, we express it as WITP [a] = hm + 1, m + 1i. Lemma 4. For a pattern P of length m, we can construct WITP in O(m) time assuming that ZP is already computed. Proof. Remind that ZP [k] is the length of the longest prefix of P [k : m] that is order-isomorphic with a prefix of P . For each 1 < k < m, we have two cases. Case 1 ZP [k] = m − k + 1 : Since P [1 : m − k + 1] ≈ P [k : m], there is no witness pair for offset k − 1. Case 2 ZP [k] < m − k + 1 : Let jk = ZP [k] + 1, imax = Lmax P [jk], and imin = Lmin P [jk]. Then P [1 : jk − 1] ≈ P [k : k + jk − 2] and P [1 : jk] 6≈ P [k : k + jk − 1], by the definition of ZP [k]. By Lemma 2, neither condition (5) nor (6) holds. If P [imax ] = P [jk] then P [jk] = P [imin ] by property (3), so that P [k + imax − 1] 6= P [k + jk − 1] ∨ P [k + jk − 1] 6= P [k + imin − 1] (7) holds by condition (5). Otherwise, i.e. P [imax ] < P [jk], we have P [jk] < P [imin ] by property (3), so that P [k + imax − 1] ≥ P [k + jk − 1] ∨ P [k + jk − 1] ≥ P [k + imin − 1] (8) 4 Algorithm 1: Algorithm for constructing the witness table WITP 1 Function Witness() /* Construct the witness table WITP */ 2 3 4 5 6 7 8 9 10 11 12 13 compute the Z-array ZP for the pattern P ; for k = 2 to m − 1 do j = ZP [k] + 1; if j = m − k + 1 then WITP [k − 1] = hm + 1, m + 1i; else if P [Lmin P [j]] = P [j] = P [Lmax P [j]] then if P [k + j − 1] 6= P [k + Lmax P [j] − 1] then WITP [k − 1] = hLmax P [j], ji; else WITP [k − 1] = hLmin P [j], ji; else if P [k + j − 1] ≤ P [k + Lmax P [j] − 1] then WITP [k − 1] = hLmax P [j], ji; else WITP [k − 1] = hLmin P [j], ji; holds by condition (6). Therefore, himax , jki is a witness pair if the leftside of condition (7) or (8) holds, and himin , jki is a witness pair if rightside of condition (7) or (8) holds. Algorithm 1 describes the procedure. Clearly it runs in O(m) time. 3.2 Dueling stage A substring of T of length m will be referred to as a candidate. A candidate that starts at the location x will be denoted by Tx. Witness pairs are useful in the following situation. Let Tx and Tx+a be two overlapping candidates and hi, ji be the witness pair for offset a. Without loss of generality, we assume that P [i] < P [j] and P [i + a] > P [j + a]. • If T [x + a + i − 1] > T [x + a + j − 1], then Tx 6≈ P . • If T [x + a + i − 1] < T [x + a + j − 1], then Tx+a 6≈ P . Based on this information, we can safely eliminate either candidate Tx or Tx+a without looking into other locations. This process is called dueling. The proce- dure for the dueling is described in the Algorithm 2. Next, we prove that the consistency property is transitive. Suppose Tx and Tx+a are two overlapping candidates. We say that Tx and Tx+a are consistent with respect to P if P [1 : m − a] ≈ P [a + 1 : m]. Candidates that do not overlap are trivially consistent. Lemma 5. For any a and a′ such that 0 < a < a + a′ < m, let us consider three candidates Tx, Tx+a, and Tx+a+a′. If Tx is consistent with Tx+a and Tx+a is consistent with Tx+a+a′, then Tx is consistent with Tx+a+a′. Proof. Since Tx is consistent with Tx+a, it follows that P [1 : m − a] ≈ P [a + 1 : m], so that P [a′ + 1 : m − a] ≈ P [(a + a′) + 1 : m]. Moreover, since Tx+a is consistent with Tx+a+a′, it follows that P [1 : m − a′] ≈ P [a′ + 1 : m], so that P [1 : m − a′ − a] ≈ P [a′ + 1 : m − a]. Thus, P [1 : m − (a + a′)] ≈ P [(a + a′) + 1 : m], which implies that Tx is consistent with Tx+a+a′. 5 Algorithm 2: Dueling 1 Function Dueling(Tx, Tx+a) /* Duel between candidates Tx and Tx+a hi, ji = WITP [a]; if P [i] = P [j] then */ if T [x + a + i − 1] 6= T [x + a + j − 1] then return Tx+a; else return Tx; if P [i] < P [j] then if T [x + a + i − 1] > T [x + a + j − 1] then return Tx+a; else return Tx; if P [i] > P [j] then if T [x + a + i − 1] < T [x + a + j − 1] then return Tx+a; else return Tx; 2 3 4 5 6 7 8 9 10 11 During the dueling stage, the candidates are eliminated until all remaining candidates are pairwise consistent. For that purpose, we can apply the dueling algorithm due to Amir et al. [1] developed for ordinal pattern matching. Lemma 6 ([1]). The dueling stage can be done in O(n2) time by using WITP. 3.3 Sweeping stage The goal of the sweeping stage is to prune candidates until all remaining can- didates are order-isomorphic with the pattern. Suppose that we need to check whether some surviving candidate Tx is order-isomorphic with the pattern P . It suffices to successively check the conditions (7) and (8) in Lemma 2, starting from the leftmost location in Tx. If the conditions are satisfied for all locations in Tx, then Tx ≈ P . Otherwise, Tx 6≈ P , and obtain a mismatch position j. A naive implementation of the sweeping will result in O(n2) time. However, if we take advantage of the fact that all the remaining candidates are pairwise consistent, we can reduce the time complexity to O(n) time. Since the remaining candidates are consistent to each other, for the overlapping candidates Tx and Tx+a, the overlap region is checked only once if Tx is order-isomorphic with the pattern P . Otherwise, for a mismatch position j, Tx+a should be checked from position j − a + 1 of Tx+a, because P [a : j − 1] ≈ Tx[a : j − 1] ≈ Tx+a[1 : j − a]. Algorithm 3 describes the procedure for the sweeping stage. Lemma 7. The sweeping stage can be completed in O(n) time. By Lemmas 4, 6, and 7, we summarize this section as follows. Theorem 1. The duel-and-sweep algorithm solves 1d-OPPM Problem in O(n+ m log m) time. Moreover, the running time is O(n + m) under the natural assumption that the characters of P can be sorted in O(m) time. 6 Algorithm 3: The sweeping stage algorithm 1 Function SweepingStage() 2 3 4 5 6 7 8 9 10 11 12 while there are unchecked candidates to the right of Tx do let Tx be the leftmost unchecked candidate; if there are no candidates overlapping with Tx then if Tx 6≈ P then eliminate Tx; else let Tx+a be the leftmost candidate that overlaps with Tx; if Tx ≈ P then start checking Tx+a from the location m − a + 1; else let j be the mismatch position; eliminate Tx; start checking Tx+a from the location j − a; OPKMP OPDuel&Sweep 0.2 0.15 0.1 0.05 ) s ( e m T i 0 0 2e+06 4e+06 6e+06 8e+06 1e+07 Text length (a) ) s ( e m T i 0.05 0.04 0.03 0.02 0.01 0 0 OPKMP OPDuel&Sweep 20 40 60 80 100 Pattern length (b) Figure 1: Running time of the algorithms with respect to (a) text length, and (b) pattern length. 4 Experiment In order to compare the performance of proposed algorithm with the KMP-based algorithm, we conducted experiments on 1d-OPPM problem. We performed two sets of experiments. In the first experiment, the pattern size m is fixed to 10, while the text size n is changed from 100000 to 1000000. In the second experiment, the text size n is fixed to 1000000 while the pattern size m is changed from m 5 to 100. We measured the average of running time and the number of comparisons for 50 repetitions on each experiment. We used randomly generated texts and patterns with alphabet size Σ = 1000. Experiments are executed on a machine with Intel Xeon CPU E5-2609 8 cores 2.40 GHz, 256 GB memory, and Debian Wheezy operating system. The results of our preliminary experiments are shown in Fig. 1 and Fig. 2. We can see that our algorithm is better that KMP based algorithm in running time and number of comparison when the pattern size and text size are large. However, our algorithm is worse when the pattern size is small, less than 10. 7 1.8e+07 1.6e+07 1.4e+07 1.2e+07 1e+07 8e+06 6e+06 4e+06 2e+06 n o s i r a p m o c f o r e b m u N 0 0 OPKMP OPDuel&Sweep OPKMP OPDuel&Sweep n o s i r a p m o c f o r e b m u N  1.6e+06 1.4e+06 1.2e+06 1e+06  600000 2e+06 4e+06 6e+06 8e+06 1e+07 0 20 40 60 100 Text length (a) Pattern length (b) Figure 2: Number of comparisons in the algorithms with respect to (a) text length, and (b) pattern length. 5 Two-dimensional order preserving pattern match- ing In this section, we will discuss how to perform two-dimensional order preserv- ing pattern matching (2d-OPPM). Array indexing is used for two-dimensional strings, the horizontal coordinate x increases from left to right and the vertical coordinate y increases from top to bottom. S[x, y] denotes an element of S at position (x, y) and S[x : x + w − 1, y : y + h − 1] denotes a substring of S of size w × h with top-left corner at the position (x, y). We say that two dimensional strings S and T are order-isomorphic, written S ≈ T, if S[ix, iy] ≤ S[jx, jy] ⇐⇒ T[ix, iy] ≤ T[jx, jy] for all 1 ≤ ix, jx ≤ w and 1 ≤ iy, jy ≤ h. For a simple presentation, we assume that both text and pattern are squares (w = h) in this paper, but we can generalize it straightforwardly. Definition 2 (2d-OPPM problem). The two-dimensional order-preserving match- ing problem is defined as follows, Input: A text T of size n × n and a pattern P of size m × m, Output: All occurrences of substrings of T that are order-isomorphic with P. Our approach is to reduce 2d-OPPM problem into 1d-OPPM problem, based on the following observation. For two-dimensional string S, let serial(S) be a (one-dimensional) string which serializing S by traversing it in the left-to- right/top-to-bottom order. We can easily verify the following lemma. Lemma 8. S ≈ T if and only if serial(S) ≈ serial(T) for any S and T. Theorem 2. 2d-OPPM problem can be solved in O(n2m + m2 log m). Proof. For a fixed 1 ≤ x ≤ n−m+1, consider the substring T[x : x+m−1, 1 : n] and let Sx = serial(T[x : x + m − 1, 1 : n]). By Lemma 8, P occurs in T at position (x, y), i.e. P ≈ T[x : x + m − 1, y : y + m − 1] if and only if serial(P) ≈ Sx[m(y − 1) + 1, m(y − 1) + m2]. The positions m(y − 1) + 1 satisfying the latter condition can be found in O(nm + m2 log m) time by 1d- OPPM algorithms, which we showed in Section 3 or KMP-based ones [15, 14], because Sx = nm and serial(P) = m2. Because we need the preprocess for the pattern serial(P) only once, and execute the search in Sx for each x, the result follows. 8 In the rest of this paper, we try a direct approach to two-dimensional strings based on the duel-and-sweep paradigm, inspired by the work [2, 9]. A substring of T of size m × m will be referred as a candidate. Tx,y denotes a candidate with the top-left corner at (x, y). 5.1 Pattern preprocessing For 0 ≤ a < m and −m < b < m, we say that a pair h(ix, iy), (jx, jy)i of locations is a witness pair for the offset (a, b) if either of the following holds: • P[ix, iy] = P[j] and P[ix + a, iy + b] 6= P[jx, jy], • P[ix, iy] > P[j] and P[ix + a, iy + b] ≤ P[jx, jy], • P[ix, iy] < P[j] and P[ix + a, iy + b] ≥ P[jx, jy]. The witness table WITP for pattern P is a two-dimensional array of size m × (2m − 1), where WITP[a, b] is a witness pair for the offset (a, b). If the overlap regions are order-isomorphic when P is superimposed with offset (a, b), then no witness pair exists. We denote it as WITP[a, b] = h(m+1, m+1), (m+1, m+1)i. We show how to efficiently construct the witness table WITP. For P and each 0 ≤ a < m, we define the Z-array ZP,a by ZP,a[i] = max {j P1[1 : j] ≈ P2[i : i + j − 1]} for each 1 ≤ i ≤ P1, 1≤j≤P1−i+1 where P1 = serial(P[1 : m − a, 1 : m]), P2 = serial(P[a + 1 : m, 1 : m]), and P1 = P2 = m(m − a). Lemma 9. For arbitrarily fixed a ≥ 0, we can compute the value of WITP[a, b] in O(1) time and for each b, assuming that ZP,a is already computed. Proof. For an offset (a, b) with b ≥ 0, let us consider za,b = ZP,a[b · (m − a) + 1]. Case 1 za,b = (m − a)·(m − b): Note that the value is equal to the number of elements in the overlap region. Then P[1 : m − a, 1 : m − b] ≈ P[a + 1 : m, b + 1 : m], so that no witness pair exists for the offset (a, b). Case 2 za,b < (m − a)·(m − b): There exists a witness pair h(ix, iy), (jx, jy)i, where (jx, jy) is the location of the element in P, that corresponds to the (za,b + 1)-th element of P1 = serial(P[1 : m− a, 1 : m]). By a simple calcula- tion, we can obtain the values (jx, jy) in O(1) time. We can also compute (ix, iy) from (jx, jy) in O(1) time, similarly to the proof of Lemma 4, with the help of auxiliary arrays Lmax P,a and Lmin P,a. (Details are omitted.) Symmetrically, we can compute it for b < 0. Lemma 10. We can construct the witness table WITP in O(m3) time. Proof. Assume that we sorted all elements of P. For an arbitrarily fixed a, calculation of Lmax P,a and Lmin P,a takes O(m2) time by using sorted P. ZP,a can be constructed in O(m2) time by Lemma 3. Furthermore, finding witness pairs for all offsets (a, b) takes O(m) time by Lemma 9. Since there are m such a's to consider, WITP can be constructed in O(m3) time. 9 36 47 20 9 49 42 44 31 8 11 17 39 28 12 23 22 12 16 15 27 24 29 11 42 49 36 47 20 9 49 42 44 31 8 11 17 39 28 12 23 36 47 20 9 49 22 12 16 15 27 42 44 31 8 11 24 29 11 42 49 17 39 28 12 23 22 12 16 15 27 24 29 11 42 49 Figure 3: An example of witness pair. The pattern P is shown on the left and the alignment of P with itself with offset (3, 2) is shown on the right. The pair h(2, 1), (2, 2)i is a witness pair for offset (3, 2), since P[2, 1] = 47 > 44 = P[2, 2], but P[5, 3] = 23 < 27 = P[5, 4]. Table 2: Computation of ZP,3. For P in Fig. 3, the overlap regions for offset (3, 0) are traversed in left-to-right/top-to-bottom order to obtain P1 and P2. 1 36 9 2 2 47 49 1 3 42 8 2 4 44 11 2 5 17 12 3 6 39 23 1 7 22 15 2 8 12 27 2 9 24 42 2 10 29 49 1 P1 P2 ZP,3 5.2 Dueling stage Similarly to Lemma 5, we can show the transitivity as follows. Lemma 11. For any a, b, a′, b′ ≥ 0, let us consider three candidates T1 = Tx,y, T2 = Tx+a,y+b, and T3 = Tx+a′,y+b′. If T1 is consistent with T2 and T2 is consistent with T3, then T1 is consistent with T3. The dueling algorithm due to Amir et al. [1] is also applicable to the problem. Lemma 12. ([1]) The dueling stage can be done in O(n2) time by using WITP. 5.3 Sweeping stage This is the hardest part for two-dimensional strings. We first consider two surviving candidates Tx,y1 and Tx,y2 in some column x, with y1 < y2. If we traverse T[x : x + m − 1, 1 : n] from top-to-bottom/left-to-right manner we can reduce the problem to one-dimensional order-preserving problem. Thus performing the sweeping stage for some column x will take O(nm) time. Since there are n − m − 1 such columns, the sweeping stage will take O(n2m) time. Next, we propose a method that takes advantage of consistency relation in both horizontal and vertical directions. First, we construct m strings Pi = serial(P[1 : m−i, 1 : m])serial(P[m−i+1 : m, 1 : m]) for 0 ≤ i < m by serializing P in different way. We then compute Lmax Pi and Lmin Pi for 0 ≤ i < m, thus we can compare the order-isomorphism of the pattern with the text in several different ways. Lmax Pi and Lmin Pi for 0 ≤ i < m can be computed in O(n3) time by sorting serial(P) once and then calculated Lmax Pi and Lmin Pi by using the sorted serial(P). Fig. 4 shows Pi for 0 ≤ i < m where m = 5. We also do the same computation for bottom-to-top/left-to-right traversing direction. 10 Table 3: Witness pairs for offsets (3, 0), (3, 1), (3, 2), (3, 3), (3, 3) for P in Fig. 3. (a, b) za,b (3, 0) 2 (3, 1) 2 (3, 2) 3 (3, 3) 2 (3, 4) 2 WITP[a, b] h(1, 1), (2, 1)i h(1, 2), (2, 1)i h(2, 1), (2, 2)i h(1, 2), (2, 1)i h(5, 5), (5, 5)i Figure 4: Example of traversing directions that we use for sweeping algorithm. Let us consider two overlapping candidates Tx1,y1 and Tx2,y2, where x1 < x2 and y1 < y2. Suppose that Tx1,y1 is order-isomorphic with the pattern and we need to check Tx2,y2. Since Tx1,y1 is consistent with Tx2,y2, we need to check the order-isomorphishm of the region of Tx2,y2 that is not an overlap region. We do this by using Pj, where j = x2 − x1, without checking the overlap region. This idea is illustrated in Figure 5 (a). The procedure for y1 > y2 is symmetrical. Next, consider three overlapping candidates T1 = Tx1,y1, T2 = Tx2,y2 and T3 = Tx3,y3, such that x1 ≤ x2 ≤ x3 and y2 ≤ y3. We assume that T1 and T2 are both order-isomorphic with the pattern. If y1 ≤ y2, we can use the method for two overlapping candidates that we described before to perform sweeping efficiently. However, if y1 ≥ y2, as showed in Fig. 5 (b), we need to check the blue region twice since we do not know the order-isomorphism relation between the blue region with the overlap region of T2 and T3. By using the above method, we can reduce the number of comparisons for sweep stage. However, the time complexity remains the same. Lemma 13. The sweeping stage can be completed in O(n2m) time. By Lemmas 10, 12, and 13, we conclude this section as follows. Theorem 3. The duel-and-sweep algorithm solves 2d-OPPM Problem in O(n2m+ m3) time. 6 Discussion In the current status, the time complexity of duel-and-sweep algorithm for 2d- OPPM problem in Theorem 3 is not better than straightforward reduction to 1d-OPPM problem explained in Theorem 2. We showed this result as a prelimi- nary work on solving 2d-OPPM, and we hope the 2d-OPPM can be solved more efficiently by finding more sophisticated method based on some unknown com- binatorial properties, as Cole et al. [9] did for two dimensional parameterized matching problem. This is left for future work. 11 (a) (b) Figure 5: (a) Elements in the overlap region is checked only once. (b) Elements in the blue region must be checked twice. References [1] A. Amir, G. Benson, and M. Farach. An alphabet independent ap- proach to two-dimensional pattern matching. SIAM Journal on Computing, 23(2):313 -- 323, 1994. [2] A. Amir and M. Farach. Two-dimensional dictionary matching. Informa- tion Processing Letters, 44(5):233 -- 239, 1992. [3] T. P. Baker. A technique for extending rapid exact-match string match- ing to arrays of more than one dimension. SIAM Journal on Computing, 7(4):533 -- 541, 1978. [4] R. S. Bird. Two dimensional pattern matching. Information Processing Letters, 6(5):168 -- 170, 1977. [5] D. Cantone, S. Faro, and M. O. Kulekci. An efficient skip-search approach to the order-preserving pattern matching problem. In PSC, pages 22 -- 35, 2015. [6] T. Chhabra, M. O. Kulekci, and J. Tarhio. Alternative algorithms for order-preserving matching. In PSC, pages 36 -- 46, 2015. [7] T. Chhabra and J. Tarhio. Order-preserving matching with filtration. In SEA, pages 307 -- 314, 2014. [8] S. Cho, J. C. Na, K. Park, and J. S. Sim. A fast algorithm for order- preserving pattern matching. Information Processing Letters, 115(2):397 -- 402, 2015. [9] R. Cole, C. Hazay, M. Lewenstein, and D. Tsur. Two-dimensional param- eterized matching. ACM Trans. Algorithms, 11(2):12:1 -- 12:30, Oct. 2014. [10] M. Crochemore, C. S. Iliopoulos, T. Kociumaka, M. Kubica, A. Langiu, S. P. Pissis, J. Radoszewski, W. Rytter, and T. Walen. Order-preserving incomplete suffix trees and order-preserving indexes. In SPIRE, pages 84 -- 95, 2013. [11] S. Faro and M. O. Kulekci. Efficient algorithms for the order preserving In International Conference on Algorithmic pattern matching problem. Applications in Management, pages 185 -- 196. Springer, 2016. 12 [12] D. Gusfield. Algorithms on strings, trees and sequences: computer science and computational biology. Cambridge university press, 1997. [13] M. M. Hasan, A. S. Islam, M. S. Rahman, and M. S. Rahman. Order preserving pattern matching revisited. Pattern Recognition Letters, 55:15 -- 21, 2015. [14] J. Kim, P. Eades, R. Fleischer, S.-H. Hong, C. S. Iliopoulos, K. Park, S. J. Puglisi, and T. Tokuyama. Order-preserving matching. Theoretical Computer Science, 525:68 -- 79, 2014. [15] M. Kubica, T. Kulczy´nski, J. Radoszewski, W. Rytter, and T. Wale´n. A linear time algorithm for consecutive permutation pattern matching. In- formation Processing Letters, 113(12):430 -- 433, 2013. [16] Y. Ueki, K. Narisawa, and A. Shinohara. A fast order-preserving match- In SOFSEM ing with q-neighborhood filtration using simd instructions. (Student Research Forum Papers/Posters), pages 108 -- 115, 2016. [17] U. Vishkin. Optimal parallel pattern matching in strings. Information and control, 67(1-3):91 -- 113, 1985. 13
1811.05652
1
1811
2018-11-14T05:34:16
Submodular Optimization Over Streams with Inhomogeneous Decays
[ "cs.DS" ]
Cardinality constrained submodular function maximization, which aims to select a subset of size at most $k$ to maximize a monotone submodular utility function, is the key in many data mining and machine learning applications such as data summarization and maximum coverage problems. When data is given as a stream, streaming submodular optimization (SSO) techniques are desired. Existing SSO techniques can only apply to insertion-only streams where each element has an infinite lifespan, and sliding-window streams where each element has a same lifespan (i.e., window size). However, elements in some data streams may have arbitrary different lifespans, and this requires addressing SSO over streams with inhomogeneous-decays (SSO-ID). This work formulates the SSO-ID problem and presents three algorithms: BasicStreaming is a basic streaming algorithm that achieves an $(1/2-\epsilon)$ approximation factor; HistApprox improves the efficiency significantly and achieves an $(1/3-\epsilon)$ approximation factor; HistStreaming is a streaming version of HistApprox and uses heuristics to further improve the efficiency. Experiments conducted on real data demonstrate that HistStreaming can find high quality solutions and is up to two orders of magnitude faster than the naive Greedy algorithm.
cs.DS
cs
Submodular Optimization Over Streams with Inhomogeneous Decays Junzhou Zhao1, Shuo Shang2, Pinghui Wang3, John C.S. Lui4, and Xiangliang Zhang1∗ 1King Abdullah University of Science and Technology, KSA 2Inception Institute of Artificial Intelligence, UAE {junzhou.zhao, xiangliang.zhang}@kaust.edu.sa, [email protected], [email protected], [email protected] 3Xi'an Jiaotong University, China 4The Chinese University of Hong Kong, Hong Kong 8 1 0 2 v o N 4 1 ] S D . s c [ 1 v 2 5 6 5 0 . 1 1 8 1 : v i X r a Abstract Cardinality constrained submodular function maxi- mization, which aims to select a subset of size at most k to maximize a monotone submodular utility function, is the key in many data mining and machine learning applications such as data summarization and maximum coverage problems. When data is given as a stream, streaming submodular optimization (SSO) techniques are desired. Existing SSO techniques can only apply to insertion-only streams where each element has an infi- nite lifespan, and sliding-window streams where each element has a same lifespan (i.e., window size). How- ever, elements in some data streams may have arbi- trary different lifespans, and this requires addressing SSO over streams with inhomogeneous-decays (SSO- ID). This work formulates the SSO-ID problem and presents three algorithms: BASICSTREAMING is a basic streaming algorithm that achieves an (1/2 − ) approx- imation factor; HISTAPPROX improves the efficiency significantly and achieves an (1/3 − ) approxima- tion factor; HISTSTREAMING is a streaming version of HISTAPPROX and uses heuristics to further improve the efficiency. Experiments conducted on real data demon- strate that HISTSTREAMING can find high quality solu- tions and is up to two orders of magnitude faster than the naive GREEDY algorithm. 1 Introduction Selecting a subset of data to maximize some utility function under a cardinality constraint is a fundamental problem fac- ing many data mining and machine learning applications. In myriad scenarios, ranging from data summarization (Mitro- vic et al. 2018), to search results diversification (Agrawal et al. 2009), to feature selection (Brown et al. 2012), to cover- age maximization (Cormode, Karloff, and Wirth 2010), util- ity functions commonly satisfy submodularity (Nemhauser, Wolsey, and Fisher 1978), which captures the diminishing returns property. It is therefore not surprising that submod- ular optimization has attracted a lot of interests in recent years (Krause and Golovin 2014). ∗Shuo Shang and Xiangliang Zhang are the corresponding au- thors. Copyright c(cid:13) 2019, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved. insertion-only remaining lifespan ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ sliding-window (homogeneous decay) remaining lifespan inhomogeneous decay remaining lifespan 0 0 0 0 1 2 3 4 0 0 0 0 0 1 2 3 4 0 1 3 2 0 4 1 5 0 0 2 1 0 3 0 4 2 0 0 1 0 0 2 0 3 1 3 t t + 1 t t + 1 t t + 1 t + 2 Fig. 1: Insertion-only stream: each element has an infinite lifes- pan. Sliding-window stream: each element has a same initial lifes- pan. Our model: each element can have an arbitrary lifespan. If data is given in advance, the GREEDY algorithm can be applied to solve submodular optimization in a batch mode. However, today's data could be generated continuously with no ending, and in some cases, data is produced so rapidly that it cannot even be stored in computer main memory, e.g., Twitter generates more than 8, 000 tweets every sec- ond (Twitter 2018). Thus, it is crucial to design streaming algorithms where at any point of time the algorithm has ac- cess only to a small fraction of data. To this end, stream- ing submodular optimization (SSO) techniques have been developed for insertion-only streams where a subset is se- lected from all historical data (Badanidiyuru et al. 2014), and sliding-window streams where a subset is selected from the most recent data only (Epasto et al. 2017). We notice that these two existing streaming settings, i.e., insertion-only stream and sliding-window stream, actually represent two extremes. In insertion-only streams, a subset is selected from all historical data elements which are treated as of equal importance, regardless of how outdated they are. This is often undesirable because the stale historical data is usually less important than fresh and recent data. While in sliding-window streams, a subset is selected from the most recent data only and historical data outside of the window is completely discarded. This is also sometimes undesirable because one may not wish to completely lose the entire his- tory of past data and some historical data may be still impor- tant. As a result, SSO over insertion-only streams may find solutions that are not fresh; while SSO over sliding-window streams may find solutions that exclude historical important data or include many recent but valueless data. Can we de- sign SSO techniques with a better streaming setting? We observe that both insertion-only stream and sliding- window stream actually can be unified by introducing the concept of data lifespan, which is the amount of time an ele- ment participating in subset selection. As time advances, an element's remaining lifespan decreases. When an element's lifespan becomes zero, it is discarded and no longer par- ticipates in subset selection. Specifically, in insertion-only streams, each element has an infinite lifespan and will al- ways participate in subset selection after arrival. While in sliding-window streams, each element has a same initial lifespan (i.e., the window size), and hence participates in subset selection for a same amount of time (see Fig. 1). We observe that in some real-world scenarios, it may be inappropriate to assume that each element in a data stream has a same lifespan. Let us consider the following scenario. Motivating Example. Consider a news aggregation website such as Hacker News (HN 2018) where news submitted by users form a news stream. Interesting news may attract users to keep clicking and commenting and thus survive for a long time; while boring news may only survive for one or two days (Leskovec, Backstrom, and Kleinberg 2009). In news recommendation tasks, we should select a subset of news from current alive news rather than the most recent news. Therefore, besides timestamp of each data element, lifes- pan of each data element should also be considered in subset selection. Other similar scenarios include hot video selection from YouTube (where each video may have its own lifes- pan), and trending hashtag selection from Twitter (where each hashtag may have a different lifespan). Overview of Our Approach. We propose to extend the two extreme streaming settings to a more general stream- ing setting where each element is allowed to have an ar- bitrary initial lifespan and thus each element can partic- ipate in subset selection for an arbitrary amount of time (see Fig. 1). We refer to this more general decaying mech- anism as inhomogeneous decay, in contrast to the homoge- neous decay adopted in sliding-window streams. This work presents three algorithms to address SSO over streams with inhomogeneous decays (SSO-ID). We first present a sim- ple streaming algorithm, i.e., BASICSTREAMING. Then, we present HISTAPPROX to improve the efficiency significantly. Finally, we design a streaming version of HISTAPPROX, i.e., HISTSTREAMING. We theoretically show that our al- gorithms have constant approximation factors. • We propose a general inhomogeneous-decaying stream- ing model that allows each element to participate in subset selection for an arbitrary amount of time. • We design three algorithms to address the SSO-ID prob- • We conduct experiments on real data, and the results demonstrate that our method finds high quality solutions and is up to two orders of magnitude faster than GREEDY. lem with constant approximation factors. Our main contributions include: 2 Problem Statement Data Stream. A data stream comprises an unbounded se- quence of elements arriving in chronological order, denoted by {v1, v2, . . .}. Each element is from set V , called the ground set, and each element v has a discrete timestamp tv ∈ N. It is possible that multiple data elements arriving at the same time. In addition, there may be other attributes associated with each element. Inhomogeneous Decay. We propose an inhomogeneous- decaying data stream (IDS) model to enable inhomogeneous decays. For an element v arrived at time tv, it is assigned an initial lifespan l(v, tv) ∈ N representing the maximum time span that the element will remain active. As time advances to t ≥ tv, the element's remaining lifespan decreases to l(v, t)(cid:44) l(v, tv)−(t−tv). If l(v, t(cid:48)) = 0 at some time t(cid:48), v is discarded. We will assume l(v, tv) is given as an input to our algorithm. At any time t, active elements in the stream form a set, denoted by St (cid:44){v : v ∈ V ∧ tv ≤ t ∧ l(v, t) > 0}. IDS model is general. If l(v, tv) = ∞,∀v, an IDS be- comes an insertion-only stream. If l(v, tv) = W,∀v, an IDS becomes a sliding-window stream. If l(v, tv) follows a ge- ometric distribution parameterized by p, i.e., P (l(v, tv) = l) = (1 − p)l−1p, it is equivalent of saying that an active element is discarded with probability p at each time step. To simplify notations, if time t is clear from context, we will use lv to represent l(v, t), i.e., the remaining lifespan (or just say "the lifespan") of element v at time t. Monotone Submodular Function (Nemhauser, Wolsey, and Fisher 1978). A set function f : 2V (cid:55)→ R≥0 is submod- ular if f (S ∪ {s}) − f (S) ≥ f (T ∪ {s}) − f (T ), for all S ⊆ T ⊆ V and s ∈ V \T . f is monotone (non-decreasing) if f (S) ≤ f (T ) for all S ⊆ T ⊆ V . Without loss of gener- ality, we assume f is normalized, i.e., f (∅) = 0. Let δ(sS) (cid:44) f (S∪{s})−f (S) denote the marginal gain of adding element s to S. Then monotonicity is equivalent of saying that the marginal gain of every element is always non-negative, and submodularity is equivalent of saying that marginal gain δ(sS) of element s never increases as set S grows bigger, aka the diminishing returns property. Streaming Submodular Optimization with Inhomoge- neous Decays (SSO-ID). Equipped with the above no- tations, we formulate the cardinality constrained SSO-ID problem as follows: OPTt (cid:44) max s.t. S ⊆ St ∧ S ≤ k, f (S), S where k is a given budget. Remark. The SSO-ID problem is NP-hard, and active data St is continuously evolving with outdated data being dis- carded and new data being added in at every time t, which further complicates the algorithm design. A naive algorithm to solve the SSO-ID problem is that, when St is updated, we re-run GREEDY on St from scratch, and this approach out- puts a solution that is (1 − 1/e)-approximate. However, it needs O(kSt) utility function evaluations at each time step, which is unaffordable for large St. Our goal is to find faster algorithms with comparable approximation guarantees. 3 Algorithms V (t) 1 V (t) 2 V (t) 3 · · · · · · V (t) L A(t) L A(t) 1 St A(t) 2 A(t) 3 reset A(t) 1 and t ← t + 1 This section presents three algorithms to address the SSO-ID problem. Due to space limitation, the proofs of all theorems are included in the extended version of this paper. 3.1 Warm-up: The BASICSTREAMING Algorithm In the literature, SIEVESTREAMING (Badanidiyuru et al. 2014) is designed to address SSO over insertion-only streams. We leverage SIEVESTREAMING as a basic build- ing block to design a BASICSTREAMING algorithm. BA- SICSTREAMING is simple per se and may be inefficient, but offers opportunities for further improvement. This section assumes lifespan is upper bounded by L, i.e., lv ≤ L,∀v. We later remove this assumption in the following sections. SIEVESTREAMING (Badanidiyuru et al. 2014) is a thresh- old based streaming algorithm for solving cardinality con- strained SSO over insertion-only streams. The high level idea is that, for each coming element, it is selected only if its gain w.r.t. a set is no less than a threshold. In its im- plementation, SIEVESTREAMING lazily maintains a set of log1+ 2k = O(−1 log k) thresholds and each is associated with a candidate set initialized empty. For each coming ele- ment, its marginal gain w.r.t. each candidate set is computed; if the gain is no less than the corresponding threshold and the candidate set is not full, the element is added in the candi- date set. At any time, a candidate set having the maximum utility is the current solution. SIEVESTREAMING achieves an (1/2 − ) approximation guarantee. Algorithm Description. We show how SIEVESTREAMING can be used to design a BASICSTREAMING algorithm to solve the SSO-ID problem. Let Vt denote a set of elements arrived at time t. We partition Vt into (at most) L non- overlapping subsets, i.e., Vt = ∪L is the subset of elements with lifespan l at time t. BASICSTREAM- ING maintains L SIEVESTREAMING instances, denoted by {A(t) l=1, and alternates a data update step and a time up- date step to process the arriving elements Vt. • Data Update. This step processes arriving data Vt. Let in- stance A(t) l only process elements with lifespan no less than l. In other words, elements in ∪i≥lV (t) . After processing Vt, A(t) • Time Update. This step prepares for processing the up- coming data in the next time step. We reset instance A(t) 1 , i.e., empty its threshold set and each candidate set. Then we 2 ← 2 ,A(t+1) conduct a circular shift operation: A(t+1) 3 , . . . ,A(t+1) A(t) BASICSTREAMING alternates the two steps and continu- ously processes data at each time step. We illustrate BASIC- STREAMING in Fig. 2, with pseudo-code given in Alg. 1. Analysis. BASICSTREAMING exhibits a feature that an in- stance gradually expires (and is reset) as data processed in it expires. Such a feature ensures that, at any time t, A(t) 1 always processed all the data in St. Because A(t) is a SIEVESTREAMING instance, we immediately have the fol- lowing conclusions. 1 outputs the current solution. L ←A(t) 1 . are fed to A(t) 1 ←A(t) l where V (t) l=1V (t) l }L 1 i l l Fig. 2: BASICSTREAMING. Solid lines denote data update, and dashed lines denote time update. Alg. 1: BASICSTREAMING Input: An IDS of data elements arriving over time Output: A subset St at any time t l }L 1 Initialize L SIEVESTREAMING instances {A(1) 2 for t = 1, 2, . . . do 3 Feed A(t) l with data ∪i≥lV (t) for l = 1, . . . , L do ; 4 i l=1; 5 6 7 St ← output of A(t) 1 ; for l = 2, . . . , L do A(t+1) Reset A(t) 1 and A(t+1) L ← A(t) 1 ; l−1 ← A(t) l // data update ; // time update Theorem 1. BASICSTREAMING achieves an (1/2 − ) ap- proximation guarantee. Theorem 2. BASICSTREAMING uses O(L−1 log k) time to process each element, and O(Lk−1 log k) memory to store intermediate results (i.e., candidate sets). Remark. As illustrated in Fig. 2, data with lifespan l will be fed to {A(t) i }i≤l. Hence, elements with large lifespans will fan out to a large fraction of SIEVESTREAMING instances, and incur high CPU and memory usage, especially when L is large. This is the main bottleneck of BASICSTREAMING. On the other hand, elements with small lifespans only need to be fed to a few instances. Therefore, if data lifespans are mainly distributed over small values, e.g., power-law dis- tributed, then BASICSTREAMING is still efficient. 3.2 HISTAPPROX: Improving Efficiency To address the bottleneck of BASICSTREAMING when pro- cessing data with a large lifespan, we design HISTAPPROX in this section. HISTAPPROX can significantly improve the efficiency of BASICSTREAMING but requires active data St to be stored in RAM1. Strictly speaking, HISTAPPROX is not a streaming algorithm. We later remove the assumption of storing St in RAM in the next section. Basic Idea. If at any time, only a few instances are main- tained and running in BASICSTREAMING, then both CPU time and memory usage will decrease. Our idea is hence to selectively maintain a subset of SIEVESTREAMING in- stances that can approximate the rest. Roughly speaking, this arrive at a time, then St ≤(cid:80)t−1 1For example, if lifespan follows a geometric distribution, i.e., P (lv = l) = (1 − p)pl−1, l = 1, 2, . . ., and at most M elements 1−p . Hence, if RAM is 1−p , St actually can be stored in RAM even as t → ∞. a=0 M pa ≤ M larger than M idea can be thought of as using a histogram to approximate a curve. Specifically, let gt(l) denote the value of output of A(t) at time t. For very large L, we can think of {gt(l)}l≥1 as a "curve" (e.g., the dashed curve in Fig. 3). Our idea is to pick a few instances as active instances and construct a histogram to approximate this curve, as illustrated in Fig. 3. l {gt(l)}l≥1 Case 1 {gt(l)}l∈xt Case 3 Case 2 1 x2 x3 x4 x1 Fig. 3: Approximate {gt(l)}l≥1 by {gt(l)}l∈xt. x5 1 , x(t) The challenge is that, as new data keeps arriving, the curve is changing; hence, we need to update the histogram accord- ingly to make sure that the histogram always well approx- 2 , . . .} index a set of imates the curve. Let xt (cid:44) {x(t) i ≥ 1.2 In the active instances at time t, where each index x(t) follows, we describe the xt updating method, i.e., HISTAP- PROX, and the method guarantees that the maintained his- togram satisfies our requirement. Algorithm Description. HISTAPPROX consists of two steps: (1) updating indices; (2) removing redundant indices. • Updating Indices. The algorithm starts with an empty in- dex set, i.e., x1 = ∅. At time t, consider a set of newly arrived elements V (t) l with lifespan l. These elements will increase the curve before l (because data V (t) l will be fed to i }i≤l, see Fig. 2). There are three cases based on the {A(t) position of l, as illustrated in Fig. 3. Case 1. If l ∈ xt, we simply feed V (t) i }i∈xt∧i≤l. Case 2. If l /∈ xt and l has no successor in xt, we create a to {A(t) to {A(t) i }i∈xt∧i≤l. new instance A(t) Case 3. If l /∈ xt and l has a successor l2 ∈ xt. Let A(t) Above scheme guarantees that each A(t) l be a copy of A(t) i }i∈xt∧i≤l. Note that A(t) needs to process all data with lifespan ≥ l at time has processed all data with lifespan ≥ l2, we t. Because A(t) still need to feed A(t) l with historical data s.t. their lifespan ∈ [l, l2). That is the reason we need St to be stored in RAM. , l ∈ xt pro- cessed all the data with lifespan ≥ l at time t. The detailed pseudo-code is given in procedure Process of Alg. 2. • Removing Redundant Indices. Intuitively, if the outputs of two instances are close to each other, it is not necessary to keep both of them. We need the following definition to quantify redundancy. Definition 1 (-redundancy). At time t, consider two in- stances A(t) is -redundant if their exists j > l such that gt(j) ≥ (1 − )gt(i). l with i < l. We say A(t) , then we feed V (t) i and A(t) and feed V (t) to {A(t) l2 l2 l l l l l l l The above definition simply states that, since A(t) and are already close with each other, then instances be- i A(t) j 2Superscript t will be omitted if time t is clear from context. Alg. 2: HISTAPPROX Input: An IDS of data elements arriving over time Output: A subset St at any time t 1 x1 ← ∅; 2 for t = 1, 2, . . . do 3 (cid:54)= ∅ do Process(V (t) foreach V (t) St ← output of A(t) x1 ; if x1 = 1 then Kill A(t) for i = 1, . . . ,xt do A(t+1) xi−1 ← A(t) l ); 1 , xt← xt\{1}; i ← x(t) i − 1; 7 8 Procedure Process(V (t) l ) 9 10 if l has no successor in xt then xi , x(t+1) 5 6 4 l else // let l2 denote the successor of l if l /∈ xt then A(t) l ← new instance; A(t) l ← a copy of A(t) Feed A(t) lifespans ∈ [l, l2); xt ← xt ∪ {l}; l2 // Case 3 in Fig. 3 l with historical data elements s.t. their ; // Vt = ∪lV (t) // data update l // time update // Case 2 in Fig. 3 11 12 13 14 15 21 foreach i ∈ xt and i ≤ l do Feed A(t) ReduceRedundancy(); foreach i ∈ xt do 16 17 18 Procedure ReduceRedundancy() 19 20 Find the largest j > i in xt s.t. gt(j)≥ (1−)gt(i); Delete each index l∈ xt s.t. i < l < j and kill A(t) ; l i with V (t) l ; tween them are redundant. In HISTAPPROX, we regularly check the output of each instance and terminate those redun- dant ones, as described in ReduceRedundancy of Alg. 2. Analysis. Notice that indices x ∈ xt and x + 1 ∈ xt−1 are actually the same index (if they both exist) but appear at different time. In general, we say x(cid:48) ∈ xt(cid:48) is an ancestor of x ∈ xt if t(cid:48) ≤ t and x(cid:48) = x + t − t(cid:48). In the follows, let x(cid:48) denote x's ancestor at time t(cid:48). First, HISTAPPROX maintains a histogram satisfying the following property. Lemma 1. For two consecutive indices xi, xi+1 ∈ xt at any time t, one of the following two cases holds: C1 St contains no data with lifespan ∈ (xi, xi+1). C2 gt(cid:48)(x(cid:48) i+1) ≥ (1−)gt(cid:48)(x(cid:48) i) at some time t(cid:48) ≤ t, and from time t(cid:48) to t, there is no data with lifespan between the two indices arrived (exclusive). Histogram with property C2 is known as a smooth his- togram (Braverman and Ostrovsky 2007). Smooth his- togram together with the submodularity of f are sufficient to ensure a constant factor approximation guarantee of gt(x1). Theorem 3. HISTAPPROX is (1/3− )-approximate, i.e., at any time t, gt(x1) ≥ (1/3 − )OPTt. Theorem 4. HISTAPPROX uses O(−2 log2 k) time to pro- cess each coming element and O(k−2 log2 k) memory to store intermediate results and St memory to store St. Remark. Because we use a histogram to approximate a curve, HISTAPPROX has a weaker approximation guarantee than BASICSTREAMING. In experiments, we observe that HISTAPPROX finds solutions with quality very close to BA- SICSTREAMING and is much faster. The main drawback of HISTAPPROX is that active data St needs to be stored in RAM to ensure each A(t) 's output is accurate. If St is larger than RAM capacity, then HISTAPPROX is inapplicable. We address this limitation in the following section. l 3.3 HISTSTREAMING: A Heuristic Streaming Algorithm l l Based on HISTAPPROX, this section presents a streaming al- gorithm HISTSTREAMING, which uses heuristics to further improve the efficiency of HISTAPPROX. HISTSTREAMING no longer requires storing active data St in memory. Basic Idea. If we do not need to process the historical data in HISTAPPROX (Line 14), then there is no need to store St. What if A(t) does not process historical data? Because A(t) does not process all the data with lifespan ≥ l in St, there will be a bias between its actual output gt(l) and ex- pected output gt(l). We only need to worry about the case gt(l) < gt(l), as the other case gt(l) ≥ gt(l) means that without processing historical data, A(t) l finds even better so- lutions (which may rarely happen in practice but indeed pos- sible). In the follows, we apply two useful heuristics to de- sign HISTSTREAMING, and show that historical data can be ignored due to its insignificance and submodularity of ob- jective function. Effects of historical data. Intuitively, if historical data is in- significant, then a SIEVESTREAMING instance may not need to process it at all, and can still output quality guaranteed solutions. We notice that, in HISTAPPROX, a newly created instance A(t) essentially needs to process three substreams: (1) elements arrived before t with lifespan ≤ l2 (Line 13)3; (2) unprocessed historical elements with lifespan ∈ [l, l2) (Line 14); (3) newly arrived elements Vl (Line 16). Denote these three substreams by S1, S2 and S3, respectively. We state a useful lemma below. Lemma 2. Let S1(cid:107)S2(cid:107)S3 denote the concatenation of three substreams S1, S2, S3. Let A(S) denote the output value of applying SIEVESTREAMING algorithm A on stream S. If A(S1) ≥ αA(S1(cid:107)S2) for 0 < α < 1, then A(S1(cid:107)S3) ≥ (1/4 − )αOPT where OPT is the value of an optimal so- lution in stream S1(cid:107)S2(cid:107)S3. Lemma 2 states that, if historical data S2 is insignificant, i.e., A(S1) ≥ αA(S1(cid:107)S2) for 0 < α < 1 (the closer α is to 1, the less significant S2 is), then an instance does not need to process S2 and still finds quality guaranteed solu- tions. This will further ensure that HISTAPPROX finds qual- ity guaranteed solutions (more explanation on this point can be found in the extended version of this paper). Although it is intractable to theoretically show that historical data S2 is indeed insignificant, intuitively, as unprocessed histori- cal data S2 is caused by the deletion of redundant instances (consider the example given in Fig. 4). These instances are 's successor A(t) 3This substream is actually processed by A(t) , l and note that A(t) is copied from A(t) . l l2 l l2 Alg. 3: HISTSTREAMING 1 Procedure Process(V (t) l ) 2 3 4 if l /∈ xt then δl ← 0; ··· // If l has a successor l2 A(t) l ← a copy of A(t) ; Find i, j ∈ xt s.t. l ∈ (i, j) and δij is recorded, then let δl ← δij; l2 5 6 ··· foreach i ∈ xt do 7 8 Procedure ReduceRedundancy() 9 10 (j)≥ (1−)gt(i); Find the largest j > i in xt s.t. g Delete each index l∈ xt s.t. i < l < j and kill A(t) ; // Record the amount of unprocessed data in (i, j) δij ← gt(i); t l 11 12 redundant because A(S1S2) does not increase much upon A(S1). Hence, it makes sense to assume that historical data S2 is insignificant, and by Lemma 2, S2 can be ignored. t(cid:48) t l(cid:48) 1 l(cid:48) 0 l(cid:48) 2 l1 l l0 l2 Fig. 4: At time t(cid:48), data with lifespan l(cid:48) 0 arrives and forms a redun- dant instance, which is removed. At time t > t(cid:48), data with lifespan l arrives and A(t) is created. Data at l0 becomes the unprocessed his- torical data. We thus say that unprocessed historical data is caused by the deletion of redundant instance at previous time. l l t t t (l), gt(l)] where g Protecting non-redundant instances. To further ensure the solution quality of HISTSTREAMING, we introduce another heuristic to protect non-redundant instances. Because gt(l) is unknown, to avoid removing instances that are actually not redundant, we give each instance A(t) an amount of value, denoted by δl, as compensation for not processing historical data, i.e., gt(l) may be as large as gt(l) + δl. This allows us to represent gt(l) by an interval (l) (cid:44) gt(l) and gt(l) (cid:44) gt(l) + δl. [g (j) ≥ (1 − )gt(i) implies gt(j) ≥ (1 − )gt(i), As g the condition in Line 20 of HISTAPPROX is replaced by (j) ≥ (1 − )gt(i). g We want δl to be related to the amount of historical data that A(t) l does not process. Recall the example in Fig. 4. Un- processed historical data is always fed to l's predecessor in- stance whenever redundant instances are removed in the in- 2) ≥ (1−)gt(cid:48)(l(cid:48) terval l belonging to. Also notice that gt(cid:48)(l(cid:48) 1) holds after the removal of redundant instances. Hence, the contribution of unprocessed historical data can be estimated to be at most gt(cid:48)(l(cid:48) 1). In general, if some redundant indices are removed in interval (i, j) at time t, we set δl = gt(i) for index l that is later created in the interval (i, j). Algorithm Description. We only need to slightly modify Process and ReduceRedundancy (see Alg. 3). t Remark. HISTSTREAMING uses heuristics to further im- prove the efficiency of HISTAPPROX, and no longer needs to store St in memory. In experiments, we observe that HIST- STREAMING can find high quality solutions. 4 Experiments In this section, we construct several maximum coverage problems to evaluate the performance of our methods. We use real world and public available datasets. Note that the optimization problems defined on these datasets may seem to be simplistic, as our main purpose is to validate the perfor- mance of proposed algorithms, and hence we want to keep the problem settings as simple and clear as possible. 4.1 Datasets DBLP. We construct a representative author selection prob- lem on the DBLP dataset (DBLP 2018), which records the meta information of about 3 million papers, including 1.8 million authors and 5, 079 conferences from 1936 to 2018. We say that an author represents a conference if the author published papers in the conference. Our goal is to maintain a small set of k authors that jointly represent the maximum number of distinct conferences at any time. We filter out au- thors that published less than 10 papers and sort the remain- ing 188, 383 authors by their first publication date to form an author stream. On this dataset, an author's lifespan could be defined as the time period between its first and last publi- cation dates. StackExchange. We construct a hot question selection problem on the math.stackexchange.com website (Stack- Exchange 2018). The dataset records about 1.3 million questions with 152 thousand commenters from 7/2010 to 6/2018. We say a question is hot if it attracts many com- menters to comment. Our goal is select a small set of k questions that jointly attract the maximum number of dis- tinct commenters at any time. The questions are ordered by the post date, and the lifespan of a question can be defined as the time interval length between its post time and last com- ment time. 4.2 Settings Benchmarks. We consider the following two methods as benchmarks. • GREEDY. We re-run GREEDY on the active data St at each time t, and apply the lazy evaluation trick (Mi- noux 1978) to further improve its efficiency. GREEDY will serve as an upper bound. • RANDOM. We randomly pick k elements from active data St at each time t. RANDOM will serve as a lower bound. Efficiency Measure. When evaluating algorithm efficiency, we follow the previous work (Badanidiyuru et al. 2014) and record the number of utility function evaluations, i.e., the number of oracle calls. The advantage of this measure is that it is independent of the concrete algorithm implementation and platform. Lifespan Generating. In order to test the algorithm perfor- mance under different lifespan distributions, we also con- sider generating data lifespans by sampling from a geomet- ric distribution, i.e., P (le = l) = (1 − p)l−1p, l = 1, 2, . . .. Here 0 < p < 1 controls the skewness of geometric distribu- tion, i.e., larger p implies that a data element is more likely to have a small lifespan. 4.3 Results Analyzing BASICSTREAMING. Before comparing the per- formance of our algorithms with benchmarks, let us first study the properties of BASICSTREAMING, as it is the ba- sis of HISTAPPROX and HISTSTREAMING. We mainly an- alyze how lifespan distribution affects the performance of BASICSTREAMING. To this end, we generate lifespans from Geo(p) with varying p, and truncate the lifespan at L = 1, 000. We run the three proposed algorithms for 100 time steps and maintain a set with cardinality k = 10 at every time step. We set  = 0.1. The solution value and number of oracle calls (at time t = 100) are depicted in Figs. 5 and 6, respectively. (a) DBLP (b) StackExchange Fig. 5: Solution value comparison (higher is better) (a) DBLP (b) StackExchange Fig. 6: Oracle calls comparison (lower is better) Figure 5 states that the outputs of the three methods are always close with each other under different lifespan dis- tributions, i.e., they always output similar quality solutions. Fig. 6 states that BASICSTREAMING requires much more oracle calls than the other two methods, indicating that BA- SICSTREAMING is less efficient than the other two meth- ods. We also observe that, as p increases (hence more data elements tend to have small lifespans), the number of ora- cle calls of BASICSTREAMING decreases. This confirms our previous analysis that BASICSTREAMING is efficient when 100 200 300 400 500 600 0.002 0.004 0.006 0.008 0.01valuepBasicStreamingHistApproxHistStreaming 50 60 70 80 90 100 110 120 130 0.002 0.004 0.006 0.008 0.01valuepBasicStreamingHistApproxHistStreaming103104105106107 0.002 0.004 0.006 0.008 0.01oracle callspBasicStreamingHistApproxHistStreaming103104105106107 0.002 0.004 0.006 0.008 0.01oracle callspBasicStreamingHistApproxHistStreaming most data elements have small lifespans. We also observe that HISTAPPROX and HISTSTREAMING are not quite sen- sitive to lifetime distribution, and they are much more effi- cient than BASICSTREAMING. In addition, we observe that HISTSTREAMING is slightly faster than HISTAPPROX even though HISTSTREAMING uses smaller RAM. This experiment demonstrates that BASICSTREAMING, HISTAPPROX, and HISTSTREAMING find solutions with similar quality, but HISTAPPROX and HISTSTREAMING are much more efficient than BASICSTREAMING. Performance Over Time. In the next experiment, we fo- cus on analyzing the performance of HISTSTREAMING. We fix the lifespan distribution to be Geo(0.001) with L = 10, 000, and run each method for 5, 000 time steps to main- tain a set with cardinality k = 10. Figs. 7 and 8 depict the solution value and ratio of the number of oracle calls (w.r.t. GREEDY), respectively. (a) DBLP (b) StackExchange Fig. 7: Solution value over time (higher is better) (a) DBLP (b) StackExchange Fig. 8: Oracle calls ratio over time (lower is better) Figure 7 shows that GREEDY and RANDOM always find the best and worst solutions, respectively, which is expected. HISTSTREAMING finds solutions that are close to GREEDY. Small  can further improve the solution quality. In Fig. 8, we show the ratio of cumulative number of oracle calls be- tween HISTSTREAMING and GREEDY. It is clear to see that HISTSTREAMING uses quite a small number of oracle calls comparing with GREEDY. Larger  further improves effi- ciency, and for  = 0.2 the speedup of HISTSTREAMING could be up to two orders of magnitude faster than GREEDY. This experiment demonstrates that HISTSTREAMING finds solutions with quality close to GREEDY and is much more efficient than GREEDY.  can trade off between solu- tion quality and computational efficiency. Performance under Different Budget k. Finally, we conduct experiments to study the performance of HIST- STREAMING under different budget k. Here, we choose the lifespan distribution as the same as the previous experiment, and set  = 0.2. We run HISTSTREAMING and GREEDY for 1000 time steps and compute the ratios of solution value and number of oracle calls between HISTSTREAMING and GREEDY. The results are depicted in Fig. 9. (a) DBLP (b) StackExchange Fig. 9: Ratios under different budget k In general, using different budgets, HISTSTREAMING al- ways finds solutions that are close to GREEDY, i.e., larger than 80%; but uses very few oracle calls, i.e., less than 10%. Hence, we conclude that HISTSTREAMING finds solutions with similar quality to GREEDY, but is much efficient than GREEDY, under different budgets. 5 Related Work Cardinality Constrained Submodular Function Maxi- mization. Submodular optimization lies at the core of many data mining and machine learning applications. Because the objectives in many optimization problems have a di- minishing returns property, which can be captured by sub- modularity. In the past few years, submodular optimization has been applied to a wide variety of scenarios, including sensor placement (Krause, Singh, and Guestrin 2008), out- break detection (Leskovec et al. 2007), search result diver- sification (Agrawal et al. 2009), feature selection (Brown et al. 2012), data summarization (Mirzasoleiman et al. 2015; Mitrovic et al. 2018), influence maximization (Kempe, Kleinberg, and Tardos 2003), just name a few. The GREEDY algorithm (Nemhauser, Wolsey, and Fisher 1978) plays as a silver bullet in solving the cardinality constrained sub- modular maximization problem. Improving the efficiency of GREEDY algorithm has also gained a lot of interests, such as lazy evaluation (Minoux 1978), disk-based opti- mization (Cormode, Karloff, and Wirth 2010), distributed computation (Epasto, Mirrokni, and Zadimoghaddam 2017; Kumar et al. 2013), sampling (Mirzasoleiman et al. 2015), etc. Streaming Submodular Optimization (SSO). SSO is an- other way to improve the efficiency of solving submodular optimization problems, and are gaining interests in recent years due to the rise of big data and high-speed streams that an algorithm can only access a small fraction of the data at a time point. Kumar et al. (2013) design stream- ing algorithms that need to traverse the streaming data for a 0 200 400 600 800 1000 1200 0 1000 2000 3000 4000 5000valuetimeGreedyHistStreaming (ε=0.1)HistStreaming (ε=0.2)Random 0 50 100 150 200 0 1000 2000 3000 4000 5000valuetimeGreedyHistStreaming (ε=0.1)HistStreaming (ε=0.2)Random 0 0.2 0.4 0.6 0.8 1 0 1000 2000 3000 4000 5000oracle calls ratiotimeHistStreaming (ε=0.1)HistStreaming (ε=0.2) 0 0.2 0.4 0.6 0.8 1 0 1000 2000 3000 4000 5000oracle calls ratiotimeHistStreaming (ε=0.1)HistStreaming (ε=0.2) 0 0.2 0.4 0.6 0.8 1 20 40 60 80 100ratiokvalueoracle calls 0 0.2 0.4 0.6 0.8 1 20 40 60 80 100ratiokvalueoracle calls few rounds which is suitable for the MapReduce framework. Badanidiyuru et al. (2014) then design the SIEVESTREAM- ING algorithm which is the first one round streaming al- gorithm for insertion-only streams. SIEVESTREAMING is adopted as the basic building block in our algorithms. SSO over sliding-window streams has recently been studied by Chen et al. (2016) and Epasto et al. (2017) respectively, that both leverage smooth histograms (Braverman and Ostrovsky 2007). Our algorithms actually can be viewed as a general- ization of these existing methods, and our SSO techniques apply for streams with inhomogeneous decays. Streaming Models. The sliding-window streaming model is proposed by Datar et al. (2002). Cohen et al. (2006) later extend the sliding-window model to general time-decaying model for the purpose of approximating summation aggre- gates in data streams (e.g., count the number of 1's in a 01 stream). Cormode et al. (2009) consider the similar estima- tion problem by designing time-decaying sketches. These studies have inspired us to propose the IDS model. 6 Conclusion When a data stream consists of elements with different lifespans, existing SSO techniques become inapplicable. This work formulates the SSO-ID problem, and presents three new SSO techniques to address the SSO-ID problem. BASICSTREAMING is simple and achieves an (1/2 − ) approximation factor, but it may be inefficient. HISTAP- PROX improves the efficiency of BASICSTREAMING sig- nificantly and achieves an (1/3 − ) approximation fac- tor, but it requires additional memory to store active data. HISTSTREAMING uses heuristics to further improve the ef- ficiency of HISTAPPROX, and no longer requires storing ac- tive data in memory. In practice, if memory is not a prob- lem, we suggest using HISTAPPROX as it has a provable ap- proximation guarantee; otherwise, HISTSTREAMING is also a good choice. Acknowledgment We would like to thank the anonymous reviewers for their valuable comments and suggestions to help us improve this paper. This work is financially supported by the King Abdul- lah University of Science and Technology (KAUST) Sensor Initiative, Saudi Arabia. The work of John C.S. Lui was sup- ported in part by the GRF Funding 14208816. References [2009] Agrawal, R.; Gollapudi, S.; Halverson, A.; and Ieong, S. 2009. Diversifying search results. In WSDM, WSDM. [2014] Badanidiyuru, A.; Mirzasoleiman, B.; Karbasi, A.; and Krause, A. 2014. Streaming submodular maximization: Massive data summarization on the fly. In KDD. [2007] Braverman, V., and Ostrovsky, R. 2007. Smooth his- tograms for sliding windows. In FOCS. [2012] Brown, G.; Pocock, A.; Zhao, M.-J.; and Luj´an, M. 2012. Conditional likelihood maximisation: A unify- ing framework for information theoretic feature selection. JMLR 13:27 -- 66. 2016. In https://news. [2016] Chen, J.; Nguyen, H. L.; and Zhang, Q. Submodular maximization over sliding windows. arXiv:1611.00129. [2006] Cohen, E., and Strauss, M. J. 2006. Maintaining time- decaying stream aggregates. Journal of Algorithms 59:19 -- 36. [2010] Cormode, G.; Karloff, H.; and Wirth, A. 2010. Set cover algorithms for very large datasets. In CIKM. [2009] Cormode, G.; Tirthapura, S.; and Xu, B. 2009. Time- decaying sketches for robust aggregation of sensor data. SIAM Journal on Computing 39(4):1309 -- 1339. [2002] Datar, M.; Gionis, A.; Indyk, P.; and Motwani, R. 2002. Maintaining stream statistics over sliding windows. SIAM Journal on Computing 31(6):1794 -- 1813. [2018] 2018. DBLP computer science bibliography. http: //dblp.dagstuhl.de/. [2017] Epasto, A.; Lattanzi, S.; Vassilvitskii, S.; and Zadi- moghaddam, M. 2017. Submodular optimization over slid- ing windows. In WWW. [2017] Epasto, A.; Mirrokni, V.; and Zadimoghaddam, M. 2017. Bicriteria distributed submodular maximization in a few rounds. In SPAA. Hacker News. [2018] 2018. ycombinator.com/newest. [2003] Kempe, D.; Kleinberg, J.; and Tardos, E. 2003. Max- imizing the spread of influence through a social network. In KDD. [2014] Krause, A., and Golovin, D. 2014. Submodular func- tion maximization. In Tractability: Practical Approaches to Hard Problems. Cambridge University Press. [2008] Krause, A.; Singh, A.; and Guestrin, C. 2008. Near- optimal sensor placements in Gaussian processes: Theory, efficient algorithms and empirical studies. JMLR 9:235 -- 284. [2013] Kumar, R.; Moseley, B.; Vassilvitskii, S.; and Vattani, A. 2013. Fast greedy algorithms in MapReduce and stream- ing. In SPAA. [2009] Leskovec, J.; Backstrom, L.; and Kleinberg, J. 2009. Meme-tracking and the dynamics of the news cycle. In KDD. [2007] Leskovec, J.; Krause, A.; Guestrin, C.; Faloutsos, C.; VanBriesen, J.; and Glance, N. 2007. Cost-effective out- break detection in networks. In KDD. [1978] Minoux, M. 1978. Accelerated greedy algorithms for maximizing submodular set functions. Optimization Tech- niques 7:234 -- 243. [2015] Mirzasoleiman, B.; Badanidiyuru, A.; Karbasi, A.; Vondrak, J.; and Krause, A. 2015. Lazier than lazy greedy. In AAAI. [2018] Mitrovic, M.; Kazemi, E.; Zadimoghaddam, M.; and Karbasi, A. 2018. Data summarization at scale: A two-stage submodular approach. In ICML. [1978] Nemhauser, G.; Wolsey, L.; and Fisher, M. 1978. An analysis of approximations for maximizing submodular set functions - I. Mathematical Programming 14:265 -- 294. [2018] 2018. archive.org/details/stackexchange. [2018] 2018. internetlivestats.com/one-second. Tweets per second. Stack Exchange data dump. https:// http://www. Proof of Lemma 1 i+1 became the successor of x(cid:48) i due to the removal of indices between them at some most recent time t(cid:48) ≤ t, then Proof. If x(cid:48) i) after the removal at time t(cid:48). From time t(cid:48) procedure ReduceRedundancy in Alg. 2 guarantees that gt(cid:48)(x(cid:48) to t, it is also impossible to have data elements with lifespans between the two indices. Otherwise we will meet a contradiction: either these elements form redundant SIEVESTREAMING instances again thus t(cid:48) is not the most recent time as claimed, or these elements form non-redundant SIEVESTREAMING instances thus xi and xi+1 cannot be consecutive at time t. We thus get C2. i when one of them is inserted in the histogram at some time t(cid:48) ≤ t. Without lose of generality, let us assume x(cid:48) i at time t(cid:48). If elements with lifespans between the two indices arrive from time t(cid:48) to t, these elements must form redundant SIEVESTREAMING instances. We still get C2. Or, there is no element with lifespan between the two indices at all, i.e., St contains no data with lifespan between xi and xi+1. We thus get C1. This completes the proof. i+1 became the successor of x(cid:48) i+1 is inserted after x(cid:48) i+1) ≥ (1−)gt(cid:48)(x(cid:48) Otherwise x(cid:48) Proof. If x1 = 1 at time t, then A(t) 1 exists. By the property of SIEVESTREAMING, we conclude that Proof of Theorem 3 gt(x1) = gt(1) ≥ ( − )OPTt. 1 2 Otherwise we have x1 > 1 at time t. If St contains elements with lifespan less than x1, then A(t) Let x0 denote the most recent expired predecessor of x1 at time t, and let t(cid:48) < t denote the last time x0's ancestor x(cid:48) elements in St, thus incurs a loss of solution quality. Our goal is to bound this loss. 0 was still alive, i.e., x(cid:48) 0 = 1 at time t(cid:48) (cf. Fig. 10). For ease of presentation, we commonly refer to x0 and x0's ancestors as the left index, and refer to x1 and x1's ancestors as the right index. Obviously, in time interval (t(cid:48), t], no element with lifespan less than the right index arrives; otherwise, these elements would create new indices before the right index; then x1 will not be the first index at time t, or x0 is not the most recent expired predecessor of x1 at time t. x1 does not process all of the t(cid:48)(cid:48) t(cid:48) t 1 x(cid:48)(cid:48) 0 left index x(cid:48) 0 = 1 x(cid:48) 1 x(cid:48)(cid:48) 1 right index x0 1 x1 Fig. 10: Indices relations at time t(cid:48)(cid:48) ≤ t(cid:48) < t. For ease of presentation, x0 (resp. x1) and its ancestors will be simply referred to as the left (right) index. 0 and x(cid:48) Notice that x(cid:48) 1 are two consecutive indices at time t(cid:48). By Lemma 1, we have two cases. • If C1 holds. In this case, St(cid:48) contains no element with lifespan between x(cid:48) 0 and x(cid:48) 1. Because there is also no element with lifespan less than the right index from time t(cid:48) to t, then St has no element with lifespan less than x1 at time t. Therefore, A(t) x1 processed all of the elements in St. By the property of SIEVESTREAMING, we still have − )OPTt. gt(x1) = gt(1) ≥ ( 1 2 • If C2 holds. In this case, there exists some time t(cid:48)(cid:48) ≤ t(cid:48) s.t. gt(cid:48)(cid:48) (x(cid:48)(cid:48) 1 ) ≥ (1 − )gt(cid:48)(cid:48) (x(cid:48)(cid:48) 0 ) holds (cf. Fig. 10), and from time t(cid:48)(cid:48) to t(cid:48), no element with lifespan between the two indices arrived (however St may have elements with lifespan less than x1 at time t and these elements arrived before time t(cid:48)(cid:48)). Notice that elements with lifespan no larger than the left index all expired after time t(cid:48) and they do not affect the solution at time t; therefore, we can safely ignore these elements in our analysis and only care elements with lifespan no less than the right index arrived in interval [t(cid:48)(cid:48), t]. Notice that these elements are only inserted on the right side of the right index. 0 ); from time t(cid:48)(cid:48) to t, the two instances are fed with same elements. Such a scenario has been studied in the sliding-window case (Epasto et al. 2017). By submodularity of f and suffix-monotonicity4 of the SIEVESTREAMING algorithm, the following lemma guarantees that gt(x1) is close to OPTt. Lemma 3. Consider a cardinality constrained monotone submodular function maximization problem. Let A(S) denote the output value of applying the SIEVESTREAMING algorithm on stream S. Let S(cid:107)S(cid:48) denote the concatenation of two streams S and S(cid:48). If A(S2) ≥ (1 − )A(S1) for S2 ⊆ S1 (i.e., each element in stream S2 is also an element in stream S1), then A(S2(cid:107)S) ≥ (1/3 − )OPT for all S, where OPT is the value of an optimal solution in stream S1(cid:107)S. In other words, at time t(cid:48)(cid:48), the output values of the two instances satisfy gt(cid:48)(cid:48)(x(cid:48)(cid:48) 1 ) ≥ (1 − )gt(cid:48)(cid:48) (x(cid:48)(cid:48) 4That is, feeding more elements to a SIEVESTREAMING algorithm cannot decrease its output value. input elements. After time t(cid:48)(cid:48), the two instances are fed with same elements. Hence, gt(x1) ≥ (1/3 − )OPTt. In our scenario, at time t(cid:48)(cid:48) the two instances satisfy gt(cid:48)(cid:48) (x(cid:48)(cid:48) Combining above results, we conclude that HISTAPPROX guarantees a (1/3 − ) approximation factor. 1 ) ≥ (1 − )gt(cid:48)(cid:48) (x(cid:48)(cid:48) 's input elements is a subset of Ax(cid:48)(cid:48) 0 ) and Ax(cid:48)(cid:48) 1 's 0 Proof of Theorem 4 Proof. At any time t, because gt(xi+2) < (1 − )gt(xi), and gt(l) ∈ [∆, k∆] where ∆ (cid:44) max{f (v) : v ∈ V }, then the size of index set xt is upper bounded by O(log(1−)−1 k) = O(−1 log k). For each data element, in the worst case, we need to update xt SIEVESTREAMING instances, and each SIEVESTREAMING instance has update time O(−1 log k). In addition, procedure ReduceRedundancy has complexity is O(−2 log2 k). Thus the total time complexity is O(−2 log2 k). For memory usage, because HISTAPPROX maintains xt SIEVESTREAMING instances, and each instance uses memory O(k−1 log k)). Thus the total memory used by HISTAPPROX is O(k−2 log2 k)). Proof of Lemma 2 We state a more general conclusion than Lemma 2. This conclusion will be useful in the later discussion. Lemma 4. Let S1(cid:107)S2(cid:107)S3 denote the concatenation of three streams S1, S2, S3. Let A denote an insertion-only SSO algorithm with approximation factor c. Let A(S) denote the output value of applying algorithm A on stream S. Assume A is suffix- monotone, i.e., A(S(cid:107)S(cid:48)) ≥ A(S),∀S(cid:48). Let OPT denote the value of an optimal solution in stream S1(cid:107)S2(cid:107)S3. Then we have the following results: (1) If A(S2) ≥ (1 − )A(S1(cid:107)S2), then A(S2(cid:107)S3) ≥ c (2) If A(S1) ≥ (1 − )A(S1(cid:107)S2), then A(S1(cid:107)S3) ≥ c Proof. Let O123, O12, O13, O23, and O3 denote the optimal solutions in streams S1(cid:107)S2(cid:107)S3, S1(cid:107)S2, S1(cid:107)S3, S2(cid:107)S3, and S3, respectively. 2 (1 − )OPT.5 2 (1 − )OPT. To prove (1), by the property of algorithm A, we have We also have Combining above two relations, we have A(S2(cid:107)S3) ≥ cf (O23). A(S2(cid:107)S3) ≥ A(S2) ≥ (1 − )A(S1(cid:107)S2) ≥ c(1 − )f (O12). 2A(S2(cid:107)S3) ≥ c(1 − )f (O12) + cf (O23) ≥ c(1 − )[f (O12) + f (O23)] ≥ c(1 − )[f (O12) + f (O3)] ≥ c(1 − )[f (O123 ∩ O12) + f (O123 ∩ O3)] ≥ c(1 − )f (O123) = c(1 − )OPT where the last inequality holds due to the submodularity of f.6 We hence obtain (1 − )f (O123). A(S2(cid:107)S3) ≥ c 2 To prove (2), similarly, by the property of algorithm A, we have We also have A(S1(cid:107)S3) ≥ cf (O13). A(S1(cid:107)S3) ≥ A(S1) ≥ (1 − )A(S1(cid:107)S2) ≥ c(1 − )f (O12). 5Adapted from Lemma 1 in (Chen, Nguyen, and Zhang 2016). 6For two sets A, B ⊆ V and a submodular function f : 2V (cid:55)→ R, it holds that f (A) + f (B) ≥ f (A ∪ B) + f (A ∩ B). Combining above two relations, we have 2A(S1(cid:107)S3) ≥ c(1 − )f (O12) + cf (O13) ≥ c(1 − )[f (O12) + f (O13)] ≥ c(1 − )[f (O12) + f (O3)] ≥ c(1 − )[f (O123 ∩ O12) + f (O123 ∩ O3)] ≥ c(1 − )f (O123) = c(1 − )OPT. A(S1(cid:107)S3) ≥ c 2 (1 − )f (O123). We hence obtain If A is the SIEVESTREAMING algorithm, then c = 1/2 − . In (2), replace the condition A(S1) ≥ (1 − )A(S1(cid:107)S2) by A(S1) ≥ αA(S1(cid:107)S2), then we immediately obtain Lemma 2. Conclusion (1) of Lemma 4 is a generalization of Lemma 3. Lemma 3 is specific to SIEVESTREAMING and the proof of Note that conclusions (1) and (2) in Lemma 4 can also be unified. Lemma 3 leverages a specific property of the SIEVESTREAMING algorithm. Hence, a better bound is obtained. Lemma 5. Let S(cid:107)S(cid:48) denote the concatenation of two streams S and S(cid:48). Let A denote an insertion-only SSO algorithm with approximation factor c. Let A(S) denote the output value of applying algorithm A on stream S. Assume A is suffix-monotone, i.e., A(S(cid:107)S(cid:48)) ≥ A(S),∀S(cid:48). If two streams S1, S2 have relation S2 ⊆ S1, i.e., each element in stream S2 is also an element in stream S1, and A(S2) ≥ (1 − )A(S1), then A(S2(cid:107)S) ≥ c 2 (1 − )OPT for all stream S, where OPT is the value of an optimal solution in stream S1(cid:107)S. A Note On HISTAPPROX and HISTSTREAMING x1 processes all the elements in St. Hence, gt(x1) ≥ (1/2 − )OPTt. HISTAPPROX maintains a histogram satisfying Lemma 1, which ensures two consecutive indices x0 and x1 to satisfy either Case 1 or Case 2. Case 1 is trivial. It simply states that there is no data with lifespan between x0 and x1. This property is used in the proof to show that A(t) 0) at some time t(cid:48), and from t(cid:48) to t, Ax0 and Ax1 are fed with same elements. Case 2 states that, gt(cid:48)(x(cid:48) Lemma 3 then guarantees that their output values will remain close with each other after time t(cid:48), and gt(x1) ≥ (1/3−)OPTt ≥ (1/3 − )gt(x0). As we discussed in the proof of Lemma 4, conclusion (1) of Lemma 4 generalizes Lemma 3. Hence, if Ax0 and Ax1 in HISTAPPROX could find solutions with constant approximation factors, then in Case 2, their output values will be still close with each other, and gt(x1) has a constant approximation factor to OPTt. 1) ≥ (1 − )gt(cid:48)(x(cid:48) HISTSTREAMING algorithm essentially leverages above observation. HISTSTREAMING ignores the insignificant historical data and conclusion (2) of Lemma 4 guarantees that each instance in HISTSTREAMING still has a constant approximation factor. Then when we were in Case 2, conclusion (1) of Lemma 4 will guarantee that gt(x1) has a constant approximation factor to OPTt.
1110.1894
1
1110
2011-10-10T00:09:55
On the Efficiency of Influence-and-Exploit Strategies for Revenue Maximization under Positive Externalities
[ "cs.DS", "cs.CC", "cs.SI" ]
We study the problem of revenue maximization in the marketing model for social networks introduced by (Hartline, Mirrokni, Sundararajan, WWW '08). We restrict our attention to the Uniform Additive Model and mostly focus on Influence-and-Exploit (IE) marketing strategies. We obtain a comprehensive collection of results on the efficiency and the approximability of IE strategies, which also imply a significant improvement on the best known approximation ratios for revenue maximization. Specifically, we show that in the Uniform Additive Model, both computing the optimal marketing strategy and computing the best IE strategy are $\NP$-hard for undirected social networks. We observe that allowing IE strategies to offer prices smaller than the myopic price in the exploit step leads to a measurable improvement on their performance. Thus, we show that the best IE strategy approximates the maximum revenue within a factor of 0.911 for undirected and of roughly 0.553 for directed networks. Moreover, we present a natural generalization of IE strategies, with more than two pricing classes, and show that they approximate the maximum revenue within a factor of roughly 0.7 for undirected and of roughly 0.35 for directed networks. Utilizing a connection between good IE strategies and large cuts in the underlying social network, we obtain polynomial-time algorithms that approximate the revenue of the best IE strategy within a factor of roughly 0.9. Hence, we significantly improve on the best known approximation ratio for revenue maximization to 0.8229 for undirected and to 0.5011 for directed networks (from 2/3 and 1/3, respectively, by Hartline et al.).
cs.DS
cs
On the Efficiency of Influence-and-Exploit Strategies for Revenue Maximization under Positive Externalities(cid:63) Dimitris Fotakis and Paris Siminelakis School of Electrical and Computer Engineering, National Technical University of Athens, 157 80 Athens, Greece. Email: [email protected], [email protected] Abstract. We study the problem of revenue maximization in the marketing model for social networks in- troduced by (Hartline, Mirrokni, Sundararajan, WWW '08). In this setting, a digital product is sold to a set of potential buyers under positive externalities, and the seller seeks for a marketing strategy, namely an ordering in which he approaches the buyers and the prices offered to them, that maximizes his revenue. We restrict our attention to the Uniform Additive Model and mostly focus on Influence-and-Exploit (IE) marketing strategies. We obtain a comprehensive collection of results on the efficiency and the approxima- bility of IE strategies, which also imply a significant improvement on the best known approximation ratios for revenue maximization. Specifically, we show that in the Uniform Additive Model, both computing the optimal marketing strategy and computing the best IE strategy are NP-hard for undirected social networks. We observe that allowing IE strategies to offer prices smaller than the myopic price in the exploit step leads to a measurable improvement on their performance. Thus, we show that the best IE strategy approximates the maximum revenue within a factor of 0.911 for undirected and of roughly 0.553 for directed networks. Moreover, we present a natural generalization of IE strategies, with more than two pricing classes, and show that they approximate the maximum revenue within a factor of roughly 0.7 for undirected and of roughly 0.35 for directed networks. Utilizing a connection between good IE strategies and large cuts in the under- lying social network, we obtain polynomial-time algorithms that approximate the revenue of the best IE strategy within a factor of roughly 0.9. Hence, we significantly improve on the best known approximation ratio for revenue maximization to 0.8229 for undirected and to 0.5011 for directed networks (from 2/3 and 1/3, respectively, by Hartline et al.). 1 1 0 2 t c O 0 1 ] S D . s c [ 1 v 4 9 8 1 . 0 1 1 1 : v i X r a (cid:63) Research partially supported by an NTUA Basic Research Grant (PEBE 2009). 1 Introduction An important artifact of the Internet is the appearance of Social Networks. For the first time, we posses an account of the friendship network for millions of people. This information is invaluable for targeted advertising, personalized recommendations, and in general, for enhancing business intelligence. How- ever, there is a noticeable discrepancy between the perceived value of Social Networks and the actual revenue they generate. For instance, Facebook is valued by Goldman Sachs at $50 billions, but its actual revenue is estimated at $2.2 billions by eMarketer. The widespread belief is that much of the commercial potential of Social Networks remains unexploited. This premise has motivated a significant volume of research in the direction of monetizing Social Networks. Recent research has studied the impact of externalities in a variety of settings (see e.g. [13, 4, 1, 3, 6, 5, 12, 9]). In this work, we are interested in the design of efficient marketing strategies that exploit positive externalities and maximize the seller's revenue. We focus on the setting where the utility of the product depends inherently on the scale of the product's adoption. E.g. the value of a social network depends on the fraction of the population that uses it on a regular basis. In fact, for many products (e.g., cell phones, online gaming), the value of the product to a buyer depends on the set of his friends that have already adopted the product. In this setting, the seller seeks for a marketing strategy that guarantees a significant revenue through a wide adoption of the product, which leads to an increased value, and consequently, to a profitable pricing of it. A Model of Marketing Strategies for Social Networks. We adopt the model of Hartline, Mirrokni, and Sundararajan [13], where a digital product is sold to a set of potential buyers under positive externalities. As in [13], we assume an unlimited supply of the product and that there is no production cost for it. A (possibly directed) social network G on the set of potential buyers models how their value of the product is affected by other buyers who already own the product. Namely, an edge e = (j, i) in the social network denotes that the event that j owns the product has a positive influence on i's value of the product. The product's value to each buyer i is given by a non-decreasing function vi(S) of the set S of buyers who own the product and have positive influence on (equivalently, an edge to) i. The exact values vi(S) are unknown and are treated as random variables of which only the distributions Fi,S are known to the seller. The most interesting cases outlined in [13] are the Concave Graph Model, where each vi(S) is a submodular function of S, and the Uniform Additive Model, where a non-negative weight wji is associated with each edge (j, i), and vi(S) is uniformly distributed between 0 and the total weight of the edges from S to i. An important special case of the Uniform Additive Model is the undirected (or the symmetric) case, where the network G is undirected and wij = wji for all edges {i, j}. In this setting, the seller approaches each potential buyer once and makes an individualized offer to him. A marketing strategy determines the sequence in which the seller approaches the buyers, and the price offered to each buyer. Each buyer either accepts the offer, in which case he pays the price asked by the seller, or rejects it, in which case he pays nothing and never receives an offer again. The seller's goal is to compute a marketing strategy that maximizes his revenue, namely the total amount paid by the buyers accepting the offer. Using a transformation from Maximum Acyclic Subgraph, Hartline et al. [13] proved that if the seller has complete knowledge of the buyers' valuations, computing a revenue-maximizing ordering of the buyers is NP-hard for directed social networks. Combined with the result of [11], this transfor- mation suggests an upper bound of 0.5 on the approximability of revenue maximization for directed networks and deterministic additive valuations. On the positive side, Hartline et al. gave a polynomial- time dynamic programming algorithm for a special fully symmetric case, where the order in which the seller approaches the buyers is insignificant. 1 An interesting contribution of [13] is a class of elegant marketing strategies called Influence-and- Exploit. An Influence-and-Exploit (IE) strategy first offers the product for free to a selected subset of buyers, aiming to increase the value of the product to the remaining buyers (influence step). Then, in the exploit step, it approaches the remaining buyers, in a random order, and offers them the product at the so-called myopic price. The myopic price ignores the current buyer's influence on the subsequent buyers and maximizes the expected revenue extracted from him. In the Uniform Additive Model, the myopic price is accepted by each buyer with probability 1/2. Hence, there is a notion of uniformity in the prices offered in the exploit step, in the sense that each buyer accepts the offer with a fixed probability, and we can say that the IE strategy uses a pricing probability of 1/2. To demonstrate the efficiency of IE strategies, Hartline et al. [13] proved that the best IE strategy approximates the maximum revenue within a factor of 0.25 for the Concave Graph Model, and within a factor of 0.94 for the (polynomially solvable) fully symmetric case of the Uniform Additive Model. Furthermore, they proved that if each buyer is selected in the influence set randomly, with an appro- priate probability, the expected revenue of IE is at least 2/3 (resp. 1/3) times the maximum revenue of undirected (resp. directed) social networks. For the Concave Graph Model, Hartline et al. presented a polynomial-time local search algorithm which approximates the revenue of the best IE strategy within a factor of 0.4. Since [13], the Influence-and-Exploit paradigm has been applied to a few other settings involving revenue maximization under positive externalities (see e.g. [4, 5, 12]). Contribution and Techniques. Despite the fact that IE strategies are simple, elegant, and quite promising in terms of efficiency, their performance against the maximum revenue and their polynomial- time approximability are hardly well understood. In this work, we restrict our attention to the impor- tant case of the Uniform Additive Model, and obtain a comprehensive collection of results on the efficiency and the approximability of IE strategies. Our results also imply a significant improvement on the best known approximation ratio for revenue maximization in the Uniform Additive Model. We first show that in the Uniform Additive Model, both computing the optimal marketing strategy and computing the best IE strategy are NP-hard for undirected social networks1. Next, we embark on a systematic study of the algorithmic properties of IE strategies (cf. Section 3). In [13], IE strategies are restricted, by definition, to the myopic pricing probability, which for the Uniform Additive Model is 1/2. A bit surprisingly, we observe that we can achieve a measurable improvement on the efficiency of IE strategies if we use smaller prices (equivalently, a larger pricing probability) in the exploit step. Thus, we let IE strategies use a carefully selected pricing probability p ∈ [1/2, 1). We show the existence of an IE strategy with pricing probability 0.586 (resp. 2/3) which approx- imates the maximum revenue within a factor of 0.9111 for undirected (resp. 0.55289 for directed) networks. The proof assumes a revenue-maximizing pricing probability vector p and constructs an IE strategy with the desired expected revenue by applying randomized rounding to p. An interesting consequence is that the upper bound of 0.5 on the approxibability of the maximum revenue of directed networks does not apply to the Uniform Additive Model. In Section 3, we discuss the technical rea- sons behind this and show a pair of upper bounds on the approximability of the maximum revenue of directed social networks in the Uniform Additive Model. Specifically, assuming the Unique Games conjecture, we show that it is NP-hard to approximate the maximum revenue within a factor greater than 27/32, and greater than 3/4, if we use an IE strategy with pricing probability 2/3. The technical intuition behind most of our results comes from the apparent connection between good IE strategies and large cuts in the underlying social network. Following this intuition, we opti- 1 We should highlight that if the seller has complete knowledge of the buyers' valuations, finding a revenue-maximizing buyer ordering for undirected social networks is polynomially solvable (cf. Lemma 1). Therefore, the reduction of [13] does not imply the NP-hardness of revenue maximization for undirected networks. 2 mize the parameters of the IE strategy of [13] and slightly improve the approximation ratio to 0.686 (resp. 0.343) for undirected (resp. directed) social networks. Moreover, we show that for undirected bipartite social networks, an IE strategy extracts the maximum revenue and can be computed in poly- nomial time. Building on the idea of generating revenue from large cuts in the network, we discuss, in Section 5, a natural generalization of IE strategies that use more than two pricing classes. We show that these strategies approximate the maximum revenue within a factor of 0.7032 for undirected networks and of 0.3516 for directed networks. The main hurdle in obtaining better approximation guarantees for the maximum revenue prob- lem is the lack of any strong upper bounds on it. In Section 6, we obtain a strong Semidefinite Programming (SDP) relaxation for the problem of computing the best IE strategy with any given pricing probability. Our approach exploits the resemblance between computing the best IE strategy and the problems of MAX-CUT and MAX-DICUT, and builds on the elegant approach of Goemans and Williamson [10] and Feige and Goemans [8]. Solving the SDP relaxation and using randomized rounding, we obtain a 0.9032 (resp. 0.9064) approximation for the best IE strategy with a pricing probability of 0.586 for undirected networks (resp. of 2/3 for directed networks). Combining these results with the bounds on the fraction of the maximum revenue extracted by the best IE strategy, we significantly improve on the best known approximation ratio for revenue maximization to 0.8229 for undirected networks and 0.5011 for directed networks (from 2/3 and 1/3, respectively, in [13]). Other Related Work. Our work lies in the area of pricing and revenue maximization in the presence of positive externalities, and more generally, in the wide area of social contagion. In this framework, Domingos and Richardson [7] studied viral marketing and investigated how a small group of early adopters can be selected, so that the spread of a product is maximized. Subsequently, Kempe, Klein- berg and Tardos [14] considered this question from an algorithmic viewpoint, under the problem of influence maximization, which has received considerable attention since then. Hartline et al. [13] were the first to consider social influence in the framework of revenue maxi- mization. Since then, relevant research has focused either on posted price strategies, where there is no price discrimination, or on game theoretic considerations, where the buyers act strategically accord- ing to their perceived value of the product. To the best of our knowledge, our work is the first that considers the approximability of revenue maximization and of computing the best IE strategy, which were the central problems studied in [13]. Regarding posted price strategies for revenue maximization, Arthur et al. [4] considered a model where the seller cannot approach potential buyers. Instead, only recommendations about the prod- uct cascade through the network from an initial seed of early adopters. They gave an Influence- and-Exploit-based constant-factor approximation algorithm for the maximum revenue in this setting. Akhlaghpour et al. [1] considered iterative posted price strategies where all interested buyers can buy the product at the same price at a given time. They studied the revenue maximization problem under two different repricing models, both allowing for at most k prices. If frequent repricing is allowed, they proved that revenue maximization is NP-hard to approximate, and identified a special case of the problem that can be approximated within reasonable factors. If repricing can be performed only at a limited rate, they presented an FPTAS for revenue maximization. Anari et al. [3] considered a posted price setting where the product exhibits historical externalities. Given a fixed price trajectory, to which the seller commits himself, the buyers decide when to buy the product. In this setting, Anari et al. studied existence and uniqueness of equilibria. They also presented an FPTAS for some special cases of the problem of computing a price trajectory that maximizes the seller's revenue. In a complementary direction, Chen et al. [6] investigated the Nash equilibria and the Bayesian- Nash equilibria when each buyer's value of the product depends on the set of buyers who own the 3 product. They focused on two classes of equilibria, pessimistic and optimistic ones, and showed how to compute these equilibria and how to find revenue-maximizing prices. Candogan et al. [5] investi- gated a scenario where a monopolist sells a divisible good to buyers under positive externalities. They considered a two-stage game where the seller first sets an individual price for each buyer, and then the buyers decide on their consumption level, according to a utility function of the consumption levels of their neighbors. They proved that the optimal price for each buyer is proportional to his Bonacich centrality, and that if the buyers are partitioned into two pricing classes (which is conceptually similar to Influence-and-Exploit), the problem is reducible to MAX-CUT. 2 Model and Preliminaries The Influence Model. The social network is a (possibly directed) weighted network G(V, E, w) on the set V of potential buyers. There is a positive weight wij associated with each edge (i, j) ∈ E (we assume that wij = 0 if (i, j) (cid:54)∈ E). A social network is undirected (or symmetric) if wij = wji for all i, j ∈ V , and directed (or asymmetric) otherwise. There may exist a non-negative weight wii associated with each buyer i 2. Every buyer has a value vi : 2Ni (cid:55)→ R+ of the product, which depends on wii and on the set S ⊆ Ni of his neighbors who already own the product, where Ni = {j ∈ V \{i} : (j, i) ∈ E}. We assume that the exact values of vi are unknown to the seller, and that for each buyer i and each set S ⊆ Ni, the seller only knows the probability distribution Fi,S(x) = IPr[vi(S) < x] that buyer i rejects an offer of price x for the product. (cid:80) In this work, we focus on the Uniform Additive Model [13, Section 2.1], which can be regarded as an extension of the Linear Threshold Model of social influence introduced in [14]. In the Uniform Additive Model, the values vi(S) are drawn from the uniform distribution in [0, Mi,S], where Mi,S = j∈S∪{i} wji is the total influence perceived by i, given the set S of his neighbors who own the product. Then, the probability that i rejects an offer of price x is Fi,S(x) = x/Mi,S. Myopic Pricing. The myopic price disregards any externalities imposed by i on his neighbors, and simply maximizes the expected revenue extracted from buyer i, given that S is the current set of i's neighbors who own the product. For the Uniform Additive Model, the myopic price is Mi,S/2, the probability that buyer i accepts it is 1/2, and the expected revenue extracted from him with the myopic price is Mi,S/4, which is the maximum revenue one can extract from buyer i alone. Marketing Strategies and Revenue Maximization. We can usually extract more revenue from G by employing a marketing strategy that exploits the positive influence between the buyers. A marketing strategy (π, x) consists of a permutation π of the buyers and a pricing vector x = (x1, . . . , xn), where π determines the order in which the buyers are approached and x the prices offered to them. We observe that for any buyer i and any probability p that i accepts an offer, there is an (essentially unique) price xp such that i accepts an offer of xp with probability p. For the Uniform Additive Model, xp = (1− p)Mi,S and the expected revenue extracted from buyer i with such an offer is p(1− p)Mi,S. Throughout this paper, we equivalently regard marketing strategies as consisting of a permutation π of the buyers and a vector p = (p1, . . . , pn) of pricing probabilities. We note that if pi = 1, i gets the product for free, while if pi = 1/2, the price offered to i is (the myopic price of) Mi,S/2. We assume that pi ∈ [1/2, 1], since any expected revenue in [0, Mi,S/4] can be achieved with such 2 For simplicity, we ignore wii's for directed social networks. This is without loss of generality, since we can replace each wii by an edge (i(cid:48), i) of weight wii from a new node i(cid:48) with a single outgoing edge (i(cid:48), i) and no incoming edges. 4  pjwji (cid:88) wii + i∈V wii and W =(cid:80) j:πj <πi (1) pricing probabilities. Then, the expected revenue of a marketing strategy (π, p) is: R(π, p) = pi(1 − pi) (cid:88) i∈V Bounds on the Maximum Revenue. Let N =(cid:80) is undirected, and W =(cid:80) The problem of revenue maximization under the Uniform Additive Model is to find a marketing strat- egy (π∗, p∗) that extracts a maximum revenue of R(π∗, p∗) from a given social network G(V, E, w). i<j wij, if the social network G (i,j)∈E wij, if G is directed. Then an upper bound on the maximum revenue of G is R∗ = (W + N )/4, and follows by summing up the myopic revenue over all edges of G [13, Fact 1]. For a lower bound on the maximum revenue, if G is undirected (resp. directed), approaching the buyers in any order (resp. in a random order) and offering them the myopic price yields a revenue of (W + 2N )/8 (resp. (W + 4N )/16). Thus, myopic pricing achieves an approximation ratio of 0.5 for undirected networks and of 0.25 for directed networks. Ordering and NP-Hardness. Revenue maximization exhibits a dual nature involving optimizing both the pricing probabilities and the sequence of offers. For directed networks, finding a good order- ing π of the buyers bears a resemblance to the Maximum Acyclic Subgraph problem, where given a directed network G(V, E, w), we seek for an acyclic subgraph of maximum total edge weight. In fact, any permutation π of V corresponds to an acyclic subgraph of G that includes all edges going forward in π, i.e, all edges (i, j) with πi < πj. [13, Lemma 3.2] shows that given a directed network G and a pricing probability vector p, computing an optimal ordering of the buyers (for the particular p) is equivalent to computing a Maximum Acyclic Subgraph of G, with each edge (i, j) having a weight of pipj(1 − pj)wij. Consequently, computing an ordering π that maximizes R(π, p) is NP-hard and Unique-Games-hard to approximate within a factor greater than 0.5 [11]. On the other hand, we show that in the undirected case, if the pricing probabilities are given, we can easily compute the best ordering of the buyers (see also Section A.1, in the Appendix, for a simple example about the importance of a good ordering in the undirected case). Lemma 1. Let G(V, E, w) be an undirected social network, and let p be any pricing probability vector. Then, approaching the buyers in non-increasing order of their pricing probabilities maximizes the revenue extracted from G under p. Proof. We consider an optimal ordering π (wrt. p) that minimizes the number of buyers' pairs appear- ing in increasing order of their pricing probabilities, namely, the number of pairs i1, i2 with pi1 < pi2 and πi1 < πi2. If there is such a pair in π, we can find a pair of buyers i and j with pi < pj such that i appears just before j in π. Then, switching the positions of i and j in π changes the expected revenue (cid:117)(cid:116) extracted from G under p by pipjwij(pj − pi) ≥ 0, a contradiction. A consequence of Lemma 1 is that [13, Lemma 3.2] does not imply the NP-hardness of revenue maximization for undirected social networks. The following lemma employs a reduction from mono- tone One-in-Three 3-SAT, and shows that revenue maximization is NP-hard for undirected networks. Lemma 2. The problem of computing a marketing strategy that extracts the maximum revenue from an undirected social network is NP-hard. Proof. In monotone One-in-Three 3-SAT, we are given a set V of n items and m subsets T1, . . . , Tm of V , with 2 ≤ Tj ≤ 3 for each j ∈ {1, . . . , m}. We ask for a subset S ⊂ V such that S∩Tj = 1 for all j ∈ {1, . . . , m}. Monotone One-in-Three 3-SAT is shown NP-complete in [15]. In the following, 5 Fig. 1. Examples of (a) an extended triangle and (b) a 3-path, used in the proof of Lemma 2. We create an extended triangle for each 3-item set Tj and a 3-path for each 2-item set Tj. The set nodes are different for each set Tj, while the selection nodes are common for all sets. we let m2 (resp. m3) denote the number of 2-item (resp. 3-item) sets Tj in an instance (V, T1, . . . , Tm) of monotone One-in-Three 3-SAT. 128 m3 + 3 Given (V, T1, . . . , Tm), we construct an undirected social network G. The network G contains a selection-node corresponding to each item in V . There are no edges between the selection nodes of G. For each 3-item set Tj = {a, b, c}, we create an extended triangle consisting of a triangle on three set nodes aj, bj, and cj, and three additional edges that connect aj, bj, cj to the corresponding selection nodes a, b, and c (see also Fig. 1.a). For each 2-item set Tj = {a, b}, we create a 3-path consisting of an edge connecting two set nodes aj and bj, and two additional edges connecting aj and bj to the corresponding selection nodes a and b (see also Fig. 1.b). Therefore, G contains n+2m2 +3m3 nodes and 3m2 + 6m3 edges. The weight of all edges of G is 1. We next show that (V, T1, . . . , Tm) is a YES- instance of monotone One-in-Three 3-SAT iff the maximum revenue of G is at least 177 4 m2. By Lemma 1, the revenue extracted from G is maximized if the nodes are approached in non- increasing order of their pricing probabilities. Therefore, we can ignore the ordering of the nodes, and focus on their pricing probabilities. The important property is that if each extended triangle (Fig. 1.a) is considered alone, its maximum revenue is 177/128, and is obtained when exactly one of the selec- tion nodes a, b, c has a pricing probability of 1/2 and the other two have a pricing probability of 1. More specifically, since the selection nodes a, b, c have degree 1, the revenue of the extended triangle is maximized when they have a pricing probability of either 1 or 1/2. If all a, b, c have a pricing prob- ability of 1, the best revenue of the extended triangle is ≈ 1.196435, and is obtained when one of aj, bj, and cj has a pricing probability of ≈ 0.7474, the other has a pricing probability of ≈ 0.5715, and the third has a pricing probability of 1/2. If all a, b, c have a pricing probability of 1/2, the best rev- enue of the extended triangle is again ≈ 1.196435, and is obtained with the same pricing probabilities of aj, bj, and cj. If two of a, b, c (say a and b) have a pricing probability of 1/2 and c has a pricing probability of 1, the best revenue of the extended triangle is 21 16 = 1.3125, and is obtained when one of aj and bj has a pricing probability of 1, the other has a pricing probability of 3/4, and cj has a pricing probability of 1/2. Finally, if two of a, b, c (say b and c) have a pricing probability of 1 and a has a pricing probability of 1/2, we extract a maximum revenue from the extended triangle, which is 128 = 1.3828125 and is obtained when aj has a pricing probability of 1, one of bj and cj has a pricing 177 probability of 9/16, and the other has a pricing probability of 1/2. Similarly, if each 3-path (Fig. 1.b) is considered alone, its maximum revenue is 3/4, and is ob- tained when exactly one of the selection nodes a, b has a pricing probability of 1/2 and the other 6 (a)bacajbjcjSelection NodesSet Nodes(b)abajbjSelection NodesSet Nodes has a pricing probability of 1. In fact, since the 3-path is a bipartite graph, Proposition 3 implies that the maximum revenue, which is 3/4, is extracted when aj and b have a pricing probability of 1 and bj and a have a pricing probability of 1/2 (or the other way around). If both a and b have a pricing probability of 1, the best revenue of the 3-path is 41/64 and is obtained when one of aj and bj has a pricing probability of 5/8, and the other has a pricing probability of 1/2. If both a and b have a pricing probability of 1/2, the best revenue of 3-path is again 41/64 and is obtained when one of aj and bj has a pricing probability of 1, and the other has a pricing probability of 5/8. If (V, T1, . . . , Tm) is a YES-instance of monotone One-in-Three 3-SAT, we assign a pricing prob- ability of 1/2 to the selection nodes in S and a pricing probability of 1 to the selection nodes in V \ S, where S is a set with exactly one element of each Tj. Thus, we have exactly one selection node with pricing probability 1/2 in each extended triangle and in each 3-path. Then, we can set the pricing probabilities of the set nodes as above, so that the revenue of each extended triangle is 177/128 and the revenue of each 3-path is 3/4. Thus, the maximum revenue of G is at least 177 128 m3 + 3 4 m2. For the converse, we recall that the edges of G can be partitioned into m3 extended triangles and 4 m2, each extended m2 3-paths. Consequently, if the maximum revenue of G is at least 177 triangle contributes exactly 177/128 and each 3-path contributes exactly 3/4 to the revenue of G. Thus, by the analysis on their revenue above, each extended triangle and each 3-path includes exactly one selection node with a pricing probability of 1/2. Therefore, if we let S consist of the selection (cid:117)(cid:116) nodes with pricing probability 1/2, we have that S ∩ Tj = 1 for all j ∈ {1, . . . , m}. 128 m3 + 3 3 Influence-and-Exploit Strategies An Influence-and-Exploit (IE) strategy IE(A, p) consists of a set of buyers A receiving the product for free and a pricing probability p offered to the remaining buyers in V \ A, who are approached in a random order. We slightly abuse the notation and let IE(q, p) denote an IE strategy where each buyer is selected in A independently with probability q. IE(A, p) extracts an expected (wrt the random ordering of the exploit set) revenue of: wii + (cid:88) j∈A (cid:88) i∈V \A (cid:88)  RIE(A, p) = p(1 − p) wji + j∈V \A, j(cid:54)=i p wji 2 (2) Specifically, IE(A, p) extracts a revenue of p(1 − p)wji from each edge (j, i) with buyer j in the influence set A and buyer i in the exploit set V \ A. Moreover, IE(A, p) extracts a revenue of p2(1 − p)wji from each edge (j, i) with both j, i in the exploit set, if j appears before i in the random order of V \ A, which happens with probability 1/2. The problem of finding the best IE strategy is to compute a subset of buyers A∗ and a pricing prob- ability p∗ that extract a maximum revenue of RIE(A∗, p∗) from a given social network G(V, E, w). The following lemma employs a reduction from monotone One-in-Three 3-SAT, and shows that com- puting the best IE strategy is NP-hard. Lemma 3. Let p ∈ [1/2, 1) be any fixed pricing probability. The problem of finding the best IE strategy with pricing probability p is NP-hard, even for undirected social networks. Proof. We recall that in monotone One-in-Three 3-SAT, we are given a set V of n items and m subsets T1, . . . , Tm of V , with 2 ≤ Tj ≤ 3 for each j ∈ {1, . . . , m}. We ask for a subset S ⊂ V such that S ∩ Tj = 1 for all j ∈ {1, . . . , m}. 7 Given (V, T1, . . . , Tm), we construct an undirected social network G on V . For each 3-item set Tj = {a, b, c}, we create a set-triangle on nodes a, b, and c with 3 edges of weight 1. For each 2- item set Tj = {a, b}, we add a set-edge {a, b} of weight 2 + p, where p is the pricing probability. To avoid multiple appearances of the same edge, we let the weight of each edge be the total weight of its appearances. Namely, if an edge e appears in k3 set-triangles and in k2 set-edges, e's weight is k3 + (2 + p)k2. We observe that for any p ∈ [1/2, 1), the maximum revenue extracted from any set-triangle and any set-edge is p(1 − p)(2 + p), by giving the product for free to exactly one of the nodes of the set-triangle (resp. the set-edge). We next show that (V, T1, . . . , Tm) is a YES-instance of monotone One-in-Three 3-SAT iff there is an influence set A in G such that RIE(A, p) ≥ mp(1− p)(2 + p). If (V, T1, . . . , Tm) is a YES-instance of monotone One-in-Three 3-SAT, we let the influence set A = S, where S is a set with exactly one element of each Tj. Then, we extract an expected revenue of p(1−p)(2+p) from each set-triangle and each set-edge in G, which yields an expected revenue of mp(1 − p)(2 + p) in total. For the converse, if there is an influence set A in G such that RIE(A, p) ≥ mp(1 − p)(2 + p), we let S = A. Since RIE(A, p) ≥ mp(1 − p)(2 + p), and since the edges of G can be partitioned into m set-triangles and set-edges, each with a maximum revenue of at most p(1 − p)(2 + p), each set-triangle and each set- edge contributes exactly p(1− p)(2 + p) to RIE(A, p). Therefore, for all set-triangles and all set-edges, (cid:117)(cid:116) there is exactly one node in A. Thus, we have that S ∩ Tj = 1 for all j ∈ {1, . . . , m}. Interestingly, even very simple IE strategies extract a significant fraction of the maximum revenue. For example, for undirected social networks, RIE(∅, 2/3) = (4W + 6N )/27, and thus IE(∅, 2/3) 27 ≈ 0.592. For directed networks, RIE(∅, 2/3) = (2W +6N )/27, achieves an approximation ratio of 16 and thus IE(∅, 2/3) achieves an approximation ratio of 8 27 ≈ 0.296. In the following, we show that carefully selected IE strategies manage to extract a larger fraction of the maximum revenue. Exploiting Large Cuts. A natural idea is to exploit the apparent connection between a large cut in the social network and a good IE strategy. For example, in the undirected case, an IE strategy IE(q, p) is conceptually similar to the randomized 0.5-approximation algorithm for MAX-CUT, which puts each node in set A with probability 1/2. However, in addition to a revenue of p(1 − p)wij from each edge {i, j} in the cut (A, V \ A), IE(q, p) extracts a revenue of p2(1− p)wij from each edge {i, j} between nodes in the exploit set V \ A. Thus, to optimize the performance of IE(q, p), we carefully adjust the probabilities q and p so that IE(q, p) balances between the two sources of revenue. Hence, we obtain the following: Proposition 1. Let G(V, E, w) be an undirected social network, and let q = max{1 − where λ = N/W . Then, IE(q, 2 − √ √ 2)( , 0}, 2) approximates the maximum revenue extracted from G within 2 − 1) ≈ 0.686. a factor of at least 2 √ 2(2 − √ √ 2(2+λ) 4 Proof. The proof extends the proof of [13, Theorem 3.1]. We start with calculating the expected (wrt to the random choice of the influence set) revenue of IE(q, p). The expected revenue of IE(q, p) from each loop {i, i} is (1 − q)p(1 − p)wii. In particular, a revenue of p(1 − p)wii is extracted from {i, i} if buyer i is included in the exploit set, which happens with probability 1 − q. The expected revenue of IE(q, p) from each edge {i, j}, i < j, is (2q(1 − q)p(1 − p) + (1 − q)2p2(1 − p))wij. More specifically, if one of i, j is included in the influence set and the other is included in the exploit set, which happens with probability 2q(1 − q), a revenue of p(1 − p)wij is extracted from edge {i, j}. Otherwise, if both i and j are included in the exploit set, which happens with probability (1 − q)2, a revenue of p2(1− p)wij is extracted from edge {i, j} (note that since {i, j} is an undirected edge, the order in which i and j are considered in the exploit set is insignificant). By linearity of expectation, 8 the expected revenue of IE(q, p) is: RIE(q, p) = (1 − q)p(1 − p) (cid:88) i∈V wii and W =(cid:80) Using that N =(cid:80) wii + (1 − q)p(1 − p) (2q + p(1 − q))wij i∈V i<j wij, and setting N = λW , we obtain that: i<j RIE(q, p) = (1 − q)p(1 − p)(λ + 2q + p(1 − q))W (cid:88) Differentiating with respect to q, we obtain that the optimal value of q is (cid:26) 1 − p − λ/2 (cid:27) 2 − p , 0 q∗ = max (3) 1 + λ We recall that R∗ = (1 + λ)W/4 is an upper bound on the maximum revenue of G. Therefore, the approximation ratio of IE(q, p) is: 4(1 − q)p(1 − p)(λ + 2q + p(1 − q)) ratio of at least 2 2(2 − √ 3 , 0(cid:9) in (3), we obtain the IE strategy of [13, Theorem 3.1], whose Using p = 1/2 and q = max(cid:8) 1−λ (cid:110) approximation ratio is at least 2/3, attained at λ = 0. Assuming small values of λ, so that q∗ > 0, and differentiating with respect to p, we obtain that the best value of p for IE(q∗, p) is p∗ = 2 − √ 2. Using p = 2 − √ , we obtain an IE strategy with an approximation 2 and q = max √ √ (cid:117)(cid:116) 2)( approxi- Proposition 2. Let G(V, E, w) be a directed social network. Then, IE mates the maximum revenue of G within a factor of Proof. The proof is similar to the proof of Proposition 1. We recall that for the directed case, we can ignore loops (i, i). Since the social network G is directed, the expected (wrt to the random choice of the influence set and the random order of the exploit set) revenue of IE(q, p) is: (q + p(1 − q)/2)wij 2(2 − √ (cid:88) 2 − 1) ≈ 0.686, attained at λ = 0. RIE(q, p) = (1 − q)p(1 − p) 2 − 1) ≈ 0.343. √ 2)( 1 − √ 2 , 2 − √ 2 2 √ 1 − 2(2+λ) , 0 4 (cid:111) (cid:16) (cid:17) √ = (1 − q)p(1 − p)(q + p(1 − q)/2)W (i,j)∈E More specifically, if i is included in the influence set and j is included in the exploit set, which happens with probability q(1 − q), a revenue of p(1 − p)wij is extracted from each edge (i, j). Furthermore, if both i and j are included in the exploit set V \ A and i appears before j in the random order of V \ A, which happens with probability (1 − q)2/2, a revenue of p2(1 − p)wij is extracted from edge (i, j). Using the upper bound of W/4 on the maximum revenue of G, we have that the approximation ratio of IE(q, p) is at least 4(1 − q)p(1 − p)(q + p(1 − q)/2). Setting q = 1/3 and p = 1/2, we obtain the IE strategy of [13, Theorem 3.1], whose approximation ratio for directed networks is 1/3. Using q = 1 − √ √ 2(2 − √ 2, we obtain an IE strategy with an approximation ratio of (cid:117)(cid:116) Proposition 3 (Optimality of IE for Bipartite Networks). Let G(V, E, w) be an undirected bipar- tite social network with wii = 0 for all buyers i, and let (A, V \ A) be any partition of V into independent sets. Then, IE(A, 1/2) extracts the maximum revenue of G. Proof. Since all edges of G are between buyers in the influence set A and buyers in the exploit set V \ A, IE(A, 1/2) extracts the myopic revenue of wij/4 from any edge {i, j} ∈ E. Therefore, (cid:117)(cid:116) IE(A, 1/2) is an optimal strategy. 2 and p = 2 − √ 2 − 1) ≈ 0.343. √ 2)( 2 9 4 On the Efficiency of Influence-and-Exploit Strategies Next, we show that the best IE strategy, which is NP-hard to compute, manages to extract a significant fraction of the maximum revenue. Theorem 1. For any undirected social network, there is an IE strategy with pricing probability 0.586 whose revenue is at least 0.9111 times the maximum revenue. Proof. We consider an arbitrary undirected social network G(V, E, w), start from an arbitrary pricing probability vector p, and obtain an IE strategy IE(A, p) by applying randomized rounding to p. We show that for p = 0.586, the expected (wrt the randomized rounding choices) revenue of IE(A, p) is at least 0.9111 times the revenue extracted from G by the best ordering for p (recall that by Lemma 1, the best ordering is to approach the buyers in non-increasing order of their pricing probabilities). Without loss of generality, we assume that p1 ≥ p2 ≥ ··· ≥ pn, and let π be the identity permutation. Then, R(π, p) =(cid:80) i<j pipj(1 − pj)wij. For the IE strategy, we assign each buyer i to the influence set A independently with probability I(pi) = α(pi − 0.5), for some appropriate α ∈ [0, 2], and to the exploit set with probability E(pi) = 1 − I(pi). By linearity of expectation, the expected revenue of IE(A, p) is: RIE(A, p) = p(1 − p)(I(pi)E(pj) + E(pi)I(pj) + p E(pi)E(pj))wij p(1 − p)E(pi)wii + i∈V pi(1 − pi)wii +(cid:80) (cid:88) (cid:88) i∈V i<j Specifically, IE(A, p) extracts a revenue of p(1 − p)wii from edge loop {i, i}, if i is included in the exploit set. Moreover, IE(A, p) extracts a revenue of p(1 − p)wij from each edge {i, j}, i < j, if one of i, j is included in the influence set A and the other is not, and a revenue of p2(1 − p)wij if both i and j are included in the exploit set V \ A (note that the order in which i and j are considered is insignificant). The approximation ratio is derived as the minimum ratio between any pair of terms in R(π, p) and RIE(A, p) corresponding to the same loop {i, i} or to the same edge {i, j}. For a weaker bound, we observe that for α = 1.43 and p = 0.586, both p (1 − p) E(x) p (1 − p)(I(x) E(y) + E(x) I(y) + p E(x) E(y)) min and 0.5≤x≤1 x (1 − x) (4) are at least 0.8024. More precisely, the former quantity is minimized for x ≈ 0.7104, for which it becomes ≈ 0.8244. For any fixed value of y ∈ [0.5, 1.0], the latter quantity is minimized for x = 1.0. The minimum value is 0.8024 for x = 1.0 and y ≈ 0.629. x y (1 − y) 0.5≤y≤x≤1 min For the stronger bound of 0.9111, we let p = 0.586, and for each buyer i, let the rounding param- eter α(pi) be chosen according to the following piecewise linear function of pi :  α(pi) = 5.0 (pi − 0.5) 1.0 + 3.3 (pi − 0.7) 1.33 + 3.0 (pi − 0.8) 1.63 + 3.7 (pi − 0.9) if 0.5 ≤ pi ≤ 0.7 if 0.7 < pi ≤ 0.8 if 0.8 < pi ≤ 0.9 if 0.9 < pi ≤ 1.0 The quantity on the left of (4) is minimized for x = 0.8, for which it becomes ≈ 0.9112. For any fixed x ∈ [0.5, 0.949], the quantity on the right of (4) is minimized for y = 0.5. The minimum value is 0.9111 for x ≈ 0.7924 and y = 0.5. For any x ∈ (0.949, 0.983], the latter quantity is minimized for y = 0.7. The minimum value, over all x ∈ (0.949, 0.983], is ≈ 0.93 at x = 0.983 and y = 0.7. For any fixed x ∈ (0.983, 1.0], the quantity on the right of (4) is minimized for some y ∈ [0.7, 0.8]. Moreover, for all y ∈ [0.7, 0.8], this quantity is minimized for x = 1.0. The minimum value is ≈ 0.9112 at x = 1.0 and y ≈ 0.8. (cid:117)(cid:116) 10 Theorem 2. For any directed social network, there is an IE strategy with pricing probability 2/3 whose expected revenue is at least 0.55289 times the maximum revenue. Proof. As before, we consider an arbitrary directed social network G(V, E, w), start from an arbitrary pricing probability vector p, and obtain an IE strategy IE(A, p) by applying randomized rounding to p. We show that for p = 2/3, the expected (wrt the randomized rounding choices) revenue of IE(A, p) is at least 0.55289 times the revenue extracted from G under the best ordering for p (which ordering is Unique-Games-hard to approximate within a factor less than 0.5!). We recall that in the directed case, we can, without loss of generality, ignore loops (i, i). Let π be the best ordering π for p. Then, the maximum revenue extracted from G with pricing probabilities p is R(π, p) ≤(cid:80) (i,j)∈E pipj(1 − pj)wij. As in the proof of Theorem 1, we assign each buyer i to the influence set A independently with probability I(pi) = α(pi − 0.5), for some α ∈ [0, 2], and to the exploit set with probability E(pi) = 1 − I(pi). By linearity of expectation, the expected (wrt the randomized rounding choices) revenue extracted by IE(A, p) is: RIE(A, p) = p(1 − p)(I(pi)E(pj) + 0.5 p E(pi)E(pj))wij (cid:88) (i,j)∈E Specifically, IE(A, p) extracts a revenue of p(1 − p)wij from each edge (i, j), if i is included in the influence set and j is included in the exploit set, and a revenue of p2(1 − p)wij if both i and j are included in the exploit set V \ A and i appears before j in the random order of V \ A. The approximation ratio is derived as the minimum ratio between any pair of terms in R(π, p) and RIE(A, p) corresponding to the same edge (i, j). Thus, we select p and α so that the following quantity is maximized: p (1 − p)(I(x) E(y) + 0.5 p E(x) E(y)) x y (1 − y) min 0.5≤x,y≤1 We observe that for p = 2/3 and α = 1.0, this quantity is simplified to miny∈[0.5,1] minimum value is ≈ 0.55289 at y = 3−√ . 3 2 2(3−2y) 27y(1−y). The (cid:117)(cid:116) Similarly, we can show that there is an IE strategy with pricing probability 1/2 whose revenue is at least 0.8857 (resp. 0.4594) times the maximum revenue for undirected (resp. directed) networks. 4.1 On the Approximability of the Maximum Revenue for Directed Networks The results of [13, Lemma 3.2] and [11] suggest that given a pricing probability vector p, it is Unique- Games-hard to compute a vertex ordering π of a directed network G for which the revenue of (π, p) is at least 0.5 times the maximum revenue of G under p. An interesting consequence of Theorem 2 is that this inapproximability bound of 0.5 does not apply to revenue maximization in the Uniform Additive Model. In particular, given a pricing probability vector p, Theorem 2 constructs, in linear time, an IE strategy with an expected revenue of at least 0.55289 times the maximum revenue of G under p. This does not contradict the results of [13, 11], because the pricing probabilities of the IE strategy are different from p. Moreover, in the Uniform Additive Model, different acyclic (sub)graphs (equivalently, different vertex orderings) allow for a different fraction of their edge weight to be trans- lated into revenue (for an example, see Section A.2, in the Appendix), while in the reduction of [13, Lemma 3.2], the weight of each edge in an acyclic subgraph is equal to its revenue. Thus, although the 11 IE strategy of Theorem 2 is 0.55289-approximate with respect to the maximum revenue of G under p, its vertex ordering combined with p may generate a revenue of less than 0.5 times the maximum rev- enue of G under p. In fact, based on Theorem 2, we obtain, in Section 6, a polynomial-time algorithm that approximates the maximum revenue of a directed network G within a factor of 0.5011. The following propositions establish a pair of inapproximabity results for revenue maximization in the Uniform Additive Model. Proposition 4. Assuming the Unique Games conjecture, it is NP-hard to compute an IE strategy with pricing probability 2/3 that approximates within a factor greater than 3/4 the maximum revenue of a directed social network in the Uniform Additive Model. Proof. Let G(V, E, w) be a directed social network, and let π∗ be a vertex ordering corresponding to an acyclic subgraph of G with a maximum edge weight of W ∗. Then, approaching the buyers according to π∗ and offering a pricing probability of 2/3 to each of them, we extract a revenue of 4W ∗/27. Therefore, the maximum revenue of G is at least 4W ∗/27. Now, we assume an influence set A so that IE(A, 2/3) approximates the maximum revenue of G within a factor of r. Thus, RIE(A, 2/3) ≥ 4rW ∗/27. Let π be the order in which IE(A, 2/3) ap- proaches the buyers, and let (i, j) be any edge with πi < πj, namely, any edge from which IE(A, 2/3) extracts some revenue. Since the revenue extracted from each such edge (i, j) is at most 2wij/9, the edge weight of the acyclic subgraph defined by π is at least 9 Hence, given an r-approximate IE(A, 2/3), we can approximate W ∗ within a ratio of 2r/3. The proposition follows from [11, Theorem 1.1], which assumes the Unique Games conjecture and shows (cid:117)(cid:116) that it is NP-hard to approximate W ∗ within a ratio greater than 1/2. Proposition 5. Assuming the Unique Games conjecture, it is NP-hard to approximate within a factor greater than 27/32 the maximum revenue of a directed social network in the Uniform Additive Model. 2 RIE(A, 2/3) ≥ 2r 3 W ∗. Proof. The proof is similar to the proof of Proposition 4. Let G(V, E, w) be a directed social network, and let π∗ be a vertex ordering corresponding to an acyclic subgraph of G with a maximum edge weight of W ∗. Using π∗ and a pricing probability of 2/3 for all buyers, we obtain that the maximum revenue of G is at least 4W ∗/27. We assume a marketing strategy (π, p) that approximates the maximum revenue of G within a factor of r. Thus, R(π, p) ≥ 4rW ∗/27. Let (i, j) be any edge with πi < πj, namely, any edge from which (π, p) extracts some revenue. Since the revenue extracted from each such edge (i, j) is at most wij/4, the edge weight of the acyclic subgraph defined by π is at least 4R(π, p) ≥ 16r Thus, given an r-approximate marketing strategy (π, p), we can approximate W ∗ within a ratio (cid:117)(cid:116) of 16r/27. Now, the proposition follows from [11, Theorem 1.1]. 27 W ∗ 5 Generalized Influence-and-Exploit Building on the idea of generating revenue from large cuts between different pricing classes, we obtain a class of generalized IE strategies, which employ a refined partition of buyers in more than two pricing classes. We first analyze the efficiency of generalized IE strategies for undirected networks, and then translate our results to the directed case. The analysis generalizes the proof of Proposition 1. A generalized IE strategy consists of K pricing classes, for some appropriately large integer K ≥ 2. Each class k, k = 1, . . . , K, is associated with a pricing probability of pk = 1 − k−1 2(K−1). Each k=1 qk = 1, and is offered a pricing probability of pk. The buyers are considered in non-increasing order of their buyer is assigned to the pricing class k independently with probability qk, where (cid:80)K 12 pricing probabilities, i.e., the buyers in class k are considered before the buyers in class k + 1, k = 1, . . . , K − 1. The buyers in the same class are considered in random order. In the following, we let IE(q, p) denote such a generalized IE strategy, where q = (q1, . . . , qK) is the assignment probability vector and p = (p1, . . . , pK) is the pricing probability vector. (cid:80)K We proceed to calculate the expected revenue extracted by the generalized IE strategy IE(q, p) from an undirected social network G(V, E, w). The expected revenue of IE(q, p) from each loop {i, i} is wii k=1 qkpk(1 − pk). Specifically, for each k, buyer i is included in the pricing class k with probability qk, in which case, the revenue extracted from {i, i} is pk(1 − pk)wii. The expected revenue of IE(p, q) from each edge {i, j}, i < j, is: (cid:32) (cid:33) k−1(cid:88) wij qkpk(1 − pk) qkpk + 2 q(cid:96)p(cid:96) K(cid:88) k=1 (cid:96)=1 k, the revenue extracted from {i, j} is p2 More specifically, for each class k, if both i, j are included in the pricing class k, which happens with k(1 − pk)wij. Furthermore, for each pair (cid:96), k of probability q2 pricing classes, 1 ≤ (cid:96) < k ≤ K, if either i is included in (cid:96) and j is included in k or the other way around, which happens with probability 2q(cid:96)qk, the revenue extracted from {i, j} is p(cid:96)pk(1 − pk)wij. i<j wij, we obtain that the i∈V wii and W = (cid:80) Using linearity of expectation and setting N = (cid:80) (cid:32) K(cid:88) expected revenue of IE(q, p) is: K(cid:88) k−1(cid:88) (cid:33) qkpk(1 − pk) + W qkpk(1 − pk) qkpk + 2 q(cid:96)p(cid:96) RIE(q, p) = N k=1 k=1 (cid:96)=1 Since R∗ = (N + W )/4 is an upper bound on the maximum revenue of G, the approximation ratio of IE(q, p) is at least: K(cid:88) (cid:32) (cid:33)(cid:41) k−1(cid:88) (cid:40) K(cid:88) min 4 qkpk(1 − pk), 4 qkpk(1 − pk) qkpk + 2 q(cid:96)p(cid:96) (5) k=1 k=1 (cid:96)=1 We can now select the assignment probability vector q so that (5) is maximized. We note that with the pricing probability vector p fixed, this involves maximizing a quadratic function of q over linear constraints. Thus, we obtain the following: Theorem 3. For any undirected social network G, the generalized IE strategy with K = 6 pricing classes and assignment probabilities q = (0.183, 0.075, 0.075, 0.175, 0.261, 0.231) approximates the maximum revenue of G within a factor of 0.7032. We note that the approximation ratio can be improved to 0.706 by considering more pricing classes. By the same approach, we show that for directed social networks, the approximation ratio of IE(q, p) is at least half the quantity in (5). Therefore: Corollary 1. For any directed social network G, the generalized IE strategy with K = 6 pricing classes and assignment probabilities q = (0.183, 0.075, 0.075, 0.175, 0.261, 0.231) approximates the maximum revenue of G within a factor of 0.3516. Proof. Similarly to the proof of Theorem 3, we calculate the expected (wrt the random partition of buyers into pricing classes and the random order of buyers in the pricing classes) revenue extracted by the generalized IE strategy IE(p, q) from a directed social network G(V, E, w). We recall that for 13 directed social networks, we can ignore loops (i, i). The expected revenue of IE(p, q) from each edge (i, j) is: wij qkpk(1 − pk) qkpk 2 + q(cid:96)p(cid:96) (cid:32) (cid:33) k−1(cid:88) (cid:96)=1 K(cid:88) k=1 More specifically, for each class k, if both i, j are included in the pricing class k and i appears before j in the random order of the buyers in k, which happens with probability q2 k/2, the revenue k(1 − pk)wij. Furthermore, for each pair (cid:96), k of pricing classes, extracted from each edge (i, j) is p2 1 ≤ (cid:96) < k ≤ K, if i is included in (cid:96) and j is included in k, which happens with probability q(cid:96)qk, the revenue extracted from (i, j) is p(cid:96)pk(1 − pk)wij. Using linearity of expectation and setting W =(cid:80) (i,j)∈E wij, we obtain that the expected revenue of IE(q, p) is: RIE(q, p) = W K(cid:88) k=1 qkpk(1 − pk) qkpk 2 + q(cid:96)p(cid:96) Since W/4 is an upper bound on the maximum revenue of G, the approximation ratio of IE(q, p) is at least: qkpk(1 − pk) qkpk 2 + q(cid:96)p(cid:96) , (6) K(cid:88) k=1 4 (cid:33) k−1(cid:88) (cid:33) (cid:96)=1 (cid:32) k−1(cid:88) (cid:96)=1 (cid:32) namely at least half of the approximation ratio in the undirected case. Using q = (0.183, 0.075, 0.075, 0.175, 0.261, 0.231) in (6), we obtain an approximation ratio of (cid:117)(cid:116) at least 0.3516. 6 Influence-and-Exploit via Semidefinite Programming The main hurdle in obtaining better approximation guarantees for the maximum revenue problem is the loose upper bound of (N + W )/4 on the optimal revenue. We do not know how to obtain a stronger upper bound on the maximum revenue. However, in this section, we obtain a strong Semidef- inite Programming (SDP) relaxation for the problem of computing the best IE strategy with any given pricing probability p ∈ [1/2, 1). Our approach exploits the resemblance between computing the best IE strategy and the problems of MAX-CUT (for undirected networks) and MAX-DICUT (for directed networks), and builds on the elegant approach of Goemans and Williamson [10] and Feige and Goe- mans [8]. Solving the SDP relaxation and using randomized rounding, we obtain, in polynomial time, a good approximation to the best influence set for the given pricing probability p. Then, employing the bounds of Theorem 1 and Theorem 2, we obtain strong approximation guarantees for the maximum revenue problem for both directed and undirected networks. Directed Social Networks. We start with the case of a directed social network G(V, E, w), which is a bit simpler, because we can ignore loops (i, i) without loss of generality. We observe that for any given pricing probability p ∈ [1/2, 1), the problem of computing the best IE strategy IE(A, p) is equivalent to solving the following Quadratic Integer Program: (cid:88) (cid:0)1 + p max p(1−p) 4 wij (i,j)∈E 2 + (1 − p 2 )y0yi − (1 + p 2 )y0yj − (1 − p 2 )yiyj (Q1) (cid:1) s.t. yi ∈ {−1, 1} ∀i ∈ V ∪ {0} 14 In (Q1), there is a variable yi for each buyer i and an additional variable y0 denoting the influence set. A buyer i is assigned to the influence set A, if yi = y0, and to the exploit set, otherwise. For each edge (i, j), 1 + y0yi − y0yj − yiyj is 4, if yi = y0 = −yj (i.e., if i is assigned to the influence set 2 (1 − y0yi − y0yj + yiyj) is 2p, if and j is assigned to the exploit set), and 0, otherwise. Moreover, p yi = yj = −y0 (i.e., if both i and j are assigned to the exploit set), and 0, otherwise. Therefore, the contribution of each edge (i, j) to the objective function of (Q1) is equal to the revenue extracted from (i, j) by IE(A, p). vi · vj denotes the inner product of vectors vi and vj: Following the approach of [10, 8], we relax (Q1) to the following Semidefinite Program, where 2 + (1 − p 2 ) v0 · vi − (1 + p 2 ) v0 · vj − (1 − p 2 ) vi · vj (S1) (cid:88) (cid:0)1 + p max p(1−p) 4 wij (i,j)∈E s.t. (cid:1) vi · vj + v0 · vi + v0 · vj ≥ −1 vi · vj − v0 · vi − v0 · vj ≥ −1 −vi · vj − v0 · vi + v0 · vj ≥ −1 −vi · vj + v0 · vi − v0 · vj ≥ −1 vi · vi = 1, vi ∈ Rn+1 ∀i ∈ V ∪ {0} We observe that any feasible solution to (Q1) can be translated into a feasible solution to (S1) by setting vi = v0, if yi = y0, and vi = −v0, otherwise. An optimal solution to (S1) can be computed within any precision ε in time polynomial in n and in ln 1 Given a directed social network G(V, E, w), a pricing probability p, and a parameter γ ∈ [0, 1], the algorithm SDP-IE(p, γ) first computes an optimal solution v0, v1, . . . , vn to (S1). Then, following [8], the algorithm maps each vector vi to a rotated vector v(cid:48) i which is coplanar with v0 and vi, lies on the same side of v0 as vi, and forms an angle with v0 equal to ε (see e.g. [2]). fγ(θi) = (1 − γ)θi + γπ(1 − cos θi)/2 , where π = 3.14 . . . and θi = arccos(v0 · vi) is the angle of v0 and vi. Finally, the algorithm computes a random vector r uniformly distributed on the unit (n + 1)-sphere, and assigns each buyer i to the i·r) = sgn(v0·r), and to the exploit set V \A, otherwise3, where sgn(x) = 1, influence set A, if sgn(v(cid:48) if x ≥ 0, and −1, otherwise. We next show that: Theorem 4. For any directed social network G, SDP-IE(2/3, 0.722) approximates the maximum rev- enue extracted from G by the best IE strategy with pricing probability 2/3 within a factor of 0.9064. Proof. In the following, we let v0, v1, . . . , vn be an optimal solution to (S1), let θij = arccos(vi · vj) be the angle of any two vectors vi and vj, and let θi = arccos(v0 · vi) be the angle of v0 and any vector vi. Similarly, we let θ(cid:48) j, and let θ(cid:48) i. We first calculate the expected revenue extracted from each edge (i, j) ∈ E by the IE strategy of SDP-IE(p, γ). Lemma 4. The IE strategy of SDP-IE(p, γ) extracts from each edge (i, j) an expected revenue of: i) be the angle of v0 and any rotated vector v(cid:48) j) be the angle of any two rotated vectors v(cid:48) i = arccos(v0 · v(cid:48) ij = arccos(v(cid:48) i and v(cid:48) i · v(cid:48) (1 − p wij p(1 − p) ij − (1 − p 2 ) θ(cid:48) 2π i) be the angle of v0 and a rotated vector v(cid:48) 2 ) θ(cid:48) i + (1 + p 2 ) θ(cid:48) j i = arccos(v0 · v(cid:48) 3 Let θ(cid:48) i. To provide some intuition behind the rotation step, i > θi, if θi ∈ (π/2, π). Therefore, applying rotation to vi, the algorithm we note that θ(cid:48) increases the probability of assigning i to the influence set, if θi ∈ (0, π/2), and the probability of assigning i to the exploit set, if θi ∈ (π/2, π). The strength of the rotation's effect depends on the value of γ and on the value of θi. i < θi, if θi ∈ (0, π/2), and θ(cid:48) (7) 15 Proof. We first define the following mutually disjoint events: Bij : sgn(v(cid:48) : sgn(v(cid:48) Bi j : sgn(v(cid:48) Bj i Bij : sgn(v(cid:48) i · r) = sgn(v(cid:48) i · r) = sgn(v0 · r) (cid:54)= sgn(v(cid:48) j · r) = sgn(v0 · r) (cid:54)= sgn(v(cid:48) i · r) = sgn(v(cid:48) j · r) = sgn(v0 · r) j · r) i · r) j · r) (cid:54)= sgn(v0 · r) Namely, Bij (resp. Bij) is the event that both i and j are assigned to the influence set A (resp. to the exploit set V \ A), and Bi i ) is the event that i (resp. j) is assigned to the influence set A and j (resp. i) is assigned to the exploit set V \ A. Also, we let IPr[B] denote the probability of any event B. Then, the expected revenue extracted from each edge (i, j) is: j (resp. Bj wij p(1 − p)(cid:0)IPr[Bi 2 IPr[Bij](cid:1) j] + p (8) To calculate IPr[Bi j ∪ Bj j], we calculate the probability of the event Bi j ∪ Bij that i is in the influence set, and of the event Bj j] and IPr[Bij], we use that if r is a vector uniformly distributed on the unit sphere, for any vectors vi, vj on the unit sphere, IPr[sgn(vi·r) (cid:54)= sgn(vj·r)] = θij/π [10, Lemma 3.2]. For IPr[Bi i that i and j are in different sets, of the i ∪ Bij that j is in the influence set. event Bi (9) (10) (11) i · r) (cid:54)= sgn(v(cid:48) ij/π i · r) = sgn(v0 · r)] = 1 − θ(cid:48) j · r) = sgn(v0 · r)] = 1 − θ(cid:48) j ∪ Bj i ] = IPr[sgn(v(cid:48) j ∪ Bij] = IPr[sgn(v(cid:48) i ∪ Bij]= IPr[sgn(v(cid:48) j] + IPr[Bj i ] = IPr[Bi j] + IPr[Bij] = IPr[Bi i ] + IPr[Bij] = IPr[Bj IPr[Bi IPr[Bi IPr[Bj j · r)] = θ(cid:48) i/π j/π Subtracting (11) from (9) plus (10), we obtain that: 2π (θ(cid:48) i + θ(cid:48) (12) j) i ∪ Bij that i is in the exploit set, and of For IPr[Bij], we also need the probability of the event Bj ij − θ(cid:48) j] = 1 IPr[Bi the event Bi j ∪ Bij that j is in the exploit set. IPr[Bj IPr[Bi i ] + IPr[Bij] = IPr[Bj j] + IPr[Bij] = IPr[Bi Subtracting (9) from (13) plus (14), we obtain that: i ∪ Bij]= IPr[sgn(v(cid:48) j ∪ Bij]= IPr[sgn(v(cid:48) i · r) (cid:54)= sgn(v0 · r)] = θ(cid:48) j · r) (cid:54)= sgn(v0 · r)] = θ(cid:48) i/π j/π (13) (14) (15) (cid:117)(cid:116) Since (S1) is a relaxation of the problem of computing the best IE strategy with pricing probability Substituting (12) and (15) in (8), we obtain (7), and conclude the proof of the lemma. IPr[Bij] = 1 2π (−θ(cid:48) ij + θ(cid:48) i + θ(cid:48) j) p, the revenue of an optimal IE(A, p) strategy is at most: 2 + (1 − p 2 ) cos θi − (1 + p 2 ) cos θj − (1 − p 2 ) cos θij (16) On the other hand, by Lemma 4 and linearity of expectation, the IE strategy of SDP-IE(p, γ) generates an expected revenue of: 2 ) θ(cid:48) ij − (1 − p 2 ) θ(cid:48) i + (1 + p 2 ) θ(cid:48) j (17) (cid:88) p(1−p) 4 wij (i,j)∈E (cid:0)1 + p (cid:88) (cid:0)(1 − p p(1−p) 2π wij (i,j)∈E 16 (cid:1) (cid:1) We recall that for each i, θ(cid:48) i = fγ(θi). Moreover, in [8, Section 4], it is shown that for each i, j, θ(cid:48) ij = gγ(θij, θi, θj) = arccos cos fγ(θi) cos fγ(θj) + cos θij − cos θi cos θj sin θi sin θj sin fγ(θi) sin fγ(θj) (cid:18) (cid:19) The approximation ratio of SDP-IE(p, γ) is derived as the minimum ratio of any pair of terms in (17) and (16) corresponding to the same edge (i, j). Thus, the approximation ratio of SDP-IE(p, γ) is: ρ(p, γ) = 2 π min 0≤x,y,z≤π 2 )fγ(y) + (1 + p 2 ) cos z − (1 − p 2 )fγ(z) 2 ) cos x s.t. (1 − p 1 + p 2 ) gγ(x, y, z) − (1 − p 2 + (1 − p 2 ) cos y − (1 + p cos x + cos y + cos z ≥ −1 cos x − cos y − cos z ≥ −1 − cos x − cos y + cos z ≥ −1 − cos x + cos y − cos z ≥ −1 It can be shown numerically, that ρ(2/3, 0.722) ≥ 0.9064. Combining Theorem 4 and Theorem 2, we conclude that: (cid:117)(cid:116) Theorem 5. For any directed social network G, the IE strategy computed by SDP-IE(2/3, 0.722) approximates the maximum revenue of G within a factor of 0.5011. Undirected Social Networks. We apply the same approach to an undirected network G(V, E, w). For any given pricing probability p ∈ [1/2, 1), the problem of computing the best IE strategy IE(A, p) for G is equivalent to solving the following Quadratic Integer Program: max p(1−p) 2 wii (1 − y0yi) + p(1−p) 4 wij (2 + p − py0yi − py0yj − (2 − p)yiyj) (Q2) (cid:88) i<j yi ∈ {−1, 1} ∀i ∈ V ∪ {0} (cid:88) i∈V s.t. In (Q2), there is a variable yi for each buyer i and an additional variable y0 denoting the influence set. A buyer i is assigned to the influence set A, if yi = y0, and to the exploit set, otherwise. For each loop {i, i}, 1 − y0yi is 2, if i is assigned to the exploit set, and 0, otherwise. For each edge {i, j}, i < j, 2−2yiyj is 4, if i and j are assigned to different sets, and 0, otherwise. Also, p(1−y0yi−y0yj +yiyj) is 4p, if both i and j are assigned to the exploit set, and 0, otherwise. Therefore, the contribution of each loop {i, i} and each edge {i, j}, i < j, to the objective function of (Q2) is equal to the revenue extracted from them by IE(A, p). The next step is to relax (Q1) to the following Semidefinite Program: max p(1−p) wij (2 + p − p v0 · vi − p v0 · vj − (2 − p) vi · vj) wii (1 − v0 · vi) + p(1−p) (cid:88) (cid:88) 4 2 i∈V s.t. i<j vi · vj + v0 · vi + v0 · vj ≥ −1 vi · vj − v0 · vi − v0 · vj ≥ −1 −vi · vj − v0 · vi + v0 · vj ≥ −1 −vi · vj + v0 · vi − v0 · vj ≥ −1 vi · vi = 1, vi ∈ Rn+1 17 (S2) ∀i ∈ V ∪ {0} Fig. 2. The approximation ratio of SDP-IE(p, γ) for the revenue of the best IE strategy and for the maximum revenue, as a function of the pricing probability p. The upper left plot shows the best choice of the rotation parameter γ, as a function of p. The blue curve (with circles) shows the best choice of γ for directed social networks and the red curve (with squares) for undirected networks. In both cases, the best choice of γ increases with p. The upper right plot shows the approximation ratio of SDP-IE(p, γ) for the maximum revenue for directed (blue curve, with circles) and undirected (red curve, with squares) networks. The lower plots show the approximation ratio of SDP-IE(p, γ) for directed (left plot) and undirected (right plot) networks, as a function of p. In each plot, the upper curve (in black) shows the approximation ratio of SDP-IE(p, γ) for the revenue of the best IE strategy, which increases slowly with p. The blue curve (that with circles) shows the guarantee of Theorem 2 and Theorem 1 on the fraction of the maximum revenue extracted by the best IE strategy. The red curve (that with squares) shows the approximation ratio of SDP-IE(p, γ) for the maximum revenue. The algorithm is the same as the algorithm for directed networks. Specifically, given an undi- rected social network G(V, E, w), a pricing probability p, and a parameter γ ∈ [0, 1], the algorithm SDP-IE(p, γ) first computes an optimal solution v0, v1, . . . , vn to (S2). Then, it maps each vector vi to a rotated vector v(cid:48) i which is coplanar with v0 and vi, lies on the same side of v0 as vi, and forms an angle fγ(θi) with v0, where θi = arccos(v0 · vi). Finally, the algorithm computes a random vector r uniformly distributed on the unit (n + 1)-sphere, and assigns each buyer i to the influence set A, if sgn(v(cid:48) Theorem 6. For any undirected network G, SDP-IE(0.586, 0.209) approximates the maximum rev- enue extracted from G by the best IE strategy with pricing probability 0.586 within a factor of 0.9032. i · r) = sgn(v0 · r), and to the exploit set V \ A, otherwise. We prove that: Proof. We employ the same approach, techniques, and notation as in the proof of Theorem 4. The expected revenue extracted from each loop {i, i} is wii p(1 − p) times the probability that i is in the exploit set, which is equal to IPr[sgn(v(cid:48) i/π. Therefore, the algorithm extracts an i·r) (cid:54)= sgn(v0·r)] = θ(cid:48) 18 expected revenue of wii p(1 − p) θ(cid:48) extracted from each (undirected) edge {i, j}, i < j, by the IE strategy of SDP-IE(p, γ). Lemma 5. SDP-IE(p, γ) extracts from each edge {i, j}, i < j, an expected revenue of: i/π from each loop {i, i}. Next, we calculate the expected revenue wij p(1 − p) (2 − p) θ(cid:48) i + p θ(cid:48) j ij + p θ(cid:48) 2π j ∪ Bj Proof. Let the events Bi i is the event that i and j are in different sets, and Bij is the event that both i and j are in the exploit set. Thus, the expected revenue extracted from edge {i, j} is: i , and Bij be defined as in the proof of Lemma 4. In particular, Bi j, Bj (cid:16) (cid:17) wij p(1 − p) IPr[Bi j ∪ Bj i ] + p IPr[Bij] In the proof of Lemma 4, in (9) and (15) respectively, we show that IPr[Bi IPr[Bij] = (−θ(cid:48) j ∪ Bj j)/(2π). Substituting these in (18), we obtain the lemma. Therefore, by linearity of expectation, the expected revenue of SDP-IE(p, γ) is: ij + θ(cid:48) i ] = θ(cid:48) ij/π, and that (cid:117)(cid:116) wii θ(cid:48) i + p(1−p) 2π wij ij + p θ(cid:48) i + p θ(cid:48) j (cid:88) i<j (cid:0)(2 − p) θ(cid:48) (cid:1) , (18) (19) i + θ(cid:48) (cid:88) π i∈V p(1−p) On the other hand, since (S2) relaxes the problem of computing the best IE strategy with pricing where θ(cid:48) i = fγ(θi), for each i ∈ V , and θ(cid:48) ij = gγ(θij, θi, θj), for each i, j ∈ V . (cid:88) (cid:88) probability p, the revenue of the best IE(A, p) strategy is at most: p(1−p) wii(1 − cos θi) + p(1−p) wij (2 + p − p cos θi − p cos θj − (2 − p) cos θij) (20) 2 i∈V 4 i<j The approximation ratio of SDP-IE(p, γ) is derived as the minimum ratio of any pair of terms in (19) and (20) corresponding either to the same loop {i, i} or to the same edge {i, j}, i < j. Therefore, the approximation ratio of SDP-IE(p, γ) for undirected social networks is the minimum of ρ1(γ) and ρ2(p, γ), where: ρ1(γ) = ρ2(p, γ) = 2 π 2 π min 0≤x≤π fγ(x) 1 − cos x and min 0≤x,y,z≤π s.t. (2 − p) gγ(x, y, z) + pfγ(y) + pfγ(z) 2 + p − p cos y − p cos z − (2 − p) cos x cos x + cos y + cos z ≥ −1 cos x − cos y − cos z ≥ −1 − cos x − cos y + cos z ≥ −1 − cos x + cos y − cos z ≥ −1 It can be shown numerically, that ρ1(0.209) ≥ 0.9035 and that ρ2(0.586, 0.209) ≥ 0.9032. (cid:117)(cid:116) Combining Theorem 6 and Theorem 1, we conclude that: Theorem 7. For any undirected social network G, the IE strategy computed by SDP-IE(0.586, 0.209) approximates the maximum revenue of G within a factor of 0.8229. 19 Remark. We can use ρ(p, γ) and min{ρ1(γ), ρ2(p, γ)}, and compute the approximation ratio of SDP-IE(p, γ) for the best IE strategy with any given pricing probability p ∈ [1/2, 1). We note that ρ1(γ) is ≈ 0.87856, for γ = 0 (see e.g. [10, Lemma 3.5]), and increases slowly with γ. Viewed as a function of p, the value of γ maximizing ρ(p, γ) and ρ2(p, γ) and the corresponding approximation ratio for the revenue of the best IE strategy increase slowly with p (see also Fig 2 about the depen- dence of γ and the approximation ratio as a function of p). For example, for directed social networks, the approximation ratio of SDP-IE(0.5, 0.653) (resp. SDP-IE(0.52, 0.685) and SDP-IE(0.52, 0.704)) is 0.8942 (resp. 0.8955 and 0.9005). For undirected networks, the ratio of SDP-IE(0.5, 0.176) (resp. (cid:117)(cid:116) SDP-IE(0.52, 0.183) and SDP-IE(2/3, 0.425)) is 0.899 (resp. 0.9005 and 0.907). References 1. H. Akhlaghpour, M. Ghodsi, N. Haghpanah, V.S. Mirrokni, H. Mahini, and A. Nikzad. Optimal iterative pricing over social networks. Proc. of the 6th Workshop on Internet and Network Economics (WINE '10), LNCS 6484, pp. 415 -- 423, 2010. 2. F. Alizadeh. Interior point methods in Semidefinite Programming with applications to Combinatorial Optimization. SIAM J. on Optimization, 5:13 -- 51, 1995. 3. N. Anari, S. Ehsani, M. Ghodsi, N. Haghpanah, N. Immorlica, H. Mahini, and V.S. Mirrokni. Equilibrium pricing with positive externalities. Proc. of the 6th Workshop on Internet and Network Economics (WINE '10), LNCS 6484, pp. 424 -- 431, 2010. 4. D. Arthur, R. Motwani, A. Sharma, and Y. Xu. Pricing strategies for viral marketing on social networks. Proc. of the 5th Workshop on Internet and Network Economics (WINE '09), LNCS 5929, pp. 101 -- 112, 2009. 5. O. Candogan, K. Bimpikis, and A. Ozdaglar. Optimal pricing in the presence of local network effects. Proc. of the 6th Workshop on Internet and Network Economics (WINE '10), LNCS 6484, pp. 118 -- 132, 2010. 6. W. Chen, P. Lu, X. Sun, Y. Wang, and Z.A. Zhu. Pricing in social networks: Equilibrium and revenue maximization. CoRR, abs/1007.1501, 2010. 7. P. Domingos and M. Richardson. Mining the network value of customers. Proc. of the 7th ACM-SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD '01), pp. 57 -- 66, 2001. 8. U. Feige and M.X. Goemans. Aproximating the value of two prover proof systems, with applications to MAX 2SAT and MAX DICUT. Proc. of the 3rd Israel Symposium on Theory of Computing and Systems, pp. 182 -- 189, 1995. 9. D. Fotakis, P. Krysta, and O. Telelis. Externalities among advertisers in sponsored search. Proc. of the 4th International Symposium on Algorithmic Game Theory (SAGT '11), 2011. 10. M.X. Goemans and D.P. Williamson. Improved approximation algorithms for Maximum Cut and Satisfiability prob- lems using Semidefinite Programming. J. of the ACM, 42:1115 -- 1145, 1995. 11. V. Guruswami, R. Manokaran, and P. Raghavendra. Beating the random ordering is hard: Inapproximability of Max- imum Acyclic Subgraph. Proc. of the 49th IEEE Symposium on Foundations of Computer Science (FOCS '08), pp. 573 -- 582, 2008. 12. N. Haghpanah, N. Immorlica, V.S. Mirrokni, and K. Munagala. Optimal auctions with positive network externalities. Proc. of the 12th ACM Conference on Electronic Commerce (EC '11), pp. 11 -- 20, 2011. 13. J. Hartline, V.S. Mirrokni, and M. Sundararajan. Optimal marketing strategies over social networks. Proc. of the 17th International Conference on World Wide Web (WWW '08), pp. 189 -- 198, 2008. 14. D. Kempe, J. Kleinberg, and ´E. Tardos. Maximizing the spread of influence through a social network. Proc. of the 9th ACM-SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD '03), pp. 137 -- 146, 2003. 15. T.J. Schaefer. The complexity of Satisfiability problems. Proc. of the 10th ACM Symposium on Theory of Computing (STOC '78), pp. 216 -- 226, 1978. A Appendix A.1 Undirected Social Networks: An Example of a Suboptimal Ordering We consider an (undirected) simple cycle with 4 nodes, numbered as they appear on the cycle, and unit weights on its edges. Proposition 3 shows that the optimal ordering is (1, 3, 2, 4), the optimal pricing vector is (1, 0.5, 1, 0.5), and the maximum revenue is 1. On the other hand, if the nodes are ordered as they appear in the cycle, i.e., as in (1, 2, 3, 4), the optimal pricing vector is (1, 2)/2, 0.5), and the resulting revenue is 0.7772. 2/2, (1+ √ √ 20 A.2 On the Approximability of Maximum Revenue in the Uniform Additive Model We show a simple example where different acyclic subgraphs (equivalently, different vertex orderings) of the social network allow for a different fraction of their edge weight to be translated into revenue. To this end, we consider a simple directed network G on V = {u1, u2, u3, u4}. G contains an edge from each vertex ui to each vertex uj with j > i, that is 6 edges in total. Formally, E = {(ui, uj) : 1 ≤ i < j ≤ 4}. The weight of each edge is 1. In ordering π1 = (u1, u2, u3, u4), all edges go forward. So, π1 corresponds to an acyclic subgraph with edge weight 6. The optimal pricing probabilities for π1 are p1 = (1, 0.7474, 0.5715, 0.5) and extract a revenue of R(π1, p1) = 1.1964 from G. Thus, π1 allows for a revenue equal to 19.943% of its edge weight. Similarly, ordering π2 = (u1, u3, u2, u4) corresponds to an acyclic subgraph with edge weight 5. The optimal pricing probabilities for π2 are p2 = (1, 0.625, 0.625, 0.5) and extract a revenue of R(π2, p2) = 1.03125. So, π2 allows for a revenue equal to 20.625% of its edge weight. Ordering π3 = (u2, u1, u3, u4) also corresponds to an acyclic subgraph with edge weight 5. The optimal pricing probabilities for π3 are p3 = (1, 1, 0.5625, 0.5) and extract a revenue of R(π3, p3) = 1.1328. Thus, π3 allows for revenue equal to 22.656% of its edge weight. Also, the revenue extracted by IE({u1, u2}, 0.5147) is 1.0634. Thus, π3 allows for an IE strategy extracting a revenue equal to 21.268% of its edge weight. IE({u1, u2}, 0.5147), for example, approximates the maximum revenue of G within a factor of 1.1964 ≈ 0.8888. On the other hand, if we consider a random ordering of u1 and u2 and of u3 and u4, we obtain a vertex ordering π(cid:48), which combined with p1, gives an expected revenue of ≈ 1.0306. 1.1964 ≈ 0.8614. Hence, (π(cid:48), p) approximates the maximum revenue of G under p1 within a factor of 1.0306 On the other hand, π(cid:48) defines an acyclic subgraph of G which has an expected edge weight of 5 and 6 ≈ 0.8333. approximates the edge weight of the maximum acyclic subgraph of G within a factor of 5 (cid:117)(cid:116) 1.0634 21
1502.07027
1
1502
2015-02-25T01:40:48
Variability in data streams
[ "cs.DS" ]
We consider the problem of tracking with small relative error an integer function $f(n)$ defined by a distributed update stream $f'(n)$. Existing streaming algorithms with worst-case guarantees for this problem assume $f(n)$ to be monotone; there are very large lower bounds on the space requirements for summarizing a distributed non-monotonic stream, often linear in the size $n$ of the stream. Input streams that give rise to large space requirements are highly variable, making relatively large jumps from one timestep to the next. However, streams often vary slowly in practice. What has heretofore been lacking is a framework for non-monotonic streams that admits algorithms whose worst-case performance is as good as existing algorithms for monotone streams and degrades gracefully for non-monotonic streams as those streams vary more quickly. In this paper we propose such a framework. We introduce a new stream parameter, the "variability" $v$, deriving its definition in a way that shows it to be a natural parameter to consider for non-monotonic streams. It is also a useful parameter. From a theoretical perspective, we can adapt existing algorithms for monotone streams to work for non-monotonic streams, with only minor modifications, in such a way that they reduce to the monotone case when the stream happens to be monotone, and in such a way that we can refine the worst-case communication bounds from $\Theta(n)$ to $\tilde{O}(v)$. From a practical perspective, we demonstrate that $v$ can be small in practice by proving that $v$ is $O(\log f(n))$ for monotone streams and $o(n)$ for streams that are "nearly" monotone or that are generated by random walks. We expect $v$ to be $o(n)$ for many other interesting input classes as well.
cs.DS
cs
Variability in data streams David Felber ∗ Rafail Ostrovsky † 5 1 0 2 b e F 5 2 ] S D . s c [ 1 v 7 2 0 7 0 . 2 0 5 1 : v i X r a Abstract We consider the problem of tracking with small relative error an integer function f (n) defined by a distributed update stream f ′(n). Existing streaming algorithms with worst-case guarantees for this problem assume f (n) to be monotone; there are very large lower bounds on the space requirements for summarizing a distributed non-monotonic stream, often linear in the size n of the stream. Input streams that give rise to large space requirements are highly variable, making relatively large jumps from one timestep to the next. However, streams often vary slowly in practice. What has heretofore been lacking is a framework for non-monotonic streams that admits algorithms whose worst-case perfor- mance is as good as existing algorithms for monotone streams and degrades gracefully for non-monotonic streams as those streams vary more quickly. In this paper we propose such a framework. We introduce a new stream parameter, the "variability" v, deriving its definition in a way that shows it to be a natural parameter to consider for non-monotonic streams. It is also a useful parameter. From a theoretical perspective, we can adapt existing algorithms for monotone streams to work for non-monotonic streams, with only minor modifications, in such a way that they reduce to the monotone case when the stream happens to be monotone, and in such a way that we can refine the worst-case communication bounds from Θ(n) to O(v). From a practical perspective, we demonstrate that v can be small in practice by proving that v is O(log f (n)) for monotone streams and o(n) for streams that are "nearly" monotone or that are generated by random walks. We expect v to be o(n) for many other interesting input classes as well. 1 Introduction In the distributed monitoring model, there is a single central monitor and several (k) observers. The observers receive data and communicate with the monitor, and the goal is to maintain at the monitor a summary of the data received at the observers while minimizing the communication between them. This model was introduced by Cormode, Muthukrishnan, and Yi [4] [5] with the motivating application of minimizing radio energy usage in sensor networks, but can be applied to other distributed applications like determining network traffic patterns. Since the monitor can retain all messages received, algorithms in the model can be used to answer historical queries too, making the model useful for auditing changes to and verifying the integrity of time-varying datasets. The distributed monitoring model has also yielded several theoretical results. These include algorithms and lower bounds for tracking total count [4] [5] [10] [11], frequency moments [4] [5] [14] [15], item frequencies [8] [14] [15] [16] [17], quantiles [8] [14] [15] [16] [17], and entropy [1] [14] [15] to small relative error. However, nearly all of the upper bounds assumed that data is only inserted and never deleted. This is unfortunate because in the standard turnstile streaming model, all of these problems have similar algorithms that permit both insertions and deletions. In general, this unfortunate situation is unavoidable; existing lower bounds for the distributed model [1] demonstrate that it is not possible to track even the total item count in small space when data is permitted to be deleted. That said, when restrictions are placed on the types of allowable input, the lower bounds evaporate, and very nice upper bounds exist. Tao, Yi, Sheng, Pei, and Li [13] developed algorithms for the problem of ∗University of California at Los Angeles. [email protected]. †University of California at Los Angeles. [email protected]. 1 summarizing the order statistics history of a dataset D over an insertion/deletion stream of size n, which has an Ω(n)-bit lower bound in general; however, they performed an interesting analysis that yielded online and offline upper bounds proportional toPn t=1 1/D(t), with a nearly matching lower bound. A year or two later, Liu, Radunovi´c, and Vojnovi´c [10] [11] considered the problem of tracking D under random inputs; for general inputs, there is an Ω(n)-bit lower bound, but Liu et. al. obtained (among other results) expected communication costs proportional to √n log n when the insertion/deletion pattern is the result of fair coin flips. In fact, the pessimistic lower bounds for the general case can occur only when the input stream is such that the quantity being tracked is forced to vary quickly. In the problems considered by Tao et. al. and Liu et. al., this occurs when D is usually small. These two groups avoid this problem in two different ways: Tao et. al. provide an analysis that yields a worst-case upper bound that is small when D is usually large, and Liu et. al. consider input classes for which D is usually large in expectation. In this paper we propose a framework that extends the analysis of Tao et. al. to the Our contributions distributed monitoring model and that permits worst-case analysis that can be specialized for random input t=1 1/D(t) in the bounds of Tao et. al. and how we can separate the different sources of randomness that appear in the algorithms of Liu et. al. to obtain worst-case bounds for the random input classes we also consider. classes considered by Liu et. al. In so doing, we explain the intuition behind the factor of Pn In the next section we derive a stream parameter, the variability v. We prove that v is O(log f (n)) for monotone streams and o(n) for streams that are "nearly" monotone or that are generated by random walks, and find that the bounds of Tao et. al. and Liu et. al. are stated nicely in terms of v. In section 3 we combine ideas from the upper bounds of Tao et. al. [13] with the existing distributed counting algorithms of Cormode et. al. [4] [5] and Huang, Yi, and Zhang [8] to obtain upper bounds for distributed counting that are proportional to v. In section 4 we show that our dependence on v is essentially necessary by developing deterministic and randomized space+communication lower bounds that hold even when v is small. We round out the piece in section 5 with a discussion of the suitability of variability as a general framework, in which we extend the ideas of section 3 to the problems of distributed tracking of item frequencies and of tracking general aggregates when k = 1. But before we jump into the derivation of variability, we define our problem formally and abstract away unessential details. Problem definition The problem is that of tracking at the coordinator an integer function f (n) defined by an update stream f′(n) that arrives online at the sites. Time occurs in discrete steps; to be definite, the first timestep is 1, and we define f (0) = 0 unless stated otherwise. At each new current time n the value f′(n) = f (n) − f (n−1) appears at a single site i(n). There is an error parameter ε that is specified at the start. The requirement is that, after each timestep n, the coordinator must have an estimate f (n) for f (n) that is usually good. In particular, for deterministic f (n)− f (n) ≤ εf (n), and for randomized algorithms we require that algorithms we require that ∀n, ∀n, P (f (n)− f(n) ≤ εf (n)) ≥ 2/3. 2 Variability In the original distributed monitoring paper [4], Cormode et. al. define a general thresholded problem (k, f, τ, ε). A dataset D arrives as a distributed stream across k sites. At any given point in time, the coordinator should be able to determine whether f (D) ≥ τ or f (D) ≤ (1−ε)τ . In continuous tracking problems, there is no single threshold, and so f (n) is tracked to within an additive ετ (n), where τ (n) also changes with the dataset D(n). Since τ is now a function, it needs to be defined; the usual choice is f itself, except for tracking item frequencies and order statistics, for which (following the standard streaming model) τ is chosen to be D. That is, the continuous monitoring problem (k, f, ε) is, at all times n maintain at the coordinator an estimate f (n) of f (n) so that f (n)− f (n) ≤ εf (n). 2 εf (t+dt) messages. The motivation for the way we define variability is seen more easily if we first look at the situation as though item arrivals and communication occur continuously. That is, over n = [0.1, 0.2] we receive the second tenth of the first item, for example. At any time t at which f changes by ±εf , we would need to communicate at least one message to keep the coordinator in sync; so if f changes by f′(t) dt then we should communicate f ′(t) dt With discrete arrivals, dt = 1, and we define f′(t) = f (t)− f (t−1). Otherwise, the idea remains the same, so we would expect the total number of messages to look likePn εf (t), where here f′(t) = f (t)− f (t−1). In sections 3 and 4 we find that, modulo the number k of sites and constant factors, this is indeed the case. Being a parameter of the problem rather than of the stream, we can move the 1/ε factor out of our definition of variability and bring it back in along with the appropriate functions of k when we state upper and lower bounds for our problem. This permits us to treat the stream parameter v independently of the problem. We also need to handle the case f = 0 specially, which we can do by communicating at each t=1 f ′(t) f (t) = 1 when f (t) = 0. "variability" for f -variability in the remainder of this paper. f (t) }. We also write v′(t) = min{1, f ′(t) timestep that case occurs. This means we can define f ′(t) t=1 min{1, f ′(t) Pn Taking all of these considerations into account, we define the f -variability of a stream to be v(n) = f (t) } to be the increase in variability at time t. We say In many database applications the database is interesting primarily because it tends to grow more than it shrinks, so it is common for the size of the dataset to have low variability; as more items are inserted, the rate of change of D shrinks relative to itself, and about as many deletions as insertions would be required to keep the ratio constant. In the following subsection, we prove that monotone and nearly monotone functions have low variability and that random walks have low variability in expectation, lending evidence to our belief. From a practical perspective, we believe low variability streams to be common. From a theoretical perspective, variability is a way to analyze algorithms for ε relative error in the face of non-monotonicity and generate provable worst-case bounds that degrade gracefully as our assumptions about the input become increasingly pessimistic. For our counting problem, it allows us to adapt the existing distributed counting algorithms of Cormode et. al. [8] with only minor modifications, and the resulting analyses show that the dependence on k and ε remains unchanged. [4] [5] and Huang et. al. 2.1 Interesting cases with small variability We start with functions that are nearly monotone in the sense that they are eventually mostly nondecreasing. We make this precise in the theorem statement. t=1 f′(t)/f (t) is O(β(n) log(β(n)f (n))). Theorem 2.1. Let f−(n) = Pt:f ′(t)<0 f′(t) and f +(n) = Pt:f ′(t)>0 f′(t). If there is a monotone nonde- creasing function β(t) ≥ 1 and a constant t0 such that for all n ≥ t0 we have f−(n) ≤ β(n)f (n), then the variability Pn The proof, which we defer to appendix A, partitions time into intervals over which f +(t) doubles and shows the variability in each interval to be O(β(n)). When f (n) is strictly monotone, β(n) = 1 suffices, and the theorem reduces to the result claimed in the abstract. As we will see in section 3, our upper bounds will simplify in the monotone case to those of Cormode et. al. [4] [5] and Huang et. al. [8]. Next, we compute the variability for two random input classes considered by Liu et. al. [10] [11]. This will permit us to decouple the randomness of their algorithms from the randomness of their inputs. This means, for example, that even our deterministic algorithm of section 3 has o(n) cost in expectation for these input classes. The first random input class we consider is the symmetric random walk. Theorem 2.2. If f′(t) is a sequence of i.i.d. ±1 coin flips then the expected variability E(v(n)) = O(√n log n). Proof. The update sequence defines a random walk for f (t), and the expected variability is P (f (t) = 0) + n Xt=1 n t Xt=1 Xs=1 3 2P (f (t) = s)/s We use the following fact, mentioned and justified in Liu et. al. [10]: Fact 2.3. For any t ≥ 1 and s ∈ [−t, t] we have P (f (t) = s) ≤ c1/√t, where c1 is some constant. Together, these show the expected cost to be at most (1 + 2Ht)/√t ≤ c2 log(n) 1/√t ≤ c3 log(n)√n c1 n Xt=1 n Xt=1 1 1/√t dt. since (1 + 2Hn) ≤ c2 c1 log(n) and Pn t=1 1/√t ≤ c3 2c2 R n The second random input class we consider is i.i.d. increments with a common drift rate of µ > 0. The case µ < 0 is symmetric. We assume that µ is constant with respect to n. The proof is a simple application of Chernoff bounds and is deferred to appendix B. Theorem 2.4. If f′(t) is a sequence of i.i.d. ±1 random variables with P (f′(t) = 1) = (1 + µ)/2 then E(v(n)) = O( log n µ ). 1 µ √k ε [10] [11] and Tao et. al. Remarks We can restate the results of Liu et. al. [13] in terms of vari- √k ε √n log n) messages (of ability. For unbiased coin flips, Liu et. al. obtain an algorithm that uses O( size O(log n) bits each) in expectation, and for biased coin flips with constant µ, an algorithm that uses (log n)1+c) messages in expectation. If we rewrite these bounds in terms of expected variability, O( √k ε (log n)cE(v(n))), respectively. In the next section, we obtain (when they become O( √k k = O(1/ε2)) a randomized bound of O( ε v(n)). In marked contrast to the bounds of Liu et. al., our bound is a worst-case lower bound that is a function of v(n); if the input happens to be generated by fair coin flips, √k ε √n log n). then our expected cost happens to be O( √k ε E(v(n))) and O( The results of Tao et. al. are for a different problem, but they can still be stated nicely in terms of the D-variability v(n): for the problem of tracking the historical record of order statistics, they obtain a lower bound of Ω( 1 ε2 v(n)), respectively. We adapt ideas from both their upper and lower bounds in sections 3 and 4. ε v(n)) and offline and online upper bounds of O(( 1 ε )v(n)) and O( 1 ε log2 1 3 Upper bounds In this section we develop deterministic and randomized algorithms for maintaining at the coordinator an estimate f (n) for f (n) that is usually good. In particular, for deterministic algorithms we require that ∀n, f (n)− f (n) ≤ εf (n), and for randomized algorithms that ∀n, P (f (n)− f (n) ≤ εf (n)) ≥ 2/3. We √k obtain deterministic and randomized upper bounds of O( k ε )v(n)) messages, respectively. For comparison, the analogous algorithms of Cormode et. al. ε log n) [4] [5] and Huang et. al. ε v(n)) and O((k + [8] use O( k and O((k + √k ε ) log n) messages, respectively. For our upper bounds we assume that f′(n) = ±1 always. If f′(n) > 1 we could simulate it with f′(n) arrivals of ±1 updates with O(log max f′(n)) overhead, as shown in appendix C. 3.1 Partitioning time We use an idea from Tao et. al. [13] to first divide time into manageable blocks. At the end of each block we know the values n and f (n) exactly. Within each block, we know these values only approximately. The division into blocks is deterministic and the same for both our deterministic and randomized algorithms. Our division ensures that the change in v(n) over each block is at least 1/5, which simplifies our analysis. • The coordinator requests the sites' values ci and fi at times n0 = 0, n1, n2, . . . and then broadcasts a value r. These values will be defined momentarily. 4 • Each site i maintains a variable ci that counts the number of stream updates f′(n) it received since the last time it sent ci to the coordinator. It also maintains fi that counts the change in f it received since the last broadcast nj. Whenever ci = ⌈2r−1⌉, site i sends ci to the coordinator. This is in addition to replying to requests from the coordinator. • The coordinator maintains a variable t. After broadcasting r, t is reset to zero. Whenever site i sends ci, the coordinator updates t = t + ci. • The coordinator also maintains variables f , j, and tj. At the first time nj > nj−1 at which t ≥ tj, the coordinator requests the ci and fi values, updates f and r, sets tj+1 = ⌈2r−1⌉k, broadcasts r, and increments j. • When r is updated at the end of time nj, it is set to r if 2r2k ≤ f (nj) < 2r4k and zero if f (nj) < 4k. Thus we divide time into blocks B0, B1, . . ., where Bj = [nj + 1, nj+1]. Algebra tells us some facts: • ⌈2r−1⌉k ≤ nj+1 − nj ≤ 2rk. • If r = 0 then f (n) − f (nj) ≤ k and f (n) ≤ 5k for all n in Bj. • If r ≥ 1 then f (n) − f (nj) ≤ 2rk and 2rk ≤ f (n) ≤ 2r5k for all n in Bj. The total number of messages sent in block Bj is at most 5k: we have at most 2k updates from sites, k in requests from the coordinator, k replies from each site, and k broadcast at nj+1. The change in variability vj = v(nj+1) − V (nj) over block Bj is min{1,f (t)} ≥ (cid:26) k/5k v(nj+1) − v(nj) = 1 nj+1 Xt=nj +1 2rk/2r5k if r = 0 if r ≥ 1(cid:27) ≥ 1/5 And therefore the total number of messages (all O(log n) bits in size) is bounded by 25kv + 3k. 3.2 Estimation inside blocks What remains is to estimate f (n) within a given block. Since we have partitioned time into constant- variability blocks, we can use the algorithms of Cormode et. al. [4] [5] and Huang et. al. [8] almost directly. Both of our algorithms use the following template, changing only condition, message, and update: • Site i maintains a variable di that tracks the drift at site i, defined as the sum of f′(n) updates received • Site i also maintains a variable δi that tracks the change in di since the last time site i sent a message. at site i during the block. That is, f (n) − f (nj) =Pi di. δi is initially zero. • The coordinator maintains an estimate di for each value di. These are initially zero. It also defines two estimates based on these di: di. ◦ For f (n): f (n) = f (nj) + d(n). ◦ For the global drift: d =Pi • When site i receives stream update f′(n), it updates di. It then checks its condition. If true, it sends a message to the coordinator and resets δi = 0. • When the coordinator receives a message from a site i it updates its estimates. 3.3 The deterministic algorithm Our method guarantees that at all times n we have f (n) − f (n) ≤ εf (n). It uses O(kv/ε) messages in total. • Condition: true if δi = 1 and r = 0, or if δi ≥ ε2r. Otherwise, false. • Message: the new value of di. • Update: set di = di. 5 f (n) − f (n) = (f (nj) + d(n)) − ( f (nj) + d(n) + δ(n)) = δ(n) Let δ =Pi δi be the error with which d estimates d =Pi di. The error in f is When r ≥ 1 we have Bj ≤ 2rk, and we always have that δ ≤ Bj. Since we constrain δi < ε2r at the end of each timestep, we have f (n) − f (n) < ε2rk ≤ εf (n). We also use at most 2k/ε messages for the block. If r = 0 then the number of messages is at most k. If r ≥ 1, then since a site must receive ε2r new stream updates to send a new message, and since there are at most 2rk stream updates in the block, there are at most k/ε messages. In each block the change in v is at least 1/5, so the total number of messages is at most 5kv/ε. 3.4 The randomized algorithm Our method uses O(√kv/ε) messages (plus the time partitioning) and guarantees that at all times n we have P (f (n) − f (n) > εf (n)) < 1/3. i and d−i separately. The estimators for those values are independent The idea is to estimate the sums d+ and monotone, so we can use the method of Huang et. al. [8] to estimate the two and then combine them. Specifically, the coordinator and each site run two independent copies A+ and A− of the algorithm. Whenever f′(n) = +1 arrives at site i, a +1 is fed into algorithm A+ at site i. Whenever f′(n) = −1 arrives at site i, a +1 is fed into algorithm A− at site i. So the drifts d+ i and d−i at every site will always be nonnegative. At the coordinator, the estimates d±i and d± are tracked independently also. However, the coordinator also defines d = d+ − d− and f (n) = f (nj) + d(n). The definitions for algorithm A± are • Condition: true with probability p = min{1, 3/ε2rk1/2}. • Message: the new value of d±i . • Update: set d±i = d±i − 1 + 1/p. The following fact 3.1 is lemma 2.1 of Huang et. al. [8]. Our algorithm effectively divides the stream f′(Bj) into two streams f′(B±j ). Since these streams consist of +1 increments only we run the algorithm of Huang et. al. separately on each of them. At any time n, stream f′(B±j ) has seen d±i (n) increments at site i, and lemma 2.1 of Huang et. al. guarantees that the estimates d±i (n) for the counts d±i (n) are good. Fact 3.1. E( d±i ) = d±i and Var( d±i ) ≤ 1/p2. This means that E( d±) = Pi E( d±i ) = Pi d±i , and therefore that E( d) = Pi E(d+ Since the estimators d±i are independent, the variance of the global drift is at most 2k/p2. By Chebyshev's inequality, i − d−i ) = Pi di. P (δ(n) > ε2rk) ≤ 2k/p2 (ε2rk)2 < 1/3 Further, the expected cost of block Bj is at most pBj ≤ (3/ε2rk1/2)(2r2k) ≤ 30k1/2vj/ε. 4 Lower bounds In this section we show that the dependence on v is essentially necessary by developing deterministic and randomized lower bounds on space+communication that hold even when v is small. Admittedly, this is not as pleasing as a pure communication lower bound would be. On the other hand, a distributed monitoring algorithm with high space complexity would be impractical for monitoring sensor data, network traffic patterns, and other applications of the model. Note that in terms of space+communication, our deterministic lower bound is tight up to factors of k, and our randomized lower bound is within a factor of log(n) of that. 6 For these lower bounds we use a slightly different problem. We call this problem the tracing problem. The streaming model for the tracing problem is the standard turnstile streaming model with updates f′(n) arriving online. The problem is to maintain in small space a summary of the sequence f so that, at any current time n, if we are given an earlier time t as a query, we can return an estimate f (t) so that P (f (t)− f (t) ≤ εf (t)) is large (one in the deterministic case, 2/3 in the randomized case). We call this the tracing problem because our summary traces f through time, so that we can look up earlier values. In appendix D we show that a space lower bound for the tracing problem implies a space+communication lower bound for the distributed tracking problem. Here, we develop deterministic and randomized space lower bounds for the tracing problem. 4.1 The deterministic bound The deterministic lower bound that follows is similar in spirit to the lower bound of Tao et. al. [13]. It uses a simple information-theoretic argument. Theorem 4.1. Let ε = 1/m for some integer m ≥ 2, let n ≥ 2m, let c < 1 constant, and let r ≤ nc and even. If a deterministic summary S(f ) guarantees, even only for sequences for which v(n) = 6m+9 2m+6 εr, that f (t) − f (t) ≤ εf (t) for all t ≤ n, then that summary must use Ω( log n ε v(n)) bits of space. The full proof appears in appendix E. At a high level, the sequences in the family take only values m or m + 3, and each sequence is defined by r of the n timesteps. If the new timestep t is one of the r chosen for our sequence, then we flip from m to m + 3 or vice-versa. All of these sequences are unique and there are 2Ω(r log n) of them. 4.2 The randomized bound We use a construction similar to the one in our deterministic lower bound to produce a randomized lower bound. In order to make the analysis simple we forego a single variability value for all sequences in our constructed family, but still maintain that they all have low variability. C is a universal constant to be defined later. Theorem 4.2. Choose ε ≤ 1/2, v ≥ 32400ε ln C, and n > 3v/ε. If a summary S(f ) guarantees, even only for sequences for which v(n) ≤ v, that P (f (t) − f (t) ≤ εf (t)) ≥ 99/100 for all t ≤ n, then that summary must use Ω(v/ε) bits of space. We prove this theorem in two lemmas. In the first lemma, we reduce the claim to a claim about the existence of a hard family of sequences. In the second lemma we show the existence of such a family. First a couple of definitions. For any two sequences f and g define the number of overlaps between f and g to be the number of positions 1 ≤ t ≤ n for which f (t) − g(t) ≤ ε max{f (t), g(t)}. Say that f and g match if they have at least 6 10 n overlaps. Lemma 4.3. Let F be a family of sequences of length n and variabilities ≤ v such that no two sequences in F match. If a summary S(f ) guarantees for all f in F that P (f (t) − f (t) ≤ εf (t)) ≥ 99/100 for all t ≤ n, then that summary must use Ω(log F) bits of space. The full proof appears in appendix F. At a high level, if S(f ) is the summary for a sequence f , we can use it to generate an approximation f that at least 90% of the time overlaps with f in at least 9 10 n positions. Since no two sequences in F overlap in more than 6 10 n positions, at least 90% of the time we can determine f given f . We then solve the one-way IndexN problem by deterministically generating F and sending a summary S(f (x)), where x is Alice's input string of size N = log2 F, and f (x) is the xth sequence in F . 7 Lemma 4.4. For all ε ≤ 1/2, v ≥ 32400ε ln C, and n > 3v/ε, there is a family F of size eΩ(v/ε) of sequences of size n such that: 1. no two sequences match, and 2. every sequence has variability at most v. The full proof appears in appendix G. At a high level, sequences again switch between m = 1/ε and m+3, except that these switches are chosen independently. We model the overlap with a Markov chain; the overlap between any two sequences is the sum over times t of a function y applied to the states of a chain modeling their interaction. We then apply a result of Chung, Lam, Liu, and Mitzenmacher [2] to show that the probability that any two sequences match is low. Lastly, we show that not too many sequences have variability more than v, by proving that they usually don't switch between m and m+3 many times. 5 Variability as a framework In section 2 we proposed the f -variabilityPn f (t) } as a way to analyze algorithms for the contin- uous monitoring problem (k, f, ε) over general update streams. However, our discussion so far has focused on distributed counting. In this final section we revisit the suitability of our definition by mentioning extensions to tracking other functions of a dataset defined by a distributed update stream. We include fuller discussions of these extensions in the appendices. t=1 min{1, f ′(t) 5.1 Tracking item frequencies We can extend our deterministic algorithm of section 3 to the problem of tracking item frequencies, in a manner similar to that in which Yi and Zhang [16] [17] extend the ideas of Cormode et. al. [4] to this problem. The definition of this problem, the required changes to our algorithm of section 3 needed to solve this problem, and a discussion of the difficulties in finding a randomized algorithm, are discussed in appendix H. 5.2 Aggregate functions with one site In this subsection we consider general single-integer-valued functions f of a dataset. When there is a single site, the site always knows the exact value of f (n), and the only issue is updating the coordinator to have an approximation f (n) so that f (n)− f (n) ≤ εf (n) for all n. We can show that this problem of tracking f to ε relative error when k = 1 has an O( 1 ε v(n))-word upper bound, where here v(n) is the f -variability. The algorithm is: whenever f − f > εf , send f to the coordinator. The proof is a simple potential argument and is deferred to appendix I. Along with our lower bounds of section 4, this upper bound lends evidence to our claim that variability captures the difficulty of communicating changes in f that are due to the non-monotonicity of the input stream. A bolder claim is that variability is also useful in capturing the difficulty of the distributed compu- tation of a general function that is due to the non-monotonicity of the input stream, but the extent to which that claim is true has yet to be determined. Acknowledgments Research supported in part by NSF grants CCF-0916574; IIS-1065276; CCF-1016540; CNS-1118126; CNS- 1136174; US-Israel BSF grant 2008411, OKAWA Foundation Research Award, IBM Faculty Research Award, Xerox Faculty Research Award, B. John Garrick Foundation Award, Teradata Research Award, and Lockheed- Martin Corporation Research Award. This material is also based upon work supported by the Defense 8 Advanced Research Projects Agency through the U.S. Office of Naval Research under Contract N00014-11- 1-0392. The views expressed are those of the author and do not reflect the official policy or position of the Department of Defense or the U.S. Government. References [1] Chrisil Arackaparambil, Joshua Brody, and Amit Chakrabarti. Functional monitoring without mono- tonicity. In Automata, Languages and Programming, pages 95 -- 106. Springer, 2009. [2] Kai-Min Chung, Henry Lam, Zhenming Liu, and Michael Mitzenmacher. Chernoff-hoeffding bounds for markov chains: Generalized and simplified. arXiv preprint arXiv:1201.0559, 2012. [3] Graham Cormode and S. Muthukrishnan. An improved data stream summary: the count-min sketch and its applications. Journal of Algorithms, 55(1):58 -- 75, 2005. [4] Graham Cormode, S. Muthukrishnan, and Ke Yi. Algorithms for distributed functional monitoring. In Proceedings of the Nineteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '08, pages 1076 -- 1085, Philadelphia, PA, USA, 2008. Society for Industrial and Applied Mathematics. [5] Graham Cormode, S Muthukrishnan, and Ke Yi. Algorithms for distributed functional monitoring. ACM Transactions on Algorithms (TALG), 7(2):21, 2011. [6] Sumit Ganguly and Anirban Majumder. Cr-precis: A deterministic summary structure for update data streams. CoRR, abs/cs/0609032, 2006. [7] Sumit Ganguly and Anirban Majumder. Cr-precis: A deterministic summary structure for update data streams. In Bo Chen, Mike Paterson, and Guochuan Zhang, editors, Combinatorics, Algorithms, Probabilistic and Experimental Methodologies, volume 4614 of Lecture Notes in Computer Science, pages 48 -- 59. Springer Berlin Heidelberg, 2007. [8] Zengfeng Huang, Ke Yi, and Qin Zhang. Randomized algorithms for tracking distributed count, fre- quencies, and ranks. In Proceedings of the 31st symposium on Principles of Database Systems, pages 295 -- 306. ACM, 2012. [9] Eyal Kushilevitz and Noam Nisan. Communication Complexity. Cambridge University Press, New York, NY, USA, 1997. [10] Zhenming Liu, Bozidar Radunovi´c, and Milan Vojnovi´c. Continuous distributed counting for non- monotonic streams. In Technical Report MSR-TR-2011-128, 2011. [11] Zhenming Liu, Bozidar Radunovi´c, and Milan Vojnovi´c. Continuous distributed counting for non- monotonic streams. In Proceedings of the 31st symposium on Principles of Database Systems, pages 307 -- 318. ACM, 2012. [12] Shanmugavelayutham Muthukrishnan. Data streams: Algorithms and applications. Now Publishers Inc, 2005. [13] Yufei Tao, Ke Yi, Cheng Sheng, Jian Pei, and Feifei Li. Logging every footstep: quantile summaries for the entire history. In Proceedings of the 2010 ACM SIGMOD International Conference on Management of data, SIGMOD '10, pages 639 -- 650, New York, NY, USA, 2010. ACM. [14] David P. Woodruff and Qin Zhang. Tight bounds for distributed functional monitoring. CoRR, abs/1112.5153, 2011. [15] David P Woodruff and Qin Zhang. Tight bounds for distributed functional monitoring. In Proceedings of the 44th symposium on Theory of Computing, pages 941 -- 960. ACM, 2012. 9 [16] Ke Yi and Qin Zhang. Optimal tracking of distributed heavy hitters and quantiles. In Proceedings of the Twenty-eighth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS '09, pages 167 -- 174, New York, NY, USA, 2009. ACM. [17] Ke Yi and Qin Zhang. Optimal tracking of distributed heavy hitters and quantiles. Algorithmica, 65(1):206 -- 223, 2013. A Variability of nearly monotone f (n), theorem 2.1 t=1 f′(t)/f (t) is O(β(n) log(β(n)f (n))). Theorem A.1. Let f−(n) =Pt:f ′(t)<0 f′(t) and f +(n) =Pt:f ′(t)>0 f′(t). If there is a monotone nonde- creasing function β(t) ≥ 1 and a constant t0 such that for all n ≥ t0 we have f−(n) ≤ β(n)f (n), then the variability Pn Proof. For i = 1, . . . , k, define ti to be the earliest time t such that f +(ti) > 2f +(ti−1), where k is the smallest index such that tk > n. (If k is undefined, define k = n + 1.) The cost Pt0−1 t=t0 f′(t)/f (t) as follows. We partition the interval [t0, tk) into subintervals [t0, t1), . . . , [tk−1, tk) and sum over the times t in each one. There are at most 1 + log f +(n) of these subintervals. t=1 f′(t)/f (t) is constant. We bound the cost Pn f′(t) f (t) ≤ n Xt=t0 ti−1 f′(t) k ti−1 k k f′(t) f (t) ≤ 1 + β(n) f +(ti−1) Xi=1 Xt=ti−1 Xt=ti−1 f +(ti−1) + f−(ti−1) Xi=1 Xi=1 ≤ f (ti−1) ≤ 4(1 + β(n))(1 + log f +(ti−1)) ≤ 4(1 + β(n))(1 + log(2(1 + β(n))f (n))) (1 + β(n)) because the condition f−(t) ≤ β(t)f (t) implies f (t) ≥ f +(t)/(1 + β(t)) and f−(t) ≤ f +(t). B Variability of biased coin flips, theorem 2.4 Theorem B.1. If f′(t) is a sequence of i.i.d. ±1 random variables with P (f′(t) = 1) = (1 + µ)/2 then E(v(n)) = O( log n µ ). Proof. We show that, with high probability, f (t) ≥ µt/2 for times t ≥ t0 = t0(n) when n is large enough with respect to µ. We write f (t) = −t + 2Yt, where Yt =Pt 2 . We have that P (f (t) ≤ µt/2) = P (Yt ≤ 2+µ 4 t) ≤ exp(−µt/16). Let A be the event ∃t ≥ t0 (f (t) ≤ µt/2). Then P (A) ≤ Pn e−µt/16 by the union bound. We can upper bound this sum by 2 t. Using a Chernoff bound, P (Yt ≤ 2+µ s=1 ys, and ys is a Bernoulli variable with mean 1+µ 4 t) and that E(Yt) = 1+µ t=t0 n e−µt/16 ≤ e−µt0/16 +Z n Taking t0 = (16/µ) ln(17n/µ) gives us P (A) ≤ 1/n. Thus Xt=t0 t0 e−µt/16 dt ≤ 17e−µt0/16/µ E n Xt=1 min{1, yielding the theorem. f′(t) f (t) }! ≤ t0 +(cid:18) 1 n(cid:19) n +(cid:18)1 − 1 n(cid:19) n Xt=t0 2 µt µ (cid:19) = O(cid:18) log n 10 C Simulating large f′(n), section 3 We noted in section 3 that we can simulate f′(n) > 1 with f′(n) arrivals of ±1 updates with O(log max f′(n)) overhead. To simplify notation we define 1/f (n) = 1 when f (n) = 0 and assume that f (n) ≥ 0 always. Theorem C.1. For f′(n) > 1 we have Pf ′(n) P1−f ′(n) Proof. For f′(n) > 1, we have Pf ′(n) If f′(n) < −1 and f (n) ≥ 1, thenP1−f ′(n) and if f (n) = 0, add another f′(n)/f (n). f (n−1)+t ≤ f ′(n) f ′(n)−t f (n) (cid:17) = 1 f (n) + f ′(n) f (n) +ln(cid:16)1 + f ′(n) f (n) (1 + H(f′(n))) and for f′(n) < −1 we have f (n) Pf ′(n) f (n) (cid:17) ≤ 2f ′(n) f (n)Pf ′(n) f (n) +ln(cid:16) f (n−1) f (n) , where H(x) is the xth harmonic number. f (n−1)+t ≤ f ′(n) f (n)+t ≤ 3f ′(n) 1 f (n−1)+t = f ′(n) f (n) + 1 1 f (n)+t ≤ 1 1 t . , f (n) 1 t=1 t=0 t t=1 t=0 t=1 t=1 D Tracing and distributed tracking, section 4 Lemma D.1. Fix some ε. Suppose that the tracing problem has an Ω(Lε(n))-bit space deterministic lower bound. Also suppose that there is a deterministic algorithm A for the distributed tracking problem that uses Ω(Cε(n)) bits of communication and Ω(Sε(n)) bits of space at the site and coordinator combined. Then we must have C + S = Ω(L). Further, if we replace "deterministic" with "randomized" in the preceding paragraph, the claim still holds. Proof. Suppose instead that for all constants c < 1 and all n0 there is an n > n0 such that C(n) + S(n) < cL(n). Then we can write an algorithm B for the tracing problem that uses L′(n) < cL(n) bits of space: simulate A, recording all communication, and on a query t, play back the communication that occurred through time t. At no point did we use the fact that A guarantees P (f (t)− f (t) ≤ εf (t)) = 1, so the claim still holds if we change the correctness requirement to P ≥ 2/3. E Deterministic lower bound, theorem 4.1 Theorem E.1. Let ε = 1/m for some integer m ≥ 2, let n ≥ 2m, let c < 1 constant, and let r ≤ nc and even. If a deterministic summary S(f ) guarantees, even only for sequences for which v(n) = 6m+9 2m+6 εr, that f (t) − f (t) ≤ εf (t) for all t ≤ n, then that summary must use Ω( log n Proof. We construct a family of input sequences of length n and variability 6m+9 indices 1 . . . n so that there are choose(n, r) such sets. 2m+6 εr. Choose sets of r different ε v(n)) bits of space. For each set S we define an input sequence fS. We define fS(0) = m and the rest of fS recursively: fS(t) = fS(t−1) if t is not in S, and fS(t) = (2m + 3) − fS(t−1) if t is in S. (That is, switch between m and m + 3.) If A and B are two different sets, then fA 6= fB: let i be the smallest index that is in one and not the other; say i is in A. Then fA(1 . . . (i−1)) = fB(1 . . . (i−1)), but fA(i) 6= fA(i−1) = fB(i−1) = fB(i). The variability of any fS is 6m+9 2m+6 εr: There are r/2 changes from m to m + 3 and another r/2 from m + 3 to m. When we switch from m to m + 3, we get f′(t)/f (t) = 3/(m + 3), and when we switch from m + 3 to m, we get f′(t)/f (t) = 3/m. Thus Pt f ′(t) There are choose(n, r) ≥ (n/r)r input sequences in our family, so to distinguish between any two input sequences we need at least r log(n/r) = Ω(r log n) bits. Any summary that can determine for each t the value f (t) to within ±εf (t), must also distinguish between f (t) = m and f (t) = m + 3, since there is no value within εm of m and also within ε(m + 3) of m + 3. Since this summary must distinguish between f (t) = m and f (t) = m + 3 for all t, it must distinguish between any two input sequences in the family, and therefore needs Ω(r log n) bits. m(m+3) = 6m+9 f (t) = r 2m+6 εr. 6m+9 2 11 F Randomized lower bound, lemma 4.3 Lemma F.1. Let F be a family of sequences of length n and variabilities ≤ v such that no two sequences in F match. If a summary S(f ) guarantees for all f in F that P (f (t) − f (t) ≤ εf (t)) ≥ 99/100 for all t ≤ n, then that summary must use Ω(log F) bits of space. Proof. Let S(f ) be the summary for a sequence f , and sample f (1) . . . f (n) once each using S(f ) to get f . Let A be the event that {t : f (t)− f (t) ≤ εf (t)} ≥ 90 100 n. By Markov's inequality and the guarantee in the premise, we must have P (A) ≥ 9/10. have that f overlaps with f in at least 9 in at most 7 10 n positions: at most the 6 might not overlap. Let ω define the random bits used in constructing S(f ) and in sampling f . For any choice ω in A we 10 n positions, which means that f overlaps with any other g ∈ F 10 n in which f and f 10 n in which f and g could overlap, plus the 1 Define F ⊆ F to be the sequences g that overlap with f in at least 9 10 n positions. This means that when ω ∈ A we have F = 1, and therefore with probability at least 9/10 we can identify which sequence f had been used to construct S(f ). We now prove our claim by reducing the IndexN problem to the problem of tracing the history of a sequence f . The following statement of IndexN is roughly as in Kushilevitz and Nisan [9]. There are two parties, Alice and Bob. Alice has an input string x of length N = log2 F and Bob has an input string i of length log2 N that is interpreted as an index into x. Alice sends a message to Bob, and then Bob must output xi correctly with probability at least 9/10. Consider the following algorithm for solving IndexN . Alice deterministically generates a family F of sequences of length n and variabilities ≤ v such that no two match, by iterating over all possible sequences and choosing each next one that doesn't match any already chosen. Her log2 F bits of input x index a sequence f in F . Alice computes a summary S(f ) and sends it to Bob. After receiving S(f ), Bob computes f (t) for every t = 1 . . . n, to get a sequence f . He then generates F himself and creates a set F of all sequences in F that overlap with f in at least 9 10 n positions. If F = {f}, which it is with probability at least 9/10, then Bob can infer every bit of x. Since the IndexN problem is known to have a one-way communication complexity of Ω(N ), it must be that S(f ) = Ω(log F). G Randomized lower bound, lemma 4.4 Lemma G.1. For all ε ≤ 1/2, v ≥ 32400ε ln C, and n > 3v/ε, there is a family F of size eΩ(v/ε) of sequences of size n such that: 1. no two sequences match, and 2. every sequence has variability at most v. Proof. We construct F so that each of the two items holds (separately) with probability at least 4/5. Let m = 1/ε. To construct one sequence in F , first define f (0) = m with probability 1/2, else f (0) = m+ 3. Then, for t = 1 . . . n: define f (t) = (2m+3) − f (t−1) with probability p = v/6εn, else f (t) = f (t−1). That is, switch from m to m+3 (or vice-versa) with probability p = v/6εn. We first prove that the probability is at most 1/5 that any two sequences f and g match. We have that P (f (0) = g(0)) = 1/2. If at any point in time we have f (t) = g(t), then P (f (t+1) = g(t+1)) = α = 1−2p(1−p) and P (f (t+1)6= g(t+1)) = 1 − α = 2p(1−p). Similarly, if f (t) 6= g(t), then P (f (t+1) = g(t+1)) = 1 − α and P (f (t+1)6= g(t+1)) = α. The overlap between f and g is the number of times t that f (t) = g(t). We model this situation with a Markov chain M with two states, c for "same" (that is, f = g) and d for "different" (f 6= g). Let st be the state after t steps, and let pt = (pt(c), pt(d)) be the probabilities that M is in state c and d after step t. The stationary distribution π = (1/2, 1/2), which also happens to be our initial distribution. We can 12 model the overlap between f and g by defining a function y(st) = 1 if st = c and y(st) = 0 otherwise; then The (1/8)-mixing time T is defined as the smallest time T such that 1 t=1 y(st) is the overlap between f and g. The expected value E(y(π)) of y evaluated on π is 1/2. Y =Pn 2M tr0 − π1 ≤ 1/8 over all initial distributions r0. Let r0 be any initial distribution and rt = M tr0. If we define ∆t = rt(c) − π(c), then ∆t = (2α−1)t∆0. We can similarly bound rt(d) − π(d), so we can bound 2p(1−p) ≤ ln(1/(2α−1)) ≤ (1 − (2α−1)) ≤ T ≤ 3 2p = 9εn v ln(8) 3 3 since 1 − p ≥ 1/2 and since 1/ ln(1/x) ≤ 1/(1−x) for x in (0, 1). With this information we can now apply a sledgehammer of a result by Chung, Lam, Liu, and Mitzenmacher [2]. Our fact G.2 is their theorem 3.1, specialized a bit to our situation: Fact G.2. Let M be an ergodic Markov chain with state space S. Let T be its (1/8)-mixing time. Let (s1, . . . , sn) denote an n-step random walk on M starting from its stationary distribution π. Let y be a t=1 y(st). Then there weight function such that E(y(π)) = µ. Define the total weight of the walk by Y = Pn exists some universal constant C such that P (Y ≥ (1 + δ)µn) ≤ C exp(−δ2µn/72T ) when 0 < δ < 1. Specifically, this means that P (Y ≥ 6 also write P ≤ exp(−v/32400ε). If F = 1 at least 4/5, no pair of sequences f, g matches. 10 n) ≤ C exp(−v/(25 · 72 · 9 · ε)). Since v is large enough, we can 5 exp(v/(2 · 32400ε)), then by the union bound, with probability We also must prove that there are enough sequences with variability at most v. The change in variability due to a single switch from m to m+3 (or vice-versa) is at most 3/m = 3ε. For any sequence f , let Ut = 1 if f switched at time t, else Ut = 0. The expected number of switches is v/6ε; using a standard Chernoff bound, P (Pt Ut ≥ 2v/6ε) ≤ exp(−v/18ε) ≤ 1/10. Suppose we sample N sequences and B of them have more than 2v/6ε switches. In expectation there are at most E(B) ≤ 1 10 N that have too many switches. By Markov's inequality, P (B ≥ N/2) ≤ 1/5, so we can toss out the ≤ N/2 bad sequences. This gives us a final size of F of 1 10 exp(v/(2 · 32400ε)). H Tracking item frequencies, section 5.1 Problem definition The problem of tracking item frequencies is only slightly different than the counting problem we've considered so far. In this problem there is a universe U of items and we maintain a dataset D(t) that changes over time. At each new timestep n, either some item ℓ from U is added to D, or some item ℓ from D is removed. This update is told to a single site i; that is, site i(n) receives an update f′ℓ(n) = ±1. The frequency fℓ(t) of item ℓ at time t is the number of copies of ℓ that appear in D(t). The first frequency moment F1(t) at time t is the total number of items D(t). The problem is to maintain estimates fℓ(n) at the coordinator so that for all times n and all items ℓ we have that P (fℓ(n)− fℓ(n) ≤ εF1(n)) is large. Since in this problem we are tracking each item frequency to εF1(n), we use F1-variability instead, defining v′(t) = min{1, 1/F1(t)}. H.0.1 Item frequencies with low communication We first partition time into blocks as in section 3.1, using f = F1. That is, at the end of each block we know the values n and F1(n) deterministically, and also that either r = 0 holds or that F1(nj) is within a factor of two of F1(nj−1). For tracking during blocks we modify the deterministic algorithm so that each site i holds counters diℓ and δiℓ for every item ℓ. It also holds counters fiℓ of the total number of copies of ℓ seen at site i across all blocks. At the end of each block, each site i reports all fiℓ ≥ ε2r/3 (using the new value of r). If site i reports counter fiℓ then it starts the next block with diℓ = δiℓ = 0; otherwise, diℓ is updated to diℓ + δiℓ and then δiℓ is reset to zero. Within a block r ≥ 1, the condition is true when δiℓ ≥ ε2r/3. 13 The coordinator maintains estimates fiℓ of fiℓ for each site i and item ℓ. Upon receiving an update δiℓ during a block the coordinator updates its estimate fiℓ = fiℓ + δiℓ. Estimation error The total error in the estimate fiℓ(n) at any time n is the error due to diℓ plus the error due to δiℓ. In both cases these quantities are bounded by ε2r/3 ≤ εF1(n)/3. Communication The total communication for a block is the total communicated within and at the end of the block. Within a block, all δiℓ start at zero, and there are at most 2rk updates, so the total number of messages sent is 3k/ε. At the end of a block, fiℓ ≥ ε2r/3 is true for at most 12k/ε counters fiℓ. Therefore the total number of messages O( k ε v(n)). H.0.2 Item frequencies in small space+communication The algorithm so far uses U counters per site, which is prohibitive in terms of space. In [3] Cormode and Muthukrishnan show that in order to track over a non-distributed update stream each fℓ(n) so that for all ℓ and all times n we have P (fℓ(n)− fℓ(n) ≤ εF1(n)/3) ≥ 8/9, it suffices to randomly partition each item in U into one of 27/ε classes using a pairwise-independent hash function h, and to estimate fℓ(n) as fh(ℓ)(n). The 27/ε counters and the hash function h together form their Count-Min Sketch [3]. ε rows of 6 log U Similarly, in [6] [7] Ganguly and Majumder adapt a data structure of Gasieniec and Muthukrishnan [12], which they call the CR-precis, to deterministically track each fℓ(n) to εF1(n)/3 error. This data structure uses 3 ε log 1/ε counters, and estimates fℓ(n) as the average over rows r of fh(r,ℓ)(n). (Ganguly and Majumder actually take the minimum over the rows r, but the average works too and yields a linear sketch.) In either case, we can first reduce our set of items ℓ to a small number of counters c, and instead of tracking fiℓ we track fic for each counter c. The coordinator can then linearly combine its estimates fic to obtain estimates fiℓ for each item ℓ. This introduces another εF1(n)/3 error, yielding algorithms that guarantee • P (fiℓ(n)− fiℓ(n) ≤ εF1(n)) = 1 in O( k log U • P (fiℓ(n)− fiℓ(n) ≤ εF1(n)) ≥ 8/9 in O(k log U + k ε2 log 1/ε v(n) log n) bits of space + communication, and ε v(n) log n) bits of space + communication. H.0.3 Remarks We obtain a randomized communication bound of O( k ε v(n)) messages, but it might be possible to do better. √k In [8] Huang et. al. both develop a randomized counting algorithm (O( ε log n) messages) and also extend it to the problem of tracking item frequencies to get the same communication bound. Unfortunately, their algorithm appears to require the total variance in their estimate at any time t < n to be bounded by a constant factor of the variance at time n. This is only guaranteed to be true when item deletions are not permitted (and F1 grows monotonically). We avoid this problem in section 3.4 for tracking f = F1 by deterministically updating F1 at the end of each block. For this problem, though, deterministically updating all of the large fiℓ at the end of each block could incur O(1/ε) messages. Whether it is also possible to √k ε v(n)) messages remains open. probabilistically track item frequencies over general update streams in O( I Aggregate functions with one site, section 5.2 The single-site algorithm of section 5.2 is: whenever f − f > εf , send f to the coordinator. Proof. If f (n) = 0 then v′(n) = 1. Also, if f (n) changes sign from f (n− 1), then v′(n) = 1. So consider intervals over which f (n) is nonzero and doesn't change sign. Over such an interval, let Φ(n) = f (n)− f (n) . f (n) 14 If at time n we update f then Φ(n) = 0. Otherwise, Φ(n) = f (n−1) − f (n−1) + f′(n) f (n) Φ(n−1) + f′(n) (1+Φ(n−1))f′(n) = f (n−1) f (n) f (n) f (n) ≤ f (n) + f′(n) f (n) f (n) ≤ Φ(n−1) + ≤ f (n−1) − f (n−1) + f′(n) f (n) Φ(n−1) + f′(n) f (n) Since Φ(n) ≤ ε we have Φ′(n) ≤ (1+ε) f ′(n) ε, so the total number of messages sent is at most the total increase in Φ, which is Pn f (n) . We only send a message each time that Φ would be more than t=1 min{1, f ′(t) f (t) }. 15
1302.5366
3
1302
2016-03-10T17:00:22
Testing Uniformity of Stationary Distribution
[ "cs.DS", "cs.CC" ]
A random walk on a directed graph gives a Markov chain on the vertices of the graph. An important question that arises often in the context of Markov chain is whether the uniform distribution on the vertices of the graph is a stationary distribution of the Markov chain. Stationary distribution of a Markov chain is a global property of the graph. In this paper, we prove that for a regular directed graph whether the uniform distribution on the vertices of the graph is a stationary distribution, depends on a local property of the graph, namely if (u,v) is an directed edge then outdegree(u) is equal to indegree(v). This result also has an application to the problem of testing whether a given distribution is uniform or "far" from being uniform. This is a well studied problem in property testing and statistics. If the distribution is the stationary distribution of the lazy random walk on a directed graph and the graph is given as an input, then how many bits of the input graph do one need to query in order to decide whether the distribution is uniform or "far" from it? This is a problem of graph property testing and we consider this problem in the orientation model (introduced by Halevy et al.). We reduce this problem to test (in the orientation model) whether a directed graph is Eulerian. And using result of Fischer et al. on query complexity of testing (in the orientation model) whether a graph is Eulerian, we obtain bounds on the query complexity for testing whether the stationary distribution is uniform.
cs.DS
cs
Testing whether the Uniform Distribution is a Stationary Distribution Sourav Chakrabortya, Akshay Kamatha, Rameshwar Pratap1a a Chennai Mathematical Institute, Chennai, India. e-mail:{sourav,adkamath,rameshwar}@cmi.ac.in Abstract A random walk on a directed graph generates a Markov chain on the vertices of the graph. An important question that often arises in the context of Markov chains is, whether the uniform distribution on the vertices of the graph is a stationary distribution. A stationary distribution of a Markov chain is a global property of the graph. This leads to the belief that whether a particular distribution is a stationary distribution of a Markov chain depends on the global property of that Markov chain. In this paper for a directed graph whose underlying undirected graph is regular, we prove that whether the uniform distribution on the vertices of the graph is a stationary distribution, depends on a local property of the graph, namely if (u, v) is a directed edge, then out-degree(u) is equal to in-degree(v). This result also has an application to the problem of testing whether a given distribution is uniform or "far" from being uniform. If the distribution is the stationary distribution of the lazy random walk on a directed graph and the graph is given as an input, then how many bits (orientations) of the input graph does one need to query in order to decide whether the distribution is uniform or "far"1 from it? This is a problem of graph property testing, and we consider this problem in the orientation model. We reduce this problem to testing Eulerianity in the orientation model. Keywords: Markov Chain; Property Testing; Orientation Model; Stationary Distribution. 1. Introduction Spectral properties of undirected graphs have been well studied and well understood [2]. How- ever, there has been less success in the study of the same in the case of directed graphs, possibly due the non-symmetric structure associated with its adjaceny matrix. In this work, we attempt to understand the spectral properties of Markov chains obtained by a random walk on a directed graph. Markov chains are one of the most important structures in Theoretical Computer Science. The most significant characteristics of a Markov chain are its stationary distribution and mixing time. It is an 1Corresponding author: This work done when the author was pursuing his PhD from Chennai Mathematical Institute. Present/corresponding address: 122/7 PAC Colony, Naini, Allahabad, UP, India. Contact Number: +91 9953842289 1Here, farness does not imply any statistical distance between the distributions. Rather, it specifies the distance between the orientations - i.e. the minimum number of edges that need to be reoriented such that the stationary distribution obtained by a random walk on the resulting graph (obtained after reorientation of edges) is uniform. Preprint submitted to Elsevier October 30, 2018 interesting problem to test if a particular distribution is a stationary distribution of a given Markov chain. Since a stationary distribution of a Markov chain is a global property of the graph, this leads to the belief that whether a particular distribution is a stationary distribution of a Markov chain depends on its global structure. In this paper, we focus on the Markov chain obtained by a random walk on a directed graph. We prove contrary to aforementioned belief that if the graph is regular, then whether the uniform distribution is a stationary distribution depends on a local property of the graph. The following theorem, which is the main result of this paper, is a statement about that local property. −→ G = (V, −→ Theorem 1. Let E ) be a directed graph such that the total degree (i.e., Indegree(v)+ Outdegree(v)) for every vertex v ∈ V is the same. Then the uniform distribution on the vertices of −→ −→ G is a stationary distribution of the Markov chain (generated by a random walk on G) if and only if the graph has the following properties: 1. for all v ∈ V , Indegree(v) 6= 0 and Outdegree(v) 6= 0, 2. for all (u, v) ∈ −→ E , Outdegree(u)=Indegree(v). As an application of this result, we design a testing algorithm to test whether the uniform dis- tribution is the stationary distribution of the Markov chain generated by a lazy random walk 2 on −→ G. 1.1. Application to Property Testing of Distributions In property testing, the goal is to look at a very small fraction of the input and decide whether the input has a certain property, or it is "far" from satisfying the property. For a given distance parameter 0 < ǫ < 1, we say that the input is an ǫ-far from satisfying the property if one has to change at least ǫ fraction of the input to make the input satisfy the property. Theorem 1 also has an application to the problem of testing whether a given distribution is uniform or "far" from being uniform. More precisely, if the distribution is the stationary distribution of the lazy random walk on a directed graph and the graph is given as an input, then how many bits of the input graph do one need to query in order to decide whether the distribution is uniform or "far" from it? We consider this problem in the orientation model (see [5]). In this model, the underlying undirected graph G = (V, E) is known in advance, and the orientation of the edges has to be queried. The graph is said to be "ǫ-far" from satisfying the property P if one has to reorient at least an ǫ fraction of the edges to make the graph satisfy the property. We reduced this problem to testing Eulerianity in the orientation model. We use the results of [4] to obtain an algorithm that incurs sublinear cost for the above problem. We present this part of our result in Section 4. 2. Preliminaries 2.1. Graph Notations Throughout the paper, we will be dealing with directed graphs (possibly with multiple edges between any two vertices) in which each edge is directed only in one direction. To avoid confusion, 2 A lazy random walk (starting from a particular vertex) on a directed graph is a random walk in which at each time step, 2 or moves according to the usual random walk. Moreover, it converges to a the walk stays where it is with probability 1 unique stationary distribution. 2 −→ G = (V, we will call them oriented graphs because each edge is oriented and is not bidirectional. We will −→ denote the oriented graph by E ), and the underlying undirected graph (that is, when the directions on the edges are removed) by G = (V, E). For a vertex v ∈ V , the in-degree and the −→ out-degree of v in E ) is called a degree-∆ oriented graph if for all v ∈ V , d−(v) + d+(v) = ∆. In this paper, we will be focusing on degree-∆ oriented graphs. −→ G are denoted by d−(v) and d+(v) respectively. An oriented graph −→ G = (V, 2.2. Markov Chains Preliminaries Fact 2. A Markov chain is a stochastic process on a set of states given by a transition matrix. Let S be the set of states with S = n. Then, the transition matrix T is an n × n matrix with entries from the positive reals; the rows and columns are indexed by the states; the (u, v)-th entry Tu,v of the matrix denotes the probability of transition from state u to state v. Since T is stochastic,Pv Tu,v must be 1. A distribution µ : S → R+ on the vertices is said to be stationary if for all vertices v, µ(u)Tu,v = µ(v). Xv −→ G is an oriented graph then a random walk on −→ Fact 3. If G defines a Markov chain, where, the states are the vertices of the graph; the probability to traverse an edge (u, v) is given by the quantity pu,v = 1 d+(u) ; and hence, the transition probability Tu,v from vertex u to vertex v is pu,v times the −→ G is a stationary number of edges between u and v. The uniform distribution on the vertices of distribution for this Markov chain if and only if for all v ∈ V , Xu:(u,v)∈−→E pu,v = 1 = Xw:(v,w)∈−→E pv,w. Note 4. In this paper, we will only consider Markov chains that arise from random walks on where −→ G is an oriented graph. −→ G, 3. Structure of Graphs with Uniform Stationary Distribution The following theorem is a rephrasing of Theorem 1. −→ G = (V, −→ E ) be a degree-∆ oriented graph, then the uniform distribution on the −→ G is a stationary distribution of the Markov chain if and only if for all v ∈ V , both Theorem 5. Let vertices of d−(v), d+(v) 6= 0 and for all (u, v) ∈ −→ E , d+(u) = d−(v). PROOF. First of all, recall that the uniform distribution is a stationary distribution for if for all v ∈ V , Xu:(u,v)∈−→E pu,v = 1 = Xw:(v,w)∈−→E pv,w, where pu,v is the transition probability from vertex u to vertex v, and pu,v = 1 d+(u) . 3 −→ G , if and only Thus, if the graph −→ G has the property that for all (u, v) ∈ −→ E , d+(u) = d−(v), then Xu:(u,v)∈−→E pu,v = Xu:(u,v)∈−→E 1 d+(u) = Xu:(u,v)∈−→E 1 d−(v) = 1. The last equality holds because the summation is over all the edges entering v (which is non-empty), and thus there are d−(v) number of items in the summation. Similarly, Xw:(v,w)∈−→E pv,w = Xw:(v,w)∈−→E 1 d+(v) = 1. Therefore, if the graph distribution is a stationary distribution of the Markov chain. −→ G has the property that for all (u, v) ∈ −→ E , d+(u) = d−(v), then the uniform Now, let us prove the other direction, that is, let us assume that the uniform distribution is a stationary distribution of the Markov chain. We prove this direction by contradiction. The central idea of the proof is the notion of "degree-alternating" path (see Definition 7 ). Now, if there is an edge (u, v) such that d+(u) 6= d−(v), then we show that there is a degree-alternating path with infinitely many unbalanced edges (see Definition 8). Further, by Lemma 9, if there is a degree- alternating path with infinitely many unbalanced edges, then there is a vertex having negative in- degree or out-degree, which is not possible, and we get a contradiction. We start the proof with a couple of easy observations. Observation 6. If the uniform distribution is a stationary distribution of the Markov chain then: 1. Every connected component in the underlying graph is strongly connected. 2. For a vertex v, there exists an edge (u, v) such that d+(u) < d−(v) if and only if there exists an edge (w, v) such that d+(w) > d−(v). Using the above observations, we prove our theorem by contradiction. Definition 7. A path {vi}t satisfied: i=0 is called a "degree-alternating" path if the following conditions are • For all i ≥ 0, (vi+1, vi) ∈ −→ E , • For all i ≥ 0, d+(v2i+1) = minnd+(w) : (w, v2i) ∈ • For all i > 0, d+(v2i) = maxnd+(w) : (w, v2i−1) ∈ −→ Eo, Eo. −→ Note that the above degree-alternating path can have repeated vertices (or edges). Definition 8. We call an edge (u, v) "unbalanced" if d+(u) 6= d−(v). Also, we call a vertex w "unbalanced" if there is an edge (w′, w) such that d+(w′) 6= d−(w). Now, we will show that if a strongly connected graph has one "unbalanced" edge, then there must be a "degree-alternating" path with infinitely many unbalanced edges. And this along with the Lemma 9 will give a contradiction. 4 If the graph does not have any degree-alternating path with infinitely many unbalanced edges, then there must be a degree-alternating path ending at an unbalanced edge (u, v) such that the path cannot be extended to a longer path with more unbalanced edges. We show that this is not possible by showing that we can extend a given degree-alternating path to a longer degree-alternating path, with at least one more unbalanced edge. Note that if u is an unbalanced vertex, then by Observation 6, we can extend the degree- alternating path ending at (u, v) by one more unbalanced edge (v, w) such that d−(v) 6= d+(w). Similarly, if there is a path from an unbalanced vertex to u, then we can extend the degree-alternating path with an edge (u, w′) such that d−(u) 6= d+(w′). Further by Observation 6, since underlying graph is strongly connected, there is a path from v to u, then using above arguments we can surely extend the degree-alternating path. As a consequence, we get a degree-alternating path with in- finitely many unbalanced edges. Now if we apply to Lemma 9 on the degree-alternating path with infinitely many unbalanced edges, and from the fact that the in-degree or out-degree of a vertex cannot be negative, we get a contradiction. This completes the proof of the theorem. Lemma 9. Let {vi}t quence {si}t i=0 of positive integers as following: i=0 be a "degree-alternating" path. Suppose we define we define a new se- • For all k ≥ 0, s2k=d−(v2k), and for all k ≥ 0, s2k+1=d+(v2k+1). Then this sequence of positive integers is a non-increasing sequence. Moreover, if vi and vi+1 are two consecutive vertices in the sequence such that d−(vi+1) 6= d+(vi), then si+1 < si. PROOF. Since we have assumed that the uniform distribution is a stationary distribution of the Markov chain, then for all vertices v, 1 d+(u) Xu:(u,v)∈−→E = 1 = Xw:(v,w)∈−→E 1 d+(v) . Let us first prove that in the sequence {si}t Since d+(v2i+1) = minnd+(w) : (w, v2i) ∈ 1 = X(u,v2i)∈−→E Eo, 1 d+(u) i=0, s2i ≥ s2i+1. −→ ≤ d−(v2i) d+(v2i+1) , (1) and hence, we have d−(v2i) ≥ d+(v2i+1) which by definition gives s2i ≥ s2i+1. Now, let us also prove that in the sequence {si}t i=0, s2i−1 ≥ s2i. By definition, this is the same −→ G is a degree-∆ graph, Similar to previous case, since as proving d+(v2i−1) ≥ d−(v2i). Since we have assumed that the graph proving that s2i−1 ≥ s2i is same as proving d−(v2i−1) ≤ d+(v2i). d+(v2i) = maxnd+(w) : (w, v2i−1) ∈ d−(v2i−1) 1 = X(u,v2i−1)∈−→E d+(v2i) d+(u) −→ Eo and 1 ≥ . 5 (2) Thus, we have s2i−1 ≥ s2i. Note that the inequalities in Equations 1 and 2 are strict inequalities if d+(v2i+1) 6= d−(v2i) and d+(v2i−1) 6= d−(v2i) respectively. Thus, if for any i, d+(vi+1) 6= d−(vi), then si+1 < si. This completes the proof of the lemma. From Theorem 5, we can also obtain the following corollary. −→ G = (V, Corollary 10. Let tribution on the vertices of following conditions apply: −→ E ) be a connected degree-∆ oriented graph. Then, the uniform dis- −→ G is a stationary distribution of the Markov chain, if and only if the −→ 1. If the underlying undirected graph G = (V, E) is non-bipartite, then the graph G is Eulerian. 2. If G is bipartite with bipartition V1 ∪ V2 = V , then V1 = V2 and the in-degree of all vertices in one part will be same, and it will be equal to out-degree of all vertices in the other part. PROOF. From Theorem 5, it follows that the uniform distribution on the vertices of distribution of the Markov chain if and only if for all (u, v) ∈ −→ E , we have −→ G is a stationary d+(u) = d−(v). (3) Suppose G has a path of length 2 between vertices u and w through v (that is (u, v) and (v, w) are edges in G). Then it is easy to verify that in all four possible cases (depending on the orientation of the edges (u, v) and (v, w)), we have d+(u) = d+(w) (by Equation 3). Similarly, it is also easy to see that if there a path of even length between u and w in G (a path from u to w using even number of edges), then we have d+(u) = d+(w). From this we can prove both parts of the corollary. Let v be a vertex of any odd cycle in G, and (u, v) be an edge belong to that cycle, then d+(v) = d+(u) = d−(v) (the last equality follows from Equation 3). And now note that, if there exist a vertex having in-degree equal to out-degree and Equation 3 holds, then all the vertices in the strongly-connected component have in-degree equal to out-degree. Further, since G is connected, −→ −→ G must be Eulerian. Also note that if G is Eulerian, then the uniform distribution is a stationary distribution. For the case of bipartite graphs, if V1 and V2 is the bi-partition, then any two vertices in V1 are connected by an even length path, and hence all the vertices in V1 has the same out-degree, and since all the vertices have the same total degree so all the vertices in V1 must have same in-degree also. Similarly, all the vertices in V2 have the same out-degree and the same in-degree. And if there is a directed edge from a vertex in V1 to vertex in V2 (or vice versa), then from Equation 3, we have the out-degree of vertices in V1 equals the in-degree of the vertices in V2. Theorem 5 and Corollary 10 have an application to property testing. We present this application in the next section. 4. Application to Property Testing A property of a graph that is invariant under graph isomorphism is called a graph property. Test- ing of graph properties has been a very active topic in the area of property testing (see [3], [6]), 6 and have been studied under various query models, for example: dense-graph models, sparse-graph −→ models, orientation model etc. Note that, whether the uniform distribution on the vertices of G is a stationary distribution of the Markov chain, is a graph property. Thus, the problem of distinguish- ing between whether the stationary distribution of the Markov chain is the uniform distribution, or is "far" from it, is a question of testing graph properties. Here, this question has been framed in the orientation model (defined in the next subsection). Some interesting graph properties like con- nectivity [1] and Eulerianity [4] have been studied in this model. Using Theorem 1, we show that for both bipartite and non-bipartite graphs, testing (in the orientation model) whether the uniform −→ G is the stationary distribution of the Markov chain (generated by a lazy distribution on vertices of −→ random walk on G), can be reduced to testing if the graph is Eulerian. Using algorithms from [4] of testing Eulerianity in the orientation model, we obtain various bounds on the query complexity for testing uniformity of the stationary distribution. In [4] it is shown that if G is an α-expander, then it is possible to test, in the orientation model, whether G is Eulerian by performing O(∆/α) queries. From our result, it implies that if G is an α-expander, then testing uniformity of the stationary distribution can be done with O(∆/α) queries. Since 1/α is also a measure of the mixing time of the random walk, it implies that the query complexity for testing uniformity of the stationary distribution is directly proportional to the mixing time of the Markov chain. 4.1. Property Testing in the Orientation Model −→ G = (V, Given an oriented graph −→ E ) and a property P, we want to test whether −→ G satisfies the property or it is "ǫ-far" from satisfying the property. In the orientation model, the underlying graph G = (V, E) is known in advance. Each edge in E is oriented (that is directed in exactly one direction), and the orientation of the edges has to be queried. The graph is said to be "ǫ-far" from satisfying the property P if one has to reorient at least an ǫ fraction of the edges to make the graph satisfy the property. Here, the goal is to design a randomized algorithm that queries the orientation of the edges, and does the following: • the algorithm ACCEPTS with probability at least 2/3, if −→ G satisfies the property P, • the algorithm REJECTS with probability at least 2/3, if −→ G is "ǫ-far" from satisfying the property P. The query complexity of the algorithm is defined by the number of edges it queries. The natural goal is to design a tester for P with minimum query complexity. If the graph satisfies the property and the tester accepts with probability 1, then the tester is called a 1-sided error tester. The standard tester (as defined above) is called a 2-sided error tester. The orientation model for testing graph properties was introduced by Halevy et al. [5]. Fischer et −→ al. studied the problem of testing whether an oriented graph G is Eulerian [4]. They derived various upper and lower bounds for both 1-sided and 2-sided error testers. Here, we use their algorithms for testing whether the uniform distribution is the stationary distribution of the Markov chain. 4.2. Testing whether the Uniform Distribution is a Stationary Distribution in the Orientation Model −→ E ), we say that the graph has the property P′ if −→ E , we have d+(u) = d−(v). Since the underlying undirected graph is known in Given a degree-∆ oriented graph for all (u, v) ∈ −→ G = (V, 7 −→ G is connected. −→ G is "ǫ-close" to satisfy the property P′, advance, we know its connected components. If the graph −→ then by "pigeonhole principle" there is at least one connected component of G that is also "ǫ-close" to satisfy the property P′. Thus, if all connected components are "ǫ-far" from satisfying the property −→ P′, then we can conclude that G is "ǫ-far" from satisfying the property P′ (contrapositive of the −→ G, and we reject if previous statement). Thus, we perform testing on every connected-component of all connected components are "ǫ-far" from satisfying the property P′. Now, w.l.o.g., we will assume that the graph −→ G is non-bipartite then we have to test whether −→ G is Eulerian. Since we can determine whether a graph is bipartite or not just by looking at the underlying undirected graph, if −→ G is non-bipartite then we use the Eulerianity testing algorithm from [4]. Now, let −→ G be bipartite. Let the bipartition be VL and VR. If VL 6= VR then the graph surely does not satisfies the property P′. From Corollary 10, if VL = VR then the graph must have the property that the out-degree of all vertices in VL must be equal to the in-degree of all vertices in VR and vice versa. Let v be a vertex in VL and d−(v) = k1 and d+(v) = k2. Now, consider −→ any bipartite directed graph E∗) with bipartition VL and VR that satisfies the following conditions: From Corollary 10, if −→ G∗ = (V, −→ G and −→ G∗ are exactly the same, • The underlying undirected graphs of −→G ∗ (u) = k1, and ∀v ∈ VR, d−−→G ∗(v) = k1, d+ • ∀u ∈ VL, d−−→G ∗ (u) = k2, d+ −→ −→ −→ G and G∪ = (V, E ∪ −→ E∗. Clearly, if Now consider the graph −→ if either e ∈ E , or e ∈ having property P′ is also true by the following lemma: −→ −→ E∗) obtained by superimposing E ∪ −→ −→ G has the property P′, then G∪ is Eulerian, and farness from −→G ∗ (v) = k2. −→ G∗ - an edge e ∈ Lemma 11. If −→ G is "ǫ-far" from having property P′, then −→ G∪ is " ǫ 2 -far" from being Eulerian. −→ H be an Eulerian graph which is the closest to −→ G∪. Since the underlying undirected PROOF. Let −→ −→ G∗ are exactly the same, there is a one-to-one correspondence between the edges G and graph for −→ −→ −→ E and in H . Suppose a flipped E∗. Now, look at edges of −→ edge (say e) belonging to E . Thus, we have effectively flipped the same number of edges. By performing these operations on the −→ E∗, we have obtained a new graph which has the same number of flipped edges as flipped edges of −→ G∪, and all the flipped edges in −→ E∗. Then, we can re-flip this edge e and flip the corresponding edge in −→ G∪ that were flipped in order to obtain −→ G∪ belongs to −→ E . 2 -far" from being Eulerian, then −→ G is not "ǫ-far" from having Thus, if the graph −→ G∪ is not " ǫ property P′, which is a contradiction. Now, all we have to test is whether the new graph 2 -far" from being Eulerian. −→ G∪ can be simulated by a single query to G. Thus, we can now use the Note that every query to Eulerian testing algorithm from [4]. The algorithm is summarized in Algorithm 1, and the various −→ G∪ is Eulerian or " ǫ 8 1-sided test 2-sided test Graphs with large ∆ ∆ + O( m ǫ2∆ ) Bounded-degree graphs ∗ α-expander Ω(cid:16)m 1 4(cid:17) αǫ (cid:19) min( O (cid:18) log( 1 ǫ ) O(cid:18) ∆ log( 1 ∆ + minn O(cid:16) m3 3 ǫ2∆ 2(cid:17)o ǫ6∆6(cid:17) , O(cid:16) m Ω(cid:16)q log m log log m(cid:17) αǫ (cid:19)3! , O(cid:18)(cid:18) √∆ log( 1 ǫ ) αǫ ǫ ) (cid:19)(cid:19)) ∗ Lower bound holds for 4-regular graph. ∆ is the maximum degree of the underlying undirected graph and m is the number of edges is the graph. Table 1: Bounds on the query complexity (in the orientation model) for testing uniformity of stationary distribution of the Markov chain obtained by the random walk on a directed graph. bounds on the query complexity that can be obtained is summarized in Table 1. Data: Degree-∆ Oriented Graph Result: Whether −→ G has the property P′ or is "ǫ-far" from having it. −→ G = (V, −→ E ) −→ G is Eulerian (see [4]) and give the corresponding output. Test if 1 if G is non-bipartite then 2 3 else 4 5 Let VL and VR be the bipartition for the graph G. Sample a vertex from VL and query all edges incident to it. Let d−(v) = k1 and d+(v) = k2. −→ Construct any bipartite graph G∗ = (V, (a) For all v ∈ VL, d−−→G ∗(v) = k2 and d+ d+ −→G ∗ (v) = k2. (b) The underlying graph of Superimpose Test if −→ G∪ is Eulerian (see [4]) and give the corresponding output. −→ G∗ is exactly same as G = (V, E). −→ E∗) with bipartition (VL, VR) such that −→G ∗ (v) = k1, and for all v ∈ VR, d−−→G ∗ (v) = k1 and −→ G∗ and the graph G (say −→ G∪ = (V, E ∪ −→ E∗)). 6 7 8 9 10 11 end Algorithm 1: Algorithm for testing property P′ 9 5. Conclusion and Open Problems We have shown that, for a given degree-∆ oriented graph −→ E ), whether the uniform −→ distribution on vertices of G is a stationary distribution of the Markov chain, depends on a local −→ property of graph. If G satisfies this local property, then it has some particular kind of structure (see Corollary 10). Finally, as an application of this result, we showed that testing this local property in orientation model, can be reduced to testing Eulerianity [4]. −→ G = (V, It is an interesting problem to test whether the stationary distribution of a Markov chain is equal to some fixed distribution D. In this paper, we have considered D to be uniform distribution, but the same problem is also interesting for other distributions. Moreover, finding a relationship between the distance of the stationary distribution from the uniform distribution, and the number of edges that needs to be reoriented, is an interesting open problem. Also, this result holds only for graphs where the in-degree plus out-degree of all the vertices are same. A major open problem of this work is to come up with a similar statement for more general graphs. References [1] Sourav Chakraborty, Eldar Fischer, Oded Lachish, Arie Matsliah, and Ilan Newman. Testing st -connectivity. In APPROX-RANDOM, pages 380 -- 394, 2007. [2] F.R.K. Chung. Spectral Graph Theory. Number no. 92 in CBMS Regional Conference Series. Conference Board of the Mathematical Sciences. [3] Eldar Fischer. The art of uninformed decisions: A primer to property testing. Current Trends in Theoretical Computer Science: The Challenge of the New Century, G. Paun, G. Rozenberg and A. Salomaa (editors), World Scientific Publishing, I:229 -- 264, 2004. [4] Eldar Fischer, Oded Lachish, Ilan Newman, Arie Matsliah, and Orly Yahalom. On the query complexity of testing orientations for being eulerian. In APPROX-RANDOM, pages 402 -- 415, 2008. [5] Shirley Halevy, Oded Lachish, Ilan Newman, and Dekel Tsur. Testing properties of constraint- graphs. In IEEE Conference on Computational Complexity, pages 264 -- 277, 2007. [6] Dana Ron. Property testing (foundations and trends in machine learning). Publishers: Now Publishers Inc. 10
1402.2437
4
1402
2016-12-29T16:18:51
On-line approach to off-line coloring problems on graphs with geometric representations
[ "cs.DS", "cs.CG", "cs.DM", "math.CO" ]
The main goal of this paper is to formalize and explore a connection between chromatic properties of graphs with geometric representations and competitive analysis of on-line algorithms, which became apparent after the recent construction of triangle-free geometric intersection graphs with arbitrarily large chromatic number due to Pawlik et al. We show that on-line graph coloring problems give rise to classes of game graphs with a natural geometric interpretation. We use this concept to estimate the chromatic number of graphs with geometric representations by finding, for appropriate simpler graphs, on-line coloring algorithms using few colors or proving that no such algorithms exist. We derive upper and lower bounds on the maximum chromatic number that rectangle overlap graphs, subtree overlap graphs, and interval filament graphs (all of which generalize interval overlap graphs) can have when their clique number is bounded. The bounds are absolute for interval filament graphs and asymptotic of the form $(\log\log n)^{f(\omega)}$ for rectangle and subtree overlap graphs, where $f(\omega)$ is a polynomial function of the clique number and $n$ is the number of vertices. In particular, we provide the first construction of geometric intersection graphs with bounded clique number and with chromatic number asymptotically greater than $\log\log n$. We also introduce a concept of $K_k$-free colorings and show that for some geometric representations, $K_3$-free chromatic number can be bounded in terms of clique number although the ordinary ($K_2$-free) chromatic number cannot. Such a result for segment intersection graphs would imply a well-known conjecture that $k$-quasi-planar geometric graphs have linearly many edges.
cs.DS
cs
ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS ON GRAPHS WITH GEOMETRIC REPRESENTATIONS TOMASZ KRAWCZYK AND BARTOSZ WALCZAK Abstract. The main goal of this paper is to formalize and explore a connection be- tween chromatic properties of graphs with geometric representations and competitive analysis of on-line algorithms, which became apparent after the recent construction of triangle-free geometric intersection graphs with arbitrarily large chromatic number due to Pawlik et al. We show that on-line graph coloring problems give rise to classes of game graphs with a natural geometric interpretation. We use this concept to esti- mate the chromatic number of graphs with geometric representations by finding, for appropriate simpler graphs, on-line coloring algorithms using few colors or proving that no such algorithms exist. We derive upper and lower bounds on the maximum chromatic number that rectangle overlap graphs, subtree overlap graphs, and interval filament graphs (all of which generalize interval overlap graphs) can have when their clique number is bounded. The bounds are absolute for interval filament graphs and asymptotic of the form (log log n)f(ω) for rectangle and subtree overlap graphs, where f(ω) is a polynomial function of the clique number and n is the number of vertices. In particular, we provide the first construction of geometric intersection graphs with bounded clique number and with chromatic number asymptotically greater than log log n. We also introduce a concept of Kk-free colorings and show that for some geometric representations, K3-free chromatic number can be bounded in terms of clique number although the ordinary (K2-free) chromatic number cannot. Such a result for segment intersection graphs would imply a well-known conjecture that k-quasi-planar geometric graphs have linearly many edges. 1. Introduction Graphs represented by geometric objects have been attracting researchers for many reasons, ranging from purely aesthetic to practical ones. A problem which has been extensively studied for this kind of graphs is proper coloring: given a family of objects, one wants to color them with few colors so that any two objects generating an edge of the graph obtain distinct colors. The off-line variant of the problem, in which the entire graph to be colored is known in advance, finds practical applications in areas like channel assignment, map labeling, and VLSI design. The on-line variant, in which the graph is being revealed piece by piece and the coloring agent must make irrevocable decisions without knowledge of the entire graph, is a common model for many scheduling problems. A natural connection between the two variants, which is discussed in this A journal version of this paper appeared in Combinatorica, in press. A preliminary version of this paper appeared as: Coloring relatives of interval overlap graphs via on-line games, in: Javier Esparza, Pierre Fraigniaud, Thore Husfeldt, and Elias Koutsoupias (eds.), 41st International Colloquium on Automata, Languages, and Programming (ICALP 2014), part I, vol. 8572 of Lecture Notes Comput. Sci., pp. 738 -- 750, Springer, Berlin, 2014. Tomasz Krawczyk and Bartosz Walczak were partially supported by National Science Center of Poland grant 2011/03/B/ST6/01367. Bartosz Walczak was partially supported by Swiss National Science Foundation grant 200020-144531. 1 2 TOMASZ KRAWCZYK AND BARTOSZ WALCZAK paper, allows us to establish new bounds on the chromatic number in various classes of graphs by analyzing the on-line problem in much simpler classes of graphs. We write χ, ω and n to denote the chromatic number, the clique number (maximum size of a clique), and the number of vertices of a graph under consideration, respectively. If χ = ω holds for a graph G and all its induced subgraphs, then G is perfect. A class of graphs G is χ-bounded or near-perfect if there is a function f : N → N such that every graph in G satisfies χ (cid:54) f(ω). All graphs that we consider are finite. Geometric intersection and overlap graphs. Any finite family of sets F gives rise to two graphs with vertex set F: the intersection graph, whose edges connect pairs of intersecting members of F, and the overlap graph, whose edges connect pairs of members of F that overlap, that is, intersect but are not nested. In this paper, we do not want to distinguish isomorphic graphs, and hence we call a graph G an intersection/overlap graph of F if there is a bijective mapping µ: V (G) → F such that uv ∈ E(G) if and only if µ(u) and µ(v) intersect/overlap. Depending on the context, we call the mapping µ or the family F an intersection/overlap model or representation of G. Ranging over all representations of a particular kind, for example, by sets with a specific geometric shape, we obtain various classes of intersection and overlap graphs. Prototypical examples are interval graphs and interval overlap graphs, which are intersection and overlap graphs, respectively, of closed intervals in R. Interval overlap graphs are the same as circle graphs -- intersection graphs of chords of a circle. Interval graphs are well known to be perfect. Interval overlap graphs are no longer perfect, but they are near-perfect: Gyárfás [17] proved that every interval overlap graph satisfies χ = O(ω24ω), which was improved to χ = O(ω22ω) by Kostochka [21], and further to χ = O(2ω) by Kostochka and Kratochvíl [23] (specifically, they proved χ (cid:54) 50· 2ω − 32ω − 64, which was later improved to χ (cid:54) 21· 2ω − 24ω − 24 by Černý [7]). Currently the best lower bound on the maximum chromatic number of an interval overlap graph with clique number ω is Ω(ω log ω), due to Kostochka [21]. The exponential gap between the best known upper and lower bounds remains open for over 30 years. For triangle-free interval overlap graphs, the bound is χ (cid:54) 5 [21], and it is tight [3]. An overlap model is clean if it has no three sets such that two overlapping ones both contain the third one. An overlap graph is clean if it has a clean overlap model. Clean overlap graphs are often much easier to color than general (non-clean) ones. For example, Kostochka and Milans [24] proved that clean interval overlap graphs satisfy χ (cid:54) 2ω − 1. In this paper, several upper bounds on the chromatic number are proved first for clean overlap graphs and then (with weaker bounds) for general overlap graphs. Intervals in R are naturally generalized by axis-parallel rectangles in R2 and by with no induced cycles of length greater than 3, see [14], subtrees of a tree, which give rise to the following classes of graphs: • chordal graphs -- intersection graphs of subtrees of a tree, originally defined as graphs • subtree overlap graphs -- overlap graphs of subtrees of a tree, introduced in [15], • rectangle graphs -- intersection graphs of axis-parallel rectangles in the plane, • rectangle overlap graphs -- overlap graphs of axis-parallel rectangles in the plane. Chordal graphs are perfect. Rectangle graphs are near-perfect: Asplund and Grün- baum [4] proved that every rectangle graph satisfies χ = O(ω2) (specifically, they proved χ (cid:54) 4ω2 − 3ω, which was later improved to χ (cid:54) 3ω2 − 2ω − 1 by Hendler [19]). ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 3 Kostochka [22] claimed existence of rectangle graphs with chromatic number 3ω, and no better construction is known. Rectangle overlap graphs are no longer near-perfect: Pawlik et al. [29] presented a con- struction of triangle-free rectangle overlap graphs with chromatic number Θ(log log n). This construction works also for a variety of other geometric intersection graphs [29, 30] and is used in all known counterexamples to a conjecture of Scott on graphs with an excluded induced subdivision [8]. Actually, it produces graphs that we call interval overlap game graphs, which form a subclass of rectangle overlap graphs, segment inter- section graphs, and subtree overlap graphs. This implies that subtree overlap graphs are not near-perfect either. Interval overlap game graphs play an important role in this paper, but their definition requires some preparation, so it is postponed until Section 6. It is proved in [25] that triangle-free rectangle overlap graphs have chromatic number O(log log n), which matches the above-mentioned lower bound. It is worth noting that intersection graphs of axis-parallel boxes in R3 are not near-perfect either: Burling [6] constructed such graphs with no triangles and with chromatic number Θ(log log n). We reprove Burling's result in Section 3. Interval filament graphs are intersection graphs of interval filaments, which are continuous non-negative functions defined on closed intervals with value zero on the endpoints. Interval filament graphs were introduced in [15] as a generalization of interval overlap graphs, polygon-circle graphs, chordal graphs and co-comparability graphs. Every interval filament graph is a subtree overlap graph [9], and the overlap graph of any collection of subtrees of a tree T intersecting a common path in T is an interval filament graph [9]. We comment more on this in Section 6. An interval filament graph is domain-non-overlapping if it has an intersection representation by interval filaments whose domains are pairwise non-overlapping intervals. Outerstring graphs are intersection graphs of curves in a halfplane with one endpoint on the boundary of the halfplane. Every interval filament graph is an outerstring graph. String graphs are intersection graphs of arbitrary curves in the plane. Every graph of any class considered above is a string graph. For example, a rectangle overlap graph can be represented as an intersection graph of boundaries of rectangles, and a subtree overlap graph defined by subtrees of a tree T can be represented as the intersection graph of closed curves encompassing these subtrees in a planar drawing of T. The best known upper bound on the chromatic number of string graphs is (log n)O(log ω), due to Fox and Pach [13]. The following diagram illustrates the inclusions between most of the classes defined above: string graphs rectangle overlap graphs subtree overlap graphs outerstring graphs interval overlap game graphs interval filament graphs interval overlap graphs = circle graphs Results. Here is the summary of the results of this paper. In what follows, we write Oω and Θω to denote asymptotics with ω fixed as a constant. 4 TOMASZ KRAWCZYK AND BARTOSZ WALCZAK Theorem 1.1. (1) Every interval filament graph satisfies χ (cid:54) g(ω)(cid:0)ω+1 (cid:1). (2) Every domain-non-overlapping interval filament graph satisfies χ (cid:54)(cid:0)ω+1 (3) There are domain-non-overlapping interval filament graphs with χ =(cid:0)ω+1 (cid:1). bound on the chromatic number of interval overlap graphs with clique number ω. (cid:1), where g(ω) denotes the upper 2 2 2 Theorem 1.2. (1) Every subtree overlap graph satisfies χ = Oω((log log n)(ω (2) Every clean subtree overlap graph satisfies χ = Oω((log log n)ω−1). (3) There are clean subtree overlap graphs with χ = Θω((log log n)ω−1). Consequently, 2)). there are string graphs with χ = Θω((log log n)ω−1). Theorem 1.3. (1) Every rectangle overlap graph satisfies χ = Oω((log log n)ω−1). (2) Every clean rectangle overlap graph satisfies χ = Oω(log log n). The aforementioned result of Pawlik et al. [29] complements Theorem 1.3 in line with Theorems 1.1 and 1.2, showing that its statement (2) is asymptotically tight: (3) ([29]) There are clean rectangle overlap graphs with ω = 2 and χ = Θ(log log n). The special case of Theorem 1.3 (1) -- (2) for ω = 2 was proved in [25]. The Pawlik et al. result (3) above implies Theorem 1.2 (3) for ω = 2, which we comment on in Section 6. Theorem 1.2 (3) provides the first construction of string graphs with bounded clique number and with chromatic number asymptotically greater than log log n. Theorem 1.1 (1) asserts in particular that the class of interval filament graphs is χ-bounded. This is also implied by a recent result of Rok and Walczak [32] that the class of outerstring graphs is χ-bounded, which is proved using different techniques leading to an enormous bound on the chromatic number. Here, by contrast, the bound is pretty good. For instance, it follows that triangle-free interval filament graphs have chromatic number at most 15. The fact that the class of interval filament graphs is χ-bounded implies that it is a proper subclass of the class of subtree overlap graphs, as the latter is not χ-bounded. However, we are not aware of any reasonably small graph witnessing proper inclusion between these two classes. The example resulting from the bounds on the chromatic number (for ω = 2) has more than 2214 vertices. A Kk-free coloring of a graph G is a coloring of the vertices of G such that every color class induces a Kk-free subgraph of G. A K2-free coloring is just a proper coloring. The Kk-free chromatic number, denoted by χk, is the minimum number of colors sufficient for a Kk-free coloring of the graph. Our interest in Kk-free colorings comes from an attempt to prove the so-called quasi-planar graph conjecture, which is discussed at the end of this section. The proof of Theorem 1.3 (2) gives the following as a by-product. Theorem 1.4. Every clean rectangle overlap graph satisfies χ3 = Oω(1). On the other hand, Theorem 1.2 (2) -- (3) implies that for every k (cid:62) 2, there are clean subtree overlap graphs (and thus string graphs) with ω = k and χk = Θk(log log n). To see this, consider any Kk-free coloring of a clean subtree overlap graph with ω = k and χ = Θk((log log n)k−1) guaranteed by Theorem 1.2 (3). Every color class induces a clean subtree overlap graph with ω (cid:54) k − 1 and therefore, by Theorem 1.2 (2), with χ = Ok((log log n)k−2). Hence, there must be at least Θk(log log n) color classes. The proofs of the upper bounds in Theorems 1.1 -- 1.4 are constructive -- they can be used to design polynomial-time coloring algorithms that use the claimed number of ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 5 colors. These algorithms require that the input graph is provided together with its geometric representation. Constructing a representation is at least as hard as deciding whether a representation exists (the recognition problem), which is NP-complete for interval filament graphs [31], and whose complexity is unknown for subtree overlap graphs and rectangle overlap graphs. Methods. All our proofs heavily depend on a correspondence between on-line graph coloring problems and off-line colorings of so-called game graphs, which originates from considerations in [25, 29] and which we formalize in the next section. It allows us to reduce problems of estimating the maximum possible chromatic number in classes of geometric intersection graphs to designing coloring algorithms or adversary strategies for the on-line coloring problem in much simpler classes of graphs. For classes of geometric intersection graphs with bounded clique number and unbounded chromatic number, this is the only approach known to give upper bounds on the chromatic number better than single logarithmic (with respect to n). In Section 3, we illustrate the concept of game graphs on two short examples. First, we construct rectangle graphs with chromatic number 3ω − 2, which is only less by 2 than Kostochka's claimed but unpublished lower bound of 3ω. Second, we reproduce Burling's construction of triangle-free intersection graphs of axis-parallel boxes in R3 with χ = Θ(log log n). Later sections contain the proofs of Theorems 1.1 -- 1.4. The proof of Theorem 1.1 relies on a result of Felsner [11], which determines precisely the competitiveness of the on-line coloring problem on incomparability graphs of up- growing partial orders. The proofs of Theorems 1.2 and 1.3 rely on the coloring algorithm and the adversary strategy for the on-line coloring problem on forests. A well-known adversary strategy due to Bean [5], later rediscovered by Gyárfás and Lehel [18], forces any on-line coloring algorithm to use at least c colors on a forest with at most 2c−1 vertices. This is tightly matched by the algorithm called First-fit, discussed in Section 7, which colors every n-vertex forest on-line using at most blog2 nc + 1 colors. A reduction to on-line coloring of forests is a final step in the proofs of Theorem 1.2 (2) and Theorem 1.3 (2). Bean's adversary strategy underlies the results of [29, 30], in particular, Theorem 1.3 (3), whereas a generalization of Bean's strategy, which is presented in Section 8, underlies Theorem 1.2 (3). An important ingredient in the proofs of Theorem 1.2 (1) and Theorem 1.3 (1) is a generalized breadth-first search procedure, which we call k-clique breadth-first search and which may be of independent interest. It allows us to reduce the respective coloring problem to clean overlap graphs in a similar way as the ordinary breadth-first search does when ω = 2 [17, 25]. This is discussed in detail in Section 5. Problems. The following problem, posed in [30], remains open: estimate (asymptoti- cally with respect to n) the maximum possible chromatic number for triangle-free seg- ment intersection graphs or, more generally, segment intersection graphs with bounded clique number. We believe the answer is Oω((log log n)c) for some constant c (cid:62) 1. For the analogous problem for string graphs, we believe the answer is Oω((log log n)f(ω)) for some function f : N → N with f(ω) (cid:62) ω − 1. The first step of the proof of Theorem 1.3 (2) is a reduction from clean rectangle overlap graphs to interval overlap game graphs (see Lemma 6.1). The main challenge in applying the on-line approach to the problems above lies in devising an analogous reduction from segment or string graphs to game graphs of an appropriate on-line graph coloring problem. 6 TOMASZ KRAWCZYK AND BARTOSZ WALCZAK An exciting open problem related to geometric intersection graphs concerns the number of edges in k-quasi-planar graphs. A graph drawn in the plane is k-quasi- planar if no k edges cross each other in the drawing. Pach, Shahrokhi and Szegedy [28] conjectured that k-quasi-planar graphs have Ok(n) edges. For k = 2, this asserts the well-known fact that planar graphs have O(n) edges. The conjecture is also proved for k = 3 [2, 27] and k = 4 [1], but it remains open for k (cid:62) 5. The best known upper bounds on the number of edges in a k-quasi-planar graph with k (cid:62) 5 are n(log n)O(log k) in general [12, 13] and Ok(n log n) if the edges are drawn as straight-line segments [35] or 1-intersecting curves [34]. If we can prove that the intersection graph of the edges of a k-quasi-planar graph G satisfies χ3 = Ok(1) (or χ4 = Ok(1)), then it will follow that G has Ok(n) edges, as each color class in a K3-free (K4-free) coloring of the edges of G is itself a 3-quasi-planar (4-quasi-planar) graph and therefore has O(n) edges. The construction of triangle-free segment intersection graphs with arbitrarily large chromatic number [30] implies that such an approach cannot succeed when we ask for a proper coloring of the edges instead of a K3-free (K4-free) coloring. In view of the remark after Theorem 1.4, neither can it succeed for Kk-free colorings when the edges of G are allowed to cross arbitrarily many times. Nevertheless, Theorem 1.4 suggests a substantial difference between proper and triangle-free colorings of geometric intersection graphs, which makes this approach appealing for k-quasi-planar graphs whose edges are drawn as straight-line segments or, more generally, 1-intersecting curves. Finally, an interesting challenge is to close the asymptotic gap between the up- per bounds of Oω((log log n)(ω 2)) and Oω((log log n)ω−1) and the lower bounds of Ωω((log log n)ω−1) and Ω(log log n), respectively, on the maximum chromatic number of subtree and rectangle overlap graphs. We believe that the lower bounds are cor- rect. A problem of similar flavor is to prove the analogue of Theorem 1.4 for rectangle overlap graphs that are not clean. 2. On-line graph coloring games and game graphs The on-line graph coloring game is played by two deterministic players: Presenter and Algorithm. It is played in rounds. In each round, Presenter adds a new vertex to the graph and declares whether or not it has an edge to each of the vertices presented before. As a response, in the same round, Algorithm colors this vertex keeping the property that the coloring is proper. Imposing additional restrictions on Presenter's moves gives rise to many possible variants of the on-line graph coloring game. Typical kinds of such restrictions look as follows: (i) The graph G being built by Presenter keeps belonging to a specific class of graphs G. It is reasonable to require that the class G is hereditary (closed under taking induced subgraphs). (ii) In addition to G, Presenter builds a mapping µ: V (G) → C called a representation of G in some class of objects C, and the edges of G are defined in terms of µ. (iii) In addition to G, Presenter builds relations R1, . . . , Rr on V (G), and the edges of (iv) There can be some further restrictions relating µ, R1, . . . , Rr, and the order in G are defined in terms of R1, . . . , Rr. which the vertices are presented. The final graph to be built by Presenter is not fixed in advance and can depend on the decisions taken by Algorithm when coloring vertices. However, the decisions of both players are irrevocable: Presenter cannot change the part of the graph, the ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 7 representation, or the relations after they have been presented, and Algorithm cannot change the colors after they have been assigned. The goal of Algorithm is to keep using as few colors as possible, while Presenter wants to force Algorithm to use as many colors as possible. The value of such a game is the minimum number c such that Algorithm has a strategy to color any graph that can be presented in the game using at most c colors or, equivalently, the maximum number c such that Presenter has a strategy to force Algorithm to use at least c colors regardless of how Algorithm responds. We call any variant of the on-line graph coloring game simply an on-line game, and any coloring strategy of Algorithm simply an on-line algorithm. We let ≺ denote the order in which the vertices are presented. It is envisioned as going from left to right. Now, we explain the crucial concept of our paper -- game graphs. Let G be an on-line game with representation µ in a class C and with relations R1, . . . , Rr. If a graph G, a particular representation µ: V (G) → C, and particular relations R1, . . . , Rr on V (G) are allowed to be presented in n rounds of the game G in such a way that the vertices are presented in a particular order ≺ on V (G), then we call the tuple G, µ, R1, . . . , Rr,≺ an n-round presentation scenario in G. We define the class of game graphs associated with G as follows. A graph G is a game graph of the on-line game G if there exist a rooted forest F on V (G), a mapping µ: V (G) → C, and relations R1, . . . , Rr on V (G) such that (a) for every v ∈ V (G), the subgraph G[V (Pv)] of G induced on the vertices of the path Pv in F from a root to v, the representation µ restricted to V (Pv), the relations R1, . . . , Rr restricted to V (Pv), and the order ≺ of vertices along Pv form a valid V (Pv)-round presentation scenario in G, (b) if uv ∈ E(G), then u is an ancestor of v or v is an ancestor of u in F. For any two distinct vertices u and v of a game graph, we let u ≺ v denote that u is an ancestor of v in F. Therefore, the order of presentation ≺ in the on-line game and the relation ≺ in the game graph correspond to each other in the same way as the relations R1, . . . , Rr do in the on-line game and in the game graph. A game graph can be envisioned as a union of several presentation scenarios in which some (but not necessarily all) common prefixes of these scenarios have been identified. All the games that we will consider are closed under taking induced subgraphs, in the sense that any induced subgraph of any presentation scenario (where the representation, the relations, and the order ≺ are restricted to the vertices of the subgraph) is again a valid presentation scenario. It easily follows from the definition that the game graphs of such games are also closed under taking induced subgraphs. It follows from (b) that ω(G) = max{ω(G[V (Pv)]): v ∈ V (G)}. In particular, if one of the restrictions on the game G requires that the presented graph has clique number at most k, then all game graphs of G also have clique number at most k. Lemma 2.1. If there is an on-line algorithm using at most c colors in an on-line game G, then every game graph of G has chromatic number at most c. Proof. Intuitively, to color a game graph properly, it is enough to run the on-line algorithm separately on the subgraph induced on each path in F from a root to a leaf. More formally, let G be a game graph of G with underlying forest F, representation µ, and relations R1, . . . , Rr. For every u ∈ V (G), the condition (a) of the definition of a game graph gives us a presentation scenario of the graph G[V (Pu)]. Color the vertex u in G with the color assigned to u by Algorithm in this scenario. For every descendant v of u in F, the presentation scenario of G[V (Pu)] is the initial part of the 8 TOMASZ KRAWCZYK AND BARTOSZ WALCZAK presentation scenario of G[V (Pv)] up to the point when u is presented, so Algorithm assigns the same color to u in both scenarios. Therefore, since Algorithm colors every (cid:3) G[V (Pv)] properly, the coloring of G defined this way is also proper. We say that a strategy of Presenter in an on-line game G is finite if the total number of presentation scenarios that can occur in the game when Presenter plays according to this strategy, for all possible responses of Algorithm, is finite. Lemma 2.2. If Presenter has a finite strategy to force Algorithm to use at least c colors in an on-line game G, then there exists a game graph of G with chromatic number at least c. Moreover, the number of vertices of this graph is equal to the total number of presentation scenarios that can occur with this strategy. Proof. Consider a finite strategy of Presenter forcing Algorithm to use at least k colors in G. Let S be the set of presentation scenarios that can occur when Presenter plays according to this strategy. Hence, S is finite. Define a forest F on S so that • if s ∈ S is a scenario that presents only one vertex, then s is a root of F, • otherwise, the parent of s in F is the scenario with one vertex less, describing the situation in the game before the last vertex is presented in the scenario s. For a scenario s ∈ S, let v(s) denote the last vertex presented in the scenario s. We define a graph G on S so that s1s2 is an edge of G if s1 is an ancestor of s2 and v(s1)v(s2) is an edge in the graph presented in the scenario s2 or vice versa. We define relations R1, . . . , Rr on S in the same way: s1 Ri s2 if s1 is an ancestor of s2 and v(s1) Ri v(s2) in the scenario s2 or vice versa. Finally, for s ∈ S, we define µ(s) = µ(v(s)) in the scenario s. It clearly follows that the graph G thus obtained is a game graph of G with underlying forest F, representation µ, and relations R1, . . . , Rr. It remains to prove that χ(G) (cid:62) c. Suppose to the contrary that there is a proper coloring of G using c − 1 colors. Consider the following strategy of Algorithm against Presenter's considered strategy in G. When a new vertex is presented, Algorithm looks at the presentation scenario s of the structure presented so far. Since Presenter is assumed to play according to the strategy that gives rise to the game graph G, the scenario s is a vertex of G. Algorithm colors the new vertex v(s) in the game with the color of s in the assumed coloring of G using c − 1 colors. This way, Algorithm uses only c − 1 colors against Presenter's considered strategy, which contradicts the (cid:3) assumption that this strategy forces Algorithm to use at least c colors. Here is how Lemmas 2.1 and 2.2 are typically applied. To provide an upper bound on the chromatic number of graphs of some class G, we show that each graph in G is a game graph of an appropriately chosen on-line game, and we find an on-line algorithm for this game using few colors. To construct graphs of some class G with large chromatic number, we show that every game graph of an appropriately chosen on-line game belongs to G, and we find a finite strategy of Presenter in this game forcing Algorithm to use many colors. We use this approach to prove the results of the paper. First, we reduce Theorems 1.1 -- 1.4 to claims about game graphs of appropriately chosen on-line games. Then, to prove these claims, we devise strategies for Algorithm or Presenter in these games and apply Lemmas 2.1 and 2.2 accordingly. 3. Two simple examples To illustrate the concept developed in the previous section, we prove the following. ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 9 ? B s3 A D s2 A A s1 s1 s2 s4 s5 A B C C s4 B E A D B A D s3 B E s5 µ(s1) = A µ(s2) = B µ(s3) = C µ(s4) = D µ(s5) = E Figure 1. A strategy of Presenter forcing 3 colors in the game INT(2). In the first two rounds, Presenter introduces two disjoint intervals A and B. If they receive different colors, then Presenter forces a third color in the next round by presenting C. If A and B receive the same color, then Presenter forces a third color in the next two rounds by presenting D and E. The five presentation scenarios s1, . . . , s5 that can occur form a game graph of INT(2), illustrated as an abstract graph (on the left) and with representation by the intervals A, B, C, D, E (on the right). Proposition 3.1. There are rectangle graphs with chromatic number 3ω − 2. Let I denote the set of all closed intervals in R. Consider an on-line game INT(k) on the class of interval graphs with clique number at most k presented with their interval representation. That is, Presenter builds an interval graph G and a representation µ: V (G) → I so that (i) µ is an intersection model of G, that is, uv ∈ E(G) if and only if µ(u) ∩ µ(v) 6= ∅, (ii) ω(G) (cid:54) k, and Algorithm properly colors G on-line. For this game, the definition of a game graph comes down to the following: a graph G is a game graph of INT(k) if there exist a rooted forest F on V (G) and a mapping µ: V (G) → I such that (a) for every v ∈ V (G) and for the path Pv in F from a root to v, the following holds: (i) µ restricted to V (Pv) is an intersection model of G[V (Pv)], (ii) ω(G[V (Pv)]) (cid:54) k, (b) if uv ∈ E(G), then u is an ancestor of v or v is an ancestor of u in F. Recall that the ancestor-descendant order of F is denoted by ≺. The above can be simplified to the following two conditions, which correspond to the two conditions in the definition of the game INT(k): (i) uv ∈ E(G) if and only if u ≺ v or v ≺ u and µ(u) ∩ µ(v) 6= ∅, (ii) ω(G) (cid:54) k. Now, we derive Proposition 3.1 from a known result on the game INT(k). 10 TOMASZ KRAWCZYK AND BARTOSZ WALCZAK µ(c) µ(a) µ(d) µ(b) µ(e) ya yb aa b xb xa yc xc c yd xd d ye e xe Figure 2. Representation of a game graph of INT(2) as an intersection graph of axis-parallel rectangles. Theorem 3.2 (Kierstead, Trotter [20]). The value of the game INT(k) is 3k − 2. In particular, Presenter has a finite strategy to force Algorithm to use at least 3k−2 colors in INT(k). Proof of Proposition 3.1. By Theorem 3.2 and Lemma 2.2, there are game graphs of INT(k) with chromatic number 3k − 2 (see Figure 1). It remains to show that every game graph of INT(k) has an intersection model by axis-parallel rectangles. Let G be a game graph of INT(k) with underlying forest F on V (G) and with representation µ: V (G) → I. For u ∈ V (G), let F(u) denote the set of vertices of the subtree of F rooted at u, inclusive. We run depth-first search on F and record, for each u ∈ V (G), the times xu, yu ∈ Z at which F(u) is entered and left, respectively, so that • xu < yu for every u ∈ V (G), • if v ∈ F(u) (cid:114) {u}, then xu < xv < yv < yu, • if v /∈ F(u) and u /∈ F(v), then [xu, yu] ∩ [xv, yv] = ∅. For every vertex u ∈ V (G), let Ru be the rectangle in R2 defined by Ru = µ(u)×[xu, yu] (see Figure 2). Consider any two vertices u, v ∈ V (G). If v ∈ F(u) or u ∈ F(v), then [xv, yv] ⊂ [xu, yu] or [xu, yu] ⊂ [xv, yv], respectively; hence, Ru and Rv intersect if and only if µ(u) and µ(v) intersect, that is, if and only if uv ∈ E(G). If v /∈ F(u) and u /∈ F(v), so that uv /∈ E(G), then [xu, yu] ∩ [xv, yv] = ∅, and thus Ru ∩ Rv = ∅. This shows that the mapping u 7→ Ru is an intersection model of G. (cid:3) In an analogous way, we can reprove the result of Burling [6] that there exist triangle- free intersection graphs of axis-parallel boxes in R3 with chromatic number Θ(log log n). To this end, we use the result of Erlebach and Fiala [10] that Presenter can force the use of arbitrarily many colors in the on-line coloring game on the class of triangle- free rectangle graphs presented with their representation by axis-parallel rectangles. ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 11 Their strategy (a geometric realization of the strategy for forests mentioned in the introduction) forces the use of c colors in 2c−1 rounds with 22O(c) presentation scenarios. Hence, Lemma 2.2 gives us a triangle-free game graph with chromatic number c and with 22O(c) vertices. The same argument as in the proof of Proposition 3.1, using an additional dimension to encode the branching structure of the game graph, shows that this graph is an intersection graph of axis-parallel boxes in R3. The graphs obtained this way are the same as the graphs constructed by Burling and isomorphic to the triangle- free rectangle overlap graphs with chromatic number Θ(log log n) constructed in [29]. 4. Interval filament graphs This section is devoted to the proof of Theorem 1.1. Let dom(f) denote the domain of an interval filament f, that is, the closed interval on which the function f is defined. We will assume, without loss of generality, that in any interval filament intersection model, the domains are in general position, that is, no two of their endpoints coincide. The following lemma allows us to reduce the general problem of coloring interval filament graphs to the problem for domain-non-overlapping interval filament graphs. Lemma 4.1. Let g : N → N be a non-decreasing function with the property that every interval overlap graph satisfies χ (cid:54) g(ω). Then the vertices of every interval filament graph can be partitioned into at most g(ω) classes so that the subgraph induced on each class is a domain-non-overlapping interval filament graph. Proof. Let G be a graph with an interval filament intersection model u 7→ fu. Let G0 be the graph with V (G0) = V (G) such that uv ∈ E(G0) if and only if dom(fu) and dom(fv) overlap. It follows that G0 is a subgraph of G and G0 is an interval overlap graph with overlap model u 7→ dom(fu). The definition of g implies that G0 can be properly colored using at most g(ω(G0)) colors, which is at most g(ω(G)) colors due to the monotonicity of g. The model u 7→ fu restricted to each color class consists of (cid:3) interval filaments with non-overlapping domains. The incomparability graph of a partial order < on a set P is the graph with vertex set P and edge set consisting of the pairs of <-incomparable elements of P. A graph G is a co-comparability graph if it is the incomparability graph of some partial order on V (G). Consider an on-line game COCO(k) on the class of co-comparability graphs with clique number at most k presented with their order relation in the up-growing manner. That is, Presenter builds a co-comparability graph G declaring, in each round, the order relation < between the vertices presented before and the new vertex so that (i) G is the incomparability graph of the order < on V (G), (ii) every vertex of G is maximal in the order < at the moment it is presented, (iii) ω(G) (cid:54) k, that is, the width of the order < is at most k, and Algorithm properly colors G on-line. Lemma 4.2. A graph G is a game graph of COCO(k) if and only if G is a domain- non-overlapping interval filament graph and ω(G) (cid:54) k. Proof. Let G be a graph with a domain-non-overlapping interval filament intersection model u 7→ fu and with ω(G) (cid:54) k. The inclusion order on the domains of the interval filaments fu defines a forest F on V (G) so that for each v ∈ V (G), • if there is no u ∈ V (G) such that dom(fu) ⊃ dom(fv), then v is a root of F, It follows that u is an ancestor of v in F if and only if dom(fu) ⊃ dom(fv). We define a relation < on V (G) so that u < v if and only if dom(fu) ⊃ dom(fv) and fu ∩ fv = ∅. Clearly, < is a partial order. Consider the path Pv in F from a root to a vertex v. The graph G[V (Pv)], the order < restricted to V (Pv), and the order ≺ of vertices along Pv form a valid V (Pv)-round presentation scenario in COCO(k). Indeed, the condition (i) of COCO(k) holds, because if u ≺ v, then dom(fu) ⊃ dom(fv), so u < v if and only if uv /∈ E(G); (ii) holds, because if u < v, then dom(fu) ⊃ dom(fv), so u ≺ v; and (iii) follows from the assumption that ω(G) (cid:54) k. Moreover, if uv ∈ E(G), then fu ∩ fv 6= ∅, which implies dom(fu) ⊂ dom(fv) or dom(fu) ⊃ dom(fv), by the assumption that the model u 7→ fu is domain-non-overlapping. Hence, if uv ∈ E(G), then u is an ancestor of v or v is an ancestor of u. This shows that G is indeed a game graph of COCO(k). For the converse implication, we use a result due to Golumbic, Rotem and Urrutia [16] and Lovász [26], which asserts that every partial order is isomorphic to the order < on some family of continuous functions [0, 1] → (0,∞), where f < g means that f(x) < g(x) for every x ∈ [0, 1]. Let G be a game graph of COCO(k) with underlying forest F and relation <. For u ∈ V (G), let F(u) denote the set of vertices of the subtree of F rooted at u, including u itself. As in the proof of Proposition 3.1, we use depth-first search to compute, for each u ∈ V (G), numbers xu, yu ∈ Z such that • xu < yu for every u ∈ V (G), • if v ∈ F(u) (cid:114) {u}, then xu < xv < yv < yu, • if v /∈ F(u) and u /∈ F(v), then [xu, yu] ∩ [xv, yv] = ∅. Let L denote the set of leaves of F, and let L(u) = L ∩ F(u) for u ∈ V (G). For v ∈ L, let Pv denote the path in F from a root to v. The graph G[V (Pv)] is the incomparability graph of the order < restricted to V (Pv). Hence, by the above- mentioned result of [16, 26], it has an intersection representation by continuous functions [xv, yv] → (0,∞). Specifically, every vertex u ∈ V (Pv) can be assigned a continuous function fu,v : [xv, yv] → (0,∞) so that u1 < u2 if and only if fu1,v > fu2,v for any u1, u2 ∈ V (Pv) (note that the order is reversed). Now, for every vertex u ∈ V (G), we define an interval filament fu as the union of the following curves: • the functions fu,v for all v ∈ L(u), 3 , 0) and (xv, fu,v(xv)) for the first leaf v ∈ L(u) • the segment connecting points (xu − 1 • the segments connecting points (yv1, fu,v1(yv1)) and (xv2, fu,v2(xv2)) for any two • the segment connecting points (yv, fu,v(yv)) and (yu + 1 3 , 0) for the last leaf v ∈ L(u) in the depth-first search order, leaves v1, v2 ∈ L(u) consecutive in the depth-first search order, in the depth-first search order. 12 • otherwise, the parent of v in F is the unique u ∈ V (G) such that dom(fu) ⊃ dom(fv) TOMASZ KRAWCZYK AND BARTOSZ WALCZAK and dom(fu) is minimal with this property. See Figure 3 for an illustration. It follows that dom(fu) = [xu − 1 3] for every u ∈ V (G), so the domains of the interval filaments fu do not overlap. It remains to prove that u 7→ fu is an intersection model of G. Fix u, v ∈ V (G). First, suppose v ∈ F(u) and u < v, so that uv /∈ E(G). By the definition of fu and fv, we have dom(fu) ⊃ dom(fv), and fu lies entirely above fv. Hence fu ∩ fv = ∅. Now, suppose v ∈ F(u) and u 6< v. We also have v 6< u, by the condition (ii) of the definition of COCO(k). Hence uv ∈ E(G). For any leaf w ∈ L(v), the functions fu,w and fv,w intersect, so fu∩ fv 6= ∅. The case that u ∈ F(v) is analogous. Finally, suppose 3 , yu + 1 ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 13 c ? a a b a b d a b c yd xe xd xc xb d c a c b e a b e ye yc yb xa ya Figure 3. Top: A strategy of Presenter forcing 3 colors in 4 rounds of the game COCO(2). If a, b, c receive distinct colors, then Presenter wins in 3 rounds. Otherwise, the color of c is the same as the color of a or b, and depending on Algorithm's choice, Presenter forces a 3rd color in the 4th round. Bottom: A domain-non-overlapping interval filament model of the game graph arising from the strategy on the top. u /∈ F(v) and v /∈ F(u), so that uv /∈ E(G). It follows that [xu, yu] ∩ [xv, yv] = ∅, so dom(fu) ∩ dom(fv) = ∅. Hence fu ∩ fv = ∅. This shows that u 7→ fu is indeed an (cid:3) intersection model of G. (cid:1). That is, there Theorem 4.3 (Felsner [11]). The value of the game COCO(k) is (cid:0)k+1 (cid:1) colors, and there is a finite strategy of is an on-line algorithm using at most (cid:0)k+1 (cid:1) colors in COCO(k). Presenter forcing Algorithm to use at least (cid:0)k+1 2 2 2 Theorem 1.1 (2) -- (3) follows from Theorem 4.3, Lemma 4.2, and Lemmas 2.1 and 2.2 (respectively). Theorem 1.1 (1) follows from Theorem 1.1 (2) and Lemma 4.1. 5. Reduction to clean overlap graphs Recall that an overlap graph is clean if it has an overlap model such that no two overlapping sets both contain a third set. The goal of this section is to establish the following reduction of the general problem of coloring overlap graphs to the problem for clean overlap graphs. Theorem 5.1. Let G be an overlap graph. If every clean induced subgraph H of G with ω(H) (cid:54) j satisfies χ(H) (cid:54) αj for 2 (cid:54) j (cid:54) ω(G), then χ(G) (cid:54) 2ω(G)−1α2 ··· αω(G). It is proved in [25] that every triangle-free overlap graph can be partitioned into two clean graphs: the union of odd levels and the union of even levels in the breadth-first search forest. This proves Theorem 5.1 for graphs with clique number 2. However, such a simple partition is insufficient for graphs with clique number greater than 2. We will need the following generalization of breadth-first search, which we call k-clique breadth-first search. 14 TOMASZ KRAWCZYK AND BARTOSZ WALCZAK v3 v6 v1 v2 v5 v8 v4 L2 L1 v1 v2 v7 L3 v3 v4 v9 v11 v10 v12 L4 L5 L6 L7 L8 v9 v10 v11 v12 v5 v6 v7 v8 Figure 4. An illustration of the 3-clique breadth-first search applied to the rectangle overlap graph above. The sets L1, L2, L6 and L8 are determined by the else statement of the main loop. k-clique breadth-first search input : a graph G with vertices ordered as v1, . . . , vn output: a partition of {v1, . . . , vn} into sets Ld with d (cid:62) 0 V := {v1, . . . , vn}; d := 0; while V 6= ∅ do if there is a k-clique K with K ∩ V = 1 then else Ld := {vj ∈ V : there is a k-clique K with K ∩ V = {vj}}; pick vi ∈ V with minimum index i; Ld := {vi}; V := V (cid:114) Ld; d := d + 1; See Figure 4 for an illustration of the algorithm. It is clear that it terminates after time polynomial in n (for fixed k). The 2-clique breadth-first search is just the ordinary breadth-first search: every connected component of G is the union of some consecutive sets Ld, . . . , Ld+t, of which Ld+i is the set of vertices at distance i from the vertex with minimum index in that connected component. The following two properties of the k-clique breadth-first search generalize those of the ordinary breadth-first search. ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 15 if vi ∈ Ld, vr ∈ Ld0, and µ(vr) ⊂ µ(vi), then d (cid:54) d0. Lemma 5.2. Let Ld be the sets computed by the k-clique breadth-first search on a graph G. Then every k-clique in G has two of its vertices in one set Ld or in two consecutive sets Ld and Ld+1. Proof. Let K be a k-clique in G. Let Ld be the set such that K ∩ V (cid:62) 2 before and K ∩ V (cid:54) 1 after the algorithm performs the assignment V := V (cid:114) Ld. It follows that K∩Ld 6= ∅. If K∩Ld (cid:62) 2, then Ld satisfies the conclusion of the lemma. If K∩Ld = 1, then K∩V = 1 after the assignment V := V (cid:114)Ld, so the vertex remaining in K∩V will be taken to Ld+1 in the next iteration of the algorithm, which yields K ∩ Ld+1 6= ∅. (cid:3) Lemma 5.3. Let G be an overlap graph with overlap model µ, with vertices v1, . . . , vn ordered so that µ(vi) 6⊂ µ(vj) for i < j, and with ω(G) (cid:54) k. Then every set Ld computed by the k-clique breadth-first search on G induces a clean overlap subgraph of G. Proof. First, we prove the following: (∗) Let vi ∈ Ld, let d0 be the minimum index such that Ld0 contains a vertex vr with µ(vr) ⊂ µ(vi), and suppose to the contrary that d0 < d. Consider the set V at the point when the algorithm computes Ld0. It follows that vi, vr ∈ V . If there was no k-clique K with K ∩ V = 1, then the algorithm would not set Ld0 to {vr}, because vi is a candidate with smaller index. Hence, there is a k-clique K with K ∩ V = 1, which implies that there is a k-clique K with K ∩ V = {vr}. For every vs ∈ K (cid:114) {vr}, we have s < r, and therefore µ(vs) and µ(vi) overlap: µ(vs) ⊂ µ(vi) would contradict the choice of d0, and µ(vs) ⊃ µ(vi) ⊃ µ(vr) would contradict the fact that vr, vs ∈ K. Hence, K0 = (K (cid:114) {vr}) ∪ {vi} is a k-clique with K0 ∩ V = {vi}, which yields vi ∈ Ld0. This contradiction completes the proof of (∗). Now, suppose that G[Ld] is not clean. This means that there are vi, vj, vr ∈ Ld such that µ(vi) overlaps µ(vj) and µ(vr) ⊂ µ(vi) ∩ µ(vj). Consider the set V at the point when the algorithm computes Ld. It follows that there is a k-clique K with K ∩ V = {vr}. By (∗), for every vs ∈ K (cid:114) {vr}, µ(vs) is not contained in either of µ(vi) and µ(vj) and thus overlaps both of them. Hence, (K (cid:114) {vr}) ∪ {vi, vj} is a (k + 1)-clique in G, which contradicts the assumption that ω(G) (cid:54) k. (cid:3) Proof of Theorem 5.1. Let µ be an overlap model of G, and let k = ω(G). The proof goes by induction on k. The theorem is trivial for k = 1, so assume that k (cid:62) 2 and the theorem holds for graphs with ω (cid:54) k − 1. Order the vertices of G as v1, . . . , vn so that µ(vi) 6⊂ µ(vj) for i < j, and run the k-clique breadth-first search to obtain a partition of {v1, . . . , vn} into sets Ld. By Lemma 5.3, every Ld induces a clean subgraph of G, so χ(G[Ld]) (cid:54) αk. Color each G[Ld] properly with the same set of αk colors, thus obtaining a partition of the vertices of G into color classes C1, . . . , Cαk. Each set of the form Ci ∩ Ld is an independent set in G. Let Lodd be the union of all sets Ld with d odd and Leven be the union of all sets Ld with d even. If there is a k-clique in G[Ci ∩ Lodd], then, by Lemma 5.2, it must contain an edge connecting vertices in one set Ld or two consecutive sets Ld and Ld+1. The former is impossible, as Ci ∩ Ld is independent, while the latter contradicts the definition of Lodd. Hence, ω(G[Ci ∩ Lodd]) (cid:54) k − 1. Similarly, ω(G[Ci ∩ Leven]) (cid:54) k − 1. It follows from the induction hypothesis that χ(G[Ci∩ Lodd]) (cid:54) 2k−2α2 ··· αk−1 and χ(G[Ci∩ Leven]) (cid:54) 2k−2α2 ··· αk−1. This implies χ(G) (cid:54) 2k−1α2 ··· αk, as the 2αk sets Ci ∩ Lodd and Ci ∩ Leven for 1 (cid:54) i (cid:54) αk form a (cid:3) partition of the entire set of vertices of G. 16 TOMASZ KRAWCZYK AND BARTOSZ WALCZAK The inductive nature of Theorem 5.1 is the main obstacle to generalizing the upper bounds of Theorem 1.2 (2) and Theorem 1.3 (2) from clean to non-clean overlap graphs (keeping the same asymptotic bounds). Furthermore, if we replace χ by χ3 in the proof of Theorem 5.1, then it does no longer work. This is why we are unable to provide the analogue of Theorem 1.4 for non-clean rectangle overlap graphs. We wonder whether a reduction similar to Theorem 5.1 but avoiding induction is possible. 6. Rectangle and subtree overlap graphs In this section, we define two on-line games and relate their game graphs to rectangle and subtree overlap graphs. These relations will be used for the proofs of Theorems 1.2 -- 1.4 in Sections 7 and 8. In view of Theorem 5.1, we can restrict our consideration to clean rectangle and subtree overlap graphs. First, we introduce the on-line game corresponding to clean rectangle overlap graphs, we define clean interval overlap game graphs, and we describe their relation to clean rectangle overlap graphs that has been established in [25, 29]. Recall that I denotes the set of closed intervals in R. Let '(x) and r(x) denote the left and the right endpoints of an interval x ∈ I, respectively. Consider an on-line game CIOV(k), in which Presenter builds a clean interval overlap graph G and its representation µ: V (G) → I so that (i) µ is an overlap model of G, that is, xy ∈ E(G) if and only if µ(x) overlaps µ(y), (ii) if x, y ∈ V (G) and x is presented before y, then '(µ(x)) < '(µ(y)), (iii) µ is clean, that is, there are no x, y, z ∈ V (G) such that µ(x) and µ(y) overlap and µ(z) ⊂ µ(x) ∩ µ(y), (iv) ω(G) (cid:54) k, and Algorithm properly colors G on-line. We will assume, without loss of generality, that in any representation µ presented in the game, the intervals are in general position, that is, no two of their endpoints coincide. As a consequence of the definition of a game graph, a graph G is a game graph of CIOV(k) if there exist a rooted forest F on V (G) and a mapping µ: V (G) → I such that the following conditions, corresponding to the four above, are satisfied (where ≺ denotes the ancestor-descendant relation of F): (i) xy ∈ E(G) if and only if x ≺ y or y ≺ x and µ(x) overlaps µ(y), (ii) if x, y ∈ V (G) and x ≺ y, then '(µ(x)) < '(µ(y)), (iii) there are no x, y, z ∈ V (G) with x ≺ y ≺ z such that µ(x) and µ(y) overlap and µ(z) ⊂ µ(x) ∩ µ(y), (iv) ω(G) (cid:54) k. A graph is a clean interval overlap game graph if it is a game graph of CIOV(k) for some k. The conditions (i) -- (iii) of the characterization above were used in [25] as the definition of clean interval overlap game graphs (called overlap game graphs therein). Lemma 6.1 (Krawczyk, Pawlik, Walczak [25]). Every clean interval overlap game graph is a clean rectangle overlap graph. The vertices of every clean rectangle overlap graph can be partitioned into Oω(1) classes so that the subgraph induced on each class is a clean interval overlap game graph. As it is explained in [25], the correspondence analogous to Lemma 6.1 holds between rectangle overlap graphs and interval overlap game graphs, which are defined like clean interval overlap game graphs above but omitting the cleanness condition (iii). It is proved in [25] that triangle-free clean interval overlap game graphs (and hence, by Lemma 6.1, triangle-free clean rectangle overlap graphs) satisfy χ = O(log log n). That ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 17 proof essentially comes down to an on-line algorithm using O(log r) colors in r rounds of the game CIOV(2), a trick with heavy-light decomposition that we explain later, and the application of Lemma 2.1. We will generalize this to game graphs of CIOV(k) and thus to clean rectangle overlap graphs with clique number bounded by any constant. On the other hand, it is proved in [29] that Presenter has a strategy to force Algorithm to use c colors in 2c−1 rounds of the game CIOV(2). This strategy (again a realization of the strategy for forests mentioned in the introduction) has 22O(c) presentation scenarios. Hence, by Lemma 2.2, there are triangle-free clean interval overlap game graphs (and thus triangle-free clean rectangle overlap graphs) with chromatic number Θ(log log n). We also define an on-line game CIOV3(k), a variant of CIOV(k) in which Algorithm is required to produce a triangle-free coloring instead of a proper coloring. The rules for Presenter's moves are the same in CIOV(k) and CIOV3(k), and therefore the classes of game graphs of CIOV(k) and CIOV3(k) are also the same. Now, we introduce the on-line game corresponding to clean subtree overlap graphs. Let G be a clean subtree overlap graph with a clean overlap model x 7→ Sx by subtrees of a tree T. To avoid confusion with vertices of G, we call vertices of T nodes. We make T a rooted tree by choosing an arbitrary node r as the root. We can assume without loss of generality that r belongs to none of the subtrees Sx, as a node with this property can always be added to T. For every x ∈ V (G), we define rx to be the unique node of Sx that is closest to r in T. We call the nodes rx subtree roots. If several subtrees Sx0, . . . , Sxm with Sxi 6⊃ Sxj for i < j (without loss of generality) have common subtree root p = rx0 = ··· = rxm, then the following transformation preserves overlaps and proper inclusions between the subtrees, thus keeping x 7→ Sx a clean overlap model of G: • replace the edge pq by a path pp1 ··· pmq, where q is the other end of the tree edge at p going towards r and p1, . . . , pm are new nodes, • add p1, . . . , pm to every subtree containing both p and q, • for 1 (cid:54) i (cid:54) m, add p1, . . . , pi to Sxi and let rxi = pi. Applying this transformation repeatedly if necessary, we can assume without loss of generality that all the subtree roots are pairwise distinct. We construct a rooted forest F on V (G) as follows. A vertex x ∈ V (G) is a root of F if the path from r to rx in T contains no subtree roots other than rx. Otherwise, the parent of x in F is the vertex y ∈ V (G) such that ry is the last subtree root before rx on the path from r to rx in T. Consider a path P in F from a root to a leaf. The overlap graph of the subtrees Sx with x ∈ V (P) is an interval filament graph [9]. Its interval filament intersection model can be constructed as follows. The roots of all the subtrees Sx with x ∈ V (P) lie on a common path Q = q1 ··· qm in T. For 1 (cid:54) i (cid:54) m, let Ti denote the connected component of T containing qi after removing all edges of Q. We represent the nodes of T by points in R2, as follows. Each node qi is represented by the point (i, 0). Each node t in Ti other than qi is represented by a point (xt, 1), where xt ∈ (i, i + 1) and all the xt are distinct. Now, we can represent each vertex x ∈ V (P) such that the intersection of Sx and Q is the subpath qi ··· qj of Q by an interval filament that starts in the interval (i−1, i), ends in the interval (j, j +1), and goes above the points representing the nodes in Sx and no other points representing nodes. Moreover, we can do this so that the interval filaments representing non-adjacent vertices (with nested or disjoint subtrees) do not intersect. This yields an interval filament intersection model of G[V (P)]. In view of the above, a natural attempt is to define the on-line game corresponding to clean subtree overlap graphs just like the game CIOV(k) but with representation by 18 TOMASZ KRAWCZYK AND BARTOSZ WALCZAK a b i j c e g d f h i j g h a b c d e f i j e f a b c d g h Figure 5. A subtree overlap graph (left) and interval filament repre- sentations of its subgraphs induced on the subtrees intersecting abcdef (top right) and abcdgh (bottom right). The domains of the interval fila- ments representing the subtrees cdeg and def overlap in the scenario abcdef but are nested in the scenario abcdgh. interval filaments instead of intervals. However, this is not correct for the following reason. We want to color the clean subtree overlap graph G properly using the on-line approach of Lemma 2.1. For each path P in F starting at a root, we will simulate an on-line algorithm on G[V (P)] presenting the vertices in their order along P. This way, we will present an interval filament graph. The on-line approach will work correctly if the algorithm always assigns the same color to each vertex x ∈ V (G), regardless of the choice of P. This will be the case when the presentation scenarios up to the point when u is presented are identical for all paths passing through x. However, this cannot be guaranteed using the model of G[V (P)] by interval filaments described above. For example, for some two adjacent vertices x, y ∈ V (G) lying on the common part of two paths P1 and P2, we may need to represent x and y by interval filaments whose domains are nested if we continue along P1 but overlap if we continue along P2. See Figure 5 for such an example. If the algorithm makes use of the representation, then the colorings it generates on P1 and P2 may be inconsistent. To overcome the difficulty explained above, we provide a more abstract description of G, which we then use to define the on-line game. For distinct vertices x, y ∈ V (G), let x ≺ y denote that x is an ancestor of y in F. We define relations ⊃◦, (cid:71) and k on V (G) as follows: • x ⊃◦ y if x ≺ y and the subtree Sx contains the subtree Sy, • x (cid:71) y if x ≺ y and the subtrees Sx and Sy overlap, • x k y if x ≺ y and the subtrees Sx and Sy are disjoint. It follows that the relations ⊃◦, (cid:71) and k partition the relation ≺, that is, they are pairwise disjoint sets of pairs and their union gives the entire ≺. Furthermore, the following conditions are satisfied for any x, y, z ∈ V (G): (A1) if x ⊃◦ y and y ⊃◦ z, then x ⊃◦ z, (A2) if x ⊃◦ y and y (cid:71) z, then x ⊃◦ z or x (cid:71) z, (A3) if x (cid:71) y and y ⊃◦ z, then x (cid:71) z or x k z (because of cleanness), (A4) if x k y and y ≺ z, then x k z. We define an on-line game CABS(k) in which Presenter builds a graph G together with relations ⊃◦, (cid:71) and k declaring, in each round, the relations ⊃◦, (cid:71) and k between the vertices presented before and the new vertex so that ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 19 a b a ⊃◦ b a b a b a (cid:71) b a b a k b Figure 6. Interval filament representations of a ⊃◦ b, a (cid:71) b, and a k b. The two drawings of a (cid:71) b distinguish whether the domains of the interval filaments representing a and b are nested or overlap. Other drawings of a (cid:71) b can be obtained by letting a and b cross many times. (i) ⊃◦, (cid:71) and k partition the order of presentation ≺ and satisfy (A1) -- (A4), (ii) xy ∈ E(G) if and only if x (cid:71) y or y (cid:71) x, (iii) ω(G) (cid:54) k, and Algorithm properly colors G on-line. No interval filament intersection model is revealed by Presenter in the game CABS(k). See Figure 6 for an illustration of possible representations of the relations ⊃◦, (cid:71) and k in the game. Lemma 6.2. A graph G is a game graph of CABS(k) if and only if G is a clean subtree overlap graph. If G is a game graph of CABS(k) and the relation ≺ (as defined for a game graph) is a total order on V (G), then G is an interval filament graph. Proof. We have argued above that every clean subtree overlap graph with clique number at most k is a game graph of CABS(k). Now, suppose that G is a game graph of CABS(k). This means that there exist a rooted forest F on V (G) and relations ⊃◦, (cid:71) and k on V (G) such that (i) ⊃◦, (cid:71) and k partition the ancestor-descendant order ≺ of F and satisfy (A1) -- (A4), (ii) xy ∈ E(G) if and only if x (cid:71) y or y (cid:71) x, (iii) ω(G) (cid:54) k. Let T be a tree with V (T) = {r} ∪ {ux : x ∈ V (G)} ∪ {vx : x ∈ V (G)}, E(T) = {rux : x is a root of F} ∪ {uxuy : xy ∈ E(F)} ∪ {uxvx : x ∈ V (G)}. For x ∈ V (G), let Sx = {ux, vx} ∪ {uy : x ⊃◦ y or x (cid:71) y} ∪ {vy : x ⊃◦ y}. We show that x 7→ Sx is a clean overlap model of G by subtrees of T. If x ≺ y and uy /∈ Sx, then x k y, so it follows from (A4) that y ≺ z implies x k z and thus uz /∈ Sx for every z. Hence, every set Sx is the node set of a subtree of T. If x ⊃◦ y, then y ⊃◦ z implies x ⊃◦ z, by (A1), and y (cid:71) z implies x ⊃◦ z or x (cid:71) z, by (A2), and hence Sy ⊂ Sx. If x (cid:71) y, then ux, vx ∈ Sx (cid:114) Sy, uy ∈ Sx ∩ Sy, and vy ∈ Sy (cid:114) Sx, and hence Sx and Sy overlap. Finally, if x k y, then it follows from (A4) that y ≺ z implies x k z for every z, and hence Sx ∩ Sy = ∅. This shows that x 7→ Sx is indeed an overlap model of G. Moreover, by (A3), there are no x, y, z with x (cid:71) y ⊃◦ z and x ⊃◦ z, so the model is clean. This completes the proof of the first statement. For the proof of the second statement, assume that the underlying forest F of the game graph G consists of just one root-to-leaf path. It follows directly from the construction that all sets Sx for x ∈ V (G) intersect the set {ux : x ∈ V (G)}, which forms a path in T. As it has been explained earlier in this section, an overlap graph of subtrees of T all of which intersect some path in T is an interval filament graph. (cid:3) 20 TOMASZ KRAWCZYK AND BARTOSZ WALCZAK The game CIOV(k) is more restrictive for Presenter than the game CABS(k), in the sense that every presentation scenario in the former can be translated into a presentation scenario in the latter. Indeed, let G be a graph presented in CIOV(k) together with its representation µ: V (G) → I, and let ≺ be its order of presentation. We can define relations ⊃◦, (cid:71) and k on V (G) just like before: • x ⊃◦ y if x ≺ y and the interval µ(x) contains the interval µ(y), • x (cid:71) y if x ≺ y and the intervals µ(x) and µ(y) overlap, • x k y if x ≺ y and the intervals µ(x) and µ(y) are disjoint. Clearly, the relations ⊃◦, (cid:71) and k thus defined satisfy the conditions (i) -- (iii) of the definition of CABS(k). This and Lemma 6.2 imply that every clean interval overlap game graph is a clean subtree overlap graph. 7. Coloring algorithm for rectangle and subtree overlap graphs In this section, we will prove that game graphs of CABS(k) have chromatic number Ok((log log n)k−1), while game graphs of CIOV(k) (which are the same as game graphs of CIOV3(k)) have chromatic number Ok(log log n) and triangle-free chromatic number Ok(1). Then, the same bounds on the chromatic number of clean subtree overlap graphs and (respectively) the chromatic number and triangle-free chromatic number of rectangle overlap graphs will follow from Lemmas 6.2 and 6.1 (respectively). The general idea is to provide on-line algorithms in CABS(k), CIOV(k) and CIOV3(k) using few colors, and then to use Lemma 2.1 to derive upper bounds on the (triangle-free) chromatic number of their game graphs. However, since Presenter has a strategy to force Algorithm to use Ω(log r) colors in r rounds of the game CIOV(2), a direct application of Lemma 2.1 to the game graph cannot succeed for CABS(k) and CIOV(k) if the rooted forest F underlying the game graph contains long paths. To overcome this problem, we use the technique of heavy-light decomposition due to Sleator and Tarjan [33]. Let G be a game graph of CABS(k) or CIOV(k) with n vertices and with an underlying forest F. Thus ω(G) (cid:54) k. We call an edge xy of F, where y is a child of x, heavy if the subtree of F rooted at y contains more than half of the vertices of the subtree of F rooted at x, and we call it light otherwise. The following is proved by an easy induction. Lemma 7.1 (Sleator, Tarjan [33]). Every path in F from a root to a leaf contains at most blog2 nc light edges. Every vertex of F has a heavy edge to at most one of its children, so the heavy edges form a collection of paths in F, called heavy paths. For each heavy path P, by the second statement of Lemma 6.2, the graph G[V (P)] is an interval filament graph, and therefore, by Theorem 1.1 (1), it can be colored properly using Ok(1) colors. In the special case that G is a game graph of CIOV(k), the result of Kostochka and Milans [24] implies that 2k − 1 colors even suffice. We start with a preliminary coloring of the vertices of G that colors each heavy path as it is described above using the same set of colors, thus using Ok(1) colors in total. Note that this is not an on-line coloring -- the color of a vertex depends on the subgraph induced on the whole heavy path that contains it. Let b = blog2 nc + 1. By Lemma 7.1, every root-to-leaf path in F is subdivided by its light edges into at most b blocks, each being a subpath of some heavy path of F. The subgraph of G induced on each color class in the preliminary coloring is itself a game graph of CABS(k) or CIOV(k), respectively, and contains no edges within any of the blocks. We will color each such subgraph separately by an appropriate on-line ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 21 a b c d e f g h i j Figure 7. A presentation scenario of an interval filament graph in the game CABS(3) and one of its possible representations. The representa- tion is for illustration only and is not revealed by Presenter in the game. The primary vertices are a, b, c, e, h. We have S(a) = {a}, S(b) = {b}, S(c) = {c, d, g}, S(e) = {e, f}, and S(h) = {h, i, j}. algorithm using Ok((log b)k−1) colors in CABS(k) and Ok(log b) colors in CIOV(k). To achieve this formally, we define on-line games CABS(k, b) and CIOV(k, b) like CABS(k) and CIOV(k), respectively, but with one additional constraint: (iv/v) there is a partition of the vertices into at most b blocks of vertices consecutive in the order of presentation ≺ such that no edge connects vertices in the same block. It follows from the discussion above that the subgraph of G induced on each color class in the preliminary coloring is a game graph of CABS(k, b) or CIOV(k, b), respectively. The rest of this section is devoted to the proofs of the following three lemmas. In view of the discussion above, combining them with the results of previous sections will then give us Theorems 1.2 (1) -- (2), 1.3 (1) -- (2), and 1.4. Lemma 7.2. There is an on-line Ok((log b)k−1)-coloring algorithm in CABS(k, b). Lemma 7.3. There is an on-line Ok(log b)-coloring algorithm in CIOV(k, b). Lemma 7.4. There is an on-line Ok(1)-coloring algorithm in CIOV3(k). For the next part of this section, we forget the preceding context (in particular, the previous meaning of G) and adopt the setting of Lemma 7.2: a graph G with relations ⊃◦, (cid:71) and k is being presented in the game CABS(k, b), and we are to color G properly using Ok((log b)k−1) colors on-line. Whatever we show for CABS(k, b) applies also to CIOV(k, b), as the latter is more restrictive for Presenter. The proof of Lemma 7.3 will differ from the proof of Lemma 7.2 only in one part, where the use of a direct argument instead of induction will allow us to reduce the number of colors to Ok(log b). The last part of that proof, which raises the number of colors from Ok(1) to Ok(log b), can be omitted when we aim only at a triangle-free coloring, whence Lemma 7.4 will follow. As a new vertex z of G is presented, we classify it as primary or secondary according to the following on-line rule: if there are x, y ∈ V (G) such that y is primary, x (cid:71) y, x (cid:71) z, and y ⊃◦ z, then z is secondary, otherwise z is primary. Let P denote the set of primary vertices, being built on-line during the game. For every y ∈ P, let S(y) be the set containing y and all secondary vertices z such that y ⊃◦ z and there is x with x (cid:71) y and x (cid:71) z, also being built on-line during the game. See Figure 7 for an illustration. The following lemma will be used implicitly throughout the rest of this section. Lemma 7.5. For every z ∈ V (G), there is a unique vertex p ∈ P with z ∈ S(p). Proof. It follows directly from the primary-secondary classification rule that there is p ∈ P such that z ∈ S(p). To see that such a vertex p is unique, suppose to the TOMASZ KRAWCZYK AND BARTOSZ WALCZAK 22 contrary that there are p, q ∈ P such that p ≺ q and z ∈ S(p) ∩ S(q). It follows that z is secondary, p ⊃◦ z, and q ⊃◦ z. We can have neither p (cid:71) q, as this would contradict (A3), nor p k q, as this would contradict (A4). Hence p ⊃◦ q. Since z ∈ S(p), there is x ∈ V (G) such that x (cid:71) p and x (cid:71) z. Since x (cid:71) p ⊃◦ q, we have x (cid:71) q or x k q, by (A3). However, we cannot have x k q, as this and q ⊃◦ z would contradict (A4). Hence x (cid:71) q. (cid:3) This contradicts the hypothesis that q is primary. The next lemma will allow us to construct an on-line coloring of G from on-line colorings of G[P] and of all G[S(p)] with p ∈ P. Lemma 7.6. The vertices in P can be 2-colored on-line so that if p, q ∈ P have the same color and pq /∈ E(G[P]), then xy /∈ E(G) for any x ∈ S(p) and y ∈ S(q). Proof. We make the following two observations: (i) If p, q ∈ P, p ≺ q, pq /∈ E(G), x ∈ S(p), y ∈ S(q), and xy ∈ E(G), then x (cid:71) q. (ii) For every q ∈ P, there is at most one vertex p ∈ P with the following properties: p ≺ q, pq /∈ E(G), and there is x ∈ S(p) with x (cid:71) q. Once they are established, we can argue as follows. By (ii), P can be colored on-line using two colors so as to distinguish any p, q ∈ P such that p ≺ q, pq /∈ E(G), and there is x ∈ S(p) with x (cid:71) q. It follows from (i) that if p, q ∈ P, p ≺ q, pq /∈ E(G), x ∈ S(P), y ∈ S(q), and xy ∈ E(G), then x (cid:71) q and therefore p and q have distinct colors. It remains to prove (i) and (ii). First, we prove the following property: (iii) If p, q ∈ P, p ≺ q, pq /∈ E(G), x ∈ S(p), q ⊃◦ y, and xy ∈ E(G), then p ⊃◦ q and x (cid:71) q. Suppose p k q. We cannot have q ≺ x, as this would imply p k x, by (A4). Hence x ≺ q. It follows from (A4) that p k y. But p ⊃◦ x and x (cid:71) y imply p ⊃◦ y or p (cid:71) y, by (A2), thus contradicting p k y. Therefore, we cannot have p k q. We cannot have p (cid:71) q either, as pq /∈ E(G). So we have p ⊃◦ q. Since x ∈ S(p), there is some u with u (cid:71) p and u (cid:71) x. We cannot have u ⊃◦ q, because this would contradict (A3). We cannot have u (cid:71) q, because then q would be secondary. Hence u k q. This implies x ≺ q, whence we have p ⊃◦ x ≺ q ⊃◦ y and x (cid:71) y. We cannot have x ⊃◦ q, because this would imply x ⊃◦ y. We cannot have x k q either, by (A4). Hence x (cid:71) q. Now, (i) follows immediately from (iii). To see (ii), suppose there are p1, p2, q ∈ P such that p1 ≺ p2 ≺ q, p1q /∈ E(G), p2q /∈ E(G), and there are x1 ∈ S(p1) and x2 ∈ S(p2) with x1 (cid:71) q and x2 (cid:71) q. By (iii), we have p1 ⊃◦ q and p2 ⊃◦ q. We cannot have p1 (cid:71) p2, as this would contradict (A3) for p1, p2 and q. Hence p1p2 /∈ E(G). We apply (iii) to p1, p2, x1 and q to conclude that x1 (cid:71) p2. Now, since x1 (cid:71) p2 ⊃◦ q and x1 (cid:71) q, we conclude that q is secondary, which is a contradiction. (cid:3) The following lemma will allow us to color G[S(p)] for every p ∈ P. Lemma 7.7. For every p ∈ P, there is x ∈ V (G) with x (cid:71) y for all y ∈ S(p). Proof. Let p ∈ P. Let z be the latest presented vertex in S(p). It follows that there is x ∈ V (G) such that x (cid:71) p and x (cid:71) z. Now, take any y ∈ S(p) (cid:114) {z}. We have x (cid:71) p and p ⊃◦ y, so x (cid:71) y or x k y, by (A3). We cannot have x k y, as this would imply x k z, by (A4). Hence x (cid:71) y. (cid:3) It follows from Lemma 7.7 that ω(G[S(p)]) (cid:54) k − 1 for every p ∈ P. This will allow us to use induction to color every G[S(p)] in the abstract overlap game. For the clean interval overlap game, instead of induction, we will use the following direct argument. ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 23 Lemma 7.8. If G is a clean interval overlap graph presented on-line in the game CIOV(k, b) or CIOV3(k), then, for every p ∈ P, the graph G[S(p)] can be properly colored on-line using at most (cid:0)k (cid:1) colors. 2 Proof. Let µ denote the clean interval overlap representation of G presented in the game together with G. Consider one of the sets S(p) being built during the game. By Lemma 7.7, there is x ∈ V (G) such that '(µ(x)) < '(µ(y)) < r(µ(x)) < r(µ(y)) for every y ∈ S(p). Define a partial order < on S(p) so that y < z whenever '(µ(y)) < '(µ(z)) and r(µ(y)) > r(µ(z)). It follows that G[S(p)] is the incomparability graph of S(p) with respect to <. Moreover, the set S(p) is built in the up-growing manner with respect to <, that is, every vertex is maximal with respect to < at the moment it is presented. Since ω(G[S(p)]) (cid:54) k − 1, it follows from Theorem 4.3 that the graph G[S(p)] can be (cid:3) properly colored on-line using(cid:0)k (cid:1) colors. 2 To prove Lemmas 7.2 and 7.3, we will color the graph G[P] in two steps, expressed if x (cid:71) y ≺ z, then x k z or y k z; by Lemmas 7.9 and 7.11. Only the first step is needed for the proof of Lemma 7.4. Lemma 7.9. The graph G[P] can be colored on-line using k colors so that the following holds for any x, y, z ∈ P of the same color: (∗) in particular, the coloring of G[P] is triangle-free. Proof. We use the following two observations: (i) If x, y, z do not satisfy (∗), then neither do x, y, y0 for any y0 with y ≺ y0 ≺ z. (ii) If x, y, z are in P and do not satisfy (∗), then y (cid:71) z. To see (i), suppose that x (cid:71) y ≺ y0 ≺ z and x, y, y0 satisfy (∗), that is, x k y0 or y k y0. By (A4), this yields x k z or y k z, respectively, so x, y, z satisfy (∗). To see (ii), suppose x (cid:71) y ⊃◦ z. By (A3), this yields x (cid:71) z or x k z. We cannot have x (cid:71) z, as then z would be secondary. Hence x k z, so x, y, z satisfy (∗). The coloring of G[P] is constructed as follows. At the time when a vertex z ∈ P is presented, consider the set Y of all vertices y ∈ P for which there is x ∈ P such that x, y, z do not satisfy (∗). By (i), for any y, y0 ∈ Y ∪ {z} with y ≺ y0, there is x ∈ P such that x, y, y0 do not satisfy (∗). This and (ii) imply that Y ∪ {z} is a clique in G[P], and hence Y (cid:54) k − 1. Therefore, at least one of the k colors is not used on any vertex from Y , and we use such a color for z. It is clear that the coloring of G[P] thus (cid:3) obtained satisfies the condition of the lemma. First-fit is the on-line algorithm that colors the graph properly with positive integers in a greedy way: when a new vertex v is presented, it is assigned the least color that has not been used on any of the neighbors of v presented before v. Theorem 7.10 (folklore). First-fit uses at most blog2 nc + 1 colors on any forest with n vertices presented in any order. Let P 0 be a subset of P being built on-line during the game so that any x, y, z ∈ P 0 satisfy the condition (∗) of Lemma 7.9. For the proofs of Lemmas 7.2 and 7.3, we apply First-fit to obtain a proper coloring of G[P 0]. Lemma 7.11. First-fit colors the graph G[P 0] properly on-line using O(log b) colors. TOMASZ KRAWCZYK AND BARTOSZ WALCZAK 24 Proof. Let R denote the set of vertices in P 0 that have no neighbor to the right in G[P 0]. We show that each member of P 0 (cid:114) R has at most one neighbor to the right in G[P 0 (cid:114) R]. Suppose to the contrary that there are x, y, z ∈ P 0 (cid:114) R with x (cid:71) y ≺ z and x (cid:71) z. Since y ∈ P 0 (cid:114) R, there is z0 ∈ P 0 such that y (cid:71) z0. Since x (cid:71) z, we have y k z, and since y (cid:71) z0, we have x k z0, because x, y, z and x, y, z0 satisfy the condition (∗) of Lemma 7.9. However, we have z ≺ z0 or z0 ≺ z, which implies either y k z0 or x k z, by (A4). This contradiction shows that each member of P 0 (cid:114) R has at most one neighbor to the right in G[P 0 (cid:114) R]. In particular, G[P 0 (cid:114) R] is a forest. By the definition of R, the colors assigned by First-fit to the vertices in P 0 (cid:114) R do not depend on the colors assigned to the vertices in R. In particular, if we ran First-fit only on the graph G[P 0 (cid:114) R], then we would obtain exactly the same colors on the vertices in P 0 (cid:114) R. Let a be the maximum color used by First-fit on G[P 0]. Since there is a vertex in P 0 with color a, there must be a vertex in P 0 (cid:114) R with color a − 1. This, the fact that G[P 0 (cid:114) R] is a forest, and Theorem 7.10 yield a (cid:54) blog2 P 0c + 2. We apply a similar reasoning to show a (cid:54) blog2 bc + 3. Recall the assumption that there is a partition of V (G) into at most b blocks of ≺-consecutive vertices such that no edge of G[P 0] connects vertices in the same block. Let Q be the set obtained from P 0(cid:114)R by removing all vertices with color 1. If we ran First-fit only on G[Q], then each vertex in Q would get the color less by 1 than the color it has received in the first-fit coloring of G[P 0 (cid:114) R]. Therefore, our hypothetical run of First-fit on G[Q] uses at least a−2 colors, which yields a (cid:54) blog2 Qc + 3, by Theorem 7.10. Now, it is enough to prove that each block B of ≺-consecutive vertices of G such that G[B] has no edge can contain at most one vertex of Q, as this will imply Q (cid:54) b. Suppose to the contrary that there are two vertices y1, y2 ∈ Q ∩ B with y1 ≺ y2. By the assumption that G[B] has no edge, we do not have y1 (cid:71) y2. Each member of Q has a neighbor to the left and a neighbor to the right in G[P 0], neither of which can belong to B. Therefore, there are x, z ∈ P 0 such that x ≺ y1 ≺ y2 ≺ z, x (cid:71) y2, and y1 (cid:71) z. We cannot have y1 k y2, as this and y2 ≺ z would imply y1 k z, by (A4). Hence y1 ⊃◦ y2. We cannot have x k y1, as this and y1 ≺ y2 would imply x k y2, by (A4). Neither can we have x ⊃◦ y1, as this and y1 ⊃◦ y2 would imply x ⊃◦ y2, by (A1). Hence x (cid:71) y1. This, y1 ⊃◦ y2, and x (cid:71) y2 contradict the assumption that y2 is primary. We have thus shown a = O(log b), which completes the proof. (cid:3) Proof of Lemma 7.2. The proof goes by induction on k. The case k = 1 is trivial. Now, assume that k (cid:62) 2 and the lemma holds for k − 1. By Lemma 7.9, G[P] can be colored on-line using colors 1, . . . , k so as to guarantee the condition (∗) for any x, y, z ∈ P. For p ∈ P, let φ(p) denote the color of p in such a coloring. For i ∈ {1, . . . , k}, let Pi = {p ∈ P : φ(p) = i}. By Lemma 7.11, each G[Pi] can be properly colored on-line using colors 1, . . . , ', where ' = O(log b). For p ∈ Pi, let ψ(p) denote the color of p in such a coloring. For i ∈ {1, . . . , k} and j ∈ {1, . . . , '}, let Pi,j = {p ∈ Pi : ψ(p) = j}. By Lemma 7.6, each set Pi,j can be further 2-colored on-line so as to distinguish any p, q ∈ Pi,j for which there is some edge between S(p) and S(q). Let ζ be such a 2- coloring of each Pi,j using colors 1 and 2. For each p ∈ P, it follows from Lemma 7.7 that ω(G[S(p)]) (cid:54) k − 1 and therefore, by the induction hypothesis, G[S(p)] can be properly colored on-line using colors 1, . . . , m, where m = Ok((log b)k−2). For p ∈ P and x ∈ S(p), let ξ(x) denote the color of x in such a coloring. We color each vertex x ∈ S(p) by the quadruple (φ(p), ψ(p), ζ(p), ξ(x)). This is a proper coloring of G using at most 2k'm = Ok((log b)k−1) colors. (cid:3) (cid:1). (cid:1) = Ok(log b) colors. 2 ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS apply Lemma 7.8 instead of induction to color G[S(p)] properly using colors 1, . . . ,(cid:0)k This gives a proper coloring of G using at most 2k'(cid:0)k 25 Proof of Lemma 7.3. The proof goes as above with one change: for every p ∈ P, we 2 (cid:3) Proof of Lemma 7.4. By Lemma 7.9, G[P] can be triangle-free colored on-line using colors 1, . . . , k. For p ∈ P, let φ(p) denote the color of p in such a coloring. For i ∈ {1, . . . , k}, let Pi = {p ∈ P : φ(p) = i}. By Lemma 7.6, each set Pi can be further 2-colored on-line so as to distinguish any p, q ∈ Pi such that pq /∈ E(G) and there is some edge between S(p) and S(q). Let ζ be such a 2-coloring of each Pi using colors 1 and 2. For each p ∈ P, by Lemma 7.8, G[S(p)] can be properly colored on-line using coloring. We color each vertex x ∈ S(p) by the triple (φ(p), ζ(p), ξ(x)). It follows that if p, q ∈ P, x ∈ S(p), y ∈ S(q), (φ(p), ζ(p), ξ(x)) = (φ(q), ζ(q), ξ(y)), and xy ∈ E(G), then pq ∈ E(G). Therefore, since φ is triangle-free, the coloring by triples is a triangle- (cid:3) Theorems 1.2 (1) -- (2) and 1.3 now follow from Theorem 5.1, Lemmas 6.2 and 6.1 (respectively), Lemma 7.1 and the discussion that follows it, Lemmas 7.2 and 7.3 (respectively), and Lemma 2.1. Theorem 1.4 follows from Lemmas 6.1, 7.4 and 2.1. colors 1, . . . ,(cid:0)k free coloring of G using at most 2k(cid:0)k (cid:1). For p ∈ P and x ∈ S(p), let ξ(x) denote the color of x in such a 2 (cid:1) colors. 2 In the next section, we will prove that the proper coloring algorithm of clean subtree overlap graphs presented above uses the asymptotically optimal number of colors. 8. Subtree overlap graphs with large chromatic number In this final section, we will present a construction of clean subtree overlap graphs with chromatic number Θω((log log n)ω−1) and thus prove Theorem 1.2 (3). To this end, we will prove the following. Lemma 8.1. For k, m (cid:62) 1, Presenter has a finite strategy to force Algorithm to use at least 2mk−1 − 1 colors in 2Ok(m) rounds of the game CABS(k). Moreover, the number of presentation scenarios for all possible responses of Algorithm is 22Ok(m). We will generalize the strategy of Presenter forcing the use of c colors in 2c−1 rounds of the game CIOV(2), described in [25, 29]. The strategy that we will describe presents a set of vertices with relations ⊃◦, (cid:71) and k that partition the order of presentation ≺ and satisfy the conditions (A1) -- (A4). The graph G is defined on these vertices by the relation (cid:71), that is, so that xy ∈ E(G) if and only if x (cid:71) y or y (cid:71) x. The strategy ensures ω(G) (cid:54) k, so that all conditions of the definition of CABS(k) are satisfied. For convenience, we extend the notation ⊃◦, (cid:71) and k to sets of vertices in a natural way. For example, X ⊃◦ Y denotes that x ⊃◦ y for all x ∈ X and y ∈ Y . The strategy is expressed in terms of a recursive procedure present, initially called as present(k, 2m, m, ∅, ∅). When a call to present(k, ', m, A1, A2) occurs, the following context and conditions are assumed: • some set of vertices, call it P, has been already presented in the game, • relations ⊃◦, (cid:71) and k among the vertices in P have been declared, • A1 and A2 are disjoint subsets of P such that A1 ⊃◦ A2, • 2 (cid:54) ' (cid:54) 2m. As a result of the call to present(k, ', m, A1, A2) considered, the game is continued in such a way that the following happens: • a new set of vertices is presented, call it S, TOMASZ KRAWCZYK AND BARTOSZ WALCZAK 26 • relations ⊃◦, (cid:71) and k are declared between P and S in a fixed way -- so that A1 ⊃◦ S, • relations ⊃◦, (cid:71) and k are declared among the vertices in S, • an independent set R ⊆ S is picked so that Algorithm has used many (at least A2 (cid:71) S, and P (cid:114) (A1 ∪ A2) k S, 'mk−2 − 1) colors on R. Here is the procedure; it uses return statements to pass the set R to the caller: procedure present(k, ', m, A1, A2) if k = 1 then present a new vertex y and declare that x ⊃◦ y for every x ∈ A1, x (cid:71) y for every x ∈ A2, and x k y for every x /∈ A1 ∪ A2 that has been presented before; return {y}; else if ' = 2 then else return present(k − 1, 2m, m, A1, A2); R1 := present(k, ' − 1, m, A1, A2); R2 := present(k, ' − 1, m, A1 ∪ R1, A2); if Algorithm has used at least 'mk−2 − 1 colors on R1 ∪ R2 then else return R1 ∪ R2; R3 := present(k − 1, 2m, m, A1 ∪ R1, A2 ∪ R2); return R1 ∪ R3; Before analyzing the details and proving correctness of the procedure, we first explain its core idea. It lies in the case k (cid:62) 2 and 3 (cid:54) ' (cid:54) 2m (the outer else block). The requirements on the recursive calls to present imply that R1, R2 and R3 are independent sets, R1 ⊃◦ R2, R1 ⊃◦ R3, R2 (cid:71) R3, and appropriately many colors have been used on each of R1, R2 and R3 (the last one considered only when used in the inner else block). If the number of colors used on R1 ∪ R2 is large enough, then R1 ∪ R2 is a good candidate for the set R to be returned by the current call to present. Otherwise, R1∪ R3 is a good candidate, as there are appropriately many common colors used on R1 and R2, and the colors used on R3 must be different. See Figure 8 for an illustration. Our goal is to show that the initial call to present(k, 2m, m, ∅, ∅) yields a strategy that obeys the rules of the game CABS(k) and forces the use of at least 2mk−1 − 1 colors. This is achieved by the following lemma. Lemma 8.2. As a result of a call to present(k, ', m, A1, A2), a set of vertices S is presented, relations ⊃◦, (cid:71) and k are declared, and a set R ⊆ S is returned so that (i) A1 ⊃◦ S, A2 (cid:71) S, and P (cid:114) (A1 ∪ A2) k S, where P denotes the set of vertices that (ii) any x, y, z ∈ S satisfy the conditions (A1) -- (A4) of the definition of CABS(k), (iii) any x, y ∈ S satisfy the following conditions: have been presented before the call to present(k, ', m, A1, A2), (B1) if x ≺ y and x, y ∈ R, then x ⊃◦ y, (B2) if x ⊃◦ y and y ∈ R, then x ∈ R, (B3) if x k y, then x ∈ S (cid:114) R, (iv) the graph defined on S by the relation (cid:71) has clique number at most k, (v) Algorithm has used at least 'mk−2 − 1 colors on the vertices in R. ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 27 A1 A2 R1 R2 present(k, ' − 1, m, A1, A2) present(k, ' − 1, m, A1 ∪ R1, A2) A1 A2 R1 R2 R3 present(k, ' − 1, m, A1, A2) present(k, ' − 1, m, A1 ∪ R1, A2) present(k − 1, 2m, m, A1 ∪ R1, A2 ∪ R2) Figure 8. A recursion step of present(k, ', m, A1, A2) with k (cid:62) 2 and 3 (cid:54) ' (cid:54) 2m illustrated by how an interval filament model of the resulting graph might look in each of the two cases: • top -- at least 'mk−2 − 1 colors have been used on R1 ∪ R2, • bottom -- at most 'mk−2 − 2 colors have been used on R1 ∪ R2. Thick lines illustrate bundles of pairwise non-intersecting interval fila- ments, as labeled. Each gray box covers the filaments of the vertices pre- sented in a direct recursive call to present; these filaments stay inside the box (unless they belong to the result set Ri) and cross all filaments piercing the box from left to right (e.g. those in A2). The white box plays the analogous role for the call to present(k, ', m, A1, A2) itself. Proof. The recursion tree of calls to present is finite, because every call to present with first parameter k and second parameter ' makes recursive calls to present with k smaller by 1 or with k unchanged and ' smaller by 1. The proof of the lemma goes by induction on the recursion tree. That is, we prove the lemma for a particular call to present(k, ', m, A1, A2), called the current call henceforth, assuming that the lemma holds for every recursive call to present triggered as a result of the current call. Even though the current call occurs in the context of a set of vertices P presented before the call, only part (i) of the statement of the lemma is concerned about P. In particular, the lemma considered just for the current call does not assert the conditions (A1) -- (A4) for all triples of vertices in P ∪ S; they are to be considered at higher levels of induction. First, consider the case that the current call is a leaf of the recursion tree, which happens if and only if k = 1. In that case, (i) is a direct consequence of how the relations ⊃◦, (cid:71) and k are declared when a new vertex is presented by the procedure, and (ii) -- (v) hold trivially, because they are concerned about a set S that consists of just one vertex. 28 TOMASZ KRAWCZYK AND BARTOSZ WALCZAK Next, if k (cid:62) 2 and ' = 2, then (i) -- (v) follow directly from the induction hypothesis applied to the recursive call with k − 1 and 2m in place of k and '. Finally, for the rest of the proof, consider the case that k (cid:62) 2 and 3 (cid:54) ' (cid:54) 2m. The current call yields two or three recursive calls to present, as a result of which three sets of vertices S1, S2 and S3 are presented, respectively (we let S3 = ∅ if there is no third recursive call). Thus A1 ∪ A2 ≺ S1 ≺ S2 ≺ S3 and S = S1 ∪ S2 ∪ S3. The induction hypothesis (i) applied to the recursive calls implies (i) for S as well as the following: (∗) R1 ⊃◦ S2 ∪ S3, S1 (cid:114) R1 k S2 ∪ S3, R2 (cid:71) S3, S2 (cid:114) R2 k S3. z ∈ S2 ∪ S3. This and x ⊃◦ y imply x ∈ R1, by (B2). Hence x ⊃◦ z, by (∗). This and x ⊃◦ y imply x ∈ R2, by (B2). Hence x (cid:71) z, by (∗). z ∈ S2 ∪ S3. This and x (cid:71) y imply x ∈ S1 (cid:114) R1, by (B1). Hence x k z, by (∗). To prove (ii) for S, choose any x, y, z ∈ S with x ≺ y ≺ z. If x, y, z ∈ Si, then all (A1) -- (A4) follow directly from the induction hypothesis (ii) for the recursive calls. If x ∈ Si and y ∈ Sj with i < j, then, by (∗), the relation between x and y is the same as the relation between x and z, whence all (A1) -- (A4) follow. It remains to consider the case that x, y ∈ Si and z ∈ Sj with i < j. To this end, we use (∗) and the induction hypothesis (iii) applied to the recursive calls. It follows from y ⊃◦ z and (∗) that y ∈ R1 and (A1) Suppose x ⊃◦ y and y ⊃◦ z. (A2) Suppose x ⊃◦ y and y (cid:71) z. It follows from y (cid:71) z and (∗) that y ∈ R2 and z ∈ S3. (A3) Suppose x (cid:71) y and y ⊃◦ z. It follows from y ⊃◦ z and (∗) that y ∈ R1 and (A4) If x k y, then x ∈ Si (cid:114) Ri, by (B3). This and z ∈ Sj with i < j imply x k z, by (∗). To prove (iii) for R, choose any x, y ∈ S with x ≺ y. If x, y ∈ Si, then all (B1) -- (B3) follow directly from the induction hypothesis (iii) applied to the recursive calls and from the fact that R ∩ Si = Ri or R ∩ Si = ∅. It remains to consider the case that x ∈ Si and y ∈ Sj with i < j. To this end, we use (∗) and the fact that the procedure present returns R = R1 ∪ R2 or R = R1 ∪ R3. (B1) If x, y ∈ R, then x ∈ R1 and y ∈ Rj, by the definition of R, so x ⊃◦ y, by (∗). (B2) If x ⊃◦ y, then x ∈ R1, by (∗), so x ∈ R, by the definition of R. (B3) If x k y, then x ∈ Si (cid:114) Ri, by (∗), so x ∈ S (cid:114) R, by the definition of R. We have ω(G[S]) = max{ω(G[S1]), ω(G[S2]), ω(G[S3]) + 1} (cid:54) k, by (∗) and by the property (B1) of R2. Hence we have (iv) for S. Finally, we prove (v) for R. If Algorithm has used at least 'mk−2 − 1 colors on R1 ∪ R2, then the call returns R = R1 ∪ R2, so (v) holds. It remains to consider the opposite case -- that at most 'mk−2 − 2 colors have been used on R1 ∪ R2 and the call returns R = R1 ∪ R3. By (v) applied to R1 and R2, Algorithm has used at least (' − 1)mk−2 − 1 colors on each of R1 and R2. It follows that at least (' − 2)mk−2 common colors have been used on both R1 and R2. By (v) applied to R3, Algorithm has used at least 2mk−2 − 1 colors on R3. Since R2 (cid:71) R3, these colors must be different from the common colors used on both R1 and R2. Therefore, at least 'mk−2 − 1 colors have been used on R1 ∪ R3, which proves (v) for R. (cid:3) Proof of Lemma 8.1. By Lemma 8.2 (ii), (iv) and (v), the strategy of Presenter de- scribed by a call to present(k, 2m, m, ∅, ∅) obeys the rules of the game CABS(k) and forces Algorithm to use at least 2mk−1 − 1 colors in total. It remains to prove that the number of presentation scenarios for all possible responses of Algorithm is 22Ok(m). ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 29 The only conditional instruction in the procedure present whose result is not determined by the values of k, ' and m but depends on the coloring chosen by Algorithm is the test whether "Algorithm has used at least 'mk−2 − 1 colors on R1 ∪ R2". We call it simply a test. Let sk,' and ck,' denote the maximum number of vertices that can be presented and the maximum number of tests that can be performed, respectively, as a result of a call to present(k, ', m, A1, A2). It easily follows from the procedure that s1,' = 1, c1,' = 0, sk,2 = sk−1,2m for k (cid:62) 2, ck,2 = ck−1,2m for k (cid:62) 2, sk,' (cid:54) 2sk,'−1 + sk−1,2m ck,' (cid:54) 2ck,'−1 + ck−1,2m + 1 for k (cid:62) 2 and 3 (cid:54) ' (cid:54) 2m, for k (cid:62) 2 and 3 (cid:54) ' (cid:54) 2m. This yields the following by straightforward induction: sk,2m (cid:54) (22m−1 − 1)sk−1,2m for k (cid:62) 2, ck,2m (cid:54) (22m−1 − 1)(ck−1,2m + 1) − 1 for k (cid:62) 2, s1,2m = 1, c1,2m = 0, sk,2m (cid:54) (22m−1 − 1)k−1, ck,2m (cid:54) (22m−1 − 1)k−1 − 1. For fixed k and m, the outcome of the call to present(k, 2m, m, ∅, ∅) (that is, the sequence of vertices presented and the relations ⊃◦, (cid:71) and k declared) is entirely determined by the outcomes of the tests performed as a result of that call. Since at most ck,2m tests are performed, the number of possible outcomes of the call is at most 2ck,2m. Since at most sk,2m vertices are presented, each outcome of the call gives rise to at most sk,2m presentation scenarios, each corresponding to an initial segment of the sequence of vertices presented. Therefore, the total number of presentation scenarios (cid:3) possible with this strategy is at most 2ck,2msk,2m, which is 22Ok(m). Lemmas 8.1, 2.2 and 6.2 yield a construction of clean subtree overlap graphs (string graphs) with χ = Θω((log log n)ω−1). This completes the proof of Theorem 1.2 (3). The graphs constructed above also satisfy χω = Θω(log log n), because every color class of a Kω(G)-free coloring of a clean subtree overlap graph G induces a subgraph with chromatic number Oω(G)((log log n)ω(G)−2), by Theorem 1.2 (2). All intersection models of the graphs constructed above require that some pairs of curves intersect many times. This is because these graphs contain vertices whose neighborhoods have chromatic number Θω((log log n)ω−2), while the neighborhood of every vertex of an intersection graph of 1-intersecting curves (that is, curves any two of which intersect in at most one point) has bounded chromatic number [34]. We wonder whether it is possible to construct intersection graphs of 1-intersecting curves with bounded clique number and with chromatic number asymptotically greater than log log n (that χ = Θ(log log n) can be achieved follows from the results of [29, 30]). Acknowledgments We thank Martin Pergel for familiarizing us with subtree overlap graphs and interval filament graphs and for asking whether these classes of graphs are χ-bounded. We also thank anonymous reviewers for their very helpful corrections and comments. 30 TOMASZ KRAWCZYK AND BARTOSZ WALCZAK References [1] Eyal Ackerman, On the maximum number of edges in topological graphs with no four pairwise crossing edges, Discrete Comput. Geom. 41 (3), 365 -- 375, 2009. [2] Pankaj K. Agarwal, Boris Aronov, János Pach, Richard Pollack, and Micha Sharir, Quasi-planar graphs have a linear number of edges, Combinatorica 17 (1), 1 -- 9, 1997. [3] Alexander A. Ageev, A triangle-free circle graph with chromatic number 5, Discrete Math. 152 (1 -- 3), 295 -- 298, 1996. [4] Edgar Asplund and Branko Grünbaum, On a colouring problem, Math. Scand. 8, 181 -- 188, 1960. [5] Dwight R. Bean, Effective coloration, J. Symb. Logic 41 (2), 289 -- 560, 1976. [6] James P. Burling, On coloring problems of families of prototypes, PhD thesis, University of Colorado, Boulder, 1965. [7] Jakub Černý, Coloring circle graphs, Electron. Notes Discrete Math. 29, 457 -- 461, 2007. [8] Jérémie Chalopin, Louis Esperet, Zhentao Li, and Patrice Ossona de Mendez, Restricted frame graphs and a conjecture of Scott, Electron. J. Combin. 23 (1), P1.30, 2016. [9] Jessica Enright and Lorna Stewart, Subtree filament graphs are subtree overlap graphs, Inform. [10] Thomas Erlebach and Jiří Fiala, On-line coloring of geometric intersection graphs, Comput. Geom. Process. Lett. 104 (6), 228 -- 232, 2007. 23 (2), 243 -- 255, 2002. [11] Stefan Felsner, On-line chain partitions of orders, Theor. Comput. Sci. 175 (2), 283 -- 292, 1997. [12] Jacob Fox and János Pach, Coloring Kk-free intersection graphs of geometric objects in the plane, [13] Jacob Fox and János Pach, Applications of a new separator theorem for string graphs, Combin. [14] Fănică Gavril, The intersection graphs of subtrees in trees are exactly the chordal graphs, J. European J. Combin. 33 (5), 853 -- 866, 2012. Prob. Comput. 23 (1), 66 -- 74, 2014. Combin. Theory Ser. B 16 (1), 47 -- 56, 1974. Inform. Process. Lett. 73 (5 -- 6), 181 -- 188, 2000. graphs, Discrete Math. 43 (1), 37 -- 46, 1983. [15] Fănică Gavril, Maximum weight independent sets and cliques in intersection graphs of filaments, [16] Martin C. Golumbic, Doron Rotem, and Jorge Urrutia, Comparability graphs and intersection [17] András Gyárfás, On the chromatic number of multiple interval graphs and overlap graphs, Discrete Math. 55 (2), 161 -- 166, 1985. Corrigendum: Discrete Math. 62 (3), 333, 1986. [18] András Gyárfás and Jenő Lehel, On-line and first fit colorings of graphs, J. Graph Theory 12 (2), 217 -- 227, 1988. [19] Clemens Hendler, Schranken für Färbungs- und Cliquenüberdeckungszahl geometrisch repräsentier- barer Graphen, Master's thesis, Freie Universität Berlin, 1998. [20] Henry A. Kierstead and William T. Trotter, An extremal problem in recursive combinatorics, in: Frederic Hoffman (ed.), 3rd Southeastern International Conference on Combinatorics, Graph Theory, and Computing (CGTC 1981), vol. 33 of Congressus Numerantium, pp. 143 -- 153, Utilitas Math. Pub., Winnipeg, 1981. [21] Alexandr V. Kostochka, On upper bounds for the chromatic numbers of graphs, Trudy Inst. Mat. 10, 204 -- 226, 1988, in Russian. [22] Alexandr V. Kostochka, Coloring intersection graphs of geometric figures with a given clique number, in: János Pach (ed.), Towards a Theory of Geometric Graphs, vol. 342 of Contemp. Math., pp. 127 -- 138, AMS, Providence, 2004. [23] Alexandr V. Kostochka and Jan Kratochvíl, Covering and coloring polygon-circle graphs, Discrete Math. 163 (1 -- 3), 299 -- 305, 1997. [24] Alexandr V. Kostochka and Kevin G. Milans, Coloring clean and K4-free circle graphs, in: János Pach (ed.), Thirty Essays on Geometric Graph Theory, pp. 399 -- 414, Springer, New York, 2012. [25] Tomasz Krawczyk, Arkadiusz Pawlik, and Bartosz Walczak, Coloring triangle-free rectangle overlap graphs with O(log log n) colors, Discrete Comput. Geom. 53 (1), 199 -- 220, 2015. [26] László Lovász, Perfect graphs, in: Lowell W. Beineke and Robin J. Wilson (eds.), Selected Topics in Graph Theory, vol. 2, pp. 55 -- 87, Academic Press, London, 1983. [27] János Pach, Radoš Radoičić, and Géza Tóth, Relaxing planarity for topological graphs, in: Ervin Győri, Gyula O. H. Katona, and László Lovász (eds.), More Graphs, Sets and Numbers, vol. 15 of Bolyai Soc. Math. Stud., pp. 285 -- 300, Springer, Berlin, 2006. ON-LINE APPROACH TO OFF-LINE COLORING PROBLEMS 31 [28] János Pach, Farhad Shahrokhi, and Mario Szegedy, Applications of the crossing number, Algorith- mica 16 (1), 111 -- 117, 1996. [29] Arkadiusz Pawlik, Jakub Kozik, Tomasz Krawczyk, Michał Lasoń, Piotr Micek, William T. Trotter, and Bartosz Walczak, Triangle-free geometric intersection graphs with large chromatic number, Discrete Comput. Geom. 50 (3), 714 -- 726, 2013. [30] Arkadiusz Pawlik, Jakub Kozik, Tomasz Krawczyk, Michał Lasoń, Piotr Micek, William T. Trotter, and Bartosz Walczak, Triangle-free intersection graphs of line segments with large chromatic number, J. Combin. Theory Ser. B 105, 6 -- 10, 2014. [31] Martin Pergel, Recognition of polygon-circle graphs and graphs of interval filaments is NP-complete, in: Andreas Brandstädt, Dieter Kratsch, and Haiko Müller (eds.), 33rd International Workshop on Graph-Theoretic Concepts in Computer Science (WG 2007), vol. 4769 of Lecture Notes Comput. Sci., pp. 238 -- 247, Springer, Berlin, 2007. [32] Alexandre Rok and Bartosz Walczak, Outerstring graphs are χ-bounded, in: Siu-Wing Cheng and Olivier Devillers (eds.), 30th Annual Symposium on Computational Geometry (SoCG 2014), pp. 136 -- 143, ACM, New York, 2014. [33] Daniel D. Sleator and Robert E. Tarjan, A data structure for dynamic trees, J. Comput. System Sci. 26 (3), 362 -- 391, 1983. [34] Andrew Suk and Bartosz Walczak, New bounds on the maximum number of edges in k-quasi- planar graphs, Comput. Geom. 50, 24 -- 33, 2015. [35] Pavel Valtr, On geometric graphs with no k pairwise parallel edges, Discrete Comput. Geom. 19 (3), 461 -- 469, 1998. Department of Theoretical Computer Science, Faculty of Mathematics and Computer Science, Jagiel- lonian University, Kraków, Poland E-mail: [email protected], [email protected]
1701.04021
1
1701
2017-01-15T10:30:38
Optimal Elephant Flow Detection
[ "cs.DS" ]
Monitoring the traffic volumes of elephant flows, including the total byte count per flow, is a fundamental capability for online network measurements. We present an asymptotically optimal algorithm for solving this problem in terms of both space and time complexity. This improves on previous approaches, which can only count the number of packets in constant time. We evaluate our work on real packet traces, demonstrating an up to X2.5 speedup compared to the best alternative.
cs.DS
cs
Optimal Elephant Flow Detection Ran Ben Basat Computer Science Department Gil Einziger Nokia Bell Labs Roy Friedman Yaron Kassner Computer Science Department Computer Science Department Technion [email protected] Technion Technion [email protected] [email protected] [email protected] 7 1 0 2 n a J 5 1 ] S D . s c [ 1 v 1 2 0 4 0 . 1 0 7 1 : v i X r a Abstract-Monitoring the traffic volumes of elephant flows, in- cluding the total byte count per flow, is a fundamental capability for online network measurements. We present an asymptotically optimal algorithm for solving this problem in terms of both space and time complexity. This improves on previous approaches, which can only count the number of packets in constant time. We evaluate our work on real packet traces, demonstrating an up to X2.5 speedup compared to the best alternative. I. INTRODUCTION A. Background Network monitoring is at the core of many important networking protocols such as load balancing [6], [21], traffic engineering [9], [43], routing, fairness [29], intrusion and anomaly detection [25], [39], [46], caching [23], policy en- forcement [41] and performance diagnostics [18]. Effective network monitoring requires maintaining various levels of traffic statistics, both as an aggregate and on a per-flow basis. This includes the number of distinct flows, also known as flow cardinality, the number of packets generated by each flow, and the total traffic volume attributed to each flow. Each of these adds complementing capabilities for managing and protecting the network. For example, a large increase in cardinality may indicate a port-scanning attack, while statistics about the number of packets or the volume of traffic can help perform load balancing, meet QoS guarantees and detect denial-of-service (DoS) attacks. For the latter, identifying the top-K flows, or the heavy-hitters and elephant flows are essential competencies. Similarly, traffic engineering [9] involves detecting high volume flows and ensuring that they are efficiently routed. Operation speed is of particular importance in network measurement. For example, a reduction in latency for par- tition/aggregate workloads can be achieved if we are able to identify traffic bursts in near real time [18]. The main challenges in addressing the above mentioned tasks come from the high line rates and large scale of modern networks. Specifically, to keep up with ever growing line rates, update operations need to be extremely fast. As already mentioned, when near real-time decisions are expected, queries should also be answered quickly. In addition, due to the huge number of flows passing through a single network device, memory is becoming a major concern. In a hardware implementation, the data structures should fit in TCAM or SRAM, because DRAM is too slow to keep up with line rate updates. Similarly, in a software implementation, as can be envisioned in upcoming SDN and NFV realizations, the ability to perform computa- tions in a timely manner greatly depends on whether the data structures fit in the hardware cache and whether the relevant memory pages can be pinned to avoid swapping. While the problem of identifying the top-K flows and heavy-hitters in terms of the number of packets has been addressed by many previous works, e.g., [7], [19], [30], [37], detection of elephant flows in terms of their traffic volume has received far less attention. However, it is non-trivial to translate a top-K or heavy-hitters algorithm to an efficient elephant flow solution, because many of the former maintain ordered or semi-ordered data structures [7], [19], [30], [37]. Performing fast updates to these data structures depends on the fact that each packet increments (or decrements) its corresponding counter(s) by 1. Hence, the perturbation caused by each update is fairly contained, predictable and tractable. In contrast, when each packet modifies its corresponding counter(s) by its entire size, such maintenance becomes much harder. Further, treating an increment (or decrement) by the packet's size S as a sequence of S increments (or decrements) by 1 would multiply the update time by a factor of S, rendering it too slow. 1) Contributions: In this paper, we introduce the first elephant flow detection scheme that provides the following benefits: (i) constant time updates, (ii) constant time point- queries, (iii) detection of elephant flows in linear time, which is optimal, and (iv) asymptotically optimal space complexity. This is achieved with two hash-tables whose size is propor- tional to the number of elephant flows, and a single floating point variable. We present two flavors of the algorithm for maintaining these data structures. The first version Iterative Median SUMming (IM-SUM), which is easier to describe and simpler to code, works in amortized O(1) time. The second variant De-amortized Iterative Median SUMming (DIM-SUM) de-amortizes the first, thereby obtaining worst case O(1) execution time. We also evaluate the performance of these variants on both synthetic and real-world traces, and compare their execution time to other leading alternatives. We demonstrate that IM- SUM is up to 2.5 times faster than any of our competitors on these traces, and up to an order of magnitude faster than others. DIM-SUM is slower than IM-SUM, but still faster than all competitors for small values of ε. DIM-SUM is faster in terms of worst case guarantee, ensuring constant update time. The latter is important when real-time behavior is required. Algorithm Space Saving [14] CM Sketch [16] Count Sketch [11] This Paper- IM-SUM This Paper- DIM-SUM  Space O(cid:0) 1 (cid:1) O(cid:0) 1 (cid:1) (cid:17) (cid:16) 1  · log 1 O(cid:0) 1 (cid:1) 2 · log 1 O(cid:0) 1 (cid:1) δ δ   O Query Time (cid:1) (cid:1) O(1) O(cid:0)log 1 O(cid:0)log 1 δ δ O(1) O(1) Update Time O(cid:0)log 1 O(cid:0)log 1 O(cid:0)log 1 δ  δ (cid:1) (cid:1) (cid:1) O(1) amortized O(1) worst case Deterministic      Table I: Comparison of frequency estimation algorithms that support weights. B. Related work Network monitoring capabilities are needed in both hard- ware and software [38]. In hardware, space is a critical constraint as there is no sufficient memory technology; while SRAM is fast enough to operate at line speed, it is too small to accommodate all flows. On the contrary, DRAM is too slow to be read at line speed. Traditional network monitoring approaches utilized short probabilistic counters [22], [42], [44] to reduce the memory requirements. Counter arrays are managed by network devices [22], [42], [44] as well as sketches such as the Count Sketch [11] and the Count Min Sketch (CM-Sketch) [16]. These algorithms can be extended to support finding frequent items using hierarchy and group testing [14], [16], [17]. As network line rates became faster, sketches evolved into more complex algorithms that require significantly less memory at the expense of a long decoding time. Such algorithms include Counter Braids [34], Randomized Counter Sharing [32] and Counter Tree [12]. While these algorithms handle updates very fast, they incur a long query time. Thus, queries can only be done off-line and not in real time as required by some networking applications. For software implementations, counter based algorithms are often the way to go [14]. These methods typically maintain a flow table, where each monitored flow receives a table entry. Counter algorithms differ from one another in the the flow table maintenance. Specifically, in Lossy Counting [36], new flows are always added to the table. In order to keep the table size bounded, flow counters are periodically decremented and flows whose counters reach 0 are deleted. Lossy counting is simple and effective, but its space consumption is not optimal. Lossy Counting's space consumption was empirically improved with probabilistic eviction of entries [20] as well as statistical knowledge about the stream distribution [40] that allows dropping excess table entries earlier. Frequent (FR) [30] is a space optimal algorithm [31]. In FR, instead of decrementing counters periodically, when a packet arrives for a non resident flow and the table is full, all counters are decremented. This improves the space complexity to optimal, but flow counters are needlessly decremented and therefore the algorithm is less accurate. This is solved by the Space Saving algorithm [37]. In Space Saving, when a packet that belongs to a flow that does not have a counter arrives, and the flow table is full, the algorithm evicts the entry whose counter is minimal. The rest of the counters are untouched and their estimation is therefore more accurate. For packet counting, since all counter updates are +1, Space Saving and FR can be implemented in O(1) [7], [37]. This makes Space Saving and FR asymptotically optimal in both space and time. The version of Space Saving we compare against in this paper uses a heap to manage its counters [14], [15], [35]; we denote it hereafter SSH. In the general case, packets have different sizes so SSH requires a logarithmic runtime. This is preferred over the original implementation with ordered linked lists [37], which requires a constant time to count the number of packets but a linear time when considering packet sizes. Various methods such as a sketches for tail items and a randomized counter admission policy can make (empirically) more efficient data structures [27], [8]. These improvements are orthogonal to the one presented in this paper. In general, Ω(cid:0) 1 Alternatively, [5] implemented elephant flow identification with a Sample and Hold like technique [36]. That is, the controller receives sampled packets and periodically updates the monitored flows to reflect the current state of the heavy hitters. Unfortunately, sampling discards some of the informa- tion about packet sizes that can be used to reduce the error. In addition, since sampling does not take into account the packet size, large packets can be missed, resulting in a large error. with an additive error bounded by ε · R, where R is the total weight of all items in the stream [37]. The optimal runtime is O(1) for both update and query. Related works which are capable of estimating flow volume (rather than packet counting) are summarized in Table I. As listed, our algorithms are the first to offer both (asymptotically) optimal space consumption and optimal runtime. (cid:1) space is required to approximately count  II. MODEL We consider a stream (S) of tuples of the form, (ai, wi), where ai denotes item's id and wi its (non-negative) weight. At each step, a new tuple is added to the stream and we denote by N the current number of tuples in the stream. Given an identifier x, we denote the total weight of x as: (cid:44) (cid:88) f t x wi. (ai,wi)∈S: ai=x,i≤t When t = N, we denote: fx (cid:44) f N x . Rt (cid:44) (cid:88) wi. (ai,wi)∈S:i≤t Also, the total weight of all ids in the stream at time t is: Symbol R Rt fx f t x (cid:98)f t x γ  qt θ δ Meaning The total sum of all items in the stream so far. The total sum of all items in the stream until time t. The weighted frequency for item x in the stream so far. The weighted frequency for item x, at time t. An estimate of the weighted frequency of item x, at time t. A speed-space tradeoff parameter, affects frequency of maintenance operations and memory consumption. Accuracy parameter, small  means lower estimation error but more counters. (cid:109) (cid:108) 1 1+γ The estimate of the top quantile at time t. Threshold for elephant flows. The error probability allowed in randomized algorithms. Table II: Summary of notations used in this paper. A. Problem definitions: We now formally define the problems we address. •  - VOLUME ESTIMATION: We say that an algorithm solves the  - VOLUME ESTIMATION problem if at any x that satisfies time t, Query(x) returns an estimation (cid:98)f t x + Rt · . x ≤ (cid:98)f t x ≤ f t f t • (θ, )-ELEPHANT FLOWS: We say that an algorithm solves the (θ, ) - ELEPHANT FLOWS problem if at any time t, an Elephants() query returns a set of elements x > Rt · θ =⇒ x ∈ St, St, such that for every flow x, f t x < Rt · (θ − ) =⇒ x (cid:54)∈ St. We note that if the and f t stream is unweighted (all weights are 1), this degenerates to the Heavy Hitters problem discussed in [14], [37], [45]. B. Notations The notations used in this paper are summarized in Table II. A. Intuition III. SOLUTION Ideally, when the table is full, we wish to evict the smallest flow as in Space Saving. However, in the weighted case, Space Saving runs in logarithmic time. We achieve constant runtime by relaxing the memory constraint; instead of removing the minimal flow upon arrival of a non resident flow, we peri- odically remove many small flows from the table at once. This maintenance operation takes linear time, but it is invoked infrequently enough to achieve amortized O(1) runtime. The table size only increases by a constant factor, so our solution remains (asymptotically) space optimal. In principle, an optimal algorithm requires O( 1  ) space [10], and runs in constant time. The algorithm provides an approx- imation guarantee that the error is bounded by R where R is the total weight of all flows in the stream. (cid:6) 1  (cid:7)th largest counter, and evicts all flows whose counters Intuitively, our periodic maintenance process identifies the is smaller than that counter. This is obtained by internally splitting the table into two sub-tables named Active and Passive. Each table entry contains both the flow's id and a counter that represents the flow's volume. The Active table is mutable, while the Passive is read-only. That is, updates only affect the Active table while queries consider both of them. The maintenance process copies all counters that are larger than the quantile of the (cid:6) 1 Passive tables remains bounded while the (cid:6) 1 Each table is configured to store at most: T (cid:44)(cid:6) γ (cid:7)th largest flow from the Passive (cid:7) largest flows (cid:7)+(cid:6) 1 (cid:7)−1 table to the Active table, clears the Passive table, and then switches between them. That way, the size of the Active and are never evicted.   items, where γ is a positive constant that affects a speed-space trade off as explained below. In addition, we keep a single floating point variable q, which represents the value of the last quantile calculated. q is the default estimation returned when querying the frequency of non-resident flows. It ensures that such estimates meet the maximum error guarantee.   We then improve the complexity to worst case O(1) with a de-amortization process. Intuitively, this is done by performing a small piece of the maintenance prior to each update. We need to make sure that maintenance is always finished by the time the Active table fills up. Once maintenance is over, we switch the Active table with the (now empty) Passive table. B. Iterative Median Summing We describe our Iterative Median SUMming (IM-SUM) algorithm and its deamortized variant Deamortized Iterative Median SUMming (DIM-SUM), by detailing four operations: a query operation, which computes the volume of a flow; an elephants method that returns all elephant flows; an update op- eration, which increases the volume of a flow corresponding to a recently arrived packet; and a maintenance operation, which periodically discards infrequent flows to prevent overflowing. a) Query(x): The query procedure appears in Figure 1. As depicted, the estimated weighted frequency of element x, (((cid:98)fx), is Active[x] if x has an Active table entry, P assive[x] perform a query for ai. Let (cid:98)f t−1 if x has a Passive table entry and otherwise q. b) Elephants(): Returns the elephant flows. First, we set St ← ∅; then, we traverse both the Active and Passive tables, adding to St any flow x for which Query(x) ≥ Rt · θ. c) Update: The update procedure is illustrated in Fig- ure 2. The procedure deals with an arrival of a pair (ai, w) (flow id, weight), e.g., ai may be a TCP five tuple and w the byte size of its payload. In the update procedure, we first be the query result for ai. We . d) Maintenance: As mentioned above, we require peri- odic maintenance to keep the Active table from overflowing. We define generation in the stream; a generation starts/ends every time the Active table fills up. Before a generation ends, the maintenance process needs to achieve the following: add the following entry to the Active table: (cid:16) ai,(cid:98)f t−1 (cid:17) + w ai ai (a) (b) (c) Figure 1: An illustration of the query process: first we query the Active table, then if the item was not found, we query the Passive table, and finally we return q if the item was not found in the Passive table as well. (a) (b) (c) (d) Figure 3: An illustration of the maintenance process. In 3a, we find a quantile for the Passive table (a median in this example where γ = 1). Next, in 3b, we copy all entries larger than the quantile to the Active table. Then, in 3c, we clear all remaining entries from the Passive table. Finally, in 3d, we swap the Active and the Passive tables. the switch, the Active table is empty and the Passive contains all entries that were a part of the Active table. The maintenance process is illustrated in Figure 3. Mainten- ance operations are performed once per generation and we need to guarantee that the number of items in the Active table never exceeds the allocated size of T (cid:44)(cid:6) γ (cid:7) − 1. We (cid:7) +(cid:6) 1 later prove that the number of update operations between two consecutive maintenance operations is at least F (cid:44) (cid:100) γ  (cid:101), and show that as a result the update time is constant if γ is constant. C. Maintenance Implementation   There are several ways to implement the maintenance steps described in Section III-B, which provide different runtime guarantees. Section III-C1 explains that when the maintenance operation is run serially after the Active table fills up we achieve an amortized O(1) runtime, while Subsection III-C2 explains how to improve the runtime to O(1) worst case. 1) Simple Maintenance: In this suggestion, we perform the maintenance procedure serially at the end of each generation. The most computationally intensive step is Step 1, where we (cid:101)th largest counter. When γ = 1, this value need to find the (cid:100) 1 is the median, and as long as γ is constant, it is a certain percentile. It is well known that median (and other percentiles) can be calculated in linear time in a deterministic manner, e.g., by using the median of medians algorithm. Therefore, the time complexity of Step 1 is linear with the table size of O(cid:0) 1+γ (cid:1).  Figure 2: An illustration of the update process: we perform a query, add w to the result and then update the Active table. 1) Set q to be the(cid:6) 1 (cid:7)th largest value in the Passive table.  2) Move or copy all items with frequency larger than q from the Passive table to the Active table, except for the items that already appear in the Active table. 3) Clear the Passive table. 4) When the Active Table has filled, switch the Active and Passive tables before a new generation begins. After (cid:1) In Step 2, we copy at most 1  ). Step 3 can be performed in O(1) time or in O(cid:0) 1+γ  entries from the Passive table to the Active table. The complexity of this step is O( 1 time, depending if the hash table supports constant time flush operations. Finally, Step 4 requires O(1) time. Therefore, since the number of update operations in a generation is  (cid:101), as shown in Lemma 2, the average update time per (cid:100) γ packet γ ), which is O(1) when γ is constant. Therefore, the simple maintenance procedure can be executed with O(1) amortized time. As mentioned above, we nickname our algorithm with the simple maintenance procedure Iterative Median SUMming (IM-SUM). is O(1 + 1  2) De-amortized Implementation: In deamortization, we can perform only a small portion of the maintenance procedure on each packet arrival. The challenge is to evenly split the maintenance task between update operations. Our deamortized algorithm, nicknamed De-amortized Iterative Median SUM- ming (DIM-SUM), uses the following two techniques. a) Controlled Execution: Here, we execute O(1) main- tenance operations after processing each packet. Since the total (cid:1), we divide the maintenance to maintenance time is O(cid:0) 1+γ  (cid:16) (cid:17) 1 + 1 γ tasks of O operations each and execute a single task for each update operation. Therefore, when γ is chosen to be a constant, we achieve O(1) worst case complexity. Note that we do not know how many update operations will actually occur before the Active table fills, e.g., if a flow with an Active table entry is updated, then the number of Active table entries does not increase. This motivates us to dynamically adjust the size of the maintenance operations according to the workload, to avoid a large variance in the length of update operations. If we use the static bound proven above, the first update operations will be slow, and once maintenance is over, update operations will be fast. To avoid this situation, we suggest an approach to dynamically adjust the task size according to the actual workload. To do so, prior to each update operation, we recalculate the minimum number U of remaining updates according to the actual number of entries in the Active table and the maximal number of entries that still need to be copied from the Passive table. Next, we calculate the maximum number of operations M left in the current maintenance iteration. Before each update operation, we execute (cid:100) M U (cid:101) maintenance operations. b) Double Threading: A second approach is to run some of the maintenance steps in a second thread in parallel to the update operations. We should ascertain that a sufficient number of maintenance operations are executed with every update op- eration. This resembles a producer-consumer problem, where the maintenance thread is the producer and the update thread is the consumer. It can be implemented with a semaphore. After a sufficient number of maintenance operations is executed, the semaphore increments, and before an update operation is executed, the semaphore decrements. the above While synchronization between the two threads, it has a few advantages. First, it simplifies the implementation. The calculation of a quantile technique requires is usually performed with a recursive function. Therefore, freezing the calculation and resuming it later requires saving the trace of recursive calls. Second, the double-threading procedure enables running the update and the maintenance procedures in parallel, which can save time. The drawback of this technique is the use of semaphore for synchronization, which hurts performance. In our deamortized implementation, we used a combination of the two techniques. We used controlled execution for steps 2 and 3 and double-threading for Step 1. Step 4 is executed only at the end of a generation. D. What is in a Hash Table? The only data structure used by our solution is a hash table. This means that the hash table's properties directly impact the performance of our solution. In particular, advances in hash tables (e.g., [24]) can directly improve our work. Below, we survey some interesting possibilities. 1) Do we really need two different tables?: In principle, one could implement both Active and Passive tables as a single table with a bit that decides if the entry belongs to the Passive or Active table. This approach can speed up the maintenance process, as moving an item from the Passive to the Active table can be done by flipping a bit, which can even be done in an atomic manner. 2) Cuckoo Hash Table: Cuckoo hashing is very attractive for read intensive workloads as it offers O(1) worst case queries. The trade off is that insertions end in O(1) time only with high probability. Another interesting benefit of the Cuckoo hash table is fast delete operations; all entries below a certain threshold can be instantly removed by treating them as empty [33]. A similar technique could also be used in our case and further reduce the time required to clear the Passive table. 3) Compact Hash Tables: When space is very tight, we can leverage compact hash tables. These data structures avoid the use of pointers and instead employ bit indexes to encode the table structure [24], [28]. Clearly, leveraging such structures is expected to significantly reduce space consumption. 4) Fast Hash Tables: Perhaps the most obvious benefit of relying only on standard hash tables is speed. Since we do not maintain any proprietary data structures, we can potentially improve our runtime as faster hash tables are developed. For example, Hop Scotch Hashing [26] is considered one of the fastest parallel hash tables in practice. IV. ANALYSIS A. Correctness Our goal is to prove that IM-SUM and DIM-SUM solve the  - VOLUME ESTIMATION and (θ, ) - ELEPHANT FLOWS problems. To do so, we first bound the value of qt. Lemma 1. qt ≤ Rt ·  at all times t. Proof of Lemma 1: Let St be the sum of the(cid:6) 1 (cid:7) items in the tables with the largest estimation value at time t. We     (cid:6) 1 show by induction on i that Si ≤ Ri for any time i. Assume that Si−1 ≤ Ri−1. consequently Si = Si−1 + wi ≤ Ri−1 + wi = Ri. not become one at time i, then Si = Si−1 ≤ Ri−1 ≤ Ri. When an item x arrives at time i, if it is already one of the x increase by wi, and If x was not one of the largest items at time i − 1 and has If, however, x was not one of the largest items at time i− 1 (cid:7) largest items, then both Ri−1 and f t (cid:7)th but became one at time i, mark the frequency of the (cid:6) 1 largest item by Qi−1. If there are fewer than(cid:6) 1 (cid:7) items in the x) becomes at most Qi−1 + wi. Therefore (cid:98)f t of x ((cid:98)f t tables, define Qi−1 = qi−1. After adding wi, the estimation x adds to Si−1 up to Qi−1 + wi. Fortunately, if Qi−1 > 0, then there  items with a positive estimation, and since must be at least 1 x has become one of the largest items, it must have replaced an item with frequency at least Qi−1. Therefore, we subtract at least Qi−1 from Si−1. In case Qi−1 was 0, we still subtract Qi−1 = 0 from Si−1. Either way, Si ≤ Si−1+Qi−1+wi−Qi−1 = Si−1+wi ≤ Ri−1+wi = Ri. Thus Si ≤ Ri for every i. (cid:7) items larger than before qt was computed. There cannot be(cid:6) 1 We next consider the time g at the beginning of a generation (cid:101) ≤ Rg, or otherwise Sg would be larger than Rg. Since Rg(cid:100) 1 this is the beginning of the generation, all of the items are in the passive table, and the quantile will be computed on the current items. Therefore qt will be smaller or equal to Rg. Since the sum of elements only grows, qt ≤ Rg ≤ Rt. Theorem 1. Our algorithm solves  - VOLUME ESTIMATION: That is, at any step (t): f t x ≤ (cid:98)f t x ≤ f t x + Rt.  Proof: We prove the theorem by induction over the number of elements seen t. Basis: At time t = 0, the claim holds trivially. Hypothesis: Suppose that at time t − 1 some element x has an approximation x ≤ (cid:100)f t−1 f t−1 x ≤ f t−1 x + Rt−1. x x does not change, and neither does (cid:100)f t−1 Passive table. If x is also in the Active table, (cid:98)f t x is changed from (cid:100)f t−1 same. Otherwise, (cid:98)f t Step: Assume that at time t item at arrives with weight wt. If at = x, then the new estimation grows by exactly wt, same as the true weight of x. According to the induction hypothesis, the estimation remains correct. Similarly, when another item arrives at time t, f t−1 . Steps 1 , 2 and 4 do not change the estimation for any item. During step 3, however, x could be removed from the x remains the to q. However, since x only appears in the Passive table, we deduce that it was not moved in step 2. This means that the estimation for x at the beginning of the generation was smaller or equal to q. Therefore, it is immediate from the induction hypothesis that the estimation becomes (cid:98)f t x ≤ q = (cid:98)f t x ≤ q. After x is removed from the Passive table as well, f t−1 x. x ≤ (cid:98)f t Lemma 1 proves that q ≤ f t x + Rt and therefore we have x = q. Hence, f t x = f t−1 x ≤ f t x + Rt. f t x  ) time.  ) elephant flows. Next, we prove that our algorithm is also able to identify the elephant flows. We note that the runtime is optimal as there could be Ω( 1 Theorem 2. At any time t, the Elephants() query solves (θ, ) - ELEPHANT FLOWS in O( 1 observing all elements x such that (cid:98)f t Lemma 1, (cid:98)f t x ≥ f t Theorem 1, (cid:98)f t Proof: Queries are done by traversing the tables and x > q. The tables are  ) when γ is constant and therefore the complexity x > Rt·θ. According to Theorem 1 and x > Rt· θ ≥ q. Hence, x must appear in one of the tables with frequency greater than Rt · θ. Otherwise, it would have an estimation of less than q. Consequently, x ∈ St. x < Rt · (θ − ). According to x + Rt ·  < Rt · (θ − ) + Rt ·  = Rt · θ. Next, let x be such that f t of size O( 1 is O( 1 Let x be such that f t x ≤ f t  ). Therefore, x will not be included in St. B. Runtime We now prove that IM-SUM runs at O(1) amortized time and that DIM-SUM runs at O(1) worst case time. Our goal is to evaluate both the complexity of the maintenance and the number of update operations between two consecutive maintenance operations. We start with evaluating the min- imal number of update operations between two consecutive generations, i.e., the number of unique flows that must be encountered before we switch to a new generation. Lemma 2. Denote by Gmin the minimal number of update operations between subsequent generations: Gmin =(cid:6) γ to(cid:6) 1 (cid:7). (cid:7) − 1 items from the Passive table. Other than that, the Proof: In the beginning of every generation the Active table is empty. During step 2, the Active table receives up  Active table only grows due to update operations. Therefore, there must be at least  Gmin = T − (cid:18)(cid:24) 1 (cid:25) (cid:108) γ  =  (cid:19) (cid:24) 1  − 1 (cid:109) + (cid:25) − 1 − (cid:18)(cid:24) 1 (cid:25)  (cid:19) − 1 (cid:108) γ (cid:109)  = updates in each generation. quired to perform the maintenance process. Next, we bound the number of hash table operations re- Lemma 3. The maintenance process requires: M = O(cid:0) 1+γ (cid:1)  hash table operations. Proof: We calculate the complexity of all steps. For Step 1, it is well known that a median can be found in linear time, e.g., using the median of medians algorithm. The same is true for any percentile, and therefore Step 1 requires (cid:18) 1 + γ (cid:19) O  hash table operations to complete. and copies or moves some of the items to the Active table. Step 2 goes over the Passive table, which is of size O(cid:0) 1+γ Therefore, its complexity is O(cid:0) 1+γ (cid:1). (cid:19) (cid:18) 1 + γ Therefore, the total complexity of all steps is: Step 3 can be performed in O(1) and so does Step 4. (cid:1),   O .  Theorem 3. For any fixed γ, IM-SUM runs in O(1) amortized and DIM-SUM in O(1) worst case hash table operations. Proof: First, we observe that for any constant γ, Lemma 2  ) update operations between establishes that there are O( 1  ) hash generations. Similarly, by Lemma 3, there are O( 1 function operations to do during each maintenance process. In IM-SUM, maintenance is performed once per generation and thus the amortized complexity is O(1). In DIM-SUM, as the work is split between update opera- tions, each update has to perform O(1) hash table operations. Let Ut be the minimum number of update operations left in the generation at time t and let Mt be the maximum number of maintenance operations left. We show by induction that = O(1). At a t in the beginning of the generation, Mt Ut Ut = Gmin and Mt = M. Therefore, Mt Ut = O(1). After a single update, Ut+1 ≥ Ut − 1, because otherwise the min- imum number of updates at time t would be smaller than Ut. Mt decreases to at most Mt+1 ≤ Mt − Mt . Therefore, the number of maintenance operations executed at time t + 1 is Assume, by induction, that for any time t, Mt Ut 1 − 1 = O(1). = Mt (cid:16) (cid:17) Ut Ut (cid:18) Mt+1 (cid:19) Ut+1 O ≤ O (cid:16)  Mt 1 − 1 Ut − 1 Ut (cid:17)  = O (cid:18) Mt (cid:19) Ut = O(1). The query process requires 2 hash table operations and is therefore also O(1). C. Required Space We now show that for each constant γ, IM-SUM and DIM-  ) table entries. SUM require the (asymptotically) optimal O( 1 Theorem 4. For each constant γ, the space complexity of IM-SUM and DIM-SUM is O( 1 ε ). Proof: The proof follows from the selected table sizes.  entries  ). Each table is sized to contain a maximum of γ  + 1 and therefore the total number of table entries is O( 1 V. EVALUATION A. Datasets Our evaluation includes the following datasets: 1) The CAIDA Chicago Anonymized Internet Trace 2015 [2] , denoted Chicago. The trace was collected by the 'equinix-chicago' high-speed monitor and contains a mix of 6.3M TCP, UDP and ICMP packets. The weight of each packed is defined as the size of its payload, not including the header. 2) The CAIDA San Jose Anonymized Internet Trace 2014 [3] , denoted SanJose. The trace was collected by the 'equinix-sanjose' high-speed monitor and contains a mix of 20.2M TCP, UDP and ICMP packets. The weight of each packet is defined as the size of its payload, not including the header. 3) The UCLA Computer Science department TCP packet trace (denoted UCLA-TCP) [4]. This trace contains 16.5M TCP packets passed through the border router of the Computer Science Department, University of California, Los Angeles. The weight of each packet is defined as the size of its payload, not including the header. 4) UCLA-UDP [4]. This trace contains 18.5M UDP pack- ets passed through the border router of the Computer Science Department, UCLA. The weight of each packet is defined as the size of its payload, not including the header. 5) YouTube Trace (referred to as YouTube) [47]. The trace contains a sequence of 436K accesses to YouTube's videos made from within the University of Massachu- setts Amherst. The weight of each video is defined as its length (in seconds). An example application for such measurement is the caching of videos according to their bandwidth usage to reduce traffic. 6) (Unweighted) Zipf streams that contain a series of i.i.d elements sampled according to a Zipfian distribution of a given skew. We denote a Zipf stream with skew X as ZipfX. Each packet is of weight 1. B. Implementation We compare both IM-SUM and DIM-SUM [1] to Count Min Sketch (CM), a Hierarchical CM-sketch (CMH), which is an extended version of CM suited to find frequent items [13], a robust implementation of the Count Sketch that has been extended using Adaptive Group Testing by [14] to support finding Frequent Items (AGT), and a heap based implement- ation of Space Saving (denoted SSH) [15], [35]. The code for the competing algorithms is the one released by [14]. All implementations are in C++ and the measurements were made on a 64-bit laptop with a 2.30GHz CPU, 4.00 GB RAM, 2 cores and 4 logical cores. In our own algorithms, we used the same hash table that was used to implement SSH for fairness. We now present an extensive evaluation for comparing our proposed algorithm with the leading alternatives. We only considered alternative algorithms that are able to count packets of variable sizes and are able to answer queries on-line. C. The effect of γ Recall that γ is a performance parameter; increasing γ increases our space requirement but also makes maintenance (a) Chicago (b) SanJose (c) YouTube (d) UCLA-TCP (e) Legend (f) U1CLA-UDP Figure 4: The effect of the parameter γ on the performance of the algorithms over different traces ( = 2−15). (i) Zipf1.3 (g) Zipf0.7 (h) Zipf1 operations infrequent and therefore potentially improves per- formance. Figure 4 shows the performance of IM-SUM and DIM-SUM for values of γ ranging from 2−4 to 24 and  = 2−15. The YouTube trace seems to benefit from larger γ until γ = 8, Chicago until γ = 4, and UCLA seems to saturate around γ = 1. SanJose peaks for IM-SUM at γ = 4 and γ = 8 for DIM-SUM. Zipf1.3 increases with γ until γ = 8. The Zipf0.7 and Zipf1 traces, however, slightly decrease with γ. We explain the decline by an increase in memory consumption, which slows down memory access. The decline is probably not evident in other traces, because in high skew traces the effect of reducing the frequency of the maintenance procedure is larger than the effect of decreasing the memory requirement. In order to balance speed and space efficiency, we continue our evaluation with γ = 4. We also recommend this setting for traces with unknown characteristics. If additional memory is available, reducing  is more effective than increasing γ. It is also evident that our de-amortization process has significant overheads. We attribute this to the synchronization overhead between the two threads of DIM-SUM. D. Effect of  Since memory consumption is coupled to accuracy , it is interesting to evaluate the operation speed as a function of . As IM-SUM and DIM-SUM are asymptotically faster, we expect them to perform better than known approaches for small s (that imply a large number of counters). Figure 5 depicts the operation speed of the algorithms, as a function of . As shown, IM-SUM is considerably faster than all alternatives in all tested workloads, even for large values of . The results for DIM-SUM are mixed. For large  values, it is mostly slower than the alternatives. However, for small s, it is consistently better than previous works. E. Effect of Skew on operation speed Intuitively, the higher the skew of the workload, the less frequent maintenance operations occur, because it takes longer before we see enough unique flows for the Active table to fill up. Figure 6 demonstrates the effect of the zipf skew parameter on performance. As can be observed, while CMH and AGT are quite indifferent to skew, IM-SUM and DIM-SUM benefit (a) Chicago (b) SanJose (c) YouTube (d) UCLA-TCP (e) legend (f) UCLA-UDP Figure 5: Comparison of the number of updates/ms performed by the different algorithms for a given error bound. (a)  = 2−10 (b) Legend (c)  = 2−20 Figure 6: Comparison of the number of updates/ms performed by the different algorithms for a given skew. greatly from it and IM-SUM is faster than all alternatives. DIM-SUM is consistently faster than CMH and AGT, and has similar speed to SSH. CM is slightly faster than DIM-SUM for low skew workloads but more than three times slower than DIM-SUM when the skew is high. SUM. This would probably require redesigning our code to eliminate synchronization, possibly by using an existing concurrent hash table implementation. A C++ based open source implementation of this work and all other code used in this paper is available at [1]. VI. DISCUSSION In this paper, we have shown two variants of the first (asymptotically) space optimal algorithm that can estimate the total traffic volume of every flow as well as identify the elephant flows (in terms of their total byte count). The first variant, IM-SUM, is faster on the average case but only en- sures O(1) amortized execution time, while the second variant, DIM-SUM, offers O(1) worst case time guarantee. We have benchmarked our algorithms on both synthetic and real-world traces and have demonstrated their superior performance. Looking into the future, we hope to further reduce the actual running time of DIM-SUM to match the rate of IM- REFERENCES [1] IM-SUM and DIM-SUM - Open source implementation. ht- tps://github.com/kassnery/dimsum. [2] The CAIDA UCSD Anon. Chichago Internet Traces 2015, Dec. 17th. [3] The CAIDA UCSD Anon. San Jose Internet Traces 2014, June 19th. [4] Unpublished, see http://www.lasr.cs.ucla.edu/ddos/traces/. [5] Yehuda Afek, Anat Bremler-Barr, Shir Landau Feibish, and Liron Schiff. Sampling and large flow detection in sdn. In ACM SIGCOMM, pages 345–346, 2015. [6] Mohammad Al-Fares, Sivasankar Radhakrishnan, Barath Raghavan, Nelson Huang, and Amin Vahdat. Hedera: Dynamic flow scheduling for data center networks. In USENIX NSDI, 2010. [7] Ran Ben-Basat, Gil Einziger, Roy Friedman, and Yaron Kassner. Heavy hitters in streams and sliding windows. In IEEE INFOCOM, 2016. [33] Yang Liu, Wenji Chen, and Yong Guan. Near-optimal approximate membership query over time-decaying windows. In IEEE INFOCOM, pages 1447–1455, 2013. [34] Yi Lu, Andrea Montanari, Balaji Prabhakar, Sarang Dharmapurikar, and Abdul Kabbani. Counter braids: a novel counter architecture for per-flow measurement. In Proc. of the ACM SIGMETRICS, 2008. [35] Nishad Manerikar and Themis Palpanas. Frequent items in streaming data: An experimental evaluation of the state-of-the-art. Data Knowl. Eng., pages 415–430, 2009. [36] Gurmeet Singh Manku and Rajeev Motwani. Approximate frequency counts over data streams. In Proc. of VLDB, 2002. [37] Ahmed Metwally, Divyakant Agrawal, and Amr El Abbadi. Efficient computation of frequent and top-k elements in data streams. In ICDT, 2005. [38] Masoud Moshref, Minlan Yu, and Ramesh Govindan. Resource/accuracy In Proc. of the 2nd ACM tradeoffs in software-defined measurement. SIGCOMM Workshop on Hot Topics in Software Defined Networking, HotSDN, pages 73–78, 2013. [39] B. Mukherjee, L.T. Heberlein, and K.N. Levitt. Network intrusion detection. Network, IEEE, 8(3), May 1994. [40] Qiong Rong, Guangxing Zhang, Gaogang Xie, and K. Salamatian. Mnemonic lossy counting: An efficient and accurate heavy-hitters iden- tification algorithm. In IEEE IPCCC, pages 255–262, 2010. [41] Joel Sommers, Paul Barford, Nick Duffield, and Amos Ron. Accurate In Proc. of the Conf. on and efficient sla compliance monitoring. Applications, Technologies, Architectures, and Protocols for Computer Communications, SIGCOMM. ACM, 2007. [42] Erez Tsidon, Iddo Hanniel, and Isaac Keslassy. Estimators also need shared values to grow together. In INFOCOM, pages 1889–1897, 2012. [43] Vijay Vasudevan, Amar Phanishayee, Hiral Shah, Elie Krevat, David G. Andersen, Gregory R. Ganger, Garth A. Gibson, and Brian Mueller. Safe and effective fine-grained tcp retransmissions for datacenter communic- ation. ACM SIGCOMM, pages 303–314, 2009. [44] Li Yang, Wu Hao, Pan Tian, Dai Huichen, Lu Jianyuan, and Liu Bin. Case: Cache-assisted stretchable estimator for high speed per-flow measurement. In IEEE INFOCOM, 2016. [45] Yin Zhang, Sumeet Singh, Subhabrata Sen, Nick Duffield, and Carsten Lund. Online identification of hierarchical heavy hitters: Algorithms, evaluation, and applications. ACM IMC, 2004. [46] Ying Zhang. An adaptive flow counting method for anomaly detection in sdn. In ACM CoNEXT, pages 25–30, 2013. [47] Michael Zink, Kyoungwon Suh, Yu Gu, and Jim Kurose. Watch global, cache local: Youtube network traffic at a campus network: measurements and implications. In Electronic Imaging 2008, pages 681805–681805, 2008. [8] Ran Ben-Basat, Gil Einziger, Roy Friedman, and Yaron Kassner. Ran- domized admission policy for efficient top-k and frequency estimation. CoRR, abs/1612.02962, 2016. [9] Theophilus Benson, Ashok Anand, Aditya Akella, and Ming Zhang. In ACM Microte: Fine grained traffic engineering for data centers. CoNEXT, pages 8:1–8:12, 2011. [10] Radu Berinde, Graham Cormode, Piotr Indyk, and Martin Strauss. Space-optimal heavy hitters with strong error bounds. In ACM PODS, 2009. [11] Moses Charikar, Kevin Chen, and Martin Farach-Colton. Finding Theor. Comput. Sci., 312(1):3–15, frequent January 2004. items in data streams. [12] Min Chen and Shigang Chen. architecture for per-flow traffic measurement. 111–122, 2015. Counter tree: A scalable counter In IEEE ICNP, pages [13] Pascal Cheung-Mon-Chan and Fabrice Cl´erot. Finding hierarchical In Proceedings of 4th In- heavy hitters with the count min sketch. ternational Workshop on Internet Performance, Simulation, Monitoring and Measurement, IPS-MOME, 2006. [14] Graham Cormode and Marios Hadjieleftheriou. Finding frequent items in data streams. VLDB 2008., 1(2):1530–1541, August 2008. Code: http://hadjieleftheriou.com/frequent-items. [15] Graham Cormode and Marios Hadjieleftheriou. Methods for finding frequent items in data streams. J. of VLDB, 19(1):3–20, 2010. [16] Graham Cormode and S. Muthukrishnan. An improved data stream summary: The count-min sketch and its applications. J. Algorithms, 55(1):58–75, April 2005. [17] Graham Cormode and S Muthukrishnan. What's new: finding significant IEEE/ACM Transactions on differences in network data streams. Networking (TON), 13(6):1219–1232, 2005. [18] Andrew R. Curtis, Jeffrey C. Mogul, Jean Tourrilhes, Praveen Yalagan- dula, Puneet Sharma, and Sujata Banerjee. Devoflow: Scaling flow management for high-performance networks. In ACM SIGCOMM, pages 254–265, 2011. [19] Erik D. Demaine, Alejandro L´opez-Ortiz, and J. Ian Munro. Frequency estimation of internet packet streams with limited space. In Proc. of the 10th Annual European Symposium on Algorithms, ESA, 2002. [20] Xenofontas Dimitropoulos, Paul Hurley, and Andreas Kind. Probabilistic lossy counting: An efficient algorithm for finding heavy hitters. ACM SIGCOMM Comput. Commun. Rev., 38, 2008. [21] Gero Dittmann and Andreas Herkersdorf. Network processor load balancing for high-speed links. In Proc. of the Int. Symp. on Performance Evaluation of Computer and Telecommunication Systems, volume 735, 2002. [22] G. Einziger, B. Fellman, and Y. Kassner. Independent counter estimation buckets. In IEEE INFOCOM, pages 2560–2568, 2015. [23] G. Einziger and R. Friedman. TinyLFU: A highly efficient cache admission policy. In Euromicro PDP, pages 146–153, 2014. [24] Gil Einziger and Roy Friedman. Counting with tinytable: Every bit counts! In ACM ICDCN 2016, pages 27:1–27:10. [25] Pedro Garcia-Teodoro, Jess E. Daz-Verdejo, Gabriel Maci-Fernndez, and E. Vzquez. Anomaly-based network intrusion detection: Techniques, systems and challenges. Computers and Security, pages 18–28, 2009. [26] Maurice Herlihy, Nir Shavit, and Moran Tzafrir. Hopscotch hashing. In 22nd Intl. Symp. on Distributed Computing, 2008. [27] Nuno Homem and Joao Paulo Carvalho. Finding top-k elements in data streams. Inf. Sci., 180(24):4958–4974, December 2010. [28] Nan Hua, Haiquan (Chuck) Zhao, Bill Lin, and Jun Xu. Rank-indexed hashing: A compact construction of bloom filters and variants. In IEEE ICNP 2008. [29] Abdul Kabbani, Mohammad Alizadeh, Masato Yasuda, Rong Pan, and Balaji Prabhakar. Af-qcn: Approximate fairness with quantized congestion notification for multi-tenanted data centers. In Proc. of the 18th Symposium on High Performance Interconnects, IEEE HOTI, 2010. [30] Richard M. Karp, Scott Shenker, and Christos H. Papadimitriou. A simple algorithm for finding frequent elements in streams and bags. ACM Trans. Database Syst., 28(1), March 2003. [31] E. Kranakis, P. Morin, and Y. Tang. Bounds for frequency estimation of packet streams. In SIROCCO, pages 33–42, 2013. [32] T. Li, S. Chen, and Y. Ling. Per-flow traffic measurement through randomized counter sharing. IEEE/ACM Transactions on Networking, 20(5):1622–1634, Oct 2012.
1807.08824
3
1807
2018-10-22T20:21:14
A Deterministic Distributed Algorithm for Weighted All Pairs Shortest Paths Through Pipelining
[ "cs.DS", "cs.DC" ]
We present a new pipelined approach to compute all pairs shortest paths (APSP) in a directed graph with nonnegative integer edge weights (including zero weights) in the CONGEST model in the distributed setting. Our deterministic distributed algorithm computes shortest paths of distance at most $\Delta$ for all pairs of vertices in at most $2 n \sqrt{\Delta} + 2n$ rounds, and more generally, it computes h-hop shortest paths for k sources in $2\sqrt{nkh} + n + k$ rounds. The algorithm is simple, and it has some novel features and a nontrivial analysis.It uses only the directed edges in the graph for communication. This algorithm can be used as a base within asymptotically faster algorithms that match or improve on the current best deterministic bound of $\tilde{O}(n^{3/2})$ rounds for this problem when edge weights are $O(n)$ or shortest path distances are $\tilde{O}(n^{3/2})$.
cs.DS
cs
A Deterministic Distributed Algorithm for Weighted All Pairs Shortest Paths Through Pipelining Udit Agarwal ⋆ and Vijaya Ramachandran∗ October 24, 2018 Abstract We present a new pipelined approach to compute all pairs shortest paths (APSP) in a directed graph with nonnegative integer edge weights (including zero weights) in the Congest model in the distributed setting. Our deterministic distributed algorithm computes shortest paths of distance at most ∆ for all pairs of vertices in at most 2n√∆ + 2n rounds, and more generally, it computes h-hop shortest paths for k sources in 2√nkh + n + k rounds. The algorithm is simple, and it has some novel features and a nontrivial analysis. It uses only the directed edges in the graph for communication. This algorithm can be used as a base within asymptotically faster algorithms that match or improve on the current best deterministic bound of O(n3/2) rounds for this problem when edge weights are O(n) or shortest path distances are O(n3/2). These latter results are presented in a companion paper [1]. 1 Introduction Designing distributed algorithms for various network and graph problems such as shortest paths [2, 8, 11, 13, 9] is a extensively studied area of research. The Congest model (described in Sec 1.2) is a widely-used model for these algorithms, see [2, 4, 8, 11]. In this paper we consider distributed algorithms for the computing all pairs shortest paths (APSP) and related problems in a graph with non-negative edge weights in the Congest model. In sequential computation, shortest paths can be computed much faster in graphs with non-negative edge-weights (including zero weights) using the classic Dijkstra's algorithm [3] than in graphs with negative edge-weights. Additionally, negative edge-weights raise the possibility of negative weight cycles in the graph, which usually do not occur in practice, and hence are not modeled by real-world weighted graphs. Thus, in the distributed setting, it is of importance to design fast shortest path algorithms that can handle non-negative edge-weights, including edges of weight zero. The presence of zero weight edges creates challenges in the design of distributed algorithms as observed in [8]. (We review related work in Section 1.3.) One approach used for positive integer edge weights is to replace an edge of weight d with d unweighted edges and then run an unweighted APSP algorithm such as [11, 13] on this modified graph. This approach is used in approximate APSP ∗Dept. Email: of Computer Science, University of Texas, Austin TX 78712. [email protected], [email protected]. This work was supported in part by NSF Grant CCF-1320675. The first author's research was also partially supported by a UT Austin Graduate School Summer Fellowship. 1 algorithms [12, 10]. However such an approach fails when zero weight edges may be present. There are a few known algorithms that can handle zero weights, such as the O(n5/4)-round randomized APSP algorithm of Huang et al. [8] (for polynomially bounded non-negative integer edge weights) and the O(n3/2)-round deterministic APSP algorithm of Agarwal et al. [2] (for graphs with arbitrary edge weights). 1.1 Our Results We present a new pipelined approach for computing APSP and related problems on an n-node graph G = (V, E) with non-negative edge weights w(e), e ∈ E, (including zero weights). Our results hold for both directed and undirected graphs and we will assume w.l.o.g. that G is directed. Our distributed algorithm uses only the directed edges for communication, while the algorithms in [8, 2] need to use the underlying undirected graph as the communication network. Our Pipelined APSP Algorithm for Weighted Graphs. An h-hop shortest path from u to v in G is a path from u to v of minimum weight among all paths with at most h edges (or hops). The central algorithm we present is for computing h-hop APSP, or more generally, the h-hop k- sources shortest path problem ((h, k)-SSP), with an additional constraint that the shortest paths have distance at most △ in G. We also compute an (h, k)-SSP tree for each source, which contains an h-hop shortest path from the source to every other vertex to which there exists a path with weight at most △. In the case of multiple h-hop shortest paths from a source s to a vertex v, this tree contains the path with the smallest number of hops, breaking any further ties by choosing the predecessor vertex with smallest ID. Our algorithm (Algorithm 1 in Section 3) is compact and easy to implement, and has no large hidden constant factors in its bound on the number of rounds. It can be viewed as a (substantial) generalization of the pipelined method for unweighted APSP given in [13], which is a refinement of [11]. Our algorithm uses key values that depend on both the weighted distance and the hop length of a path, and it can store multiple distance values for a source at a given node, with the guarantee that the shortest path distance will be identified. This algorithm (Algorithm 1) achieves the bounds in the following theorem. Theorem 1.1. Let G = (V, E) be a directed or undirected edge-weighted graph, where all edge weights are non-negative integers (with zero-weight edges allowed). The following deterministic bounds can be obtained in the Congest model for shortest path distances at most △. (i) (h, k)-SSP in 2√△kh + k + h rounds. (ii) APSP in 2n√△ + 2n rounds. (iii) k-SSP in 2√△kn + n + k rounds. Follow-up Results. In a companion paper [1], we build on this pipelined algorithm to present several improved results, which we summarize here. We improve on the bounds given in (ii) and (iii) of Theorem 1.1 by combining our pipelined Algorithm 1 with a modified version of the APSP algorithm in [2] to obtain the bounds stated in the following Theorems 1.2 and 1.3. Theorem 1.2. [1] Let G = (V, E) be a directed or undirected edge-weighted graph, where all edge weights are non-negative integers bounded by λ (with zero-weight edges allowed). The following deterministic bounds can be obtained in the Congest model. (i) APSP in O(λ1/4 · n5/4 log1/2 n) rounds. (ii) k-SSP in O(λ1/4 · nk1/4 log1/2 n) rounds. 2 Theorem 1.3. [1] Let G = (V, E) be a directed or undirected edge-weighted graph, where all edge weights are non-negative integers (with zero edge-weights allowed), and the shortest path distances are bounded by △. The following deterministic bounds can be obtained in the Congest model. (i) APSP in O(n(△ log2 n)1/3) rounds. (ii) k-SSP in O((△kn2 log2 n)1/3) rounds. The results in Theorem 1.2 and 1.3 improve on the O(n3/2) deterministic APSP bound of Agarwal et al. [2] for significant ranges of values for both λ and ∆, as stated below. Corollary 1.4. [1] Let G = (V, E) be a directed or undirected edge-weighted graph with non-negative edge weights (and zero-weight edges allowed). The following deterministic bounds hold for the Con- gest model for 1 ≥ ǫ ≥ 0. (i) If the edge weights are bounded by λ = n1−ǫ, then APSP can be computed in O(n3/2−ǫ/4 log1/2 n) rounds. (ii) For shortest path distances bounded by ∆ = n3/2−ǫ, APSP can be computed in O(n3/2−ǫ/3 log2/3 n) rounds. The corresponding bounds for the weighted k-SSP problem are: O(n5/4−ǫ/4k1/4 log1/2 n) (when λ = n1−ǫ) and O(n7/6−ǫ/3k1/3 log2/3 n) (when ∆ = n3/2−ǫ). Note that the result in (i) is independent of the value of ∆ (depends only on λ) and the result in (ii) is independent of the value of λ (depends only on ∆). Our pipelined technique can be adapted to give simpler methods for some procedures in the random- ized distributed weighted APSP algorithms in Huang et al. [8]. In [1] we present simple deterministic algorithms that match the congest and dilation bounds in [8] for two of the three procedures used there: the short-range and short-range-extension algorithms. Those simplified algorithms are both obtained using a streamlined single-source version of our pipelined APSP algorithm (Algorithm 1). Several other results for distributed computation of shortest paths are presented in [1]. After discussing the Congest model and related reults, the rest of this paper will present our new pipelined algorithm. 1.2 Congest Model In the Congest model, there are n independent processors interconnected in a network by bounded- bandwidth links. We refer to these processors as nodes and the links as edges. This network is modeled by graph G = (V, E) where V refers to the set of processors and E refers to the set of links between the processors. Here V = n and E = m. Each node is assigned a unique ID between 1 and poly(n) and has infinite computational power. Each node has limited topological knowledge and only knows about its incident edges. For the weighted APSP problem we consider, each edge has a positive or zero integer weight that can be represented with B = O(log n) bits. Also if the edges are directed, the corresponding communi- cation channels are bidirectional and hence the communication network can be represented by the underlying undirected graph UG of G (this is also considered in [8, 13, 7]). It turns out that our basic pipelined algorithm does not need this feature though our faster algorithm does. The computation proceeds in rounds. In each round each processor can send a message of size O(log n) along edges incident to it, and it receives the messages sent to it in the previous round. The model allows a node to send different message along different edges though we do not need this 3 feature in our algorithm. The performance of an algorithm in the Congest model is measured by its round complexity, which is the worst-case number of rounds of distributed communication. 1.3 Related Work Weighted APSP. The current best bound for the weighted APSP problem is due to the randomized algorithm of Huang et al. [8] that runs in O(n5/4) rounds. This algorithm works for graphs with polynomially bounded integer edge weights (including zero-weight edges), and the result holds with w.h.p. in n. For graphs with arbitrary edge weights, the recent result of Agarwal et al. [2] gives a deterministic APSP algorithm that runs in O(n3/2) rounds. This is the current best bound (both deterministic and randomized) for graphs with arbitrary edge weights as well as the best deterministic bound for graphs with integer edge weights. In a companion paper [1] we build on the pipelined algorithm we present here to obtain an algorithm for non-negative integer edge-weights (including zero-weighted edges) that runs in O(n△1/3) rounds where the shortest path distances are at most △ and in O(n5/4λ1/4) rounds when the edge weights are bounded by λ. This result improves on the O(n3/2) deterministic APSP bound of Agarwal et al. [2] when either edge weights are at most n1−ǫ or shortest path distances are at most n3/2−ǫ, for any ǫ > 0. In [1] we also give an improved randomized algorithm for APSP in graphs with arbitrary edge weights that runs in O(n4/3) rounds, w.h.p. in n. Weighted k-SSP. The current best bound for the weighted k-SSP problem is due to the Huang et al's [8] randomized algorithm that runs in O(n3/4·k1/2+n) rounds. This algorithm is also randomized and only works for graphs with integer edge weights. The deterministic APSP algorithm in [2] can be shown to give an O(n · √k log n) round deterministic algorithm for k-SSP. In this paper, we present a deterministic algorithm for non-negative (including zero) integer edge-weighted graphs that runs in O((△ · n2 · k)1/3) rounds where the shortest path distances are at most △ and in O((λk)1/4n) rounds when the edge weights are bounded by λ. 2 Overview of the O(n√△) Pipelined Algorithm for APSP The starting point for our weighted APSP algorithm is the distributed algorithm for unweighted APSP in [13], which is a streamlined variant of an earlier APSP algorithm [11]. This unweighted APSP algorithm is very simple: each source initiates its distributed BFS in round 1. Each node v retains the best (i.e., shortest) distance estimate it has received for each source, and stores these estimates in sorted order (breaking ties by source id). Let d(s) (or dv(s)) denote the shortest distance estimate for source s at v and let pos(s) be its position in sorted order (pos(s) ≥ 1). In a general round r, node v sends out a shortest distance estimate d(s) if r = d(s) + pos(s). Since d(s) is nondecreasing and pos(s) is increasing, there will be at most one d(s) at v that can satisfy this condition. It is shown in [13] that if the current best distance estimate d(s) for a source s reaches v in round r then r < d(s) + pos(s). Since d(s) < n for any source s and pos(s) is at most n, shortest path values for all sources arrive at any given node v in less than 2n rounds. In the class of graphs that we deal with, d(s) is at most △ for all s, v, and it appears plausible that the above pipelining method would apply here as well. Unfortunately, this does not hold since we allow zero weight edges in the graph. The key to the guarantee that a d(s) value arrives at v before round d(s) + pos(s) in the unweighted case in [13] is that the predecessor y that sent its dy(s) value to v must have had dy(s) = dv(s) − 1. (Recall that in the unweighted case, dy(s) is 4 simply the hop-length of the path taken from s to y.) If we have zero-weight edges this guarantee no longer holds for the weighted path length, and it appears that the key property of the unweighted pipelining methodogy no longer applies. Since edge weights larger than 1 are also possible (as long as no shortest path distance exceeds △) we also have the property that the hop length of a path can be either greater than or less than its weighted distance. 2.1 Our (h, k)-SSP algorithm Algorithm 1 in the next section is our pipelined algorithm for a directed graph G = (V, E) with non-negative edge-weights. The input is G, together with the subset S of k vertices for which we need to compute h-hop shortest path trees. An innovative feature of this algorithm is that the key κ it uses for a path is not its weighted distance, but a function of both its hop length l and its weighted distance d. More specifically, κ = d · γ + l, where γ = pkh/∆. This allows the key to inherit some of the properties from the algorithms in [11, 13] through the fact that the hop length is part of κ's value, while also retaining the weighted distance which is the actual value that needs to be computed. The new key κ by itself is not sufficient to adapt the algorithm for unweighted APSP in [13] to the weighted case. In fact, the use of κ can complicate the computation since one can have two paths from s to v, with weighted distances d1 < d2, and yet for the associated keys one could have κ1 > κ2 (because the path with the smaller weight can have a larger hop-length). Our algorithm handles this with another unusual feature: it may maintain several (though not all) of the key values it receives, and may also send out several key values, even some that it knows cannot correspond to a shortest distance. These features are incorporated into a carefully tailored algorithm that terminates in O(√△kh) rounds with all h-hop shortest path distances from the k sources computed. It is not difficult to show that eventually every shortest path distance key arrives at v for each source from which v is reachable when Algorithm 1 is executed. In order to establish the bound on the number of rounds, we show that our pipelined algorithm maintains two important invariants: Invariant 1: If an entry Z is added to listv in round r, then r < ⌈Z.κ + pos(Z)⌉, where Z.κ is Z ′s key value. Invariant 2: The number of entries for a given source s at listv is at most p△h/k + 1. Invariant 1 is the natural generalization of the unweighted algorithms [11, 13] for the key κ that we use. On the other hand, to the best of our knowledge, Invariant 2 has not been used before, nor has the notion of storing multiple paths or entries for the same source at a given node. By Invariant 2, the number of entries in any list is at most √△kh + k, so pos(Z) ≤ √△kh + k for every list at every round. Since the value of any κ is at most △· γ + h, by Invariant 1 every entry is received by round 2√△kh + k + h. We give the details in the next section, starting with a step-by-step description of Algorithm 1 followed by its analysis. 3 The Pipelined (h, k)-SSP Algorithm We now describe Algorithm 1. Recall that the key value we use for a path π is κ = d · γ + l, where γ = pkh/∆, d is the weighted path length, and l is the hop-length of π. At each node v our 5 Table 1: Notations Global Parameters: S k h △ n γ set of sources number of sources, or S maximum number of hops in a shortest path maximum weighted distance of a shortest path number of nodes parameter equal to phk/∆ Local Variables at node v: x d∗ listv current shortest path distance from x to v; same as d∗ list at v for storing the SP and non-SP entries x,v Variables/Parameters for entry Z = (κ, d, l, x) in listv: κ d l x p ν flag-d∗ pos SP key for Z; κ = d · γ + h weight (distance) of the path associated with this entry hop-length of the path associated with this entry start node (i.e. source) of the path associated with this entry parent node of v on the path associated with this entry number of entries for source x at or below Z in listv (not stored explicitly) flag to indicate if Z is the current SP entry for source x position of Z in listv in a round r; same as posr, posr shortest path v algorithm maintains a list, listv, of the entries and associated data it has retained. Each element Z on listv is of the form Z = (κ, d, l, x), where x is the source vertex for the path corresponding to κ, d, and l. The elements on listv are ordered by key value κ, with ties first resolved by the value of d, and then by the label of the source vertex. We use Z.ν to denote the number of keys for source x stored on listv at or below Z. The position of an element Z in listv is given by pos(Z), which gives the number of elements at or below Z on listv. If the vertex v and the round r are relevant to the discussion we will use the notation posr v(Z), but we will remove either the subscript or the superscript (or both) if they are clear from the context. We also have a flag Z.flag-d∗which is set if Z has the smallest (d, κ) value among all entries for source x (so d is the shortest weighted distance from s to v among all keys for x on listv). A summary of our notation is in Table 1. Initially, when round r = 0, listv is empty unless v is in the source set S. Each source vertex x ∈ S places an element (0, 0, 0, x) on its listx to indicate a path of weight 0 and hop length 0 from x to x, and Z.flag-d∗is set to true. In Step 1 of the Initialization round 0, node v initializes the distance from every source to ∞. In Step 2 every source vertex initializes the distance from itself to 0 and adds the corresponding entry in its list. There are no Sends in round 0. In a general round r, in Step 1 of Algorithm 1, v checks if listv contains an entry Z with ⌈Z.κ + posv(Z)⌉ = r. If there is such an entry Z then v sends Z to its neighbors, along with Z.ν and Z.f lag-d∗ in Step 2. Steps 3-13 describe the steps taken at v after receiving a set of incoming messages I from its neighbors. In Step 7 an entry Z is created from an incoming message M , updated to reflect the d and l values at v. Step 9 checks if Z has a shorter distance than the current shortest path entry, Z ∗, at v, or a shorter hop-length (if the distance is the same), or a parent with smaller ID (if both distance and hop-length are same). And if so, then Z is marked as SP in Step 10 and is then inserted in listv in Step 11. Otherwise, if Z is a non-SP it is inserted into listv in Step 13 only if the number of entries on listv for source x with key < Z.κ in listv is less than Z −.ν. This is the rule that decides if a received entry that is not the SP entry is inserted into listv. Steps 1-4 of procedure Insert perform the addition of a new entry Z to listv. In Step 1 Z is inserted in listv in the sorted order of (κ, d, x). The algorithm then moves on to remove an existing entry for source x on listv if the condition in Step 2 holds. This condition checks if there is a non-SP entry above Z in listv. If so then the closest non-SP entry above Z is removed in Steps 3-4. 6 Initialization: Initialization procedure for Algorithm 1 at node v Input: set of sources S 1: for each x ∈ S do d∗ 2: if v ∈ S then d∗ x ← ∞ v ← 0; add an entry Z = (0, 0, 0, v) to listv; Z.flag-d∗← true Algorithm 1 Pipelined (h, k)-SSP algorithm at node v for round r Input: A set of sources S 1: send [Steps 1-2]: if there is an entry Z with ⌈Z.κ + posr 2: v(Z)⌉ = r then compute Z.ν and form the message M = hZ, Z.flag-d∗, Z.νi and send M to all neighbors 3: receive [Steps 3-13]: let I be the set of incoming messages 4: for each M ∈ I do 5: 6: 7: 8: 9: let M = (Z − = (κ−, d−, l−, x), Z −.flag-d∗, Z −.ν) and let the sender be y. κ ← κ− + w(y, v) · γ + 1; d ← d− + w(y, v); l ← l− + 1 Z ← (κ, d, l, x); Z.flag-d∗← f alse; Z.p ← y let Z ∗ be the entry for x in listv such that Z ∗.flag-d∗= true, if such an entry exists (otherwise d∗ if Z −.flag-d∗= true and l ≤ h and ((d < d∗ (Z may be added to listv in Step 11 or 13) x and Z.κ < Z ∗.κ) or (d = d∗ x) or (d = d∗ x = ∞) x and Z.κ = Z ∗.κ and Z.p < Z ∗.p)) then 10: 11: 12: 13: x ← d; Z.flag-d∗← true; Z ∗.flag-d∗← f alse (if Z ∗ exists) d∗ Insert(Z) else if there are less than Z −.ν entries for x with key ≤ Z.κ then Insert(Z) Insert(Z): Procedure for adding Z to listv 1: insert Z in listv in sorted order of (κ, d, x) 2: if ∃ an entry Z for x in listv such that Z 3: 4: find Z remove Z with smallest pos(Z from listv ′ ′ ′ ′ ′ .flag-d∗= f alse and pos(Z ′ ) > pos(Z) then ) such that pos(Z ′ ) > pos(Z) and Z ′ .flag-d∗= f alse Algorithm 1 performs these steps in successive rounds. We next analyze it for correctness and we also show that it terminates with all shortest distances computed before round r = ⌈2√△kh+k+h⌉. 3.1 Correctness of Algorithm 1 v(Z) and its relation to posr We now provide a sketch for correctness of Algorithm 1. The complete proofs are in Appendix A. The initial Observations and Lemmas given below establish useful properties of an entry Z in a listv y(Z −). We then present the key lemmas. In Lemma 3.9, we and of posr show that the collection of entries for a given source x in listv can be mapped into (d, l) pairs with non-negative l values such that d = d∗ for the shortest path entry, and the d values for all other entries are distinct and larger than d∗. (It turns out that we cannot simply use the d values already present in Z's entries for this mapping since we could have two different entries for source x on listv, Z1 and Z2, that have the same d value. ) Once we have Lemma 3.9 we are able to bound the number of entries for a given source at listv by h γ + 1 in Lemma 3.11, and this establishes Invariant 2 (which is stated in Section 2). Lemma 3.12 establishes Invariant 1. In Lemma 3.13 we establish that all shortest path values reach node v. With these results in hand, the final Lemma 3.14 for the round bound for computing (h, k)-SSP with shortest path distances at most △ is readily established, which then gives Theorem 1.1. Observation 3.1. Let Z be an entry for a source x ∈ S added to listv in round r. Then if Z is removed from listv in a round r′ ≥ r, it was replaced by another entry for x, Z ′, such that posr′ v (Z) > posr′ v (Z ′) and Z.κ ≥ Z ′.κ. Lemma 3.2. Let Z be an entry in listv. Then posr′ Z exists in v's list. v (Z) ≥ posr v(Z) for all rounds r′ > r, for which 7 Observation 3.3. Let Z be an entry for source x that was added to listv. If there exists a non-SP entry for x above Z in listv, then the closest non-SP entry above Z will be removed. Observation 3.4. Let Z − be an entry for source x sent from y to v in round r, and let Z be the corresponding entry created for possible addition to listv in Step 7 of Algorithm 1. If Z is not added to listv, then there is an entry Z ′ 6= Z for source x in listv with Z ′.flag-d∗= true, and there are at least Z −.ν entries for x with key ≤ Z.κ at the end of round r. Lemma 3.5. Let Z be an entry for source x that is present on listv in round r. Let r′ > r, and let c and c′ be the number of entries for source x on listv that have key value less than Z's key value in rounds r and r′ respectively. Then c′ ≥ c. Lemma 3.5 holds for every round greater than r, even if Z is removed from listv. Lemma 3.6. Let Z − be an entry for source x sent from y to v and suppose the corresponding entry Z (Step 7 of Algorithm 2) is added to listv in round r. Then there are at least Z −.ν entries at or below Z in listv for source x. 1 be the (Z −.ν − 1)-th entry for source x in listy. Since Z − Proof. Assume inductively that this result holds for all entries on listv and listy with key value at most Z.κ at all previous rounds and at y in round r as well. (It trivially holds initially.) Let Z − 1 has a key value smaller than Z − it was sent to v in an earlier round r′. If the corresponding entry Z1 created for possible addition to listv in Step 7 of Algorithm 1, was inserted in listv then by inductive assumption there were at least Z − 1 .ν = Z −.ν − 1 entries for x at or below Z1 in listv. And by Lemma 3.5 this holds for round r as well and hence the result follows since Z is present above Z1 in listv. And if Z1 was not added to listv in round r′, then by Observation 3.4 there were already Z −.ν − 1 entries for x with key ≤ Z1.κ and by Lemma 3.5 there are at least Z −.ν − 1 entries for x with key ≤ Z1.κ ≤ Z.κ on listv at round r and hence the result follows. Lemma 3.7. Let Z − be an entry sent from y to v in round r and let Z be the corresponding entry created for possible addition to listv in Step 7 of Algorithm 1. For each source xi ∈ S, let there be exactly ci entries for xi at or below Z − in listy. If Z is added to listv, then for each xi ∈ S, there are at least ci entries for xi at or below Z in listv. Corollary 3.8. Let Z − be an entry sent from y to v in round r and let Z be the corresponding entry created for possible addition to listv in Step 7 of Algorithm 1. If Z is added to listv, then posr y(Z −) ≤ posr v(Z). x if Z is a current shortest path entry, otherwise d > d∗ x. Lemma 3.9. Let C be the entries for a source x ∈ S in listv in round r. Then the entries in C can be mapped to (d, l) pairs such that each l ≥ 0 and each Z ∈ C is mapped to a distinct d value with Z.κ = d · γ + l. Also d = d∗ Proof. We will establish this result by induction on j, the number of entries in C. For the base case, when j = 1, we can map d and l to the pair in the single entry Z since Z.κ = d · γ + l. Assume inductively that the result holds at listu for all nodes u when the number of entries for x is at most j − 1. Consider the first time C becomes j at listv, and let this occur when node y sends Z − to v and this is updated and inserted as Z in listv in round r. If Z is inserted as a new shortest path entry with distance value d∗, then the distinct d values currently assigned to the j − 1 entries for source x in listv must all be larger than d∗ hence we can simply assign the d and l values in Z as its (d, l) mapping. 8 If Z is inserted as a non-SP entry then it is possible that the d value in Z has already been assigned to one of the j − 1 entries for source x on listv. If this is the case, consider the entries for source x with key value at most Z −.κ in listy (at node y). By the check in Step 13 of Algorithm 1 we know that there are j such values. Inductively these j entries have j distinct d− values assigned to them, and we transform these into j distinct values for listv by adding w(y, v)· γ + 1 to each of them. For at least one of these d− values in y, call it d− 1 , it must be the case that d′ = d− 1 + w(y, v) · γ + 1 is not assigned to any of the j − 1 entries for source x below Z in listv. Let Z − 1 be the entry in y's list that is associated with distance d− 1 . It is readily seen that the associated l value for d′ in Z on listv must be greater than 0 and the distance value d′ + w(y, v) 6= d∗ x (see proof in Appendix A). So we can assign this d value to Z. We do not need to consider non-SP entries above Z since if there were one, the closest one above Z would have been deleted and j − 1 would not have increased to j. In the general case when the number of entries remains at j after the insert we do need to consider the possibility of the new value assigned to Z being duplicated at an entry Z ′ above Z. But here we can assign to Z ′ the d value previously given to the removed entry (and the l needed for Z ′.κ will be non-negative because the removed entry must have been below Z ′ on listv). Lemma 3.10. Let Z be the current shortest path distance entry for a source x ∈ S in v's list. Then the number of entries for x below Z in listv is at most h/γ. Proof. By Lemma 3.9, we know that the keys of all the entries for x can be mapped to (d, l) pairs such that each entry is mapped to a distinct d value and l > 0. We have Z.κ = d∗ entry for x below Z in v's list. Then, Z ≥ d∗ which gives d .κ ≤ Z.κ. It implies that d x, there can be at most h/γ entries for x below Z in listv. x is the hop-length of the shortest path from x to v. Let Z ) < d∗ x · γ + l∗ x+h/γ. Since d be an x·γ + h x·γ + (l∗ x, where l∗ ·γ ≤ d∗ x− l < d∗ ′′ ′′ ′′ ′′ ′′ ′′ Using Lemma 3.10 we can show that there are at most h/γ + 1 entries for source x in listv in the case when the entry for the shortest distance for x is not the topmost entry in listv. Lemma 3.11. For each source x ∈ S, v's list has at most h/γ + 1 entries for x. In Lemmas 3.12-3.13 we establish an upper bound on the round r by which v receives a shortest path entry Z ∗. Lemma 3.12. If an entry Z is added to listv in round r then r < ⌈Z.κ + posr Proof. The lemma holds in the first round since all entries have non-negative κ, any received entry has hop length at least 1, and the lowest position is 1 so for any entry Z received by v in round 1, ⌈Z.κ + pos1 Let r be the first round (if any) in which the lemma is violated, and let it occur when entry Z is added to listv. So r ≥ ⌈Z.κ + posr Since Z was added to listv in round r, Z − was sent to v by a node y in round r. So by Step 1 y(Z −), hence r must be less than r = ⌈Z −.κ + posr ⌈Z.κ + posr v(Z)⌉. Lemma 3.13. Let π∗ among h-hop shortest paths from x to v. Let π∗ v receives an entry Z ∗ = (κ, d∗ x,v be a shortest path from source x to v with the minimum number of hops x,v. Then y(Z −)⌉. But Z.κ > Z −.κ and posr x,v have l∗ hops and shortest path distance d∗ v(Z)⌉ (so r1 ≤ r by assumption). v(Z)⌉. Let r1 = ⌈Z.κ + posr v(Z)⌉ ≥ 1 + 1 > 1. v(Z) ≥ posr v(Z)⌉. x,v, l∗, x) by round r < ⌈Z ∗.κ + posr v(Z ∗)⌉. 9 Proof. If an entry Z ∗ = (κ, d∗ before round ⌈Z ∗.κ + posr It remains to show that an entry for path π∗ by induction on key value κ. v(Z ∗)⌉ and hence it will be sent in round r = ⌈Z ∗.κ + posr x,v, l∗, x) is placed on listv by v then by Lemma 3.12 it is received v(Z ∗)⌉ in Step 2. x,v is received by v. We establish this for all pairs x, v If κ = 0, then it implies that the shortest path is the vertex x itself and thus the statement holds for κ = 0. Let us assume that the statement holds for all keys < κ and consider the path π∗ x,v with key κ = d∗ Let (y, v) be the last edge on the path π∗ x,v from x to y. By construction the path π∗ x,y is a shortest path from x to y and its hop length l∗ − 1 is the smallest among all shortest paths from x to y. Hence by the inductive assumption an entry Z − with Z −.κ = d∗ x,y · γ + l∗ − 1 (which is strictly less than Z ∗.κ) is received by y before round y (Z −)⌉ in ⌈Z −.κ + pos Step 2. Thus v adds the shortest path entry for x, Z ∗, to listv by end of round r′. y(Z −)⌉ (by Lemma 3.12) and is then sent to v in round r′ = ⌈Z −.κ + posr′ x,y be the subpath of π∗ x,v and let π∗ x,v · γ + l∗. ′ In Lemma 3.14 we establish an upper bound on the round r by which Algorithm 1 terminates. Lemma 3.14. Let ∆ be the maximum shortest path distance in the h-hop paths. Algorithm 1 correctly computes the h-hop shortest path distances from each source x ∈ S to each node v ∈ V by round ⌈△γ + h + △ · γ + k⌉. Proof. An h-hop shortest path has hop-length at most h and weight at most △, hence a key corresponding to a shortest path entry will have value at most △γ + h. Thus by Lemma 3.13, for every source x ∈ S every node v ∈ V should have received the shortest path distance entry, Z ∗, for source x by round r = ⌈△γ + h + posr Now we need to bound the value of posr v(Z ∗). By Lemma 3.11, we know that there are at most h/γ + 1 entries for each source x ∈ S in a node v's list. Now as there are k sources, v's list has at most (h/γ +1)·k ≤ γ·△+k entries, thus posr Since γ = phk/∆, Lemma 3.14 establishes Theorem 1.1. v(Z ∗) ≤ γ·△+k and hence r ≤ ⌈∆γ +h+γ·∆+k⌉. v(Z ∗)⌉. 4 Conclusion We have presented a new approach to the distributed computation of shortest paths in a graph with non-negative integer weights (including zero weights). Our deterministic pipelined distributed algorithms for weighted shortest paths (both APSP, and for k sources) is novel and very simple. Its asymptotic performance improves on O(n3/2) rounds, the current best deterministic distributed algorithm for this problem [2], only in very special cases when shortest path distances are smaller than n. But the algorithm may be relevent even for larger shortest path lengths since it is very simple, and has the very small constant factor 2 in the leading term. As noted in the introduction, we have built on this algorithm to achieve several new results, including improved deterministic APSP for moderately large non-negative integer weights (including zero weights) [1]. A major open problem left by our work is whether we can come up with a similar pipelining strategy when working with the scaled graph in Gabow's scaling technique [5]. Our current pipelined algorithm assumes that all sources see the same weight on each edge, while in the scaling algorithm each source sees a different edge weight on a given edge. We could obtain a deterministic O(n4/3)- round APSP algorithm with non-negative polynomially bounded integer weights if our pipelined 10 strategy can be made to work with Gabow's scaling technique [5]. While this can be handled with n different SSSP computations in conjunction with the randomized scheduling result of Ghaffari [6], it will be very interesting to see if a deterministic pipelined strategy could achieve the same result. References [1] U. Agarwal and V. Ramachandran. New and simplified distributed algorithms for weighted all pairs shortest paths. arXiv:1810.08544, 2018. [2] U. Agarwal, V. Ramachandran, V. King, and M. Pontecorvi. A deterministic distributed algorithm for exact weighted all-pairs shortest paths in O(n3/2) rounds. In Proc. PODC, pages 199 -- 205. ACM, 2018. [3] E. W. Dijkstra. A note on two problems in connexion with graphs. Numerische mathematik, 1(1):269 -- 271, 1959. [4] M. Elkin. Distributed exact shortest paths in sublinear time. In Proc. STOC, pages 757 -- 770. ACM, 2017. [5] H. N. Gabow. Scaling algorithms for network problems. J. Comp. Sys. Sci., 31(2):148 -- 168, 1985. [6] M. Ghaffari. Near-optimal scheduling of distributed algorithms. In Proc. PODC, pages 3 -- 12. ACM, 2015. [7] M. Ghaffari and J. Li. Improved distributed algorithms for exact shortest paths. In Proc. STOC, pages 431 -- 444. ACM, 2018. [8] C.-C. Huang, D. Nanongkai, and T. Saranurak. Distributed exact weighted all-pairs shortest paths in O(n5/4) rounds. In Proc. FOCS, pages 168 -- 179. IEEE, 2017. [9] S. Krinninger and D. Nanongkai. A faster distributed single-source shortest paths algorithm. In Proc. FOCS. IEEE, 2018. [10] C. Lenzen and B. Patt-Shamir. Fast partial distance estimation and applications. In Proc. PODC, pages 153 -- 162. ACM, 2015. [11] C. Lenzen and D. Peleg. Efficient distributed source detection with limited bandwidth. In Proc. PODC, pages 375 -- 382. ACM, 2013. [12] D. Nanongkai. Distributed approximation algorithms for weighted shortest paths. In Proc. STOC, pages 565 -- 573. ACM, 2014. [13] M. Pontecorvi and V. Ramachandran. Distributed algorithms for directed betweenness cen- trality and all pairs shortest paths. arXiv:1805.08124, 2018. 11 A Appendix: Correctness of Algorithm 1 Observations and Lemmas 3.1-3.6: In the following Observations and Lemmas we point out the key facts about an entry Z in listv in our Algorithm 1. We use these in our proofs in this section. Observation. 3.1. Let Z be an entry for a source x ∈ S added to listv in round r. Then if Z is removed from listv in a round r′ ≥ r, it was replaced by another entry for x, Z ′, such that posr′ v (Z) > posr′ v (Z ′) and Z.κ ≥ Z ′.κ. Proof. An entry is removed from listv only in Step 4 of Insert, and this occurs at most once in round r′ (through a call from either Step 11 or Step 13 of Algorithm 1). But immediately before that removal an entry Z ′ with a smaller value was inserted in listv in Step 1 of Insert. Lemma. 3.2. Let Z be an entry in listv. Then posr′ Z exists in v's list. v (Z) ≥ posr v(Z) for all rounds r′ > r, for which Proof. If not, then it implies that there exists Z ′ such that Z ′ was below Z in v's list in round r and was replaced by another entry Z > r and hence posr ). But by Observation 3.1 this cannot happen and thus resulting in a v (Z contradiction. that was above Z in a round r such that r′ ≥ r ′′ ′′ ′′ ′′ ) > posr v (Z ′ ′′ ′′ Observation. 3.3. Let Z be an entry for source x that was added to listv. If there exists a non-SP entry for x above Z in listv, then the closest non-SP entry above Z will be removed from listv. Proof. This is immediate from Steps 1-4 of the procedure Insert. Observation. 3.4. Let Z − be an entry for a source x sent from y to v in round r, and let Z be the corresponding entry created for possible addition to listv in Step 7 of Algorithm 1. If Z is not added to listv, then there is an entry Z ′ 6= Z in listv with Z ′.flag-d∗= true, and there are at least Z −.ν entries for x with key ≤ Z.κ at the end of round r. Proof. This is immediate from Steps 8 and 9 of Algorithm 1 where the current entry Z ∗ with Z ∗.flag-d∗= true is verified to have a shorter distance (or a smaller key if Z and Z ∗ have the same distance), and by the check in Step 13. Observation A.1. Let Z ∗ be a current SP entry for a source x ∈ S present in listv. Then Z ∗.l ≤ h. Proof. This is immediate from the check in Step 9. The above Observation should be contrasted with the fact that listv could contain entries Z with Z.l > h, but only if flag-d∗(Z) = f alse. In fact it is possible that listv contains an entry Z ′ 6= Z ∗ with Z ′.d = d∗ and l > h since such an entry would fail the check in Step 9 but could then be inserted in Step 13 of Algorithm 1. Lemma. 3.5. Let Z be an entry for source x that is present on listv in round r. Let r′ > r, and let c and c′ be the number of entries for source x on listv that have key value less than Z's key value in rounds r and r′ respectively. Then c′ ≥ c. 12 Proof. If c′ < c then an entry for x that was present below Z in round r must have been removed without having another entry for x being inserted below Z. But by Observation 3.1 this is not possible since any time an entry for source x is removed from listv another entry for source x with smaller key value is inserted in listv. Lemma 3.5 holds for every round greater than r, even if Z is removed from listv. The following stronger lemma holds for rounds greater than r when Z remains on listv. Lemma A.2. Let Z be a non-SP entry for source x that is present on listv in round r. Let r′ > r, and let c and c′ be the number of entries for source x on listv that have key value less than Z's key value in rounds r and r′ respectively. Then c′ = c. ′ Proof. If a new entry Z entry for x with key > Z we have c′ = c. ′ with key < Z.κ for x is added, then by Observation 3.3 the closest non-SP ≤ c. Then using Lemma 3.5 .κ must be removed from listv and thus c ′ Lemma. 3.6. Let Z − be an entry for source x sent from y to v and suppose the corresponding entry Z (Step 7 of Algorithm 2) is added to listv in round r. Then there are at least Z −.ν entries at or below Z in listv for source x. 1 be the (Z −.ν − 1)-th entry for source x in listy. Since Z − Proof. Let us assume inductively that this result holds for all entries on listv and listy with key value at most Z.κ at all previous rounds and at y in round r as well. (It trivially holds initially.) Let Z − 1 has a key value smaller than Z − it was sent to v in an earlier round r′. If the corresponding entry Z1 created for possible addition to listv in Step 7 of Algorithm 1, was inserted in listv then by inductive assumption there were at least Z − 1 .ν = Z −.ν − 1 entries for x at or below Z1 in listv. And by Lemma 3.5 this holds for round r as well and hence the result follows since Z is present above Z1 in listv. And if Z1 was not added to listv in round r′, then by Observation 3.4 there were already Z −.ν − 1 entries for x with key ≤ Z1.κ and by Lemma 3.5 there are at least Z −.ν − 1 entries for x with key ≤ Z1.κ ≤ Z.κ on listv at round r and hence the result follows. y(Z−) ≤ posr v(Z): For an entry Z − sent from y to v such that Z is the cor- Establishing posr responding entry created for possible addition to listv in Step 7 of Algorithm 1, in Lemma 3.7 and Corollary 3.8 we establish that if Z is added to listv then posr v(Z), which is an important property of pos. y(Z −) ≤ posr Lemma. 3.7. Let Z − be an entry sent from y to v in round r and let Z be the corresponding entry created for possible addition to listv in Step 7 of Algorithm 1. For each source xi ∈ S, let there be exactly ci entries for xi at or below Z − in listy. If Z is added to listv, then for each xi ∈ S, there are at least ci entries for xi at or below Z in listv. Proof. If not there exists an xi ∈ S with strictly less than ci entries for xi at or below Z in listv. Let Z − 1 is not Z −, it is below Z − in listy and so was sent in a round r′ < r; if Z − 1 = Z − then r′ = r. Let Z1 be the corresponding entry created for possible addition to listv in Step 7 of Algorithm 1. 1 be the ci-th entry for xi in listy (if xi is Z's source, then Z − 1 is Z −). If Z − If Z1 was added to listv and is also present in listv in round r, then by Lemma 3.6 and 3.5, there will be at least ci entries for xi at or below Z1, resulting in a contradiction. And if Z1 was removed 13 ′′ < r, then by Lemma 3.5, the number of entries for xi with key ≤ Z1.κ from listv in a round r should be at least cj. Now if Z1 was not added to listv in round r′, then by Observation 3.4, we must already have at least ci entries for xi with key ≤ Z1.κ in round r′ and by Lemma 3.5, this must hold for all rounds r > r as well. ′′ Corollary. 3.8. Let Z − be an entry sent from y to v in round r and let Z be the corresponding entry created for possible addition to listv in Step 7 of Algorithm 1. If Z is added to listv, then posr y(Z −) ≤ posr v(Z). A.1 Establishing an Upper bound on Z.ν x if Z is a current shortest path entry, otherwise d > d∗ x. In this section (Lemmas 3.9-3.11) we establish an upper bound on the value of Z.ν. This upper bound on Z.ν immediately gives a bound on the maximum number of entries that can be present in listv for a source x ∈ S. Lemma. 3.9. Let C be the entries for a source x ∈ S in listv in round r. Then the entries in C can be mapped to (d, l) pairs such that each l ≥ 0 and each Z ∈ C is mapped to a distinct d value with Z.κ = d · γ + l. Also d = d∗ Proof. We will establish this result by induction on j, the number of entries in C. For the base case, when j = 1, we can map d and l to the pair in the single entry Z since Z.κ = d · γ + l. Assume inductively that the result holds at listu for all nodes u when the number of entries for x is at most j − 1. Consider the first time C becomes j at listv, and let this occur when node y sends Z − to v and this is updated and inserted as Z in listv in round r. If Z is inserted as a new shortest path entry with distance value d∗, then the distinct d values currently assigned to the j − 1 entries for source x in listv must all be larger than d∗ hence we can simply assign the d and l values in Z as its (d, l) mapping. If Z is inserted as a non-SP entry then it is possible that the d value in Z has already been assigned to one of the j − 1 entries for source x on listv. If this is the case, consider the entries for source x with key value at most Z −.κ in listy (at node y). By the check in Step 13 of Algorithm 1 we know that there are j such values. Inductively these j entries have j distinct d− values assigned to them, and we transform these into j distinct values for listv by adding w′ x(y, v) · γ + 1 to each of them. For at least one of these d− values in y, call it d− x(y, v)· γ + 1 is not assigned to any of the j − 1 entries for source x below Z in listv. Let Z − 1 be the entry in y's list that is associated with distance d− 1 . We show that the associated l value for d′ in Z on listv must be greater than 0. 1 , it must be the case that d′ = d− 1 + w′ (d′ + w′ x(y, v)) · γ + l = Z.κ = Z −.κ + w′ ≥ Z − 1 .κ + w′ = d′ · γ + l− = (d′ + w′ x(y, v) · γ + 1 x(y, v) · γ + 1 1 + w′ x(y, v)) · γ + l− x(y, v) · γ + 1 1 + 1 Hence l ≥ l− 1 + 1 > 0. 14 (since (posy(Z −) > posy(Z − 1 ))) x(y, v) 6= d∗ x. If not then by induction, 1 for x in y's list correspond to the current shortest path entry for x in 1 gives the shortest path distance from x to y, the corresponding shortest path entry x associated with it. This results x(y, v), such that it was different from Since Z is a non-SP entry we also need to argue that d′ + w′ it implies that the entry Z − listy. Since Z − for x must be below Z in v's list and by induction, it must have d∗ in a contradiction since we chose the distance value, d′ + w′ the distances associated with the other (j − 1) entries for x in v's list. We have shown that the lemma holds the first time a j-th entry is added to listv for source x. To complete the proof we now show that the lemma continues to hold if a new entry Z for source x is added to listv while keeping the number of entries at j. The argument is the same as the case of having j entries for source x for the first time except that we also need to consider duplication of a d value at an entry above the newly inserted Z. For this we proceed as in the previous case. Let Z be inserted in position p ≤ j. We assign a d value to Z as in the previous case, taking care that the d value assigned to Z is different from that for the p − 1 entries below Z. Suppose Z's d value has been assigned to another entry Z ′′ in listv above Z. Then, we consider Z ′, the entry that was removed (in Step 5 of Insert) in order to keep the total number of entries for source x at j. We assign to Z ′′ the value d′ that was assigned to Z ′. Since Z ′′ has a larger key value than Z ′ we will need to use an l′′ at least as large as that used for Z ′ (call it l′) in order satisfy the requirement that Z ′′.κ = d′ · κ + l′′. Since l′ must have been non-negative, l′′ will also be non-negative as required, and all d values assigned to the entries for x will be distinct. Lemma. 3.10. Let Z be the current shortest path distance entry for a source x ∈ S in v's list. Then the number of entries for x below Z in listv is at most γ · n k . Proof. By Lemma 3.9, we know that the keys of all the entries for x can be mapped to (d, l) pairs such that each entry is mapped to a distinct d value and l > 0. We have Z.κ = d∗ an entry for x below Z in v's list. Then, Z x is the hop-length of the shortest path from x to v. Let Z x · γ + l∗ x, where l∗ be ′′ ′′ .κ ≤ Z.κ. It implies x x · γ + l∗ x · γ + (l∗ (l∗ x − l x + γ x − l ) ′′ ′′ ) ′′ ′′ ≤ d∗ · γ ≤ d∗ ≤ d∗ d ≤ d∗ < d∗ x + x + ′′ d · γ + l d ′′ (h − 1) γ h γ h γ2 · γ n k · γ = d∗ x + = d∗ x + ′′ < d∗ x + n x, there can be at most n Thus d Lemma. 3.11. For each source x ∈ S, v's list has at most n k · γ. Since d ≥ d∗ ′′ k · γ entries for x below Z in listv. k · γ + 1 entries for x. 15 Proof. On the contrary, let Z be an entry for source x ∈ S with the smallest key such that Z is the (γ · n k + 2)-th entry for x in listv. Let y be the sender of Z to v and let the corresponding entry in y's list be Z −. If Z was added as a non-SP entry, then by Lemma 3.6 there are at least γ · n k + 2 entries for x at or below Z − in listy, resulting in a contradiction as Z is the entry with the smallest key that have this ν value. Otherwise if Z was added as a current shortest path entry, then by Lemma 3.10, Z can have at most γ · n k + 1 at or below Z in listv in all rounds (and if Z is later marked as non-SP then by Lemma A.2 Z.ν will stay fixed at that value), again resulting in a contradiction. k entries below it in any round and hence there are at most γ · n A.2 Establishing an Upper Bound on the round r by which an entry Z is sent Lemma. 3.12. If an entry Z is added to listv in round r then r < Z.κ + posr v(Z). Proof. The lemma holds in the first round since all entries have non-negative κ, any received entry has hop length at least 1, and the lowest position is 1 so for any entry Z received by v in round 1, Z.κ + pos1 v(Z) ≥ 1 + 1 > 1. Let r be the first round (if any) in which the lemma is violated, and let it occur when entry Z is added to listv. So r ≥ Z.κ + posr Since Z was added to listv in round r, Z − was sent to v by a node y in round r. So r = Z −.κ + posr y(Z −), hence r must be less than Z.κ + posr y(Z −). But Z.κ > Z −.κ and posr v(Z) (so r1 < r by assumption). v(Z). Let r1 = Z.κ + posr v(Z). v(Z) ≥ posr Lemma. 3.13. Let π∗ among h-hop shortest paths from x to v. Let π∗ v receives an entry Z ∗ = (κ, d∗ x,v be a shortest path from source x to v with the minimum number of hops x,v. Then x,v have l∗ hops and shortest path distance d∗ x,v, l∗, x) by round r < Z ∗.κ + posr v(Z ∗). Proof. If an entry Z ∗ = (κ, d∗ before round Z ∗.κ + posr remains to show that an entry for path π∗ induction on key value κ. v(Z ∗) and hence it will be sent in round r = Z ∗.κ + posr x,v, l∗, x) is placed on listv by v then by Lemma 3.12 it is received v(Z ∗) in Step 1. It x,v is received by v. We establish this for all pairs x, v by x,v · γ + l∗. If κ = 0, then it implies that the shortest path is the vertex x itself and thus the statement holds for κ = 0. Let us assume that the statement holds for all keys < κ and consider the path π∗ x,v with key κ = d∗ Let (y, v) be the last edge on the path π∗ x,v from x to y. x,y is a shortest path from x to y and its hop length l∗ − 1 is the By construction the path π∗ smallest among all shortest paths from x to y. Hence by the inductive assumption an entry Z − x,y · γ + l∗ − 1 (which is strictly less than Z ∗.κ) is received by y before round with Z −.κ = d∗ y (Z −) in Step 1. Z −.κ + pos Thus v adds the shortest path entry for x, Z ∗, to listv by the end of round r′. y(Z −) (by Lemma 3.12) and is then sent to v in round r′ = Z −.κ + posr′ x,y be the subpath of π∗ x,v and let π∗ ′ 16 A.3 Establishing an Upper Bound on the round r by which Algorithm 1 ter- minates Lemma. 3.14. Algorithm 1 correctly computes the h-hop shortest path distances from each source x ∈ S to each node v ∈ V by round (n − 1)γ + h + n · γ + k. Proof. An h-hop shortest path has hop-length at most h and weight at most n − 1, hence a key corresponding to a shortest path entry will have value at most (n − 1)γ + h. Thus by Lemma 3.13, for every source x ∈ S every node v ∈ V should have received the shortest path distance entry, Z ∗, for source x by round r = (n − 1)γ + h + posr Now we need to bound the value of posr γ · n most (γ· n Since γ = q hk v(Z ∗). By Lemma 3.11, we know that there are at most k + 1 entries for each source x ∈ S in a node v's list. Now as there are k sources, v's list has at n , Lemma 3.14 establishes the bounds given in Theorem 1.1. k +1)·k ≤ γ·n+k entries, thus posr v(Z ∗) ≤ γ·n+k and hence r ≤ (n−1)γ +h+γ·n+k. v(Z ∗). 17
1210.7638
10
1210
2018-07-03T15:19:18
Finding Efficient Region in The Plane with Line segments
[ "cs.DS", "cs.CG" ]
Let $\mathscr O$ be a set of $n$ disjoint obstacles in $\mathbb{R}^2$, $\mathscr M$ be a moving object. Let $s$ and $l$ denote the starting point and maximum path length of the moving object $\mathscr M$, respectively. Given a point $p$ in ${R}^2$, we say the point $p$ is achievable for $\mathscr M$ such that $\pi(s,p)\leq l$, where $\pi(\cdot)$ denotes the shortest path length in the presence of obstacles. One is to find a region $\mathscr R$ such that, for any point $p\in \mathbb{R}^2$, if it is achievable for $\mathscr M$, then $p\in \mathscr R$; otherwise, $p\notin \mathscr R$. In this paper, we restrict our attention to the case of line-segment obstacles. To tackle this problem, we develop three algorithms. We first present a simpler-version algorithm for the sake of intuition. Its basic idea is to reduce our problem to computing the union of a set of circular visibility regions (CVRs). This algorithm takes $O(n^3)$ time. By analysing its dominant steps, we break through its bottleneck by using the short path map (SPM) technique to obtain those circles (unavailable beforehand), yielding an $O(n^2\log n)$ algorithm. Owing to the finding above, the third algorithm also uses the SPM technique. It however, does not continue to construct the CVRs. Instead, it directly traverses each region of the SPM to trace the boundaries, the final algorithm obtains $O(n\log n)$ complexity.
cs.DS
cs
Finding Achievable Region among Line-segment Obstacles in the Plane Zhi Jie Wang Bin Yao Department of Computer Science and Engineering, Shanghai Jiao Tong University Department of Computer Science and Engineering, Shanghai Jiao Tong University Shanghai, China [email protected] Shanghai, China [email protected] 3 1 0 2 v o N 2 1 ] S D . s c [ 8 v 8 3 6 7 . 0 1 2 1 : v i X r a ABSTRACT We propose and study a new class of problem, called finding achiev- able region (FAR). Let O be a set of n disjoint obstacles in R2, M be a moving object. Let s and l denote the starting point and max- imum path length of the moving object M, respectively. Given a point p in R2, we say the point p is achievable for M such that p (s, p) ≤ l, where p (·) denotes the shortest path length in the pres- ence of obstacles. The FAR problem is to find a region R such that, for any point p ∈ R2, if it is achievable for M, then p ∈ R; other- wise, p /∈ R. The FAR problem has a variety of applications rang- ing from location-based service, probabilistic answer on uncertain data, to moving target search. In this paper, we restrict our attention to the case of line-segment obstacles. To tackle this problem, we develop three algorithms. We first present a simpler-version algo- rithm for the sake of intuition. Its basic idea is to reduce our prob- lem to computing the union of a set of circular visibility regions (CVRs). In order to obtain the CVRs, we adopt the spatial pruning mechanism and incorporate the idea of the rotational plane sweep. Furthermore, for most CVRs, the circles used to construct them are unavailable beforehand. We adopt the visibility graph technique to obtain those circles. This algorithm takes O(n3) time. By analysing MPL its dominant steps, we break through its bottleneck by using the short path map (SPM) technique to obtain those circles (unavail- able beforehand), yielding an O(n2 log n) algorithm. Owing to the finding above, the third algorithm also uses the SPM technique. It however, does not continue to construct the CVRs. Instead, it di- rectly traverses each region of the SPM to trace the boundaries, the final algorithm obtains the O(nlog n) worst case upper bound. 1. INTRODUCTION Suppose there are a set O of n disjoint obstacles and a moving object M in R2, and suppose M freely moves in R2 except that it cannot be allowed to directly pass through any obstacle o ∈ O. See the right figure for example. The black line-segments denote the set of obstacles, and the black dot Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. WOOD**** 'XX, Location, City, Nation Copyright 20XX ACM X-XXXXX-XX-X/XX/XX ...$15.00. denotes the starting point of M, the grey line-segment denotes the maximum path length that M is allowed to travel. We address the problem, how to find a region R such that, for any point p if M can reach it, then p ∈ R; otherwise, p /∈ R. (See Section 2 for more formal definitions and other constraint conditions.) Clearly, if there is no obstacle in R2, the answer is a circle, denoted by C(s, l), where s and l denote the center and radius of the circle, respectively. Now consider the case of one obstacle as shown in Figure 1(a). Firstly, we can easily know any point in the region bounded by the solid lines is achievable for M, without the need of making a turn, see Figure 1(b). Secondly, we can also easily know any point in the circle C(a, dist(a, v1)) is achievable for M, where dist(·) denotes the Euclidean distance, see Figure 1(c). Sim- ilarly, we can get another circle C(b, dist(b, v2)), see Figure 1(d). Naturally, we can get the answer by merging the three regions, i.e., two circles and a circular-arc polygon. By investigating the simplest case, we seemingly can derive a rough solution called RS as follows. Firstly, we obtain the region denoted by Rd in which any point is achievable for M, without the need of making a turn. Second, for each vertex (or endpoint) v of obstacles, if p (s, v) < l, we obtain the circle centered at v and with the radius l − p (s, v), where p (·) denotes the shortest path length in the presence of obstacles. Finally, we merge all the regions ob- tained in the previous two steps. Is it really so simple? (See Section 2 for a more detailed analysis.) 1 2 (a) (b) (c) (d) Figure 1: The simplest case. The black dot s and solid line ab denote the starting point of M and the obstacle, respectively. Motivations. Our study is motivated by the increasing popularity of location-based service [29, 32] and probabilistic answer on un- certain data [28, 1]. Nowadays, many mobile devices, such as cell phones, PDAs, taxies are equipped with GPS. It is common for the service provider to keep track of the user' s location, and provide many location-based services, for instance finding the taxies being located in a query range, finding the nearest supermarkets or ATMs, etc. The database sever, however, is often impossible to contain the total status of an entity, due to the limited network bandwidth and limited battery power of the mobile devices. This implies that the current location of an entity is uncertain before obtaining the next specific location. In this case, it is meaningful to use a closed region to represent the possible location of an entity [6, 34]. In database community, they usually assumed this region is available beforehand, which is impractical. A proper manner to obtain such a region is generally based on the following information: geographi- cal information around the entity, say GI, the (maximum) speed of the entity, say VM, and the elapsed time, say TE . By substituting "VM · TE" with the maximum path length l, GI with obstacles O, it corresponds to our problem. Our problem also finds applications in the so-called moving tar- get search [19, 36]. Traditionally, moving target search is the prob- lem where a hunter has to catch a moving target, and they assumed the hunter always knows the current position of the moving target [36]. In many scenarios (e.g., when the power of GPS - equipped with the moving target- is used up, or in a sensor network envi- ronment, when the moving target walked out of the scope of being minitored), it is possible that the current position of the moving target cannot be obtained. In this case, we can infer the available region based on some available knowledge such as the geograph- ical information and the previous location. The available region here can contribute to the reduction of search range. Related work. Although our problem is easily stated and can find many applications, to date, we are not aware of any published re- sult. Our problem is generally falls in the realm of computational geometry. In this community, the problem of computing the visi- bility polygon (VP, a.k.a., visibility region) [14, 2, 37] is the most similar to our problem. Given a point p and a set of obstacles in a plane, this problem is to find a region in which each point is visible from p. There are three major differences between our problem and the VP problem: (i) our problem has an extra constraint, i.e., the maximum path length l, whereas the VP problem does not involve this concept; (ii) in the VP problem, the region behind the obstacle must not be visible, whereas in our problem it may be achievable by making a turn; and (iii) the VP problem does not involve the circular arc segments, whereas in our problem we have to handle a number of circular arc segments. It is easy to see that our problem is more complicated. We note that the Euclidean shortest path problem [21, 18, 3, 33, 23, 17, 31, 35] also involves the obstacles and the path length. In these two aspects it is similar to our problem. Given two points p and p∗, and a set of obstacles in a plane, this problem is to find the shortest path between p and p∗ that does not intersect with any of the obstacles. It is different from our problem in three points at least: (i) this problem is to find a path, whereas our problem is to find a region; (ii) the starting point and ending point are known beforehand in this problem, whereas the ending point in our prob- lem is unknown beforehand; and (iii) the shortest path length is unknown beforehand in this problem, whereas the maximum path length l in our problem is given beforehand. Finally, our problem shares at least a common aspect(s) with other visibility problems [38, 20, 30, 9, 26, 27, 16] in this com- munity, since they all involve the concept of obstacles. But they are more or less different from our problem. The art gallery problem [20] for example is to find a minimum set S of points such that for any point q in a simple polygon P, there is at least a point p ∈ S such that the segment pq does not pass through any edge of P. The edges of P here correspond to the obstacles. The differences be- tween this problem and our problem is obvious since our problem is to find a region rather than a minimum set of points. More details about the visibility problems please refer to the textbooks, e.g., [11, 8]. Our contributions. We formulate the problem - finding achiev- able region, offer insights into its nature, and develop multiple al- gorithms to tackle it. Specifically, in Section 3, we present a simpler-version algo- rithm for the sake of intuition. The basic idea of this algorithm is to reduce our problem to computing the union of a set of circu- lar visibility regions (CVRs), defined in Section 2. Intuitively, the CVR can be obtained by computing a boolean union of the visibil- ity region and the circle. The visibility region however, may not be always bounded, which leads to some troubles and makes this straightforward idea to be difficult to develop. We adopt a different way to compute the CVR instead of directly solving those trou- bles. Specifically, we first prune some unrelated obstacles based on a simple but efficient pruning mechanism that ensures all can- didate obstacles to be located in the circle, which can simplify the subsequent computation. After this, we use the idea of the rota- tional plane sweep to construct the CVR, whose boundaries are represented as a series of vertexes and appendix points (defined in Section 2) that are stored using a double linked list. We note that, for most CVRs, the circles used to construct them are unavailable beforehand. We use the visibility graph technique to obtain the cir- cle. Once we obtain a new CVR, we merge it with the previous one. In this way, we finally get our wanted answer, i.e., the achievable region R. This algorithm takes O(n3) time. We analyse the dominant steps of the first algorithm, and break through its bottleneck by incorporating the short path map (SPM) technique. Specifically, in Section 4, we show the SPM technique, previously used to answer the short path queries among polygonal obstacles, can be equivalently applied to the context of our con- cern. We use this technique to obtain those circles (that are used to construct most CVRs). Obtaining each circle needs O(n2) time in the first algorithm, it takes (only) O(logn) time by using the SPM technique. This improvement immediately yields an O(n2 log n) algorithm. Thanking the realization in Section 4 - the SPM technique can be used to the context of our concern, the third algorithm presented in Section 5 also uses this technique. It however, does not continue to construct the CVRs. Instead, it directly traverse each region of the SPM to trace the boundaries. By doing so, it gets a circular kernel-region and many circular ordinary regions. (Some circu- lar ordinary regions possibly consist of not only circular arc and straight line segments but also hyperbolas, hence, sometimes we call them conic polygons.) Any two of these regions actually have no duplicate region, defined in Section 2. In theory, we can directly output these conic polygons. We should note that Section 2 empha- sizes a constraint condition - the output of the algorithm to be de- veloped is the well-organized boundaries of the achievable region R. In order to satisfy such a constraint, we only need to execute a simple boolean set operation (i.e., arrange all edges (segments) of these conic polygons and then combine them in order). Due to the SPM has complexity O(n), naturally, the number of edges of all these conic polygons has the linear-size complexity. Moreover, in the context of our concern, the number of intersections among all these segments is clearly no more than O(n), and constructing the SPM can be done in O(nlog n) time (which has been stated in Section 4), all these facts form our final algorithm, obtaining an O(nlog n) worst case upper bound. We remark that although this paper focuses on the case of line- segment obstacles, the FAR problem in the case of polygonal obsta- cles should be easily solved using anyone of the above algorithms (maybe some minor modifications are needed). Paper organization. In the next section, we formulate our prob- lem, define some notations, and analyse the so-called rough solu- tion mentioned before. Section 3 presents a simpler-version O(n3) algorithm for the sake of intuition. Section 4 presents a modified- version O(n2 logn) algorithm, and Section 5 presents our final al- gorithm, running in O(nlog n) time. Finally, Section 6 concludes this paper with several open problems. 2. PRELIMINARIES 2.1 Problem definition and notations Let M be a moving object in R2, we assume M can be regarded as a point compared to the total space. Let O be a set of n disjoint obstacles in R2. We assume that the moving object M can freely move in R2, but cannot directly pass through any obstacle o ∈ O. For clarity, we use R2/O to denote the free space. Let s be the starting point of the moving object M. (Sometimes we also call it the source point.) Given a point p ∈ R2/O, assume that the moving object M freely moves from s to p, the total travelled-distance of M is called the path length. We remark that, if s and p are identical in R2, the path length is not definitely equal to 0. The maximum value of path length that M is allowed to travel is called the maximum path length. We use l to denote the maximum path length of the moving ob- ject M. Given two points p and p′ in R2, we use p (p, p′) to de- note the shortest path length in presence of obstacles (a.k.a., the geodesic distance). When two points p and p′ are to be visible to each other, we use dist(p, p′) to denote the Euclidean distance be- tween them. Given a point p in R2, we say M can reach the point p such that p (s, p) ≤ l. (Sometimes, we also say p is achievable for M.) Given two closed regions, we say they have the duplicate region if the area of their intersection set does not equal to 0; oth- erwise, we say they have no duplicate region. DEFINITION 2.1 (FINDING ACHIEVABLE REGION). The prob- lem of finding achievable region (FAR) is to find a region denoted by R such that for any point p in R2, if M can reach p, then p ∈ R; otherwise, p /∈ R. Clearly, the line segment is the basic element in geometries. This paper restricts the attention to the case of disjoint line-segment ob- stacles. (We remark that the case of polygonal obstacles should be easily solved using our proposed algorithms.) In particular, we emphasize that the output of the algorithm to be developed is the well-organized boundaries of the achievable region R, rather than a set of out-of-order segments. Furthermore, we are interested in de- veloping the exact algorithms rather than approximate algorithms. Unless stated otherwise, the term obstacles refers to line-segment obstacles in the rest of the paper. Let E be the set of all endpoints of obstacles O, we use E′ to denote the set of endpoints such that (i) for each endpoint e ∈ E′, p (s, e) < l; and (ii) for each endpoint e ∈ E but e /∈ E′, p (s, e) ≥ l. For clarity, we call the set E′ the effective endpoint set. (Sometimes we call the endpoint e ∈ E′ the effective endpoint.) Given any set, we use the notation " · " to denote the cardinality of the set (e.g., E′ denotes the number of effective endpoints). Given two points p and p′, we use pp′ to denote the straight line segment joining the two points. Given a circular arc segment with two endpoints p and p′, we use \pp∗ p′ to denote this arc. Note that, here p∗ is used to eliminate the ambiguity. (Recall that a circular arc may be the major/minor arc, two endpoints cannot determine a specific circular arc.) We call such a point (like p∗) the appendix point. Given a circle with the center p and the radius r, we use C(p, r) to denote this circle. Given a ray emitting from a point p and passing through another point p′, we use r(p,p′) to denote this ray. Given two points p and p′, we use ∢(p, p′) to denote that they are visible to each other, and use ¬(∢(p, p′) to denote the opposite case. Given a point p, we use Rvp(p) to denote the visibility polygon (i.e., visibility region) of p. 2.2 A brief analysis on the "rough solution" Now we verify whether or not the so-called rough solution (RS) can work correctly. EXAMPLE 2.1. Based on the RS, we first get Rd (recall Section 1); it here is bounded by v1a, ab, bv2, \v2v6v4, v4d, dc, cv3, \v3v5v1. See Figure 2(a). Next, we get four circles which are C(a, dist(a, v1)), C(b, dist(b, v2)), C(c, dist(c, v3)), and C(d, dist(d, v4)), respectively. We finally get the answer by merging all the five regions. Interest- ingly, this example shows that the RS seems to be feasible. The ex- ample in Figure 2(b), however, breaks this delusion. See the black region in the circle C(a, dist(a, v1)). M obviously can not reach any point located in this region. In other words, the second step of the RS is incorrect. Furthermore, consider the example in Figure 2(c), here Rd is bounded by v1a, ab, bv4, v4d, dv2, \v2v3v1. Note that, v4 here is the intersection between r(s,b) and cd, and p (s, v4) < l. Then, whether or not we should consider such a point like v4 when we design a new solution? In the next section, we show such a point does not need to be considered (see Lemma 3.1), and prove that our problem can be reduced to computing the union of a series of circular visibility regions defined below. DEFINITION 2.2 (CIRCULAR VISIBILITY REGION). Given a circle C(p, r), its corresponding circular visibility region, denoted by Rcvr(p, r), is a region such that, for any point p′ ∈ C(p, r), if p and p′ are to be visible to each other, i.e., ∢(p, p′), then p′ ∈ Rcvr(p, r); otherwise, p′ /∈ Rcvr(p, r). We say p is the center and r is the radius of Rcvr(p, r), respec- tively. Sometimes, we also say that Rcvr(p, r) is the circular visi- bility region of p when r is clear from the context. a 1v v 5 S c v 3 (a) 2v 1v b d v 6 v4 c a S (b) d 2v 1v b a c 4v b 2v d S 3v (c) Figure 2: The case of two obstacles. ab and cd denote obstacles, other solid or dashed lines are the auxiliary lines, for ease of presentation. 3. AN O(N3) ALGORITHM 3.1 Reduction LEMMA 3.1. Given a set O of disjoint obstacles, the moving object M, its starting point s and its maximum path length l, the effective endpoint set E′, and a point p ∈ C(s, l), we have that if p (s, p) < l, then Rcvr(p, l − p (s, p)) ⊂ Se∈E′ Rcvr(e, l − p (s, e)) S Rcvr(s, l). PROOF. The proof is not difficult but somewhat long, we move it to Appendix A. Based on Lemma 3.1, the set theory and the definition of the circular visibility region, we can easily build the follow theorem. THEOREM 3.1. Given a set O of disjoint obstacles, the moving object M, its starting point s and its maximum path length l, and the effective endpoint set E′; then, the achievable region R can be computed as R = Se∈E′ Rcvr(e, l − p (s, e)) S Rcvr(s, l). Theorem 3.1 implies that the achievable region R is a union of a set of circular visibility regions (CVRs). Clearly, the boundaries of the CVR usually consist of circular arc and/or straight line seg- ments. The straight line segment can be represented using two end- points, and the circular arc can be represented using two endpoints and an appendix point (recall Section 2). Naturally, a double linked list can be used to store the information of boundaries of a CVR. Meanwhile, we can easily know that the boundaries of R also con- sist of circular arc and/or straight line segments, since it is a union of all the CVRs, implying that we can also use a double linked list to store the information of boundaries of R. Discussion. Given a point p and a positive real number r, an easy called to mind method to compute the circular visibility region of p is as follows. First, we compute Rvp(p) (i.e., the visibility polygon of p, recall Section 2). Second, we compute the intersection set be- tween the circle C(p, r) and the visibility polygon Rvp(p). Clearly, we can easily get all the segments that are visible from p, based on existing algorithms [37, 3]. However, the visibility polygon of a point among a set of obstacles may not be always bounded [11], which arises the following trouble - how to compute the intersec- tion set between an unbounded polygonal region and a circle? In the next section, we present a method that can compute the circular visibility region of p efficiently, and is to be free from tackling the above trouble. 3.2 Computing the circular visibility region 3.2.1 Pruning Before constructing the CVR, we first prune some unrelated ob- stacles using a simple but efficient mechanism, which can simplify the subsequent computation. LEMMA 3.2. Given the set O of obstacles and a circle C(p, r), we have that for any obstacle o ∈ O, • if o /∈C(p, r); then, o can be pruned safely. • if o∩C(p, r), let os be the sub-segment of o such that os /∈ C(p, r); then, the sub-segment os can be pruned safely. PROOF. The proof is straightforward. We only need to prove that o makes no impact on the size of Rcvr(p, r). We prove this by contradiction. According to the definition of the CVR, we can easily know that for any point p′ ∈ Rcvr(p, r), the point p′ has the following properties: p′ ∈ C(p, r) and ∢(p, p′). We assume that o makes impact on the size of Rcvr(p, r). This implies that there is at least a point p′′ ∈ o such that dist(p, p′′) < r. On the other hand, based on analytic geometry, it is easy to know that if o /∈ C(p, r), then, for any point p′′ ∈ o, dist(p, p′′) > r. It is contrary to the previous assumption. Hence o can be pruned safely. (Using the same method, we can prove that the sub-segment os can also be pruned safely.) THEOREM 3.2. Given a set of n obstacles in R2, and a circle C(p, r), we can prune the unrelated obstacles in O(n) time. PROOF. We first use the minimum bounding rectangle (MBR) of C(p, r) as the input to prune unrelated obstacles. As a result, we obtain a set of obstacles called initial candidate obstacles (ICOs), see Figure 3(a). This step takes O(n) time. Next, for each ICO, we check if it can be pruned or partially pruned according to Lemma 3.2. Each operation takes constant time and the number of ICOs is W (n) in the worst case. Thus, the total running time for pruning obstacles is O(n). We say the rest of obstacles (after pruning) are candidate obsta- cles. In particular, they can be generally classified into five types, p,r MBR r p C (p,r) (a) Case 4 r p Case 1 Case 2 Case 5 Case 3 C(p,r) (b) Figure 3: Example of pruing obstacles. (a) The rectangle denotes the MBR of C(p,r), and the black solid line segments denote initial can- didate obstacles. (b) The black solid line segments denote candidate obstacles. Case 4 see Figure 3(b). We remark that it is also feasible to develop more complicated pruning mechanism that can prune the Case 4-type ob- stacle. Case 3 Case 2 Case 1 Case 5 In particular, we can easily realize an obvious characteristic - all these candidate obstacles are bounded by the circle C(p, r). This fact lets us be without distraction from handling many unrelated ob- stacles, and be easier to construct the CVR. In the next subsection, we show how to construct it and store its boundaries in the afore- mentioned (well-known) data structure - double linked list. p,r 3.2.2 Constructing The basic idea of constructing the CVR is based on the rotational plane sweep [37]. We first introduce some basic concepts, for ease of understanding the detailed process of constructing the CVR. Given the circle C(p, r), we use L to denote a horizontal ray emit- ting from p to the right of p. When we rotate L around p, we call the obstacles that currently intersect with L the active obstacles. Assume that L intersects with an obstacle at u, we use o(u) to de- note this obstacle. Let T be a balance tree, we shall insert the active obstacles into T . Assume that o(ei) is a node in T , we use o(e j) to denote the parent node of o(ei) in T by default. Given an obsta- cle endpoint e and the horizontal ray L, we use ∠(e) to denote the counter-clockwise angle subtended by the segment pe and the ray L. We say this angle is the polar angle of e. Given two endpoints e and e′ of an obstacle o, if ∠(e) > ∠(e′), we say e is the upper endpoint and e′ is the lower endpoint; and vice verse. Moreover, let D be a double linked list used to store the CVR. We remark that two endpoints of an obstacle o can have the same size of polar angles; this problem can be solved by directly ignor- ing o, since this obstacle o almost makes no impact on the size of Rcvr(p, r). In the subsequent discussion, we assume two endpoints of any obstacle o have different polar angles. THEOREM 3.3. Given a circle C(p, r), without loss of general- ity, assume that there are n′(≤ n) candidate obstacles; then con- structing Rcvr(p, r) can be finished in O(nlog n) time. PROOF. We first draw the horizontal ray L from p to the right of p, and then compute the intersections between L and all can- didate obstacles, which takes O(n′) time in the worst case. With- out loss of generality, assume that there are k intersections. Let ui denote one of these intersections, we sort these intersections such that dist(p, ui−1) < dist(p, ui) < dist(p, ui+1) for any i ∈ [2,3, · · · , k − 1]. (Note that, these active obstacles are also being sorted when we sort the intersections.) This takes O(n′ log n′) time, sine k can have W (n′) size in the worst case, see Figure 4(a). We then insert these active obstacles o(ui) (i ∈ [1, · · · , k]) into the balance tree T such that, if o(ui) is the left (right) child of o(u j), then i < j (i > j). So, o(u1) is the leftmost leaf of T . (Note that, 2 C(p,r) 4 5 3 * 1 3 1 2 6 (b) 1 8 5 7 4 * 2 C (a) Figure 4: Example of constructing Rcvr(p,r). The black and grey solid line segment(s) denote candidate obstacles and the horizontal ray L, respectively. (a) r denotes the radius of C(p,r). (b) The dashed lines are the result of rotating L. (p,r) any point p∗ ∈ o(ui) is visible from p if and only if o(ui) is the leftmost leaf in T .) Initializing the tree T takes O(n′) time, since T = k = W (n′) in the worst case. We sort the endpoints of all candidate obstacles according to their polar angles. We denote these sorted endpoints as e1, e2, · · ·, e2n′ such that ∠(ei−1) < ∠(ei) < ∠(ei+1) for any i ∈ [2,3, · · · ,2n′ − 1], see Figure 4(b). Since each obstacle has two endpoints, sorting them takes O(n′ logn′) time. We then rotate L according to the counter-clockwise. Note that, in the process of rotation, the active obstacles in T change if and only if L passes through the endpoints of obstacles. We handle each endpoint event as follows. if ei is the lower endpoint of obstacle o(ei) then Insert the obstacle o(ei) into T if o(ei) is the leftmost leaf in T then if T > 1 then 1 2 3 4 5 6 7 14 15 16 17 Let z be the intersection between pei and o(e j) Put the two points z and ei into D in order else if T = 1 ∧ dist(p,ei ) 6= r then Let z be the intersection between pei and C(p,r) Put the two points z and ei into D in order Put the point ei into D else // T = 1 ∧ dist(p,ei) = r 8 9 10 if ei is the upper endpoint of o(ei) then 11 12 13 if o(ei) is the leftmost leaf in T if T > 1 then Let z be the intersection between pei and o(e j ) Put the two points ei and z into D in order else if T = 1 ∧ dist(p,ei ) 6= r then Let z be the intersection between pei and C(p,r) Let z∗ be a point such that dist(p,z∗) = r and pz∗ is subtended by pei and pei+1 Put the three points ei, z and z∗ into D in order else // T = 1 ∧ dist(p,ei ) = r Let z∗ be a point such that dist(p,z∗) = r and pz∗ is subtended by pei and pei+1 Put the two points ei and z∗ into D in order Remove o(ei) from T 18 It is easy to know that the height of T is log n′. So, each op- eration (e.g., insert, delete and find the active obstacle) in T takes O(log n′) time. In addition, other operation (e.g., obtain the in- tersections z, z∗, and put them into D) takes constant time. Thus, handling all endpoint events takes n′ log n′ time. After all endpoints are handled, we finally get the CVR whose boundaries are repre- sented as a series of vertexes and appendix points (stored in D). See Figure 4(b) for example, we shall get a series of organized points {e2, z1, z∗ 2 are appendix points. We note that n′ can have W (n) size in the worst case. In summary, 2, z4, e7, z5, e8}, where z∗ 1, z2, e3, e5, z3, e6, z∗ 1 and z∗ constructing the CVR takes O(nlog n) time. Discussion. Recall Section 3.1, we mentioned two types of CVRs: Rcvr(s, l) and Rcvr(e, l − p (s, e)). Regarding to the former, we use the circle C(s, l) to prune unrelated obstacles and then to construct it based on the method discussed just now. Regarding to the latter, the circle C(e, l − p (s, e)) however, is unavailable beforehand. Hence, we first have to obtain this circle. In the next subsection, we show how to get it using a simple method. 3.2.3 Obtaining the circle C(e, l − p (s, e)) This simple method incorporates the classical visibility graph technique. To save space, we simply state the previous results, and then use them to help us obtain this circle. DEFINITION 3.1 (VISIBILITY GRAPH). [38] The visibility graph of a set of n line segments is an undirected graph whose vertexes consist of all the endpoints of the n line segments, and whose edges connect mutually visible endpoints. LEMMA 3.3. [38] Given a set of n line segments in R2, con- structing the visibility graph for these segments can be finished in O(n2) time. LEMMA 3.4. [7] Given an undirected graph with n vertexes, finding the shortest path between any pair of vertexes can be fin- ished in O(n2) time using the standard Dijkstra algorithm. To obtain the circle, our first step is to construct a visibility graph. Note that, we here need to consider the starting point s; in other words, the visibility graph consists of not only endpoints of obsta- cles but also the starting point s. Even so, from Lemma 3.3, we can still get an immediate corollary below. COROLLARY 3.1. Given a set O of n disjoint line-segment ob- stacles, and the starting point s, we can build a visibility graph for the set of obstacles and the starting point s in O(n2) time. Let G be the visibility graph obtained using the above method. For clarity, we say C(e, l −p (s, e)) is a valid circle if l −p (s, e) > 0; otherwise, we say it is an invalid circle. THEOREM 3.4. Given the visibility graph G, the maximum path length l, the staring point s, and an obstacle endpoint e, obtaining the circle C(e, l − p (s, e)) can be finished in O(n2) time. PROOF. It is easy to see that the key step of obtaining the circle C(e, l − p (s, e)) is to compute the shortest path length from s to e, i.e., p (s, e). Now assume we have obtained the visibility graph G. At anytime we need to obtain the circle C(e, l −p (s, e)), we run the standard Dijkstra algorithm to find the shortest path from s to e, which takes O(n2) time1, see Lemma 3.4. Once the shortest path is found, its length p (s, e) can be easily computed in additional O(k) time, where k is the number of segments in the path. Finally, if l − p (s, e) > 0, we let l − p (s, e) and e be the radius and center of the circle, respectively, we get a valid circle; otherwise, we report it is an invalid circle. This can be finished in O(1) time. Pulling all together, this completes the proof. 1We also note that Ghosh and Mount [12] proposed an output-sensitive O(E + nlog n) algorithm for constructing the visibility graph, where E is the number of edges in the graph. Furthermore, using Fibonacci heap, the shortest path of two points in a graph can be reported in O(E + nlog n) time [10]. Even so, the worst case running time is still no better than O(n2) since the visibility graph can have W (n2) edges in the worst case. 3.3 Putting it all together The overall algorithm is shown in Algorithm 1. The correctness of our algorithm follows from Lemma 3.2, Corollary 3.1, Theorems 3.1, 3.3 and 3.4. THEOREM 3.5. The running time of Algorithm 1 is O(n3). PROOF. Clearly, Lines 2, 3 and 4 take O(n2), linear and O(nlog n) time, respectively, see Corollary 3.1, Theorems 3.2 and 3.3. Within the for circulation, Line 6 takes O(n2) time, see Theorem 3.4. Line 8 takes linear time, see Theorem 3.2. Line 9 takes O(nlog n) time, see Theorem 3.3. We remark that the step "let R = R S Rcvr(e, l − p (s, e))" shown in Line 8 is a simple boolean union operation of two polygons with circular arcs, it is used to remove the duplicate region. A straightforward adaptation of Bentley-Ottmann's plane sweep algorithm [4], or the algorithm in [5] can be used to ob- tain their union in O((m + k)log m) time, where m and k respec- tively are the number of edges and intersections of the two poly- gons. Regarding to the case of our concern, m = W (n) and k has the constant descriptive complexity, see e.g., Figure 4(b) for an il- lustration (note: substitute C(p, r) with C(s, l)). Hence, the step "let R = R S Rcvr(e, l −p (s, e))" actually can be done in O(nlog n) time. Hence, the for circulation takes O(n3) time. To summarize, the worst case upper bound of this algorithm is O(n3). Algorithm 1 Finding Achievable Region of M Input: O, s, l Output: R 1: Set R = /0 2: Construct the visibility graph G 3: Prune unrelated obstacles using C(s,l) 4: Construct Rcvr(s,l), and let R = Rcvr(s,l) 5: for each obstacle endpoint e do 6: 7: 8: 9: 10: return R Obtain the circle C(e,l − p (s,e)) if it is a valid circle then Prune unrelated obstacles using C(e,l − p (s,e)) Construct Rcvr(e,l −p (s,e)), and let R = R S Rcvr(e,l −p (s,e)) Summary In this section, we have presented a simpler-version al- gorithm, which is indeed intuitive and easy-to-understand. We can easily see that the dominant step of this algorithm is to obtain the circle C(e, l − p (s, e)), i.e., Line 6. In the next section, we show how to break through this bottleneck and obtain an O(n2 log n) al- gorithm. 4. AN O(N2 log N) ALGORITHM This more efficient solution mechanically relies on the well-known technique called the shortest path map, which was previously used to compute the Euclidean shortest path among polygonal obstacles. 4.1 Overview of the short path map DEFINITION 4.1 (SHORTEST PATH MAP). [23, 15] The short- est path map of a source point s with respect to a set O of obstacles is a decomposition of the free space R2\O into regions, such that the shortest paths in the free space from s to any two points in the same region pass through the same sequence of obstacle vertices. The shortest path map is usually stored using the quad-edge data structure [13, 22, 15]. Let SPM(s) denote the short path map of the source point s. It has the following properties. LEMMA 4.1. [23, 24, 25] Once the SPM(s) is obtained, the map can be used to answer the single-source Euclidean shortest path query in O(log n) time. LEMMA 4.2. [23, 15] The map SPM(s) has complexity O(n), it consists of O(n) vertexes, edges, and faces. Each edge is a segment of a line or a hyperbola. The early method to compute SPM(s) can be found in [22], the author (Mitchell) later adopted the continuous Dijkstra paradigm to compute this map [23, 25]. An optimal algorithm for computing the Euclidean shortest path among a set of polygonal obstacles was proposed by Hershberger and Suri [15], their method also used the continuous Dijkstra paradigm, but it employed two key ideas: a conforming subdivision of the plane and an approximate wavefront. Here we simply state the general steps of constructing SPM(s), and their main result. (If any question, please refer to [15] for more details). The general steps of constructing SPM(s) can be summarized as follows. • It builds a confirming subdivision of the plane by considering only the vertexes of polygonal obstacles, dividing the plane into the linear-size cells. • It inserts the edges of obstacles into the subdivision above, and gets a confirming subdivision of the free space. • It propagates the approximate wavefront through the cells of the conforming subdivision of the free space, remember- ing the collisions arose from wavefront-wavefront events and wavefront-obstacle events. • It collects all the collision information, and uses them to de- termine all the hyperbola arcs of SPM(s), and finally com- bines these arcs with the edges of obstacles, forming SPM(s). LEMMA 4.3. [15] Given a source point s, and a set O of polyg- onal obstacles with a total number n of vertexes in the plane, the map SPM(s) can be computed in O(nlog n) time. 4.2 Constructing SPM(s) among line-segment ob- stacles The method to construct SPM(s) among line-segment obstacles is the same as the one in [15]. To justify this, we can consider the line-segment obstacle as the special (or degenerate) case of the polygonal obstacle - one has only 2 sides and no area (see Figure 5 for an illustration). Furthermore, although the free space in the case of line-segment obstacles is (almost) equal to the space of the plane (since each obstacle here has no area), this fact still cannot against applying the algorithm in [15] to the case of our concern. This is mainly because (i) we can still build the confirming subdivision of the plane by considering only the endpoints of line segments firstly, and then insert the n line segments into the conforming subdivision; (ii) the collisions are also arose from wavefront-wavefront events and wavefront-obstacle events, we can also collect these collision in- formation, and then determine the hyperbola arcs of SPM(s); and (iii) we can obtain SPM(s) by (also) combining these arcs with the n line segments. With the argument above, and each line-segment obstacle has only 2 endpoints, from Lemma 4.3, we have an imme- diate corollary below. COROLLARY 4.1. Given a source point s, and a set O of n line- segment obstacles in the plane, the map SPM(s) can be computed in O(nlog n) time. 4.3 The algorithm To obtain the achievable region R, the first step of this O(n2 log n) algorithm is to construct SPM(s). The rest of steps are the same as 3e 3e e1 e2 e1 e2 e1 e2 Figure 5: The line-segment obstacle is the degenerate case of the polygonal obstacle. the ones in Algorithm 1 except the step "obtain the circle C(e, l − p (s, e))". We now can obtain this circle in a more efficient way. This is mainly because the short path can be computed in O(logn) time once SPM(s) is available, see Lemma 4.1. Based on this fact and the previous analysis used to prove Theorem 3.4, we can easily build the following theorem. THEOREM 4.1. Given the short path map SPM(s), the maxi- mum path length l, and an obstacle endpoint e, obtaining the circle C(e, l − p (s, e)) can be finished in O(logn) time. The correct of this algorithm follows from Algorithm 1, Corol- lary 4.1 and Theorem 4.1. The pseudo codes are shown in Algo- rithm 2. Algorithm 2 Finding Achievable Region of M Input: O, s, l Output: R 1: Set R = /0 2: Construct SPM(s) 3: Prune unrelated obstacles using C(s,l) 4: Construct Rcvr(s,l), and let R = Rcvr(s,l) 5: for each obstacle endpoint e do 6: 7: 8: 9: 10: return R Obtain the circle C(e,l − p (s,e)) based on SPM(s) if it is a valid circle then Prune unrelated obstacles using C(e,l − p (s,e)) Construct Rcvr(e,l −p (s,e)), and let R = R S Rcvr(e,l −p (s,e)) THEOREM 4.2. The running time of Algorithm 2 is O(n2 log n). PROOF. This follows directly from Theorem 4.1 and the proof for Theorem 3.5. Summary. This section presented an O(n2 log n) algorithm by mod- ifying Algorithm 1. We can easily see that the dominant step has shifted, compared to Algorithm 1. Now, The bottleneck is located in Line 9, which takes O(nlog n) time. In the next section, we show how to improve this O(n2 log n) algorithm to obtain a sub-quadratic algorithm. 5. AN O(N log N) ALGORITHM The first step of this O(nlog n) algorithm is also to construct the short path map, which is the same as the one in Algorithm 2. It however, does not construct the CVRs. Instead, it directly traverses each region of the short path map to obtain their boundaries, and finally merges them. 5.1 Regions of SPM(s) As mentioned in Section 4.1, for two different points p and p′ in the same region, their short paths (i.e., p (s, p) and p (s, p′)) pass through the same sequence of obstacle vertices. We say the final obstacle vertex (among the sequence of obstacle vertexes) is the control point of this region. Let ec be a control point, we say ec is a valid control point if p (s, ec) < l; otherwise, we say it is an invalid control point. For ease of discussion, we say the region containing the starting (source) point s is the kernel-region, and use Rmap(k) to denote this region. We say any other region is the ordinary region, and use Rmap(o) to denote an ordinary region of SPM(s). Intuitively, the kernel-region can have W (n) edges in the worst case (see e.g., Figure 6(a)), and the number of edges of an ordinary region has the constant descriptive complexity. Moreover, we say the intersection set of the kernel-region Rmap(k) and the circle C(s, l) is the circular kernel-region, and denote it as R∗ map(k). Assume that ce is a valid control point of an ordinary region Rmap(o), we say the intersection set of this ordinary re- gion and the circle C(s, l −p (s, ce)) is the circular ordinary region, and denote it as R∗ map(o). According to the definition of SPM(s), map(k) and R∗ R∗ map(o), we can easily build the following theorem. THEOREM 5.1. Given SPM(s) and the maximum path length l, without loss of generality, assume that there are a set Y of ordinary regions (among all the ordinary regions) such that each of these re- gions has the valid control point ec (i.e., l − p (s, ec) > 0), implying that there are a number Y ∗ be the set of circular ordinary regions. Then, the achievable region R can be computed as R = R∗ of circular ordinary regions. Let Y map(k) SRmap∗(o)∈Y ∗ R∗ map(o). LEMMA 5.1. Given the kernel-region Rmap(k) and the circle C(s, l), computing their intersection set can be done in O(n) time. PROOF. This stems directly from the fact that the kernel-region Rmap(k) can have W (n) edges in the worst case, and computing their intersections takes linear time. LEMMA 5.2. Given an ordinary region Rmap(o) and its con- trol point ec, we assume that ec is a valid control point. Then, computing the intersection set of this ordinary region and the circle C(ce, l − p (s, ec)) can be done in constant time. PROOF. The proof is the similar as the one for Lemma 5.1. LEMMA 5.3. Given SPM(s), finding the control point of any ordinary region can be finished in O(log n) time. PROOF. We just need to randomly choose a point in the region and execute a Euclidean shortest path query, the final obstacle ver- tex in the path can be obtained easily. The Euclidean shortest path query can be done in O(log n) time, see Lemma 4.1. Discussion. Recall Section 3.1, we mentioned two types of cir- cular visibility regions. We remark that the circular kernel-region R∗ map(k) actually equals the circular visibility region Rcvr(s, l), see Figure 6(b). However, the circular ordinary region R∗ map(o) does not equal another type of circular visibility region Rcvr(e, l −p (s, e)). More specifically, (i) E′ (see Theorem 3.1) is usually less than Y ∗ (see Theorem 5.1); and (ii) the intersection set of two circular visibility regions may be non-empty (i.e., they may have the du- plicate region), but the intersection set of any two circular ordinary regions (or, any circular ordinary region and circular kernel-region) is empty (see e.g., Figure 6(c)), implying that no duplicate region is needed to be removed, hence in theory, we can directly output all the circular ordinary regions and the circular kernel-region. The output shall be a set of conic polygons, since the boundaries of some circular ordinary regions possibly consist of not only circular arc and straight line segments but also hyperbolas. But we should note that Section 2 previously has stated a constraint - the output of the algorithm to be developed is the well-organized boundaries of the achievable region R (just like shown in Figure 6(d)), rather than a set of out-of-order segments, implying that we need to han- dle edges (or segments) of those conic polygons. Even so, we still (a) (b) (c) (d) Figure 6: Illustration of SPM(s). (a) The kernel-region. (b) The circular kernel-region Rmap actually equals the circular visibility region Rcvr(s,l). (c) No duplicate region is needed to be handled. (d) The merged result. can obtain an O(nlog n) worst case upper bound, since the number of segments among all these conic polygons has only complexity O(n). 5.2 The algorithm The final algorithm is shown in Algorithm 3. Its correctness di- rectly follows from Corollary 4.1, Theorem 4.1, and Theorem 5.1. Algorithm 3 Finding Achievable Region of M Input: O, s, l Output: R 1: Set R = /0 2: Construct SPM(s) 3: Obtain R∗ 4: for each ordinary region Rmap(o) do 5: 6: 7: 8: Let R = R∗ Obtain the control point of Rmap(o) if it is a valid control point then map(k) SRmap∗(o)∈Y ∗ R∗ map(k) Obtain R∗ map(o) obtained before map(o) // i.e., merge all the regions 9: return R THEOREM 5.2. The running time of Algorithm 3 is O(nlog n). PROOF. We can easily see that, Lines 2 and 3 take O(nlog n) and linear time respectively, see Corollary 4.1 and Lemma 5.1. In the for circulation, Lines 5 and 6 take O(log n) time, see Lemma 5.3. We remark that Line 6 actually is (almost) the same as the operation - determining if C(e, l − (s, e)) is a valid circle, see Theorem 4.1. Moreover, Line 7 takes constant time, see Lemma 5.2. Note that, the number of ordinary regions is the linear-size complexity, which stems directly from Lemme 4.2. So, the overall execution time of the for circulation is also O(nlog n). Finally, Line 8 is a simple boolean set operation, which can be done in O(nlog n) time, since the number of edges of all these conic polygons has complexity O(n), arranging all these segments and appealing to the algorithm in [5] can immediately produce their union in O((n + i)log n) time, where i is the number of intersections among all these segments. Note that in the context of our concern, i has the linear complex- ity, see e.g., Figure 6(c) for an illustration. This completes the proof. Summary. This section presented our final algorithm, which sig- nificantly improves the previous ones. We remark that, maybe there still exist more efficient solutions to improve some sub-steps in Algorithm 3, but it is obvious that beating this worst case upper bound is (almost) impossible, this is mainly because, the nature of our problem decides any solution to be developed, or the ones pro- posed in this paper, (almost) cannot be free from computing the geodesic distance, i.e., the shortest path length in the presence of obstacles. Moreover, we remark that although our attention is fo- cused on the case of disjoint line-segment obstacles in this paper, it is not difficult to see that all these algorithms can be easily ap- plied to the case of disjoint polygonal obstacles (directly or after the minor modifications). Finally, the O(nlog n) algorithm is to construct SPM(s) with respect to all the obstacles, sometimes the maximum path length l is possibly pretty small, an output-sensitive algorithm can be easily developed by a straightforward extension of this O(nlog n) algorithm. 6. CONCLUDING REMARKS This paper proposed and studied the FAR problem. In particu- lar, we focused our attention to the case of line-segment obstacles. We first presented a simpler-version algorithm for the sake of intu- ition, which runs in O(n3) time. The basic idea of this algorithm is to reduce our problem to computing the union of a series of cir- cular visibility regions (CVRs). We demonstrated its correctness, analysed its dominant steps, and improved it by appealing to the shortest path map (SPM) technique, which was previously used to compute the Euclidean shortest path among polygonal obstacles. We showed Hershberger-Suri's method can be equivalently used to compute the SPM in the case of our concern, and thus immediately yielded an O(n2 logn) algorithm. Owing to the realization above, the third algorithm also used this technique. It however, did not construct the CVRs. Instead, it directly traversed each region of the SPM to trace the boundaries, thus obtained the O(nlog n) worst case upper bound. We conclude this paper with several open problems. 1. The dynamic version of this problem is that, if the maximum path length l is not constant, how to efficiently maintain the dynamic achievable region? 2. The inverse problem is that, given a closed region R∗, how to efficiently determine whether or not R∗ is the real achievable region R? 3. The multi-object version of this problem is that, if there are multiple moving objects, how to efficiently find their com- mon part of their achievable regions? 7. REFERENCES [1] C. C. Aggarwal and P. S. Yu. A survey of uncertain data algorithms and applications. IEEE Transactions on Knowledge and Data Engineering (TKDE), 21(5):609–623, 2009. [2] T. Asano. An efficient algorithm for finding the visibility polygon for a polygonal region with holes. Transactions of IECE of Japan E, 68(9):557–559, 1985. [3] T. Asano, T. Asano, L. J. Guibas, J. Hershberger, and H. Imai. Visibility-polygon search and euclidean shortest paths. In IEEE Symposium on Foundations of Computer Science (FOCS), pages 155–164, 1985. [4] J. L. Bentley and T. Ottmann. Algorithms for reporting and counting geometric intersections. IEEE Transaction on Computers (TC), 28(9):643–647, 1979. [5] E. Berberich, A. Eigenwillig, M. Hemmer, S. Hert, K. Mehlhorn, and E. SchÃumer. A computational basis for conic arcs and boolean operations on conic polygons. In European Symposium on Algorithm (ESA), pages 174–186. 2002. [6] R. Cheng, D. V. Kalashnikov, and S. Prabhakar. Querying imprecise data in moving object environments. IEEE Transactions on Knowledge and Data Engineering (TKDE), 16(9):1112–1127, 2004. [7] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction To Algorithms, Second Edition. The MIT Press, Cambridge, 2001. [8] M. de Berg, O. Cheong, M. van Kreveld, and M. Overmars. Computational geometry: algorithms and applications, Third Edition. Springer, Berlin, 2008. [9] J. F. Eastman. An efficient scan conversion and hidden surface removal algorithm. Computers and Graphics (CG), 1(2-3):215–220, 1975. [10] M. L. Fredman and R. E. Tarjan. Fibonacci heaps and their uses in improved network optimization algorithms. Journal of the ACM (JACM), 34(3):596–615, 1987. [11] S. K. Ghosh. Visibility algorithms in the plane. Cambridge University Press, New York, 2007. [12] S. K. Ghosh and D. M. Mount. An output-sensitive algorithm for computing visibility graphs. SIAM Journal on Computing (SIAMCOMP), 20(5):888–910, 1991. [13] L. J. Guibas and J. Stolfi. Primitives for the manipulation of general subdivisions and computation of voronoi diagrams. ACM Transactions on Graphics (TOG), 4(2):74–123, 1985. [14] P. J. Heffernan and J. S. B. Mitchell. An optimal algorithm for computing visibility in the plane. SIAM Journal on Computing (SIAMCOMP), 24(1):184–201, 1995. [15] J. Hershberger and S. Suri. An optimal algorithm for euclidean shortest paths in the plane. SIAM Journal on Computing (SIAMCOMP), 28(6):2215–2256, 1999. [16] Y. K. Hwang and N. Ahuja. Gross motion planning - a survey. ACM Computing Surveys (CSUR), 24(3):219–291, 1992. [17] S. Kapoor and S. N. Maheshwari. Efficient algorithms for euclidean shortest path and visibility problems with polygonal obstacles. In ACM Symposium on Computational Geometry (SoCG), pages 172–182, 1988. [18] S. Kapoor, S. N. Maheshwari, and J. S. B. Mitchell. An efficient algorithm for euclidean shortest paths among polygonal obstacles in the plane. Discrete and Computational Geometry (DCG), 18(4):377–383, 1997. [19] A. Kolling, A. Kleiner, M. Lewis, and K. P. Sycara. Computing and executing strategies for moving target search. In IEEE International Conference on Robotics and Automation (ICRA), pages 4246–4253, 2011. [20] D. T. Lee and A. K. Lin. Computational complexity of art gallery problems. IEEE Transactions on Information Theory (TIT), 32(2):276–282, 1986. [21] D. T. Lee and F. P. Preparata. Euclidean shortest paths in the presence of rectilinear barriers. Networks, 14(3):393–410, 1984. [22] J. S. B. Mitchell. A new algorithm for shortest paths among obstacles in the plane. Annals of Mathematics and Artificial Intelligence (AMAI), 3(1):83–105, 1991. [23] J. S. B. Mitchell. Shortest paths among obstacles in the plane. In ACM Symposium on Computational Geometry (SoCG), pages 308–317, 1993. [24] J. S. B. Mitchell and C. H. Papadimitriou. The weighted region problem: Finding shortest paths through a weighted planar subdivision. Journal of the ACM (JACM), 38(1):18–73, 1991. [25] J. S. B. Mitchell and C. H. Papadimitriou. Shortest paths among obstacles in the plane. International Journal of Computational Geometry and Applications (IJCGA), 6(3):309–332, 1996. [26] J. O'Rourke. Art gallery theorems and algorithms. Oxford University Press, Oxford, 1987. [27] W. pang Chin and S. C. Ntafos. Optimum watchman routes. In ACM SIGACT/SIGGRAPH Symposium on Computational Geometry (SoCG), pages 24–33, 1986. [28] J. Pei, M. Hua, Y. Tao, and X. Lin. Query answering techniques on uncertain and probabilistic data: tutorial summary. In ACM International Conference on Management of Data (SIGMOD), pages 1357–1364, 2008. [29] E. Pitoura and G. Samaras. Locating objects in mobile computing. IEEE Transactions on Knowledge and Data Engineering (TKDE), 13(4):571–592, July/August 2001. [30] A. Ricci. An algorithm for the removal of hidden lines in 3d scenes. The Computer Journal (CJ), 14(4):375–377, 1971. [31] H. Rohnert. Shortest paths in the plane with convex polygonal obstacles. Information Processing Letters (IPL), 23(2):71–76, 1986. [32] J. Schiller and A. Voisard. Location-Based Services. Morgan Kaufmann Publishers, San Francisco, 2004. [33] M. Sharir and A. Schorr. On shortest paths in polyhedral spaces. In ACM Symposium on Theory of Computing (STOC), pages 144–153, 1984. [34] A. P. Sistla, O. Wolfson, S. Chamberlain, and S. Dao. Modeling and querying moving objects. In IEEE International Conference on Data Engineering (ICDE), pages 422–432. 1997. [35] J. A. Storer and J. H. Reif. Shortest paths in the plane with polygonal obstacles. Journal of ACM (JACM), 41(5):982–1012, 1994. [36] X. Sun, W. Yeoh, and S. Koenig. Efficient incremental search for moving target search. In International Joint Conference on Artificial Intelligence(IJCAI), pages 615–620, 2009. [37] S. Suri and J. O'Rourke. Worst-case optimal algorithms for constructing visibility polygons with holes. In ACM Symposium on Computational Geometry (SoCG), pages 14–23, 1986. [38] E. Welzl. Constructing the visibility graph for n-line segments in o(n2) time. Information Processing Letters (IPL), 20(4):167–171, 1985. APPENDIX A. The proof of Lemma 3.1 PROOF. There are several cases for a point p ∈ C(s, l) such that p (s, p) < l. p e pa e 1 p o 1 (a) e (b) m-o 1 . . . . . . . . . . . e* m-o 1 . . . . . . . . . . . jo pa em e* p em mo pa p jo 1- . . . . . . 1o (c) (d) Figure 7: Illustration of Lemma 3.1. (a) The small and big circles denote C(p,l − p (s, p)) and C(e∗,l − p (s,e∗)), respectively. In (b-d), we omit the circle C(e∗,l − p (s,e∗)) for clearness. • Case 1: p ∈ E′. In this case, it is obvious that Rcvr(p, l − p (s, p)) ⊂ Se∈E′ Rcvr(e, l − p (s, e)) S Rcvr(s, l). • Case 2: p is located in one of obstacles but p /∈ E′ . Without loss of generality, assume that e∗ is the previous point on the short- est path from s to p such that e∗ ∈ {s S E′}. Consider the two cir- cles C(p, l − p (s, p)) and C(e∗, l − p (s, e∗)). It is easy to know that dist(p, e∗) + (l −p (s, p)) = l −p (s, e∗) and p ∈ C(e∗, l −p (s, e∗)). Hence, C(p, l − p (s, p)) must be an inscribed circle of C(e∗, l − p (s, e∗)). This implies that C(p, l − p (s, p)) ⊂ C(e∗, l − p (s, e∗)). Therefore, we get a preliminary conclusion - for any point pa such that pa ∈ Rcvr(p, l −p (s, p)) and ∢(pa, e∗), we have that pa ∈ Rcvr(e∗, l − p (s, e∗)). ⋆ Case 2.1: There is no other obstacle that makes impact on the size of Rcvr(p, l − p (s, p)). See Figure 7(a). Clearly, for any point pa ∈ Rcvr(p, l − p (s, p)), we have ∢(pa, e∗). By the prelim- inary conclusion shown in the previous paragraph, this completes the proof of Case 2.1. ⋆ Case 2.2: There are other obstacles that make impact on the size of Rcvr(p, l − p (s, p)). The key of point is to prove that, for any point pa such that pa ∈ Rcvr(p, l − p (s, p)) and ¬(∢(pa, e∗)), it must be located in a circular visibility region whose center is the endpoint of certain obstacle. Let O′ be the set of other obstacles that make impact on the size of Rcvr(p, l − p (s, p)). For ease of discussion, assume that e∗ i are the endpoints of the ith ob- stacle (among O′ obstacles). Let e∗ i denote the endpoint such that p (e∗, e∗ i). Let m′ = O′, and m be an arbitrary integer. We next prove by induction that the following proposition called P holds - for any point pa such that pa ∈ Rcvr(p, l − p (s, p)) and ¬(∢(pa, e∗)), we have that pa ∈ Sm′ i ) ≤ p (e∗, e′ i , l − p (s, e∗ i=1 Rcvr(e∗ i and e′ i )). We first consider m′ = 1. We connect the following points, e∗, p, pa and e∗ 1. Then, they build a circuit with four edges (see Figure 7(b)). Let D be (dist(e∗, p)+dist(p, pa))−(dist(e∗, e∗ 1)+ dist(e∗ 1, pa)). According to analytic geometry and graph theory, it is easy to know 1, l − p (s, e∗ that D > 0. This implies that the radius of Rcvr(e∗ 1)) is equal to dist(e∗ . So, for any point pa such that pa ∈ Rcvr(p, l −p (s, p)) and ¬(∢(pa, e∗)), we have that pa ∈ Rcvr(e∗ 1, l − p (s, e∗ 1)). Therefore, the proposition P holds when m′ = 1. 1, pa) + D By convention, we assume P holds when m′ = m − 1. We next show it also holds when m′ = m. Let o1, · · ·, om denote these ob- stacles, i.e., O′ = {o1, · · · , om}. We remark that (i) it corresponds to "m′ = m − 1" if om viewed from p is totally blocked by other m − 1 obstacles; and (ii) in the rest of the proof, unless stated otherwise, we use "viewed from p" by default when the location relation of obstacles is considered. There are three cases. i=1 Rcvr(e∗ m, l − p (s, e∗ i , l − p (s, e∗ First, if om is disjointed with other m − 1 obstacles, we denote by ≍ (om, Sm−1 i=1 oi) this case. See Figure 7(c). Let's consider om, according to the method for proving the case m′ = 1, it is easy to get a result - for any point pa such that pa ∈ Rcvr(p, l − p (s, p)) and pa /∈ Sm−1 i )) and ¬(∢(pa, e∗)), we have that pa ∈ Rcvr(e∗ m)). Furthermore, we have assumed P holds when m′ = m − 1. This completes the proof of the case ≍ (om, Sm−1 i=1 oi). Second, if om is in the front of other m − 1 obstacles, we denote by ≻ (om, Sm−1 i=1 oi) this case. We connect the points e∗, · · ·, e∗ i , · · ·, and e∗ m such that the set of segments build the shortest path m. The total length of these segments is p (e∗, e∗ from e∗ to e∗ m). Without loss of generality, assume that pa is to be a point such that pa ∈ Rcvr(p, l − p (s, p) and pa /∈ Sm−1 i , l − p (s, e∗ i )) and ¬(∢(pa, e∗)). We also connect the points e∗ m and pa. Nat- urally, we get the shortest path from e∗ to pa, its total length is p (e∗, e∗ m, pa). This implies that there is no other path (from e∗ to pa) whose length is less than p (e∗, e∗ m) + dist(e∗ m, pa). Let D be (p (e∗, p) + dist(p, pa)) − (p (e∗, e∗ m, pa)), we have that l − p (s, e∗ m, pa), since D > m, pa) + D > dist(e∗ 0. Therefore, pa ∈ Rcvr(e∗ m)). Furthermore, we have assumed P holds when m′ = m − 1. This completes the proof of the case ≻ (om, Sm−1 m, l − p (s, e∗ i=1 Rcvr(e∗ m) = dist(e∗ m) + dist(e∗ m) + dist(e∗ Third, if om is partially blocked by other m − 1 obstacles. We denote by ≺ (om, Sm−1 i=1 oi) this case. Without loss of generality, assume that om is partially blocked by an obstacle o j. (i) If o j does not block any other m − 2 obstacles (see, e.g., Figure 7(d)), according to the method for proving the case m′ = 1, we can also get a result which is the same as the result shown in the case ≍ (om, Sm−1 (ii) Otherwise, we connect the points e∗, · · ·, e∗ i (i ∈ [1, · · · , j − 1]), · · ·, and e∗ m such that the set of segments build the shortest path from e∗ to e∗ m. The rest of steps are the same as the ones for proving the case ≻ (om, Sm−1 i=1 oi). And we can also get a result which is the same as the previous one. Furthermore, we have assumed the proposition P holds when m′ = m − 1. This completes the proof of the case ≺ (om, Sm−1 i=1 oi). In summary, the proposition P also holds when m′ = m. Com- bining the preliminary conclusion shown in the first paragraph of Case 2, this completes the proof of Case 2.2. i=1 oi). i=1 oi). • Case 3: p is not located in any obstacle. The proof for this case is almost the same as the one for Case 2. (Substituting the words "other obstacles" in Case 2 with "obstacles".) Pulling all together, hence the lemma holds.
1609.04723
5
1609
2017-11-04T13:10:41
K-Medoids For K-Means Seeding
[ "cs.DS" ]
We run experiments showing that algorithm clarans (Ng et al., 2005) finds better K-medoids solutions than the Voronoi iteration algorithm. This finding, along with the similarity between the Voronoi iteration algorithm and Lloyd's K-means algorithm, suggests that clarans may be an effective K-means initializer. We show that this is the case, with clarans outperforming other seeding algorithms on 23/23 datasets with a mean decrease over K-means++ of 30% for initialization mse and 3% or final mse. We describe how the complexity and runtime of clarans can be improved, making it a viable initialization scheme for large datasets.
cs.DS
cs
K-Medoids for K-Means Seeding James Newling Idiap Research Institue and Franc¸ois Fleuret Idiap Research Institue and ´Ecole polytechnique f´ed´erale de Lausanne ´Ecole polytechnique f´ed´erale de Lausanne 7 1 0 2 v o N 4 ] S D . s c [ 5 v 3 2 7 4 0 . 9 0 6 1 : v i X r a [email protected] [email protected] Abstract We show experimentally that the algorithm clarans of Ng and Han (1994) finds better K-medoids solutions than the Voronoi iteration algorithm of Hastie et al. (2001). This finding, along with the similarity between the Voronoi iteration algo- rithm and Lloyd's K-means algorithm, motivates us to use clarans as a K-means initializer. We show that clarans outperforms other algorithms on 23/23 datasets with a mean decrease over k-means-++ (Arthur and Vassilvitskii, 2007) of 30% for initialization mean squared error (MSE) and 3% for final MSE. We introduce algorithmic improvements to clarans which improve its complexity and runtime, making it a viable initialization scheme for large datasets. 1 Introduction 1.1 K-means and K-medoids The K-means problem is to find a partitioning of points, so as to minimize the sum of the squares of the distances from points to their assigned partition's mean. In general this problem is NP-hard, and in practice approximation algorithms are used. The most popular of these is Lloyd's algorithm, henceforth lloyd, which alternates between freezing centers and assignments, while updating the other. Specifically, in the assignment step, for each point the nearest (frozen) center is determined. Then during the update step, each center is set to the mean of points assigned to it. lloyd has applications in data compression, data classification, density estimation and many other areas, and was recognised in Wu et al. (2008) as one of the top-10 algorithms in data mining. The closely related K-medoids problem differs in that the center of a cluster is its medoid, not its mean, where the medoid is the cluster member which minimizes the sum of dissimilarities between itself and other cluster members. In this paper, as our application is K-means initialization, we focus on the case where dissimilarity is squared distance, although K-medoids generalizes to non-metric spaces and arbitrary dissimilarity measures, as discussed in §SM-A. By modifying the update step in lloyd to compute medoids instead of means, a viable K-medoids algorithm is obtained. This algorithm has been proposed at least twice (Hastie et al., 2001; Park and Jun, 2009) and is often referred to as the Voronoi iteration algorithm. We refer to it as medlloyd. Another K-medoids algorithm is clarans of Ng and Han (1994, 2002), for which there is no direct K-means equivalent. It works by randomly proposing swaps between medoids and non-medoids, accepting only those which decrease MSE. We will discuss how clarans works, what advantages it has over medlloyd, and our motivation for using it for K-means initialization in §2 and §SM-A. 1.2 K-means initialization lloyd is a local algorithm, in that far removed centers and points do not directly influence each other. This property contributes to lloyd's tendency to terminate in poor minima if not well initial- 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA. initial: final: (cid:13)(cid:63) (cid:13)(cid:63) (cid:63) (cid:63) (cid:13) (cid:63) (cid:13)(cid:63) initial: final: (cid:63)(cid:13) (cid:63)(cid:13) (cid:63) (cid:13)(cid:63) (cid:63) (cid:13) (cid:63) Figure 1: N = 3 points, to be partitioned into K = 2 clusters with lloyd, with two possible initializations (top) and their solutions (bottom). Colors denote clusters, stars denote samples, rings denote means. Initialization with clarans enables jumping between the initializations on the left and right, ensuring that when lloyd eventually runs it avoids the local minimum on the left. ized. Good initialization is key to guaranteeing that the refinement performed by lloyd is done in the vicinity of a good solution, an example showing this is given in Figure 1. In the comparative study of K-means initialization methods of Celebi et al. (2013), 8 schemes are tested across a wide range of datasets. Comparison is done in terms of speed (time to run initialization+lloyd) and energy (final MSE). They find that 3/8 schemes should be avoided, due to poor performance. One of these schemes is uniform initialization, henceforth uni, where K samples are randomly selected to initialize centers. Of the remaining 5/8 schemes, there is no clear best, with results varying across datasets, but the authors suggest that the algorithm of Bradley and Fayyad (1998), henceforth bf, is a good choice. The bf scheme of Bradley and Fayyad (1998) works as follows. Samples are separated into J (= 10) partitions. lloyd with uni initialization is performed on each of the partitions, providing J centroid sets of size K. A superset of JK elements is created by concatenating the J center sets. lloyd is then run J times on the superset, initialized at each run with a distinct center set. The center set which obtains the lowest MSE on the superset is taken as the final initializer for the final run of lloyd on all N samples. Probably the most widely implemented initialization scheme other than uni is k-means++ (Arthur and Vassilvitskii, 2007), henceforth km++. Its popularity stems from its simplicity, low computa- tional complexity, theoretical guarantees, and strong experimental support. The algorithm works by sequentially selecting K seeding samples. At each iteration, a sample is selected with probability proportional to the square of its distance to the nearest previously selected sample. The work of Bachem et al. (2016) focused on developing sampling schemes to accelerate km++, while maintaining its theoretical guarantees. Their algorithm afk-mc2 results in as good initializa- tions as km++, while using only a small fraction of the KN distance calculations required by km++. This reduction is important for massive datasets. In none of the 4 schemes discussed is a center ever replaced once selected. Such refinement is only performed during the running of lloyd. In this paper we show that performing refinement during initialization with clarans, before the final lloyd refinement, significantly lowers K-means MSEs. 1.3 Our contribution and paper summary We compare the K-medoids algorithms clarans and medlloyd, finding that clarans finds bet- ter local minima, in §3 and §SM-A. We offer an explanation for this, which motivates the use of clarans for initializing lloyd (Figure 2). We discuss the complexity of clarans, and briefly show how it can be optimised in §4, with a full presentation of acceleration techniques in §SM-D. Most significantly, we compare clarans with methods uni, bf, km++ and afk-mc2 for K-means initialization, and show that it provides significant reductions in initialization and final MSEs in §5. We thus provide a conceptually simple initialization scheme which is demonstrably better than km++, which has been the de facto initialization method for one decade now. Our source code at https://github.com/idiap/zentas is available under an open source li- cense. It consists of a C++ library with Python interface, with several examples for diverse data types (sequence data, sparse and dense vectors), metrics (Levenshtein, l1, etc.) and potentials (quadratic as in K-means, logarithmic, etc.). 1.4 Other Related Works Alternatives to lloyd have been considered which resemble the swapping approach of clarans. One is by Hartigan (1975), where points are randomly selected and reassigned. Telgarsky and 2 Vattani (2010) show how this heuristic can result in better clustering when there are few points per cluster. The work most similar to clarans in the K-means setting is that of Kanungo et al. (2002), where it is indirectly shown that clarans finds a solution within a factor 25 of the optimal K-medoids clustering. The local search approximation algorithm they propose is a hybrid of clarans and lloyd, alternating between the two, with sampling from a kd-tree during the clarans-like step. Their source code includes an implementation of an algorithm they call 'Swap', which is exactly the clarans algorithm of Ng and Han (1994). 2 Two K-medoids algorithms Like km++ and afk-mc2, K-medoids generalizes beyond the standard K-means setting of Euclidean metric with quadratic potential, but we consider only the standard setting in the main body of this paper, referring the reader to SM-A for a more general presentation. In Algorithm 1, medlloyd is presented. It is essentially lloyd with the update step modified for K-medoids. Algorithm 1 two-step iterative medlloyd algo- rithm (in vector space with quadratic potential). 1: Initialize center indices c(k), as distinct el- ements of {1, . . . , N}, where index k ∈ {1, . . . , K}. for i = 1 : N do a(i) ← arg min k∈{1,...,K} end for for k = 1 : K do c(k) ← (cid:107)x(i)−x(c(k))(cid:107)2 (cid:88) (cid:107)x(i)−x(i(cid:48))(cid:107)2 2: do 3: 4: 5: 6: 7: 8: arg min i:a(i)=k i(cid:48):a(i(cid:48))=k end for 9: 10: while c(k) changed for at least one k 3: ψ− ←(cid:80)N ψ+ ←(cid:80)N Algorithm 2 swap-based clarans algorithm (in a vector space and with quadratic potential). 1: nr ← 0 2: Initialize center indices C ⊂ {1, . . . , N} i=1 mini(cid:48)∈C (cid:107)x(i) − x(i(cid:48))(cid:107)2 4: while nr ≤ Nr do 5: 6: 7: 8: 9: 10: 11: 12: end if 13: 14: end while sample i− ∈ C and i+ ∈ {1, . . . , N} \ C mini(cid:48)∈C\{i−}∪{i+} (cid:107)x(i)− x(i(cid:48))(cid:107)2 C ← C \ {i−} ∪ {i+} nr ← 0, ψ− ← ψ+ nr ← nr + 1 if ψ+ < ψ− then else i=1 In Algorithm 2, clarans is presented. Following a random initialization of the K centers (line 2), it proceeds by repeatedly proposing a random swap (line 5) between a center (i−) and a non- center (i+). If a swap results in a reduction in energy (line 8), it is implemented (line 9). clarans terminates when Nr consecutive proposals have been rejected. Alternative stopping criteria could be number of accepted swaps, rate of energy decrease or time. We use Nr = K 2 throughout, as this makes proposals between all pairs of clusters probable, assuming balanced cluster sizes. clarans was not the first swap-based K-medoids algorithm, being preceded by pam and clara of Kaufman and Rousseeuw (1990). It can however provide better complexity than other swap-based algorithms if certain optimisations are used, as discussed in §4. When updating centers in lloyd and medlloyd, assignments are frozen. In contrast, with swap- based algorithms such as clarans, assignments change along with the medoid index being changed (i− to i+). As a consequence, swap-based algorithms look one step further ahead when computing MSEs, which helps them escape from the minima of medlloyd. This is described in Figure 2. 3 A Simple Simulation Study for Illustration We generate simple 2-D data, and compare medlloyd, clarans, and baseline K-means initializers km++ and uni, in terms of MSEs. The data is described in Figure 3, where sample initializations are also presented. Results in Figure 4 show that clarans provides significantly lower MSEs than medlloyd, an observation which generalizes across data types (sequence, sparse, etc), metrics (Lev- enshtein, l∞, etc), and potentials (exponential, logarithmic, etc), as shown in Appendix SM-A. 3 • x(1) • • x(3) x(2) • x(4) • x(5) • x(6) • x(7) Figure 2: Example with N = 7 samples, of which K = 2 are medoids. Current medoid indices are 1 and 4. Using medlloyd, this is a local minimum, with final clusters {x(1)}, and the rest. clarans may consider swap (i−, i+) = (4, 7) and so escape to a lower MSE. The key to swap- based algorithms is that cluster assignments are never frozen. Specifically, when considering the swap of x(4) and x(7), clarans assigns x(2), x(3) and x(4) to the cluster of x(1) before computing the new MSE. (Column 1) Simu- Figure 3: lated data in R2. For each cluster center g ∈ {0, . . . , 19}2, 100 points are drawn from N (g, σ2I), illustrated here for σ ∈ {2−6, 2−4, 2−2}. (Columns 2,3,4,5) Sample initializations. We observe 'holes' for meth- ods uni, medlloyd and km++. clarans successfully fills holes by under- utilised centers. The spatial correlation of medlloyd's holes are due to its locality of updating. removing distant, 4 Complexity and Accelerations lloyd requires KN distance calculations to update K centers, assuming no acceleration technique such as that of Elkan (2003) is used. The cost of several iterations of lloyd outweighs initialization with any of uni, km++ and afk-mc2. We ask if the same is true with clarans initialization, and find that the answer depends on how clarans is implemented. clarans as presented in Ng and Han (1994) is O(N 2) in computation and memory, making it unusable for large datasets. To make clarans scalable, we have investigated ways of implementing it in O(N ) memory, and devised optimisations which make its complexity equivalent to that of lloyd. clarans consists of two main steps. The first is swap evaluation (line 6) and the second is swap implementation (scope of if-statement at line 8). Proposing a good swap becomes less probable as MSE decreases, thus as the number of swap implementations increases the number of consecutive rejected proposals (nr) is likely to grow large, illustrated in Figure 5. This results in a larger fraction of time being spent in the evaluation step. Figure 4: Results on simulated data. For 400 values of σ ∈ [2−10, 2−1], initialization (left) and final (right) MSEs relative to true cluster variances. For σ ∈ [2−5, 2−2] km++ never results in minimal MSE (M SE/σ2 = 1), while clarans does for all σ. Initialization MSE with medlloyd is on average 4 times lower than with uni, but most of this improvement is regained when lloyd is subsequently run (final M SE/σ2). 4 σ=2−6σ=2−4019σ=2−2unimedlloyd++clarans2−102−92−82−72−62−52−42−32−22−1σ2−4202428212216initMSE/σ22−102−92−82−72−62−52−42−32−22−1σ2−4202428212216finalMSE/σ2medlloyduni++clarans Figure 5: The number of consecutive swap proposal rejections (evaluations) before one is accepted (implementations), for simulated data (§3) with σ = 2−4. We will now discuss optimisations in order of increasing algorithmic complexity, presenting their computational complexities in terms of evaluation and implementation steps. The explanations here are high level, with algorithmic details and pseudocode deferred to §SM-D. Level -2 To evaluate swaps (line 6), simply compute all KN distances. Level -1 Keep track of nearest centers. Now to evaluate a swap, samples whose nearest center is x(i−) need distances to all K samples indexed by C \ {i−} ∪ {i+} computed in order to determine the new nearest. Samples whose nearest is not x(i−) only need the distance to x(i+) computed to determine their nearest, as either, (1) their nearest is unchanged, or (2) it is x(i+). Level 0 Also keep track of second nearest centers, as in the implementation of Ng and Han (1994), which recall is O(N 2) in memory and computes all distances upfront. Doing so, nearest centers can be determined for all samples by computing distances to x(i+). If swap (i−, i+) is accepted, samples whose new nearest is x(i+) require K distance calculations to recompute second nearests. Thus from level -1 to 0, computation is transferred from evaluation to implementation, which is good, as implementation is less frequently performed, as illustrated in Figure 5. Level 1 Also keep track, for each cluster center, of the distance to the furthest cluster member as well as the maximum, over all cluster members, of the minimum distance to another center. Using the triangle inequality, one can then frequently eliminate computation for clusters which are unchanged by proposed swaps with just a single center-to-center distance calculation. Note that using the triangle inequality requires that the K-medoids dissimilarity is metric based, as is the case in the K-means initialization setting. Level 2 Also keep track of center-to-center distances. This allows whole clusters to be tagged as unchanged by a swap, without computing any distances in the evaluation step. We have also considered optimisations which, unlike levels -2 to 2, do not result in the exact same clustering as clarans, but provide additional acceleration. One such optimisation uses random sub- sampling to evaluate proposals, which helps significantly when N/K is large. Another optimisation which is effective during initial rounds is to not implement the first MSE reducing swap found, but to rather continue searching for approximately as long as swap implementation takes, thus balancing time between searching (evaluation) and implementing swaps. Details can be found in §SM-D.3. The computational complexities of these optimisations are in Table 1. Proofs of these complexities rely on there being O(N/K) samples changing their nearest or second nearest center during a swap. In other words, for any two clusters of sizes n1 and n2, we assume n1 = Ω(n2). Using level 2 complexities, we see that if a fraction p(C) of proposals reduce MSE, then the expected complexity is O(N (1 + 1/(p(C)K))). One cannot marginalise C out of the expectation, as C may have no MSE reducing swaps, that is p(C) = 0. If p(C) is O(K), we obtain complexity O(N ) per swap, which is equivalent to the O(KN ) for K center updates of lloyd. In Table 2, we consider run times and distance calculation counts on simulated data at the various levels of optimisation. 5 Results We first compare clarans with uni, km++, afk-mc2 and bf on the first 23 publicly available datasets in Table 3 (datasets 1-23). As noted in Celebi et al. (2013), it is common practice to run initialization+lloyd several time and retain the solution with the lowest MSE. In Bachem et al. (2016) methods are run a fixed number of times, and mean MSEs are compared. However, when comparing minimum MSEs over several runs, one should take into account that methods vary in their time requirements. 5 0500100015002000acceptedswaps(implementations)20210Nrevaluations K 2 evaluations, K implementations K 3N -2 N K 1 N -1 N 1 0 N N K 2N N K 2N N 1 N K + K N N K + K 3 2 N K N KN N N + K 2 1 evaluation 1 implementation memory Table 1: The complexities at different levels of optimisation of evaluation and implementation, in terms of required distance calculations, and overall memory. We see at level 2 that to perform K 2 evaluations and K implementations is O(KN ), equivalent to lloyd. 2 log2(# dcs ) 44.1 36.5 35.5 29.4 26.7 407 19.2 15.6 time [s] -1 0 -2 - 1 - Table 2: Total number of distance calculations (# dcs ) and time required by clarans on sim- ulation data of §3 with σ = 2−4 at different opti- misation levels. dataset a1 a2 a3 birch1 birch2 birch3 ConfLong dim032 dim064 dim1024 europe N # 3000 1 5250 2 7500 3 100000 4 100000 5 100000 6 164860 7 1024 8 1024 9 1024 10 11 169308 dim 2 2 2 2 2 2 3 32 64 1024 2 TL [s] K 1.94 40 1.37 70 1.69 100 21.13 200 15.29 200 16.38 200 30.74 22 1.13 32 1.19 32 7.68 32 1000 166.08 N dataset # housec8 12 KDD∗ mnist Mopsi rna∗ s1 s2 s3 s4 song∗ susy∗ yeast 34112 13 145751 10000 14 13467 15 20000 16 17 5000 5000 18 5000 19 5000 20 20000 21 22 20000 1484 23 TL [s] dim K 3 18.71 400 200 998.83 74 784 300 233.48 2.14 2 6.84 8 2 1.20 1.50 2 1.39 2 1.44 2 71.10 90 18 24.50 1.23 8 100 200 30 30 30 30 200 200 40 Table 3: The 23 datasets. Column 'TL' is time allocated to run with each initialization scheme, so that no new runs start after TL elapsed seconds. The starred datasets are those used in Bachem et al. (2016), the remainder are available at https://cs.joensuu.fi/sipu/datasets. Rather than run each method a fixed number of times, we therefore run each method as many times as possible in a given time limit, 'TL'. This dataset dependent time limit, given by columns TL in Table 3, is taken as 80× the time of a single run of km+++lloyd. The numbers of runs completed in time TL by each method are in columns 1-5 of Table 4. Recall that our stopping criterion for clarans is K 2 consecutively rejected swap proposals. We have also experimented with stopping criterion based on run time and number of swaps implemented, but find that stopping based on num- ber of rejected swaps best guarantees convergence. We use K 2 rejections for simplicity, although have found that fewer than K 2 are in general needed to obtain minimal MSEs. We use the fast lloyd implementation accompanying Newling and Fleuret (2016) with the 'auto' flag set to select the best exact accelerated algorithm, and run until complete convergence. For initializations, we use our own C++/Cython implementation of level 2 optimised clarans, the im- plementation of afk-mc2 of Bachem et al. (2016), and km++ and bf of Newling and Fleuret (2016). The objective of Bachem et al. (2016) was to prove and experimentally validate that afk-mc2 pro- duces initialization MSEs equivalent to those of km++, and as such lloyd was not run during ex- periments. We consider both initialization MSE, as in Bachem et al. (2016), and final MSE after lloyd has run. The latter is particularly important, as it is the objective we wish to minimize in the K-means problem. In addition to considering initialization and final MSEs, we also distinguish between mean and minimum MSEs. We believe the latter is important as it captures the varying time requirements, and as mentioned it is common to run lloyd several times and retain the lowest MSE clustering. In Table 4 we consider two MSEs, namely mean initialization MSE and minimum final MSE. 6 runs completed mean initial mse minimum final mse m k + + k f a 2 c m i n u f b s n a r a l c m k + + k f a 2 c m i n u s n a r a l c m k + + k f a 2 c m i n u f b s n a r a l c 135 1 81 2 82 3 79 4 85 5 68 6 84 7 84 8 81 9 144 10 70 11 80 12 13 102 14 88 91 15 107 16 84 17 100 18 88 19 20 88 96 21 116 22 23 82 gm 90 65 24 21 27 22 22 66 29 29 52 25 27 74 43 23 28 31 39 36 36 52 48 31 34 8 138 5 85 6 87 95 28 137 27 23 77 75 38 5 88 90 5 311 24 28 15 21 81 65 56 276 83 7 52 86 28 5 85 7 100 6 83 87 6 98 67 134 67 5 81 93 14 29 7 4 5 6 4 46 19 16 18 4 4 5 4 4 4 25 30 24 24 4 4 6 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 0.98 0.97 0.99 0.99 0.99 1.96 2.07 1.54 3.8 2.35 1.17 0.98 43.1 1.01 >102 0.99 >102 20.2 2.09 0.99 1 1 1 1 1 1 1 1 1 0.99 1.01 0.99 1.05 1.01 4 1 25 24.5 2.79 2.24 1.55 1.65 1.14 1.04 1.18 4.71 0.6 0.6 0.63 0.59 0.58 0.59 0.61 0.57 0.62 0.59 0.61 0.63 0.58 0.63 0.61 0.62 0.63 0.59 0.69 0.66 0.66 0.66 0.66 0.66 0.62 0.62 0.62 0.64 0.63 0.59 0.67 0.64 0.64 0.68 0.68 0.63 0.73 0.64 0.64 0.64 0.64 0.64 0.65 0.65 0.65 0.66 0.66 0.63 0.66 0.66 0.66 0.66 0.69 0.63 0.72 0.62 0.61 0.62 0.62 0.59 0.72 0.67 0.67 2.25 0.64 0.77 0.73 0.74 0.69 0.77 0.69 0.69 0.75 0.75 0.69 0.87 0.6 0.6 0.6 0.57 0.57 3.71 3.62 0.51 0.62 0.62 0.61 2.18 2.42 0.56 0.7 0.66 0.65 0.67 0.69 0.65 0.69 0.65 0.65 0.66 0.66 0.64 0.71 0.65 0.65 0.66 0.67 0.65 0.71 0.65 0.64 0.64 0.65 0.64 0.8 0.65 0.81 0.69 0.69 0.69 0.69 0.69 0.74 0.65 0.65 0.65 0.67 0.64 0.7 0.62 0.67 0.66 0.71 0.64 0.64 0.79 0.61 2.4 0.7 0.7 0.6 0.6 0.7 0.8 Table 4: Summary of results on the 23 datasets (rows). Columns 1 to 5 contain the number of initial- ization+lloyd runs completed in time limit TL. Columns 6 to 14 contain MSEs relative to the mean initialization MSE of km++. Columns 6 to 9 are mean MSEs after initialization but before lloyd, and columns 10 to 14 are minimum MSEs after lloyd. The final row (gm) contains geometric means of all columns. clarans consistently obtains the lowest across all MSE measurements, and has a 30% lower initialization MSE than km++ and afk-mc2, and a 3% lower final minimum MSE. Figure 6: Initialization (above) and final (below) MSEs for km++ (left bars) and clarans (right bars), with minumum (1), mean (2) and mean + standard deviation (3) of MSE across all runs. For all initialization MSEs and most final MSEs, the lowest km++ MSE is several standard deviations higher than the mean clarans MSE. 7 0.50.60.70.80.91.01.1initialisationMSE(2)(1)(3)1234567891011121314151617181920212223dataset0.50.60.70.80.91.01.1finalMSEkm++clarans 5.1 Baseline performance We briefly discuss findings related to algorithms uni, bf, afk-mc2 and km++. Results in Table 4 corroborate the previously established finding that uni is vastly outperformed by km++, both in initialization and final MSEs. Table 4 results also agree with the finding of Bachem et al. (2016) that initialization MSEs with afk-mc2 are indistinguishable from those of km++, and moreover that final MSEs are indistinguishable. We observe in our experiments that runs with km++ are faster than those with afk-mc2 (columns 1 and 2 of Table 4). We attribute this to the fast blas-based km++ implementation of Newling and Fleuret (2016). Our final baseline finding is that MSEs obtained with bf are in general no better than those with uni. This is not in strict agreement with the findings of Celebi et al. (2013). We attribute this discrepancy to the fact that experiments in Celebi et al. (2013) are in the low K regime (K < 50, N/K > 100). Note that Table 4 does not contain initialization MSEs for bf, as bf does not initialize with data points but with means of sub-samples, and it would thus not make sense to compare bf initialization with the 4 seeding methods. 5.2 clarans performance Having established that the best baselines are km++ and afk-mc2, and that they provide clusterings of indistinguishable quality, we now focus on the central comparison of this paper, that between km++ with clarans. In Figure 6 we present bar plots summarising all runs on all 23 datasets. We observe a very low variance in the initialization MSEs of clarans. We speculatively hypothesize that clarans often finds a globally minimal initialization. Figure 6 shows that clarans provides significantly lower initialization MSEs than km++. The final MSEs are also significantly better when initialization is done with clarans, although the gap in MSE between clarans and km++ is reduced when lloyd has run. Note, as seen in Table 4, that all 5 initializations for dataset 7 result in equally good clusterings. As a supplementary experiment, we considered initialising with km++ and clarans in series, thus using the three stage clustering km+++clarans+lloyd. We find that this can be slightly faster than just clarans+lloyd with identical MSEs. Results of this experiment are presented in §SM-I. We perform a final experiment measure the dependence of improvement on K in §SM-I, where we see the improvement is most significant for large K. 6 Conclusion and Future Works In this paper, we have demonstrated the effectiveness of the algorithm clarans at solving the k- medoids problem. We have described techniques for accelerating clarans, and most importantly shown that clarans works very effectively as an initializer for lloyd, outperforming other initial- ization schemes, such as km++, on 23 datasets. An interesting direction for future work might be to develop further optimisations for clarans. One idea could be to use importance sampling to rapidly obtain good estimates of post-swap energies. Another might be to propose two swaps simultaneously, as considered in Kanungo et al. (2002), which could potentially lead to even better solutions, although we have hypothesized that clarans is already finding globally optimal initializations. All source code is made available under a public license. It consists of generic C++ code which can be extended to various data types and metrics, compiling to a shared library with extensions in Cython for a Python interface. It can currently be found in the git repository https://github. com/idiap/zentas. Acknowledgments James Newling was funded by the Hasler Foundation under the grant 13018 MASH2. 8 References Arthur, D. and Vassilvitskii, S. (2007). K-means++: The advantages of careful seeding. In Proceed- ings of the Eighteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '07, pages 1027–1035, Philadelphia, PA, USA. Society for Industrial and Applied Mathematics. Bachem, O., Lucic, M., Hassani, S. H., and Krause, A. (2016). Fast and provably good seedings for k-means. In Neural Information Processing Systems (NIPS). Bradley, P. S. and Fayyad, U. M. (1998). Refining initial points for k-means clustering. In Proceed- ings of the Fifteenth International Conference on Machine Learning, ICML '98, pages 91–99, San Francisco, CA, USA. Morgan Kaufmann Publishers Inc. Celebi, M. E., Kingravi, H. A., and Vela, P. A. (2013). A comparative study of efficient initialization methods for the k-means clustering algorithm. Expert Syst. Appl., 40(1):200–210. Elkan, C. (2003). Using the triangle inequality to accelerate k-means. In Machine Learning, Pro- ceedings of the Twentieth International Conference (ICML 2003), August 21-24, 2003, Washing- ton, DC, USA, pages 147–153. Hartigan, J. A. (1975). Clustering Algorithms. John Wiley & Sons, Inc., New York, NY, USA, 99th edition. Hastie, T. J., Tibshirani, R. J., and Friedman, J. H. (2001). The elements of statistical learning : data mining, inference, and prediction. Springer series in statistics. Springer, New York. Kanungo, T., Mount, D. M., Netanyahu, N. S., Piatko, C. D., Silverman, R., and Wu, A. Y. (2002). A local search approximation algorithm for k-means clustering. In Proceedings of the Eighteenth Annual Symposium on Computational Geometry, SCG '02, pages 10–18, New York, NY, USA. ACM. Kaufman, L. and Rousseeuw, P. J. (1990). Finding groups in data : an introduction to cluster analysis. Wiley series in probability and mathematical statistics. Wiley, New York. A Wiley- Interscience publication. Lewis, D. D., Yang, Y., Rose, T. G., and Li, F. (2004). Rcv1: A new benchmark collection for text categorization research. Journal of Machine Learning Research, 5:361–397. Newling, J. and Fleuret, F. (2016). Fast k-means with accurate bounds. International Conference on Machine Learning (ICML), pages 936–944. In Proceedings of the Ng, R. T. and Han, J. (1994). Efficient and effective clustering methods for spatial data mining. In Proceedings of the 20th International Conference on Very Large Data Bases, VLDB '94, pages 144–155, San Francisco, CA, USA. Morgan Kaufmann Publishers Inc. Ng, R. T. and Han, J. (2002). Clarans: A method for clustering objects for spatial data mining. IEEE Transactions on Knowledge and Data Engineering, pages 1003–1017. Park, H.-S. and Jun, C.-H. (2009). A simple and fast algorithm for k-medoids clustering. Expert Syst. Appl., 36(2):3336–3341. Telgarsky, M. and Vattani, A. (2010). Hartigan's method: k-means clustering without voronoi. In AISTATS, volume 9 of JMLR Proceedings, pages 820–827. JMLR.org. Wu, X., Kumar, V., Quinlan, J. R., Ghosh, J., Yang, Q., Motoda, H., McLachlan, G., Ng, A., Liu, B., Yu, P., Zhou, Z.-H., Steinbach, M., Hand, D., and Steinberg, D. (2008). Top 10 algorithms in data mining. Knowledge and Information Systems, 14(1):1–37. Yujian, L. and Bo, L. (2007). A normalized levenshtein distance metric. IEEE Trans. Pattern Anal. Mach. Intell., 29(6):1091–1095. 9 SM-A Generalised K-Medoids Results The potential uses of clarans as a K-medoids algorithm go well beyond K-Means initialization. In this Appendix, we wish to demonstrate that clarans should be chosen as a default K-medoids algorithm, rather than medlloyd. In its most general form, the K-medoids problem is to minimize, N(cid:88) i=1 E(C) = 1 N f (x(i), x(i(cid:48))). arg min i(cid:48)∈C (1) We assume that f is of the form, f (x(i), x(i(cid:48))) = ψ(dist(x(i), x(i(cid:48)))), (2) where ψ is non-decreasing, and samples belong to a metric space with metric dist(·,·). Con- straint 2 allows us to use the triangle inequality to eliminate certain distance calculations. We now present examples comparing clarans and medlloyd in various settings, showing the effective- ness of clarans. Table 5 describes artificial problems, with results in Figure 7. Table 6 describes real-world problems, with results in Figure 8. syn-1 syn-2 syn-3 syn-4 N 2000 20000 28800 20000 K 40 100 144 100 type metric sequence Levenshtein sparse-v dense-v dense-v l2 l1 l∞ ψ(d) d d2 ed Id>0.05 Table 5: Synthetic datasets used for comparing K-medoids algorithms (Figure 7). syn-1: Each of the cluster centers is a random binary sequence of 16 bits (0/1). In each of the clusters, 50 elements are generated by applying 2 mutations (insert/delete/replacement) to the center, at random locations. syn-2: Each of the centers is a vector in R106, non-zero at exactly 5 indices, with the 5 non-zero values drawn from N (0, 1). Each sample is a linear combination of two centers, with coefficients 1 and Q respectively, where Q ∼ U [−0.5, 0.5]. syn-3: Centers are integer co-ordinates of an 12 × 12 grid. For each center, 50 samples are generated, each sample being the center plus Gaussian noise of identity covariance, as in the simulation data in the main text. syn-4: Data are points drawn uniformly from [0, 1]2. We attempt cover a unit square with 100 squares of diameter 0.1, a task with a unique lattice solution. Points not covered have energy 1, while covered points have energy 0. SM-B The task We state precisely the K-medoids task in the setting where dissimilarity is an increasing function of a distance function. Given a set of N elements, {x(i) : i ∈ {1, . . . , N}}, with a distance defined rcv1 genome mnist words N 23149 400000 10000 354983 K 400 1000 400 1000 type metric l2 sparse-v sequence dense-v sequence Levenshtein n-Levensh. l2 ψ(d) d2 d2 d2 d2 Table 6: Real datasets used for comparing K-medoids algorithms (Figure 8), with data urls in SM-E. rcv1: The Reuters Corpus Volume I training set of Lewis et al. (2004), a sparse datasets containing news article categorisation annotation. genome: Nucleotide subsequences of lengths 10,11 or 12, randomly selected from chromosome 10 of a Homo Sapiens. Note that the normalised Levenshtein metric (Yujian and Bo, 2007) is used. mnist: The test images of the MNIST hand-written digit dataset. words: A comprehensive English language word list. 10 Figure 7: Results on synthetic datasets. Algorithms clarans and medlloyd are run four times with random seedings. Each experiment is run with a time limit of 64 seconds. The vertical axis is mean energy (dissimilarity) across samples. In all experiments, medlloyd gets trapped in local minima before 64 seconds have elapsed, and clarans always obtains significantly lower energies than medlloyd. Figure 8: Results on real datasets. Vertical axes are energies relative to the lowest energy found. We observe that medlloyd performs very poorly on sequence datasets (right), failing to find clusterings significantly better than the random initializations. While an improvement over the initial seeding is obtained using vik on the vector datasets (left), the energies obtained using clarans are signif- icantly lower. Runs with clarans appear to converge to a common energy solution, even though initial energies vary greatly, as is the case in on dataset rcv1. The majority of runs with medlloyd converge to a local minimum before the allotted time limit of 210 seconds. between elements, dist(x(i), x(i(cid:48))) ≥ 0, dist(x(i), x(i)) = 0, dist(x(i), x(i(cid:48))) = dist(x(i(cid:48)), x(i)), dist(x(i), x(i(cid:48)(cid:48))) ≤ dist(x(i), x(i(cid:48))) + dist(x(i(cid:48)), x(i(cid:48)(cid:48))), and given an energy function ψ : R+ → R+ satisfying, ψ(0) = 0, v1 ≤ v2 ⇐⇒ ψ(v1) ≤ ψ(v2), 11 1.82.6energysyn-10.53.5syn-22−52−22124time[s]1.62.3energysyn-32−52−22124time[s]0.00.2syn-4claransmedlloyd1.01.11.21.3energyrcv11.01.1genome212427210time[s]1.01.1energymnistclaransmedlloyd26272829210time[s]1.01.11.2words The task is to find indices {c(k) : k ∈ {1, . . . , K}} ⊂ {1, . . . , N}, to minimize, N(cid:88) min k∈{1,...,K} ψ(dist(x(i), x(c(k))). i=1 SM-C The pam algorithm Algorithm 3 The pam algorithm of Kaufman and Rousseeuw (1990) is a computationally inefficient predecessor of clarans. At lines 4 and 5, one loops over all possible (medoid, non-medoid) swaps, recording the energy obtained with each swap. At line 9, the best of all possible swaps is chosen. At line 10, if the best found swap results in a decrease in energy, proceed, otherwise stop. 1: t ← 0 2: Initialize C0 ⊂ {1, . . . , N}. 3: while true do 4: 5: for ip ∈ {1, . . . , N} \ Ct do for kp ∈ {1, . . . , K} do i(cid:48)∈Ct\{ct(kp)}∪{ip} ψ(dist(x(i), x(i(cid:48)))) min t+1(ip, kp) ← N(cid:88) ψp i=1 6: 7: 8: 9: p, k∗ end for i∗ p, k∗ if ψp end for p ← arg min ip,kp t+1(i∗ p) < 0 then Ct+1 ← Ct \ {ct(k∗ break end if t ← t + 1 else 10: 11: 12: 13: 14: 15: 16: end while ψp t+1(ip, kp) p} p)} ∪ {i∗ SM-D clarans In Detail, And How To Accelerate It We start by presenting modified notation, required to describe our optimisations of clarans (Ng and Han, 1994) in full pseudocode. As before, we will let the N samples which we want to partition into K clusters be x(1), . . . , x(N ). Let t ∈ {1, . . . ,∞} denote the current round of the algorithm. Let ct(k) ∈ {1, . . . , N} be the index of the sample chosen as the center of cluster k ∈ {1, . . . , K} at iteration t, so that x(ct(k)) is the center of cluster k at iteration t. Let Ct = {ct(k) k ∈ {1, . . . , K}} ⊂ {1, . . . , N} denote all such center indices. We let a1 t (i) be the cluster of sample i, that is a1 t (i) = arg min k∈{1,...,K} f (x(i), x(ct(k))). (3) Let ψt(k) denote the sum of the dissimilarities of elements in cluster k at iteration t, also referred to as the energy of cluster k, so that (cid:88) Let ψt =(cid:80) ψt(k) = f (x(i), x(ct(k))). k ψt(k) be the total energy, the quantity which we ultimately wish to minimize. i:a1 t (i)=k We assume here that dissimilarity can be decomposed as in Eqn. (2), which will enable the use of the triangle inequality. Let d1 t (i) be the distance at iteration t of sample i to its nearest center, that is d1 t (i) = min i(cid:48)∈Ct dist(x(i), x(i(cid:48))). 12 Under assumption (2), we now have (3) taking the form, a1 t (i) = arg min k∈{1,...,K} dist(x(i), x(ct(k))), so that d1 center, we will use a2 t (i) = dist(x(i), x(ct(a1 t (i) and d2 t (i)))). In the same way as we use a1 t (i) for the second nearest center, that is t (i) and d1 t (i) for the nearest d2 t (i) = a2 t (i) = min i(cid:48)∈Ct\{ct(a1 arg min k∈{1,...,K}\{a1 t (i))} dist(x(i), x(i(cid:48))), t (i)} dist(x(i), x(ct(k))), t (i) = dist(x(i), x(ct(a2 t (i)))). The energy of a sample is now defined as the energy of the t (i)). Finally, let t (i)). Some cluster specific quantities so that d2 distance to its nearest center, so that at iteration t the energy of sample x(i) is ψ(d1 the margin of sample i be defined as mt(i) = ψ(d2 which are required in the accelerated algorithm are, Nt(k) = {i : a1 D1 t (k) = max t (i))− ψ(d1 t (i) = k}, d1 t (i), D2 t (k) = max M∗ t (k) = (4) mt(i). i:a1 t (i)=k i:a1 t (i)=k 1 d2 t (i), (cid:88) Nt(k) i:a1 t (i)=k The key triangle inequality results used to accelerate clarans evaluations are now presented, with proofs in §SM-D.2. Firstly, dist(x(ip), x(ct(kp))) ≥ D1 t (kp) =⇒ change in energy of cluster kp is Nt(kp)M∗ t (kp) + D2 t (kp), which says that if the new center x(ip) of cluster kp is sufficiently far from the old center x(ct(kp)), then all old elements of cluster kp will migrate to their old second nearest clusters, and so their change in energies will simply be their margins, which have already been computed. The second inequality used is, k (cid:54)= kp ∧ dist(x(ct(k)), x(ip)) ≥ 2D1 t (k) =⇒ no change in energy of cluster k, which states that if cluster k is sufficiently far from the new center of kp, there is no change in its energy as the indices of samples assigned to it do not change. These implications allow changes in energies of entire clusters to be determined in a single com- parison. Clusters likely to benefit from these tests are those lying far from the new proposed center x(ip). The above tests involve the use of dist(x(ct(k)), x(ip)), but the computation of this quantity can sometimes be avoided by using the inequality, dist(x(ct(k)), x(ip)) ≥ cct(a1 t (ip), k) − D1 t (ip), where cct is the K × K matrix of inter-medoid distances at iteration t. To accelerate the update step of clarans, the following bound test is used, min(dist(x(ct(kp)), x(ct(k))), dist(x(ip), x(ct(k)))) > D1 t (k) + D2 t (k) =⇒ no change in cluster k. We also use a per-sample version of the above inequality for the case of failure to eliminate the entire cluster. Full proofs, descriptions, and algorithms incorporating these triangle inequalities can be found in SM-D.2. 13 SM-D.1 Review of notation and ideas Consider a proposed update for centers at iteration t + 1, where the center of cluster kp is replaced by x(ip). Let δt(i kp (cid:67) ip) denote the change in energy of sample i under such an update, that is δt(i kp (cid:67) ip) = energy after swap − energy before swap = min i(cid:48)∈Ct\{ct(kp)}∪{ip} ψ(dist(x(i), x(i(cid:48)))) − ψ(d1 t (i)} throughout for brevity. Finally, let t (i)). We choose subscript 'p' for kp and ip, as together they define a proposed swap. We will write a12d12 t (i) = {a1 t (i), a2 t (i), d1 t (i), d2 D1 t (k) = max i:a1 t (i)=k D2 t (k) = max i:a1 t (i)=k d1 t (i), d2 t (i). N (cid:80)N i=1 δt(i kp (cid:67) ip) Algorithm 4 One round of clarans. The potential bottlenecks are the proposal evaluation at line 2 and the update at line 6. The cost of proposal evaluation, if all distances are pre-computed, is O(N ), while if distances are not pre-computed it is O(dN ) where d is the cost of a distance computation. As for the update step, there is no cost if ∆t ≥ 0 as nothing changes, however if the proposal is accepted then Ct+1 (cid:54)= Ct, and all data whose nearest or second nearest center change needs updating. 1: Make proposal kp ∈ {1, . . . K} and ip ∈ {1, . . . , N} \ Ct. 2: ∆t(kp (cid:67) ip) ← 1 3: if ∆t < 0 then 4: 5: 6: 7: 8: else 9: 10: 11: 12: 13: end if end for Ct+1 ← Ct for i ∈ {1, . . . , N} do Ct+1 ← Ct \ {ct(kp)} ∪ {ip} for i ∈ {1, . . . , N} do (cid:46) The assignment evaluation step, see Alg. 5 (cid:46) The update step, see Alg. 6 t+1(i) ← a12d12 Set a12d12 end for a12d12 t+1(i) t (i) else t (i) then t (i) = kp then if d ≥ d2 Algorithm 5 Standard approach (level 0) with clarans for computing δt(i kp (cid:67) ip) at iteration t, as described in Ng and Han (1994). Note however that here we do not store all N 2 distances, as in Ng and Han (1994). 1: d ← dist(x(i), x(ip)) 2: if a1 3: 4: 5: 6: 7: 8: else 9: 10: 11: 12: 13: 14: end if δt(i kp (cid:67) ip) ← ψ(d2 δt(i kp (cid:67) ip) ← ψ(d) − ψ(d1 δt(i kp (cid:67) ip) ← 0 δt(i kp (cid:67) ip) ← ψ(d) − ψ(d1 end if if d ≥ d1 t (i)) − ψ(d1 t (i) then end if t (i)) t (i)) t (i)) else SM-D.2 Accelerating clarans We now discuss in detail how to accelerate the proposal evaluation and the cluster update. We split our proposed accelerations into 3 levels. At levels 1 and 2, triangle inequality bounding techniques 14 t (i) = kp then t (i) = kp or a2 Get dist(x(i), x(ct+1(k))) for all k ∈ {1, . . . , K} Use above k distances to set a12d12 Algorithm 6 Simple approach (level 0) with clarans for computing a12d12 1: // If the center which moves is nearest or second nearest, complete update required 2: if a1 3: 4: 5: else 6: 7: 8: 9: end if // d1 d ← dist(x(i), x(ip)) Use the fact that {d1 t (i), d} to set a12d12 t+1(i)} ⊂ {d1 t (i) are still valid distances, so need only check new candidate center kp t (i) and d2 t+1(i), d2 t (i), d2 t+1(i) t+1(i) t (i) are used to eliminate distance calculations. At level 3, an early breaking scheme is used to quickly reject unpromising swaps. SM-D.2.1 Basic triangle inequalities bounds We show how δt(i kp (cid:67) ip) can be bounded, with the final bounding illustrated in Figure 9. There are four bounds to consider : upper and lower bounds for each of the two cases kp = a1 t (i) (the center being replaced is the center of element i) and kp (cid:54)= a1 t (i) (the center being replaced is not the center of element i). We will derive a lower bound for the two cases simultaneously, thus we will derive 3 bounds. First, consider the upper bound for the case kp (cid:54)= a1 t (i), δt(i kp (cid:67) ip) = min i(cid:48)∈Ct\{ct(kp)}∪{ip} ψ(dist(x(i), x(i(cid:48)))) − ψ(d1 min i(cid:48)∈{ct(a1 t (i)),ip} ψ(dist(x(i), x(i(cid:48)))) − ψ(d1 t (i)), t (i)), t (i))))) − ψ(d1 t (i)), = ≤ ψ(dist(x(i), x(ct(a1 = 0. and thus we have kp (cid:54)= a1 t (i) =⇒ δt(i kp (cid:67) ip) ≤ 0. (5) Implication 5 simply states the obvious fact that the energy of element i cannot increase when a center other than that of cluster a1 t (i) is replaced. The other upper bound case to consider is kp = a1 t (i), which is similar, δt(i kp (cid:67) ip) = min i(cid:48)∈Ct\{ct(kp)}∪{ip} ψ(dist(x(i), x(i(cid:48)))) − ψ(d1 min i(cid:48)∈{ct(a2 t (i)),ip} ψ(dist(x(i), x(i(cid:48)))) − ψ(d1 t (i)), t (i)), t (i))))) − ψ(d1 t (i)), = ≤ ψ(dist(x(i), x(ct(a2 = ψ(d2 t (i)), = mt(i), ≤ Mt(kp). t (i)) − ψ(d1 and thus we have kp = a1 t (i) =⇒ δt(i kp (cid:67) ip) ≤ Mt(i). (6) Implication 6 simply states the energy of element i cannot increase by more than the maximum margin in the cluster of i when it is the center of cluster a1 t (i) which is replaced. We now consider lower bounding δt(i kp (cid:67) ip) for both the cases a1 t (i) (cid:54)= kp simultaneously. We t (i) = kp and a1 15 t (a1 Let dp(k) denote the distance between the elements in the proposed swap, The triangle inequality guarantees that, Using (8) in (7) we obtain, dist(x(i), x(ip)) ≥ − ψ(D1 ψ(dp(a1 0 δt(i kp(cid:67)ip) ≥ t (a1 t (i))) t (i)) − D1 t (i))) − ψ(D1 t (a1 t (a1 t (i))) if dp(a1 if D1 t (a1 if 2D1 t (a1 t (i)) ≤ D1 t (a1 t (i)) < dp(a1 t (i)) < dp(a1 t (i)) t (i)) ≤ 2D1 t (i)). t (a1 t (i)) Figure 9: Illustrating the bounds. Dark gray regions denote possible changes in energy of elements. On the left, the case k = kp, where the solid line segment is the average change in element energy in the case where dp exceeds a certain radius. On the right, the case k (cid:54)= kp, where sample energies can only decrease. choose to bound them simultaneously as doing so separately arrives at the same bound. δt(i kp (cid:67) ip) = t (i)), = min t (i)), i(cid:48)∈Ct\{ct(kp)}∪{ip} ψ(dist(x(i), x(i(cid:48)))) − ψ(d1 i(cid:48)∈Ct∪{ip} ψ(dist(x(i), x(i(cid:48)))) − ψ(d1 ≥ min t (i))(cid:1) , = min(cid:0)0, ψ(dist(x(i), x(ip))) − ψ(d1 t (i)),ip} ψ(dist(x(i), x(i(cid:48)))) − ψ(d1 min i(cid:48)∈{ct(a1 ≥ min(cid:0)0, ψ(dist(x(i), x(ip))) − ψ(D1 t (i)))(cid:1) . (cid:26)0 dp(k) = dist(x(ct(k)), x(ip)). t (i)), dp(a1 t (i)) − D1 t (a1 t (i)) if dp(a1 if D1 t (a1 t (i)) ≤ D1 t (a1 t (i)) < dp(a1 t (i)), t (i)). (7) (8) (9) These are the lower bounds illustrated in Figure 9. Define ∆(k kp (cid:67) ip) to be the average change in energy for cluster k resulting from a proposed swap, that is, ∆t(k kp (cid:67) ip) = δt(i kp (cid:67) ip). Let the average of the change in energy over all data resulting from a proposed swap be ∆t(kp (cid:67) ip), that is ∆t(kp (cid:67) ip) = pt(k)∆t(k kp (cid:67) ip). One can show that for k = kp, dp(kp) ≥ D1 (10) The equality (10) corresponds to a case where the proposed center x(ip) is further from every point in cluster kp than is the second nearest center, in which case the increase in energy of cluster kp is simply the sum of margins. It corresponds to the solid red horizontal line in Figure 9, left. t (kp) + D2 t (kp) =⇒ ∆t(k kp (cid:67) ip) = M∗ t (kp). (cid:88) i:a1 t (i)=kp 1 Nt(k) (cid:88) k What we wish to evaluate when considering a proposal is the mean change in energy, that is, SM-D.2.2 Level 1 proposal evaluation accelerations N(cid:88) i=1 1 N δt(i kp (cid:67) ip) = 1 N (cid:32) (cid:88) (cid:124) k:k(cid:54)=kp (cid:88) i:a1 t (i)=k (cid:123)(cid:122) (cid:88) δt(i kp (cid:67) ip) + δt(i kp (cid:67) ip) . (11) (cid:125) (cid:124) (cid:123)(cid:122) i:a1 t (i)=kp Nt(kp)∆(kpkp(cid:67) ip) (N−Nt(kp))∆ t (kp(cid:67) ip) − (cid:33) (cid:125) 16 R1t(k)2R1t(k)R1t(k)+R2t(k)dp(=dist(x(ct(k)),x(ip)))−ψ(R1t(k))0Mt(k)M∗t(k)δt(ikp(cid:67)ip)case:k=kpR1t(k)2R1t(k)R1t(k)+R2t(k)dp(=dist(x(ct(k)),x(ip)))case:k(cid:54)=kp Where in (11) we define ∆− t (kp (cid:67) ip) as, ∆− t (kp (cid:67) ip) = 1 N − Nt(kp) (cid:88) (cid:88) k:k(cid:54)=kp i:a1 t (i)=k δt(i kp (cid:67) ip). From SM-D.2.1 we have the result, corresponding to the solid line in Figure 9, that t (i) = k ∧ k (cid:54)= kp ∧ dist(x(ct(k)), x(ip)) ≥ 2D1 a1 (12) We use this result to eliminate entire clusters in the proposal evaluation step: a cluster k whose center lies sufficiently far from x(ip) will not contribute, as long as k (cid:54)= kp, t (k) =⇒ δt(i kp (cid:67) ip) = 0. (cid:88) (cid:88) ∆− t (kp (cid:67) ip) = 1 N − Nt(kp) k:k(cid:54)=kp∧ dist(x(ip),x(ct(k)))<2D1 t (k) i:a1 t (i)=k δt(i kp (cid:67) ip). Implication 10, corresponding to the solid line in Figure 9, left, can be used in the case k = kp to rapidly obtain the second term in (11) if dist(x(ct(kp)), x(ip)) ≥ D1 The level 1 techniques for obtaining whole cluster sums require the distances from x(ip) to all cluster centers, although in §SM-D.2.4 (level 2) we show how even these distance calculations can sometimes be avoided. A second layer of element-wise triangle inequality tests is included for the case where the test on an entire cluster fails. These level 1 techniques for accelerating the proposal are presented in Alg. 7. t (k) + D2 t (k). Algorithm 7 CLARANS-1-EVAL : proposal evaluation using level 1 accelerations. We call subroutines for processing the cluster kp (CLARANS-12-EVAL-P) and all other clusters (CLARANS-1-EVAL-N-P). The expected complexity for the full evaluation is O(d(K + N/K)). The expected complexity for CLARANS-12-EVAL-P assumes that the probability that cluster kp is not processed using (10) is O(1/K). 1: // Set distances from proposed center x(ip) to all current centers Ct 2: for k ∈ {1, . . . , K} do 3: 4: end for 5: dpp ← dc(kp) 6: // Process cluster kp 7: CLARANS-12-EVAL-P() 8: // Process all other clusters 9: CLARANS-1-EVAL-N-P() dc(k) ← dist(x(ip), x(ct(k))) (cid:46) O(dN/K 2) (cid:46) O(dN/K) (cid:46) O(dK) SM-D.2.3 Level 1 cluster update accelerations If a proposal is accepted, the standard CLARANS uses Alg. (6) to obtain a12d12 t+1(i), where every element i requires at least 1 distance calculation, with those elements for which cluster kp is the nearest or second nearest at t require K distance calculations. Here at level 1, we show how many samples requiring 1 distance calculation can be set without any distance calculations, and even better: how entire clusters can sometimes be processed in constant time. The inequality to eliminate an entire cluster is, min(dist(x(ct(kp)), x(ct(k))), dist(x(ip), x(ct(k)))) > D1 t (k) + D2 t (k) =⇒ no change in cluster k. (13) While the inequality used to eliminate the distance calculation for a single sample is, min(dist(x(ct(kp)), x(ct(k))), dist(x(ip), x(ct(k)))) > d1 (14) Note that the inequalities need to be strict, '≥' would not work. The test (13) is illustrated in Figure 10, left. These bound tests are used in Alg. (10). The time required to update cluster related quantities (D1, Dt, M∗) is negligible as compared to updating sample assignments, and we do not do anything clever to accelerate it, other than to note that only clusters which fail to be eliminated by (13) potentially require updating. =⇒ no change for sample i. t (i) + d2 t (i) 17 t (kp) end if end for t (kp) + D2 t (kp) then ∆t(kp (cid:67) ip) = ∆t(kp (cid:67) ip) + mt(i)/N t (t(cid:48)) = kp} do t (i) + d2 t (i) then // Test failed, need to compute distance d ← dist(x(ip), x(i)) ∆t(kp (cid:67) ip) = ∆t(kp (cid:67) ip) + min(d, mt(i))/N // Test (10) failed, enter element-wise loop for cluster kp for i ∈ {i(cid:48) : a1 // Try tighter element-wise version of (10) to prevent computing a distance if dpp ≥ d1 else Algorithm 8 CLARANS-12-EVAL-P : adding the contribution of cluster kp to ∆t(kp (cid:67) ip). The key inequality here is (10), which states that if ip is sufficiently far from the center of cluster kp, then elements in cluster kp will go to their current second nearest center if the center of kp is removed. 1: // Try to use (10) to quickly process cluster kp 2: if dpp ≥ D1 ∆t(kp (cid:67) ip) = ∆t(kp (cid:67) ip) + pt(kp)M∗ 3: 4: else 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: end if Algorithm 9 CLARANS-1-EVAL-N-P : adding contributions of all clusters k (cid:54)= kp to ∆t(kp (cid:67) ip). The key inequality used is (12), which states that if the distance between x(ip) and the center of cluster k is large relative to the distance from the center of cluster k to its most distant member, then there is no change in energy in cluster k. 1: for k ∈ {1, . . . , K} \ {kp} do 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: end for // Try tighter element-wise version of (12) to prevent computing a distance if dc(k) < 2d1 // Test (12) failed, enter element-wise loop for cluster k for i ∈ {i(cid:48) : a1 // Try to use (12) to quickly process cluster k if dc(k) < 2D1 t (k) then // Test failed, need to compute distance d ← dist(x(ip), x(i)) if d < d1 ∆t(kp (cid:67) ip) = ∆t(kp (cid:67) ip) + (d − d1 t (i) then t (t(cid:48)) = k} do t (i) then end for t (i))/N end if end if end if SM-D.2.4 Level 2 proposal evaluation accelerations We now discuss level 2 accelerations. Note that these accelerations come at the cost of an increase of O(K 2) to the memory footprint. The key idea is to maintain all K 2 inter-center distances, denoting by cct(k, k(cid:48)) = dist(x(ct(k)), x(ct(k(cid:48)))) the distance between centers of clusters k and k(cid:48). At level 1, all distances dist(x(ip), x(ct(k))) for k ∈ {1, . . . , K} are computed up-front for proposal evaluation, but here at level 2 we use, dist(x(ip), x(ct(k))) ≥ cct(a1 t (ip), k) − d1 t (ip), to eliminate the need for certain of these distances. Combining (15) with (12) gives, t (i) = k ∧ k (cid:54)= kp ∧ cct(a1 a1 t (ip), k) − d1 t (ip) ≥ 2D1 t (k) =⇒ δt(i kp (cid:67) ip) = 0. (15) (16) SM-D.2.5 Level 2 cluster update accelerations The only acceleration added at level 2 for the cluster update is for the case kp ∈ {a1 where at level 1, a12d12 t (i)}, t+1 is set from scratch, requiring all K distances to centers to be computed. t (i), a2 18 Figure 10: (left) illustrating test 13. Consider an element x(i) with a1 in the inner gray circle, and k (cid:54)= kp. Firstly, dist(x(ct(kp)), x(ct(k))) > D1 that a2 dist(x(ip), x(ct(k))) > D1 t (i). a2 t (i) = k, so that x(i) lies t (k) means t (i) will be valid distances at iteration t + 1. Then, as t+1(i) = t (k), we have dist(x(ip), x(i)) > D2 t (i) (cid:54)= kp, thus both d1 t (k) ≥ d2 t (i) and d2 t (k) + D2 t (i), so a2 t (k) + D2 (cid:46) O(dK) Obtain a12d12 t (t(cid:48)) = kp} do t+1(i) from scratch ( = min(dist(x(ct(kp)), x(ct(k))), dist(x(ct+1(kp)), x(ct(k))))) dc(k) ← min(dist(x(ct(kp)), x(ct(k))), dist(x(ip), x(ct(k)))) Algorithm 10 CLARANS-1-UPDATE : cluster update using level 1 accelerations. Inequalities (13) t+1(i) for i : a1(i) (cid:54)= kp∧a2(i) (cid:54)= kp. Essentially and (14) are used to accelerate the updating of a12d12 these inequalities say that if neither the old center of cluster kp nor its new center x(ip) are near to an element (or all elements in a cluster), then the nearest and second element of that element (or all elements on a cluster) will not change. 1: // Set distance from centers to the nearer of new and old cluster center kp 2: for k ∈ {1, . . . , K} do 3: 4: 5: end for 6: // Process elements in cluster kp from scratch 7: for i ∈ {i(cid:48) : a1 8: 9: end for 10: // Process all other clusters 11: for k ∈ {1, . . . , K} \ {kp} do 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: end for 29: Update cluster statistics for t + 1 where necessary t (k) then t (t(cid:48)) = k} do t (k) + d2 t (i) = kp then Obtain a12d12 d ← dist(x(i), x(ip)) Use {d1 // Try to use (14) to quickly process element i if dc(k) ≤ d1 // Try to use (13) to quickly process cluster k if dc(k) ≤ D1 t+1(i) ← a12d12 t (i), d} as in (6) t+1(i) from scratch for i ∈ {i(cid:48) : a1 t+1(i), d2 t+1(i)} ⊂ {d1 t (i), d2 end if end for if a2 else t (k) then t (k) + D2 else end if a12d12 t (i) end if 19 x(ct(k))x(ip)x(ct(kp))D1t(k)D2t(k) t (k) then // Try to use (16) to quickly process cluster k if cct(a1 t (ip), k) − 2D1 t (ip) then // Test (10) failed, enter element-wise loop for cluster k for i ∈ {i(cid:48) : a1 t (k) < d1 // Test (16) failed, computing dc(k) and resorting to level 1 accelerations... dpk ← dist(x(ip), x(ct(k))) if dpk < 2D1 Algorithm 11 CLARANS-2-EVAL-N-P : add contribution of all clusters k (cid:54)= kp to ∆t(kp (cid:67) ip). In addition to the bound tests used at level 1, inequality (16) is used to test if a center-center distance needs to be calculated. 1: for k ∈ {1, . . . , K} \ {kp} do 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: end for // Try tighter element-wise version of (12) to prevent computing a distance if dpk < 2d1 // Test failed, need to compute distance d ← dist(x(ip), x(i)) if d < d1 ∆t(kp (cid:67) ip) ← ∆t(kp (cid:67) ip) + (d − d1 t (t(cid:48)) = k} do t (i) then end if end if end for end if end if t (i) then t (i))/N Algorithm 12 CLARANS-2-EVAL : Proposal evaluation using level 2 accelerations. Unlike at level 1, not all distances from x(ip) to centers need to be computed up front. 1: dpp ← dist(x(ip), x(ct(kp))) 2: // Process cluster kp 3: CLARANS-12-EVAL-P() 4: // Process all other clusters 5: CLARANS-2-EVAL-N-P() (cid:46) O(dN/K 2) (cid:46) O(dN/K) At level 2, we use cct to eliminate certain of these distances using WARMSTART, which takes in the distances to 2 of the K centers and uses the larger of these as a threshold beyond which any distance to a center can be ignored. SM-D.3 Level 3 At levels 1 and 2, we showed how clarans can be accelerated using the triangle inequality. The accelerations were exact, in the sense that for a given initialization, the clustering obtained using clarans is unchanged whether or not one uses the triangle inequality. Here at level 3 we diverge from exact acceleration. In particular, we will occasionally reject good proposals. However, the proposals which are accepted are still only going to be good ones, so that the energy strictly decreases. In this sense, it is not like stochastic gradient descent, where the loss is allowed to increase. The idea is to the following. Given a proposal swap : replace the center of cluster kp with the element indexed by ip, use a small sample of data to estimate the quality of the swap, and if the estimate is bad (increase in energy) then immediately abandon the proposal and generate a new proposal. If the estimate is good, obtain a more accurate estimate using more (2×) elements. Repeat this until all the elements have been used and the exact energy under the proposed swap is known : if the exact energy is lower, implement the swap otherwise reject it. The level 1 and 2 accelerations can be used in parallel with the acceleration here. The elements sub sampled at level 3 are chosen to belong to clusters which are not eliminated using level 1 and 2 cluster-wise bound tests. Suppose that there are K clusters which are not eliminated at level 2, we 20 t (i). dc(k) ← min(cct(kp, k), cct+1(kp, k)) t (t(cid:48)) = kp} do d ← dist(x(i), ct+1(kp)) t+1(i), using WARMSTART with d and d2 Obtain a12d12 Algorithm 13 CLARANS-2-UPDATE : update using level 2 accelerations. The only addition to level 1 accelerations is the use of WARMSTART to avoid computing all k sample-center distances for elements whose nearest or second nearest is kp. 1: For k ∈ {1, . . . , K} \ {kp}: compute dist(x(ip), x(ct(k))) ( = dist(x(ct+1(kp)), x(ct+1(k))) and set cct+1 accordingly (in practice we don't need to store cct and cct+1 simultaneously as they are very similar). 2: for k ∈ {1, . . . , K} do 3: 4: end for 5: // Process elements in cluster kp from scratch 6: for i ∈ {i(cid:48) : a1 7: 8: 9: end for 10: // Process all other clusters 11: for k ∈ {1, . . . , K} \ {kp} do 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: end for 29: Update cluster statistics for t + 1 where necessary t+1(i), using WARMSTART with d and d1 t (i), d} as in (6) // Try to use (14) to quickly process element i if dc(k) ≤ d1 // Try to use (13) to quickly process cluster k if dc(k) ≤ D1 t (k) + D2 t (k) then d ← dist(x(i), ct+1(kp)) if a2 t (k) then t (t(cid:48)) = k} do t (k) + d2 t (i) = kp then Obtain a12d12 Use {d1 t+1(i), d2 a12d12 t+1(i) ← a12d12 t (i) t+1(i)} ⊂ {d1 t (i), d2 for i ∈ {i(cid:48) : a1 else end if t (i). else end if end for end if choose the number of elements chosen in the smallest sub sample to be 30 K. Thereafter the number of elements used to estimate the post-swap energy doubles. Let the number of elements in the K non-eliminated clusters by nA and the number sampled be nS, so that nS = 30 K. Supposing that nA/nS is a power of 2. Then, one can show that the probability that a good swap is rejected is bounded above by 1 − nS/nA. Consider the case nA/nS = 2, so that the sample is exactly half of the total. Suppose that the swap is good. Then, if the sum over the sample is positive, the sum over its complement must be negative, as the total sum is negative. Thus there at least as many ways to draw nS samples whose sum is negative as positive. If nA/nS = 4, then consider what happens if one randomly assign another quarter to the sample. With probability one half the sum is negative, thus by the same reasoning with probability at least 1/2 × 1/2 = 1/4 the sum over the original nS samples is negative. SM-E Links to datasets : rcv1 dataset http://jmlr.csail.mit.edu/papers/volume5/lewis04a/ The a13-vector-files/lyrl2004_vectors_train.dat.gz Chromosone 10 : http://ftp.ensembl.org/pub/release-77/fasta/homo_sapiens/dna/ Homo_sapiens.GRCh38.dna.chromosome.10.fa English word list : https://github.com/dwyl/english-words.git 21 3: NT ←(cid:80) k∈U Nt(k) Algorithm 14 Level 3: Schemata of using sub sampling to quickly eliminate unpromising proposals without computing an exact energy. This allows for more rapid proposal evaluation. 1: Determine which clusters are not eliminated at level 2, define to be U. 2: K ← U. 4: NS ← 30 K 5: S ← uniform sample of indices of size NS from clusters U 6: ∆t(kp (cid:67) ip) ← ∞ 7: while NS < NT and ∆t(kp (cid:67) ip) < 0 do 8: 9: 10: 11: end while 12: if NS < NT then return reject 13: else 14: 15: 16: 17: 18: end if ∆t(kp (cid:67) ip) ← 1 NS ← min(NT , 2NS) S ← S ∪ uniform sample of indices so that S = NS. Compute ∆t(kp (cid:67) ip) if ∆t(kp (cid:67) ip) < 0 then return accept else return reject end if (cid:80) i∈S δt(i kp (cid:67) ip) NS SM-F Local minima formalism Theorem SM-F.1. A local minimum of clarans is always a local minimum of vik. However, there exist local minima of vik which are not local minima of clarans. Proof. The second statement is proven by the existence of example in the Introduction. For the first statement, suppose that a configuration is a local minimum of clarans, so that none of the K(N − K) possible swaps results in a decrease in energy. Then, each center must be the medoid of its cluster, as otherwise we could swap the center with the medoid and obtain an energy reduction. Therefore the configuration is a minimum of clarans. SM-G Efficient Levenshtein distance calculation The algorithm we have developed relies heavily on the triangle inequality to eliminate distances. However, it is also possible to abort distance calculations once started if they exceed a certain thresh- old of interest. When we wish to determine the 2 nearest centers to a sample for example, we can abort a distance calculation as soon as we know the distance being calculated is greater than at least two other centers. For vectorial data, this generally does not result in significant gains. However, when computing the Levenshtein distance it can help enormously. Indeed, for a sequence of length l, without a threshold on the distance the computation cost of the distance is O(l2). With a threshold m it becomes (lm). Essentially, only the diagonal of is searched while running the dynamic Needleman- Wunsch algorithm. We use this idea at all levels of acceleration. SM-H A Comment on Similarities used in Bioinformatics A very popular similarity measure in bioinformatics is that of Smith-Waterman. The idea is that similarity should be computed based on the most similar regions of sequences, and not on the entire sequences. Consider for example, the sequences a = 123123898989, b = 454545898989, c = 123123012012. According to Smith-Waterman, these should have sim(a, b) = sim(a, c) (cid:29) sim(b, c). This is not possible to turn into a proper distance, as one would need dist(a, b) = dist(a, c) (cid:28) dist(b, c), which is going to break the triangle inequality. Thus, the triangle inequality accelerations introduced cannot be applied to similarities of the Smith-Waterman type. 22 Figure 11: Comparing km+++clarans+lloyd and km+++lloyd, over ten runs, on the com- plete rna dataset at https://www.csie.ntu. edu.tw/~cjlin/libsvmtools/datasets/ binary.html#cod-rna with dimensions N = 488, 565, d = 8, and K = 2, 000. We ignore here the time to run km++, so that at t = 0 km++ has finished. Running clarans before lloyd results in mean final MSE of 0.76, a significant improvement over 0.83 obtained without clarans. With clarans+lloyd, that is without pre-initialising with km++, the mean MSE is also 0.76, although clarans runs for 28 seconds, as opposed to 18 seconds with km+++clarans+lloyd. SM-I Pre-initialising with km++ In Figure 11, we compare km+++clarans+lloyd and km+++lloyd. SM-J Comapring the different optimisations levels, and kmlocal We briefly present results of the optimisations at each of the levels, as well as compare to the clarans implementation accompanying Kanungo et al. (2002), an algorithm which they call 'Swap'. The source code of Kanungo et al. (2002) can be found at https://www.cs.umd. edu/~mount/Projects/KMeans/ and is called 'kmlocal', and our code is currently at https: //github.com/anonymous1331/km4kminit. To the best of our knowledge, we compiled kmlo- cal correctly, and used the default -O3 flag in the Makefile. The only modification we made to it was to output the elapsed time after each iteration, which has negligible effect on performance. The data consists in this experiment is N = 500, 000 data points in d = 4, drawn i.i.d from a Gaussian with identity covariance, and K = 500. With all optimisations (level 3) convergence is obtained within 20 seconds. We notice that each optimisation provides a significant boost to convergence speed. The faster initialisation at levels 2 and 3 is due to the fact that using inter- center distances allows nearests and second nearests to be determined with fewer distances and comparisons. Finally we note that the implementation of Kanungo et al. (2002), kmlocal, is about 100× slower than our level 3 implememtation on this data. We have not run any other experiments comparing performance. 23 0510152025time[s]0.70.80.91.01.11.21.3MSEkm+++clarans+lloydkm+++lloyd Figure 12: Comparing the different optimisation levels and the implementation of clarans of Ka- nungo et al. (2002), kmlocal at https://www.cs.umd.edu/~mount/Projects/KMeans/. Left and right are the same but for a logarithmic scale for the time-axis on the right. The data being clustered here is N = 500, 000 elements in d = 4, drawn from a Gaussian distribution with identity covariance, and K = 500. We see that the various levels of optimisation provide significant accel- erations, and that the implementation in kmlocal is 2 orders of magnitude slower than our level 3 optimised implementation. Figure 13: Improvement obtained using clarans for different values of K (horizontal axis). The experimental setup is as follows. N = 20, 000 points are drawn from a 3-D Gaussian with identity covariance. Then for each of 40 values of K on the horizontal axis, (1) km++ is run for fixed seed, and the time it takes to run is recorded (call it T++). clarans is then run for a mulitple 'itok' of T++, where 'itok' is one of {0, 1, 2, 4}. 'itok' of 0 corresponds to no clarans. After clarans has completed, lloyd is run. For 'itok' in 1, 2, 4 the ratio of the final MSE with 'itok' 0 (no clarans) is plotted. This value is the fraction of the MSE without running clarans. We see that the dependence of the improvement on K is significant, with larger K values benefitting more from clarans. Also, as expected, larger 'itok' results in lower MSE. 24 020406080100120140160180time[s]0.300.320.340.360.380.40MSEkmlocallevel0level1level2level3100101102time[s]0.300.320.340.360.380.40MSE05001000150020002500K0.930.940.950.960.970.980.991.001.01(mse with clarans) / (mse without)itok = 1itok = 2itok = 4
1304.7793
1
1304
2013-04-29T20:22:27
Co-Scheduling Algorithms for High-Throughput Workload Execution
[ "cs.DS", "cs.DC" ]
This paper investigates co-scheduling algorithms for processing a set of parallel applications. Instead of executing each application one by one, using a maximum degree of parallelism for each of them, we aim at scheduling several applications concurrently. We partition the original application set into a series of packs, which are executed one by one. A pack comprises several applications, each of them with an assigned number of processors, with the constraint that the total number of processors assigned within a pack does not exceed the maximum number of available processors. The objective is to determine a partition into packs, and an assignment of processors to applications, that minimize the sum of the execution times of the packs. We thoroughly study the complexity of this optimization problem, and propose several heuristics that exhibit very good performance on a variety of workloads, whose application execution times model profiles of parallel scientific codes. We show that co-scheduling leads to to faster workload completion time and to faster response times on average (hence increasing system throughput and saving energy), for significant benefits over traditional scheduling from both the user and system perspectives.
cs.DS
cs
Co-Scheduling Algorithms for High-Throughput Workload Execution Guillaume Aupy∗ Manu Shantharam† Anne Benoit∗‡ Yves Robert∗‡§ Padma Raghavan¶ {guillaume.aupy, anne.benoit, yves.robert}@ens-lyon.fr; [email protected]; [email protected] August 2, 2021 Abstract This paper investigates co-scheduling algorithms for processing a set of parallel applications. Instead of executing each application one by one, using a maximum degree of parallelism for each of them, we aim at scheduling several applications concurrently. We partition the original application set into a series of packs, which are executed one by one. A pack comprises several applications, each of them with an assigned number of processors, with the constraint that the total number of processors assigned within a pack does not exceed the maximum number of available pro- cessors. The objective is to determine a partition into packs, and an assignment of processors to applications, that minimize the sum of the execution times of the packs. We thoroughly study the complexity of this optimization prob- lem, and propose several heuristics that exhibit very good performance on a variety of workloads, whose application execution times model profiles of parallel scientific codes. We show that co-scheduling leads to to faster workload completion time and to faster response times on average (hence increasing system throughput and saving energy), for significant benefits over traditional scheduling from both the user and system perspectives. 1 Introduction The execution time of many high-performance computing applications can be significantly reduced when using a large number of processors. Indeed, parallel multicore platforms enable the fast processing of very large size jobs, thereby rendering the solution of challenging scientific problems more tractable. However, monopolizing all computing re- sources to accelerate the processing of a single application is very likely to lead to inefficient resource usage. This is because the typical speed-up profile of most applications is sub-linear and even reaches a threshold: when the number of processors increases, the execution time first decreases, but not linearly, because it suffers from the overhead due to communications and load imbalance; at some point, adding more resources does not lead to any significant benefit. In this paper, we consider a pool of several applications that have been submitted for execution. Rather than executing each of them in sequence, with the maximum number of available resources, we introduce co-scheduling algorithms that execute several applications concurrently. We do increase the individual execution time of each ap- plication, but (i) we improve the efficiency of the parallelization, because each application is scheduled on fewer resources; (ii) the total execution time will be much shorter; and (iii) the average response time will also be shorter. In other words, co-scheduling increases platform yield (thereby saving energy) without sacrificing response time. In operating high performance computing systems, the costs of energy consumption can greatly impact the total costs of ownership. Consequently, there is a move away from a focus on peak performance (or speed) and towards ∗LIP, Ecole Normale Sup´erieure de Lyon, France †University of Utah, USA ‡Institut Universitaire de France, France §University of Tennessee Knoxville, USA ¶Pennsylvania State University, USA 1 improving energy efficiency [12, 20]. Recent results on improving the energy efficiency of workloads can be broadly classified into approaches that focus on dynamic voltage and frequency scaling, or alternatively, task aggregation or co-scheduling. In both types of approaches, the individual execution time of an application may increase but there can be considerable energy savings in processing a workload. More formally, we deal with the following problem: given (i) a distributed-memory platform with p processors, and (ii) n applications, or tasks, Ti, with their execution profiles (ti,j is the execution time of Ti with j processors), what is the best way to co-schedule them, i.e., to partition them into packs, so as to minimize the sum of the execution times over all packs. Here a pack is a subset of tasks, together with a processor assignment for each task. The constraint is that the total number of resources assigned to the pack does not exceed p, and the execution time of the pack is the longest execution time of a task within that pack. The objective of this paper is to study this co-scheduling problem, both theoretically and experimentally, We aim at demonstrating the gain that can be achieved through co-scheduling, both on platform yield and response time, using a set of real-life application profiles. On the theoretical side, to the best of our knowledge, the complexity of the co-scheduling problem has never been investigated, except for the simple case when one enforces that each pack comprises at most k = 2 tasks [21]. While the problem has polynomial complexity for the latter restriction (with at most k = 2 tasks per pack), we show that it is NP-complete when assuming at most k ≥ 3 tasks per pack. Note that the instance with k = p is the general, unconstrained, instance of the co-scheduling problem. We also propose an approximation algorithm for the general instance. In addition, we propose an optimal processor assignment procedure when the tasks that form a pack are given. We use these two results to derive efficient heuristics. Finally, we discuss how to optimally solve small-size instances, either through enumerating partitions, or through an integer linear program: this has a potentially exponential cost, but allows us to assess the absolute quality of the heuristics that we have designed. Altogether, all these results lay solid theoretical foundations for the problem. On the experimental side, we study the performance of the heuristics on a variety of workloads, whose application execution times model profiles of parallel scientific codes. We focus on three criteria: (i) cost of the co-schedule, i.e., total execution time; (ii) packing ratio, which evaluates the idle time of processors during execution; and (iii) response time compared to a fully parallel execution of each task starting from shortest task. The proposed heuristics show very good performance within a short running time, hence validating the approach. The paper is organized as follows. We discuss related work in Section 2. The problem is then formally defined in Section 3. Theoretical results are presented in Section 4, exhibiting the problem complexity, discussing sub-problems and optimal solutions, and providing an approximation algorithm. Building upon these results, several polynomial- time heuristics are described in Section 5, and they are thoroughly evaluated in Section 6. Finally we conclude and discuss future work in Section 7. 2 Related work In this paper, we deal with pack scheduling for parallel tasks, aiming at makespan minimization (recall that the makespan is the total execution time). The corresponding problem with sequential tasks (tasks that execute on a single processor) is easy to solve for the makespan minimization objective: simply make a pack out of the largest p tasks, and proceed likewise while there remain tasks. Note that the pack scheduling problem with sequential tasks has been widely studied for other objective functions, see Brucker et al. [4] for various job cost functions, and Potts and Kovalyov [18] for a survey. Back to the problem with sequential tasks and the makespan objective, Koole and Righter in [13] deal with the case where the execution time of each task is unknown but defined by a probabilistic distribution. They showed counter-intuitive properties, that enabled them to derive an algorithm that computes the optimal policy when there are two processors, improving the result of Deb and Serfozo [7], who considered the stochastic problem with identical jobs. To the best of our knowledge, the problem with parallel tasks has not been studied as such. However, it was introduced by Dutot et al. in [8] as a moldable-by-phase model to approximate the moldable problem. The moldable task model is similar to the pack-scheduling model, but one does not have the additional constraint (pack constraint) that the execution of new tasks cannot start before all tasks in the current pack are completed. Dutot et al. in [8] provide an optimal polynomial-time solution for the problem of pack scheduling identical independent tasks, using a dynamic programming algorithm. This is the only instance of pack-scheduling with parallel tasks that we found in the 2 literature. A closely related problem is the rectangle packing problem, or 2D-Strip-packing. Given a set of rectangles of different sizes, the problem consists in packing these rectangles into another rectangle of size p × m. If one sees one dimension (p) as the number of processors, and the other dimension (m) as the maximum makespan allowed, this problem is identical to the variant of our problem where the number of processors is pre-assigned to each task: each rectangle ri of size pi × mi that has to be packed can be seen as the task Ti to be computed on pi processors, with ti,pi = mi. In [22], Turek et al. approximated the rectangle packing problem using shelf-based solutions: the rectangles are assigned to shelves, whose placements correspond to constant time values. All rectangles assigned to a shelf have equal starting times, and the next shelf is placed on top of the previous shelf. This is exactly what we ask in our pack-scheduling model. This problem is also called level packing in some papers, and we refer the reader to a recent survey on 2D-packing algorithms by Lodi et al. [16]. In particular, Coffman et al. in [6] show that level packing algorithm can reach a 2.7 approximation for the 2D-Strip-packing problem (1.7 when the length of each rectangle is bounded by 1). Unfortunately, all these algorithms consider the number of processors (or width of the rectangles) to be already fixed for each task, hence they cannot be used directly in our problem for which a key decision is to decide the number of processors assigned to each task. In practice, pack scheduling is really useful as shown by recent results. Li et al. [15] propose a framework to predict the energy and performance impacts of power-aware MPI task aggregation. Frachtenberg et al. [9] show that system utilization can be improved through their schemes to co-schedule jobs based on their load-balancing requirements and inter-processor communication patterns. In our earlier work [21], we had shown that even when the pack-size is limited to 2, co-scheduling based on speed-up profiles can lead to faster workload completion and corresponding savings in system energy. Several recent publications [2, 5, 11] consider co-scheduling at a single multicore node, when contention for resources by co-scheduled tasks leads to complex tradeoffs between energy and performance measures. Chandra et al. [5] predict and utilize inter-thread cache contention at a multicore in order to improve performance. Hankendi and Coskun [11] show that there can be measurable gains in energy per unit of work through the application of their multi-level co-scheduling technique at runtime which is based on classifying tasks according to specific performance measures. Bhaduria and McKee [2] consider local search heuristics to co-schedule tasks in a resource-aware manner at a multicore node to achieve significant gains in thread throughput per watt. These publications demonstrate that complex tradeoffs cannot be captured through the use of the speed-up measure alone, without significant additional measurements to capture performance variations from cross-application interfer- ence at a multicore node. Additionally, as shown in our earlier work [21], we expect significant benefits even when we aggregate only across multicore nodes because speed-ups suffer due to of the longer latencies of data transfer across nodes. We can therefore project savings in energy as being commensurate with the savings in the time to complete a workload through co-scheduling. Hence, we only test configurations where no more than a single application can be scheduled on a multicore node. 3 Problem definition The application consists of n independent tasks T1, . . . , Tn. The target execution platform consists of p identical processors, and each task Ti can be assigned an arbitrary number σ(i) of processors, where 1 ≤ σ(i) ≤ p. The objective is to minimize the total execution time by co-scheduling several tasks onto the p resources. Note that the approach is agnostic of the granularity of each processor, which can be either a single CPU or a multicore node. Speedup profiles -- Let ti,j be the execution time of task Ti with j processors, and work(i, j) = j × ti,j be the corresponding work. We assume the following for 1 ≤ i ≤ n and 1 ≤ j < p: Non-increasing execution time: ti,j+1 ≤ ti,j (1) Non-decreasing work: work(i, j) ≤ work(i, j + 1) (2) Equation (1) implies that execution time is a non-increasing function of the number of processors. Equation (2) states that efficiency decreases with the number of enrolled processors: in other words, parallelization has a cost! As a side note, we observe that these requirements make good sense in practice: many scientific tasks Ti are such that ti,j 3 first decreases (due to load-balancing) and then increases (due to communication overhead), reaching a minimum for j = j0; we can always let ti,j = ti,j0 for j ≥ j0 by never actually using more than j0 processors for Ti. Co-schedules -- A co-schedule partitions the n tasks into groups (called packs), so that (i) all tasks from a given pack start their execution at the same time; and (ii) two tasks from different packs have disjoint execution intervals. See Figure 1 for an example. The execution time, or cost, of a pack is the maximal execution time of a task in that pack, and the cost of a co-schedule is the sum of the costs of each pack. k-IN-p-COSCHEDULE optimization problem -- Given a fixed constant k ≤ p, find a co-schedule with at most k tasks per pack that minimizes the execution time. The most general problem is when k = p, but in some frameworks we may have an upper bound k < p on the maximum number of tasks within each pack. processors P1 P2 P3 P4 Figure 1: A co-schedule with four packs P1 to P4. time 4 Theoretical results First we discuss the complexity of the problem in Section 4.1, by exhibiting polynomial and NP-complete instances. Next we discuss how to optimally schedule a set of k tasks in a single pack (Section 4.2). Then we explain how to compute the optimal solution (in expected exponential cost) in Section 4.3. Finally, we provide an approximation algorithm in Section 4.4. 4.1 Complexity Theorem 1. The 1-IN-p-COSCHEDULE and 2-IN-p-COSCHEDULE problems can both be solved in polynomial time. Proof. This result is obvious for 1-IN-p-COSCHEDULE: each task is assigned exactly p processors (see Equation (1)) and the minimum execution time is(cid:80)n i=1 ti,p. This proof is more involved for 2-IN-p-COSCHEDULE, and we start with the 2-IN-2-COSCHEDULE problem to get an intuition. Consider the weighted undirected graph G = (V, E), where V = n, each vertex vi ∈ V corresponding to a task Ti. The edge set E is the following: (i) for all i, there is a loop on vi of weight ti,2; (ii) for all i < i(cid:48), there is an edge between vi and vi(cid:48) of weight max(ti,1, ti(cid:48),1). Finding a perfect matching of minimal weight in G leads to the optimal solution to 2-IN-2-COSCHEDULE, which can thus be solved in polynomial time. For the 2-IN-p-COSCHEDULE problem, the proof is similar, the only difference lies in the construction of the edge set E: (i) for all i, there is a loop on vi of weight ti,p; (ii) for all i < i(cid:48), there is an edge between vi and vi(cid:48) of weight minj=1..p (max(ti,p−j, ti(cid:48),j)). Again, a perfect matching of minimal weight in G gives the optimal solution to 2-IN-p-COSCHEDULE. We conclude that the 2-IN-p-COSCHEDULE problem can be solved in polynomial time. Theorem 2. When k ≥ 3, the k-IN-p-COSCHEDULE problem is strongly NP-complete. Proof. We prove the NP-completeness of the decision problem associated to k-IN-p-COSCHEDULE: given n indepen- dent tasks, p processors, a set of execution times ti,j for 1 ≤ i ≤ n and 1 ≤ j ≤ p satisfying Equations (1) and (2), a fixed constant k ≤ p and a deadline D, can we find a co-schedule with at most k tasks per pack, and whose execution time does not exceed D? The problem is obviously in NP: if we have the composition of every pack, and for each task in a pack, the number of processors onto which it is assigned, we can verify in polynomial time: (i) that it is indeed a pack schedule; (ii) that the execution time is smaller than a given deadline. 4 ai integers into n triplets, each of sum B? We can assume that(cid:80)3n We first prove the strong completeness of 3-IN-p-COSCHEDULE. We use a reduction from 3-PARTITION. Consider an arbitrary instance I1 of 3-PARTITION: given an integer B and 3n integers a1, . . . , a3n, can we partition the 3n i=1 ai = nB, otherwise I1 has no solution. The 3-PARTITION problem is NP-hard in the strong sense [10], which implies that we can encode all integers (a1, . . . , a3n, B) in unary. We build the following instance I2 of 3-IN-p-COSCHEDULE: the number of processors is p = B, the , deadline is D = n, there are 3n tasks Ti, with the following execution times: for all i, j, if j < ai then ti,j = 1 + 1 ai otherwise ti,j = 1. It is easy to check that Equations (1) and (2) are both satisfied. For the latter, since there are only two possible execution times for each task, we only need to check Equation (2) for j = ai − 1, and we do obtain that ) ≤ ai. Finally, I2 has a size polynomial in the size of I1, even if we write all instance parameters in (ai − 1)(1 + 1 unary: the execution time is n, and the ti,j have the same size as the ai. We now prove that I1 has a solution if and only if I2 does. Assume first that I1 has a solution. For each triplet (ai, aj, ak) of I1, we create a pack with the three tasks (Ti, Tj, Tk) where Ti is scheduled on ai processors, Tj on aj processors, and Tk on ak processors. By definition, we have ai + aj + ak = B, and the execution time of this pack is 1. We do this for the n triplets, which gives a valid co-schedule whose total execution time n. Hence the solution to I2. Assume now that I2 has a solution. The minimum execution time for any pack is 1 (since it is the minimum execution time of any task and a pack cannot be empty). Hence the solution cannot have more than n packs. Because there are 3n tasks and the number of elements in a pack is limited to three, there are exactly n packs, each of exactly 3 elements, and furthermore all these packs have an execution time of 1 (otherwise the deadline n is not matched). If there were a pack (Ti, Tj, Tk) such that ai + aj + ak > B, then one of the three tasks, say Ti, would have to use fewer than ai processors, hence would have an execution time greater than 1. Therefore, for each pack (Ti, Tj, Tk), we have i=1 ai = nB. Finally, we conclude by saying that the set of triplets (ai, aj, ak) for every pack (Ti, Tj, Tk) is a solution to I1. The final step is to prove the completeness of k-IN-p-COSCHEDULE for a given k ≥ 4. We perform a similar reduction from the same instance I1 of 3-PARTITION. We construct the instance I2 of k-IN-p-COSCHEDULE where the number of processors is p = B + (k − 3)(B + 1) and the deadline is D = n. There are 3n tasks Ti with the same , otherwise ti,j = 1), and also n(k − 3) new execution times as before (for 1 ≤ i ≤ 3n, if j < ai then ti,j = 1 + 1 identical tasks such that, for 3n + 1 ≤ i ≤ kn, ti,j = max . It is easy to check that Equations (1) and (2) are also fulfilled for the new tasks. If I1 has a solution, we construct the solution to I2 similarly to the previous reduction, and we add to each pack k − 3 tasks Ti with 3n + 1 ≤ i ≤ kn, each assigned to B + 1 processors. This solution has an execution time exactly equal to n. Conversely, if I2 has a solution, we can verify that there are exactly n packs (there are kn tasks and each pack has an execution time at least equal to 1). Then we can verify that there are at most (k − 3) tasks Ti with 3n + 1 ≤ i ≤ kn per pack, since there are exactly (k − 3)(B + 1) + B processors. Otherwise, if there were k − 2 (or more) such tasks in a pack, then one of them would be scheduled on less than B + 1 processors, and the execution time of the pack would be greater than 1. Finally, we can see that in I2, each pack is composed of (k− 3) tasks Ti with 3n + 1 ≤ i ≤ kn, scheduled on (k− 3)(B + 1) processors at least, and that there remains triplets of tasks Ti, with 1 ≤ i ≤ 3n, scheduled on at most B processors. The end of the proof is identical to the reduction in the case k = 3. ai + aj + ak ≤ B. The fact that this inequality is an equality for all packs follows from the fact that(cid:80)3n (cid:17) (cid:16) B+1 , 1 j ai Note that the 3-IN-p-COSCHEDULE problem is NP-complete, and the 2-IN-p-COSCHEDULE problem can be solved in polynomial time, hence 3-IN-3-COSCHEDULE is the simplest problem whose complexity remains open. and we search for an assignment function σ : {1, . . . , k} → {1, . . . , p} such that(cid:80)k 4.2 Scheduling a pack of tasks In this section, we discuss how to optimally schedule a set of k tasks in a single pack: the k tasks T1, . . . , Tk are given, i=1 σ(i) ≤ p, where σ(i) is the number of processors assigned to task Ti. Such a schedule is called a 1-pack-schedule, and its cost is max1≤i≤k ti,σ(i). In Algorithm 1 below, we use the notation Ti (cid:52)σ Tj if ti,σ(i) ≤ tj,σ(j): Theorem 3. Given k tasks to be scheduled on p processors in a single pack, Algorithm 1 finds a 1-pack-schedule of minimum cost in time O(p log(k)). 5 Algorithm 1: Finding the optimal 1-pack-schedule σ of k tasks in the same pack. procedure Optimal-1-pack-schedule(T1, . . . , Tk) begin for i = 1 to k do σ(i) ← 1 end Let L be the list of tasks sorted in non-increasing values of (cid:52)σ; pavailable := p − k; while pavailable (cid:54)= 0 do Ti(cid:63) := head(L); L := tail(L); σ(i(cid:63)) ← σ(i(cid:63)) + 1; pavailable := pavailable − 1; L := Insert Ti(cid:63) in L according to its (cid:52)σ value; end return σ; end Lemma: At the end of iteration (cid:96) of Algorithm 1, let Ti(cid:63) be the first task of the sorted list, i.e., the task with longest In this greedy algorithm, we first assign one processor to each task, and while there are processors that are not processing any task, we select the task with the longest execution time and assign an extra processor to this task. Algorithm 1 performs p − k iterations to assign the extra processors. We denote by σ((cid:96)) the current value of the function σ at the end of iteration (cid:96). For convenience, we let ti,0 = +∞ for 1 ≤ i ≤ k. We start with the following lemma: execution time. Then, for all i, ti(cid:63),σ((cid:96))(i(cid:63)) ≤ ti,σ((cid:96))(i)−1. Proof. Let Ti(cid:63) be the task with longest execution time at the end of iteration (cid:96). For tasks such that σ((cid:96))(i) = 1, the result is obvious since ti,0 = +∞. Let us consider any task Ti such that σ((cid:96))(i) > 1. Let (cid:96)(cid:48) + 1 be the last iteration when a new processor was assigned to task Ti: σ((cid:96)(cid:48))(i) = σ((cid:96))(i) − 1 and (cid:96)(cid:48) < (cid:96). By definition of iteration (cid:96)(cid:48) + 1, task Ti was chosen because ti,σ((cid:96)(cid:48) )(i) was greater than any other task, in particular ti,σ((cid:96)(cid:48))(i) ≥ ti(cid:63),σ((cid:96)(cid:48))(i(cid:63)). Also, since we never remove processors from tasks, we have σ((cid:96)(cid:48))(i) ≤ σ((cid:96))(i) and σ((cid:96)(cid:48))(i(cid:63)) ≤ σ((cid:96))(i(cid:63)). Finally, ti(cid:63),σ((cid:96))(i(cid:63)) ≤ ti(cid:63),σ((cid:96)(cid:48) )(i(cid:63)) ≤ ti,σ((cid:96)(cid:48) )(i) = ti,σ((cid:96))(i)−1. We are now ready to prove Theorem 3. of Theorem 3. Let σ be the 1-pack-schedule returned by Algorithm 1 of cost c(σ), and let Ti(cid:63) be a task such that c(σ) = ti(cid:63),σ(i(cid:63)). Let σ(cid:48) be a 1-pack-schedule of cost c(σ(cid:48)). We prove below that c(σ(cid:48)) ≥ c(σ), hence σ is a 1-pack- schedule of minimum cost: • If σ(cid:48)(i(cid:63)) ≤ σ(i(cid:63)), then Ti(cid:63) has fewer processors in σ(cid:48) than in σ, hence its execution time is larger, and c(σ(cid:48)) ≥ c(σ). • If σ(cid:48)(i(cid:63)) > σ(i(cid:63)), then there exists i such that σ(cid:48)(i) < σ(i) (since the total number of processors is p in both σ and σ(cid:48)). We can apply the previous Lemma at the end of the last iteration, where Ti(cid:63) is the task of maximum execution time: ti(cid:63),σ(i(cid:63)) ≤ ti,σ(i)−1 ≤ ti,σ(cid:48)(i), and therefore c(σ(cid:48)) ≥ c(σ). Finally, the time complexity is obtained as follows: first we sort k elements, in time O(k log k). Then there are p − k iterations, and at each iteration, we insert an element in a sorted list of k−1 elements, which takes O(log k) operations (use a heap for the data structure of L). Note that it is easy to compute an optimal 1-pack-schedule using a dynamic-programming algorithm: the optimal cost is c(k, p), which we compute using the recurrence formula c(i, q) = min 1≤q(cid:48)≤q {max(c(i − 1, q − q(cid:48)), ti,q(cid:48))} 6 Minimize(cid:80)n (i) (cid:80) (ii) (cid:80) (iii) (cid:80) subject to b=1 yb 1 ≤ i ≤ n j,b xi,j,b = 1, 1 ≤ b ≤ n i,j xi,j,b ≤ k, i,j j × xi,j,b ≤ p, 1 ≤ b ≤ n (iv) xi,j,b × ti,j ≤ yb, 1 ≤ i, b ≤ n, 1 ≤ j ≤ p (3) for 2 ≤ i ≤ k and 1 ≤ q ≤ p, initialized by c(1, q) = t1,q, and c(i, 0) = +∞. The complexity of this algorithm is O(kp2). However, we can significantly reduce the complexity of this algorithm by using Algorithm 1. 4.3 Computing the optimal solution In this section we sketch two methods to find the optimal solution to the general k-IN-p-COSCHEDULE problem. This can be useful to solve some small-size instances, albeit at the price of a cost exponential in the number of tasks n. The first method is to generate all possible partitions of the tasks into packs. This amounts to computing all partitions of n elements into subsets of cardinal at most k. For a given partition of tasks into packs, we use Algorithm 1 to find the optimal processor assignment for each pack, and we can compute the optimal cost for the partition. There remains to take the minimum of these costs among all partitions. The second method is to cast the problem in terms of an integer linear program: Theorem 4. The following integer linear program characterizes the k-IN-p-COSCHEDULE problem, where the un- known variables are the xi,j,b's (Boolean variables) and the yb's (rational variables), for 1 ≤ i, b ≤ n and 1 ≤ j ≤ p: is the execution time of pack b. Since there are no more than n packs (one task per pack), b ≤ n. The sum(cid:80)n Proof. The xi,j,b's are such that xi,j,b = 1 if and only if task Ti is in the pack b and it is executed on j processors; yb b=1 yb is therefore the total execution time (yb = 0 if there are no tasks in pack b). Constraint (i) states that each task is assigned to exactly one pack b, and with one number of processors j. Constraint (ii) ensures that there are not more than k tasks in a pack. Constraint (iii) adds up the number of processors in pack b, which should not exceed p. Finally, constraint (iv) computes the cost of each pack. 4.4 Approximation algorithm In this section we introduce PACK-APPROX, a 3-approximation algorithm for the p-IN-p-COSCHEDULE problem. The design principle of PACK-APPROX is the following: we start from the assignment where each task is executed on one processor, and use Algorithm 2 to build a first solution. Algorithm 2 is a greedy heuristic that builds a co-schedule when each task is pre-assigned a number of processors for execution. Then we iteratively refine the solution, adding a processor to the task with longest execution time, and re-executing Algorithm 2. Here are details on both algorithms: Algorithm 2. The k-IN-p-COSCHEDULE problem with processor pre-assignments remains strongly NP-complete (use a similar reduction as in the proof of Theorem 2). We propose a greedy procedure in Algorithm 2 which is similar to the First Fit Decreasing Height algorithm for strip packing [6]. The output is a co-schedule with at most k tasks per pack, and the complexity is O(n log(n)) (dominated by sorting). Algorithm 3. We iterate the calls to Algorithm 2, adding a processor to the task with longest execution time, until: (i) either the task of longest execution time is already assigned p processors, or (ii) the sum of the work of all tasks is greater than p times the longest execution time. The algorithm returns the minimum cost found during execution. The complexity of this algorithm is O(n2p) (in the calls to Algorithm 2 we do not need to re-sort the list but maintain it sorted instead) in the simplest version presented here, but can be reduced to O(n log(n) + np) using standard algorithmic techniques. Theorem 5. PACK-APPROX is a 3-approximation algorithm for the p-IN-p-COSCHEDULE problem. Proof. We start with some notations: • step i denotes the ith iteration of the main loop of Algorithm PACK-APPROX; • σ(i) is the allocation function at step i; • tmax(i) = maxj tj,σ(i)(j) is the maximum execution time of any task at step i; 7 Algorithm 2: Creating packs of size at most k, when the number σ(i) of processors per task Ti is fixed. procedure MAKE-PACK(n, p, k, σ) begin Let L be the list of tasks sorted in non-increasing values of execution times ti,σ(i); while L (cid:54)= ∅ do Schedule the current task on the first pack with enough available processors and fewer than k tasks. Create a new pack if no existing pack fits; Remove the current task from L; end return the set of packs end Algorithm 3: PACK-APPROX procedure PACK-APPROX(T1, . . . , Tn) begin COST = +∞ ; for j = 1 to n do σ(j) ← 1; for i = 0 to n(p − 1) − 1 do Let Atot(i) =(cid:80)n j=1 tj,σ(j)σ(j); end return COST; end • Atot(i) =(cid:80) Let Tj(cid:63) be one task that maximizes tj,σ(j); Call MAKE-PACK (n, p, p, σ); Let COSTi be the cost of the co-schedule; if COSTi < COST then COST ← COSTi; if ( Atot(i) else σ(j(cid:63)) ← σ(j(cid:63)) + 1; /* Add a processor to Tj(cid:63) p > tj(cid:63),σ(j(cid:63)) ) or (σ(j(cid:63)) = p) then return COST; /* Exit loop */ */ • j(cid:63)(i) is the index of the task with longest execution time at step i (break ties arbitrarily); • COSTi is the result of the scheduling procedure at the end of step i; • OPT denotes an optimal solution, with allocation function σ(OPT), execution time COSTOPT, and total work j tj,σ(i)(j)σ(i)(j) is the total work that has to be done at step i; (cid:88) j AOPT = tj,σ(OPT)(j)σ(OPT)(j). Note that there are three different ways to exit algorithm PACK-APPROX: 1. If we cannot add processors to the task with longest execution time, i.e., σ(i)(j(cid:63)(i)) = p; 2. If Atot(i) 3. When each task has been assigned p processors (the last step of the loop "for": we have assigned exactly np p > tmax(i) after having computed the execution time for this assignment; processors, and no task can be assigned more than p processors). Lemma 1. At the end of step i, COSTi≤ 3max tmax(i), Atot(i) . p (cid:16) (cid:17) Proof. Consider the packs returned by Algorithm 2, sorted by non-increasing execution times, B1, B2, . . . , Bn (some of the packs may be empty, with an execution time 0). Let us denote, for 1 ≤ q ≤ n, • jq the task with the longest execution time of pack Bq (i.e., the first task scheduled on Bq); • tq the execution time of pack Bq (in particular, tq = tjq,σ(i)(jq)); 8 • Aq the sum of the task works in pack Bq; • pq the number of processors available in pack Bq when jq+1 was scheduled in pack Bq+1. With these notations, COSTi =(cid:80)n q=1 tq and Atot(i) =(cid:80)n q=1Aq. For each pack, note that ptq ≥ Aq, since ptq is Summing over all q's, we have: 2(cid:80)n (cid:16) the maximum work that can be done on p processors with an execution time of tq. Hence, COSTi ≥ Atot(i) In order to bound COSTi, let us first remark that σ(i)(jq+1) > pq: otherwise jq+1 would have been scheduled on pack Bq. Then, we can exhibit a lower bound for Aq, namely Aq ≥ tq+1(p − pq). Indeed, the tasks scheduled before jq+1 all have a length greater than tq+1 by definition. Furthermore, obviously Aq+1 ≥ tq+1pq (the work of the first task scheduled in pack Bq+1). So finally we have, Aq + Aq+1 ≥ tq+1p. p + t1 ≥ COSTi. Finally, note that t1 = . Note that this proof is similar to the one for the Strip- tmax(i), and therefore COSTi ≤ 3 max Packing problem in [6]. Lemma 2. At each step i, Atot(i + 1) ≥ Atot(i) and tmax(i + 1) ≤ tmax(i), i.e., the total work is increasing and the maximum execution time is decreasing. Proof. Atot(i + 1) = Atot(i) − a + b, where p ≥ (cid:80)n q=2 tq, hence 2 Atot(i) tmax(i), Atot(i) . p Aq q=1 (cid:17) p • a = work(j(cid:63)(i), σ(i)(j(cid:63)(i))), and • b = work(j(cid:63)(i), σ(i+1)(j(cid:63)(i))). But b = work(j(cid:63)(i), σ(i)(j(cid:63)(i))+1)and a ≤ b by Equation (2). Therefore, Atot(i+1) ≥ Atot(i). Finally, tmax(i+1) ≤ tmax(i) since only one of the tasks with the longest execution time is modified, and its execution time can only decrease thanks to Equation (1). Lemma 3. Given an optimal solution OPT, ∀j, tj,σ(OPT)(j) ≤ COSTOPT and AOPT ≤ pCOSTOPT. Proof. The first inequality is obvious. As for the second one, pCOSTOPT is the maximum work that can be done on p processors within an execution time of COSTOPT, hence it must not be smaller than AOPT, which is the sum of the work of the tasks with the optimal allocation. Lemma 4. For any step i such that tmax(i) > COSTOPT, then ∀j, σ(i)(j) ≤ σ(OPT)(j), and Atot(i) ≤ AOPT. Proof. Consider a task Tj. If σ(i)(j) = 1, then clearly σ(i)(j) ≤ σ(OPT)(i). Otherwise, σ(i)(j) > 1, and then by definition of the algorithm, there was a step i(cid:48) < i, such that σ(i(cid:48))(j) = σ(i)(j) − 1 and σ(i(cid:48)+1)(j) = σ(i)(j). Therefore tmax(i(cid:48)) = tj,σ(i(cid:48) )(j). Following Lemma 2, we have tmax(i(cid:48)) ≥ tmax(i) > COSTOPT. Then necessarily, σ(OPT)(j) > σ(i(cid:48))(j), hence the result. Finally, Atot(i) ≤ AOPT is a simple corollary of the previous result and of Equation (2). Lemma 5. For any step i such that tmax(i) > COSTOPT, then Atot(i) p < tmax(i). p ≤ AOPT p . Lemma 3 gives us AOPT p ≤ COSTOPT, hence the result. Proof. Thanks to Lemma 4, we have Atot(i) Lemma 6. There exists i0 ≥ 0 such that tmax(i0 − 1) > COSTOPT ≥ tmax(i0) (we let tmax(−1) = +∞). Proof. We show this result by contradiction. Suppose such i0 does not exist. Then tmax(0) > COSTOPT (otherwise i0 = 0 would suffice). Let us call i1 the last step of the run of the algorithm. Then by induction we have the following property, tmax(0) ≥ tmax(1) ≥ ··· ≥ tmax(i1) > COSTOPT (otherwise i0 would exist, hence contradicting our hypothesis). Recall that there are three ways to exit the algorithm, hence three possible definitions for i1: • σ(i1)(j(cid:63)(i1)) = p, however then we would have tmax(i1) = tj(cid:63)(i1),p > COSTOPT ≥ tj(cid:63)(i1),σ(OPT) (according to Lemma 3). This contradicts Equation (1), which states that tj(cid:63)(i1),p ≤ tj(cid:63)(i1),k for all k. • i1 = n(p − 1) − 1, but then we have the same result, i.e., σ(i1)(j(cid:63)(i1)) = p because this is true for all tasks. • tmax(i1) < Atot(i1) , but this is false according to Lemma 5. p 9 We have seen that PACK-APPROX could not have terminated at step i1, however since PACK-APPROX terminates (in at most n(p − 1) − 1 steps), we have a contradiction. Hence we have shown the existence of i0. Lemma 7. Atot(i0) ≤ AOPT. Proof. Consider step i0. If i0 = 0, then at this step, all tasks are scheduled on exactly one processor, and ∀j, σ(i0)(j) ≤ σ(OPT)(j). Therefore, Atot(i0) ≤ AOPT. If i0 (cid:54)= 0, consider step i0 − 1: tmax(i0 − 1) > COSTOPT. From Lemma 4, we have ∀j, σ(i0−1)(j) ≤ σ(OPT)(j). Furthermore, it is easy to see that ∀j (cid:54)= j(cid:63)(i0 − 1), σ(i0)(j) = σ(i0−1)(j) since no task other than j(cid:63)(i0 − 1) is modified. We also have the following properties: • tj(cid:63)(i0−1),σ(i0−1)(j(cid:63)(i0−1)) = tmax(i0 − 1); • tmax(i0 − 1) > tOPT (by definition of step i0); • tOPT ≥ tj(cid:63)(i0−1),σ(OPT)(j(cid:63)(i0−1)) (Lemma 3); • σ(i0)(j(cid:63)(i0 − 1)) = σ(i0−1)(j(cid:63)(i0 − 1)) + 1. The three first properties and Equation (1) allow us to say that σ(i0−1)(j(cid:63)(i0 − 1)) < σ(OPT)(j(cid:63)(i0 − 1)). Thanks to the fourth property, σ(i0)(j(cid:63)(i0 − 1)) ≤ σ(OPT)(j). Finally, we have, for all j, σ(i0)(j) ≤ σ(OPT)(j), and therefore Atot(i0) < AOPT by Equation (2). We are now ready to prove the theorem. For i0 introduced in Lemma 6, we have: (cid:18) (cid:18) COSTi0 ≤ 3 max ≤ 3 max ≤ 3COSTOPT (cid:19) (cid:19) tmax(i0), Atot(i0) COSTOPT, p AOPT p The first inequality comes from Lemma 1. The second inequality is due to Lemma 6 and 7. The last inequality comes from Lemma 3, hence the final result. 5 Heuristics In this section, we describe the heuristics that we use to solve the k-IN-p-COSCHEDULE problem. RANDOM-PACK -- In this heuristic, we generate the packs randomly: as long as there remain tasks, randomly choose an integer j between 1 and k, and then randomly select j tasks to form a pack. Once the packs are generated, apply Algorithm 1 to optimally schedule each of them. RANDOM-PROC -- In this heuristic, we assign the number of processors to each task randomly between 1 and p, then use Algorithm 2 to generate the packs, followed by Algorithm 1 on each pack. A word of caution -- We point out that RANDOM-PACK and RANDOM-PROC are not pure random heuristics, in that they already benefit from the theoretical results of Section 4. A more naive heuristic would pick both a task and a number of processor randomly, and greedily build packs, creating a new one as soon as more than p resources are assigned within the current pack. Here, both RANDOM-PACK and RANDOM-PROC use the optimal resource allocation strategy (Algorithm 1) within a pack; in addition, RANDOM-PROC uses an efficient partitioning algorithm (Algorithm 2) to create packs when resources are pre-assigned to tasks. PACK-APPROX -- This heuristic is an extension of Algorithm 3 in Section 4.4 to deal with packs of size k rather than p: simply call MAKE-PACK (n, p, k, σ) instead of MAKE-PACK (n, p, p, σ). However, although we keep the same name as in Section 4.4 for simplicity, we point out that it is unknown whether this heuristic is a 3-approximation algorithm for arbitrary k. PACK-BY-PACK (ε) -- The rationale for this heuristic is to create packs that are well-balanced: the difference between the smallest and longest execution times in each pack should be as small as possible. Initially, we assign one processor 10 per task (for 1 ≤ i ≤ n, σ(i) = 1), and tasks are sorted into a list L ordered by non-increasing execution times ((cid:52)σ values). While there remain some tasks in L, let Ti(cid:63) be the first task of the list, and let tmax = ti(cid:63),σ(i(cid:63)). Let Vreq be the ordered set of tasks Ti such that ti,σ(i) ≥ (1− ε)tmax: this is the sublist of tasks (including Ti(cid:63) as its first element) whose execution times are close to the longest execution time tmax, and ε ∈ [0, 1] is some parameter. Let preq be the total number of processors requested by tasks in Vreq. If preq ≥ p, a new pack is created greedily with the first tasks of Vred, adding them into the pack while there are no more than p processors used and no more than k tasks in the pack. The corresponding tasks are removed from the list L. Note that Ti(cid:63) is always inserted in the created pack. Also, if we have σ(i(cid:63)) = p, then a new pack with only Ti(cid:63) is created. Otherwise (preq < p), an additional processor is assigned to the (currently) critical task Ti(cid:63), hence σ(i(cid:63)) := σ(i(cid:63)) + 1, and the process iterates after the list L is updated with the insertion of the new value for Ti(cid:63) Finally, once all packs are created, we apply Algorithm 1 in each pack, so as to derive the optimal schedule within each pack. We have 0 < ε < 1. A small value of ε will lead to balanced packs, but may end up with a single task with p processors per pack. Conversely, a large value of ε will create new packs more easily, i.e., with fewer processors per task. The idea is therefore to call the heuristic with different values of ε, and to select the solution that leads to the best execution time. Summary of heuristics -- We consider two variants of the random heuristics, either with one single run, or with 9 different runs, hence hoping to obtain a better solution, at the price of a slightly longer execution time. These heuristics are denoted respectively RANDOM-PACK-1, RANDOM-PACK-9, RANDOM-PROC-1, RANDOM-PROC-9. Similarly, for PACK-BY-PACK, we either use one single run with ε = 0.5 (PACK-BY-PACK-1), or 9 runs with ε ∈ {.1, .2, . . . , .9} (PACK-BY-PACK-9). Of course, there is only one variant of PACK-APPROX, hence leading to seven heuristics. Variants -- We have investigated variants of PACK-BY-PACK, trying to make a better choice than the greedy choice to create the packs, for instance using a dynamic programming algorithm to minimize processor idle times in the pack. However, there was very little improvement at the price of a much higher running time of the heuristics. Additionally, we tried to improve heuristics with up to 99 runs, both for the random ones and for PACK-BY-PACK, but here again, the gain in performance was negligible compared to the increase in running time. Therefore we present only results for these seven heuristics in the following. 6 Experimental Results In this section, we study the performance of the seven heuristics on workloads of parallel tasks. First we describe the workloads, whose application execution times model profiles of parallel scientific codes. Then we present the measures used to evaluate the quality of the schedules, and finally we discuss the results. Workloads -- Workload-I corresponds to 10 parallel scientific applications that involve VASP [14], ABAQUS [3], LAMMPS [17] and Petsc [1]. The execution times of these applications were observed on a cluster with Intel Nehalem 8-core nodes connected by a QDR Infiniband network with a total of 128 cores. In other words, we have p = 16 processors, and each processor is a multicore node. Workload-II is a synthetic test suite that was designed to represent a larger set of scientific applications. It models tasks whose parallel execution time for a fixed problem size m on q cores is of the form t(m, q) = f × t(m, 1) + (1− f ) t(m,1) q + κ(m, q), where f can be interpreted as the inherently serial fraction, and κ represents overheads related to synchronization and the communication of data. We consider tasks with sequential times t(m, 1) of the form cm, cm log2 n, cm2 and cm3, where c is a suitable constant. We consider values of f in {0, 0.04, 0.08, .16, .32}, with overheads κ(m, q) of the form log2 q, (log2 q)2, q log2 q, m tasks executing on up to 128 cores. The same process was also used to develop Workload-III, our largest synthetic test suite with 260 tasks for 256 cores (and p = 32 multicore nodes), to study the scalability of our heuristics. For all workloads, we modified speedup profiles to satisfy Equations (1) and (2). q log2 q,(cid:112)m/q, and m log2 q to create a workload with 65 As discussed in related work (see Section 2) and [21], and confirmed by power measurement using Watts Up Pro meters, we observed only minor power consumption variations of less than 5% when we limited co-scheduling to occur across multicore nodes. Therefore, we only test configurations where no more than a single application can be scheduled on a given multicore node comprising 8 cores. Adding a processor to an application Ti which is already assigned σi processors actually means adding 8 new cores (a full multicore node) to the 8σi existing cores. Hence a 11 For a given k-IN-p-COSCHEDULE, consider(cid:80)n with each task running at maximum speed on all p processors. pack size of k corresponds to the use of at most 8k cores for applications in each pack. For Workloads-I and II, there are 16 nodes and 128 cores, while Workload-III has up to 32 nodes and 256 cores. Methodology for assessing the heuristics -- To evaluate the quality of the schedules generated by our heuristics, we consider three measures: Relative cost, Packing ratio, and Relative response time. Recall that the cost of a pack is the maximum execution time of a task in that pack and the cost of a co-schedule is the sum of the costs over all its packs. We define the relative cost as the cost of a given co-schedule divided by the cost of a 1-pack schedule, i.e., one i=1 ti,σ(i) × σ(i), i.e., the total work performed in the co-schedule when the i-th task is assigned σ(i) processors. We define the packing ratio as this sum divided by p times the cost of the co-schedule; observe that the packing quality is high when this ratio is close to 1, meaning that there is almost no idle time in the schedule. An individual user could be concerned about an increase in response time and a corresponding degradation of individ- ual productivity. To assess the impact on response time, we consider the performance with respect to a relative response time measure defined as follows. We consider a 1-pack schedule with the n tasks sorted in non-decreasing order of execution time, i.e., in a "shortest task first" order, to yield a minimal value of the response time. If this ordering is j=1 tπ(j),p and the mean response i=1 ri. For a given k-IN-p-COSCHEDULE with u packs scheduled in increasing order of the costs of (cid:96)=1 cost((cid:96)) + ti,σ(i), where cost((cid:96)) is the cost of the (cid:96)-th pack for 1 ≤ (cid:96) ≤ u. The mean response time of the k-IN-p-COSCHEDULE R is calculated using these values and we use R Results for small and medium workloads -- For Workload-I, we consider packs of size k = 2, 4, 6, 8, 10 with 16 processors (hence a total of 128 cores). Note that we do not try k = p = 16 since there are only 10 applications in this workload. For Workload-II, we consider packs of size k = 2, 4, 6, 8, 10, 12, 14, 16. given by the permutation π(i), i = 1, 2, . . . , n, the response time of task i is ri =(cid:80)i a pack, the response time of task i in pack v, 1 ≤ v ≤ u, assigned to σ(i) processors, is: ri =(cid:80)v−1 R as the relative response time. time is R = 1 n (cid:80)n Figure 2 shows the relative cost of co-schedules computed by the heuristics. For Workload-I (Figure 2(a)), the optimal co-schedule was constructed using exhaustive search. We observe that the optimal co-schedule has costs that are more than 35% smaller than the cost of a 1-pack schedule for Workload-I. Additionally, we observe that PACK-APPROX and PACK-BY-PACK compute co-schedules that are very close to the optimal one for all values of the pack size. Both RANDOM-PACK and RANDOM-PROC perform poorly when compared to PACK-BY-PACK and PACK-APPROX, especially when a single run is performed. As expected, RANDOM-PROC does better than RANDOM- PACK because it benefits from the use of Algorithm 2, and for this small workload, RANDOM-PROC-9 almost always succeed to find a near-optimal co-schedule. The results are similar for the larger Workload-II as shown in Figure 2(b), with an increased gap between random heuristics and the packing ones. Computing the optimal co-schedule was not feasible because of the exponential growth in running times for exhaustive search. With respect to the cost of a 1-pack schedule, we observe very significant benefits, with a reduction in costs of most than 80% for larger values of the pack size, and in particular in the unconstrained case where k = p = 16. This corresponds to significant savings in energy consumed by the hardware for servicing a specific workload. Figure 3 shows the quality of packing achieved by the heuristics. The packing ratios are very close to one for PACK-BY-PACK and PACK-APPROX, indicating that our methods are producing high quality packings. In most cases, RANDOM-PROC and RANDOM-PACK also lead to high packing ratios. Finally, Figure 4 shows that PACK-BY-PACK and PACK-APPROX produce lower cost schedules with commensurate reductions in response times. For Workload-II and larger values of the pack size, response time gains are over 80%, making k-IN-p-COSCHEDULE attractive from the user perspective. Scalability -- Figure 5 shows scalability trends for Workload-III with 260 tasks on 32 processors (hence a total of 256 cores.) Although the heuristics, including RANDOM-PACK and RANDOM-PROC, result in reducing costs relative to those for a 1-pack schedule, PACK-APPROX and PACK-BY-PACK are clearly superior, even when the random schemes are run 9 times. We observe that for pack sizes of 16 and 32, PACK-APPROX and PACK-BY-PACK produce high quality co-schedules with costs and response times that are respectively 90% and 80% lower than those for a 1-pack schedule. PACK-BY-PACK-1 obtains results that are very close to those of PACK-BY-PACK-9, hence even a single run returns a high quality co-schedule. Running times -- We report in Table 1 the running times of the seven heuristics. All heuristics run within a few milliseconds, even for the largest workload. Note that PACK-APPROX was faster on Workload-II than Workload-I 12 (a) (b) Figure 2: Quality of co-schedules: Relative costs are shown in (a) for Workload-I and in (b) for Workload-II. The horizontal line in (a) indicates the relative cost of an optimal co-schedule for Workload-I. (a) (b) Figure 3: Quality of packs: Packing ratios are shown in (a) for Workload-I and in (b) for Workload-II. The horizontal line in (a) indicates the packing ratio of an optimal co-schedule for Workload-I. 13 0.00 0.20 0.40 0.60 0.80 1.00 1.20 2 4 6 8 10 Rela%ve cost Pack size Workload--‐I PACK--‐APPROX PACK--‐BY--‐PACK--‐1 PACK--‐BY--‐PACK--‐9 RANDOM--‐PACK--‐1 RANDOM--‐PACK--‐9 RANDOM--‐PROC--‐1 RANDOM--‐PROC--‐9 0.00 0.20 0.40 0.60 0.80 1.00 1.20 2 4 6 8 10 12 14 16 Rela%ve cost Pack size Workload--‐II PACK--‐APPROX PACK--‐BY--‐PACK--‐1 PACK--‐BY--‐PACK--‐9 RANDOM--‐PACK--‐1 RANDOM--‐PACK--‐9 RANDOM--‐PROC--‐1 RANDOM--‐PROC--‐9 0 0.2 0.4 0.6 0.8 1 1.2 2 4 6 8 10 Packing ra*o Pack size Workload--‐I PACK--‐APPROX PACK--‐BY--‐PACK--‐1 PACK--‐BY--‐PACK--‐9 RANDOM--‐PACK--‐1 RANDOM--‐PACK--‐9 RANDOM--‐PROC--‐1 RANDOM--‐PROC--‐9 0 0.2 0.4 0.6 0.8 1 1.2 2 4 6 8 10 12 14 16 Packing ra*o Pack size Workload--‐II PACK--‐APPROX PACK--‐BY--‐PACK--‐1 PACK--‐BY--‐PACK--‐9 RANDOM--‐PACK--‐1 RANDOM--‐PACK--‐9 RANDOM--‐PROC--‐1 RANDOM--‐PROC--‐9 because its execution performed fewer iterations in this case. Random heuristics are slower than the other heuristics, because of the cost of random number generation. PACK-BY-PACK has comparable running times with PACK-APPROX, even when 9 values of ε are used. Workload-I Workload-II Workload-III PACK-APPROX PACK-BY-PACK-1 PACK-BY-PACK-9 RANDOM-PACK-1 RANDOM-PACK-9 RANDOM-PROC-1 RANDOM-PROC-9 0.50 0.03 0.30 0.07 0.67 0.05 0.47 0.30 0.12 1.17 0.34 2.71 0.26 2.26 5.12 0.53 5.07 9.30 87.25 4.49 39.54 Table 1: Average running times in milliseconds. Summary of experimental results -- Results indicate that heuristics PACK-APPROX and PACK-BY-PACK both produce co-schedules of comparable quality. PACK-BY-PACK-9 is slightly better than PACK-BY-PACK-1, at a price of an in- crease in the running time from using more values of ε. However, the running time remains very small, and similar to that of PACK-APPROX. Using more values of ε to improve PACK-BY-PACK leads to small gains in performance (e.g, 1% gain for PACK-BY-PACK-9 compared to PACK-BY-PACK-1 for k = 16 in Workload-II). However, these small gains in performance correspond to significant gains in system throughput and energy, and far outweigh the costs of com- puting multiple co-schedules. This makes PACK-BY-PACK-9 the heuristic of choice. Our experiments with 99 values of ε did not improve performance, indicating that large increases in the number of ε values may not be necessary. 7 Conclusion We have developed and analyzed co-scheduling algorithms for processing a workload of parallel tasks. Tasks are assigned to processors and are partitioned into packs of size k with the constraint that the total number of processors assigned over all tasks in a pack does not exceed p, the maximum number of available processors. Tasks in each pack execute concurrently on a number of processors, and workload completes in time equal to sum of the execution times of the packs. We have provided complexity results for minimizing the sum of the execution times of the packs. The bad news is that this optimization problem is NP-complete. This does not come as a surprise because we have to choose for each task both a number of processors and a pack, and this double freedom induces a huge combinatorial solution space. The good news is that we have provided an optimal resource allocation strategy once the packs are formed, together with an efficient load-balancing algorithm to partition tasks with pre-assigned resources into packs. This load-balancing algorithm is proven to be a 3-approximation algorithm for the most general instance of the prob- lem. Building upon these positive results, we have developed several heuristics that exhibit very good performance in our test sets. These heuristics can significantly reduce the time for completion of a workload for corresponding savings in system energy costs. Additionally, these savings come along with measurable benefits in the average response time for task completion, thus making it attractive from the user's viewpoint. These co-schedules can be computed very rapidly when speed-up profile data are available. Additionally, they operate at the scale of workloads with a few to several hundred applications to deliver significant gains in energy and time per workload. These properties present opportunities for developing hybrid approaches that can additionally leverage dynamic voltage and frequency scaling (DVFS) within an application. For example, Rountree et al. [19] have shown that depending on the properties of the application, DVFS can be applied at runtime through their Adagio system, to yield system energy savings of 5% to 20%. A potential hybrid scheme could start with the computation of a k-IN-p- COSCHEDULE for a workload, following which DVFS could be applied at runtime per application. Our work indicates the potential benefits of co-schedules for high performance computing installations where even medium-scale facilities consume Megawatts of power. We plan to further test and extend this approach towards de- ployment in university scale computing facilities where workload attributes often do not vary much over weeks to 14 months and energy costs can be a limiting factor. Acknowledgments. This work was supported in part by the ANR RESCUE project. The research of Padma Raghavan was supported in part by the The Pennsylvania State University and grants from the U.S. National Science Foun- dation. The research of Manu Shantharam was supported in part by the U.S. National Science Foundation award CCF-1018881. References [1] BALAY, S., BROWN, J., BUSCHELMAN, K., GROPP, W. D., KAUSHIK, D., KNEPLEY, M. G., MCINNES, L. C., SMITH, B. F., AND ZHANG, H. PETSc Web page, 2012. http://www.mcs.anl.gov/petsc. [2] BHADAURIA, M., AND MCKEE, S. A. An approach to resource-aware co-scheduling for cmps. In Proceedings of the 24th ACM International Conference on Supercomputing (New York, NY, USA, 2010), ICS '10, ACM, pp. 189 -- 199. [3] BORGESSON, L. Abaqus. In Coupled Thermo-Hydro-Mechanical Processes of Fractured Media - Mathematical and Experimental Studies, O. Stephansson, L. Jing, and C.-F. Tsang, Eds., vol. 79 of Developments in Geotech- nical Engineering. Elsevier, 1996, pp. 565 -- 570. [4] BRUCKER, P., GLADKY, A., HOOGEVEEN, H., KOVALYOV, M. Y., POTTS, C., TAUTENHAHN, T., AND VAN DE VELDE, S. Scheduling a batching machine. Journal of Scheduling 1 (1998), 31 -- 54. [5] CHANDRA, D., GUO, F., KIM, S., AND SOLIHIN, Y. Predicting inter-thread cache contention on a chip multi- processor architecture. In HPCA 11 (2005), IEEE, pp. 340 -- 351. [6] COFFMAN JR, E. G., GAREY, M. R., JOHNSON, D. S., AND TARJAN, R. E. Performance bounds for level- oriented two-dimensional packing algorithms. SIAM Journal on Computing 9, 4 (1980), 808 -- 826. [7] DEB, R. K., AND SERFOZO, R. F. Optimal control of batch service queues. Advances in Applied Probability (1973), 340 -- 361. [8] DUTOT, P.-F., MOUNI ´E, G., TRYSTRAM, D., ET AL. Scheduling parallel tasks: Approximation algorithms. Handbook of Scheduling: Algorithms, Models, and Performance Analysis (2003). [9] FRACHTENBERG, E., FEITELSON, D., PETRINI, F., AND FERNANDEZ, J. Adaptive parallel job scheduling with flexible coscheduling. Parallel and Distributed Systems, IEEE Transactions on 16, 11 (2005), 1066 -- 1077. [10] GAREY, M. R., AND JOHNSON, D. S. Computers and Intractability; A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., New York, NY, USA, 1990. [11] HANKENDI, C., AND COSKUN, A. Reducing the energy cost of computing through efficient co-scheduling of parallel workloads. In Design, Automation Test in Europe Conference Exhibition (DATE), 2012 (2012), pp. 994 -- 999. [12] KAMIL, S., SHALF, J., AND STROHMAIER, E. Power efficiency in high performance computing. In IPDPS (2008), IEEE, pp. 1 -- 8. [13] KOOLE, G., AND RIGHTER, R. A stochastic batching and scheduling problem. Probability in the Engineering and Informational Sciences 15, 04 (2001), 465 -- 479. [14] KRESSE, G., AND HAFNER, J. Ab initio molecular dynamics for liquid metals. Phys. Rev. B 47, 1 (Jan 1993), 558 -- 561. [15] LI, D., NIKOLOPOULOS, D. S., CAMERON, K., DE SUPINSKI, B. R., AND SCHULZ, M. Power-aware MPI task aggregation prediction for high-end computing systems. In IPDPS 10 (2010), pp. 1 -- 12. 15 [16] LODI, A., MARTELLO, S., AND MONACI, M. Two-dimensional packing problems: A survey. European Journal of Operational Research 141, 2 (2002), 241 -- 252. [17] PLIMPTON, S. Fast parallel algorithms for short-range molecular dynamics. J. Comput. Phys. 117 (March 1995), 1 -- 19. [18] POTTS, C. N., AND KOVALYOV, M. Y. Scheduling with batching: a review. European Journal of Operational Research 120, 2 (2000), 228 -- 249. [19] ROUNTREE, B., LOWNENTHAL, D. K., DE SUPINSKI, B. R., SCHULZ, M., FREEH, V. W., AND BLETSCH, T. Adagio: making DVS practical for complex HPC applications. In ICS 09 (2009), pp. 460 -- 469. [20] SCOGLAND, T., SUBRAMANIAM, B., AND FENG, W.-C. Emerging Trends on the Evolving Green500: Year Three. In 7th Workshop on High-Performance, Power-Aware Computing (Anchorage, Alaska, USA, May 2011). [21] SHANTHARAM, M., YOUN, Y., AND RAGHAVAN, P. Speedup-aware co-schedules for efficient workload man- agement. Parallel Processing Letters (2013, to appear). [22] TUREK, J., SCHWIEGELSHOHN, U., WOLF, J. L., AND YU, P. S. Scheduling parallel tasks to minimize average response time. In Proceedings of the fifth annual ACM-SIAM symposium on Discrete algorithms (1994), Society for Industrial and Applied Mathematics, pp. 112 -- 121. 16 (a) (b) Figure 4: Relative response times are shown in (a) for Workload-I and in (b) for Workload-II; values less than 1 indicate improvements in response times. The horizontal line in (a) indicates the relative response time of an optimal co-schedule for Workload-I. (a) (b) (c) Figure 5: Relative costs, packing ratios and relative response times of co-schedules for Workload-III on 256 cores. 17 0.00 0.20 0.40 0.60 0.80 1.00 1.20 1.40 1.60 1.80 2.00 2.20 2 4 6 8 10 Rela%ve response %me Pack size Workload--‐I PACK--‐APPROX PACK--‐BY--‐PACK--‐1 PACK--‐BY--‐PACK--‐9 RANDOM--‐PACK--‐1 RANDOM--‐PACK--‐9 RANDOM--‐PROC--‐1 RANDOM--‐PROC--‐9 0.00 0.20 0.40 0.60 0.80 1.00 1.20 1.40 1.60 1.80 2 4 6 8 10 12 14 16 Rela%ve response %me Pack size Workload--‐II PACK--‐APPROX PACK--‐BY--‐PACK--‐1 PACK--‐BY--‐PACK--‐9 RANDOM--‐PACK--‐1 RANDOM--‐PACK--‐9 RANDOM--‐PROC--‐1 RANDOM--‐PROC--‐9 0.00 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00 4 16 32 Rela%ve cost Pack size Workload--‐III PACK--‐APPROX PACK--‐BY--‐PACK--‐1 PACK--‐BY--‐PACK--‐9 RANDOM--‐PACK--‐1 RANDOM--‐PACK--‐9 RANDOM--‐PROC--‐1 RANDOM--‐PROC--‐9 0 0.2 0.4 0.6 0.8 1 1.2 4 16 32 Packing ra*o Pack size Workload--‐III PACK--‐APPROX PACK--‐BY--‐PACK--‐1 PACK--‐BY--‐PACK--‐9 RANDOM--‐PACK--‐1 RANDOM--‐PACK--‐9 RANDOM--‐PROC--‐1 RANDOM--‐PROC--‐9 0.00 0.50 1.00 1.50 2.00 2.50 4 16 32 Rela%ve response %me Pack size Workload--‐III PACK--‐APPROX PACK--‐BY--‐PACK--‐1 PACK--‐BY--‐PACK--‐9 RANDOM--‐PACK--‐1 RANDOM--‐PACK--‐9 RANDOM--‐PROC--‐1 RANDOM--‐PROC--‐9
1902.01088
4
1902
2019-07-09T07:53:59
Regular Languages meet Prefix Sorting
[ "cs.DS" ]
Indexing strings via prefix (or suffix) sorting is, arguably, one of the most successful algorithmic techniques developed in the last decades. Can indexing be extended to languages? The main contribution of this paper is to initiate the study of the sub-class of regular languages accepted by an automaton whose states can be prefix-sorted. Starting from the recent notion of Wheeler graph [Gagie et al., TCS 2017]-which extends naturally the concept of prefix sorting to labeled graphs-we investigate the properties of Wheeler languages, that is, regular languages admitting an accepting Wheeler finite automaton. Interestingly, we characterize this family as the natural extension of regular languages endowed with the co-lexicographic ordering: when sorted, the strings belonging to a Wheeler language are partitioned into a finite number of co-lexicographic intervals, each formed by elements from a single Myhill-Nerode equivalence class. Moreover: (i) We show that every Wheeler NFA (WNFA) with $n$ states admits an equivalent Wheeler DFA (WDFA) with at most $2n-1-|\Sigma|$ states that can be computed in $O(n^3)$ time. This is in sharp contrast with general NFAs. (ii) We describe a quadratic algorithm to prefix-sort a proper superset of the WDFAs, a $O(n\log n)$-time online algorithm to sort acyclic WDFAs, and an optimal linear-time offline algorithm to sort general WDFAs. By contribution (i), our algorithms can also be used to index any WNFA at the moderate price of doubling the automaton's size. (iii) We provide a minimization theorem that characterizes the smallest WDFA recognizing the same language of any input WDFA. The corresponding constructive algorithm runs in optimal linear time in the acyclic case, and in $O(n\log n)$ time in the general case. (iv) We show how to compute the smallest WDFA equivalent to any acyclic DFA in nearly-optimal time.
cs.DS
cs
Regular Languages meet Prefix Sorting(cid:63) Jarno Alanko1, Giovanna D'Agostino2, Alberto Policriti2, and Nicola Prezza3(cid:63)(cid:63) 1 University of Helsinki, Finland, [email protected] 2 University of Udine, Italy, {giovanna.dagostino,alberto.policriti}@uniud.it 3 University of Pisa, Italy, [email protected] Abstract. Indexing strings via prefix (or suffix) sorting is, arguably, one of the most successful algo- rithmic techniques developed in the last decades. Can indexing be extended to languages? The main contribution of this paper is to initiate the study of the sub-class of regular languages accepted by an automaton whose states can be prefix-sorted. Starting from the recent notion of Wheeler graph [Gagie et al., TCS 2017] -- which extends naturally the concept of prefix sorting to labeled graphs -- we inves- tigate the properties of Wheeler languages, that is, regular languages admitting an accepting Wheeler finite automaton. Interestingly, we characterize this family as the natural extension of regular languages endowed with the co-lexicographic ordering: when sorted, the strings belonging to a Wheeler language are partitioned into a finite number of co-lexicographic intervals, each formed by elements from a single Myhill-Nerode equivalence class. We proceed by proving several results related to Wheeler automata: (i) We show that every Wheeler NFA (WNFA) with n states admits an equivalent Wheeler DFA (WDFA) with at most 2n − 1 − Σ states (Σ being the alphabet) that can be computed in O(n3) time. This is in sharp contrast with general NFAs (where the blow-up could be exponential). (ii) We describe a quadratic algorithm to prefix-sort a proper superset of the WDFAs, a O(n log n)- time online algorithm to sort acyclic WDFAs, and an optimal linear-time offline algorithm to sort general WDFAs. By contribution (i), our algorithms can also be used to index any WNFA at the moderate price of doubling the automaton's size. (iii) We provide a minimization theorem that characterizes the smallest WDFA recognizing the same language of any input WDFA. The corresponding constructive algorithm runs in optimal linear time in the acyclic case, and in O(n log n) time in the general case. (iv) We show how to compute the smallest WDFA equivalent to any acyclic DFA in nearly-optimal time. Our contributions imply new results of independent interest. Contributions (i-iii) extend the universe of known regular languages for which membership can be tested efficiently [Backurs and Indyk, FOCS 2016] and provide a new class of NFAs for which the minimization problem can be approximated within constant factor in polynomial time. In general, the NFA minimization problem does not admit a polynomial-time o(n)-approximation unless P=PSPACE. Contribution (iv) is a big step towards a complete solution to the well-studied problem of indexing graphs for linear-time pattern matching queries: our algorithm provides a provably minimum-size solution for the deterministic-acyclic case. 9 1 0 2 l u J 9 ] S D . s c [ 4 v 8 8 0 1 0 . 2 0 9 1 : v i X r a (cid:63) We wish to thank Travis Gagie for introducing us to the problem and for stimulating discussions. (cid:63)(cid:63) Corresponding author. Supported by the project MIUR-SIR CMACBioSeq ("Combinatorial methods for analysis and compression of biological sequences") grant n. RBSI146R5L. 1 Introduction Prefix-sorting is the process of ordering the positions of a string in the co-lexicographic order of their corresponding prefixes4. Once this step has been performed, several problems on strings become much easier to solve: for example, substrings can be located efficiently in the string without the need to read all of its characters. Given the versatility of this tool, it is natural trying to generalize it to more complex objects such as edge-labeled trees and graphs. For example, a procedure for lexicographically-sorting the states of a finite-state automaton could be useful to speed up sub- sequent membership queries in its accepting language or its substring/suffix closure; as shown by Backurs and Indyk [2], membership and pattern matching problems on regular languages are hard in the general case. The newborn theory of Wheeler graphs [11] provides such a generalization. Intuitively, a labeled graph is Wheeler if and only if its nodes can be co-lexicographically sorted in a total order, i.e. pairwise-distinct nodes are ordered according to (i) their incoming labels or (when the labels are equal), according to (ii) their predecessors. As a consequence, Wheeler graphs admit indexes for linear-time exact pattern matching queries (also known as path queries). Wheeler graphs generalize several lexicographically-sorted structures studied throughout the past decades: indexes on strings [10, 23, 32], sets of strings [25], trees [9], de Bruijn graphs [5], variable-order de Bruijn graphs [30], wavelet trees [15], wavelet matrices [4]. These efforts are part of a more general wave of interest (dating as far back as 27 years ago [24]) towards techniques aimed at solving pattern matching on labeled graphs [1,6,7,9,11,19,24,28,30,31]. As discussed above, existing graph-indexing solutions can only deal with simple labeled graphs. The problem of indexing general (or even just acyclic) graphs with a solution of provably-minimum size remains unsolved. Unfortunately, not all graphs are Wheeler and, as Gibney and Thankachan [13] have recently shown, the problem of recognizing (and sorting) them turns out to be NP-complete even when the graph is acyclic (this includes, in particular, acyclic NFAs). Even worse, not all regular languages admit an accepting Wheeler finite automaton: the set of Wheeler languages is a proper superset of the finite languages and a proper subset of the regular languages [11]. Even when an index is not used, exact pattern matching on graphs is hard: Equi et al. [6, 7] have recently shown that any solution to the problem requires at least quadratic time (under the Orthogonal Vectors hypothesis), even on acyclic DFAs. In particular, this implies that converting an acyclic DFA into an equivalent Wheeler DFA cannot be done in less than quadratic time in the worst case. The remaining open questions, therefore, are: what are the properties of Wheeler languages? which class of automata admits polynomial-time prefix-sorting procedures? Can we efficiently build the smallest (that is, with the minimum number of states) prefix-sortable finite-state automaton that accepts a given regular language? These questions are also of practical relevance: as shown in [30], acyclic DFAs recognizing pan-genomes (i.e. known variations in the reference genome of a population) can be turned into equivalent WDFAs of the same expected asymptotic size. While the authors do not find the minimum such automaton, their theoretical analysis (as well as experimental evaluation) suggests that the graph-indexing problem is tractable in some real-case scenarios. 1.1 Our Contributions In this paper we provide the following contributions: 4 Usually, the lexicographic order is used to sort string suffixes. In this paper, we use the symmetric co-lexicographic order of the string's prefixes, and extend the concept to labeled graphs. 1 1. We show that Wheeler languages are the natural version of regular languages endowed with the co-lexicographic ordering: when sorted, the strings belonging to a Wheeler language are partitioned into a finite number of intervals, each formed by elements from a single Myhill- Nerode equivalence class. In regular languages, those intervals are replaced with general sets. 2. We show that every Wheeler NFA (WNFA) with n states admits an equivalent Wheeler DFA (WDFA) with at most 2n−1−Σ states (Σ being the alphabet) that can be computed in O(n3) time. This is in sharp contrast with general NFAs (where the blow-up could be exponential). 3. Let d-NFA denote the class of NFAs with at most d equally-labeled edges leaving any state. We show that the problem of recognizing and sorting Wheeler d-NFAs is in P for d ≤ 2. A recent result from Gibney and Thankachan [13] shows that the problem is NP-complete for d ≥ 5. Our result almost completes the picture, the remaining open cases being d = 3 and d = 4. 4. We provide an online incremental algorithm that, when fed with an acyclic Wheeler DFA's nodes in any topological order, can dynamically compute the co-lexicographic rank of each new incoming node among those already processed with just logarithmic delay. 5. We improve the running time of (4) to linear in the offline setting for arbitrary WDFAs. 6. Given a Wheeler DFA A of size n, we show how to compute, in O(n log n) time, the smallest Wheeler DFA recognizing the same language as A. If A is acyclic, running time drops to O(n). 7. Given any acyclic DFA A of size n, we show how to compute, in O(n + m log m) time, the smallest Wheeler DFA A(cid:48), of size m, recognizing the same language as A. The paper is structured in a top-down fashion to make it accessible also to non-experts. We provide the main theorems and proof sketches within the first ten pages. We start in Section 2 with results 1 and 2: a Myhill-Nerode theorem for Wheeler languages and a linear conversion from WNFAs to WDFAs. Result 1 shows that Wheeler languages are precisely those admitting a "finite interplay" between the co-lexicographic ordering and the Myhill-Nerode equivalence relation (i.e. the relation characterizing general DFAs). Result 2 implies that the WNFA minimization problem admits a polynomial-time 2-approximation. We remark that the NFA minimization problem is notoriously hard (even to approximate within o(n)-factor) in the general case [14,16,22]. In Section 3 we describe results 3-5: polynomial-time algorithms for recognizing and sorting Wheeler 2-NFAs. These results generalize to labeled graphs existing prefix-sorting algorithms on strings [26] and labeled trees [9] that have been previously described in the literature. Combined with contribution 2, our algorithms can be used to index any Wheeler NFA at the price of a moderate linear blow-up in the number of states. This result expands the universe of known regular languages for which membership and pattern matching problems can be solved efficiently [2]. Contributions 6 and 7 (Section 4) combine our sorting algorithms 3-5 with DFA minimization techniques to solve the following problem: to compute, given a finite language represented either explicitly by a set of strings or implicitly by an acyclic DFA, the smallest accepting WDFA. Note that this can be interpreted as a technique to index arbitrary deterministic acyclic graphs using the smallest prefix- sortable equivalent automaton. While we do not provide a lower bound stating that the space of our index is minimum, we note that all known fast indexes on strings, sets of strings, trees, and variable-order de Bruijn graphs are Wheeler graphs [11]. In this sense, any index on acyclic graphs improving our solution would probably require techniques radically different than those developed in the last decades to solve the indexing problem (virtually any known full-text index uses prefix sorting, including those based on LZ77 [21], run-length BWT [12], and grammars [3]). 2 1.2 Definitions We start by giving a definition of finite-state automata that captures, to some extent, the amount of nondeterminism of the automaton. A d-NFA is a nondeterministic finite state automaton that has at most d transitions with the same label leaving each state. Note that 1-NFAs correspond to DFAs, while ∞-NFAs correspond to NFAs. Definition 1. A d-NFA is a quintuple A = (V, E, F, s, Σ), where V is a set of states (or vertices), Σ is the alphabet (or set of labels), E ⊆ V × V × Σ is a set of directed labeled edges, F ⊆ V is a set of accepting states, and s ∈ V is a start state (or source). We moreover require that s ∈ V is the only node with in-degree zero and that for each u ∈ V and a ∈ Σ, {(u, v, a) ∈ E} ≤ d. We denote σ = Σ. The notation L(A) indicates the language accepted by A, i.e. the set of all strings labeling paths from s to an accepting state. We assume that each state either is s or is reachable from s. Otherwise, any state that cannot be reached from s can be removed without changing L(A). Note that we allow states with incomplete transition function, i.e. such that the set of labels of their outgoing edges does not coincide with Σ. If state s misses outgoing label a, then any computation following label a from s is considered as non-accepting. In a standard NFA definition, this would be equivalent to having an outgoing edge labeled a to a universal non-accepting node (a sink). We call a d-NFA acyclic when the graph (V, E) does not have cycles. We say that a d-NFA is input-consistent if, for every v ∈ V , all incoming edges of v have the same label. If the d-NFA is input-consistent, we indicate with λ(v), v ∈ V , the label of the incoming edges of v. For the source, we take λ(s) = # /∈ Σ. We will assume that characters in Σ are totally ordered by ≺ and that # is minimum. We extend ≺ to Σ∗ co-lexicographically, still denoting it by ≺. On DFAs, we denote by succa(u), with u ∈ V and a ∈ Σ, the unique successor of v by label a, when it exists. We define the size of an automaton to be the number of its edges. The notion of Wheeler graph generalizes in a natural way the concept of co-lexicographic sorting to labeled graphs: Definition 2 (Wheeler Graph). A triple G = (V, E, Σ), where V is a set of vertices and E ⊆ V × V × Σ is a set of labeled edges, is called a Wheeler graph if there is a total ordering < on V such that vertices with in-degree 0 precede those with positive in-degree and for any two edges (u1, v1, a1), (u2, v2, a2) we have (i) a1 ≺ a2 → v1 < v2, and (ii) (a1 = a2) ∧ (u1 < u2) → v1 ≤ v2. Note that the above definition generalizes naturally the concept of prefix-sorting from strings to graphs: two nodes (resp. string prefixes) can be ordered either looking at their incoming labels (resp. last characters) or, if the labels are equal, by looking at their predecessors (resp. previous prefixes). Considering that, differently from strings and trees, a graph's node can have multiple predecessors, it should be clear that there could exist graphs whose nodes cannot be sorted due to conflicting predecessors: not all labeled graphs enjoy the Wheeler properties. We call a total order of nodes satisfying Definition 2 a Wheeler order of the nodes and we write WDFA,WNFA as a shortcut for Wheeler DFA, Wheeler NFA. By property (i), input-consistence is a necessary condition for a graph to be Wheeler. An important property of Wheeler graphs is path coherence: Definition 3 (Path coherence [11]). An edge-labeled directed graph G is path coherent if there is a total order of the nodes such that for any consecutive range [i, j] of nodes and string α, the nodes reachable from those in [i, j] in α steps by following edges whose labels form α when concatenated, themselves form a consecutive range. A Wheeler graph is path coherent with respect to any Wheeler order of the nodes [11]. 3 2 Wheeler Languages In this section we collect our basic results on regular languages accepted by automata whose tran- sition relation is a Wheeler graph: Wheeler languages. Definition 4. Let Σ be a finite set. A language L is Wheeler if L = L(A) for a Wheeler NFA A. Let us begin with some basic notation. Given a language L ⊆ Σ∗ we denote by Pref(L), Suff(L), and Fact(L) the set of prefixes, suffixes, and factors of strings in L, respectively. More formally: Pref(L) = {α : ∃β ∈ Σ∗ αβ ∈ L}, Suff(L) = {β : ∃α ∈ Σ∗ αβ ∈ L}, Fact(L) = {α : ∃β, γ ∈ Σ∗ γαβ ∈ L}. Given two states u, v of an NFA A, we denote by u (cid:32) v a path from u to v in A. Definition 5. If A = (V, E, F, s, Σ) is an NFA, u ∈ V , and α ∈ Pref(L(A)), we define: 1. Vα = {v α labels s (cid:32) v}, 2. Pref(L(A))u := {α ∈ Pref(L(A)) : α labels s (cid:32) u} . Clearly, from the above definition it follows that (i) Vα ⊆ V , (ii) Pref(L(A))u ⊆ Pref(L(A)), and (iii) u ∈ Vα if and only if α ∈ Pref(L(A))u. The prefix/suffix property introduced below is going to be crucial to determine the Wheeler ordering among states -- when such an ordering exists. Definition 6. Consider a linear order (L, <). 1. An interval in (L, <) is a I ⊆ L such that (∀x, x(cid:48) ∈ I)(∀y ∈ L)(x < y < x(cid:48) → y ∈ I). 2. Given I, J intervals in (L, <) and I ⊆ J, then: - I is a prefix of J if (∀x ∈ I)(∀y ∈ J \ I)(x < y); - I is a suffix of J if (∀y ∈ J \ I)(∀x ∈ I)(y < x). I, J ∈ C such that I ⊆ J, I is either a prefix or a suffix of J. 3. A family C of non-empty intervals in (L, <) is said to have the prefix/suffix property if, for all The following lemma will allow us to bound (linearly) the blow-up of the number of states taking place when moving from a WNFA to a WDFA. Lemma 1. Let (L, <) be a finite linear order of cardinality L = n, let C be a prefix/suffix family of non-empty intervals in (L, <). Then: 1. C ≤ 2n − 1. 2. The upper bound is tight: for every n, there exists a prefix/suffix family of size 2n − 1. Definition 7. Let C be a family of non-empty intervals of a linear order (L, <) having the pre- fix/suffix property. Let <i (or simply <) the binary relation over C defined by I <i J if and only if (∃x ∈ I)(∀y ∈ J)(x < y) ∨ (∃y ∈ J)(∀x ∈ I)(x < y). The following lemma is easily proved. Lemma 2. Let C be a family of non-empty intervals of a linear order (L, <) having the prefix/suffix property, then (C, <i) is a linear order. 4 Note that whenever the linear order (L, <) is finite, any non-empty interval I has minimum mI and maximum MI . In this special case, the above order <i can be equivalently described on a family having the prefix/suffix property, by: I <i J if and only if (mI < mJ )∨ [(mI = mJ )∧ (MI < MJ )]. We now have the basics to start our study of Wheeler languages. In this section, we use V, E, F, s, Σ, < to denote the set of states, edges, final states, initial state, alphabet, and Wheeler order of a generic WNFA. The key property of path-coherence will be re-proved below -- in Lemma 4 -- , together with what we may call a sort of its "dual", that is, the the set of strings read while reaching a given state is an interval. More precisely, if A is a WNFA, u ∈ V , and α ∈ Σ∗, we have that Vα is an interval in (V, <) (Iα, from now on), Pref(L(A))u is an interval in (Pref(L(A)),≺) (Iu, from now on), and α ∈ Iu if and only if u ∈ Iα. Preliminary to our result are the following lemmas, exploiting the interval-structure of both Wheeler languages and automata. Lemma 3. If A is a WNFA, u, v ∈ V are states, and α, β ∈ Pref(L(A)), then: 1. if α ∈ Iu, β ∈ Iv, and {α, β} (cid:54)⊆ Iv ∩ Iu, then α ≺ β if and only if u < v; 2. if u ∈ Iα, v ∈ Iβ, and {u, v} (cid:54)⊆ Iβ ∩ Iα, then α ≺ β if and only if u < v. Let IV = {Iu : u ∈ V } and IPref(L(A)) = {Iα : α ∈ Pref(L(A))}. Lemma 4. If A is a WNFA and L = L(A), then: 1. for all u ∈ V , the set Iu is an interval in (Pref(L(A)),≺); 2. IV is a prefix/suffix family of intervals in (Pref(L(A)),≺); 3. for all α ∈ Pref(L(A)), the set Iα is an interval in (V, <); 4. IPref(L(A)) is a prefix/suffix family of intervals in (V, <). From Lemma 2 it follows that both (Iv,≺i) and (IPref(L(A)), <i) are linear orders. The link between such orders is made explicit below. Lemma 5. Consider Iu, Iv ∈ IV and Iα, Iβ ∈ IPref(L(A)). 1. Iu ≺i Iv implies that u < v and u < v implies that Iu (cid:22)i Iv 2. Iα <i Iβ implies that α ≺ β and α ≺ β implies that Iα ≤i Iβ If A is a WNFA we can prove that the following interval construction -- which is the analogous of the power-set construction for NFAs -- allows determinization. Definition 8. If A is a WNFA we define its (Wheeler) determinization as the automaton Ad = (V d, Ed, F dsd, <d, Σ), where: - V d = I Pref(L(A)); - sd = I = {s} - F d = {Iα α ∈ L(A)}; - Ed is the set of triples (Iα, Iαe, e), for all e ∈ Σ and αe ∈ Pref(L(A)); - <d=<i. The bound proved in Lemma 1 can be sligthly improved in the special case of prefix/suffix families corresponding to WNFA intervals. 5 Lemma 6 (Determinization of a Wheeler NFA). If A is a WNFA with n states over an alphabet Σ, then Ad is a WDFA with at most 2n − 1 − Σ states, and L(Ad) = L(A). Lemma 7 (Computing the determinization). If A is a WNFA with n states, then Ad can be computed in O(n3) time. Lemma 6 above -- saying that we can restrict the automata recognizing Wheeler Languages to deterministic ones without an exponential blow up -- marks a difference between the standard and the Wheeler case for regular languages and can be seen as the first step in the study of Wheeler Languages. Further differences can be observed. For example, the reader can check that the language L(A) = L = b+a is accepted by incomplete WDFAs only. The subsequent step to take in a theory of Wheeler Languages is a Myhill-Nerode like theorem for this class. To this end, we define: Definition 9. Given a language L ⊆ Σ∗, an equivalence relation ∼ over Pref(L) is: - right invariant, when for all α, β ∈ Pref(L) and γ ∈ Σ∗: if α ∼ β and αγ ∈ Pref(L), then βγ ∈ Pref(L) and αγ ∼ βγ; - convex if ∼-classes are intervals of (Pref(L),≺); - input consistent if all words belonging to the same ∼-class end with the same letter. Consider a language L ⊆ Σ∗. The Myhill-Nerode equivalence ≡L among words in P ref (L) is defined as α ≡L β if and only if (∀γ ∈ Σ∗)(αγ ∈ L ⇔ βγ ∈ L). Definition 10. The input consistent, convex refinement of ≡L is defined as follows. For all α, β ∈ Pref(L): α ≡cL β if and only if α ≡L β ∧ end(α) = end(β) ∧ (∀γ ∈ Pref(L))(α ≺ γ ≺ β → γ ≡L α), where end(α) is the final character of α when α (cid:54)= , and  otherwise. Using the above results in this section we can prove: Theorem 1 (Myhill-Nerode for Wheeler Languages). Given a language L ⊆ Σ∗, the follow- ing are equivalent: 1. L is a Wheeler language (i.e. L is recognized by a WNFA). 2. ≡cL has finite index. 3. L is a union of classes of a convex, input consistent, right invariant equivalence over Pref(L) 4. L is recognized by a WDFA. of finite index. This theorem and other results on Wheeler Languages are going to be part of a companion paper of this one. 6 3 Sorting Wheeler Finite Automata In this section we provide efficient algorithms to sort a relevant sub-class of the Wheeler automata. Combined with the results of the previous section, our algorithms can be used to index any WNFA. We start with a reduction from the problem of recognizing Wheeler 2-NFAs to 2-SAT. The reduction introduces only a polynomial number of boolean variables and can be computed in polynomial time; since 2-SAT is in P, this implies that Wheeler 2-NFA recognition is in P. Theorem 2. Let A = (V, E, F, s, Σ) be a 2-NFA. In O(E2) time we can: 1. Decide whether A is a Wheeler graph, and 2. If A is a Wheeler graph, return a node ordering satisfying the Wheeler graph definition. Proof (Sketch). It is easy to express the Wheeler properties (i)-(ii) and antisymmetry/connex of the Wheeler order with 2-SAT clauses. Transitivity, however, requires 3-SAT clauses on general graphs. The core of the full proof in Appendix D is to show that, on 2-NFAs, transitivity automatically (cid:117)(cid:116) "propagates" from the source to all nodes and does not require additional clauses. Gibney and Thankachan [13] have recently shown that the problem of recognizing Wheeler d- NFAs is NP-complete for d ≥ 5. Theorem 2 almost completes the picture, the remaining open cases being d = 3 and d = 4. We note that Theorem 2 combined with our determinization result of Section 2 does not break the problem's NP-completeness: in principle, our determinization algorithm could turn a non-Wheeler NFA into a WDFA. We now describe more efficient algorithms for the deterministic case. The first, Theorem 3, is an online algorithm that solves the problem considered in Theorem 2 in O(E log V ) time when the graph is an acyclic DFA. The algorithm is online in the following sense. We assume that the nodes, together with their incoming labeled edges, are provided to the algorithm in any valid topological ordering. At any step, we maintain a prefix-sorted list of the current nodes, which is updated when a new node is added. When a new node v arrives together with its incoming labeled edges (u1, v, a), . . . , (uk, v, a), then u1, . . . , uk have already been seen in the past node sequence and can be used to decide the co-lexicographic rank of v. If v falsifies the Wheeler properties, we detect this event, report it, and stop the computation. Our algorithm is an extension of an existing one that builds online the Burrows-Wheeler transform of a string [26]. In Section 4 we will modify this algorithm so that, instead of failing on non-Wheeler graphs, it computes the smallest Wheeler DFA equivalent to the input acyclic DFA. follows from the fact that, on WDFAs, {α, β} (cid:54)⊆ Iv ∩ Iu always holds): Corollary 1. Let A be a Wheeler DFA, < be the node ordering satisfying the Wheeler properties, and ≺ be the co-lexicographic order among strings. For any two nodes u (cid:54)= v, the following holds: αu ≺ αv for all string pairs αu, αv labeling paths s (cid:32) u and s (cid:32) v if and only if u < v. First, note that Lemma 3 implies that Wheeler DFAs admit a unique admissible ordering (this Corollary 1 has two important consequences: on DFAs, (i) we can use any paths connecting s with two nodes u (cid:54)= v to decide their co-lexicographic order, and (ii) if it exists, the total ordering of the nodes is unique. The corollary is crucial in proving the following (as well as others) result: Theorem 3. Let A = (V, E, F, s, Σ) be an acyclic DFA. There exists an algorithm that either prefix-sorts the nodes of A or returns FAIL if such an ordering does not exist online with O(log V ) delay per input edge. 7 All details of our algorithm (description, pseudocode and data structures) and the proof of its correctness are reported in in Appendices D.1 and D.2. To conclude the section, we show that in the offline setting we can improve upon the previous result. We first need the following lemma (see Appendix D.3 for the full proof): Lemma 8. Given an input-consistent edge-labeled graph G = (V, E, Σ) and a permutation of V sorted by a total order < on V , we can check whether < satisfies the Wheeler properties in optimal O(V + E) time. Theorem 4. Let A = (V, E, F, s, Σ) be a DFA. In O(V + E) time we can: 1. Decide whether A is a Wheeler graph, and 2. If A is a Wheeler graph, return a node ordering satisfying the Wheeler graph definition. Proof (Sketch). By Corollary 1, if A is a Wheeler graph then we can use the strings labeling any paths s (cid:32) u and s (cid:32) v to decide the order of any two nodes u and v. We build a spanning tree of A rooted in s and prefix-sort it using [9, Thm 2]. Finally, we verify correctness using Lemma 8. (cid:117)(cid:116) We note that the above strategy cannot be used to sort Wheeler NFAs, since the spanning tree could connect s with several distinct nodes using the same labeled path: this would prevent us to find the order of those nodes using the spanning tree as support. 4 Wheeler DFA Minimization We are now ready to use the algorithms of the previous sections to prove our main algorithmic results: (i) a minimization algorithm for WDFAs (Theorem 5) and (ii) a near-optimal algorithm generating the minimum acyclic WDFA equivalent to any input acyclic DFA (Theorem 7). Let ≡ be an equivalence relation over the states V of an automaton A = (V, E, F, s, Σ). The quotient automaton is defined as A/≡ = (V /≡, E/≡, F/≡, [s]≡, Σ), where E/≡ = {([u]≡, [v]≡, c) : (u, v, c) ∈ E}. The symbol ≈ denotes the Myhill-Nerode equivalence among states [27]: u ≈ v, with u, v ∈ V , if and only if, for any string α, we reach a final state by following the path labeled α from u if and only if the same holds for v. Note that this is the "state" version of the relation ≡L given in Section 2 (which instead is defined among strings). The goal of any DFA-minimization algorithm is to find ≈, which is the, provably existing and unique, coarsest (i.e. largest classes) equivalence relation stable with respect to the initial partition in final/non-final states. To abbreviate, we will simply say "coarsest equivalence relation" instead of "coarsest equivalence relation stable with respect to an initial partition". In our case, assuming that A is Wheeler, we want to find the (unique as proved below) coarsest equivalence relation ≡w finer than ≈, such that A/≡w is Wheeler. Our Algorithm 1 achieves precisely this goal: we start with ≈ and then refine it preserving stability with respect to characters, while also ensuring that the resulting equivalence classes can be ordered consistently with the Wheeler constraints. Again, it can be proved that ≡w is the "state" version of the relation ≡cL given in Section 2. For the purposes of the following results, we do not need to prove the connection between the two relations and we keep a distinct notation to avoid confusion. We show (formal proof in Appendix E): Theorem 5. Let A be a WDFA. The automaton A/≡w returned by Algorithm 1 is the minimum WDFA recognizing L(A). 8 Algorithm 1: WheelerMinimization(A) input : Wheeler DFA A output: Minimum Wheeler DFA A(cid:48) such that L(A) = L(A(cid:48)) 1. Compute the Myhill-Nerode equivalence ≈ among states of A. 2. Prefix-sort A's states, obtaining the ordering v1 < ··· < vn. 3. Compute a new relation ≡w defined as follows. Insert in the same equivalence class all maximal runs vi < vi+1 < ··· < vi+t such that: (a) vi ≈ vi+1 ≈ ··· ≈ vi+t (b) λ(vi) = λ(vi+1) = ··· = λ(vi+t). 4. Return A/≡w . Note that uniqueness of the minimum WDFA follows from Corollary 1 (uniqueness of the Wheeler order) and Algorithm 1. Note also that, in the automaton output by Algorithm 1, adjacent states in co-lexicographic order are distinct by the relation ≈ unless their incoming labels are different (in which case they might be equivalent). It follows that if a sorted Wheeler DFA does not have this property, then it is not minimum (otherwise Algorithm 1 would collapse some of its states). Conversely, If a Wheeler DFA has this property, then Algorithm 1 does not collapse any state, i.e. the automaton is already of minimum size. We therefore obtain the following characterization: Theorem 6 (Minimum WDFA). Let A be a Wheeler DFA, let v1 < v2 < ··· < vt be its co- lexicographically ordered states, and let ≈ be the Myhill-Nerode equivalence among them. A is the minimum Wheeler DFA recognizing L(A) if and only if the following holds: for every 1 ≤ i < t, if vi ≈ vi+1 then λ(vi) (cid:54)= λ(vi+1). Theorem 5 implies the following corollaries. Corollary 2. Given a WDFA A of size n, in O(n log n) time we can build the minimum WDFA recognizing L(A). Proof. We run Algorithm 1 computing ≈ with Hopcroft's algorithm [17] (O(n log n) time), and prefix-sorting A with Theorem 4 (O(n) time). Note that we can check u ≈ v in constant time by representing the equivalence relation as a vector EQ[v] = [v]≈, where we choose V = {1, . . . ,V } and where [v]≈ is any representative of the equivalence class of v (e.g., the smallest one, which we can identify in linear time by radix-sorting equivalent states). Then, u ≈ v if and only if EQ[u] = EQ[v]. (cid:117)(cid:116) Using this structure, the runs of Algorithm 1 can easily be identified in linear time. Corollary 3. Given an acyclic WDFA A of size n, in O(n) time we can build the minimum acyclic WDFA recognizing L(A). Proof. We run Algorithm 1 computing ≈ with Revuz's algorithm [29] (O(n) time), prefix-sorting (cid:117)(cid:116) A with Theorem 4 (O(n) time), and testing u ≈ v in constant time as done in Corollary 2. Note that Corollary 3 implies that we can, in optimal linear time, build the minimum WDFA A/≡w recognizing any input finite language L represented as a set of strings: we build the tree DFA accepting L and apply Corollary 3. The corollary can be applied since trees are always Wheeler [9, 11]. In the next subsection we treat the (more interesting) case where L is represented by a DFA. Note that this result could already be achieved by unraveling the DFA into a tree and minimizing it using Corollary 3. However, the intermediate tree could be exponentially larger than the output. 9 4.1 Acyclic DFAs to Smallest Equivalent WDFAs states in LEXi itself: in Definition 2, we require u1, u2, v1, v2 ∈ LEXi. We show how to build the smallest acyclic Wheeler DFA equivalent to any acyclic DFA in output- sensitive time. Let A = (V, E, F, s, Σ) be an acyclic DFA. We first minimize A using Revuz's algorithm [29] and obtain the equivalent minimum acyclic DFA A1 = A/≈ = (V1, E1, F1, s1, Σ). Let us denote V1 = t. The idea is to run a modified version of the online Algorithm 3 on A1. The difference is that now we will solve (not just detect) violations to the Wheeler properties without changing the accepting language. The next step is to topologically-sort A1's states (e.g. using Kahn's algorithm [20]). At this point, we modify A1 in t steps by processing its states in topological order. This defines a sequence of automata A1,A1, . . . ,At. At each step, the states of Ai are partitioned in two sets: -- those not yet processed: Ni = {vi+1, vi+2, . . . , vt}, and -- the remaining states Vi − Ni, sorted by a total ordering < in a sequence LEXi. At the beginning, N1 = {v2, . . . , vt} and LEX1 = s. Note that Nt = ∅ (i.e. at the end we will have processed all states). At each step i, we maintain the following invariants: 1. L(Ai) = L(A1). 2. States in LEXi are sorted by a total order < that does not violate the Wheeler properties among 3. for each j = 1, . . . ,LEXi − 1, if LEXi[j] ≈ LEXi[j + 1] then λ(LEXi[j]) (cid:54)= λ(LEXi[j + 1]). Invariant 1 implies L(At) = L(A). Since Nt = ∅ and LEXt contains all At's states, invariant 2 implies that At is Wheeler (note that intermediate automata Ai, with 1 < i < t might be non- Wheeler). Finally, invariant 3 and Theorem 6 imply that At is the minimum WDFA accepting L(At). As a result, At = A/≡w . We describe all the details of our algorithm in Appendix E.1 for space constraints; here we give an overview of the procedure. The idea is to process states in topological order as done in Theorem 3. This time, however, we also solve inconsistencies of type 1 and 2 among nodes in LEXi∪{vi+1} by splitting nodes in ≈-equivalent copies. Here, splitting means creating two or more copies of a state v in such a way that (i) each copy duplicates all v's outgoing edges, (ii) v's incoming edges are distributed (not duplicated) among the copies, and (iii) each copy is a final state if and only if v is a final state. Our splitting process creates ≈-equivalent nodes, therefore the accepted language never changes (invariant 1 stays true). Moreover, since the states of A have already been collapsed by the equivalence ≈, after inserting nodes (or their copies) in LEXi we never create runs of length greater than one of ≈-equivalent states with equal incoming labels (invariant 3 stays true). As a result, we incrementally build the minimum WDFA A/≡w recognizing L(A). Since our algorithm never deletes edges, the running time is bounded by the output's size (which could nevertheless be much larger -- or smaller -- than A). In Appendix E.1 we show: Theorem 7. Given an acyclic DFA A of size n, we can build and prefix-sort the minimum acyclic WDFA, of size m, recognizing L(A) in O(n + m log m) time. Theorem 7 solves the problem of indexing deterministic DAGs for linear-time pattern matching queries in nearly-optimal time with a solution of minimum size. Note that the hardness result of Equi et al. [7] implies that, under the Orthogonal Vectors hypothesis, in the worst case the minimum WDFA has size Ω(n2−) for any constant  > 0. We can do better: in Appendix F we show that, in the worst case, the minimum WDFA can be of size Ω(2n/4). 10 A Indexing Wheeler Automata We show that any Wheeler NFA can be efficiently indexed in order to support fast membership queries in its accepting language or in its substring/suffix closure. Let A be any Wheeler NFA. We first remove all states that do not lead to a final state. This preserves the accepted language, the total ordering, and the Wheeler properties. We then use our algorithms to convert the automaton to a WDFA, prefix-sort it in polynomial time, and build a (generalized) FM-index on the graph as described in [11]. We mark in a bitvector B[1..V ] supporting constant-time rank queries [18] all accepting states of the Wheeler NFA in our array LEX containing the states in co-lexicographic order. To check membership of a word w, we search the word #w and get a range LEX[L, R] of all states reachable from the root by a path labeled w. At this point, w is accepted if and only if B[L, R] contains at least one bit set (constant time using rank on B). Note that this procedure works in O(w log σ) time also if the original automaton is nondeterministic (this, in general, is not possible for general NFAs). If we search for w instead of #w, then we get the range of states reachable by a path labeled uw, for any u ∈ Σ∗. This range is non-empty if and only if w belongs to the substring closure of L(A). Finally, if we search a word w and get a range LEX[L, R], then w is in the suffix closure of L(A) if and only if B[L, R] contains at least one bit set. B Conclusions and Future Extensions In this paper, we have initiated the study of Wheeler languages, that is, regular languages that can be indexed via prefix-sorting techniques. On our way, we provided new results of independent inter- est: (i) we provided a new class of NFAs for which the minimization problem can be approximated up to multiplicative factor 2 in polynomial time and that admit fast membership and pattern matching algorithms, and (ii) we solved the problem of indexing finite languages with prefix-sortable DFAs of minimum size. Our work leaves several intriguing lines of research (some of which will be explored in future extensions of this paper). First of all, is the problem of recognizing Wheeler languages (encoded, e.g. as regular expressions) decidable? We believe that the answer to this question is positive: the Wheelerness of a regular language seems to translate into particular constraints (that can be verified in bounded time) on the topology of its minimum accepting DFA. Once a regular language has been classified as Wheeler, can we build the minimum accepting Wheeler DFA? Also in this case, we believe that the task can be solved by iterating conflict-resolution (Section 4.1) from the minimum DFA until the process converges to the minimum Wheeler DFA. C Proofs of Section 2 Proof. (of Lemma 1) Let us order the elements of L by the relation <, and let us denote by L[i] the i-th element in the ordering. The notation L[i, j], with j ≥ i, denotes the interval {L[k] : i ≤ k ≤ j}. In particular, L[1, n] = L. We say that an interval I ∈ C is maximal if I is not the prefix nor the suffix of any other interval in C. We say that an interval I ∈ C is prefix (resp. suffix ) if I is the proper prefix (resp. suffix) of a maximal interval of C. Note that, by this definition, intervals of C are either maximal or prefix/suffix. Note also that there could be elements of C being both prefix and suffix intervals. (1) We first prove that (1.i) C contains at most n prefix intervals, then (1.ii) slightly improve this bound to n − 1, and finally (1.iii) show that the sum between the number of maximal and 11 suffix intervals is at most n. To prove (1.i), we show that every L[j], 1 ≤ j ≤ n, can be the largest element of at most one prefix interval. In turn, this is shown by considering the prefixes of any two pairwise distinct maximal intervals of C. Consider two distinct maximal intervals I = L[i, j] and J = L[i(cid:48), j(cid:48)]. If I and J do not overlap (i.e. j < i(cid:48) or j(cid:48) < i), then the property is trivially true: if I(cid:48) and J(cid:48) are prefixes of I and J, respectively, then max(I(cid:48)) (cid:54)= max(J(cid:48)). Consider now the case where I and J overlap. Without loss of generality, we can assume i < i(cid:48) ≤ j < j(cid:48) (the strict inequalities follow from the fact that, by maximality, it cannot be i = i(cid:48) or j = j(cid:48)). Assume, for contradiction, that C contains two intervals L[i, j(cid:48)(cid:48)] and L[i(cid:48), j(cid:48)(cid:48)] such that i(cid:48) ≤ j(cid:48)(cid:48) < j, i.e. L[i, j(cid:48)(cid:48)] and L[i(cid:48), j(cid:48)(cid:48)] are (proper) prefixes of I and J, respectively, that share their largest element j(cid:48)(cid:48). Then, we have i < i(cid:48) ≤ j(cid:48)(cid:48) < j: interval L[i(cid:48), j(cid:48)(cid:48)] is strictly contained inside L[i, j] ∈ C (i.e. L[i(cid:48), j(cid:48)(cid:48)] ⊂ L[i, j]) and it is not a prefix nor a suffix of it. This is forbidden by the definition of prefix/suffix family. From this contradiction we deduce that any two distinct prefix intervals I(cid:48), J(cid:48) ∈ C satisfy max(I(cid:48)) (cid:54)= max(J(cid:48)), which implies that C contains at most n prefix intervals. To improve the above bound to n − 1 and prove (1.ii), consider the rightmost maximal interval I = L[i, j], i.e. the one having largest j. We show that j cannot be the maximum element of any prefix interval. Assume, for contradiction, that such a prefix interval K = L[i(cid:48), j] exists. Then, the corresponding maximal interval J = L[i(cid:48), j(cid:48)] of which K is a proper prefix satisfies j(cid:48) > j. This contradicts the fact that I is the rightmost maximal interval. The next step is to prove (1.iii), i.e. that the sum between the number of maximal and suffix intervals is at most n. We proceed by induction on the number M of maximal intervals. If M = 1, then the unique maximal interval I = L[i, j] contains at most j − i suffix intervals. In total, C contains at most 1 + (j − i) ≤ n maximal and suffix intervals. For M > 1, consider the maximal interval I = L[i, j] with minimum j (call it the "leftmost"). Now, consider the immediate maximal "successor" J = L[i(cid:48), j(cid:48)] of I, i.e. the maximal interval with the smallest endpoint j(cid:48) ≥ j. Clearly, such j(cid:48) satisfies j(cid:48) > j, otherwise J would be a suffix of I (contradicting maximality of J). Note that it must also be the case that i(cid:48) > i: if i = i(cid:48), then I would be a prefix of J (contradicting maximality of I); on the other hand, if i(cid:48) < i then I would be strictly contained in J, contradicting the definition of prefix/suffix family. We are left with two cases: (a) i ≤ j < i(cid:48) ≤ j(cid:48). In this case, I and J are disjoint. As seen above, I contributes to at most one maximal interval (I itself) and j − i suffix intervals. In total, I contributes to at most j − i + 1 maximal and suffix intervals. We are left to count the number of maximal and suffix intervals in the remaining portion of the linear order L[i(cid:48), ..., n]. Note that there are no other intervals to be considered: if L[i(cid:48)(cid:48), j(cid:48)(cid:48)] is a maximal interval in C, different from I, J, then j(cid:48)(cid:48) > j(cid:48) and hence i(cid:48)(cid:48) > i(cid:48) or L[i(cid:48)(cid:48), j(cid:48)(cid:48)] would contain J. The portion L[i(cid:48), ..., n] contains M − 1 maximal intervals, so we can apply the inductive hypothesis and obtain that this segment contains at most n − i(cid:48) + 1 maximal and suffix intervals. In total, we have that L[1, ..., n] contains at most (j − i + 1) + (n − i(cid:48) + 1) maximal and suffix intervals. Since i(cid:48) > j and i ≥ 1, this quantity is at most n. (b) i < i(cid:48) ≤ j < j(cid:48). Denote by k = i(cid:48) − i the number of L's elements belonging to I \ J. Then, C can contain at most k proper suffixes of I: L[i + 1, j], L[i + 2, j], ..., L[i(cid:48), j]. All other suffixes of I are strictly contained inside J, and cannot belong to C due to the prefix/suffix property. Actually, one of those suffixes, L[i(cid:48), j], is a prefix of J so it has already been counted above in points (1.i) and (1.ii). We are left with k− 1 suffixes to take into account, plus the maximal interval I itself: in total, k = i(cid:48) − i maximal and suffix intervals. As noted above, all remaining maximal and suffix intervals of C to take into account are those contained in L[i(cid:48), n]. Since L[i(cid:48), n] contains M − 1 maximal intervals, we can apply the inductive hypothesis and deduce that it contains at most n − i(cid:48) + 1 12 maximal and suffix intervals. In total, L[1, n] contains therefore at most (i(cid:48) − i) + (n − i(cid:48) + 1) ≤ n maximal and suffix intervals. This concludes the proof of the upper bound C ≤ 2n − 1. (2) Consider the prefix/suffix family containing just one maximal interval and all its proper prefixes and suffixes: C = {L[1, n], L[1, 1], . . . , L[1, n − 1], L[2, n], . . . , L[n, n]}. This family satisfies C = 2n − 1. (cid:117)(cid:116) Proof. (of Lemma 2) We just prove transitivity when I <i J and J <i K are witnessed by x0 ∈ I satisfying (∀y ∈ J)(x0 < y), and z0 ∈ K satisfying (∀y ∈ J)(y < z0), respectively (the other cases are similar). We claim that z0 > x, for all x ∈ I. Suppose, for contradiction, that there exists x1 ∈ I with z0 ≤ x1; then, from x0 < y < z0 ≤ x1 for all y ∈ J and the fact that I is an interval, it follows that z0 ∈ I, J ⊆ I, so that, by prefix/suffix property of C, J is either a prefix or a suffix of I. Since x0 < y for all y ∈ J, we see that J must be a suffix of I and this, knowing that z0 ∈ I, implies z0 ∈ J. A contradiction. In the following proofs, we always refer to a WNFA A = (V, E, F, s, Σ, <). Proof. (of Lemma 3) (1) Suppose α ∈ Iu, β ∈ Iv and {α, β} (cid:54)⊆ Iv ∩ Iu. From this we have that α ∈ Iu \ Iv or β ∈ Iv \ Iu, hence u (cid:54)= v and α (cid:54)= β follows. If u = s or v = s, either α or β is the empty string  and the result follows easily. Hence, we suppose u (cid:54)= s (cid:54)= v and (hence) α (cid:54)=  (cid:54)= β. To see the left-to-right implication, assume α ≺ β: we prove that u < v by induction on the maximum betwewn α and β. If α = β = 1, then the property follows from the Wheeler-(i). If max(α,β) > 1 and α and β end with different letters, then again the property follows from Wheeler-(i). Hence, we are just left with the case in which α = α(cid:48)e and β = β(cid:48)e, with e ∈ Σ. If α ≺ β, then α(cid:48) ≺ β(cid:48). Consider states u(cid:48), v(cid:48) such that α(cid:48) ∈ Iu(cid:48), β(cid:48) ∈ Iv(cid:48), and (u(cid:48), u, e), (v(cid:48), v, e) ∈ E. Then α(cid:48) ∈ Iu(cid:48) \ Iv(cid:48) or β(cid:48) ∈ Iv(cid:48) \ Iu(cid:48) because otherwise we would have α(cid:48) ∈ Iv(cid:48) and β(cid:48) ∈ Iu(cid:48) which imply respectively α ∈ Iv and β ∈ Iu. By induction we have u(cid:48) < v(cid:48) and therefore, by Wheeler- (ii), u ≤ v. From u (cid:54)= v it follows u < v. Conversely, for the right-to-left implication, suppose u < v. Since α (cid:54)= β, if it were β ≺ α then, by the above, we would have v < u: a contradiction. Hence, α ≺ β holds. (2) Recall that, by definition, α ∈ Iu if and only if u ∈ Iα and β ∈ Iv if and only if v ∈ Iβ. Hence, the hypothesis that u ∈ Iα, v ∈ Iβ and {u, v} (cid:54)⊆ Iβ ∩ Iα, is equivalent to say that α ∈ Iu, β ∈ Iv and {α, β} (cid:54)⊆ Iv ∩ Iu. Therefore, (2) follows from (1). Proof. (of Lemma 4) 1. Suppose α ≺ β ≺ γ with α, γ ∈ Iu and β ∈ Pref(L(A)); we want to prove that β ∈ Iu. From β ∈ Pref(L(A)) it follows that there exists a state v such that β ∈ Iv. Suppose, for contradiction, that β (cid:54)∈ Iu. Then β ∈ Iv\Iu and from α ≺ β and Lemma 3, it follows u < v. Similarly, applying again Lemma 3, from β ≺ γ we have v < u, which is a contradiction. 2. Suppose, for contradiction, that Iu, Iv ∈ IV are such that Iu (cid:40) Iv and Iu is neither a prefix nor a suffix of Iv. In these hypotheses there must exist α, α(cid:48) ∈ Iv \ Iu and β ∈ Iu such that α ≺ β ≺ α(cid:48). Lemma 3 implies v < u < v, which is a contradiction. Points (3), (4) follow similarly from Lemma 3. 13 Proof. (of Lemma 6) The verification that L(Ad) = L(A) follows the same lines of the proof in the classical regular case. We prove that <d is a Wheeler order on the states of the automaton Ad. By Lemma 4, the set V d = IPref(L(A)) of states of Ad is a prefix/suffix family of intervals, so that, by Lemma 2, <d is a linear order on V d. Next, we check the Wheeler properties. The only vertex with in-degree 0 is I, and it clearly precedes those with positive in-degree. For any two edges (Iα, Iαa1, a1), (Iβ, Iβa2, a2) we have: (i) if a1 ≺ a2 then αa1 ≺ βa2, and from Lemma 5 it follows Iαa1 ≤d Iβa2. Moreover, by the input consistency of A, states in Iαa1 are a1-states, while states in Iβa2 are a2-states; hence Iαa1 (cid:54)= Iβa2, so that Iαa1 <d Iβa2 follows. (ii) If a = a1 = a2 and Iα < Iβ, from Lemma 5 it follows α ≺ β, so that αa ≺ βa and, using again Lemma 5, we obtain I = Iαa ≤i I = Iβa. Finally, we prove that V d ≤ 2n − 1 − Σ. By the Wheeler properties, we know that the only interval in IPref(L(A)) containing the initial state s of the automaton A is {s} and that the remaining intervals can be partitioned into Σ-classes, by looking at the letter labelling incoming edges. If Σ = {a1, . . . , ak}, and, for every i = 1, . . . , k, we denote by mi the number of states of the automaton i=1 mi = n − 1. Using Lemma 1 we see that the intervals in V d composed by ai states are at most 2mi − 1, so that the total number of intervals in V d is at most A whose incoming edges are labeled ai, we have(cid:80)k k(cid:88) (cid:88) 1 + (2mi − 1) = 1 + 2( mi) − k = 1 + 2(n − 1) − k = 2n − 1 − k = 2n − 1 − Σ. i=1 i=1 Proof (of Lemma 7). We apply the standard powerset construction algorithm starting from the original WNFA A. By Lemma 6, the powerset algorithm does not generate more than 2n − 1 − Σ distinct sets of states. Remember that such algorithm starts from the set {s} containing the NFA's source and simulates a visit of the final DFA, whose states are represented as sets of states of the original NFA. At each step, the successor with label a ∈ Σ of a set K is computed by calculating all the a-successors of states in K, and taking their union. In the worst case, K = O(n) and each state in K has O(n) a-successors. After having obtained the a-successor K(cid:48) of K, we need to check if K(cid:48) had already been visited. Since K(cid:48)'s cardinality is at most n, this operation takes O(n) time using a standard dictionary (e.g. a hash table). Overall, we spend O(n2) time to simulate an edge traversal of the final DFA. By Lemma 6, we visit at most O(n) distinct sets of states. Overall, the (cid:117)(cid:116) powerset algorithm's complexity is O(n3). Proof. (of Theorem 1) (1) ⇒ (2) If A is a Wheeler NFA such that L = L(A), consider the following equivalence relation ∼A over Pref(L): α ∼A β ⇔ Iα = Iβ. Using the fact that the Iα are intervals (see Lemma 4), and other properties of Wheeler au- tomata, one can easily prove that the equivalence ∼A is a refinement of ≡cL, so that each ≡cL-class is a union of ∼A-classes. Moreover, the equivalence ∼A has finite index, bounded by the number of intervals Iα, hence ≡cL has finite index as well. 14 (2) ⇒ (3) We prove that the relation ≡cL is a convex, input consistent, right invariant equivalence, and that L is a union of ≡cL-classes; this last property is true simply because L is a union of ≡L- classes and ≡cL is a refinement of ≡L. The fact that ≡cL is convex and input consistent follows directly from its definition. We prove that ≡cL is right invariant. Suppose α, α(cid:48), γ ∈ Pref(L) and α ≡cL α(cid:48). Note that if αγ ∈ Pref(L) then there exists ν ∈ Σ∗ such that αγν ∈ L, so that α(cid:48)γ ∈ Pref(L) follows from α ≡L α(cid:48). Hence, we are left to prove that αγ ≡cL α(cid:48)γ. We easily prove the following: - αγ ≡L α(cid:48)γ (it follows from α ≡L α(cid:48)). - If αγ ≺ β(cid:48) ≺ α(cid:48)γ, for β(cid:48) ∈ Pref(L), then β(cid:48) ≡L αγ: from αγ ≺ β(cid:48) ≺ α(cid:48)γ it follows that β(cid:48) = βγ, for some β ∈ Pref(L), and α ≺ β ≺ α(cid:48). Since α, α(cid:48) belong to the same ≡cL class, then β ≡L α, and βγ ≡L αγ follows from the right invariance of ≡L. Since αγ, βγ end with the same letter, the previous points imply that αγ ≡cL α(cid:48)γ and ≡cL is right invariant. (3) ⇒ (4) Suppose L is a union of classes of a convex, input consistent, right invariant equivalence relation ∼ of finite index. We build a WDFA A∼ = (V∼, E∼, F∼, s∼, Σ, <∼) such that L = L(A) as follows: - V∼ = {[α]∼ α ∈ Pref(L)}; - s∼ = []∼ (note that, by input consistency, []∼ = {}); - (I, J, e) ∈ E∼ if and only if Ie ∩ Pref(L) (cid:54)= ∅ and Ie ⊆ J, where Ie = {αe α ∈ I} (note that J, if existing, is unique by right invariancy); - F∼ = {I I ⊆ L}; - <∼=≺i (being pairwise disjoint and convex, the classes in V∼ form a prefix/suffix family of intervals of (Pref(L),≺)). Note that all words in Pref(L) label a computation in A∼. We claim that, for all ∼-class I and α ∈ Pref(L): α ∈ I ⇔ s∼ (cid:32) I in A∼ reading α. We prove the implication from right to left by induction on the length of α ∈ Pref(L). If α =  then the claim follows from the definition of s∼. If α = α(cid:48)e ∈ Pref(L) with e ∈ Σ, then α(cid:48) ∈ Pref(L). Then, if K ∈ V∼ is such that s∼ (cid:32) K reading α(cid:48) in A∼, by induction we know that α(cid:48) ∈ K. Since α = α(cid:48)e ∈ Ke, we have Ke ∩ Pref(L) (cid:54)= ∅; by right invariance of ∼ there exists a unique J such that Ke ⊆ J. From α = α(cid:48)e ∈ Ke ⊆ J it follows α ∈ J, and also J = I, because A∼ is a deterministic automaton and s∼ (cid:32) I, s∼ (cid:32) J, both by reading α. In order to prove the implication from left to right of the claim, suppose α ∈ I, and J ∈ V∼ is such that s∼ (cid:32) J in A∼ reading α. Then, by the first part of the proof of the claim we obtain α ∈ J; since J and I are equivalence classes and α ∈ I ∩ J, it follows that I = J and s∼ (cid:32) I in A∼ reading α. From the above claim and the definition of F∼, it easily follows that L is the language recognised by A∼. We conclude by checking that A∼ is Wheeler, proving the two Wheeler properties (i) and (ii) with respect to the linear order (V∼, <∼). To see Wheeler-(i) assume e ≺ e(cid:48) with e, e(cid:48) ∈ Σ. Consider I, J ∈ V∼ such that (I, H, e) ∈ E∼ and (J, K, e(cid:48)) ∈ E∼. We want to prove that H <∼ K (i.e. H ≺i K). By definition of E∼, in our hypotheses there are α ∈ I, α(cid:48) ∈ J with αe ∈ H and α(cid:48)e(cid:48) ∈ K. From e ≺ e(cid:48) it follows αe ≺ α(cid:48)e(cid:48) 15 and hence H (cid:22)i K. To conclude observe that H ≺i K since all words in H end with e, while all words in K end with e(cid:48). To see Wheeler-(ii) assume I <∼ J (i.e. I ≺i J), e ∈ Σ, (I, H, e) ∈ E∼, and (J, K, e) ∈ E∼. In these hypotheses there are α ∈ I, α(cid:48) ∈ J, with αe ∈ H and α(cid:48)e ∈ K. From I ≺i J and the fact that different classes are disjoint it follows α ≺ α(cid:48); therefore, αe ≺ α(cid:48)e and hence H (cid:22)i K. This ends the proof of the implication (3) ⇒ (4). (4) ⇒ (1) Trivial. D Proofs of Section 3 Proof. (of Theorem 2) We can assume, without loss of generality, that A is input-consistent, since checking this prop- erty takes linear time. If A is not input-consistent, then it is not Wheeler. We show a reduction of problem 1 to 2-SAT, which can be solved in linear time using Aspvall, Plass, and Tarjan's (APT) algorithm based on strongly connected components computation. The reduction introduces O(V 2) variables and O(E2) clauses, hence the final running time will be O(E2). Moreover, since a sat- isfying assignment to our boolean variables will be sufficient to define a total order of the nodes, APT will essentially solve also problem 2. For every pair u (cid:54)= v of nodes we introduce a variable xu<v which, if true, indicates that u must precede v in the ordering. We now describe a 2-SAT CNF formula whose clauses are divided in two types: clauses of the former type ensure that the Wheeler graph property is satisfied, while clauses of the second type ensure that the order of nodes induced by the variables is total. The following formulas ensure that the Wheeler properties are satisfied: (a) For each u, v, if λ(u) ≺ λ(v) then we add the unary clause xu<v. (b) For each u (cid:54)= v, if λ(u) = λ(v) = a, then for every pair u(cid:48) (cid:54)= v(cid:48) such that (u(cid:48), u, a) ∈ E and (v(cid:48), v, a) ∈ E we add the clause xu(cid:48)<v(cid:48) → xu<v. There are at most V 2 ≤ E2 clauses of type (a) and at most E2 clauses of type (b). The following formulas guarantee that the order is total. Note that we omit transitivity which, on a general graph, would require a 3-literals clause (xu<v ∧ xv<w) → xu<w for each triple u, v, w. We will show that, if the graph is an input-consistent 2-NFA, then transitivity is satisfied "for free". (1) Antisymmetry. For every pair u (cid:54)= v, add the clause xu<v → ¬xv<u. (2) Completeness. For every pair u (cid:54)= v, add the clause xu<v ∨ xv<u. There are at most O(V 2) = O(E2) clauses of types (1) and (2). We now show that on input-consistent 2-NFAs transitivity propagates from the source to all nodes. Consider a variable assignment that satisfies clauses (a),(b),(1), and (2) (if A is a Wheeler 2-NFA, then such an assignment exists by definition). Assume, moreover, that xu<v and xv<w are set true by the assignment, for three pairwise distinct nodes u, v, w. We want to show that also xu<w must be true. Consider a directed shortest-path tree T with root s of A. Since we assume that each state is reachable from s, T must exist and must contain all nodes of A. Let dv be the length of a shortest directed path connecting s to v. By definition of T , the path connecting s to v in T has length dv, with ds = 0. We proceed by induction on k = max{du, dv, dw}. The case k = 0 is trivial, since 16 there are no triples of pairwise distinct nodes in {u : du ≤ 0} (this set contains just s). Take now a general k > 0. We consider two main cases: (i) {λ(u), λ(v), λ(w)} > 1. Then, since xu<v and xv<w, for some a < b < c ∈ Σ either: (i.1) λ(u) = a, λ(v) = b, λ(w) = c, or (i.2) λ(u) = a, λ(v) = a, λ(w) = b, or (i.3) λ(u) = a, λ(v) = b, λ(w) = b. Any other choice would force one of the variables xv<u, xw<v to be true (by an (a)- clause), forcing a contradiction by a (1)-clause. In all cases (i.1)-(i.3) we have that λ(u) < λ(w), therefore xu<w must be true by (a). (ii) λ(u) = λ(v) = λ(w) = a for some a ∈ Σ (note that a (cid:54)= # since the NFA has only one source and u, v, w are distinct by assumption). Let u(cid:48), v(cid:48), w(cid:48) be the parents of u, v, w, respectively, in T . Note that u(cid:48), v(cid:48), w(cid:48) cannot be the same vertex, since u, v, w are distinct and every node has at most two outgoing edges with the same label. We therefore consider two sub-cases. (ii.1) {u(cid:48), v(cid:48), w(cid:48)} = 2. We first show that u(cid:48) = w(cid:48) (cid:54)= v(cid:48) generates a contradiction. Since xu<v and xv<w are true and u(cid:48) (cid:54)= v(cid:48) and v(cid:48) (cid:54)= w(cid:48) hold, xu(cid:48)<v(cid:48) and xv(cid:48)<w(cid:48) must be true: otherwise, by (b), would imply that xv<u and xw<v are true, which generates a contradiction. Now, u(cid:48) = w(cid:48) means that xv(cid:48)<w(cid:48) and xv(cid:48)<u(cid:48) have the same truth value; since xu(cid:48)<v(cid:48) and xv(cid:48)<u(cid:48) cannot be both true, we have a contradiction. We are therefore left with the case u(cid:48) = v(cid:48) (cid:54)= w(cid:48) (u(cid:48) (cid:54)= v(cid:48) = w(cid:48) is symmetric). Remember that we assumed xu<v and xv<w are true. Hence, xv(cid:48)<w(cid:48) must be true: otherwise, by (b), the truth of xw(cid:48)<v(cid:48) would imply that xw<v is true, which generates a contradiction. Since xv(cid:48)<w(cid:48) = xu(cid:48)<w(cid:48) is true, by (b) we conclude that also xu<w must be true. (ii.2) u(cid:48), v(cid:48), w(cid:48) are pairwise distinct. We show that xu(cid:48)<v(cid:48) and xv(cid:48)<w(cid:48) must be true. Suppose, for contradiction, that xu(cid:48)<v(cid:48) is false (the proof is symmetric for xv(cid:48)<w(cid:48)). Then, by (2), xv(cid:48)<u(cid:48) is true. But then, by (b) it must be the case that xv<u is true. Since we are assuming that xu<v is true, this introduces a contradiction by (1). Therefore, we conclude that xu(cid:48)<v(cid:48) and xv(cid:48)<w(cid:48) are true for the (pairwise distinct) parents u(cid:48), v(cid:48), w(cid:48) of u, v, w in T . Now, by definition of the shortest-path tree T it must be the case that du(cid:48) = du − 1, dv(cid:48) = dv − 1, and dw(cid:48) = dw − 1 as u(cid:48), v(cid:48), w(cid:48) are the parents of u, v, w in T . As a consequence, max{du(cid:48), dv(cid:48), dw(cid:48)} = k − 1. We can therefore apply the inductive hypothesis and conclude that xu(cid:48)<w(cid:48) is true. But then, by (b) we conclude that xu<w must also be true. From the above proof correctness follows: if A is an input-consistent 2-NFA and there exists a truth assignment satisfying the formula, then the assignment induces a total ordering of the nodes satisfying the Wheeler properties. Conversely, the algorithm is clearly complete: if A is a Wheeler 2-NFA, then there exists a total ordering of the nodes satisfying the Wheeler properties. (cid:117)(cid:116) This defines a truth assignment of the variables that satisfies our 2-SAT formula. We note that it is tempting to try to generalize the above solution to general NFAs by simulating arbitrary degree-d nondeterminism using binary trees: a node with d equally-labeled outgoing edges could be expanded to a binary tree with d leaves (bringing down the degree of nondeterminism to 2). Unfortunately, while this solution works for transitivity (which is successfully propagated from the source), it could make the graph non-Wheeler: the topology of those trees cannot be arbitrary and must satisfy the co-lexicographic ordering of the nodes, i.e. the solution we are trying to compute. D.1 Sorting WDFAs Online Algorithm 2 initializes all variables used by our procedure and implements Kahn's topological- sorting algorithm [20]. Every time a new node is appended to the topological ordering, we call Algorithm 3 -- our actual online algorithm -- to update also the co-lexicographic ordering. This step 17 also checks if the new node and its incoming edges falsify the Wheeler properties. We use the following structures (indices start from 1): -- LEX is a dynamic sequence of distinct nodes v1, . . . , vk ∈ V supporting the following operations: 1. LEX[i] returns vi. 2. LEX−1[v], with v ∈ LEX, returns the index i such that LEX[i] = v. 3. LEX.insert(v, i) inserts node v between LEX[i − 1] and LEX[i]. If i = 1, v is inserted at the beginning of the sequence. This operation increases the sequence's length by one. -- IN and OUT are dynamic sequences of strings, i.e. sequences α1, . . . , αk, where αi ∈ Σ∗ (note that αi could be the empty string ). To make our pseudocode more readable, we index IN and OUT by nodes of LEX (these three arrays will be synchronized). Let T = α1, α2, . . . , αk, with T ∈ {IN, OUT}. Both arrays support the following operation: 4. T.insert(α, v), where α ∈ Σ∗ and v ∈ LEX: insert α between αLEX−1[v]−1 and αLEX−1[v]. If LEX−1[v] = 1, then α is inserted at the beginning of T. This operation increases the sequence's length by one. Sequence OUT supports these additional operations: 5. OUT[v], with v ∈ LEX, returns αLEX−1[v]. 6. OUT.append(α, v), where α ∈ Σ∗ and v ∈ LEX: append the string α at the end of the string OUT[v], i.e. replace OUT[v] ← OUT[v] · α. Note that this operation does not increase OUT's length. 7. OUT.rank(c, u), with u ∈ LEX and c ∈ Σ: return the number of characters equal to c in all strings OUT[v], with v = LEX[1], LEX[2], . . . , LEX[LEX−1[u]]. 8. OUT.reserve(u, v, c), with u, v ∈ LEX and c ∈ Σ: from the moment this operation is called, the sequence αLEX−1[u], . . . , αLEX−1[v] is marked with label c. Note that inserting new elements inside αLEX−1[u], . . . , αLEX−1[v] will increase the length of the reserved sequence. 9. OUT.is reserved(v, c), with v ∈ LEX and c ∈ Σ: return TRUE iff αLEX−1(v) falls inside a In our algorithm, sequence IN will always be partitioned in at most t ≤ σ + 1 sub-sequences IN = αc1 i contains only character c and c1 ≺ c2 ≺ ··· ≺ ct. We define an additional operation on IN: 10. IN.start(c), with c ∈ Σ, returns the largest integer j ≥ 1 such that all characters in IN[v] sequence that has been marked (reserved) with character c. 1 , . . . , αc1 kc1 , αc2 1 , . . . , αc2 kc2 are strictly smaller than c, for all v = LEX[1], . . . , LEX[j − 1]. , . . . , αct 1 , . . . , αct kct , where each αc Figure 1 shows how our dynamic structures evolve while processing states in topological order. In Appendix D.2 we discuss data structures implementing the above operations in O(log k) time, k being the sequence's length. Intuitively, these three dynamic sequences have the following meaning: LEX will contain the co-lexicographically-ordered sequence of nodes. IN[v] and OUT[v], with v ∈ LEX, will contain the labels of the incoming and outgoing edges of v, respectively. To keep the three sequences synchronized, when inserting v in LEX we will also need to update the other two sequences so that IN[v] = ct, where t is the number of incoming edges, labeled c, of v, and OUT[v] = , since v does not have yet outgoing edges. OUT[v] will (possibly) be updated later, when new nodes adjacent to v will arrive in the topological order. Our representation is equivalent to that used 18 in [30] to represent the GCSA data structure. Intuitively, OUT is a generalized version of the well- known Burrows-Wheeler transform (except that we sort prefixes in co-lexicographic order instead of suffixes in lexicographic order). If the graph is a path (i.e. a string) then OUT is precisely the BWT of the reversed path. We proceed with a discussion of the pseudocode. In Lines 2-12 of Algorithm 2 we initialize all variables and data structures. Let u ∈ V . The variable u.in memorizes the number of incoming edges in u; we will use this counter to implement Kahn's topological sorting procedure. u.label is the label of all incoming edges of u, or # if u = s. IN, LEX, and OUT are initialized as empty dynamic sequences. Lines 13-22 implement Kahn's topological sorting algorithm [20]. Each time a new node u is appended to the order, we call our online procedure update(u), implemented in Algorithm 3. Algorithm 3 works as follows. Assume that we have already sorted v1, . . . , vk, that LEX contains the nodes' permutation reflecting their co-lexicographic order, and that IN[vi] and OUT[vi] contain the incoming and outgoing labels for each i = 1, . . . , k in the sub-graph induced by v1, . . . , vk. When a new node u arrives in topological order, all its t predecessors are in LEX. Let b = u.label be the incoming label of u. We find the co-lexicographically smallest vmin and largest vmax predecessors of u (using function LEX−1 on all u's predecessors). In our pseudocode, if u = s then vmin = vmax = NULL. To keep the Wheeler properties true, note that there cannot be b's in the range OUT[vmin..vmax]: if there are, since we will append b to OUT[vmin] and OUT[vmax], there will be three nodes vmin < v(cid:48) < vmax such that (vmin, u, b), (v(cid:48), u(cid:48), b), (vmax, u, b) ∈ E for some u(cid:48). Then, by Wheeler property (ii), this would imply that u < u(cid:48) < u, a contradiction. We therefore check this event using function contains (note: this function can be easily implemented using two calls to rank). If b's are present, then the graph is no longer Wheeler: such an event is shown in Figure 1, left-hand side (where u = v5). Otherwise, the number j of b's before vmin (which is equal to the number of b's before vmax) tells us the co-lexicographic rank i of u (similarly to the standard string-BWT, we obtain this number by adding j to the starting position of b's in IN), and we can mark (reserve) range OUT[vmin..vmax] with letter b using function reserve. Such an event is shown in Figure 1, left-hand side, when inserting, e.g., node v3. At this point, we may have an additional inconsistency falsifying the Wheeler properties in the case that one of the predecessors vi of u falls inside a reserved range for b (reserved by a node other than u): this happens, for example, when inserting v6 in Figure 1, right-hand side. This check requires calling function is reserved. If all tests succeed, we insert u in position i of LEX and we update IN and OUT by inserting bt at the i-th position in IN (i.e. the position corresponding to u) and by appending b at the end of each OUT[vi] for each predecessor vi of u. D.2 Data Structure Details In this section we show how to implement operations 1-10 used by Algorithms 2 and 3 using state- of-the-art data structures. At the core of LEX and OUT stands the dynamic sequence representation of Navarro and Nekrich [26]. This structure supports insertions, access, rank, and select in O(log n) worst-case time, n being the sequence's length. The space usage is bounded by nH0 + o(n log σ) + O(σ log n) bits, where H0 is the zero-th order entropy of the sequence. Sequence IN will instead be represented using a dynamic partial sum data structure, e.g. a balanced binary tree or a Fenwick tree [8], and a dynamic bitvector. All details follow. Sequence LEX is stored with Navarro and Nekrich's dynamic sequence representation [26]. Op- erations 1-3 are directly supported on the representation. Operation 2 is simply a selectv(1) (i.e. the position of the first v). 19 Algorithm 2: sort(G) input : Labeled DAG G = (V, E, s, Σ) output: A permutation of V reflecting the co-lexicographic ordering of the nodes, or FAIL if such an ordering does not exist. 1 for u ∈ V do u.in ← 0; u.label ← NULL; 3 2 4 s.label ← #; 5 for (u, v, a) ∈ E do v.in ← v.in + 1; if v.label (cid:54)= NULL and v.label (cid:54)= a then 6 7 8 9 return FAIL; v.label ← a; 10 IN ← new dyn sequence(Σ ∗); 11 LEX ← new dyn sequence(V); 12 OUT ← new dyn sequence(Σ ∗); 13 S ← {s}; 14 while S (cid:54)= ∅ do u ← S.pop(); update(u); for (u, v, a) ∈ E do v.in ← v.in − 1; if v.in = 0 then S ← S ∪ {v}; 20 19 18 17 15 16 /* Cannot be Wheeler graph */ /* Sequence of strings */ /* Sequence of nodes */ /* Sequence of strings */ /* Set of nodes with no incoming edges */ /* Extract any u ∈ S */ /* Call to Algorithm 3. If this fails, return FAIL. */ 21 if ∃ v ∈ V : v.in > 0 then 22 return FAIL; 23 return LEX; /* cycle found! */ Sequence OUT is stored using a dynamic sequence out and a bitvector, both represented with Navarro and Nekrich's dynamic sequence. The idea is to store all the strings OUT[1], . . . , OUT[OUT] concatenated in a single sequence out, and mark the beginning of those strings with a bit set in a dynamic bitvector Bout[1..n], were n = out. Clearly, operations 4-7 on OUT can be simulated with a constant number of operations (insert, access, rank, select) on out and Bout. Operations 8-9 require an additional dynamic sequence of parentheses PAR[1..n] on alphabet : c ∈ Σ} ∪ {)c : c ∈ Σ} ∪ {(cid:3)}. Every time a new character is inserted at position i in out, {(c we also insert (cid:3) at position i in PAR. When OUT.reserve(u, v, c) is called (i.e. operation 8), let iv and iu be the positions in out corresponding to the two occurrences of character c in OUT[u] and OUT[u], respectively (remember that the automaton is deterministic, so these positions are unique). These positions can easily be computed in O(log n) time using select and rank operations on out and Bout. Then, we replace PAR[iu] and PAR[iv] with characters (c and )c, respectively (replacing a character requires a deletion followed by an insertion). Note that reserved intervals for a fixed 20 Algorithm 3: update(u) input behavior: Inserts u at the right place in the co-lexicographic ordering LEX of the nodes already processed, or : Node u returns FAIL if a conflict is detected. 1 vmin ← min pred(u); 2 vmax ← max pred(u); 3 if u (cid:54)= s then /* co-lexicographically-smallest predecessor */ /* co-lexicographically-largest predecessor */ if OUT[vmin, . . . , vmax].contains(u.label) then return FAIL; else for (v, u, a) ∈ E do if OUT.is reserved(v, u.label) then return FAIL; else OUT[v].append(u.label); /* Inconsistency of type 1 */ /* Inconsistency of type 2 */ OUT.reserve(vmin, vmax, u.label); /* Reserve [vmin, vmax] with u.label */ 4 5 6 7 8 9 10 11 12 13 14 15 i ← IN.start(u.label) + OUT.rank(u.label, vmin); LEX.insert(u, i); p ← pred(u); 16 else 17 18 LEX.insert(u, 1); p ← 1; 19 IN.insert(u.labelp, u); 20 OUT.insert(, u); /* Number of predecessors of u */ /* Number of predecessors of u */ /* Insert p times u.label */ /* u does not have successors yet */ character do not overlap, so this parentheses representation permits to unambiguously reconstruct the structure of the intervals. At this point, operation 9 is implemented as follows. Let iv be the position in out corresponding to the first character in OUT[v]. This position can be computed in O(log n) time with two select operations on LEX and Bout. Then, OUT.is reserved(v, c) returns true if and only if PAR.rank(c(iv) > PAR.rank)c(iv), i.e. if we did not close all opening parentheses (c before position iv (note that does not make any difference if iv is the first or last position in OUT[v], since when we call this operation OUT[v] does not contain characters equal to c). To conclude, IN is represented with a dynamic bitvector BIN[1..n] and a partial sum PS[1..σ + 1] supporting the following operations in O(log σ) time: -- partial sum: PS.ps(i) =(cid:80)i -- update: PS[i] ← PS[i] + δ. j=1 PS[j]. Fenwick trees [8] support the above operations within this time bound. Bitvector BIN[1..n] con- tains the bit sequence 110tv2−110tv3−1 . . . 10tvk−1, where tvi is the number of predecessors of vi in the current sequence LEX = v1, . . . , vk of sorted nodes (note that v1 is always the source s). Assume, for simplicity, that Σ = [1, σ + 1], where # corresponds to 1 (this is not restrictive, as we can map the alphabet to this range at the beginning of the computation). At the beginning, the partial 21 Fig. 1. Left: Inconsistency of type 1. The five tables show how arrays IN, LEX, and OUT evolve during insertions of nodes v1, . . . , v5 in topological order. Up to node v4, the Directed Acyclic Graph (DAG) is Wheeler. When inserting node v3, we successfully reserve the interval [v1, v2] with label 'a' (shown in red). From this point, no 'a's can be inserted inside the reserved interval. When inserting node v5 (with incoming label 'b'), the co-lexicographically smallest and largest predecessors of v5 are v3 and v4, respectively. This means we have to reserve the interval [v3, v4] with label 'b' (shown in blue dashed line); however, this is not possible since there already is a 'b' (highlighted in blue) in OUT[v3, . . . , v4]. Right: Inconsistency of type 2. Up to node v5, the DAG is Wheeler. Note that we successfully reserve two intervals: [v1, v2] (with letter 'a', red interval), and [v3, v4] (with letter 'b', blue interval). When inserting node v4 we do not need to reserve any interval since the node has only one predecessor. The confict arises when inserting node v6 (with incoming label 'b'). Since v5 is a predecessor of v6, we need to append 'b' in OUT[v5]. However, this 'b' (underlined in the picture) falls inside a reserved interval for 'b' (in blue). sum is initialized as IN[c] = 0 for all c. Operation 10, IN.start(c), with c (cid:54)= #, is implemented as PS.ps(c − 1) + 1. If c = #, the operation returns 1. Operation 4, IN.insert(cp, u), is imple- mented as PS[c] ← PS[c] + p followed by BIN.insert(10p−1, iu) (i.e. p calls to insert on the dynamic bitvector at position iu), where iu is the position of the j-th bit set in BIN (a select operation) and j = LEX−1[u], or iu = n + 1 if BIN has j − 1 bits set (note that, when we call IN.insert(cp, u), node u has already been inserted in LEX). D.3 Proof of Theorem 3 In Appendix D.2 we show that all operations on the dynamic sequences can be implemented in logarithmic time. Correctness follows from the fact that we always check that the Wheeler properties are maintained true. To prove completeness, note that at each step we place u between two nodes v1 and v2 in array LEX only if the smallest u's predecessor is larger than the largest v1's predecessor, and if the largest u's predecessor is smaller than the smallest v2's predecessor. This is the only possible choice we can make in order to satisfy wv1 ≺ wu ≺ wv2 for all strings labeling paths s (cid:32) v1, s (cid:32) u, and s (cid:32) v2 and to obtain, by Corollary 1, the only possible correct ordering of the nodes. It follows that, if the new node v does not falsify the Wheeler properties, then we are computing its co-lexicographic rank correctly. Proof. (of Lemma 8) First, we sort edges by label, with ties broken by origin, and further ties broken by destination. This can be achieved in time O(E +V ) by radix sorting the edges represented as triples (a, u, v), 22 v1v3v5v4v2bbcaab#v1#v1#bv2bv1#bav3aav2bav1#bav3aav2bacv4cv1#bav3aabv2bacv5bbv4cbv6bv1#bav3aabv2bacv5bbbv4cbPREDINLEXOUTPREDINLEXOUTPREDINLEXOUTPREDINLEXOUTPREDINLEXOUTPREDINLEXOUTv1v3v5v4v2bbbaab#v1#v1#bv2bv1#bav3aav2bav1#bav3aav2babv4bv1#bav3aav2babv4bPREDINLEXOUTPREDINLEXOUTPREDINLEXOUTPREDINLEXOUTPREDINLEXOUT where a is the label, and u and v respectively are the ranks of the source and destination nodes in the given order <. Let L denote the sorted list of edges. We claim that the given order < satisfies the Wheeler properties (Definition 2) if and only if for all pairs of consecutive edges (ai, ui, vi), (ai+1, ui+1, vi+1) in L, we have (ai = ai+1) → vi ≤ vi+1 and (ai (cid:54)= ai+1) → vi < vi+1. Clearly this can be checked in time O(E) with one scan over L. We now argue the correctness of this algorithm. Wheeler property (ii) is equivalent to the condition that when all edges labeled by some char- acter a ∈ Σ are sorted by source with ties broken by destination, the sequence of destinations is monotonically increasing, which is expressed by the condition (ai = ai+1) → vi ≤ vi+1. Wheeler property (i) is equivalent to the condition that for all pairs of characters a, b ∈ Σ such that b is a successor of a in the order of Σ, denoting by va the largest node with an incoming a-edge, and by vb the smallest node with an incoming b-edge, we have va < vb. If Wheeler property (ii) holds, then destinations va and vb are consecutive in L because the list is sorted primarily by label and destinations are monotonically increasing for each label. Hence checking for (ai (cid:54)= ai+1) → vi < vi+1 (cid:117)(cid:116) verifies Wheeler property (i) given that Wheeler property (ii) holds. Proof. (of Theorem 4) In O(V + E) time we build a directed spanning tree T of A with root s (e.g. its directed shortest-path tree with root s). Note that this is always possible since we assume that all states are reachable from s. By Corollary 1, if A is a Wheeler graph then we can use the strings that label any two paths s (cid:32) u and s (cid:32) v to decide the order of any two nodes u and v. We can therefore sort V according to the paths spelled by T ; by Corollary 1, if A is Wheeler then we obtain the correct (unique) ordering. To prefix-sort T , we compute its XBW transform 5 in O(V ) time [9, Thm 2]. The array containing the lexicographically-sorted nodes (i.e. the prefix array of T ) can easily be obtained from the XBW transform using, e.g. the partial rank counters defined in the proof of Lemma 8 to navigate the tree (this is analogous to repeatedly applying function LF on the BWT in order to obtain the suffix array). At this point, we check that the resulting node order satisfies the Wheeler properties using Lemma 8. If this is this case, then the above-computed prefix array contains the prefix-sorted nodes of A. (cid:117)(cid:116) E Proofs of Section 4 Proof. (of Theorem 5) Let A = (V, E, F, s, Σ). Consider the (possibly infinite) deterministic automaton T that is a tree and that is equivalent to A in the following sense: T is the (unique) tree obtained by "unraveling" A, i.e. the tree containing all words in L(A) such that each path labeled with such a word leads to an accepting state. Clearly, T is a (possibly infinite) deterministic automaton recognizing L(A): a string α leads to a final state in A if and only if it does in T . Let Lu = {u1, u2, . . . , uku} be the (possibly infinite) set of nodes of T reached by following, from its root, all the paths labeled α for each α labeling a path s (cid:32) u connecting s with u in A. Note that each state u of A can be identified by the set Lu of states of T ; this allows us to extend 5 note: this requires mapping the labels of T to alphabet Σ(cid:48) ⊆ [1,V ] while preserving their lexicographic ordering. Since we assume that the original alphabet's size does not exceed EO(1) = V O(1), this step can be performed in linear time by radix-sorting the labels. 23 ≡w to the states of T as follows: ui ≡w uj for all ui, uj ∈ Lu, u ∈ V , and ui ≡w vj for ui ∈ Lu, vj ∈ Lv if and only if u ≡w v. Consider now the process of minimizing T by collapsing states in equivalence classes in such a way that (i) the quotient automaton is finite, (ii) the accepting language of the quotient DFA is the same as that of T and (iii) the quotient DFA is Wheeler. By the existence of A, there exists such a partition (not necessarily the coarsest): the one putting ui and uj in the same equivalence class if and only if ui, uj ∈ Lu, for some u ∈ V (in this case, A itself is the resulting quotient automaton). Call ≡ the relation among states of T yielding the smallest such WDFA A/≡. By definition, A/≡ is the smallest WDFA recognizing L(A). Our claim is that ≡ = ≡w, i.e. that Algorithm 1 returns this automaton. We observe that: 1. ui ≈ uj for any ui, uj ∈ Lu and all u ∈ V . Otherwise, assume for a contradiction that there exists a string α leading to an accepting state from ui but not from uj. By construction of T , ui and uj are ≈-equivalent to u: this leads to a contradiction, since the state reached from u with label α cannot be both accepting and not accepting. 2. Since A is a Wheeler DFA, Corollary 1 applied to A tells us that, for any two nodes u < v ∈ V , all strings labeling paths from the root of T to nodes in Lu are co-lexicographically smaller than those labeling paths from the root of T to nodes in Lv. We express this fact using the notation Lu < Lv. 3. Since A is Wheeler, then each u ∈ V has only one distinct incoming label and λ(uj) = λ(u) for all uj ∈ Lu. By the above properties, ui ≡ uj for all ui, uj ∈ Lu, u ∈ V . To see this, note that, by property 1, those states are all equivalent by relation ≈. Moreover, properties 2-3 combined with Corollary 1 imply that, by grouping states in each Lu, we cannot break any Wheeler property. It follows that ≡ must group those states, being the coarsest partition finer than ≈ with these two properties. Let us indicate with Lu ≡ Lv the fact that ui ≡ vj for all ui ∈ Lu, vj ∈ Lv. Suppose now, for a contradiction, that there exist Lu < Lv < Lw with Lu ≡ Lw (cid:54)≡ Lv. Then, by Corollary 1, Lu < Lv implies that, in the quotient automaton, states [Lw]≡ = [Lu]≡ and [Lv]≡ are reachable from the source by two paths α and β, respectively, with α ≺ β. Conversely, Lv < Lw implies that states [Lv]≡ and [Lw]≡ are reachable from the source by two paths α(cid:48) and β(cid:48), respectively, with α(cid:48) ≺ β(cid:48). Then, by Corollary 1 we cannot define a total order on A/≡'s states, i.e. A/≡ is not Wheeler. By all the above observations, we conclude that ≡ must (i) group only equivalent states by ≈, (ii) group only states with the same incoming label, (iii) group all states inside each Lu, and (iv) group only states in adjacent sets Lu, Lv in the co-lexicographic order. By its definition, the relation ≡w induces the coarsest partition that satisfies (i)-(iv), therefore we conclude that ≡ = ≡w. (cid:117)(cid:116) E.1 Converting DFAs to minimum WDFAs We describe an online step of our algorithm. Assume we successfully built Ai, with i < t, and we are about to process vi+1 in order to build Ai+1. Let {c1, . . . , ck} be the labels of incoming vi+1's edges. We first replace (split) vi+1 by k equivalent states vc1 i+1 (i) is accepting if and only if vi+1 is accepting, (ii) keeps only the incoming edges of vi+1 labeled ci, and (iii) it duplicates all its outgoing edges: we replace each (vi+1, u, c) with the edges (vc1 i+1, u, c). Note that i+1 ≈ ··· ≈ vck i+1: each vck i+1, u, c), . . . , (vck 24 all the newly-created edges must be present in the final automaton At since the states vc1 i+1, . . . , vck cannot be collapsed back by ≡w (as they have different incoming labels); it follows that in this step we are not creating more edges than necessary. i+1 i+1, . . . , vck We now insert separately vc1 i+1 in LEXi in any order as follows. The procedure is the same for all those vertices, therefore we may simply assume we are about to process a node v with all incoming edges labeled with the same character a. Let u1 < ··· < uk be the predecessors of v in the graph; note that those nodes must belong to LEXi (since we are processing states in topological order), therefore their order < is well-defined. We now must detect and solve inconsistencies of type 1 and 2 as defined in the proof of Theorem 3 (see also Figure 1). We start with inconsistencies of type 1: there already are nodes wi /∈ {u1, . . . , uk} with outgoing edges labeled a inside the range [u1, uk]. This breaks the sequence u1 < ··· < uk into q sub- intervals [uij , u(cid:48) ], j = 1, . . . , q, that do not contain nodes with outgoing label a different than those in {u1, . . . , uk}. The range has therefore the following form, where we denote with wi and w(cid:48) i all nodes not in {u1, . . . , uk} with outgoing edges labeled a and we highlight in bold the runs [uij , u(cid:48) ]: ij ij w1 < ui1 ≤ ··· ≤ u(cid:48) i1 < w2 ≤ ··· ≤ w(cid:48) 2 < ui2 ≤ ··· ≤ u(cid:48) i2 < ··· < uiq ≤ ··· ≤ u(cid:48) iq < wq+1 , ij iq where ui1 = u1, u(cid:48) = uk, and w1 < u1, wq+1 > uk are the rightmost and leftmost states with an outgoing edge labeled a, respectively (if they exist). The top part of Figure 2 depicts this situation, where k = 4 and u1, . . . , u4 are clustered in q = 3 runs: w1 < u1 < w2 < w3 < u2 < u3 < w4 < u4 < w5. We solve the inconsistencies of type 1 by splitting v in (i.e. replacing it with) q equivalent nodes: v1 ≈ ··· ≈ vq. Each vj is final if and only if v is final, duplicates all v's outgoing edges (as seen above), and keeps only incoming edges from v's predecessors inside the corresponding run [uij , u(cid:48) ]. This is depicted in the bottom part of Figure 2: v has been split into the three equivalent nodes v1 ≈ v2 ≈ v3. Inconsistencies of type 2 are solved similarly by splitting a-successors of w1, . . . , wq+1 that belong to LEXi when necessary. Let LEXi ∩ {succa(w1), . . . , succa(wq+1)} = {z1 < ··· < zq(cid:48)} be the a-successors of w1, . . . , wq+1 in LEXi. Note that it might be the case that q(cid:48) < q + 1. Note also that some of the nodes zi might belong to {u1, . . . , uk} ∪ {w1, . . . , wq+1}. We have an inconsistency of type 2 (among nodes in LEXi) whenever succa(wi) = succa(wi+1) = ze, for some 1 ≤ e ≤ q(cid:48), and there exist some uj such that wi < uj < wi+1. In this case, we split ze = succa(wi) = succa(wi+1) in two equivalent nodes z(cid:48) e . This cannot contradict the Wheeler properties (even if zi ∈ {u1, . . . , uk}∪{w1, . . . , wq+1}), since succa(uj) is one of the copies of v (or v itself if v has not been splitted in the previous step) and has therefore no successors in the current automaton. The process of fixing inconsistencies of type 2 is shown in Figure 2: nodes w3 and w4 are separated by u2, u3 as w3 < u2 < u3 < w4. In this case, succa(w3) = succa(w4) = z3, and we split z3 in the two equivalent nodes z(cid:48) 3 . Note also that we only need to check those wi that immediately precede or follow a predecessor of v (i.e. w1, w2, w(cid:48) 2, . . . , wq+1): those nodes are at most O(k), where k is the number of v's predecessors. e < succa(uj) < z(cid:48)(cid:48) e ordered as z(cid:48) 3 and z(cid:48)(cid:48) e ≈ z(cid:48)(cid:48) As shown in Figure 2 (bottom), after solving the inconsistencies of type 1 and 2 the nodes in LEXi+1 are again range-consistent: the a-successors of any (sorted) range of nodes form themselves a (sorted) range. Moreover, the splitting process defines unambiguously a total ordering of the new nodes among those already in LEXi, which can be therefore updated to LEXi+1 by inserting those nodes at the right place: to insert a node v(cid:48) in LEXi, let u(cid:48) be its a-predecessor: succa(u(cid:48)) = v(cid:48). Let moreover u(cid:48)(cid:48) < u(cid:48) be the rightmost node preceding u(cid:48) (in LEXi) having an outgoing edge labeled a, and let v(cid:48)(cid:48) be its a-successor: succa(u(cid:48)(cid:48)) = v(cid:48)(cid:48). By range-consistency, node v(cid:48) has to be inserted 25 immediately after v(cid:48)(cid:48) in LEXi. If such a node u(cid:48)(cid:48) does not exist (i.e. u(cid:48) is the leftmost node in LEXi having an outgoing edge labeled a), then v(cid:48) has to be inserted in LEXi so that it becomes the first node with incoming edges labeled a (i.e. in the position immediately following the rightmost node v(cid:48)(cid:48) with incoming label a(cid:48), where a(cid:48) is the lexicographically-largest character such that a(cid:48) ≺ a, or at the first position in LEXi if such a character a(cid:48) does not exist). This shows that invariant 2 is maintained: the Wheeler properties are kept true among nodes in LEXi+1. It is also clear that we do not insert ≈-equivalent adjacent states with the same incoming label (see Figure 2: by construction, the newly-inserted nodes v1, z(cid:48) 3 , v3 are non-equivalent to their neighbors), i.e. invariant 3 is maintained. Finally, the accepted language does not change since the splitting process generates ≈-equivalent nodes: also invariant 1 stays true. Note that the minimization process on the original acyclic DFA A takes linear time. After that, we only insert edges/nodes in the minimum output WDFA: never delete. It follows that the number of performed operations is equal to the output's size. The final automaton could be either smaller or exponentially-larger than A. We note that all the discussed operations can be easily implemented in logarithmic time using the data structures discussed in Section D.2: finding the q runs of states [uij , u(cid:48) ], as well as finding the O(k) states wi, requires executing a constant number of rank operations on sequence OUT and start operations on IN for each predecessor of v. Nodes can be inserted at the right position in sequence LEX exactly as done in Algorithm 3 (by also updating IN and OUT). Finally, the graph can be dynamically updated (i.e. splitting nodes) and queried (i.e. navigation) by keeping it as a dynamic adjacency list: since we can spend logarithmic time per edge, we can store the graph as a self-balancing tree associating nodes to their predecessors and successors (also kept as self-balancing trees). This structure supports all updates and queries on the graph in logarithmic time. It follows that the overall procedure terminates in O(n + m log m) time, n and m being the input and output's sizes, respectively. 3, v2, z(cid:48)(cid:48) ij Fig. 2. Inconsistency resolution. Nodes are ordered left-to-right by the total ordering < (except v in the top part of the figure). Top: we are trying to insert v in LEXi, but this violates the Wheeler properties (edges' destinations are not ordered as the sources, no matter where we insert v). Bottom: we solve the inconsistencies by splitting v in three equivalent nodes v1 ≈ v2 ≈ v3 and z3 in two equivalent nodes z(cid:48) 3 . Note that (i) the splitting procedure induces naturally an ordering of the nodes that satisfies the Wheeler properties, and (ii) after splitting, no two adjacent states with the same incoming label are equivalent by ≈. By Theorem 6, this is the minimum way of splitting nodes. For simplicity, in the figure nodes z1, . . . , z4 do not coincide with any node w1, . . . , w5 or u1, . . . , u4. This may not necessarily be the case. In our full proof in Appendix E.1 we show that our procedure is correct even when this happens. 3 ≈ z(cid:48)(cid:48) 26 w1z1u1w2w3z2z3z4u2u3w4u4w5vw1z1u1w2w3z2z'3z4u2u3w4u4w5v1z''3v2v3LEXiLEXi+1aaaaaaaaaaaaaaaaaa F Worst case blowup from an acyclic DFA to the minimum equivalent WDFA In this section we show that the running time of the conflict resolution algorithm in Section 4.1 is exponential in the worst case, i.e. there exists a family of regular languages where the size of the smallest WDFA is exponential in the size of the smallest DFA. We now show that one such family the sequence of languages L1, L2, . . ., where Lm = {cαe α ∈ {a, b}m} ∪ {dαf α ∈ {a, b}m}. For an example, Figure 3 shows a DFA and the smallest WDFA for the language L3. In general, we can build a DFA for Lm by generalizing the construction in the figure: the source node has outgoing edges labeled with c and d, followed by simple linear size "universal gadgets" capable of generating all binary strings of length m, with one gadget followed by an e and the other by an f . The two sink states are the only accepting states. The smallest WDFA for Lm is an unraveling of the described DFA, such that all paths up to (but not including) the sinks end up in distinct nodes, i.e. the universal gadgets are replaced by full binary trees (see Figure 3). It is easy to see that the automaton is Wheeler as the only nodes that have multiple incoming paths are the sinks, and the sinks have unique labels. To prove that this is the minimal WDFA, we need to check the condition of Theorem 6, i.e. that all colexicographically consecutive pairs of nodes with the same incoming label are Myhill- Nerode inequivalent. As labels c, d, e and f occur only once, it is enough to focus on nodes that have label a or b. Let B1, B2, B2m+1−1 be the colexicographically sorted sequence of all possible binary strings with lengths 1 ≤ Bi ≤ m from the alphabet {a, b}. Observe that the nodes with incoming label a and b correspond to path labels of the form cBi and dBi for all 1 ≤ i ≤ 2m+1 − 1. The colexicographically sorted order of these path labels is: cB1 < dB1 < cB2 < dB2 < . . . < cB2m+1−1 < dB2m+1−1 Here we can see that all consecutive pairs have a different first character, and therefore they lead to a different sink in the construction, and hence they are not Myhill-Nerode equivalent. Therefore the automaton is the minimum WDFA. The DFA has n = 4m + 5 states and the WDFA has 1 + 2m+2 = 1 + 2(n−5)/4+2 states, so we obtain the following result: Theorem 8. The minimal WDFA equivalent to an acyclic DFA with n states has Ω(2n/4) states in the worst case. References 1. Amihood Amir, Moshe Lewenstein, and Noa Lewenstein. Pattern matching in hypertext. Journal of Algorithms, 35(1):82 -- 99, 2000. 2. Arturs Backurs and Piotr Indyk. Which regular expression patterns are hard to match? In 2016 IEEE 57th Annual Symposium on Foundations of Computer Science (FOCS), pages 457 -- 466. IEEE, 2016. 3. 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. 4. Francisco Claude, Gonzalo Navarro, and Alberto Ord´onez. The wavelet matrix: An efficient wavelet tree for large alphabets. Information Systems, 47:15 -- 32, 2015. 5. Nicolaas Govert De Bruijn. A combinatorial problem. Koninklijke Nederlandse Akademie v. Wetenschappen, 49(49):758 -- 764, 1946. 6. Massimo Equi, Roberto Grossi, and Veli Makinen. On the Complexity of Exact Pattern Matching in Graphs: Binary Strings and Bounded Degree. arXiv preprint arXiv:1901.05264, 2019. 27 c d b b b a a a b b b a a a e f c d b a a b b a b a a b a b b a b a b a b a a b a b a b a b e f Fig. 3. Left: a DFA recognizing L3. Right: the minimal WDFA recognizing L3. For clarity the labels are drawn on the nodes: the label of an edge is the label of the destination node. 7. Massimo Equi, Roberto Grossi, Veli Makinen, and Alexandru I. Tomescu. On the Complexity of String Matching for Graphs. In 46th International Colloquium on Automata, Languages and Programming, 2019. 8. Peter M Fenwick. A new data structure for cumulative frequency tables. Software: Practice and Experience, 24(3):327 -- 336, 1994. 9. Paolo Ferragina, Fabrizio Luccio, Giovanni Manzini, and S Muthukrishnan. Compressing and indexing labeled trees, with applications. Journal of the ACM (JACM), 57(1):4, 2009. 10. Paolo Ferragina and Giovanni Manzini. Indexing compressed text. Journal of the ACM (JACM), 52(4):552 -- 581, 2005. 11. Travis Gagie, Giovanni Manzini, and Jouni Sir´en. Wheeler graphs: A framework for BWT-based data structures. Theoretical computer science, 698:67 -- 78, 2017. 12. Travis Gagie, Gonzalo Navarro, and Nicola Prezza. Optimal-time text indexing in BWT-runs bounded space. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1459 -- 1477. Society for Industrial and Applied Mathematics, 2018. 13. Daniel Gibney and Sharma V. Thankachan. On the Hardness and Inapproximability of Recognizing Wheeler Graphs. arXiv preprint arXiv:1902.01960, 2019. 14. Gregor Gramlich and Georg Schnitger. Minimizing NFA's and Regular Expressions. In Volker Diekert and Bruno Durand, editors, STACS 2005, pages 399 -- 411, Berlin, Heidelberg, 2005. Springer Berlin Heidelberg. 15. Roberto Grossi, Ankur Gupta, and Jeffrey Scott Vitter. High-order entropy-compressed text indexes. In Pro- ceedings of the fourteenth annual ACM-SIAM symposium on Discrete algorithms, pages 841 -- 850. Society for Industrial and Applied Mathematics, 2003. 16. Hermann Gruber and Markus Holzer. Computational Complexity of NFA Minimization for Finite and Unary Languages. LATA, 8:261 -- 272, 2007. 17. John Hopcroft. An n log n algorithm for minimizing states in a finite automaton. In Theory of machines and computations, pages 189 -- 196. Elsevier, 1971. 18. Guy Joseph Jacobson. Succinct static data structures. PhD thesis, Carnegie Mellon University, 1988. 19. Chirag Jain, Haowen Zhang, Yu Gao, and Srinivas Aluru. On the Complexity of Sequence to Graph Alignment. BioRxiv, page 522912, 2019. 20. Arthur B Kahn. Topological sorting of large networks. Communications of the ACM, 5(11):558 -- 562, 1962. 21. S. Kreft and G. Navarro. On compressing and indexing repetitive sequences. Theoretical Computer Science, 483:115 -- 133, 2013. 22. Andreas Malcher. Minimizing Finite Automata is Computationally Hard. Theor. Comput. Sci., 327(3):375 -- 390, November 2004. 23. Udi Manber and Gene Myers. Suffix arrays: a new method for on-line string searches. siam Journal on Computing, 22(5):935 -- 948, 1993. 28 24. Udi Manber and Sun Wu. Approximate string matching with arbitrary costs for text and hypertext. In Advances In Structural And Syntactic Pattern Recognition, pages 22 -- 33. World Scientific, 1992. 25. Sabrina Mantaci, Antonio Restivo, Giovanna Rosone, and Marinella Sciortino. An extension of the Burrows -- Wheeler transform. Theoretical Computer Science, 387(3):298 -- 312, 2007. 26. Gonzalo Navarro and Yakov Nekrich. Optimal dynamic sequence representations. SIAM Journal on Computing, 43(5):1781 -- 1806, 2014. 27. Anil Nerode. Linear automaton transformations. Proceedings of the American Mathematical Society, 9(4):541 -- 544, 1958. 28. Mikko Rautiainen and Tobias Marschall. Aligning sequences to general graphs in O (V+ mE) time. bioRxiv, page 216127, 2017. 29. Dominique Revuz. Minimisation of acyclic deterministic automata in linear time. Theoretical Computer Science, 92(1):181 -- 189, 1992. 30. Jouni Sir´en, Niko Valimaki, and Veli Makinen. Indexing graphs for path queries with applications in genome research. IEEE/ACM Transactions on Computational Biology and Bioinformatics (TCBB), 11(2):375 -- 388, 2014. 31. Kavya Vaddadi, Naveen Sivadasan, Kshitij Tayal, and Rajgopal Srinivasan. Sequence Alignment On Directed Graphs. bioRxiv, page 124941, 2017. 32. Peter Weiner. Linear pattern matching algorithms. In Switching and Automata Theory, 1973. SWAT'08. IEEE Conference Record of 14th Annual Symposium on, pages 1 -- 11. IEEE, 1973. 29
1702.06099
1
1702
2017-02-20T18:36:25
Preemptive Online Partitioning of Sequences
[ "cs.DS" ]
Online algorithms process their inputs piece by piece, taking irrevocable decisions for each data item. This model is too restrictive for most partitioning problems, since data that is yet to arrive may render it impossible to extend partial partitionings to the entire data set reasonably well. In this work, we show that preemption might be a potential remedy. We consider the problem of partitioning online sequences, where $p-1$ separators need to be inserted into a sequence of integers that arrives online so as to create $p$ contiguous partitions of similar weight. While without preemption no algorithm with non-trivial competitive ratio is possible, if preemption is allowed, i.e., inserted partition separators may be removed but not reinserted again, then we show that constant competitive algorithms can be obtained. Our contributions include: We first give a simple deterministic $2$-competitive preemptive algorithm for arbitrary $p$ and arbitrary sequences. Our main contribution is the design of a highly non-trivial partitioning scheme, which, under some natural conditions and $p$ being a power of two, allows us to improve the competitiveness to $1.68$. We also show that the competitiveness of deterministic (randomized) algorithms is at least $\frac{4}{3}$ (resp. $\frac{6}{5}$). For $p=2$, the problem corresponds to the interesting special case of preemptively guessing the center of a weighted request sequence. While deterministic algorithms fail here, we provide a randomized $1.345$-competitive algorithm for all-ones sequences and prove that this is optimal. For weighted sequences, we give a $1.628$-competitive algorithm and a lower bound of $1.5$.
cs.DS
cs
Preemptive Online Partitioning of Sequences ∗ Christian Konrad1 and Tigran Tonoyan1 1Department of Computer Science and DIMAP, University of Warwick, UK, 2ICE-TCS, School of Computer Science, Reykjavik University, Iceland, [email protected] [email protected] July 12, 2021 Abstract Online algorithms process their inputs piece by piece, taking irrevocable decisions for each data item. This model is too restrictive for most partitioning problems, since data that is yet to arrive may render it impossible to extend partial partitionings to the entire data set reasonably well. In this work, we show that preemption might be a potential remedy. We consider the problem of partitioning online sequences, where p − 1 separators need to be inserted into a sequence of integers that arrives online so as to create p contiguous partitions of similar weight. While without preemption no algorithm with non-trivial competitive ratio is possible, if preemption is allowed, i.e., inserted partition separators may be removed but not reinserted again, then we show that constant competitive algorithms can be obtained. Our contributions include: We first give a simple deterministic 2-competitive preemptive algorithm for arbitrary p and arbitrary sequences. Our main contribution is the design of a highly non-trivial partitioning scheme, which, under some natural conditions and p being a power of two, allows us to improve the competitiveness to 1.68. We also show that the competitiveness of deterministic (randomized) algorithms is at least 4 3 (resp. 6 5 ). For p = 2, the problem corresponds to the interesting special case of preemptively guessing the center of a weighted request sequence. While deterministic algorithms fail here, we provide a randomized 1.345-competitive algorithm for all-ones sequences and prove that this is optimal. For weighted sequences, we give a 1.628-competitive algorithm and a lower bound of 1.5. 1 Introduction Online algorithms receive their inputs sequentially piece by piece. For each incoming piece of data (=request), the algorithm takes an immediate and irrevocable decision on how to process it. Taking good decisions can be challenging or even impossible, since decisions are based only on the requests seen and choices taken so far, and, in particular, they cannot be based on future requests. For many problems, taking a few bad decisions is forgivable and good competitive algorithms can nevertheless be designed (e.g. maximum matching [13], bin packing [24], k-server [17]), while for other problems, even a single bad decision may make it impossible to obtain non-trivial solutions (e.g. the maximum independent set problem [9]). Generally, a necessary condition for a problem to admit good online algorithms is that solutions can be incrementally built by extending partial solutions. In this paper, we are interested in whether data partitioning problems can be solved online. In an online data partitioning problem, the input data X arrives online and is to be partitioned into p parts by computing a partitioning function φ : X → {1, 2, . . . , p} such that an application-specific cost function is optimized. Unfortunately, most partitioning problems are inherently non-incremental and thus poorly suited to the online model, which may explain why the literature on online data partitioning is exceptionally scarce (see related works section). This raises the following research questions: ∗C. Konrad is supported by the Centre for Discrete Mathematics and its Applications (DIMAP) at Warwick University and by EPSRC award EP/N011163/1. 1 1. Is online data partitioning with provable guarantees really hopeless to achieve? 2. If so, how can we minimally augment the power of online algorithms to render data partitioning possible? In this work, we address these questions with regards to the problem of partitioning integer sequences. It is one of the simplest data partitioning problems and thus a good candidate problem to answer the questions raised. We prove that even for this rather simple problem, non-trivial quality guarantees are indeed impossible to achieve in the online model. However, if we augment the online model with preemption, i.e., the ability to remove a previously inserted element from the solution, or, in the context of data partitioning, the ability to merge a subset of current partitions by removing previously inserted partition separators, then competitive ratios of at most 2 can be obtained. Partitioning Online Integer Sequences. Let X be an integer sequence of length n, and p ≥ 2 an integer. In the problem of partitioning integer sequences (abbreviated by Part), the goal is to partition X into p contiguous blocks (by determining the position of p − 1 partition separators) such that the maximum weight of a block, denoted the bottleneck value of the partitioning, is minimized. In the (non-preemptive) online model, parameter p is given to the algorithm beforehand, and the sequence X arrives online, integer by integer. When processing an integer, the algorithm has to decide whether or not to place a partition separator after the current integer. We are interested in the competitive ratio [2] of an algorithm, i.e., the (expected) ratio of the bottleneck value of the computed partitioning and the optimal bottleneck value of the input, maximized over all inputs. Placing no separator at all results in a single partition that is trivially p-competitive. We prove, however, that this is essentially best possible in the non-preemptive online model, even if the integer sequence is an all-ones sequence. Given this strong impossibility result, we then augment the online model with preemption. When processing the current integer of the input sequence, a preemptive online algorithm for Part is allowed to remove a previously placed separator, which results in the merging of the two adjacent partitions incident to the separator. The removed separator can then be reinserted again (however, only after the current integer). In this paper, we show that the additional flexibility gained through preemption allows us to obtain algorithms with competitive ratio at most 2. Even though our original motivation for studying Part in the preemptive online model is the fact that non-trivial algorithms cannot be obtained in the non-preemptive case, preemptive online algorithms for Part are extremely space efficient (only the weights of partitions and positions of separators need to be remembered) and thus work well in a data streaming context for massive data sets. Partitioning Continuous Online Flows. Algorithms for Part have to cope with the following two difficulties: First, the weights in the input sequence may vary hugely, which implies that algorithms cannot establish partitions of predictable weights. Second, algorithms need to find a way to continuously merge adjacent partitions while keeping the bottleneck value small. While the first point can be tackled via rounding approaches, the second constitutes the core difficulty of Part. We define a problem denoted Flow, which abstracts away the varying weights of the integers and allows us focus on the second point. Flow differs from Part in that the preemptive online algorithm is allowed to determine the weight of every incoming element (we now even allow for positive rational weights). The difficulty in Flow stems from the fact that the algorithm is not aware of the total weight of the input. While at a first glance this problem appears to be substantially easier than Part, we show that any algorithm for Flow can be used for Part while incurring an error term that depends on the ratio of the largest weight of an element and the total weight of the input sequence. Flow can be seen as a continuous version of Part and can be interpreted as the problem of partitioning a continuous online flow (details follow in the preliminaries section). Our Results. We first show that every algorithm for Part in the non-preemptive online model has an approximation ratio of Ω(p), even if the input is guaranteed to be a sequence of ones (Theorem 1). We then turn to the preemptive model and consider the special case p = 2 first, which corresponds to preemptively guessing the center of a weighted request sequence. It is easy to see that every deterministic algorithm for the p = 2 case has a competitive ratio of 2. We then give a randomized 1.345-competitive algorithm for unweighted sequences (Theorem 2) and prove that this is best possible (Theorem 3). We extend this algorithm to weighted sequences and give a 1.628-competitive algorithm (Theorem 4) and a lower bound of 1.5 on the competitiveness (Theorem 5). 2 For general p, we first give a simple deterministic 2-competitive online algorithm for Part (Theorem 6) and prove a lower bound of 4/3 (6/5) on the competitiveness of every deterministic (resp. randomized) algorithm (Theorem 7). We then turn to Flow and give a highly non-trivial deterministic partitioning scheme with competitive ratio 1.68 (Theorem 8) for the case that p is a power of two, which constitutes the main contribution of this paper. This scheme translates to Part while incurring a small additive term in the competitive ratio that stems from the varying weights in Part. We discuss extensions of our scheme to arbitrary values of p and demonstrate experimentally that competitive ratios better than 2 can still be obtained. Last, we give a lower bound of 1.08 on the competitive ratio of every deterministic algorithm for Flow (Theorem 9). Unlike the lower bounds for Part, this lower bound does not rely on the discrete properties of integers. Techniques. Consider first the p = 2 case and all-ones sequences, which corresponds to preemptively guessing the center of the request sequence. One potential technique is reservoir sampling [25], which allows the sampling of a uniform random element while processing the input sequence. It naturally suits the preemptive online model and can be used to place a separator at a uniform random position in the request sequence, giving a randomized algorithm with expected competitive ratio 1.5. We show that the randomized geometric guessing technique allows us to improve on this bound: For a random δ ∈ (0, 1) and a carefully chosen value X, reset the single separator to the current position every time the total weight seen so far equals (cid:100)X δ·i(cid:101), for i ∈ {1, 2, . . .}, giving a 1.345-competitive algorithm. Via Yao's principle, we prove that this algorithm is optimal. We then analyze essentially the same algorithm on weighted sequences and show that it is 1.632-competitive. For general p, consider the following algorithm for all-ones sequences of unknown length n (assume also that p is even): First, fill all partitions with weight w = 1. Whenever partitions are entirely filled, merge them pairwise creating p/2 partitions of weight 2w and then update w ← 2w. Then w always constitutes the bottleneck value of this partitioning. After the merging, fill the empty partitions with weight w and repeat. Note that the optimal bottleneck value opt is bounded as opt ≥ n p . Since at least 2 ≤ n, which together half of all partitions computed by the algorithm have weight w, it holds that w p p implies w ≤ 2opt, giving a 2-competitive algorithm. The 2-competitive algorithm given in with opt ≥ n this paper is based on the intuition provided and also works for sequences with arbitrary weights. To go beyond the competitiveness of 2, consider the key moment that leads to the 2-competitiveness of the above algorithm: Just after merging all p partitions of weight w into p/2 partitions of weight 2w, the competitive ratio is 2. To avoid this situation, note that merging only a single pair of partitions would not help. Instead, after merging two partitions, we need to guarantee that the new bottleneck value is substantially smaller than twice the current bottleneck value. This implies that the weights of the merged partitions cannot both be close to the current bottleneck value, and it is hence beneficial to establish and merge partitions with different weights. In fact, our 1.08 lower bound for Flow makes use of this observation: If at some moment the competitive ratio is too good, then most partitions have similar weight, which implies that when these partitions have to be merged in the future the competitive ratio will be large. From an upper bound perspective, a clever merging scheme is thus required, which establishes partitions of different weights and, in particular, remains analyzable. We give such a scheme for Flow, when p is a power of two. As an illustration, consider the case p = 4 as depicted in Table 1. Recall that in Flow we are allowed to determine the weight of the incoming elements. We first initialize the partitions with values x, x2, x3, x4, for x = 2 1 4 , and evolve the partitions as in the table. Note that, at every moment, all partition weights are different, but at the same time never differ by more than a factor of 2. A key property is that at the end of the scheme the weights of the partitions are a multiple of the initial weights of the partitions. This allows us to repeate the scheme and limits the analysis to one cycle of the scheme. We prove that the competitive ratio of our scheme is 1.68 for every p that is a power of two. We discuss how our scheme can be extended to other values of p and demonstrate experimentally that competitive ratios better than 2 can still be obtained. Further Related Work. The study of Part in the offline setting has a rich history with early works dating back to the 80s [1, 7, 11, 18, 19, 14, 10, 20, 21]. After a series of improvements, Frederickson gave a highly non-trivial linear time algorithm [7]. Part finds many applications, especially in load balancing scenarios (e.g. [20, 15, 16]). It has recently been studied in the context of streaming algorithms where it serves as a building block for partitioning XML documents [16]. Recently, Stanton and Kliot [23] expressed interest in simple online strategies for data partitioning. 3 P1 x x(1 + x) x(1 + x) x(1 + x) x(1 + x) x(1 + x)(1 + x2) x(1 + x)(1 + x2) x(1 + x)(1 + x2) x(1 + x)(1 + x2) P2 x2 x3 x3 P3 x3 x4 x4 x3(1 + x) x3(1 + x) x2(1 + x) x2(1 + x)(1 + x2) x2(1 + x)(1 + x2) x2(1 + x)(1 + x2) x2(1 + x) x2(1 + x) x4(1 + x) x3(1 + x) x3(1 + x)(1 + x2) x3(1 + x)(1 + x2) P4 x4 x2 x2(1 + x) x4 x4(1 + x) x3(1 + x) x5(1 + x) x4(1 + x) next x2 x3 x4 x5 x3(1 + x) x5(1 + x) x4(1 + x) x6(1 + x) x4(1 + x)(1 + x2) Table 1: A partitioning scheme for Flow for p = 4. The bold elements are merged next. They studied online graph partitioning heuristics1 for the balanced graph partitioning problem and demonstrated experimentally that simple heuristics work well in practice. Stanton later analyzed the behavior of these heuristics on random graphs and gave good quality bounds [22]. Interestingly, besides this line of research, we are unaware of any further attempts at online data partitioning. Many works provide additional power to the online algorithm. Besides preemption, common resource augmentations include lookahead (e.g. [8]), distributions on the input (e.g. [12]), or advice (e.g. [4]). Preemptive online algorithms have been studied for various online problems. One example with a rich history is the matching problem (e.g. [6, 27, 5, 3]). Outline. In Section 2, we formally define the studied problems and the preemptive online model. In Section 3, we prove that every non-preemptive algorithm for Part has a competitive ratio of Ω(p). Then, we give our algorithms and lower bounds for Part for the special case p = 2 in Section 4. All our results for Part and Flow for arbitrary p are given in Section 5. 2 Preliminaries Partitioning Integer Sequences. In this paper, we study the following problem: Definition 1 (Partitioning Integer Sequences). Let X = w1, . . . , wn ∈ Nn be an integer sequence, and let p ∈ N be an integer. The problem of partitioning integer sequences consists of finding separators S = s1, . . . , sp−1 such that 1 = s0 ≤ s1 ≤ s2 ≤ ··· ≤ sp−1 ≤ sp = n + 1 and the maximum weight of a wi is minimized. The weight of a heaviest partition partition is minimized, i.e., maxj∈{0,...,p−1}(cid:80)sj+1−1 is the bottleneck value of the partitioning. This problem is abbreviated by Part. i=sj Online Model. In the online model, parameter p is given to the algorithm beforehand, and the integers X = w1, . . . , wn arrive online. Upon reception of an integer wi (also called a request), the algorithm has to decide whether to place a partition separator after wi. In the non-preemptive online model, placing a separator is final, while in the preemptive model, when processing wi previously placed separators may be removed. The total number of separators in place never exceeds p − 1 and separators can only be inserted at the current request. Competitive Ratio. The competitive ratio of a deterministic online algorithm for Part is the ratio between the bottleneck value of the computed partitioning and the bottleneck value of an optimal partitioning, maximized over all potential inputs. If the algorithm is randomized, then we are interested in the expected competitive ratio, where the expectation is taken over the coin flips of the algorithm. Partitioning Online Flows. We connect Part to the problem of partitioning a continuous online flow, abbreviated by Flow. volume of flow(cid:82) t Definition 2 (Preemptive Partitioning of a Continuous Online Flow). In Flow, time is continuous starting at time 0. Flow enters the system with unit and constant speed such that at time t, the total 0 1 dx = t has been injected. The goal is to ensure that when the flow stops at time 1Phrased in the context of streaming algorithms, but their algorithms are in fact online 4 s1 ≤ ··· ≤ sp−1 ≤ sp = t are in place such that: maxj∈{0,...,p−1}(cid:82) sj+1 tmax ≥ t0 (t0 is an arbitrarily small initial warm-up period), which is unknown to the algorithm, the total amount of flow is partitioned into p parts such that the weight of a heaviest partition is minimized. More formally, at time tmax ≥ t0, the objective is that partition separators S = s1, . . . , sp−1 with 0 = s0 ≤ 1 dt = maxj∈{0,...,p−1} sj+1 − sj is minimized. Similar to Part, in the preemptive online model, partition separators can only be inserted at the current time t, and previously inserted partition separators can be removed. sj Even though Flow is defined as a continuous problem, it can be seen as a special case of Part where the algorithm can determine the weight of every incoming element. 3 An Ω(p) Lower Bound In The Non-preemptive Online Model Solving Part in the non-preemptive online model is difficult since the total weight of the input sequence is unknown to the algorithm. Since inserted partition separators cannot be removed, any partition created by the algorithm may be too small if the input sequence is heavier than expected. This intuition is formalized in the following theorem: Theorem 1. For every p ≥ 2, every randomized non-preemptive online algorithm for Part has expected competitive ratio Ω(p), even on all-ones sequences. Proof. Let k = p2 and let Σ = {σ1, . . . , σk} be a set of request sequences where σi is the all-ones sequence of length 4ip. Let A be a randomized algorithm for Part, and assume that its expected competitive ratio on every instance of Σ is at most c. Then by Yao's lemma, there exists a deterministic algorithm Ad with average approximation ratio at most c over the instances of Σ. Let S = {s1, . . . , sp−1} denote the set of separators output by Ad on σk. Note that since σi is a prefix of σk, the output of Ad on σi is a subset of the separators S. Partition now Σ into Σ0 and Σ1 such that the approximation ratio of Ad on σ ∈ Σ1 is strictly smaller than p/2, and the approximation ratio of Ad on σ ∈ Σ0 is at least p/2. Consider now a σi ∈ Σ1. Then, there exists a separator s(i) ∈ S with 1/4 · 4ip ≤ sj ≤ (3/4) · 4ip, since otherwise the bottleneck value of the partitioning output by Ad on σi was at least 2pi. This in turn would imply that the approximation ratio was at least 2pi/(4i) = 1 2 p (since the optimal bottleneck value on σi is 4i), contradicting the fact that σ ∈ Σ1. Next, note that the separators s(i) and s(j), for i (cid:54)= j and σi, σj ∈ Σ1, are necessarily different. Thus, since the number of separators is p − 1, the size of Σ1 is bounded by p − 1. The average approximation factor c of Ad on instances S is thus at least c ≥ Σ0 · p 2 + Σ1 · 1 Σ = (k − (p − 1)) p 2 k > p 2 − p2 2k ≥ p 2 − p2 2k = p 2 − 1 2 . 4 Guessing the Center: Part for p = 2 In this section, we consider Part for p = 2, i.e., a single separator needs to be introduced into the request sequence so as to split it into two parts of similar weight. We start with all-ones sequences and present an asymptotically optimal preemptive online algorithm. Then, we show how to extend this algorithm to sequences of arbitrary weights. 4.1 All-ones Sequences The special case p = 2 on all-ones sequences corresponds to preemptively guessing the center of a request sequence of unknown length. Deterministic algorithms cannot achieve a competitive ratio better than 2 here, since request sequences that end just after a deterministic algorithm placed a separator give a competitive ratio of 2. Observation 1. Every deterministic preemptive online algorithm for Part with p = 2 has a competitive ratio of 2. 5 Using a single random bit, the competitiveness can be improved to 1.5. This barely-random algorithm is given in Appendix A. Using O(log n) random bits, we can improve the competitive ratio to 1.344, which is best possible, and will be presented now. Algorithm 2 Alg. Ax for Part and p = 2 Choose uniform random δ ∈ (0, 1), i → 0 for each request j = 1, . . . , n do if j = (cid:100)xi+δ(cid:101) then move separator to current position i → i + 1 end if end for Algorithm Ax, as depicted in Algorithm 2, is parametrized by a real x > 2, which will be optimized in Theorem 2. It moves the separator to the current position as soon as the (cid:100)xi+δ(cid:101)-th request is processed, where i is any integer and δ ∈ (0, 1) is a random number. Remark. The continuous random variable δ is only taken for convenience in the analysis; a bit precision of O(log n) is enough. In the following, denote by RnAx the competitive ratio of Ax on a sequence of length n. Theorem 2. There is a constant x ≈ 3.052 such that E[RnAx Proof. Let α ∈ [0, 1) and i ∈ N be such that n = 2xi+α. Then, the bottleneck value of an optimal partition is (cid:100) n , which depends on various ranges of α and δ. We distinguish two ranges for α, and within each case, we distinguish three ranges of δ: 2(cid:101) = (cid:100)xi+α(cid:101). We now bound the bottleneck value of the computed partitioning rnAx ] ≈ 1.344 + O(n−1). Case 1: α > 1 − logx 2 (note that we assumed x > 2). In order to bound rnAx , we split the possible values of δ into three subsets: • If δ ∈ (0, α + logx 2 − 1], then we have that xδ+i+1 ≤ 2xi+α = n. In this case, the bottleneck value is rnAx = xδ+i+1 + O(1). • If δ ∈ (α + logx 2 − 1, α], then we have that xδ+i+1 > n but xδ+i ≤ n 2 . n − xδ+i + O(1) = 2xα+i − xδ+i + O(1). In this case, rnAx = • If δ ∈ (α, 1), then we have that xδ+i+1 > n and xδ+i ∈ ( n 2 , n). In this case, rnAx = xδ+i. Using these observations, we can bound the expected competitive ratio as follows: (cid:90) α+logx 2−1 (cid:32)(cid:90) α+logx 2−1 0 1 xα 0 xδ+i+1 xi+α dδ + (cid:90) α (cid:90) α α+logx 2−1 xδ+1dδ + α+logx 2−1 E[RnAx ] = = 2xα+i − xδ+i xi+α dδ + (2xα − xδ)dδ + xδ+i (cid:33) xi+α dδ + O(n−1) + O(n−1) xδdδ (cid:90) 1 (cid:90) 1 α α = 2 − 2 logx 2 + 2 x ln x + O(n−1). Case 2: α ≤ 1 − logx 2. We deal with this case similarly, but we need to group the possible values for δ in a different way: • If δ ∈ (0, α], then xδ+i+1 > n but xδ+i ≤ n • If δ ∈ (α, α + logx 2], then xδ+i > n • If δ ∈ (α + logx 2, 1), then xδ+i > n. In this case, rnAx 2 . In this case, rnAx = n − xδ+i + O(1). 2 and xδ+i ≤ n. In this case, rnAx = xδ+i + O(1). = n − xδ+i−1 + O(1) (note that i ≥ 1 here). 6 Plugging the values above in the formula for the expected value, we obtain a different sum of integrals, (cid:90) α which however leads to the same function as above: E[RAx] = 2xα+i − xδ+i 0 xi+α = 2 − 2 logx 2 + dδ + α 2 x ln x + O(n−1). (cid:90) α+logx 2 (cid:90) 1 xδ+i xi+α dδ + 2xα+i − xδ+i−1 dδ + O(n−1) α+logx 2 xi+α def = 2 − 2 logx 2 + 2 Moreover, the formulas above are independent of α. Thus, it remains to find a value of x that minimizes x ln2 x , and f(cid:48)(x) = 0 if and only x2 ln x + ln 2 f (x) e with z = −x ln 2, if x = log2(ex). With a simple transformation, the latter is equivalent to zez = − ln 2 so the value that minimizes f (x) can be computed as xmin = − W−1(− ln 2/e) ≈ 3.052, where W−1 is the lower branch of Lambert's W function. The claim of the theorem follows by calculating f (xmin). x ln x . Observe that f(cid:48)(x) = − 2 x2 ln2 x − 2 ln 2 Next, we prove that no algorithm can achieve an (expected) competitive ratio better than the one claimed in Theorem 2. The proof applies Yao's Minimax principle and uses a hard input distribution over all-ones sequences of length n ∈ [nmin, nmax], for some large values of nmin and nmax, where the probability that the sequence is of length n is proportional to 1/n. Theorem 3. For any randomized algorithm A, E[RnA] ≥ 1.344. Proof. We will prove the theorem by using Yao's Minimax principle [26]. To this end, let us first consider an arbitrary deterministic algorithm Adet. Assume the length of the sequence is random in the interval X := [nmin, nmax] for large values of nmax and nmin with nmax > 2·nmin and has the following distribution: The sequence ends at position n ∈ X with probability pn which is proportional to 1 n , i.e., using the definition S = nmax(cid:88) m=nmin 1 m , we have pn := P[sequence is of length n] = 1 n · S . ] ≥ 1.344 − O(ln We will show that for each deterministic algorithm Adet, if the input sequence is distributed as above, −1 nmax/nmin), where the expectation is taken over the distribution of n. then E[RnAdet Let J denote the set of requests at which Adet places the separator when processing the all-ones sequence of length nmax. Note that the set of separator positions placed by Adet on sequences of shorter lengths are a subset of J. Let I = J ∩ X = {i1, . . . , ik} (the ij are ordered with increasing value). be the bottleneck value of the partitioning computed by Adet on the sequence of length n. We bound E[RnAdet by separately bounding every partial sum in the following decomposition: E[RnAdet ] = E(nmin, i1) + E(i1, i2) + ··· + E(ik−1, ik) + E(ik, nmax), ] =(cid:80)nmax For n ∈ X, let rnAdet pnRnAdet n=nmin where for each a > b, E(a, b) =(cid:80)b−1 n=a pnRnAdet start with bounding all other terms. In the following, H q q ≥ p ≥ 1. In particular, S = H nmax nmin Thus, we proceed in three steps: 1. Consider an index 1 ≤ j < k and let us bound the sum E(ij, ij+1). Let us denote a = ij and . The first and last terms need a special care, so we will 1 n denotes partial harmonic sums for n=p . b = ij+1. We need to consider two cases. Case 1: b ≤ 2a. Then for all n ∈ {a, . . . , b − 1}, the bottleneck value computed by the algorithm is rnAdet = a (since n/2 < a). Then: p =(cid:80)q E(a, b) ≥ b−1(cid:88) n=a b−1(cid:88) · 1 nS a (cid:100)n/2(cid:101) ≥ 2a S 1 = 2a S n(n + 1) n=a (cid:19) (cid:18) 1 a − 1 b > 1.4 · H b−1 a S , (1) where the last inequality can be proved as follows. First, it is easily checked that the ratio Φ(a, b) = 2(1 − a decreases when b increases with a kept fixed, implying that (recall that b ≤ 2a and using standard approximations of harmonic sums) b )/H b−1 a 7 Φ(a, b) ≥ Φ(a, 2a) = 1/H 2a−1 a ≥ 1 ln 2 + 1 a > 1.4, where the last inequality holds when a = ij is large enough (say ij ≥ nmin/2 ≥ 50). Case 2: b > 2a. In this case, for all n = a, . . . , 2a− 1, if the sequence is of length n, then rnAdet as in case 1. However, when n ≥ 2a, then n/2 ≥ a, so rnAdet can bound E[RnAdet = a, = n − a. Using these observations, we ] as follows: E[RnAdet ] = n=a 1 nS 2a−1(cid:88) 2a−1(cid:88) (cid:18) 1 (cid:18) 2a S 2 S H b a S a 2a Sb n=a + · b−1(cid:88) n=2a a (cid:100)n/2(cid:101) + n − a (cid:100)n/2(cid:101) 1 nS 2a+1 − 2a H b S 1 + (cid:19) 2 S 2a+1 − 2a 2 H b + S S (cid:19) a − H 2a a ) − H 2a a H b a n(n + 1) − 1 2a 2 S 2a bH b a (H b + , 2 + ≥ 2a S = = = b−1(cid:88) (cid:18) 1 n=2a − 1 b 2a n(n + 1) 1 (cid:19) where the third line is obtained by using the identity H b approximation for the harmonic sums, and setting x = b a − H 2a 2a+1 = H b a , we can approximate: a . Again, using a standard 2 + 2a bH b a − H 2a a H b a ≥ 2 + 2a b ln b a − ln 2 ln b a − O(a−1) = 2 + 2 x ln x − logx 2 − O(a−1), x ln x − logx 2 is exactly the same that was minimized in the proof Note that the function f (x) = 2 + 2 of Thm. 2, and achieves its minimum in (1,∞) at xmin ≈ 3.052, giving f (xmin) ≈ 1.344. Thus, we have E(ij, ij+1) ≥ H (1.344 − O( 1 ij+1−1 ij )). S ij 2. The term E(ik, nmax) can be bounded by above. H nmax−1 ik S (1.344 − O( 1 ik )) by an identical argument as 3. The term E(nmin, i1) needs a slightly different approach. Let i0 denote the last separator that the algorithm placed before nmin. We can assume that i0 ≥ nmin/2, as otherwise the algorithm could only profit by moving the separator to nmin/2. We consider two cases. First, if i1 ≤ 2i0, then we simply assume the algorithm performs optimally in the range [nmin, i1): E(nmin, i1) = H i1−1 nmin S ≥ 1.344 · H i1−1 nmin S − 0.5 H i1−1 nmin S > 1.344 · H i1−1 nmin S − 1/S, since (recalling that i1 ≤ 2i0 ≤ 2nmin), H i1 On the other hand, when i1 > 2i0 (and by the discussion above, 2i0 ≥ nmin), then with calculations similar to the one in Case 2 above, we can obtain: < H 2nmin nmin < 1. nmin E(xmin, i1) = n=nmin 1 nS 2i0−1(cid:88) 2i0−1(cid:88) (cid:18) i0 n=nmin ≥ 2i0 S i1−1(cid:88) n=2i0 i0(cid:100)n/2(cid:101) + n − i0 (cid:100)n/2(cid:101) 1 nS i1−1(cid:88) 1 1 n(n + 1) + 2 S 2i0+1 − 2i0 (cid:19) H i1 − H 2i0 nmin n=2i0 S ≥ 2 · H i1 nmin S n(n + 1) − O(1/S), ≥ 2 S + i0 i1 + H i1 nmin nmin because i0 ≤ nmin and thus H 2i0 nmin < 1. 8 It remains to plug the obtained estimates in (1): k−1(cid:88) E[RnAdet ] = E(nmin, i1) + E(ij, ij+1) + E(ik, nmax) j=1 ≥ (1.344 − O(1/nmin)) · H i1 = 1.344 − O(1/S). nmin +(cid:80)k−1 j=1 H ij+1−1 ij S + H nmax ik − O(1/S) Last, by Yao's principle, every randomized algorithm has a competitive ratio of at least E[RnAdet ]. X can be thought of as a sequence of Wn =(cid:80)n 4.2 General Weights Algorithm Ax can be adapted to weighted sequences X = w1, w2, . . . , wn of positive integers as follows: i=1 wi unit weight requests and we simulate Ax on this unit weight sequence. Whenever Ax attempts to place a separator, but the position does not fall at the end of a weight wi, the separator is placed after wi. If the weights of the sequence are bounded, algorithm Ax can be analyzed similarly as Theorem 2, by treating all requests as unit weights. This introduces an additional error term: Corollary 1. There is a constant value of x ≈ 3.052 such that E[RnAx sequence X = w1, w2, . . . , wn with weights wi ≤ B. ] ≈ 1.344 + O(B/Wn) for any When arbitrary weights are possible, a non-trivial bound can still be proved. Interestingly, the optimal 2 n ) for each gap size between the separator positions is larger than in the case of unweighted sequences. ] ≤ 1.627 + O(W −1 Theorem 4. There is a constant value of x ≈ 5.357 such that E[RXAx sequence of total weight Wn. 2 . Then, wm is the central weight of the sequence, and we denote Wn Wn Proof. Let X = w1, w2, . . . , wn be the input sequence of total weight Wn, and let m = arg minm(cid:48)(cid:80) first that replacing all wi left of wm by a sequence of(cid:80) of wm by a single large request of weight(cid:80) i≤m(cid:48) wi ≥ the central point. We will argue i<m wi unit requests, and replacing all wi right i>m wi worsens the approximation factor of the algorithm. Indeed, suppose that the algorithm attempts to place a separator at a position j that falls on an element wi, which is located left of wm. Then the algorithm places the separator after wi, which brings the separator closer to the center and thus improves the partitioning. Similarly, suppose that the algorithm attempts to place a separator at position j that falls on an element wi, which is located right of wm. By replacing all weights located to the right of wm by a single heavy element, the algorithm has to place the separator at the end of the sequence, which gives the worst possible approximation ratio. Thus, we suppose from now on that X is of the form X = 1 . . . 1wmB, where B may be non-existent. Assume that the central point splits the request with weight wm into two parts w(cid:48), w(cid:48)(cid:48) ≥ 0, such that 2 + min{w(cid:48), w(cid:48)(cid:48)}. Further assume that Wn = 2xi+α for α ∈ [0, 1) and i ∈ N. Then, Wn 2 = xi+α is the central point. Let α1, α2 be such that xi+α1 is the starting point of weight wm, and xi+α2 is the starting point of weight B. Note that α2 is non-negative, but α1 can be negative. However, if α1 < 0, we can replace α1 = 0 without decreasing the approximation ratio, because in both cases the algorithm places the separator after wm, while in the case of negative α1 the optimum can only be larger than when α1 = 0. Thus, we assume w.l.o.g. that α1 ≥ 0, so α1 ∈ [0, α] and α2 ∈ [α, α + logx 2]. Again, we consider several cases. In the estimates below, we ignore the rounding terms as they are all O(1), and hence the error term in the approximation ratio is O(opt−1) = O(W −1 n ). Also, we use W in place of Wn for brevity. Case 1: α < 1 − logx 2. In this case, xi+1 > W . So for all δ ∈ [0, α + logx 2], xi+δ is the position where the last separator would be (in the unit weights case). However, when δ > α + logx 2 then xi+δ > W and xi+δ−1 < W/2 is the last separator. i<m wi = Wn 2 . Clearly, the optimal bottleneck value is opt = Wn w(cid:48) +(cid:80) Here we have: • δ ∈ [0, α1]: rAx = W − xi+δ (all unit weights before wm). 9 • δ ∈ [α1, α2]: the separator is placed after wm, and rAx = W/2 + w(cid:48)(cid:48). • δ ∈ [α2, α + logx 2]: assume the worst case bound rAx ≤ W . • δ ∈ [α + logx 2, 1]: rAx = W − xi+δ−1, as the last separator is at xi+δ−1 < xi ≤ xi+α1 . Computing the expectation gives: (cid:90) α1 (cid:90) 1 0 E[RXAx ] ≤ + = W − xi+δ dδ + opt W − xi+δ−1 (cid:18) α+logx 2 1 opt W (1 + opt 1 x ln x (cid:90) α2 α1 dδ (cid:90) α+logx 2 W/2 + w(cid:48)(cid:48) opt dδ + α2 W opt dδ ) − α2(W/2 − w(cid:48)(cid:48)) + α1(W/2 − w(cid:48)(cid:48)) − xi+α1 ln x (cid:19) . (2) First, assume that w(cid:48)(cid:48) ≤ w(cid:48), which implies that α1 ≤ logx(W/2 − w(cid:48)(cid:48)) − i. In this case opt = W/2 + w(cid:48)(cid:48). Let us see which values of α1 maximize the term φ(α1) = ( W ln x in the parentheses. We 2 − w(cid:48)(cid:48) − xi+α1 ≥ 0, since α1 ≤ logx(W/2 − w(cid:48)(cid:48)) − i by assumption (that w(cid:48)(cid:48) ≤ w(cid:48)). So have φ(cid:48)(α1) = W φ(α1) is increasing in the interval [0, logx(W/2 − w(cid:48)(cid:48)) − i], and α1 = logx(W/2 − w(cid:48)(cid:48)) − i is the maximizer. Plugging this value and α2 = logx(W/2 + w(cid:48)(cid:48)) − i in the expectation formula and rearranging the terms gives: 2 − w(cid:48)(cid:48))α1 − xi+α1 E[RXAx ] ≤ W (1 + 1 x ln x ) + ( W 2 − w(cid:48)(cid:48))(logx( W 2 − w(cid:48)(cid:48)) − logx( W 2 + w(cid:48)(cid:48)) − 1 ln x ) . W 2 + w(cid:48)(cid:48) Note that the right hand side is a decreasing function of w(cid:48)(cid:48) and the maximum is achieved when w(cid:48)(cid:48) = 0: (3) Now assume that w(cid:48)(cid:48) ≥ w(cid:48). Then opt = W/2 + w(cid:48). By plugging the value α2 = logx(W/2 + w(cid:48)(cid:48)) − i in (2) we see again that the expression is a decreasing function of w(cid:48)(cid:48), so it is maximum when w(cid:48)(cid:48) takes its minimum value w(cid:48)(cid:48) = w(cid:48): x ln x . E[RXAx ] ≤ 2 + 2 − 1 ln x E[RXAx ] ≤ W (1 + 1 x ln x ) + ( W 2 − w(cid:48))(logx( W 2 + w(cid:48) W 2 − w(cid:48)) − logx( W 2 + w(cid:48)) − 1 ln x ) . where we also used xα1+i = W/2 − w(cid:48). This is again a decreasing function of w(cid:48) and gives exactly the same bound (3). Case 2: α > 1 − logx 2. Here xi+δ+1 < W for all δ ∈ [0, α + logx 2 − 1], so we assume that the algorithm places the separator at the end of the sequence for such δ. Here we have to distinguish two sub-cases. Case 2.1: α1 > α + logx 2 − 1. We have: • δ ∈ [0, α + logx 2 − 1]: rAx ≤ W . • δ ∈ [α + logx 2 − 1, α1]: rAx = W − xi+δ. • δ ∈ [α1, α2]: rAx = W/2 + w(cid:48)(cid:48). • δ ∈ [α2, 1]: rAx ≤ W . (cid:90) α+logx 2−1 Computing the expectation gives: (cid:18) (cid:90) α1 E[RXAx W opt ] ≤ dδ + α+logx 2−1 W − xi+δ opt dδ + (cid:90) α2 α1 W/2 + w(cid:48)(cid:48) opt (cid:90) 1 α2 W opt dδ dδ + (cid:19) . 0 1 opt = W (1 + 1 x ln x ) − α2(W/2 − w(cid:48)(cid:48)) + α1(W/2 − w(cid:48)(cid:48)) − xi+α1 ln x The latter is the same formula as in Case 1, so (3) holds in this case too. 10 Case 2.2: α1 ≤ α + logx 2 − 1. In the analysis below, we assume that rAx takes the worst-case value W for all δ ∈ [0, α + logx 2 − 1]. In this case, we assume w.l.o.g. that α1 = α + logx 2 − 1, because the optimum can only become worse when α1 is smaller, while the algorithm (as we assume) will not profit. Thus, xi+α1 = W/x and α1 = logx W − 1 − i. We have: • δ ∈ [0, α1]: rAx ≤ W . • δ ∈ [α1, α2]: rAx = W/2 + w(cid:48)(cid:48). • δ ∈ [α2, 1]: rAx ≤ W . Computing the expectation gives: (cid:90) α1 (cid:18) 0 1 opt 1 opt E[RXAx ] ≤ = = (cid:90) α2 (cid:90) 1 W/2 + w(cid:48)(cid:48) α1 opt dδ + dδ + W W opt opt (W + α1(W/2 − w(cid:48)(cid:48)) − α2(W/2 − w(cid:48)(cid:48))) W/2 + w(cid:48)(cid:48) − 1) W + (W/2 − w(cid:48)(cid:48))(logx W α2 dδ (cid:19) , (4) (cid:18) W (cid:19) (cid:17) (cid:16) 1 where we used α1 = logx W − 1 − i and α2 = logx(W/2 + w(cid:48)(cid:48)) − i. (Z − 1) logx Z + 1 with Z = in which case we have E[RXAx optimize the numerator of (4) as a function of w(cid:48)(cid:48). The derivative is Now, if w(cid:48)(cid:48) ≤ w(cid:48), then opt = W/2 + w(cid:48)(cid:48). Plugging this value in (4), we obtain the expression W/2+w(cid:48)(cid:48) , which is a decreasing function of w(cid:48)(cid:48), so it is maximized for w(cid:48)(cid:48) = 0, ] ≤ 1 + logx 2. On the other hand, if w(cid:48)(cid:48) > w(cid:48), then opt = W/2 + w(cid:48) = W/2 + W/2 − xi+α1 = W − W/x. Let us W − logx W W/2 + w(cid:48)(cid:48) + 1 + W/2 − w(cid:48)(cid:48) (W/2 + w(cid:48)(cid:48)) ln x = 1 − 1 ln x W/2 + w(cid:48)(cid:48) + ln W/2 + w(cid:48)(cid:48) W Recall that w(cid:48)(cid:48) > w(cid:48) = W/2 − W/x, so the expression above is at least 1 − 1 and is 1−1/x + ln positive for all x > 3, showing that the bound we obtained is an increasing function of w(cid:48)(cid:48) and is maximized when w(cid:48)(cid:48) = W/2. Plugging the values of opt and w(cid:48)(cid:48) = W/2 in (4), we obtain that E[RXAx 1−1/x ] ≤ ln x 1 1 def = 2 + 2 Thus, covering all cases, we obtain the bound E[RXAx ln x , h(x) = 1 + logx 2, and f (x) = 2e ) ≈ 5.3567 minimizes g(x) and g(xmin) ≈ 1.627. x ln x − 1 g(x) xmin = −2W−1(− 1 max{h(xmin), f (xmin)} < 1.5. 1/2+1/x . ] ≤ max{g(x), h(x), f (x)} + O(W −1 n ), where 1/2+1/x . It can be shown as in Thm. 2 that It can also be checked that 1 The competitive ratio 1.627 is tight for algorithm Ax. This is achieved on sequences consisting of Wn/2 unit weight requests followed by a request of weight Wn/2. Furthermore, using a similar idea as for the unweighted case, a barely-random algorithm that uses only a single bit can be obtained with competitive ratio 1.75 (analysis omitted). Last, it can be seen that on sequences with exponentially increasing weights, no algorithm can achieve a competitive ratio better than 1.5. Theorem 5. Every randomized algorithm for Part on sequences with arbitrary weights has an expected competitive ratio of at least 1.5. Proof. Let Si = 20, 21, 22, . . . , 2i−1 denote the exponentially increasing sequence of length i, let xmin, xmax be large integers with xmax ≥ 2xmin, and let X = [xmin, xmax]. We consider the performance of any deterministic algorithm Adet on the uniform input distribution on set S = {Si : i ∈ X}. The result for randomized algorithms then follows by applying Yao's lemma. Let J be the set of requests at which Adet places a separator on input Sxmax. Note that the set of separator positions on any other input of S is a subset of J. Let I = J ∩ X = {i1, . . . , ik} be the separators placed within the interval X (ordered such that ij < ij+1, for every j) and let i0 be the right-most separator placed before xmin. W.l.o.g., we can savely assume that i0 = xmin − 1, since this 11 does not worsen the algorithm (it is the optimal choice for Sxmin ). Furthermore, we can also assume that xk < xmax, since placing a separator at request xmax gives the worst ratio possible for Sxmax. We bound now the expected competitive ratio of Adet, where the expectation is taken over the inputs S. To this end, notice that the optimal bottleneck value OP Ti on sequence Si is OP Ti = 2i−1. We write RiAdet to denote the competitive ratio of Adet on sequence Si. Then: 1 xmax − xmin + 1 ESi←S RiAdet = xmax(cid:88) i1−1(cid:88) (cid:124) We now bound I, II, and(cid:80)ij+1−1 RnAdet n=xmin = n=xmin (cid:123)(cid:122) I RnAdet + (cid:125) · xmax(cid:88) i2−1(cid:88) n=xmin RnAdet RnAdet , and + ··· + ik−1(cid:88) RnAdet + xmax(cid:88) (cid:124) n=ik (cid:123)(cid:122) II RnAdet . (cid:125) n=i1 n=ik−1 for every 1 ≤ j ≤ k − 1, separately. = 2ij −1 ij + 1 < ij+1), and in general for every a ≥ 2 with ij + a < ij+1, Rij +aAdet 1. First, observe that for every 1 ≤ j ≤ k − 1, we have RijAdet RnAdet n=ij ≥ (1.5 − 1 2ij−1 )(ij+1 − ij) ≥ (1.5 − 2xmin−1 )(ij+1 − ij). 1 Hence,(cid:80)ij+1−1 i1 = xmin + a, then I =(cid:80)a−1 RnAdet n=ij 2. Concerning I, first notice that if i1 = xmin, then I = 0. By similar considerations as above, if which is at least 1.5 · a, if a ≥ 4. 3. Last, concerning II, this case is identical to the first case, and we can bound II by II ≥ (1.5 − 2xmin−1+2xmin +2xmin+1+···+2xmin+b−1 2xmin+b−1 b=0 2ij−1 = 2 − 1 2ij−1 , Rij +1Adet = 2ij +2ij +1+···+2ij +a−1 2ij +a−1 = 1 (if ≥ 1.5. 2xmin−1 )(xmax − ik). 1 Thus, we can bound Ei←X RiAdet by: ESi←S RiAdet ≥ 1 xmax − xmin + 1 ). = 1.5 − O( 1 xmax (cid:18) (xmax − xmin + 1 − 4)(1.5 − (cid:19) 1 2xmin−1 ) + 4 · 1 Thus, since xmax can be chosen arbitrarily large, every deterministic algorithm has an expected competitive ratio of 1.5. The result for randomized algorithms follows by applying Yao's principle. 5 Partitioning with Arbitrary Number of Partitions We give now our results for Part for arbitrary p. We first give an algorithm and a lower bound that directly consider Part. Then, we address Part indirectly, by first solving Flow. 5.1 Algorithm and Lower Bound for Part: Direct Approach 5.1.1 Algorithm We give now a deterministic 2-competitive algorithm for Part for any number of partitions p in the preemptive online model. A building block of our algorithm is the Probe algorithm, which has previously been used for tackling Part [7, 14, 16]. Algorithm Probe takes an integer parameter B, which constitutes a potential bottleneck value, and traverses the input sequence from left to right, placing separators such that partitions of maximal size not larger than B are created. It is easy to see that Probe creates at most p partitions if B ≥ B∗, the optimal bottleneck value. Lemma 1. Let X be an integer sequence. If there exists a partitioning of X into p parts with maximum partition weight m, then Probe(m) creates at most p partitions. 12 Algorithm 3 2-Approximation for Part wi ← 0 for all 1 ≤ i ≤ p {current partitions} S ← 0 {current total weight} m ← 0 {current maximum} while request sequence not empty do x ← next request S ← S + x, m ← max{m, x} B ← 2 · max{m, S/p} {bottleneck val.} Run Probe(B) on w1, w2, . . . , wp, x and update partition weights w1, . . . , wp end while Instead of running Probe directly on the input sequence, we will run Probe for a carefully chosen bottleneck value B on the sequence w1, . . . , wp, x of current partition weights w1, . . . , wp followed by the value of the current request x. We will prove that this run of Probe creates at most p partitions. If Probe places a subsequence wi, . . . , wj of partition weights into the same partition, then the partition separators between current partitions i, . . . , j are removed. See Algorithm 3 for details. Theorem 6. Algorithm 3 is a deterministic 2-competitive algorithm for Part. Proof. First, suppose that the run of Probe Algorithm 3 succeeds in every iteration. Let S be the weight of the entire input sequence, and let m be its maximum. Since the optimal bottleneck value B∗ is trivially bounded from below by max{m, S/p}, and the bottleneck value employed in the last run of Probe is B = 2 · max{m, S/p}, we obtain an approximation factor of 2. Denote wp+1 = x. It remains to prove that the run of Probe always succeeds, i.e., in every iteration of the algorithm, the optimal bottleneck value of the sequence w1, w2, . . . wp, wp+1 is at most B = 2 · max{m, S/p} (where S is the current total weight of the input sequence, and m the current maximum). Indeed, if Probe(B) does not succeed in creating p partitions, then wi + wi+1 > B ≥ 2S/p must hold for all 1 ≤ i ≤ p. But then: p+1(cid:88) (cid:98)(p+1)/2(cid:99)(cid:88) S = wi ≥ (w2i−1 + w2i) > (cid:98)(p + 1)/2(cid:99) · 2S/p ≥ S, a contradiction, which proves correctness of the algorithm. i=1 i=1 5.1.2 Lower Bound Next, we present a lower bound for Part that makes use of the discrete properties of integers (and does not apply to Flow). For a given p ≥ 2, let σ1 and σ2 be the all-ones sequences of lengths 2p and 2p + 1, respectively. Consider first a deterministic algorithm Adet. If Adet computes an optimal solution on σ1, i.e., a partitioning consisting of p partitions each of weight 2, then Adet on σ2 is at least 4 3 -competitive, since the merging of any two partitions creates a bottleneck value of 4 while the optimal bottleneck is 3. On the other hand, if Adet is not optimal on σ1, then Adet is at least 3 2 -competitive on σ1. Thus, every deterministic algorithm for Part is at least 4 Consider now a randomized algorithm Arand. Consider further the input distribution over {σ1, σ2} so that σ1 occurs with probability 2 5 . Let p denote the probability that Arand outputs an optimal solution on σ1. Then, the approximation ratio of Arand is bounded from below by: 5 , and σ2 occurs with probability 3 3 -competitive. P [σ1 occurs] · p · 1 + (1 − p) · 3 2 + [σ2 occurs] · p · 4 3 + (1 − p) · 1 = 6 5 . (cid:18) (cid:19) (cid:18) (cid:19) We thus established the following theorem: Theorem 7. Every deterministic (randomized) preemptive online algorithm for Part is at least 4 3 - competitive (resp. 6 5 -competitive). 13 Algorithm 4 Periodic Scheme Require: Integer p, real number x Si ← super-partition with base i, ∀i ∈ [p] j ← 1 Xj ← S1 {Initial conf. equals S1} for p − 1 times do for i ← 1 . . . p do merge-next(Si) X(cid:48) ← length p prefix of S1, S2, . . . , Sp if X(cid:48) (cid:54)= Xj then j ← j + 1, Xj ← X(cid:48) end if end for end for 5.2 Algorithm and Lower Bound for Part: Indirect Approach Via Flow 5.2.1 Algorithm We will first give a deterministic algorithm for Flow, which is roughly 1.68-competitive, and then prove a lower bound of 1.08. In the following, we assume that p is a power of two. We first give a scheme, which is based on a positive real number x (we will set x = 2 later), that defines a sequence of p-ary vectors X1, X2, . . . . Then, we will prove in Lemma 2 how this scheme can be applied to Flow. To define our scheme, we require the concept of a super-partition: Definition 3 (Super-partition). For an integer 1 ≤ b ≤ p denoted the base, let S = S1, . . . , Sp with S1 = x p Si be the initial configuration of the super-partition. The super-partition evolves by merging in each step the pair of partitions whose sum is minimal, thus decreasing the length of the super-partition by 1 in every step (since we assumed that p is a power of two, overall we do log n merge sweeps from left to right). p and Si+1 = x 1 b Our scheme is best explained via the evolution of p super-partitions with different bases and is depicted in Algorithm 4. It outputs a sequence X1, X2, . . . , which corresponds to the evolution of the weights of the p partitions in an algorithm for Flow. To illustrate the scheme, as in Table 1 in the introduction, we consider the case p = 4. Initially, four super-partitions are in their initial state, and since X1 equals the length 4 prefix of the values of the super-partitions S1, S2, . . . , Sp, we have that X1 equals S1 (in the following, the Xi are highlighted in bold): (cid:125)(cid:124) S2 (cid:123) 5 4 (cid:122) (cid:125)(cid:124) S3 (cid:123) 6 4 (cid:122) (cid:125)(cid:124) S4 4 4 , x 5 4 , x 6 4 , x x (cid:123) 7 4 (cid:122) (cid:125)(cid:124) S1 (cid:123) (cid:122) 1 4 , x 2 4 , x 3 4 , x 4 4 x 2 4 , x 3 4 , x 4 4 , x x 3 4 , x 4 4 , x 5 4 , x x Then, merge-next advances super-partition S1 into its next state, by merging the two lightest weights (x 1 and x 2 4 of super-partition S2 advance to position 4 and is thus included in X2: 4 )). This makes the weight x 2 4 (1 + x 1 4 to x 1 4 = x 1 4 + x 2 4 1 4 (1 + x 1 4 ), x 3 4 , x 4 4 x x 2 4 , x 3 4 , x 4 4 , x 5 4 x 3 4 , x 4 4 , x 5 4 , x 6 4 x 4 4 , x 5 4 , x 6 4 , x 7 4 Next, super-partition S2 is advanced, which gives X3: 1 4 (1 + x 1 4 ), x 3 4 , x 4 4 x x 2 4 (1 + x 1 4 ), x 4 4 , x 5 4 x 3 4 , x 4 4 , x 5 4 , x 6 4 x 4 4 , x 5 4 , x 6 4 , x 7 4 Note that in the next two steps, super-partitions S3 and S4 are advanced, which does not affect the first four positions. Hence, in these iterations, the condition in Line 8 evaluates to false and no new Xj values are created. The entire evolution is illustrated in Appendix B. Analysis. Throughout the analysis, we use the notation Xi[j] to denote the jth element of Xi. We also fix x = 2. Some of our results are stated for x = 2 while others use a general x for convenience. We also 14 use the abbreviation α = x1/p = 21/p. We first show how our scheme can be used to obtain an algorithm for Flow. Lemma 2. The scheme of Algorithm 4 gives rise to a deterministic algorithm for Flow with competitive ratio p+4 p Proof. W.l.o.g., we assume that the warm-up period in Flow is time(cid:80) · maxj max Xj avg Xj . x (if not, then we scale our scheme). We initialize the p partitions with X1. The transition from Xi to Xi+1 in our scheme should be understood as a two-step process: First, the merge operation takes place (i.e., the advancing of some super-partition), which either creates an empty partition to the right, or the last partition has been merged with more incoming flow. In case an empty partition is created, it is then filled with flow up to value Xi+1[p]. When our scheme terminates but the flow has not yet ended, then we simply repeat the scheme, where all values are scaled. To see that this is possible, let Xmax be the last partition created by Algorithm 4, and observe that Xmax[i] = x p . Hence, the final configuration is a scaled version of the initial configuration (by factor x j=1 S1[j], while X1[i] = x p (cid:80)p p(cid:80)p x∈S1 − 1 i−1 i j=1 S1[j]). It is therefore enough to assume that the flow stops during the first iteration of the scheme. At that moment, the last partition may not be entirely filled. Consider a final partitioning such that the first p − 1 partitions coincide with the weights of the first p − 1 values of some Xi, and the last partition is of some arbitrary weight y ≤ Xi[p]. Then, the competitive ratio is bounded by: max{Xi[1], . . . , Xi[p − 1], y} (cid:16) y +(cid:80)p−1 1 p j=1 Xi[j] (cid:17) ≤ max Xi avg Xi−1 ≤ p + 4 p · max Xi avg Xi , where we used avg Xi−1 ≥ p+4 p avg Xi, which will be proved below. The next lemma was used in the proof of the previous lemma. Lemma 3. Let x = 2. Then, for every i: avg Xi−1 ≥ p p + 4 avg Xi. Proof. First, by investigating the structure of Xi, it can be seen that max Xi ≤ 2·min Xi, for every Xi, and max Xi ≤ 2 max Xi−1. These two bounds give max Xi ≤ 4 min Xi−1, which implies max Xi ≤ 4 avg Xi−1. Then, avg Xi = 1 p x = · 1 p · (cid:88) x∈Xi Xi[p] +  ≤ 1 p y 4 avg Xi−1 + ·  y (cid:88) y∈Xi−1 (cid:88) y∈Xi−1 = p + 4 p avg Xi−1. Thus, in order to obtain a good algorithm for Flow, we need to bound the max-over-average ratio max Xj avg Xj , for every Xj, of the scheme. To this end, observe that Xi is of the form: Xi = S1S2 . . . Sj [ Sj+1 . . . Sk ], (cid:124) (cid:123)(cid:122) (cid:125) (cid:124) (cid:123)(cid:122) (cid:125) Length l Length l + 1 where S1, . . . , Sj are of length l, Sj+1 . . . , Sk are of length l + 1, Sj+1 . . . , Sk may or may not exist, and the last super-partition of Xi may be incomplete (not entirely included in Xi). Using Lemma 4, it can be seen that for base x = 2, the maximum of Xi always lies in either the right-most super-partition of length l that is entirely included in Si, or in the incomplete super-partition of length l (if it exists). In general, in order to describe the current Xi, let L, t, m be such that L is a power of two, 1 ≤ t ≤ L/2, all super-partitions have lengths either l = L − t or l + 1 = L − t + 1, and m is the rightmost index of the super-partition that has length L − t and is entirely included in Xi. Such a triple (L, t, m) completely describes the state of Xi. 15 First, we need an expression for max Xi. This quantity depends on the current lengths of the super-partitions and the value m, and using the quantities L and l, we obtain the following lemma: Our analysis requires a structural result on super-partitions, which we give first. In the following lemma, we relate the maximum value of a given super-partition to its length, and we give an expression for the total weight of a super-partition. Lemma 4. Fix a super-partition Si and suppose that its current length is l = L − t, where L is a power of two and 1 ≤ t ≤ L/2. Let maxi denote the maximum at that moment and sumi the total weight of Si. Then: sumi = αi α − 1 , and maxi = αi · α2tp/L · 1 − α−2p/L α − 1 . Proof. The first claim is easy: We have p(cid:88) j=1 sum1 = αj = αp+1 − α α − 1 = α α − 1 , and sumi = αi−1 · sum1 , which gives the result. S1 is of length L. Then, the kth element of S1 is s1,k = α(k−1)p/L · s1,1 = α(k−1)p/L ·(cid:80)p/L Denote by si,j the jth element of Si. Concerning the maximum, suppose first that super-partition j=1 αj = . The corresponding elements in Si, when it has length L, are si,k = αi−1 · s1,k = α−1 α(k−1)p/L · αp/L+1−α αi−1 · α(k−1)p/L · αp/L+1−α maxi = si,2t−1 + si,2t = (1 + αp/L) · α(2t−2)p/L · αi−1 · αp/L+1 − α . Consider now the general setting, when Si is of length l = L − t. Then: = αi · α2(t−1)p/L · α2p/L − 1 α − 1 α − 1 α−1 . Bounding avg Xi is the challenging part. Based on the triple (L, t, m), our analysis requires a bound on c, the number of super-partitions entirely included in Xi. It is easy to see that c is at least (cid:100) p+m−l l+1 (cid:101). This, however, introduces difficulties, since optimizing over such a function is difficult if we need a fine enough optimization that does not allow us to ignore rounding effects (i.e., the estimate c ≥ p+m−l is not good enough in some cases). In Lemma 5 we thus conduct a case distinction: In the easy cases (if c is large), the estimate c ≥ p+m−l is good enough for our purposes and the max-over-average ratio follows by a careful calculation. In the other cases (c is small), we analyze the max-over-average ratio using reference points: A reference point is one where all partitions included in Xi have equal length which is a power of two (for example the initial configuration is one). We then study the behavior of the scheme between two consecutive reference points and obtain a different bound. Lemma 5 is the most technical part of this analysis. l+1 l+1 . The following bounds hold for each Xi with configuration (L, t, m), with an Lemma 5. Let R = max Xi avg Xi additive error term in O(1/p): (cid:40) (cid:41) . R ≤ min ln 2 · 22t/L(1 − 2−2/L) p+1−l p(l+1) − 1 2 2p · (22/L − 1)L 21/ ln 2 ln 2 · (p + 2 − L) , , 2 4 ln 2 · (22/L − 1) · 2− 2p p (21/p − 1) + 2−1/p − 2−c/p cL c+2 Proof. The first and second bounds will be used when there are relatively many super-partitions in Xi. In that case, we can afford ignoring the remainder part Sc+1 (when estimating the average) and also use the bound on c that ignores rounding effects. Thus, the average is estimated as follows: p · avg Xi ≥ c(cid:88) sumt = t=1 (cid:80)c 1 αt α − 1 αc+1 − α (α − 1)2 . = Recall that the current maximum is achieved in Sm, so all we need is to bound the ratio maxm/ avg Xi. Using the expression for maxm given in Lemma 4, we obtain: maxm avg Xi ≤ p(α − 1)αm−1α2tp/L(1 − α−2p/L) αc − 1 16 ≤ ln 2 · αm−1α2tp/L(1 − α−2p/L) , p+m l+1 −1 − 1 α where we used the approximation p(1 − α) ≈ ln 2 which holds with an error bounded by 1/p (which l+1 − 1. Differentiation shows that the right hand side is we will henceforth omit) and the bound c ≥ p+m non-increasing as a function of m and is maximum at m = 1, which gives the first bound: maxm avg Xi ≤ ln 2 · α2tp/L(1 − α−2p/L) l+1 − 1 p−l α . This can be used to obtain bounds for smaller values of l. For larger values, we use the bound ex > 1 + x, applied to α , which gives, after replacing α = 21/p, l+1 − 1 in the denominator, which gives α p−l p(l+1) − 1 > ln 2·(p−l) l+1 − 1 = 2 p−l p(l+1) p−l A simple and crude optimization w.r.t. t, where we replace t = 1 in the denominator and then optimize the numerator w.r.t. t (giving t =(cid:0)1 − 1 maxm avg Xi ≤ p · (1 − 2−2/L) · 22t/L(L − t + 1) p − L + t (cid:1) L + 1), gives the second bound: . 2 ln 2 maxm avg Xi ≤ 2p · (22/L − 1)L 21/ ln 2 ln 2 · (p + 1 − L) . Now, consider the case when there are few super-partitions in Xi, i.e., c is small. We need a more delicate bound on avg Xi (by losing precision when computing maxXi: uncertainty principle in action), so we shift the reference point to the time step when there are exactly c super-partitions in Xi and no incomplete super-partitions. Let (L, tc, mc) be the tuple describing this point. We concentrate on the process of going from (L, tc, mc) to (L, tc+1, mc+1). Note that (L − tc)mc + (c − mc)(L − tc + 1) = p, and 0 < mc < c, so we have L − p c + 1. Consider an arbitrary point (L, t, m) during this process (note that L is the same). What is the number T of elements of Sc+1 that are in Xi? Note that at (L, tc + 1, 1), T = c − mc. Next, each time t increments, T increases by at least c (not counting the possible action inside Sc+1). Thus, T ≥ c − mc + (t − tc) · c + m ≥ (t − tc) · c + m + 1. This helps us estimate the sum slast of the elements of Sc+1 in Xi at time (L, t, m). Note that the length of Sc+1 is L − t + 1, so c ≤ tc ≤ L − p c + 1 Now, we can bound the average i=1 i=1 s1,i = αc−1 · αT +t − α α − 1 slast ≥ T +t−1(cid:88) sc+1,i = αc−1 · T +t−1(cid:88) c(cid:88) (α − 1)2 · (αT +t+c−1(α − 1) + αc − α) (α − 1)2 · (αm · αc(t−tc+1)(α − 1) + αc − α), sumi + slast ≥ αc+1 − α (α − 1)2 + αc−1 · αT +t − α α − 1 ≥ i=1 = 1 1 . p · avg Xi = and the max-over-average ratio maxm avg Xi ≤ p(α − 1)αm · α2tp/L · (1 − α−2p/L) αm · αc(t−tc+1)(α − 1) + αc − α ≤ ln 2 · αc+1 · α2tp/L · (1 − α−2p/L) αc−1 · αc(t−tc+1)(α − 1) + αc − α ln 2 · (1 − α−2p/L) · α2tp/L αc+2(α − 1) · αctα−ctc + α−1 − α−c = where we let m take its maximum possible value m = c + 1, and used the approximation p(α − 1) ≈ ln 2. The last expression is a decreasing function of t, which can be checked by differentiation (the derivative is A(2/L − c/p) + B for positive values A, B), so t = tc gives the worst-case bound maxm avg Xi ≤ ln 2 · (1 − 2−2/L) · 22tc/L p (21/p − 1) + 2−1/p − 2−c/p c+2 2 ≤ 2 4 ln 2 · (22/L − 1) · 2− 2p p (21/p − 1) + 2−1/p − 2−c/p cL c+2 , where we also used the bound tc ≤ L − p/c + 1 (observed above) in the second inequality. This proves the third inequality of the lemma. 17 Figure 1: Extension of our scheme to arbitrary p. The encircled points correspond to the max-over-average ratio of powers of two. The blue curve is the bound proved in our analysis. Combining the previous results, we obtain the following results: Theorem 8. For every Xi in our scheme, the max-over-average ratio is bounded as: max Xi avg Xi ≤ ln 2√ 2 − 1 + O(1/p) ≈ 1.673 + O(1/p) . Proof. We can assume that p is large, e.g. p ≥ 256, since we checked smaller values with a computer (see below). With this assumption, we can use the bounds in Lemma 5. The first bound gives the required approximation ratio for small values of l, 1 ≤ l ≤ 8, by checking each case separately. The second bound of the lemma gives the ratio for 8 ≤ l ≤ p/16. The remaining cases are when l > p/16, i.e. c ≤ 16. These cases can again be individually checked for each c, by using the third bound given by Lemma 5. Corollary 2. If p is a power of two, then there is an algorithm for Flow with competitive ratio ln 2√ 2−1 + O(1/p) ≈ 1.673 + O(1/p). Last, similar to Corollary 1, via rounding, an algorithm for Flow can be used for Part while incurring an error term that depends on the weights of the sequence. Corollary 3. There is a deterministic preemptive online algorithm for Part with competitive ratio 1.68 + O(1/p) + O(max/S), where S is the total weight of the sequence and max is the maximum element of the sequence. Extending Our Scheme to Arbitrary Number of Partitions. Our scheme can equally be applied to arbitrary values of p, and we experimentally verified that max-over-average ratios better than two are obtained. Conducting a rigorous analysis for values of p that are not a power of two poses further complications and proves challenging. A case in point are the maxima of super-partitions, which could not be computed according to Lemma 4, and many rounding problems. In Figure 1, we plot the max-over-average ratio of our scheme against the number of partitions p. The plot shows that the power of two cases are the ones that give the best competitive ratio. The chaotic behavior of the plot also indicates that many mechanisms within our scheme are at work at the same time that need to be bounded appropriately. We thus pose as an open problem: Can we obtain an analyzable partitioning scheme for arbitrary p with max-over-average ratio strictly better than 2? 5.2.2 Lower Bound Consider an arbitrary current partitioning in Flow, and let xmax denote the current bottleneck value. For an appropriately chosen value α ∈ (1, 2), partition the current partitions into two categories L, H, so 18 1.55 1.6 1.65 1.7 1.75 1.8 1.85 1.9 0 200 400 600 800 1000 1200Max-over-average RatioNumber of Partitionsmax-over-avgln(2) / (sqrt(2) - 1)powers of two that partitions in L are of weight at most xmax α , and H are all other partitions. Our argument is based on the observation that if too many partition are in L, then the current competitive ratio cannot be good. However, if only very few partitions are in L, then after consuming only very little flow from the input, two partitions in H need to be merged with each other, which results in a large increase in the bottleneck value. This idea is formalized in the following theorem: Theorem 9. Every deterministic preemptive online algorithm for Flow has an approximation factor of at least 5 2 ≈ 1.086. 2 − √ Proof. Let Alg be a deterministic f -approximation algorithm, for some f > 1. Suppose that the input is a sequence of unit weight requests. Consider a point in time when the total weight xmax of a heaviest partition is large enough so that rounding effects do not matter. Denote the weights of the partitions by a1, . . . , ap. Since Alg is an f -approximation algorithm, p(cid:88) i=1 xmax ≤ f p ai. (5) Let α ∈ (1, 2) be a parameter whose value will be optimized later. Partition the set of indices [p] into sets L and H such that i ∈ L if ai < xmax α , and i ∈ H otherwise. Using this definition in Inequality 5, we obtain pxmax f ≤ L · xmax α + (p − L) · xmax ⇔ L ≤ p · 1 − 1/f 1 − 1/α . We will prove now that after processing the next (L + 1) 2xmax at least one partition of weight at least 2xmax α α . Indeed, consider the sequence: requests from the input sequence, there is X = a1a2 . . . ap (cid:124)(cid:123)(cid:122)(cid:125) 1 . . . 1 (L+1) 2xmax α and, for the sake of a contradiction, suppose that there is a partitioning of this sequence into p parts with maximum partition weight smaller than 2xmax α . By Lemma 1, such a partitioning would be found α − 1) on X read from right to left. Notice first that every resulting partition by a run of Probe( 2xmax contains at most one element from H (call such an element heavy), as the sum of two heavy elements α − 1. The first L + 1 partitions created by Probe each consist of 1s only. already exceeds the bound 2xmax Since there are H = p − L heavy elements, this implies that Probe creates another H partitions each containing one heavy element, which totals to p + 1 partitions, a contradiction. ones from the input sequence, the average weight of a Thus, after processing the next (L + 1) 2xmax α partition is bounded by: A ≤ H · xmax + L · xmax (cid:18) α − 1 (cid:18) 2f + α − 3 1 + L 3 = xmax p = xmax f (α − 1) + 2 pα (cid:19) , α p α + (L + 1) · 2xmax (cid:32) 1 + p · 1 − 1 1 − 1 ≤ xmax (cid:19) 2 pα + f = xmax · (p − L) + L · 3 (cid:33) p α − 1 · 3 2 pα + p α α + 2 α where we applied Inequality 6, and as proved above, the maximum value then is at least x(cid:48) Since Alg is a f -approximation algorithm, we have x(cid:48) max ≤ f · A, so max ≥ 2xmax α . which implies that 2f ≥ 5 −(cid:0)α + 2 (cid:1) − O(1/p). The function g(α) = α + 2/α achieves its minimum at 2 − √ 2 − O(1/p), giving the result. 2, which implies that f ≥ 5 f (α − 1) + O(1/p) α = √ α α , 2xmax ≤ f · xmax (cid:18) 2f + α − 3 (cid:19) This lower bound argument shows that competitive ratios of at least 1.086 occur repeatedly while processing the input sequence. Recall that the lower bound for Part given in Theorem 7 only holds for two specific input lengths. 19 References [1] S. H. Bokhari. Partitioning problems in parallel, pipeline, and distributed computing. IEEE Trans. Comput., 37(1):48 -- 57, January 1988. URL: http://dx.doi.org/10.1109/12.75137, doi: 10.1109/12.75137. [2] Allan Borodin and Ran El-Yaniv. Online Computation and Competitive Analysis. Cambridge University Press, New York, NY, USA, 1998. [3] Ashish Chiplunkar, Sumedh Tirodkar, and Sundar Vishwanathan. On randomized algorithms for matching in the online preemptive model. In Algorithms - ESA 2015 - 23rd Annual European Symposium, Patras, Greece, September 14-16, 2015, Proceedings, pages 325 -- 336, 2015. [4] Yuval Emek, Pierre Fraigniaud, Amos Korman, and Adi Ros´en. Online computation with advice. Theor. Comput. Sci., 412(24):2642 -- 2656, May 2011. [5] Leah Epstein, Asaf Levin, Danny Segev, and Oren Weimann. Improved bounds for online preemptive matching. In 30th International Symposium on Theoretical Aspects of Computer Science, STACS 2013, February 27 - March 2, 2013, Kiel, Germany, pages 389 -- 399, 2013. [6] Joan Feigenbaum, Sampath Kannan, Andrew McGregor, Siddharth Suri, and Jian Zhang. On graph problems in a semi-streaming model. Theor. Comput. Sci., 348(2):207 -- 216, December 2005. URL: http://dx.doi.org/10.1016/j.tcs.2005.09.013, doi:10.1016/j.tcs.2005.09.013. [7] Greg N. Frederickson. Optimal algorithms for tree partitioning. SODA '91, pages 168 -- 177, Philadel- phia, PA, USA, 1991. URL: http://dl.acm.org/citation.cfm?id=127787.127822. [8] Edward F. Grove. Online bin packing with lookahead. In Proceedings of the Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '95, pages 430 -- 436, 1995. [9] Magn´us M. Halld´orsson, Kazuo Iwama, Shuichi Miyazaki, and Shiro Taketomi. Online independent sets. Theor. Comput. Sci., 289(2):953 -- 962, October 2002. [10] Yijie Han, Bhagirath Narahari, and Hyeong-Ah Choi. Mapping a chain task to chained processors. Inf. Process. Lett., 44(3):141 -- 148, 1992. URL: http://dblp.uni-trier.de/db/journals/ipl/ipl44. html#HanNC92. [11] Pierre Hansen and Keh-Wei Lih. Improved algorithms for partitioning problems in parallel, pipelined, and distributed computing. IEEE Trans. Comput., 1992. [12] Chinmay Karande, Aranyak Mehta, and Pushkar Tripathi. Online bipartite matching with unknown distributions. In Proceedings of the Forty-third Annual ACM Symposium on Theory of Computing, STOC '11, pages 587 -- 596, New York, NY, USA, 2011. ACM. URL: http://doi.acm.org/10.1145/ 1993636.1993715, doi:10.1145/1993636.1993715. [13] R. M. Karp, U. V. Vazirani, and V. V. Vazirani. An optimal algorithm for on-line bipartite matching. In Proceedings of the Twenty-second Annual ACM Symposium on Theory of Computing, STOC '90, pages 352 -- 358, New York, NY, USA, 1990. ACM. URL: http://doi.acm.org/10.1145/100216. 100262, doi:10.1145/100216.100262. [14] Sanjeev Khanna, S. Muthukrishnan, and Steven Skiena. Efficient array partitioning. In ICALP, volume 1256, pages 616 -- 626. Springer Berlin Heidelberg, 1997. URL: http://dx.doi.org/10.1007/ 3-540-63165-8_216. [15] Christian Konrad. Two-constraint domain decomposition with space filling curves. Parallel Comput., 37(4-5):203 -- 216, April 2011. URL: http://dx.doi.org/10.1016/j.parco.2011.03.002, doi:10. 1016/j.parco.2011.03.002. [16] Christian Konrad. Streaming partitioning of sequences and trees. In 19th International Conference on Database Theory, ICDT 2016, Bordeaux, France, March 15-18, 2016, pages 13:1 -- 13:18, 2016. 20 [17] Mark S. Manasse, Lyle A. McGeoch, and Daniel D. Sleator. Competitive algorithms for server prob- lems. J. Algorithms, 11(2):208 -- 230, May 1990. URL: http://dx.doi.org/10.1016/0196-6774(90) 90003-W, doi:10.1016/0196-6774(90)90003-W. [18] Fredrik Manne and Bjørn Olstad. Efficient partitioning of sequences. IEEE Trans. Comput., 44(11):1322 -- 1326, November 1995. URL: http://dx.doi.org/10.1109/12.475128, doi:10.1109/ 12.475128. [19] Fredrik Manne and Tor Sørevik. Optimal partitioning of sequences. J. Algorithms, 19(2):235 -- 249, September 1995. URL: http://dx.doi.org/10.1006/jagm.1995.1035, doi:10.1006/jagm.1995. 1035. [20] Serge Miguet and Jean-Marc Pierson. Heuristics for 1d rectilinear partitioning as a low cost and high quality answer to dynamic load balancing. HPCN Europe '97, pages 550 -- 564, London, UK, UK, 1997. Springer-Verlag. URL: http://dl.acm.org/citation.cfm?id=645561.659355. [21] Ali Pinar and Cevdet Aykanat. Fast optimal load balancing algorithms for 1d partitioning. J. Parallel Distrib. Comput., 64(8):974 -- 996, August 2004. URL: http://dx.doi.org/10.1016/j.jpdc.2004. 05.003, doi:10.1016/j.jpdc.2004.05.003. [22] Isabelle Stanton. Streaming balanced graph partitioning algorithms for random graphs. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '14, pages 1287 -- 1301. SIAM, 2014. URL: http://dl.acm.org/citation.cfm?id=2634074.2634169. [23] Isabelle Stanton and Gabriel Kliot. Streaming graph partitioning for large distributed graphs. In Proceedings of the 18th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD '12, pages 1222 -- 1230, New York, NY, USA, 2012. ACM. URL: http://doi.acm.org/ 10.1145/2339530.2339722, doi:10.1145/2339530.2339722. [24] J. D. Ullman. The performance of a memory allocation algorithm. Technical report, Princeton University, 1971. [25] Jeffrey S. Vitter. Random sampling with a reservoir. ACM Trans. Math. Softw., 11(1):37 -- 57, March 1985. URL: http://doi.acm.org/10.1145/3147.3165, doi:10.1145/3147.3165. [26] Andrew Chi-Chin Yao. Probabilistic computations: Toward a unified measure of complexity. In Proceedings of the 18th Annual Symposium on Foundations of Computer Science, SFCS '77, pages 222 -- 227, Washington, DC, USA, 1977. IEEE Computer Society. URL: http://dx.doi.org/10. 1109/SFCS.1977.24, doi:10.1109/SFCS.1977.24. [27] Mariano Zelke. Weighted matching in the semi-streaming model. Algorithmica, 62(1-2):1 -- 20, February 2012. URL: http://dx.doi.org/10.1007/s00453-010-9438-5, doi:10.1007/ s00453-010-9438-5. 21 A Barely-random Algorithm for Unit Requests and p = 2 We show that using a single random bit gives a significant improvement over deterministic algorithms. The algorithm A0 places the separator at positions 2i for odd or even i depending on an initial random choice. Algorithm 5 A0 i ← 0 or 1 with probability 1/2 each for each request j = 1 . . . n do if j = 2i then move the separator to the current position i → i + 2 end if end for Denote the competitive ratio of A0 on sequences of length n by RnA0 . Then, we obtain the following ] = 1.5. theorem: Theorem 19. E[RnA0 Proof. Let α ∈ [0, 1) and i ∈ N be such that the sequence length is n = 2 · 2i+α. The bottleneck value of an optimal partition is at least (cid:100) n 2(cid:101) = (cid:100)2i+α(cid:101). Since, 2i+2 > n, the algorithm puts the separator either at position 2i or 2i+1, each with probability 1/2. In the first case, the bottleneck value is n − 2i, while in the second case it is 2i+1. Thus, E[RnA0 ] = · n − 2i + 2i+1 (cid:100)n/2(cid:101) 1 2 ≤ 1 + 1 2α+1 ≤ 1.5 . B Complete Scheme for p = 4 (cid:122) x (cid:125)(cid:124) S1 (cid:123) 1 4 , x 2 4 , x 3 4 , x 4 4 3 4 , x 4 4 , x (cid:123) 5 4 (cid:125)(cid:124) S2 (cid:122) 2 x 4 , x x 1 4 (1 + x 1 4 ), x 3 4 , x 4 4 x 2 4 , x 3 4 , x 4 4 , x 5 4 1 4 (1 + x 1 4 ), x 3 4 , x 4 4 x x 2 4 (1 + x 1 4 ), x 4 4 , x 5 4 (cid:122) 3 x 4 , x x 3 4 , x x (cid:122) (cid:125)(cid:124) S3 4 4 , x (cid:123) 6 4 5 4 , x 4 4 , x 5 4 , x 6 4 3 4 , x 4 4 , x 5 4 , x 6 4 4 4 , x x x 4 4 , x x (cid:125)(cid:124) S4 5 4 , x (cid:123) 7 4 6 4 , x 5 4 , x 6 4 , x 7 4 1 4 (1 + x 1 4 ), x 3 4 , x 4 4 x x 2 4 (1 + x 1 4 ), x 4 4 , x 5 4 x 3 4 (1 + x 1 4 ), x 5 4 , x 6 4 4 4 , x x 5 4 , x 6 4 , x 7 4 4 4 , x 5 4 , x 6 4 , x 7 4 1 4 (1 + x 1 4 ), x 3 4 , x 4 4 x x 2 4 (1 + x 1 4 ), x 4 4 , x 5 4 x 1 4 (1 + x 1 4 ), x 3 4 (1 + x 1 4 ) x x 2 4 (1 + x 1 4 ), x 4 4 , x 5 4 1 4 ), x 5 4 , x 6 4 1 4 ), x 5 4 , x 6 4 x 4 4 (1 + x x 4 4 (1 + x 1 4 ), x 6 4 , x 7 4 1 4 ), x 6 4 , x 7 4 1 4 (1 + x 1 4 )(1 + x x 2 4 ) 2 4 (1 + x 1 4 )(1 + x 3 4 (1 + x 1 4 )(1 + x 2 4 ) x 4 4 (1 + x 1 4 )(1 + x 2 4 ) x x x x 1 4 (1 + x 1 4 ), x 3 4 (1 + x 1 4 ) x 1 4 (1 + x 1 4 ), x 3 4 (1 + x 1 4 ) x 1 4 (1+x 1 4 ), x 3 4 (1+x 1 4 ) x 1 4 (1+x 1 4 ), x 3 4 (1+x x 1 4 (1+x 1 4 )(1+x 2 4 ) x 1 4 (1+x 1 4 )(1+x 2 4 ) x 1 4 (1 + x 1 4 )(1 + x 2 4 ) x 1 4 ) x x x x 2 4 (1 + x 1 4 ), x 4 4 (1 + x 1 4 ) 2 4 (1 + x 1 4 ), x 4 4 (1 + x 1 4 ) 1 4 ), x 5 4 , x 6 4 1 4 ), x 5 4 , x 6 4 4 4 (1 + x 4 4 (1 + x 1 4 ), x 6 4 , x 7 4 1 4 ), x 6 4 , x 7 4 2 4 (1+x 1 4 ), x 4 4 (1+x 1 4 ) 3 4 (1+x 1 4 ), x 5 4 (1+x 1 4 ) 4 4 (1+x 1 4 ), x 6 4 , x 7 4 2 4 (1+x 1 4 ), x 4 4 (1+x 3 4 (1+x 1 4 ), x 5 4 (1+x 4 4 (1+x 1 4 ), x 6 4 (1+x 1 4 ) 2 4 (1+x 1 4 ), x 4 4 (1+x 3 4 (1+x 1 4 ), x 5 4 (1+x 1 4 ) 4 4 (1+x 1 4 ), x 6 4 (1+x 1 4 ) 2 4 (1+x 1 4 )(1+x 2 4 ) 3 4 (1+x 1 4 ), x 5 4 (1+x 1 4 ) 4 4 (1+x 1 4 ), x 6 4 (1+x 1 4 ) 2 4 (1 + x 1 4 )(1 + x 2 4 ) 3 4 (1 + x 1 4 )(1 + x 2 4 ) 4 4 (1 + x 1 4 ), x 6 4 (1 + x 1 4 ) x x x x 1 4 ) x x x 3 4 (1 + x x 3 4 (1 + x x x 3 4 (1 + x 3 4 (1 + x x x 1 4 ) x 1 4 ) x x x 2 4 ) 22
1811.01551
1
1811
2018-11-05T08:37:57
Almost Optimal Distance Oracles for Planar Graphs
[ "cs.DS" ]
We present new tradeoffs between space and query-time for exact distance oracles in directed weighted planar graphs. These tradeoffs are almost optimal in the sense that they are within polylogarithmic, sub-polynomial or arbitrarily small polynomial factors from the na\"{\i}ve linear space, constant query-time lower bound. These tradeoffs include: (i) an oracle with space $\tilde{O}(n^{1+\epsilon})$ and query-time $\tilde{O}(1)$ for any constant $\epsilon>0$, (ii) an oracle with space $\tilde{O}(n)$ and query-time $\tilde{O}(n^{\epsilon})$ for any constant $\epsilon>0$, and (iii) an oracle with space $n^{1+o(1)}$ and query-time $n^{o(1)}$.
cs.DS
cs
Almost Optimal Distance Oracles for Planar Graphs∗ Panagiotis Charalampopoulos1,2, Pawe(cid:32)l Gawrychowski3, Shay Mozes2, and Oren Weimann4 1 Department of Informatics, King's College London, UK, [email protected] 2 Efi Arazi School of Computer Science, The Interdisciplinary Center Herzliya, Israel, 3 Institute of Computer Science, University of Wroc(cid:32)law, Poland, [email protected] 4 Department of Computer Science, University of Haifa, Israel, [email protected] [email protected] Abstract We present new tradeoffs between space and query-time for exact distance oracles in directed weighted planar graphs. These tradeoffs are almost optimal in the sense that they are within polylogarithmic, sub-polynomial or arbitrarily small polynomial factors from the naıve linear space, constant query-time lower bound. These tradeoffs include: (i) an oracle with space1 O(n1+) and query-time O(1) for any constant  > 0, (ii) an oracle with space O(n) and query-time O(n) for any constant  > 0, and (iii) an oracle with space n1+o(1) and query-time no(1). lg Q/ lg n 1 W G '9 6 [1 5] [2 0] C S'0 1 O F SODA'12[37] S O D W G'96[15] E S A '9 6 [1] 1/2 1/3 1/4 1 4/3 3/2 5/3 2 lg S/ lg n A '1 8 [2 2] F O C S ' 1 7 [ 1 STOC'00[11] SODA'06[6] 2 ] Our result 0 Figure 1: Tradeoff of the space (S) vs. the query time (Q) for exact distance oracles in planar graphs on a doubly logarithmic scale, hiding subpolynomial factors. The previous tradeoffs are indicated by solid black lines and points, while our new tradeoff is indicated by the red point at the bottom left. ∗This work was partially supported by the Israel Science Foundation under grant number 592/17. 1The O(·) notation hides polylogarithmic factors. 1 Introduction Computing shortest paths is one of the most fundamental and well-studied algorithmic problems, with numerous applications in various fields. In the data structure version of the problem, the goal is to preprocess a graph into a compact representation such that the distance (or a shortest path) between any pair of vertices can be retrieved efficiently. Such data structures are called distance oracles. Distance oracles are useful in applications ranging from navigation, geographic information systems and logistics, to computer games, databases, packet routing, web search, computational biology, and social networks. The topic has been studied extensively; see for example the survey by Sommer [42] for a comprehensive overview and references. The two main measures of efficiency of a distance oracle are the space it occupies and the time it requires to answer a distance query. To appreciate the tradeoff between these two quantities consider two naıve oracles. The first stores all Θ(n2) pairwise distances in a table, and answers each query in constant time using table lookup. The second only stores the input graph, and runs a shortest path algorithm over the entire graph upon each query. Both of these oracles are not adequate when working with mildly large graphs. The first consumes too much space, and the second is too slow in answering queries. A third quantity of interest is the preprocessing time required to construct the oracle. Since computing the data structure is done offline, this quantity is often considered less important. However, one approach to dealing with dynamic networks is to recompute the entire data structure quite frequently, which is only feasible when the preprocessing time is reasonably small. One of the ways to design oracles with small space is to consider approximate distance oracles (allowing a small stretch in the distance output). However, it turns out that one cannot get both small stretch and small space. In their seminal paper, Thorup and Zwick [44] showed that, assuming the girth conjecture of Erdos [17], there exist dense graphs for which no oracle with size less than n1+1/k and stretch less than 2k − 1 exists. Patra¸scu and Roditty [41] showed that even sparse graphs with O(n) edges do not have distance oracles with stretch better than 2 and subquadratic space, conditioned on a widely believed conjecture on the hardness of set intersection. To bypass these impossibility results one can impose additional structure on the graph. In this work we follow this approach and focus on distance oracles for planar graphs. Distance oracles for planar graphs. The importance of studying distance oracles for planar graphs stems from several reasons. First, distance oracles for planar graphs are ubiquitous in real-world applications such as geographical navigation on road networks [42] (road networks are often theoretically modeled as planar graphs even though they are not quite planar due to tunnels and overpasses). Second, shortest paths in planar graphs exhibit a remarkable wealth of structural properties that can be exploited to obtain efficient oracles. Third, techniques developed for shortest paths problems in planar graphs often carry over (because of intricate and elegant connections) to maximum flow problems. Fourth, planar graphs have proved to be an excellent sandbox for the development of algorithms and techniques that extend to broader families of graphs. As such, distance oracles for planar graphs have been extensively studied. Works on exact distance oracles for planar graphs started in the 1990's with oracles requiring O(n2/Q) space and O(Q) query-time for any Q ∈ [1, n] [1, 15]. Note that this includes the two trivial approaches mentioned above. Over the past three decades, many other works presented exact distance oracles for planar graphs with increasingly better space to query-time tradeoffs [1, 6, 11, 12, 15, 20, 22, 37, 39]. Figure 1 illustrates the advancements in the space/query-time tradeoffs over the years. Until recently, no distance oracles with subquadratic space and polylogarithmic query time were known. Cohen-Addad et al. [12], inspired by Cabello's use of Voronoi diagrams for the diameter problem in 1 planar graphs [7], provided the first such oracle. The currently best known tradeoff [22] is an oracle with O(n3/2/Q) space and O(Q) query-time for any Q ∈ [1, n1/2]. Note that all known oracles with √ nearly linear (i.e. O(n)) space require Ω( n) time to answer queries. The holy grail in this area is to design an exact distance oracle for planar graphs with both linear space and constant query-time. It is not known whether this goal can be achieved. We do know, however, (for nearly twenty years now) that approximate distance oracles can get very close. For any fixed  > 0 there are (1 + )-approximate distance oracles that occupy nearly-linear space and answer queries in polylogarithmic, or even constant time [9, 23, 26, 28, 29, 43, 45]. However, the main question of whether an approximate answer is the best one can hope for, or whether exact distance oracles for planar graphs with linear space and constant query time exist, remained a wide open important and interesting problem. Our results and techniques. In this paper we approach the optimal tradeoff between space and query time for reporting exact distances.We design exact distance oracles that require almost-linear space and answer distance queries in polylogarithmic time. Specifically, given a planar graph of size n, we show how to construct in roughly O(n3/2) time a distance oracle admitting any of the following (cid:104)space, query-time(cid:105) tradeoffs (see Theorem 7 and Corollary 8 for the exact statements). (i) (cid:104) O(n1+),O(log1/ n)(cid:105), for any constant 1/2 ≥  > 0; (ii) (cid:104)O(n log2+1/ n), O(n)(cid:105), for any constant  > 0; (iii) (cid:104)n1+o(1), no(1)(cid:105). Voronoi diagrams. The main tool we use to obtain this result is point location in Voronoi diagrams on planar graphs. The concept of Voronoi diagrams has been used in computational geometry for many years (cf. [2, 13]). We consider graphical (or network) Voronoi diagrams [19, 34]. At a high level, a graphical Voronoi diagram with respect to a set S of sites is a partition of the vertices into S parts, called Voronoi cells, where the cell of site s ∈ S contains all vertices that are closer (in the shortest path metric) to s than to any other site in S. Graphical Voronoi diagrams have been studied and used quite extensively, most notably in applications in road networks (e.g., [14, 16, 25, 40]). Perhaps the most elementary operation on Voronoi diagrams is point location. Given a point (vertex) v, one wishes to efficiently determine the site s such that v belongs to the Voronoi cell of s. Cohen-Addad et al. [12], inspired by Cabello's [7] breakthrough use of Voronoi diagrams in planar graphs, suggested a way to perform point location that led to the first exact distance oracle for planar graphs with subquadratic space and polylogarithmic query time. A simpler and more efficient point location mechanism for Voronoi diagrams in planar graphs was subsequently developed in [22]. In both oracles, the space efficiency is obtained from the fact that the size of the representation of a Voronoi diagram is proportional to the number of sites and not to the total number of vertices. To obtain our result, we add two new ingredients to the point location mechanism of [22]. The first is the use of what might be called external Voronoi diagrams. Unlike previous constructions, instead of working with Voronoi diagrams for every piece in some partition (r-division) of the graph, we work with many overlapping Voronoi diagrams, representing the complements of such pieces. This is analogous to the use of external dense distance graphs in [5,37]. This approach alone leads to an oracle with space O(n4/3) and query time O(log2 n) (see Section 3). The obstacle with pushing this approach further is that the point location mechanism consists of auxiliary data for each piece, whose size is proportional to the size of the complement of the piece, which is Θ(n) rather than the much smaller size of the piece. We show that this problem can be mitigated by using recursion, and 2 storing much less auxiliary data at a coarser level of granularity. This approach is made possible by a more modular view of the point location mechanism which we present in Section 2, along with other preliminaries. The proof of our main space/query-time tradeoffs is given in Section 4 and the algorithm to efficiently construct these oracles is given in Section 5. 2 Preliminaries In this section we review the main techniques required for describing our result. Throughout the paper we consider as input a weighted directed planar graph G = (V (G), E(G)), embedded in the plane. (We use the terms weight and length for edges and paths interchangeably throughout the paper.) We use G to denote the number of vertices in G. Since planar graphs are sparse, E(G) = O(G) as well. The dual of a planar graph G is another planar graph G∗ whose vertices correspond to faces of G and vice versa. Arcs of G∗ are in one-to-one correspondence with arcs of G; there is an arc e∗ from vertex f∗ to vertex g∗ of G∗ if and only if the corresponding faces f and g of G are to the left and right of the arc e, respectively. We assume that the input graph has no negative length cycles. We can transform the graph in a standard [38] way so that all edge weights are non-negative and distances are preserved. With another standard transformation we can guarantee, in O(n log2 n log log n ) time, that each vertex has constant degree and that the graph is triangulated, while distances are preserved and without increasing asymptotically the size of the graph. We further assume that shortest paths are unique; this can be ensured in O(n) time by a deterministic perturbation of the edge weights [18]. Let dG(u, v) denote the distance from a vertex u to a vertex v in G. Multiple-source shortest paths. The multiple-source shortest paths (MSSP) data structure [30] represents all shortest path trees rooted at the vertices of a single face f in a planar graph using a persistent dynamic tree. It can be constructed in O(n log n) time, requires O(n log n) space, and can report any distance between a vertex of f and any other vertex in the graph in O(log n) time. We note that it can be augmented to also return the first edge of this path within the same complexities. The authors of [22] show that it can be further augmented -- within the same complexities -- such that given two vertices u, v ∈ G and a vertex x of f it can return, in O(log n) time, whether u is an ancestor of v in the shortest path tree rooted at x as well as whether u occurs before v in a preorder traversal of this tree. √ Separators and recursive decompositions. Miller [35] showed how to compute, in a bicon- nected triangulated planar graph with n vertices, a simple cycle of size O( n) that separates the graph into two subgraphs, each with at most 2n/3 vertices. Simple cycle separators can be used to recursively separate a planar graph until pieces have constant size. The authors of [32] show how to obtain a complete recursive decomposition tree A of G in O(n) time. A is a binary tree whose nodes correspond to subgraphs of G (pieces), with the root being all of G and the leaves being pieces of constant size. We identify each piece P with the node representing it in A. We can thus abuse notation and write P ∈ A. An r-division [21] of a planar graph, for r ∈ [1, n], is a √ decomposition of the graph into O(n/r) pieces, each of size O(r), such that each piece has O( r) boundary vertices, i.e. vertices that belong to some separator along the recursive decomposition used to obtain P . Another desired property of an r-division is that the boundary vertices lie on a constant number of faces of the piece (holes). For every r larger than some constant, an r-division with few holes is represented in the decomposition tree A of [32]. In fact, it is not hard to see that if the original graph G is triangulated then all vertices of each hole of a piece are boundary vertices. 3 Throughout the paper, to avoid confusion, we use "nodes" when referring to A and "vertices" when referring to G. We denote the boundary vertices of a piece P by ∂P . We refer to non-boundary vertices as internal. We assume for simplicity that each hole is a simple cycle. Non-simple cycles do not pose a significant obstacle, as we discuss at the end of Section 4. It is shown in [32, Theorem 3] that, given a geometrically decreasing sequence of numbers (rm, rm−1, . . . , r1), where r1 is a sufficiently large constant, ri+1/ri = b for all i for some b > 1, and rm = n, we can obtain the ri-divisions for all i in time O(n) in total. For convenience we define the only piece in the rm division to be G itself. These r-divisions satisfy the property that a piece in the ri-division is a -- not necessarily strict -- descendant (in A) of a piece in the rj-division for each j > i. This ancestry relation between the pieces of an r-division can be captures by a tree T called the recursive r-division tree. The boundary vertices of a piece P ∈ A that lie on a hole h of P separate the graph G into two subgraphs G1 and G2 (the cycle is in both subgraphs). One of these two subgraphs is enclosed by the cycle and the other is not. Moreover, P is a subgraph of one of these two subgraphs, say G1. We then call G2 the outside of hole h with respect to P and denote it by P h,out. In the sections where we assume that the boundary vertices of each piece lie on a single hole that is a simple cycle, the outside of this hole with respect to P is G \ (P \ ∂P ) and to simplify notation we denote it by P out. Additively weighted Voronoi diagrams. Let H be a directed planar graph with real edge- lengths, and no negative-length cycles. Assume that all faces of H are triangles except, perhaps, a single face h. Let S be the set of vertices that lie on h. The vertices of S are called sites. Each site u ∈ S has a weight ω(s) ≥ 0 associated with it. The additively weighted distance between a site s ∈ S and a vertex v ∈ V , denoted by dω(s, v) is defined as ω(s) plus the length of the s-to-v shortest path in H. Definition 1. The additively weighted Voronoi diagram of (S, ω) (VD(S, ω)) within H is a partition of V (H) into pairwise disjoint sets, one set Vor(s) for each site s ∈ S. The set Vor(s), which is called the Voronoi cell of s, contains all vertices in V (H) that are closer (w.r.t. dω(. , .)) to s than to any other site in S. 1 be the graph obtained from VD∗ There is a dual representation VD∗(S, ω) (or simply VD∗) of a Voronoi diagram VD(S, ω). Let H∗ be the planar dual of H. Let VD∗ 0 be the subgraph of H∗ consisting of the duals of edges uv of H such that u and v are in different Voronoi cells. Let VD∗ 0 by contracting edges incident to degree-2 vertices one after another until no degree-2 vertices remain. 1 are called Voronoi vertices. A Voronoi vertex f∗ (cid:54)= h∗ is dual to a face f such The vertices of VD∗ that the vertices of H incident to f belong to three different Voronoi cells. We call such a face trichromatic. Each Voronoi vertex f∗ stores for each vertex u incident to f the site s such that u ∈ Vor(s). Note that h∗ (i.e. the dual vertex corresponding to the face h to which all the sites are incident) is a Voronoi vertex. Each face of VD∗ 1 corresponds to a cell Vor(s). Hence there are at most S faces in VD∗ 1. By sparsity of planar graphs, and by the fact that the minimum degree of a 1 is O(S). vertex in VD∗ Finally, we define VD∗ to be the graph obtained from VD∗ 1 after replacing the node h∗ by multiple copies, one for each occurrence of h as an endpoint of an edge in VD∗ 1. It was shown in [22] that VD∗ is a forest, and that, if all vertices of h are sites and if the additive weights are such that each site is in its own nonempty Voronoi cell, then VD∗ is a ternary tree. See Fig. 2 (also used in [22]) for an illustration. 1 is 3, the complexity (i.e., the number of vertices, edges and faces) of VD∗ Point location in Voronoi diagrams. A point location query for a node v in a Voronoi diagram VD asks for the site s of VD such that v ∈ Vor(s) and for the additive distance from s to v. 4 Figure 2: A planar graph (black edges) with four sites on the infinite face together with the dual Voronoi diagram VD∗ (in blue). The sites are shown together with their corresponding shortest path trees (in turquoise, red, yellow, and green). Gawrychowski et al. [22] described a data structure supporting efficient point location, which is captured by the following theorem. Theorem 2 ([22]). Given an O(H log H)-sized MSSP data structure for H with sources S, and after an O(S)-time preprocessing of VD∗, point location queries can be answered in time O(log2 H). the presentation is a bit more modular. We will later adapt the implementation in Section 4. We now describe this data structure. The data structure is essentially the same as in [22], but Recall that H is triangulated (except the face h). For technical reasons, for each face f (cid:54)= h of H with vertices y1, y2, y3 we embed three new vertices vf 3 inside f and add a directed 0-length edge from yi to vf i . The main idea is as follows. In order to find the Voronoi cell Vor(s) to which a query vertex v belongs, it suffices to identify an edge e∗ of VD∗ that is adjacent to Vor(s). Given e∗ we can simply check which of its two adjacent cells contains v by comparing the distances from the corresponding two sites to v. The point location structure is based on a centroid decomposition of the tree VD∗ into connected subtrees, and on the ability to determine which of the subtrees is the one that contains the desired edge e∗. The preprocessing consists of just computing a centroid decomposition of VD∗. A centroid of an n-node tree T is a node u ∈ T such that removing u and replacing it with copies, one for each edge incident to u, results in a set of trees, each with at most n+1 edges. A centroid always exists in a tree with at least one edge. In every step of the centroid decomposition of VD∗, we 2 work with a connected subtree T ∗ of VD∗. Recall that there are no nodes of degree 2 in VD∗. If there are no nodes of degree 3, then T ∗ consists of a single edge of VD∗, and the decomposition terminates. Otherwise, we choose a centroid c∗, and partition T ∗ into the three subtrees T ∗ 1 , T ∗ obtained by splitting c∗ into three copies, one for each edge incident to c∗. Clearly, the depth of the recursive decomposition is O(log S). The decomposition can be computed in O(S) time and can be represented as a ternary tree which we call the centroid decomposition tree, in O(S) space. Each 0 , T ∗ 2 1 , vf 2 , vf 5 non-leaf node of the centroid decomposition tree corresponds to a centroid vertex c∗, which is stored explicitly. We will refer to nodes of the centroid decomposition tree by their associated centroid. Each node also corresponds implicitly to the subtree of VD∗ of which c∗ is the centroid. The leaves of the centroid decomposition tree correspond to single edges of VD∗, which are stored explicitly. Point location queries for a vertex v in the Voronoi diagram VD are answered by employing procedure PointLocate(VD∗ , v) (Algorithm 1), which takes as input the Voronoi diagram, rep- resented by the centroid decomposition of VD∗, and the vertex v. This in turn calls the recursive procedure HandleCentroid(VD∗ , c∗, v) (Algorithm 2), where c∗ is the root centroid in the centroid decomposition tree of VD∗. We now describe the procedure HandleCentroid. It gets as input the Voronoi diagram, represented by its centroid decomposition tree, the centroid node c∗ in the centroid decomposition tree that should be processed, and the vertex v to be located. It returns the site s such that v ∈ Vor(s), and the additive distance to v. If c∗ is a leaf of the centroid decomposition, then its corresponding subtree of VD∗ is the single edge e∗ we are looking for (Lines 1-6). Otherwise, c∗ is a non-leaf node of the centroid decomposition tree, so it corresponds to a node in the tree VD∗, which is also a vertex of the dual H∗ of H. Thus, c is a face of H. Let the vertices of c be y1, y2 and y3. We obtain si, the site such that yi ∈ Vor(si), from the representation of VD∗ (Line 7). (Recall that si (cid:54)= sk if i (cid:54)= k since c is a trichromatic face.) Next, for each i, we retrieve the additive distance from si to v. Let sj be the site among them with minimum additive distance to v. If v is an ancestor of the node yj in the shortest path tree rooted at sj, then v ∈ Vor(sj) and we are done. Otherwise, handling c consists of finding the child c(cid:48)∗ of c∗ in the centroid decomposition tree whose corresponding subtree contains e∗. It is shown in [22] that identifying c(cid:48)∗ amounts to determining a certain left/right relationship between v and vc j is the artificial vertex embedded inside the face c with an incoming 0-length edge from yj.) We next make this notion more precise. j . (Recall that vc Definition 3. For a tree T and two nodes x and y, such that none is an ancestor of the other, we say that x is left of y if the preorder number of x is smaller than the preorder number of y. Otherwise, we say that x is right of y. It is shown in [22, Section 4] that given the left/right/ancestor relationship of v and vc j , one can determine, in constant time, the child of c∗ in the centroid decomposition tree containing e∗. We call the procedure that does this NextCentroid. Having found the next centroid in Line 15, HandleCentroid moves on to handle it recursively. The efficiency of procedure HandleCentroid depends on the time to compute distances in H (Lines 4 and 9) and the left/right/ancestor relationship (Line 11). Given an MSSP data structure for H, with sources S, each of these operations can be performed in time O(log H) and hence Theorem 2 follows. Algorithm 1 PointLocate(VD∗, v) Input: The centroid decomposition of the dual representation VD∗ of a Voronoi diagram VD and a vertex v. Output: The site s of VD such that v ∈ Vor(s) and the additive distance from s to v. 1: c∗ ← root centroid in the centroid decomposition of VD∗ 2: return HandleCentroid(VD∗ , c∗, v) 6 , c∗, v) Algorithm 2 HandleCentroid(VD∗ Input: The centroid decomposition of the dual representation VD∗ of a Voronoi diagram, a centroid c∗ and a vertex v that belongs to the Voronoi cell of some descendant of c∗ in the centroid decomposition of VD∗. Output: The site s of VD such that v ∈ Vor(s) and the additive distance from s to v. 1: if c∗ is a leaf then 2: 3: 4: 5: 6: s1, s2 ← sites corresponding to c∗ for k = 1, 2 do j ← argmink(dk) return (sj, dj) dk ← ω(sk) + dH (sk, v) dk ← ω(sk) + dH (sk, v) 7: s1, s2, s3 ← sites corresponding to c∗ 8: for k = 1, 2, 3 do 9: 10: j ← argmink(dk) 11: a ← left/right/ancestor relationship of v to vc 12: if v is an ancestor of vc 13: 14: else 15: return (sj, dj) c ← NextCentroid(c, a) return HandleCentroid(VD∗ j then , c, v) 16: j in the shortest path tree of sj in H 3 An O(n4/3)-space O(log2 n)-query oracle We state the following result from [22] that we use in the oracle presented in this section. Theorem 4 ([22]). For a planar graph G of size n, there is an O(n3/2)-sized data structure that answers distance queries in time O(log n). For clarity of presentation, we first describe our oracle under the assumption that the boundary vertices of each piece P in the r-division of the graph lie on a single hole and that each such hole is a simple cycle. Multiple holes and non-simple cycles do not pose any significant complications; we explain how to treat pieces with multiple holes that are not necessarily simple cycles, separately. Data Structure. We obtain an r-division for r = n2/3√ 1. The O(P3/2)-space, O(log P)-query-time distance oracle of Theorem 4. These occupy following for each piece P of the r-division: log n. The data structure consists of the √ O(n r) space in total. 2. Two MSSP data structures, one for P and one for P out, both with sources the nodes of ∂P . The MSSP data structure for P requires space O(r log r), while the one for P out requires space O(n log n). The total space required for the MSSP data structures is O( n2 r log n), since there are O( n r ) pieces. 3. For each node u of P : • VD∗ in(u, P ), the dual representation of the Voronoi diagram for P with sites the nodes of ∂P , and additive weights the distances from u to these nodes in G; 7 • VD∗ out(u, P ), the dual representation of the Voronoi diagram for P out with sites the nodes of ∂P , and additive weights the distances from u to these nodes in G. r) space and hence, since each √ The representation of each Voronoi diagram occupies O( vertex belongs to a constant number of pieces, all Voronoi diagrams require space O(n r). Query. We obtain a piece P of the r-division that contains u. Let us first suppose that v ∈ P . We have to consider both the case that the shortest u-to-v path crosses ∂P and the case that it does not. If it does cross, we retrieve this distance by performing a point location query for v in the Voronoi diagram VDin(u, P ). If the shortest u-to-v path does not cross ∂P , the path lies entirely within P . We thus retrieve the distance by querying the exact distance oracle of Theorem 4 stored for P . The answer is the minimum of the two returned distances. This requires O(log2 n) time by Theorems 2 and 4. Else, v (cid:54)∈ P and the shortest path from u to v must cross ∂P . The answer can be thus obtained by a point location query for v in the Voronoi diagram VDout(u, P ) in time O(log2 n) by Theorem 2. The pseudocode of the query algorithm is presented below as procedure SimpleDist(u, v) (Algorithm 3). √ Algorithm 3 SimpleDist(u, v) Input: Two nodes u and v. Output: dG(u, v). 1: P ← a piece of the r-division containing u 2: if v ∈ P then 3: 4: 5: 6: else 7: d1 ← dP (u, v) d2 ← PointLocate(VD∗ return min(d1, d2) return PointLocate(VD∗ in(u, P ), v) out(u, P ), v) Dealing with holes. The data structure has to be modified as follows. 2. For each hole h of P , two MSSP data structures, one for P and one for P h,out, both with sources the nodes of ∂P that lie on h. 3. For each node u of P , for each hole h of P : • VD∗ in(u, P, h), the dual representation of the Voronoi diagram for P with sites the nodes of ∂P that lie on h, and additive weights the distances from u to these nodes in G; out(u, P, h), the dual representation of the Voronoi diagram for P h,out with sites the nodes of ∂P that lie on h, and additive weights the distances from u to these nodes in G. As for the query, if v ∈ P we have to perform a point location query in VDin(u, P, h) for each hole h of P . Else v (cid:54)∈ P and we have to perform a point location query in VDout(u, P, h) for the hole h of P such that v ∈ P h,out. We can afford to store the required information to identify this hole explicitly in balanced search trees. We thus obtain the following result. • VD∗ Theorem 5. For a planar graph G of size n, there is an O(n4/3√ answers distance queries in time O(log2 n). log n)-sized data structure that 8 4 An oracle with almost optimal tradeoffs In this section we describe how to obtain an oracle with almost optimal space to query-time tradeoffs. Consider the oracle in the previous section. The size of the representation we store for each Voronoi diagram is proportional to the number of sites, while the size of an MSSP data structure is roughly proportional to the size of the graph in which the Voronoi diagram is defined. Thus, the MSSP data structures that we store for the outside of pieces of the r-division are the reason that the oracle in the previous section requires Ω(n4/3) space. However, storing the Voronoi diagrams for the outside of each piece is not a problem. For instance, if we could somehow afford to store MSSP data structures for P and P out of each piece P of an n-division using just O(n) space, then plugging r = n into the data structure from the previous sections would yield an oracle with space O(n1+) and query-time O(log2 n). We cannot hope to have such a compact MSSP representation. However, we can use recursion to get around this difficulty. We compute a recursive r-division, represented by a recursive r-division tree T . We store, for each piece P ∈ T , the Voronoi diagram for P out. However, instead of storing the costly MSSP for the entire P out, we store the MSSP data structure (and some additional information) just for the portion of P out that belongs to the parent Q of P in T . Roughly speaking, when we need to perform point location on a vertex of P out that belongs to Q we can use this MSSP information. When we need to perform point location on a vertex of P out that does not belong to Q (i.e., it is also in Qout), we recursively invoke the point location mechanism for Qout. We next describe the details. For clarity of presentation, we assume that the boundary vertices of each piece P in T lie on a single hole which is a simple cycle. We later explain how to remove these assumptions. In what follows, if a vertex in a Voronoi diagram can be assigned to more than one Voronoi cell, we assign it to the Voronoi cell of the site with largest additive weight. In other words, since we define the additive weights as distances from some vertex u, and since shortest paths are unique, we assign each vertex v to the Voronoi cell of the last site on the shortest u-to-v path. In particular, this implies that there are no empty Voronoi cells as every site belongs to its own cell. Thus VD∗ is a ternary tree (see [22]). We can make such an assignment by perturbing the additive weights to slightly favor sites with larger distances from u at the time that the Voronoi diagram is constructed. The data structure. Consider a recursive (rm, . . . , r1)-division of G for some n = rm > ··· > r1 = O(1) to be specified later. Recall that our convention is that the rm-division consists of G itself. For convenience, we define each vertex v to be a boundary vertex of a singleton piece at level 0 of the recursive division. Denote the set of pieces of the ri-division by Ri. Let T denote the tree representing this recursive (rm, . . . , r0)-division (each singleton piece v at level 0 is attached as the child of an arbitrary piece P at level 1 such that v ∈ P ). We will handle distance queries between vertices u, v that have the same parent P in R1 separately by storing these distances explicitly (this takes O(n) space because pieces at level 1 have constant size). The oracle consists of the following for each 0 ≤ i ≤ m − 1, for each piece R ∈ Ri whose parent in T is Q ∈ Ri+1: 1. If i > 0, two MSSP data structures for Q \ (R \ ∂R), with sources ∂R and ∂Q, respectively. 2. If i < m − 1, for each boundary vertex u of R: • VD∗ near(u, Q), the dual representation of the Voronoi diagram for Q \ (R \ ∂R) with sites the nodes of ∂Q, and additive weights the distances from u to these nodes in Rout; 9 • VD∗ f ar(u, Q), the dual representation of the Voronoi diagram for Qout with sites the nodes of ∂Q, and additive weights the distances from u to these nodes in Rout; • if i > 0, the coarse tree T R u , which is the tree obtained from the shortest path tree rooted at u in Rout (the fine tree) by contracting any edge incident to a vertex not in ∂Q ∪ ∂R. Note that the left/right/ancestor relationship between vertices of ∂Q ∪ ∂R in the coarse tree is the same as in the fine tree. Also note that each (coarse) edge in T R u originates from a contracted path in the fine tree. We preprocess the coarse tree T R u in time proportional to its size to allow for O(1)-time lowest common ancestor (LCA)2 and level ancestor3 queries [3, 4]. In addition, for every (coarse) edge of T R u , we store the first and last edges of the underlying path in the fine tree. We also store the preorder numbers of the vertices of T R u . Space. The space required to store the described data structure is O(n(cid:80) data structures is O(n(cid:80) log ri+1). Part 1 of the data structure: At the ri-division, we have O( n ) pieces and for each of them, we store two MSSP data structures, each of size O(ri+1 log ri+1). Thus, the total space required for the MSSP log ri+1). Part 2 of the data structure: At the ri-division, we store, for each of the O( n√ ) boundary nodes, the representation of two Voronoi diagrams and a coarse √ tree, each of size O( )1/2). ri ri+1 ri+1). The space for this part is thus O(n(cid:80) ri+1 i ri i ri ri i( ri+1 ri Query. Upon a query dG(u, v) for the distance between vertices u and v in G, we pick the singleton piece Q0 = {u} ∈ R0 and call the procedure Dist(u, v, Q0) presented below. In what follows we denote by Qj the ancestor of Q0 in T that is in Rj. The procedure Dist(u, v, Qi) (Algorithm 4) gets as input a piece Qi, a source vertex u ∈ ∂Qi and a destination vertex v ∈ Qout . The output of Dist(u, v, Qi) is a tuple (β, d), where d is the i distance from u to v in Qout and β is a sequence of certain boundary vertices of the recursive 0 = G and thus Dist(u, v, Q0) returns division that occur along the recursive query. (Note that Qout dG(u, v).) Let i∗ be the smallest index such that v ∈ Qi∗. For every 1 ≤ i < i∗, the i'th element in the list β is the last boundary vertex on the shortest u-to-v path that belongs to ∂Qi. As we shall see, the list β enables us to obtain the information that enables us to determine the required left/right/ancestor relationships during the recursion. Dist(u, v, Qi) works as follows. i 1. If v ∈ Qi+1 \ Qi, it computes the required distance by considering the minimum of the distance from u to v returned by a query in the MSSP data structure for Qi+1 \ (Qi \ ∂Qi) with sources ∂Qi and the distance returned by a (vanilla) point location query for v in VDnear(u, Qi+1) using the procedure PointLocate. The first query covers the case where the shortest path from u to v lies entirely within Qi+1, while the second one covers the complementary case. The time required in this case is O(log2 n). 2. If v (cid:54)∈ Qi+1, Dist performs a recursive point location query on VDf ar(u, Qi+1) by calling the procedure ModifiedPointLocate. Since Dist returns a list of boundary vertices as well as the distance, PointLocate and HandleCentroid must pass and augment these lists as well. The pseudocode for Modified- PointLocate is identical to that of PointLocate, except it calls ModifiedHandleCentroid instead of HandleCentroid; see Algorithm 5. In what follows, when any of the three procedures is called with respect to a piece Qi, we refer to this as an invocation of this procedure at level i. ancestor of both 2An LCA query takes as input two nodes of a rooted tree and returns the deepest node of the tree that is an 3A level ancestor query takes as input a node v at depth d and an integer (cid:96) ≤ d and returns the ancestor of v that is at depth (cid:96). 10 Algorithm 4 Dist(u, v, Qi) Input: A piece Qi, a vertex u ∈ ∂Qi and a vertex v ∈ Qout Output: (s, d), where s is a list of (some) boundary vertices on the u-to-v shortest path in Qout and d is the u-to-v distance in Qout 1: if v ∈ Qi+1 then (v may belong to Qi if i = m). (β, d) ← (null, distance returned by querying the MSSP data structure for Qi+1 \ (Qi \ ∂Q)) (β(cid:48), d(cid:48)) ← PointLocate(VD∗ if d(cid:48) < d then near(u, Qi+1), v) 2: 3: 4: . i i i , 5: (β, d) ← (β(cid:48), d(cid:48)) 6: else if i = m − 2 then 7: 8: else 9: (β, d) ← PointLocate(VD∗ (β, d) ← ModifiedPointLocate(VD∗ f ar(u, Qm−1), v) f ar(u, Qi+1), v, i + 1) 10: return (β, d) Algorithm 5 ModifiedPointLocate(VD∗ Input: The centroid decomposition of the dual representation VD∗ of a Voronoi diagram VD for i with sites ∂Qi and a vertex v ∈ Qout Qout Output: The site s of VD such that v ∈ Vor(s) and the additive distance from s to v. 1: c∗ ← root centroid in the centroid decomposition of VD∗ 2: return ModifiedHandleCentroid(VD∗ , c∗, v, i) , v, i) . i The pseudocode of ModifiedHandleCentroid (Algorithm 6) is similar to that of the procedure HandleCentroid, except that when the site s such that v ∈ Vor(s) is found, s is prepended to the list. A more significant change in ModifiedHandleCentroid stems from the fact that, since , we use recursive calls to Dist to obtain we no longer have an MSSP data structure for all of Qout the distances from the sites sk to v in Qout in Lines 4 and 9. We highlight these changes in red in the pseudocode provided below (Algorithm 6). We next discuss how to determine the required left/right/ancestor relationships in VDf ar (Line 11) in the absence of MSSP information for the entire Qout . i i i Left/right/ancestor relationships in VDf ar. Let sj be the site among the three sites corre- sponding to a centroid c∗ such that v is closest to sj with respect to the additive distances (see Lines 7-10 of Algorithm 6). Recall that yj is the vertex of the centroid face c that belongs to Vor(sj) and that vc j is the artificial vertex connected to yj and embedded inside the face c. In Line 11 of ModifiedHandleCentroid we have to determine whether v is an ancestor of yj in the shortest path tree rooted at sj in Qout , and if not, whether the sj-to-v path is left or right of the sj-to-vc j path. To avoid clutter, we will omit the subscript j in the following, and refer to sj as s, to vc j as vc, and to the sequence of boundary vertices βj returned by the recursion as β. To infer the relationship between the two paths we use the sites (boundary vertices) stored in the list β. We prepend s to β, and, if v is not already the last element of β, we append v to β and use a flag to denote that v was appended. i To be able to compare the s-to-v path with the s-to-vc path, we perform another recursive call Dist(s, vc, Qi) (this call is implicit in Line 11). Let γ be the list of sites returned by this call. As above, we prepend s to γ, and append vc if it is not already the last element. The intuition is that 11 Algorithm 6 ModifiedHandleCentroid(VD∗ , c∗, v, i) Input: The centroid decomposition of the dual representation VD∗ of a Voronoi diagram VD for i with sites ∂Qi, a centroid c∗ and a vertex v ∈ Qout Qout that belongs to the Voronoi cell of some descendant of c∗ in the centroid decomposition of VD∗. Output: The site s of VD such that v ∈ Vor(s) and the additive distance from s to v. 1: if c∗ is a leaf then i 2: 3: 4: 5: 6: s1, s2 ← sites corresponding to c∗ for k = 1, 2 do j ← argmink(ω(sk) + dk) return (prepend(sj, βj), ω(sj) + dj) (βk, dk) ← Dist(sk, v, Qi) (βk, dk) ← Dist(sk, v, Qi) 7: s1, s2, s3 ← sites corresponding to c∗ 8: for k = 1, 2, 3 do 9: 10: j ← argmink(ω(sk) + dk) 11: a ← left/right/ancestor relationship of v to vc 12: if v is an ancestor of vc 13: 14: else 15: return (prepend(sj, βj), ω(sj) + dj) c ← NextCentroid(c, a) return ModifiedHandleCentroid(VD∗ j then 16: j in the shortest path tree of sj in Qout i , c, v, i) the lists β and γ are a coarse representation of the s-to-v and s-to-vc shortest paths, and that we can use this coarse representation to roughly locate the vertex where the two paths diverge. The left/right relationship between the two paths is determined solely by the left/right relationship between the two paths at that vertex (the divergence point). We can use the local coarse tree information or the local MSSP information to infer this relationship. Recall that s is a boundary vertex of the piece Qi at level i of the recursive division. More generally, for any k ≥ 0, β[k] is a boundary vertex of Qi+k (except, possibly, when β[k] = v). To avoid this shift between the index of a site in the list and the level of the corresponding piece in the recursive r-division, we prepend i empty elements to both lists, so that now, for any k ≥ i, β[k] is a boundary vertex of Qk. Let k be the largest integer such that β[k] = γ[k]. Note that k exists because s is the first vertex in both β and γ. Observation 6. The restriction of the shortest path from β[i] to β[i + 1] in Qout ∂Qi ∪ ∂Qi+1 is identical to the path from β[i] to β[i + 1] in T Qi β[i]. i to the nodes of We next analyze the different cases that might arise and describe how to correctly infer the left/right relationship in each case. An illustration is provided as Fig. 3. 1. (β[k + 1] = v /∈ ∂Qk+1) or (γ[k + 1] = c /∈ ∂Qk+1). This corresponds to the case that in at least one of the lists there are no boundary vertices after the divergence point. We have a few cases depending on whether β[k + 1] and γ[k + 1] are in Qk or not. a. If β[k + 1], γ[k + 1] ∈ Qk, then it must be that β[k + 1] = v and γ[k + 1] = c were appended to the sequences manually. In this case we can query the MSSP data structure for Qk \ (Qk−1 \ ∂Qk−1) with sources the boundary vertices of ∂Qk to determine the left/right/ancestor relationship. 12 b. If β[k + 1], γ[k + 1] (cid:54)∈ Qk, we can use the MSSP data structure stored for Qk+1\ (Qk\ ∂Qk) with sources the nodes of ∂Qk. Let us assume without loss of generality that β[k + 1] = v /∈ ∂Qk+1. We then define w to be γ[k + 1] if γ[k + 1] = c (cid:54)∈ ∂Qk+1 or the child w of the root β[k] of the coarse T Qk β[k] that is an ancestor of γ[k + 1] otherwise. (In the latter case we can compute w in O(1) time with a level ancestor query.) We then query the MSSP data structure for the relation between v and the w. Note that the relation between the s-to-v and s-to-c paths is the same as the relation between the s-to-v and s-to-w paths. c. Else, one of β[k + 1], γ[k + 1] is in Qk and the other is not. Let us assume without loss of generality that β[k + 1] = v ∈ Qk. We can infer the left/right relation by looking at the circular order of the following edges: (i) the last fine edge in the root-to-β[k] path Qk−1 β[k−1], (ii) the first edge in the β[k]-to-β[k + 1] path, and (iii) the first edge in the in T Qk−1 β[k]-to-w path, where w is defined as in Case 1(b). Edge (i) is stored in T β[k−1] -- note that β[k − 1] exists since β[k + 1] ∈ Qk. Edge (ii) can be retrieved from the MSSP data structure for Qk \ (Qk−1 \ ∂Qk−1) with sources the boundary vertices of ∂Qk, and edge (iii) can be retrieved from the MSSP data structure for Qk+1 \ (Qk \ ∂Qk) with sources the boundary vertices of ∂Qk. 2. β[k + 1], γ[k + 1] ∈ ∂Qk+1. We first compute the LCA x of β[k + 1] and γ[k + 1] in T Qk β[k]. a. If neither of β[k + 1], γ[k + 1] is an ancestor of the other in T Qk β[k] we are done by utilising the preorder numbers stored in T Qk β[k]. b. Else, x is one of β[k + 1], γ[k + 1]. We can assume without loss of generality that x = β[k + 1]. Using a level ancestor query we find the child z of β[k + 1] in T Qk β[k] that is a (not necessarily strict) ancestor of γ[k + 1]. The x-to-z shortest path in Qout is internally disjoint from ∂Qk+1; i.e. it starts and ends at ∂Qk+1, but either entirely lies inside Qk+1 or entirely outside Qk+1. If β[k + 2] = v /∈ ∂Qk+2 let w be v; otherwise let w be the child Qk+1 of the root in T β[k+1] that is an ancestor of β[k + 2]. The x-to-w shortest path also lies either entirely inside or entirely outside Qk+1. It remains to determine the relationship of the x-to-w and the x-to-z paths. k i. If the shortest x-to-z path and the shortest x-to-w path lie on different sides of ∂Qk+1, we can infer the left/right relation by looking at the circular order of the following edges: (i) the last edge on the coarse edge from β[k] to x in T Qk β[k], (ii) the first edge on the x-to-z shortest path in Qout k , and (iii) the first edge on the x-to-w shortest path in Qout k . Edges (ii) and (iii) can be retrieved from the MSSP data structure. ii. Else, the x-to-z and the x-to-w shortest paths lie on the same side, and we compute the required relation using the MSSP data structure for this side, with sources the sites of ∂Qk+1. Query Correctness. Let us consider an invocation of Dist at level i. We first show that if such a query is answered without invoking ModifiedPointLocate (Line 9 of Algorithm 4) then the distance it returns is correct. Indeed, let us recall that the input to Dist is a piece Qi, a vertex u ∈ ∂Qi and a vertex v ∈ Qout (along with ). Let us now look at the cases in which Dist some vertices on the u-to-v shortest path in Qout does not call ModifiedPointLocate (Lines 1-7). If v ∈ Qi+1 then we have two cases: either the shortest u-to-v path in Qout crosses ∂Qi+1 or it does not. In the first case the answer is obtained by and the desired output is the u-to-v distance in Qout i i i i 13 (a) Case 1.a. (b) Case 1.b. (c) Case 1.c. (d) Case 2.a. (e) Case 2.b.i. (f) Case 2.b.ii Figure 3: An illustration of the different cases that arise in determining the left/right/ancestor relationship of β[k + 1] and γ[k + 1] in the shortest path tree rooted at s in Rout. The s-to-v path is red, the s-to-c path is blue, and their common prefix is purple. 14 a point location query in the graph Qi+1 \ (Qi \ ∂Qi) with sites the vertices of ∂Qi+1 and additive weights the distances from u to these vertices in Qout , while in the second case by a query on the MSSP data structure for this graph with sources the vertices of ∂Qi. Else, if v (cid:54)∈ Qi+1 and i = m− 2, the shortest path must cross ∂Qi+1. We can thus obtain the distance by performing a point location query in the Voronoi diagram for Qout m−1 with sites the vertices of ∂Qi+1 and additive weights the distances to these vertices from u in Qout m−2. Note that in both the cases that we perform point location queries, we have MSSP information for the underlying graph on which the Voronoi diagram is defined and hence the correctness of the answer follows from the correctness of the point location mechanism designed in [22]. i We now observe that if invocations of Dist at level i + 1 return the correct answer, then so does the invocation of ModifiedPointLocate at line 9 of the invocation of Dist at level i, since the only other requirement for the correctness of ModifiedPointLocate is is the ability to resolve the left/right/ancestor relationship; this follows from inspecting the cases analyzed above. It follows that invocations of Dist at level i also return the correct answer. The correctness of the query algorithm then follows by induction. Query time. We initially call Dist at level 0. A call to Dist at level i, either returns the answer in O(log2 n) time by using MSSP information and/or invoking PointLocate (Lines 1-7), or makes a call to ModifiedPointLocate at level i + 1 (Line 9). For the latter to happen it must be that i ≤ m − 3. This call to ModifiedPointLocate at level i + 1 invokes a call to ModifiedHandleCentroid at level i + 1. Then, ModifiedHandleCentroid makes O(log ri+1) calls to Dist at level i + 1, while going down the centroid decomposition of a Voronoi diagram with √ O( ri+1) sites. Let D[i] be the time required by a call to Dist at level i and C[i, t] be the time required by a call to ModifiedHandleCentroid at level i, where the size of the subtree of VD∗ corresponding to the input centroid is t. We then have the following: (cid:40) D[i] = C[i + 1, ri+1] + O(log n + log2 ri+1) O(log2 n) If i < m − 2 If i = m − 2 (The additive O(log n) factor comes from the possible existence of multiple holes, see Section 4.1.) (cid:40)O(D[i] + log n) + C[i, k/2] C[i, k] = 2D[i] If k > 1 If k = 1 (The additive O(log n) factor comes from resolving the left/right/ancestor relationship.) Hence, for i < m − 2, D[i] = O(log ri+1(D[i + 1] + log n)). The total time complexity of the query is thus D[0] = O(log2 n c log ri+1) = O(cm logm−1 n), where c > 0 is a constant. m−3(cid:81) i=1 Retrieving the shortest path. First of all, let us recall that given an MSSP data structure for a planar graph H of size n with sources the nodes of a face f , we can construct the shortest path from a node x in f to any node y of H, backwards from y in O(log log n) per reported edge (cf. [31]). We can easily retrieve one by one the edges of the coarse trees T Qi β[i] corresponding to paths whose concatenation would give us the shortest u-to-v path. The shortest path is in fact the concatenation of the β[i]-to-β[i + 1] paths in T Qi β[i], plus perhaps an extra final leg, which lies entirely in Qj \ (Qj−1 \ ∂Qj−1) for some j, if v was appended to β. Our MSSP data structures for each i allow us to refine those coarse edges of T Qi β[i] when their underlying shortest path lies entirely within Qi+1 \ (Qi \ ∂Qi). For an edge (x, y) of T Qi β[i] that corresponds to a path lying entirely in Qi+1 Qout , which we can refine using the MSSP information we have i+1, we use the x-to-y path in T x 15 for Qi+2 \ (Qi+1 \ ∂Qi+1). We then proceed inductively on coarse edges whose underlying path is entirely in Qout i+2. In each step we obtain and refine an edge from a node in ∂Qi to a node in ∂Qj, j ∈ {i − 1, i, i + 1} using the local MSSP information. To summarize, we retrieve one by one the edges of the coarse trees T Qi β[i], corresponding to portions of the actual shortest path that lie entirely in Qi \ (Qi−1 \ ∂Qi−1) in O(1) time each. We then use the local MSSP information to obtain the actual edges of each coarse edge in O(log log n) time per actual edge. ). We summarize our main result in the following theorem. We prove in Section 5 that the time bound for the construction of the data structure is O(n(cid:80) O(n(cid:80) constant. This data structure can be constructed in time O(n(cid:80) Theorem 7. Given a planar graph G of size n, for any decreasing sequence n = rm > rm−1 > ··· > r1, where r1 is a sufficiently large constant and m ≥ 3, there is a data structure of size log ri+1) that answers distance queries in time O(cm logm−1 n), where c > 0 is a ). The shortest path can be ri+1√ ri retrieved backwards from v to u, at a cost of O(log log n) time per edge. ri+1√ ri ri+1 ri i i i We next present three specific tradeoffs that follow from this theorem. Corollary 8. Given a planar graph G of size n, we can construct a distance oracle admitting any of the following (cid:104)space, query-time(cid:105) tradeoffs: (a) (cid:104)O(n log2+1/ n), O(n)(cid:105), for any constant  > 0; (b) (cid:104)n1+o(1), no(1)(cid:105); (c) (cid:104) O(n1+),O(log1/ n)(cid:105), for any constant 1/2 ≥  > 0. The construction time is O(n3/2 log1/2 n), n3/2+o(1) and O(n3/2+), respectively. Proof. Let ρi denote ri+1 ri (c) by setting ρ = log1/ n, ρ = 2 ; we will set all ρi to be equal to a value ρ. We get tradeoffs (a), (b) and log n and ρ = n, respectively. √ We provide the arithmetic below. (a) If we set ρ = log1/ n, then the depth of the recursive r-division is m = logρ n + 1 = log n log ρ + 1 =  log n/ log log n + 1. Then, the space required is O(nmρ log n) = O(n log2+1/ n) and the time required to answer a distance query is O((c log n)logρ n) = O(n). (b) If we set ρ = 2 log n, then the depth of the recursive r-division is m = logρ n + 1 = log n √ log ρ + 1 = log n + 1. Then, the space required is O(nmρ log n) = n1+o(1) and the time required to answer a distance query is O(loglogρ n n) = O(log √ log n n) = O(2 log n log log n) = no(1). √ √ (c) If we set ρ = n, then the depth of the recursive r-division is m = logρ n + 1 = 1/ + 1. Then, the space required is O(nmρ log n) = O(n1+ log n) and the time required to answer a distance query is O(loglogρ n n) = O(log1/ n). 4.1 Dealing with multiple holes We now remove the assumption that all boundary vertices of each piece lie on a single hole. 16 Data Structure. The oracle consists of the following for each 0 ≤ i ≤ m − 1, for each piece R ∈ Ri whose parent in T is Q ∈ Ri+1: 1. If i > 0, for each pair of holes h of R and g of Q, such that g lies in Rh,out, two MSSP data structures for Rh,out ∩ Q, one with sources the vertices of ∂R that lie on h, and one with sources the vertices of ∂Q that lie on g. 2. If i < m − 1, for each boundary vertex u of R that lies on a hole h of R: • For each hole g of Q that lies in Rh,out: -- VD∗ near(u, Q, g), the dual representation of the Voronoi diagram for Rh,out ∩ Q with sites the nodes of ∂Q that lie on g, and additive weights the distances from u to these nodes in Rh,out; f ar(u, Q, g), the dual representation of the Voronoi diagram for Qg,out with sites the nodes of ∂Q that lie on g, and additive weights the distances from u to these nodes in Rh,out; -- VD∗ • If i > 0, the coarse tree T R,h u , which is the tree obtained from the shortest path tree rooted at u in Rh,out by contracting any edge incident to a vertex that is neither in h nor in ∂Q, preprocessed as in the single hole case. If v ∈ Qi+1 \ Qi then in Line 3 of Dist, we need to consider O(1) Voronoi diagrams near(u, Qi+1, g), one for each hole of Qi+1, instead of just one. If not, we find the correct hole h Query. VD∗ of Qi+1 such that v ∈ Qh,out We can find the correct hole by storing some information for each hole of each piece. It is not hard to see that each separator of the O(log n) ancestors of a piece P ∈ A lies in P h,out for some hole h of P . For each piece P ∈ A, we store, for each separator of an ancestor of P in A, the hole h of P such that P h,out contains that separator. Then, by performing an LCA query for the constant size piece of A containing v and Qi+1 in A we find the separator that separated v from Qi+1 and we can thus find the appropriate hole of Qi+1 in O(1) time. i+1 , and recurse on VD∗ f ar(u, Qi+1, h). Obtaining the left/right/ancestor information is essentially the same as in the single hole case. There is one additional case that needs to be considered, in which the vertex at which the s-to-v path and the s-to-vc path diverge is located inside a hole. In this case we may have to look into finer and finer coarse trees until we get to a level of resolution where we can either deduce the left/right relationship from the coarse tree at that level, or from the MSSP data structure at that level. This refining process has O(log n) levels and takes constant time per level, except for the last level where we use the MSSP data structure in O(log n) time as in the single hole case. Therefore, the asymptotic query time is unchanged. As for retrieving the edges of the shortest path in O(log log n) time each, the presence of multiple holes does not pose any further complications. Dealing with holes that are non-simple cycles Non-simple holes do not introduce any significant difficulties. The technique to handle non-simple holes is the one described in [27, Section 5.1, pp. 27]. We make an incision along the non-simple boundary of a hole to turn it into a simple cycle. Making this incision creates multiple copies of vertices that are visited multiple times by the non-simple cycle. However, the total number of copies is within a constant of the original number of boundary vertices along the hole. These copies do not pose any problems because, for our purposes, they can be treated as distinct sites of the Voronoi diagram. 17 5 Construction Time In this section we show how to construct our oracles in the O(n(cid:80) ri+1√ ri Before doing so, we give some preliminaries on dense distance graphs. i ) time stated in Theorem 7. Dense distance graphs and FR-Dijkstra. The dense distance graph of a piece P , denoted DDGP is a complete directed graph on the boundary vertices of P . Each edge (u, v) has weight dP (u, v), equal to the length of the shortest u-to-v path in P . DDGP can be computed in time O(∂P2 + P log P) using the multiple source shortest paths (MSSP) algorithm [8, 30]. Over all pieces of the recursive decomposition this takes time O(n log2 n) in total and requires space O(n log n). We refer to the aforementioned (standard) DDGs as internal; the external DDG of a piece P is the complete directed graph on the vertices of ∂P , with the edge (u, v) having weight equal to dP out(u, v). There is an efficient implementation of Dijkstra's algorithm (nicknamed FR- Dijkstra [20]) that runs on any union of DDGs. The algorithm exploits the fact that, due to planarity, a DDG's adjacency matrix M satisfies a Monge property (namely, for any i (cid:54)= j we have that M [i + 1, j] + M [i, j + 1] ≤ M [i + 1, j + 1] + M [i, j]). We next give a -- convenient for our purposes -- interface for FR-Dijkstra which was essentially proved in [20], with some additional components and details from [27, 38]. Theorem 9 ([20, 27, 38]). A set of DDGs with O(M ) vertices in total (with multiplicities), each having at most m vertices, can be preprocessed in time and space O(M log m) in total. After this preprocessing, Dijkstra's algorithm can be run on the union of any subset of these DDGs with O(N ) vertices in total (with multiplicities) in time O(N log2 m). The construction. For ease of presentation we present the construction algorithm assuming pieces have only one hole. Generalizing to multiple holes does not pose any new obstacles. Recall that for each piece R in the recursive decomposition whose parent in T is Q we need to compute two MSSP data structures, and for each boundary vertex u of R we need to compute VD∗ near(u, Q), VD∗ f ar(u, Q), and the coarse tree T R u . Computing the MSSP data structures takes nearly linear time in the total size of these data structures. To be able to compute the distances between vertices in the same piece of the r1 division, additive distances for all Voronoi diagrams, and the coarse trees T R u , we compute the internal and external dense distance graphs of every piece in the recursive r-division. This can be done in nearly linear time [37]. We also compute the dense distance graph of ∂R ∪ ∂Q. This is done by running MSSP twice in Q \ (R \ ∂R), and then querying all pairwise distances. For a piece R of the ri division, this takes O(ri+1) time, so a total of O((cid:80) ) time overall. i n ri+1 ri We then compute the distances from each vertex in G to all other vertices in the same piece R of the r1-division in time O(1), using FR-Dijkstra on R and the external DDG of R. To compute the additive weights for the Voronoi diagrams VD∗ f ar(u, Q), as well u , we need to compute distances from u to ∂Q ∪ ∂R in Rout. This can as the coarse tree T R be done in time O(∂Q log2 ∂Q) by running FR-Dijkstra from u on the union of the DDG of Q \ (R \ ∂R) and the external DDG of Q. The total time to compute all such additive weights is near(u, Q) and VD∗ thus O((cid:80) i n (cid:113) ri+1 ri log2 ri+1). To compute each Voronoi diagram VD∗ near(u, Q) we compute the primal Voronoi diagram VDnear(u, Q) with a single-source shortest path computation in Q from an artificial super-source s connected to all vertices ∂Q with edges whose weights are the additive weights. This can be done in linear O(Q) time [24]. In O(Q) time it is then easy to obtain the dual VD∗ near(u, Q) from the primal VDnear(u, Q). The total time to compute all such diagrams is therefore O((cid:80) ). i n ri+1√ ri 18 It remains to compute the diagram VD∗ √ (cid:113) f ar(u, Q) since all we need for point location is the centroid decomposition of VD∗ n ·(cid:112)Q). A more careful analysis that takes into account double counting of large pieces f ar(u, Q). Here we cannot afford to make an explicit computation of the primal Voronoi diagram VDf ar(u, Q). Instead, we will compute just the tree structure and the trichromatic faces of VDf ar(u, Q). These suffice as the representation of VD∗ f ar(u, Q). The main idea is to use FR-Dijkstra to locate the trichromatic faces. Let K be a star with center u and leaves ∂Q, where for each vertex w ∈ ∂Q, the length of the arc uw is the additive distance of w in VD∗ f ar(u, Q). We start by computing a shortest path tree T rooted at u in the union of K and the DDGs of all siblings of pieces in the complete recursive decomposition tree A that contain Q. We shall prove that, by inspecting the restriction of T to the DDG of each piece P , we can infer whether P contains a trichromatic face or not. If P contains a trichromatic face we refine T inside P by replacing the DDG of P with the DDGs of its two children in A, and recomputing the part of T inside P using FR-Dijkstra. We continue doing so until we locate all O(∂Q) trichromatic faces. The tree structure of VDf ar(u, Q) is captured by the structure of the shortest path tree in the DDGs of all the pieces at the end of this process. The total time to locate all the trichromatic faces is proportional, up to polylogarithmic factors, to the total number of vertices in all of the DDGs √ involved in all these computations. Since the total number of vertices in all DDGs containing a particular face is O( n), the total time for finding all trichromatic faces as well as the tree structure is O( (cf. [10]) bounds this time by O( recursive r-division, the total time to compute all Voronoi diagrams VD∗ O( n√ ri The only missing part in the explanation above is showing we can infer whether a piece P contains a trichromatic face just by inspecting the restriction of T to P . Our choice of additive distance guarantees that each vertex of ∂Q is a child of u in T . We label each vertex w of T by its unique ancestor in T that belongs to ∂Q. Note that the label of a vertex w corresponds to the Voronoi cell containing w in VD∗ f ar(u, Q). Consider the restriction of T to the DDG of P . We use a representation of size O(∂P) of the edges of T embedded as curves in P , such that each edge of T is homologous (w.r.t. the holes of P ) to its underlying shortest path in P . See [33, 36] for details on such a representation. We make incisions in the embedding of P along the edges of T (the endpoints of edges of T are duplicated in this process). Let P be the set of connected components of P after all incisions are made. Lemma 10. P contains a trichromatic face if and only if some connected component C in P contains boundary vertices of P with more than two distinct labels. (cid:112)Q). Since there are n/ ) = O(n3/2). This is dominated by the O((cid:80) n ri boundary vertices at level i of the f ar(u, Q) for a single level is ) term for any choice of ri's. · √ nr 1/4 i √ i n ri+1√ ri Intuitively, for each connected component C in P, each label appears as the label of boundary vertices along at most a single sequence of consecutive boundary vertices along the boundary of C. Consider the component C(cid:48) obtained from C by connecting an artificial new vertex to all the boundary vertices with the same label. Since these boundary vertices form a single consecutive interval on the boundary of C, C(cid:48) is also a planar graph when the new vertices are embedded in the infinite face of C. Now C(cid:48) has a new infinite face where every vertex on that face has a distinct label, and there are more than two labels. The Voronoi diagram of C(cid:48) necessarily contains a trichromatic face. Proof. Let C be a connected component in P. Note that the vertices of ∂Q either do not belong to C or they are incident to a single face f of C. In the former case, let f be the face of C such that ∂Q is embedded in f . We think of f as the infinite face of C. Note that, because any path from ∂Q 19 Figure 4: Illustration for the proof of Lemma 10. Some pieces in a graph G are shown. The piece Q (in bold) is a piece of some ri-division in the recursive r-division of G. The piece P (bold boundary, horizontal stripes) is some piece in the complete recursive decomposition of G that lies outside Q. The shortest path tree T is shown in blue, the connected component C in yellow, and the cycle D in gray. Vertices x and y have the same label q. The vertices w, z between x and y (on the cyclic walk F along the infinite face of C) must also be labeled q. to any vertex of C must intersect f , the set of labels of the vertices of f is identical to the set of labels of all of C. We first claim that the vertices of f that have the same label are consecutive in the cyclic order of f . To see this, consider any two distinct vertices x, y of f that have the same label q. Note that, by the incision process defining C, if x is an ancestor of y in T (or vice versa) then all the vertices between x and y on f are on the x-to-y path in T , and hence all have the label q. Assume, therefore, that neither is an ancestor of the other (as illustrated in Figure 4), and consider the (not necessarily simple) cycle D (in Qout) formed by the unique x-to-y path in T , and the x-to-y path F of f such that D does not enclose C. Observe that D is non self crossing, and that D encloses no vertices of ∂Q except, perhaps, q itself. Suppose some vertex of F has a label q(cid:48) (cid:54)= q, and let w be a rootmost such vertex in T . Since D does not enclose q(cid:48), the q(cid:48)-to-w path in T is not enclosed by D, and hence must intersect C. But then C should have been further dissected when the incisions along T were performed, a contradiction. The argument above established that the vertices of f that have the same label are consecutive in the cyclic order of f . For every unique label q of a vertex of f we embed inside f an artificial vertex and connect it to every vertex w of f that has label q with an edge whose length is the q-to-w distance in T . By the consecutiveness property above, this can be done without violating planarity. We connect the artificial vertices by infinite length edges, according to the cyclic order of the labels along f , so that resulting graph C(cid:48) has a new infinite face containing just the artificial vertices. Consider now the additively weighted Voronoi diagram VD(C(cid:48)) with the artificial vertices as sites, where the additive weight of an artificial vertex with label q is equal to the additive weight of the corresponding site q in VD∗ f ar(u, Q). Note that, by construction, the additive distances in VD(C(cid:48)) and in VD∗ f ar(u, Q) are the same, so the restrictions of both diagrams to C are identical. It therefore suffices to prove that VD(C(cid:48)) has a trichromatic face in C. 20 z<latexit sha1_base64="V61ahDJnnWKPVhpM/yuf77m1lKo=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FQSEfQkBS8eW7Af0Iay2U7atZtN2N0INfQXePGgiFd/kjf/jds2B219YeHhnRl25g0SwbVx3W+nsLa+sblV3C7t7O7tH5QPj1o6ThXDJotFrDoB1Si4xKbhRmAnUUijQGA7GN/O6u1HVJrH8t5MEvQjOpQ85IwaazWe+uWKW3XnIqvg5VCBXPV++as3iFkaoTRMUK27npsYP6PKcCZwWuqlGhPKxnSIXYuSRqj9bL7olJxZZ0DCWNknDZm7vycyGmk9iQLbGVEz0su1mflfrZua8NrPuExSg5ItPgpTQUxMZleTAVfIjJhYoExxuythI6ooMzabkg3BWz55FVoXVc9y47JSu8njKMIJnMI5eHAFNbiDOjSBAcIzvMKb8+C8OO/Ox6K14OQzx/BHzucP6A+M+g==</latexit><latexit sha1_base64="V61ahDJnnWKPVhpM/yuf77m1lKo=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FQSEfQkBS8eW7Af0Iay2U7atZtN2N0INfQXePGgiFd/kjf/jds2B219YeHhnRl25g0SwbVx3W+nsLa+sblV3C7t7O7tH5QPj1o6ThXDJotFrDoB1Si4xKbhRmAnUUijQGA7GN/O6u1HVJrH8t5MEvQjOpQ85IwaazWe+uWKW3XnIqvg5VCBXPV++as3iFkaoTRMUK27npsYP6PKcCZwWuqlGhPKxnSIXYuSRqj9bL7olJxZZ0DCWNknDZm7vycyGmk9iQLbGVEz0su1mflfrZua8NrPuExSg5ItPgpTQUxMZleTAVfIjJhYoExxuythI6ooMzabkg3BWz55FVoXVc9y47JSu8njKMIJnMI5eHAFNbiDOjSBAcIzvMKb8+C8OO/Ox6K14OQzx/BHzucP6A+M+g==</latexit><latexit sha1_base64="V61ahDJnnWKPVhpM/yuf77m1lKo=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FQSEfQkBS8eW7Af0Iay2U7atZtN2N0INfQXePGgiFd/kjf/jds2B219YeHhnRl25g0SwbVx3W+nsLa+sblV3C7t7O7tH5QPj1o6ThXDJotFrDoB1Si4xKbhRmAnUUijQGA7GN/O6u1HVJrH8t5MEvQjOpQ85IwaazWe+uWKW3XnIqvg5VCBXPV++as3iFkaoTRMUK27npsYP6PKcCZwWuqlGhPKxnSIXYuSRqj9bL7olJxZZ0DCWNknDZm7vycyGmk9iQLbGVEz0su1mflfrZua8NrPuExSg5ItPgpTQUxMZleTAVfIjJhYoExxuythI6ooMzabkg3BWz55FVoXVc9y47JSu8njKMIJnMI5eHAFNbiDOjSBAcIzvMKb8+C8OO/Ox6K14OQzx/BHzucP6A+M+g==</latexit><latexit sha1_base64="V61ahDJnnWKPVhpM/yuf77m1lKo=">AAAB6HicbZBNS8NAEIYn9avWr6pHL4tF8FQSEfQkBS8eW7Af0Iay2U7atZtN2N0INfQXePGgiFd/kjf/jds2B219YeHhnRl25g0SwbVx3W+nsLa+sblV3C7t7O7tH5QPj1o6ThXDJotFrDoB1Si4xKbhRmAnUUijQGA7GN/O6u1HVJrH8t5MEvQjOpQ85IwaazWe+uWKW3XnIqvg5VCBXPV++as3iFkaoTRMUK27npsYP6PKcCZwWuqlGhPKxnSIXYuSRqj9bL7olJxZZ0DCWNknDZm7vycyGmk9iQLbGVEz0su1mflfrZua8NrPuExSg5ItPgpTQUxMZleTAVfIjJhYoExxuythI6ooMzabkg3BWz55FVoXVc9y47JSu8njKMIJnMI5eHAFNbiDOjSBAcIzvMKb8+C8OO/Ox6K14OQzx/BHzucP6A+M+g==</latexit>y<latexit sha1_base64="k2E7geM6EpzwHg6AXJpYg82YvKU=">AAAB6XicbZBNS8NAEIYnftb4VfXoZbEUPJVEBD1JwYvHFuwHtKFstpN26WYTdjdCCf0FngQF8epP8uS/cdvmoK0vLDy8M8POvGEquDae9+1sbG5t7+yW9tz9g8Oj4/LJaVsnmWLYYolIVDekGgWX2DLcCOymCmkcCuyEk/t5vfOESvNEPpppikFMR5JHnFFjreZ0UK54NW8hsg5+ARUo1BiUv/rDhGUxSsME1brne6kJcqoMZwJnbrWfaUwpm9AR9ixKGqMO8sWmM1K1zpBEibJPGrJw3V8TOY21nsah7YypGevV2tz8r9bLTHQb5FymmUHJlh9FmSAmIfOzyZArZEZMLVCmuF2WsDFVlBkbjmtT8FdvXof2Vc233Lyu1O+KPEpwDhdwCT7cQB0eoAEtYIDwDK/w5kycF+fd+Vi2bjjFzBn8kfP5A0vFjSQ=</latexit><latexit sha1_base64="k2E7geM6EpzwHg6AXJpYg82YvKU=">AAAB6XicbZBNS8NAEIYnftb4VfXoZbEUPJVEBD1JwYvHFuwHtKFstpN26WYTdjdCCf0FngQF8epP8uS/cdvmoK0vLDy8M8POvGEquDae9+1sbG5t7+yW9tz9g8Oj4/LJaVsnmWLYYolIVDekGgWX2DLcCOymCmkcCuyEk/t5vfOESvNEPpppikFMR5JHnFFjreZ0UK54NW8hsg5+ARUo1BiUv/rDhGUxSsME1brne6kJcqoMZwJnbrWfaUwpm9AR9ixKGqMO8sWmM1K1zpBEibJPGrJw3V8TOY21nsah7YypGevV2tz8r9bLTHQb5FymmUHJlh9FmSAmIfOzyZArZEZMLVCmuF2WsDFVlBkbjmtT8FdvXof2Vc233Lyu1O+KPEpwDhdwCT7cQB0eoAEtYIDwDK/w5kycF+fd+Vi2bjjFzBn8kfP5A0vFjSQ=</latexit><latexit sha1_base64="k2E7geM6EpzwHg6AXJpYg82YvKU=">AAAB6XicbZBNS8NAEIYnftb4VfXoZbEUPJVEBD1JwYvHFuwHtKFstpN26WYTdjdCCf0FngQF8epP8uS/cdvmoK0vLDy8M8POvGEquDae9+1sbG5t7+yW9tz9g8Oj4/LJaVsnmWLYYolIVDekGgWX2DLcCOymCmkcCuyEk/t5vfOESvNEPpppikFMR5JHnFFjreZ0UK54NW8hsg5+ARUo1BiUv/rDhGUxSsME1brne6kJcqoMZwJnbrWfaUwpm9AR9ixKGqMO8sWmM1K1zpBEibJPGrJw3V8TOY21nsah7YypGevV2tz8r9bLTHQb5FymmUHJlh9FmSAmIfOzyZArZEZMLVCmuF2WsDFVlBkbjmtT8FdvXof2Vc233Lyu1O+KPEpwDhdwCT7cQB0eoAEtYIDwDK/w5kycF+fd+Vi2bjjFzBn8kfP5A0vFjSQ=</latexit><latexit sha1_base64="k2E7geM6EpzwHg6AXJpYg82YvKU=">AAAB6XicbZBNS8NAEIYnftb4VfXoZbEUPJVEBD1JwYvHFuwHtKFstpN26WYTdjdCCf0FngQF8epP8uS/cdvmoK0vLDy8M8POvGEquDae9+1sbG5t7+yW9tz9g8Oj4/LJaVsnmWLYYolIVDekGgWX2DLcCOymCmkcCuyEk/t5vfOESvNEPpppikFMR5JHnFFjreZ0UK54NW8hsg5+ARUo1BiUv/rDhGUxSsME1brne6kJcqoMZwJnbrWfaUwpm9AR9ixKGqMO8sWmM1K1zpBEibJPGrJw3V8TOY21nsah7YypGevV2tz8r9bLTHQb5FymmUHJlh9FmSAmIfOzyZArZEZMLVCmuF2WsDFVlBkbjmtT8FdvXof2Vc233Lyu1O+KPEpwDhdwCT7cQB0eoAEtYIDwDK/w5kycF+fd+Vi2bjjFzBn8kfP5A0vFjSQ=</latexit>u<latexit sha1_base64="rezAWKkdjTLXShLFd/Wl6eaKQ9E=">AAAB6XicbZBNS8NAEIYnftb4VfXoZbEUPJVEBD1JwYvHFuwHtKFstpN26WYTdjdCCf0FngQF8epP8uS/cdvmoK0vLDy8M8POvGEquDae9+1sbG5t7+yW9tz9g8Oj4/LJaVsnmWLYYolIVDekGgWX2DLcCOymCmkcCuyEk/t5vfOESvNEPpppikFMR5JHnFFjrWY2KFe8mrcQWQe/gAoUagzKX/1hwrIYpWGCat3zvdQEOVWGM4Ezt9rPNKaUTegIexYljVEH+WLTGalaZ0iiRNknDVm47q+JnMZaT+PQdsbUjPVqbW7+V+tlJroNci7TzKBky4+iTBCTkPnZZMgVMiOmFihT3C5L2JgqyowNx7Up+Ks3r0P7quZbbl5X6ndFHiU4hwu4BB9uoA4P0IAWMEB4hld4cybOi/PufCxbN5xi5gz+yPn8AUWxjSA=</latexit><latexit sha1_base64="rezAWKkdjTLXShLFd/Wl6eaKQ9E=">AAAB6XicbZBNS8NAEIYnftb4VfXoZbEUPJVEBD1JwYvHFuwHtKFstpN26WYTdjdCCf0FngQF8epP8uS/cdvmoK0vLDy8M8POvGEquDae9+1sbG5t7+yW9tz9g8Oj4/LJaVsnmWLYYolIVDekGgWX2DLcCOymCmkcCuyEk/t5vfOESvNEPpppikFMR5JHnFFjrWY2KFe8mrcQWQe/gAoUagzKX/1hwrIYpWGCat3zvdQEOVWGM4Ezt9rPNKaUTegIexYljVEH+WLTGalaZ0iiRNknDVm47q+JnMZaT+PQdsbUjPVqbW7+V+tlJroNci7TzKBky4+iTBCTkPnZZMgVMiOmFihT3C5L2JgqyowNx7Up+Ks3r0P7quZbbl5X6ndFHiU4hwu4BB9uoA4P0IAWMEB4hld4cybOi/PufCxbN5xi5gz+yPn8AUWxjSA=</latexit><latexit sha1_base64="rezAWKkdjTLXShLFd/Wl6eaKQ9E=">AAAB6XicbZBNS8NAEIYnftb4VfXoZbEUPJVEBD1JwYvHFuwHtKFstpN26WYTdjdCCf0FngQF8epP8uS/cdvmoK0vLDy8M8POvGEquDae9+1sbG5t7+yW9tz9g8Oj4/LJaVsnmWLYYolIVDekGgWX2DLcCOymCmkcCuyEk/t5vfOESvNEPpppikFMR5JHnFFjrWY2KFe8mrcQWQe/gAoUagzKX/1hwrIYpWGCat3zvdQEOVWGM4Ezt9rPNKaUTegIexYljVEH+WLTGalaZ0iiRNknDVm47q+JnMZaT+PQdsbUjPVqbW7+V+tlJroNci7TzKBky4+iTBCTkPnZZMgVMiOmFihT3C5L2JgqyowNx7Up+Ks3r0P7quZbbl5X6ndFHiU4hwu4BB9uoA4P0IAWMEB4hld4cybOi/PufCxbN5xi5gz+yPn8AUWxjSA=</latexit><latexit sha1_base64="rezAWKkdjTLXShLFd/Wl6eaKQ9E=">AAAB6XicbZBNS8NAEIYnftb4VfXoZbEUPJVEBD1JwYvHFuwHtKFstpN26WYTdjdCCf0FngQF8epP8uS/cdvmoK0vLDy8M8POvGEquDae9+1sbG5t7+yW9tz9g8Oj4/LJaVsnmWLYYolIVDekGgWX2DLcCOymCmkcCuyEk/t5vfOESvNEPpppikFMR5JHnFFjrWY2KFe8mrcQWQe/gAoUagzKX/1hwrIYpWGCat3zvdQEOVWGM4Ezt9rPNKaUTegIexYljVEH+WLTGalaZ0iiRNknDVm47q+JnMZaT+PQdsbUjPVqbW7+V+tlJroNci7TzKBky4+iTBCTkPnZZMgVMiOmFihT3C5L2JgqyowNx7Up+Ks3r0P7quZbbl5X6ndFHiU4hwu4BB9uoA4P0IAWMEB4hld4cybOi/PufCxbN5xi5gz+yPn8AUWxjSA=</latexit>q<latexit sha1_base64="bdGUh2GFhz17H0BtMF+W9k6UzbQ=">AAAB6XicbZBNS8NAEIYn9avGr6pHL4ul4KkkIuhJCl48tmA/oA1ls520SzebuLsRSukv8CQoiFd/kif/jds2B219YeHhnRl25g1TwbXxvG+nsLG5tb1T3HX39g8Oj0rHJy2dZIphkyUiUZ2QahRcYtNwI7CTKqRxKLAdju/m9fYTKs0T+WAmKQYxHUoecUaNtRqP/VLZq3oLkXXwcyhDrnq/9NUbJCyLURomqNZd30tNMKXKcCZw5lZ6mcaUsjEdYteipDHqYLrYdEYq1hmQKFH2SUMWrvtrYkpjrSdxaDtjakZ6tTY3/6t1MxPdBFMu08ygZMuPokwQk5D52WTAFTIjJhYoU9wuS9iIKsqMDce1KfirN69D67LqW25clWu3eR5FOINzuAAfrqEG91CHJjBAeIZXeHPGzovz7nwsWwtOPnMKf+R8/gA/nY0c</latexit><latexit sha1_base64="bdGUh2GFhz17H0BtMF+W9k6UzbQ=">AAAB6XicbZBNS8NAEIYn9avGr6pHL4ul4KkkIuhJCl48tmA/oA1ls520SzebuLsRSukv8CQoiFd/kif/jds2B219YeHhnRl25g1TwbXxvG+nsLG5tb1T3HX39g8Oj0rHJy2dZIphkyUiUZ2QahRcYtNwI7CTKqRxKLAdju/m9fYTKs0T+WAmKQYxHUoecUaNtRqP/VLZq3oLkXXwcyhDrnq/9NUbJCyLURomqNZd30tNMKXKcCZw5lZ6mcaUsjEdYteipDHqYLrYdEYq1hmQKFH2SUMWrvtrYkpjrSdxaDtjakZ6tTY3/6t1MxPdBFMu08ygZMuPokwQk5D52WTAFTIjJhYoU9wuS9iIKsqMDce1KfirN69D67LqW25clWu3eR5FOINzuAAfrqEG91CHJjBAeIZXeHPGzovz7nwsWwtOPnMKf+R8/gA/nY0c</latexit><latexit sha1_base64="bdGUh2GFhz17H0BtMF+W9k6UzbQ=">AAAB6XicbZBNS8NAEIYn9avGr6pHL4ul4KkkIuhJCl48tmA/oA1ls520SzebuLsRSukv8CQoiFd/kif/jds2B219YeHhnRl25g1TwbXxvG+nsLG5tb1T3HX39g8Oj0rHJy2dZIphkyUiUZ2QahRcYtNwI7CTKqRxKLAdju/m9fYTKs0T+WAmKQYxHUoecUaNtRqP/VLZq3oLkXXwcyhDrnq/9NUbJCyLURomqNZd30tNMKXKcCZw5lZ6mcaUsjEdYteipDHqYLrYdEYq1hmQKFH2SUMWrvtrYkpjrSdxaDtjakZ6tTY3/6t1MxPdBFMu08ygZMuPokwQk5D52WTAFTIjJhYoU9wuS9iIKsqMDce1KfirN69D67LqW25clWu3eR5FOINzuAAfrqEG91CHJjBAeIZXeHPGzovz7nwsWwtOPnMKf+R8/gA/nY0c</latexit><latexit sha1_base64="bdGUh2GFhz17H0BtMF+W9k6UzbQ=">AAAB6XicbZBNS8NAEIYn9avGr6pHL4ul4KkkIuhJCl48tmA/oA1ls520SzebuLsRSukv8CQoiFd/kif/jds2B219YeHhnRl25g1TwbXxvG+nsLG5tb1T3HX39g8Oj0rHJy2dZIphkyUiUZ2QahRcYtNwI7CTKqRxKLAdju/m9fYTKs0T+WAmKQYxHUoecUaNtRqP/VLZq3oLkXXwcyhDrnq/9NUbJCyLURomqNZd30tNMKXKcCZw5lZ6mcaUsjEdYteipDHqYLrYdEYq1hmQKFH2SUMWrvtrYkpjrSdxaDtjakZ6tTY3/6t1MxPdBFMu08ygZMuPokwQk5D52WTAFTIjJhYoU9wuS9iIKsqMDce1KfirN69D67LqW25clWu3eR5FOINzuAAfrqEG91CHJjBAeIZXeHPGzovz7nwsWwtOPnMKf+R8/gA/nY0c</latexit>x<latexit sha1_base64="qsvKBTJ5NAKSwUaIHVyo1ttN4GU=">AAAB6XicbZBNS8NAEIYn9avGr6pHL4ul4KkkIuhJCl48tmA/oA1ls520SzebsLsRS+kv8CQoiFd/kif/jds2B219YeHhnRl25g1TwbXxvG+nsLG5tb1T3HX39g8Oj0rHJy2dZIphkyUiUZ2QahRcYtNwI7CTKqRxKLAdju/m9fYjKs0T+WAmKQYxHUoecUaNtRpP/VLZq3oLkXXwcyhDrnq/9NUbJCyLURomqNZd30tNMKXKcCZw5lZ6mcaUsjEdYteipDHqYLrYdEYq1hmQKFH2SUMWrvtrYkpjrSdxaDtjakZ6tTY3/6t1MxPdBFMu08ygZMuPokwQk5D52WTAFTIjJhYoU9wuS9iIKsqMDce1KfirN69D67LqW25clWu3eR5FOINzuAAfrqEG91CHJjBAeIZXeHPGzovz7nwsWwtOPnMKf+R8/gBKQI0j</latexit><latexit sha1_base64="qsvKBTJ5NAKSwUaIHVyo1ttN4GU=">AAAB6XicbZBNS8NAEIYn9avGr6pHL4ul4KkkIuhJCl48tmA/oA1ls520SzebsLsRS+kv8CQoiFd/kif/jds2B219YeHhnRl25g1TwbXxvG+nsLG5tb1T3HX39g8Oj0rHJy2dZIphkyUiUZ2QahRcYtNwI7CTKqRxKLAdju/m9fYjKs0T+WAmKQYxHUoecUaNtRpP/VLZq3oLkXXwcyhDrnq/9NUbJCyLURomqNZd30tNMKXKcCZw5lZ6mcaUsjEdYteipDHqYLrYdEYq1hmQKFH2SUMWrvtrYkpjrSdxaDtjakZ6tTY3/6t1MxPdBFMu08ygZMuPokwQk5D52WTAFTIjJhYoU9wuS9iIKsqMDce1KfirN69D67LqW25clWu3eR5FOINzuAAfrqEG91CHJjBAeIZXeHPGzovz7nwsWwtOPnMKf+R8/gBKQI0j</latexit><latexit sha1_base64="qsvKBTJ5NAKSwUaIHVyo1ttN4GU=">AAAB6XicbZBNS8NAEIYn9avGr6pHL4ul4KkkIuhJCl48tmA/oA1ls520SzebsLsRS+kv8CQoiFd/kif/jds2B219YeHhnRl25g1TwbXxvG+nsLG5tb1T3HX39g8Oj0rHJy2dZIphkyUiUZ2QahRcYtNwI7CTKqRxKLAdju/m9fYjKs0T+WAmKQYxHUoecUaNtRpP/VLZq3oLkXXwcyhDrnq/9NUbJCyLURomqNZd30tNMKXKcCZw5lZ6mcaUsjEdYteipDHqYLrYdEYq1hmQKFH2SUMWrvtrYkpjrSdxaDtjakZ6tTY3/6t1MxPdBFMu08ygZMuPokwQk5D52WTAFTIjJhYoU9wuS9iIKsqMDce1KfirN69D67LqW25clWu3eR5FOINzuAAfrqEG91CHJjBAeIZXeHPGzovz7nwsWwtOPnMKf+R8/gBKQI0j</latexit><latexit sha1_base64="qsvKBTJ5NAKSwUaIHVyo1ttN4GU=">AAAB6XicbZBNS8NAEIYn9avGr6pHL4ul4KkkIuhJCl48tmA/oA1ls520SzebsLsRS+kv8CQoiFd/kif/jds2B219YeHhnRl25g1TwbXxvG+nsLG5tb1T3HX39g8Oj0rHJy2dZIphkyUiUZ2QahRcYtNwI7CTKqRxKLAdju/m9fYjKs0T+WAmKQYxHUoecUaNtRpP/VLZq3oLkXXwcyhDrnq/9NUbJCyLURomqNZd30tNMKXKcCZw5lZ6mcaUsjEdYteipDHqYLrYdEYq1hmQKFH2SUMWrvtrYkpjrSdxaDtjakZ6tTY3/6t1MxPdBFMu08ygZMuPokwQk5D52WTAFTIjJhYoU9wuS9iIKsqMDce1KfirN69D67LqW25clWu3eR5FOINzuAAfrqEG91CHJjBAeIZXeHPGzovz7nwsWwtOPnMKf+R8/gBKQI0j</latexit>Qq0PCw Since C has boundary vertices of P with more than two distinct labels, C(cid:48) has more than two sites. Since all the vertices on the infinite face of C(cid:48) are sites, and since every site is in its own Voronoi cell, VD(C(cid:48)) has at least two trichromatic faces [7, 22] (one being the infinite face of C(cid:48)). Observe that all the newly introduced faces of C(cid:48) (those created by the edges connecting artificial vertices to vertices of f or to each other) have either a single label (in case the face is a triangle formed by an artificial vertex and two consecutive vertices of f with the same label), or two labels (in case the face has size 4, and is formed by two artificial vertices and two consecutive vertices of f with two distinct labels). It follows that VD(C(cid:48)) must have a trichromatic face of C, and so does VD∗ f ar(u, Q). 6 Final remarks The main open question is whether there exists a distance oracle occupying linear (or nearly linear) space and requiring constant (or polylogarithmic) time to answer queries. Note that currently, any oracle with O(n) space requires polynomial query time. In particular, the fastest known oracles with strictly linear space [37, 39] require Ω(n1/2+) query time. Another important question concerns the construction time. Is there a nearly-linear time algorithm to construct our oracle, or oracles with comparable space to query-time tradeoffs? References [1] Srinivasa Rao Arikati, Danny Z. Chen, L. Paul Chew, Gautam Das, Michiel H. M. Smid, and Christos D. Zaroliagis. Planar spanners and approximate shortest path queries among obstacles in the plane. In 4th ESA, pages 514 -- 528, 1996. [2] Franz Aurenhammer. Voronoi diagrams: a survey of a fundamental geometric data structure. ACM Comput. Surv., 23(3):345 -- 405, 1991. [3] Michael A. Bender and Martin Farach-Colton. The LCA problem revisited. In 4th LATIN, pages 88 -- 94, 2000. [4] Michael A. Bender and Martin Farach-Colton. The level ancestor problem simplified. Theor. Comput. Sci., 321(1):5 -- 12, 2004. [5] Glencora Borradaile, Piotr Sankowski, and Christian Wulff-Nilsen. Min st-cut oracle for planar graphs with near-linear preprocessing time. In 51th FOCS, pages 601 -- 610, 2010. [6] Sergio Cabello. Many distances in planar graphs. Algorithmica, 62(1-2):361 -- 381, 2012. [7] Sergio Cabello. Subquadratic algorithms for the diameter and the sum of pairwise distances in planar graphs. In 28th SODA, pages 2143 -- 2152, 2017. [8] Sergio Cabello, Erin W. Chambers, and Jeff Erickson. Multiple-source shortest paths in embedded graphs. SIAM J. Comput., 42(4):1542 -- 1571, 2013. [9] Timothy M. Chan and Dimitrios Skrepetos. Faster approximate diameter and distance oracles in planar graphs. In 25th ESA, pages 25:1 -- 25:13, 2017. [10] Panagiotis Charalampopoulos, Shay Mozes, and Benjamin Tebeka. Exact distance oracles for planar graphs with failing vertices. In 30th SODA, 2019. To appear. 21 [11] Danny Z. Chen and Jinhui Xu. Shortest path queries in planar graphs. In 32nd STOC, pages 469 -- 478, 2000. [12] Vincent Cohen-Addad, Søren Dahlgaard, and Christian Wulff-Nilsen. Fast and compact exact distance oracle for planar graphs. In 58th FOCS, pages 962 -- 973, 2017. [13] Mark de Berg, Otfried Cheong, Marc J. van Kreveld, and Mark H. Overmars. Computational geometry: algorithms and applications, 3rd Edition. Springer, 2008. [14] Ugur Demiryurek and Cyrus Shahabi. Indexing network voronoi diagrams. In 17th DASFAA, pages 526 -- 543, 2012. [15] Hristo Djidjev. On-line algorithms for shortest path problems on planar digraphs. In 22nd WG, pages 151 -- 165, 1996. [16] David Eppstein and Michael T. Goodrich. Studying (non-planar) road networks through an algorithmic lens. In 16th ACM-GIS, page 16, 2008. [17] Paul Erdos. Extremal problems in graph theory. In Proc. Symp. Theory of Graphs and its Applications, pages 29 -- 36, 1963. [18] Jeff Erickson, Kyle Fox, and Luvsandondov Lkhamsuren. Holiest minimum-cost paths and flows in surface graphs. In 50th STOC, pages 1319 -- 1332, 2018. [19] Martin Erwig. The graph voronoi diagram with applications. Networks, 36(3):156 -- 163, 2000. [20] Jittat Fakcharoenphol and Satish Rao. Planar graphs, negative weight edges, shortest paths, and near linear time. J. Comput. Syst. Sci., 72(5):868 -- 889, 2006. [21] Greg N. Frederickson. Fast algorithms for shortest paths in planar graphs, with applications. SIAM J. Comput., 16(6):1004 -- 1022, 1987. [22] Pawe(cid:32)l Gawrychowski, Shay Mozes, Oren Weimann, and Christian Wulff-Nilsen. Better tradeoffs for exact distance oracles in planar graphs. In 29th SODA, pages 515 -- 529, 2018. [23] Qian-Ping Gu and Gengchun Xu. Constant query time (1+\epsilon ) -approximate distance oracle for planar graphs. In 26th ISAAC, pages 625 -- 636, 2015. [24] Monika Rauch Henzinger, Philip N. Klein, Satish Rao, and Sairam Subramanian. Faster shortest-path algorithms for planar graphs. J. Comput. Syst. Sci., 55(1):3 -- 23, 1997. [25] Shinichi Honiden, Michael E. Houle, Christian Sommer, and Martin Wolff. Approximate shortest path queries using voronoi duals. Trans. Computational Science, 9:28 -- 53, 2010. [26] Ken ichi Kawarabayashi, Philip N. Klein, and Christian Sommer. Linear-space approximate distance oracles for planar, bounded-genus and minor-free graphs. In 37th ICALP, pages 135 -- 146, 2011. [27] Haim Kaplan, Shay Mozes, Yahav Nussbaum, and Micha Sharir. Submatrix maximum queries in monge matrices and partial monge matrices, and their applications. ACM Trans. Algorithms, 13(2):26:1 -- 26:42, 2017. [28] Ken-ichi Kawarabayashi, Christian Sommer, and Mikkel Thorup. More compact oracles for approximate distances in undirected planar graphs. In 23rd SODA, pages 550 -- 563, 2013. 22 [29] Philip N. Klein. Preprocessing an undirected planar network to enable fast approximate distance queries. In 12th SODA, pages 820 -- 827, 2002. [30] Philip N. Klein. Multiple-source shortest paths in planar graphs. In 16th SODA, pages 146 -- 155, 2005. [31] Philip N. Klein and Shay Mozes. Optimization algorithms for planar graphs. http://planarity. org. Book draft. [32] Philip N. Klein, Shay Mozes, and Christian Sommer. Structured recursive separator decompo- sitions for planar graphs in linear time. In 45th STOC, pages 505 -- 514, 2013. [33] Jakub Lacki and Piotr Sankowski. Min-cuts and shortest cycles in planar graphs in o(n loglogn) time. In 19th ESA, pages 155 -- 166, 2011. [34] Kurt Mehlhorn. A faster approximation algorithm for the steiner problem in graphs. Inf. Process. Lett., 27(3):125 -- 128, 1988. [35] Gary L. Miller. Finding small simple cycle separators for 2-connected planar graphs. In 16th STOC, pages 376 -- 382, 1984. [36] Shay Mozes, Kirill Nikolaev, Yahav Nussbaum, and Oren Weimann. Minimum cut of directed planar graphs in O(nloglogn) time. In 29th SODA, pages 477 -- 494, 2018. [37] Shay Mozes and Christian Sommer. Exact distance oracles for planar graphs. In 23rd SODA, pages 209 -- 222, 2012. [38] Shay Mozes and Christian Wulff-Nilsen. Shortest paths in planar graphs with real lengths in O(nlog2n/loglogn) time. In 18th ESA, pages 206 -- 217, 2010. [39] Yahav Nussbaum. Improved distance queries in planar graphs. In 12th WADS, pages 642 -- 653, 2011. [40] Atsuyuki Okabe, Toshiaki Satoh, Takehiro Furuta, Atsuo Suzuki, and K. Okano. Generalized network voronoi diagrams: Concepts, computational methods, and applications. International Journal of Geographical Information Science, 22(9):965 -- 994, 2008. [41] Mihai Patrascu and Liam Roditty. Distance oracles beyond the thorup-zwick bound. SIAM J. Comput., 43(1):300 -- 311, 2014. [42] Christian Sommer. Shortest-path queries in static networks. ACM Comput. Surv., 46(4):45:1 -- 45:31, 2014. [43] Mikkel Thorup. Compact oracles for reachability and approximate distances in planar digraphs. Journal of the ACM, 51(6):993 -- 1024, 2004. [44] Mikkel Thorup and Uri Zwick. Approximate distance oracles. J. ACM, 52(1):1 -- 24, 2005. [45] Christian Wulff-Nilsen. Approximate distance oracles for planar graphs with improved query time-space tradeoff. In 26th SODA, pages 351 -- 362, 2016. 23
1606.00726
1
1606
2016-06-02T15:43:29
On Solving Floating Point SSSP Using an Integer Priority Queue
[ "cs.DS" ]
We address the single source shortest path planning problem (SSSP) in the case of floating point edge weights. We show how any integer based Dijkstra solution that relies on a monotone integer priority queue to create a full ordering over path lengths in order to solve integer SSSP can be used as an oracle to solve floating point SSSP with positive edge weights (floating point P-SSSP). Floating point P-SSSP is of particular interest to the robotics community. This immediately yields a handful of faster runtimes for floating point P-SSSP; for example, ${O({m + n\log \log \frac{C}{\delta}})}$, where $C$ is the largest weight and $\delta$ is the minimum edge weight in the graph. It also ensures that many future advances for integer SSSP will be transferable to floating point P-SSSP.
cs.DS
cs
On Solving Floating Point SSSP Using an Integer Priority Queue Michael Otte Work done at University of Colorado at Boulder Dept. Aerospace Engineering Sciences Abstract. We address the single source shortest path planning prob- lem (SSSP) in the case of floating point edge weights. We show how any integer based Dijkstra solution that relies on a monotone integer prior- ity queue to create a full ordering over path lengths in order to solve integer SSSP can be used as an oracle to solve floating point SSSP with positive edge weights (floating point P-SSSP). Floating point P-SSSP is of particular interest to the robotics community. This immediately yields a handful of faster runtimes for floating point P-SSSP; for ex- ample, O(m + n log log C δ ), where C is the largest weight and δ is the minimum edge weight in the graph. It also ensures that many future advances for integer SSSP will be transferable to floating point P-SSSP. Our work relies on a result known to [Dinic, 1978] and [Tsitsiklis, 1995]; that, under the right conditions, SSSP can be solved using a partial or- dering of nodes, despite the fact that full orderings are typically used in practice. Thus, priority queues that do not extract keys in a mono- tonically nondecreasing order can be used to solve SSSP under a special set of conditions that always hold for floating point P-SSSP. In partic- ular, any node that has a shortest-path-length (key value) within δ of the queue's minimum key can be extracted (instead of the node with the minimum key) from the priority queue and Dijkstra's algorithm will still run correctly. Our contribution is to show how any monotonic in- teger priority queue can be transformed into a suitable δ-nonmonotonic floating point priority queue in order to produce the necessary partial or- dering for floating point values. Monotonic integer keys for floating point values are obtained by dividing the floating point key values by δ (as was done by [Dinic, 1978]) and then converting the result to an intege. The loss of precision this division causes is the reason the resulting floating point queue is δ-nonmonotonic instead of monotonic, but does not break the correctness of Dijkstra's algorithm. We also prove that the floating point version of non-negative SSSP (which allows δ = 0 in addition to δ > 0) cannot be solved without creating a full ordering of nodes (and thus requires a fully monotonic priority heap); and so our method cannot be extended to work on non-negative floating point SSSP, in general. 1 Introduction Finding the shortest path through a graph G = (E, V ) defined by sets of nodes V and edges E is a classic problem. The variation known as the "single source shortest-path planning problem" (or SSSP) is concerned with finding all of the shortest-paths from a particular node s ∈ V to all other nodes v ∈ V , where each edge (u, v) = ε ∈ E is associated with a length (cid:107)ε(cid:107). The first algorithm that solves SSSP was presented by Dijkstra in the 1950s using an algorithm that runs in time O(m + n2) for the case of nonnegative integer edge lengths [Dijk- stra, 1959]. Over the years, the SSSP problem has been studied extensively by computer scientists, who have primarily focus on the classic integer version of the problem. The robotics community, on the other hand, is more interested in floating point solutions to SSSP. In robotics, graphs are embedded in the envi- ronment1 and edge lengths represent distances along physical trajectories that a robot traverses to move between different locations. Movement is subject to the practical geometric constraints of the environment (topology and obstacles) as well as the dynamics and kinomatics of the robotic system. Thus, finding suitable trajectories (and their edge lengths) often involves solving a set of differential equations or other two-point boundary value problem. In short, the most natural numerical representation for robotics SSSP problems is not integers. The main contribution of this paper is to show how a large class of solutions for integer SSSP can easily be modified to solve floating point SSSP with strictly positive edge weights (floating point P-SSSP). Our work is applicable to both theoretical performance bounds, as well as the practical implementation of SSSP algorithms. We note that our method breaks if edges are allowed to have length 0. This is usually not a concern for robotics applications, where an edge of length 0 implies that the two nodes it connects represent the same location in the environment2 -- without loss of generality3 these can be combined into a single node and the 0 length edge removed from the graph. The vast majority of previous work on SSSP has involved graphs with inte- ger edge weights (related work is surveyed in Section 7). Sophisticated priority queue data structures have reduced the runtime of integer SSSP algorithms to O(m + n log n) for the restrictive comparison computational model and even further for the RAM computational model that most "real" computers use e.g., O(m + n log log n). See Table 1 for additional results. The discrepancy between the state-of-the-art for integer vs. floating point SSSP can be seen in Table 1. That said, notable floating point results in- clude [Thorup, 2000a] and [Thorup, 2004]. [Thorup, 2000a] proves that, in the case of undirected graphs (i.e., USSSP), an algorithm that solves integer USSSP can be used as an oracle to solve floating point USSSP. [Thorup, 2004] leverages the fact that, assuming the IEEE standard for floating point numbers and inte- gers is used, value orderings are preserved if we interpret the bit representations of floating point numbers directly as integers. The latter trick enables many (but 1In many cases the graph used for robotics is embedded within the configuration space of the robot (the space created as the product space over the degrees of freedom of the system), of which the physical environment is a lower dimensional projection. 2Or configuration space. 3At least in the robotics domain, where the graph is just a tool for reasoning about environmental connectivity with respect to the movement constraints of the robot. Table 1: Best theoretical runtimes prior to our work (with references) Directed (SSSP) Undirected (USSSP) O(m + n log log n) O(m + n log log C) O(m + n(log C log log C)1/3) O(n + m log log m) O(n + m log log C) [Thorup, 2004] O(m + n) [Thorup, 1999] [Thorup, 2004] [Raman, 1997] [Thorup, 1996] [Raman, 1997] O(m + n(B + C/B)) s.t. B < C + 1 [Cherkassky et al., 1996] O(m∆ + n(∆ + C/∆)) s.t. 0 < ∆ < C [Cherkassky et al., 1996] e s a c t s r o w r e g e t n I [Thorup, 2004] [Thorup, 2004] [Thorup, 2000b] [Thorup, 2004] O(m + n) [Thorup, 2000a] * [Cherkassky et al., 1999] + [Tsitsiklis, 1995] [Thorup, 2004] dO(m + n log log n) O(m + n log log C) √ log log n) O(m e O(m + n log log n) O(m + n log C log log C δ δ ) dO(m + n log log n) e t c e p x e s a c t s r o w e t c e p x e t n i o P g n i t a o l F O(m + n(log C δ )1/3+) * [Cherkassky et al., 1999] √ O(m log log n) Results with (*) assume strictly positive edges, (P-SSSP), 0 < δ ≤ (cid:107)ε(cid:107) ≤ C < ∞, ∀ε ∈ E. Other results hold for both positive and nonnegative edges (N-SSSP), 0 ≤ (cid:107)ε(cid:107) ≤ C < ∞. [Thorup, 2000b] + [Tsitsiklis, 1995] not all) results from integer SSSP to be extended to floating point SSSP, assum- ing IEEE standards are followed. In particular, it enables the direct application of the O(m + n log log n) integer SSSP algorithm presented in [Thorup, 2004] to be used to solve floating point SSSP. From a high-level point-of-view, our work extends the applicability of integer- to-floating-point oracles to a greater subset of SSSP. In particular, it enables any solution for integer SSSP that constructs a full ordering (i.e., by extracting values from an integer priority queue in a monotonically nondecreasing sequence) to solve floating point P-SSSP. The floating point solution happens via a partial ordering on path lengths that can be found by extracting floating point values in a special sequence that may not be monotonically nondecreasing. The trick that we use is fundamentally different than interpreting the bits of floating point numbers directly as integers, and thus applies to a different subset of SSSP algorithms than previous work. Many (and arguably most) integer SSSP Table 2: Best theoretical runtimes after our work (with references) Directed (SSSP) Undirected (USSSP) O(m + n log log n) O(m + n log log C) O(m + n(log C log log C)1/3) O(n + m log log m) O(n + m log log C) [Thorup, 2004] O(m + n) [Thorup, 1999] [Thorup, 2004] [Raman, 1997] [Thorup, 1996] [Raman, 1997] O(m + n(B + C/B)) s.t. B < C + 1 [Cherkassky et al., 1996] O(m∆ + n(∆ + C/∆)) s.t. 0 < ∆ < C [Cherkassky et al., 1996] e s a c t s r o w r e g e t n I dO(m + n log log n) e t c e p x e O(m + n log log C) √ log log n) O(m O(m + n log log n) O(m + n log log C δ ) O(m + n(log C δ log log C δ )1/3) O(n + m log log m) O(n + m log log C δ ) O(m + n(B + C δB )) s.t. B < C + 1 e s a c t s r o w t n i o P g n i t a o l F [Thorup, 2004] [Thorup, 2004] [Thorup, 2000b] [Thorup, 2004] O(m + n) [Thorup, 2000a] * new result * new result * new result * new result * new result O(m∆ + n(∆ + C δ∆ )) s.t. 0 < ∆ < C * new result dO(m + n log log n) O(m + n log log C δ ) e t c e p x e [Thorup, 2004] * new result √ O(m log log n) Results with (*) assume strictly positive edges, (P-SSSP), 0 < δ ≤ (cid:107)ε(cid:107) ≤ C < ∞, ∀ε ∈ E. Other results hold for both positive and nonnegative edges (N-SSSP), 0 ≤ (cid:107)ε(cid:107) ≤ C < ∞. Yellow indicates new results enabled by our work. [Thorup, 2000b] solutions construct a full ordering based on path-length. Leveraging this previous work, we immediately get a variety of faster theoretical runtimes for floating point P-SSSP. For example, combining our work with [Thorup, 2004] yields an algorithm for floating point P-SSSP that runs in time O(m + n log log C δ ), where δ is the minimum edge length in the graph. This is particularly of note given the comment in [Thorup, 2004] that "for floating point numbers we [they] do not get bounds in terms of the maximal weight," i.e., C. Other new results enabled by our work appear highlighted in Table 2. Our works also guarantees that any new faster results for integer SSSP that come from the discovery of a new monotonic integer priority queue will have corresponding counterparts for floating point P-SSSP. 1.1 High Level Description Our method relies on a result known to [Dinic, 1978] and [Tsitsiklis, 1995]; that, under the right conditions, SSSP can be solved using a partial ordering of nodes, despite the fact that full orderings are typically used in practice. In particular, any node that has a shortest-path-length (key value) within δ of the queue's minimum key can be extracted (instead of the node with the minimum key) from the priority queue and Dijkstra's algorithm will still run correctly. We show how an integer priority queue that extracts values in a monotonically nondeceasing order can easily be converted into a floating point priority queue that is suitable for solving floating point P-SSSP. This is acomplished by calculating integer keys for floating point values by dividing the latter by δ and then converting with truncation to an integer representation. The resulting floating point priority is no longer monotonic, but rather δ-nonmonotonic (see Section 2.3 for a discussion on the differences between δ-nonmonotonic and nonmonotonic). While [Dinic, 1978] uses a similar idea to improve integer bucket-based priority queues for solving integer SSSP, we are the first to employ this mechanism to leverage integer priority queues for solving floating point SSSP. Algorithmically this means that we store two keys with each node instead of one. The actual floating point key D(v) that reflects the current best guess of δ (cid:99). node v's shortest path length, as well as a companion integer key D(v) = (cid:98) D(v) We maintain the position of node v within the integer queue using D(v) instead of D(v). Whenever D(v) is decreased we recalculate D(v) from the new D(v) and then update v's position in the integer queue using D(v). The differences between standard Dijkstra's algorithm and a version using our modification to solve floating point P-SSSP can be seen by comparing Algorithms 1 and 2. Although there is loss of precision within the integer priority queue (due to conversion from floating point to integer with truncation) any resulting node reordering is upper-bounded by δ with respect to D(v). Thus, as long as δ > 0, any reordering of nodes that results due to this precision loss is still sufficient to solve floating point SSSP with Dijkstra's algorithm (i.e., the resulting δ- nonmonotonic extraction order from the resulting floating point queue creates a partial ordering sufficient for Dijkstra's algorithm to solve SSSP). The rest of this paper is dedicated to formalizing these results and discussing them in greater detail. 2 Preliminaries A graph G (either directed or underacted) is defined by its edge set E and vertex set V . We assume that both m = E and n = V are finite. Each edge εij = (vi, vj) between two vertices vi and vj (or from vi to vj if the edge is directed) is Algorithm 1: Dijkstra(G, s) standard implementation Input: A graph G = (E, V ) of node set V and edge set E, a start node s ∈ V , and a priority queue H. Output: Shortest path lengths d(v) and parent pointers p(v) with respect to the shortest path-tree S for all v ∈ V . /* S = ∅ */ ; /* S = S ∪ {v} */ ; 1 H = ∅ ; 2 for all v ∈ V do D(v) = ∞ ; p(v) = NULL ; 4 3 5 D(s) = 0 ; 6 v = s ; 7 while v (cid:54)= NULL do 8 9 10 11 12 13 14 d(v) = D(v) ; for all u s.t. (v, u) ∈ E do if d(v) + (cid:107)(v, u)(cid:107) < D(u) then D(u) = d(v) + (cid:107)(v, u)(cid:107) ; p(u) = v ; updateValue(H, u, D(u)) ; v = extractMin(H) ; assumed to have a predefined length (or edge-length or cost) (cid:107)εij(cid:107) = (cid:107)(vi, vj)(cid:107) such that 0 ≤ (cid:107)εij(cid:107) ≤ ∞ for all εij ∈ E. and εk = (vk−1, vk) for all k ∈ {2, . . . , (cid:96) − 1} and ε(cid:96) = (v(cid:96)−1, vj) and where {εk ∈ P (vi, vj)} ⊂ V . The shortest path P ∗(vi, vj) is the shortest possible path from vi to vj. Formally, A path P (vi, vj) is an ordered sequence of edges ε1, . . . , ε(cid:96) such that ε1 = (vi, v1) (cid:88) P ∗(vi, vj) ≡ arg min P (vi,vj ) (cid:107)ε(cid:107) ε∈P (vi,vj ) We are interested in paths from a particular "start-node" s to nodes v, and define d(v) to be the length of the shortest possible path from s to v. (cid:88) d(v) ≡ min P (s,v) (cid:107)ε(cid:107) ε∈P (s,v) Dijkstra's algorithm works by incrementally building a "shortest-path-tree" S outward from s, one node at a time. Dijkstra's algorithm appears in Algorithm 1. Each node that is not yet part of the growing S refines a "best-guess" D(v) of its actual shortest-path-length d(v), with the restriction that d(v) ≤ D(v). Dijkstra's algorithm guarantees/requires that d(v) = D(v) for the node in V \ S with minimum D(v). In modern versions of the algorithm, a min-priority-heap H (or related data structure) is used to keep track of D(v) values. The min-priority-heap H is initialized to empty, best-guesses D(v) are ini- tialized to ∞, parent pointers p(v) with respect to the shortest path tree S are Algorithm 2: Dijkstra(G, s) our modification that solves floating point P-SSSP using an integer priority queue. Input: A graph G = (E, V ) of node set V and edge set E, a start node s ∈ V , and a monotone integer priority queue H. Output: Shortest path lengths d(v) and parent pointers p(v) with respect to the shortest path-tree S for all v ∈ V . /* S = ∅ */ ; /* S = S ∪ {v} */ ; /* (cid:98)·(cid:99) converts to integer with 1 H = ∅ ; 2 for all v ∈ V do D(v) = ∞ ; p(v) = NULL ; 3 4 5 δ = ∞; 6 for all (v, u) ∈ E do δ = (cid:107)(v, u)(cid:107); if (cid:107)(v, u)(cid:107) < δ then 7 8 9 D(s) = 0 ; 10 v = s ; 11 while v (cid:54)= NULL do 12 13 14 15 16 17 18 19 d(v) = D(v) ; for all u s.t. (v, u) ∈ E do if d(v) + (cid:107)(v, u)(cid:107) < D(u) then D(u) = d(v) + (cid:107)(v, u)(cid:107) ; D(v) = (cid:98) D(v) δ (cid:99) truncation */ ; p(u) = v ; updateValue(H, u, D(v)) ; v = extractMin(H) ; initialized to NULL, and the start node s is given an actual distance of 0 from itself, lines 1-5, respectively. Each iteration involves "processing" the node v ∈ V \ S with minimum D(v) lines 8-13 (where v is removed, for all practical purposes, from future considera- tion during the algorithm's execution). Such a node v is extracted from the heap on line 14 (in the first iteration we know to use s, line 6). Next, each neighbor u of v checks if d(v) + (cid:107)(v, u)(cid:107) < D(u), that is, if the distance from s through the shortest-path-tree to v plus the distance from v to u through edge (v, u) ∈ E is less than u's current best-guess. If so, then u updates its best-guess and parent pointer to reflect the better path via v, lines 10-13. All neighbors u of v perform the update D(u) = min(D(u), d(v) + (cid:107)(v, u)(cid:107)). The heap is adjusted to account for changing D(u) on line 13. Our modification that enables any integer based solution (i.e., a monotone integer priority queue) to be used for a floating point problem appears in Algo- rithm 2. It relies on knowledge of δ, the length of shortest edge in E. (cid:107)ε(cid:107) δ = min ε∈E (1) If δ is not known a priori then it can be obtained by scanning all edges in the graph in time O(m), lines 5-8. We store two keys with each node instead of one. The actual floating point key D(v) that reflects the current best guess of node v's shortest path length, as well as a companion integer key D(v) = (cid:98) D(v) that is used to update the position of v within the integer priority queue. δ (cid:99), line 16, A number of the previous (integer-based) algorithms that are compatible with our method have runtime dependent on the maximum weight C and w, the word size of the computer being used (currently 32 or 64 in most computers). The effects of w and C on runtime are buried in the heap operations, and dependent on the particular algorithm being used. If a value of C is explicitly needed by a particular priority queue then it can be found by scanning edges at the beginning of the algorithm, similarly to δ. 2.1 Problem Variants Given G = (V, E) and a particular node s ∈ V , then for all v ∈ V , find the SSSP The single source shortest path planning problem is defined: shortest path P ∗(s, v). The problems is considered solved once we have produced a data structure containing both: 1. The shortest-path lengths d(v) for all v ∈ V from s. 2. The shortest path tree that can be used to extract the shortest path from s to any v (at least for any v such that d(v) < ∞). The latter can be accomplished by storing the parent of each node with respect to S, allowing each shortest path to be extracted by following back pointers in the fashion of gradient descent from v to s and then reversing the result. The reverse (i.e., sink) search that involves finding all paths to s (instead of from s) can be solved using basically the same algorithm except that the rolls played by in- and out- neighbors are swapped and the extracted path is not reversed. For the sake of clarity and brevity in the rest of our presentation, we now formally define abbreviations for a number of variations on SSSP. Variations are related to the range of allowable edge weights (e.g., whether or not zero-length edges allowed), and if edges are directed or undirected. N-SSSP "Nonnegative SSSP" refers to the special case of SSSP such that edges have nonnegative weights, 0 ≤ (cid:107)ε(cid:107) for all ε ∈ E. P-SSSP "Positive SSSP" refers to the special case of SSSP such that edges have positive weights, 0 < δ ≤ (cid:107)ε(cid:107) for all ε ∈ E. BN-SSSP "Bounded Nonnegative SSSP" refers to the special case of N-SSSP such that edge weights are bounded above, 0 ≤ (cid:107)ε(cid:107) ≤ C < ∞ for all ε ∈ E. BP-SSSP "Bounded Positive SSSP" refers to the special case of P-SSSP such that edge weights are bounded above, 0 < (cid:107)ε(cid:107) ≤ C < ∞ for all ε ∈ E. USSSP The single source shortest path planning problem for undirected graphs is defined: Given G = (V, E) such that for all (u, v) ∈ E there exists (v, u) ∈ E such that (cid:107)(u, v)(cid:107) = (cid:107)(v, u)(cid:107), and a particular node s ∈ V , then for all v ∈ V , find the shortest path P ∗(s, v). The prefixes N, P, BN, and BP can also be used with USSSP, e.g., P-USSSP is "Positive USSSP." Floating point vs. integer We explicitly differentiate between variants of problems that use either integer or floating point edge weights. For example, integer SSSP is the subset of SSSP that uses integer weights; floating point BP-SSSP is the subset of BP-SSSP that uses floating point weights; etc. 2.2 Orderings Dijkstra's original algorithm is provably correct (see [Dijkstra, 1959]), based on guarantees that the next node v processed at any step has the following properties: 1. v ∈ V \ S. 2. Either v = s or v has some neighbor u such that u ∈ S. 3. D(v) ≤ D(v(cid:48)), for all nodes v(cid:48) ∈ V \ S. As has often been remarked, it works by finding a full ordering on d(v) for all v ∈ V . The priority heap data structure enforces (3) and determines this ordering. However, a partial ordering based on δ is sufficient to solve P-SSSP; this is formally proven in Section 3 and has previously been shown by [Tsitsiklis, 1995] and, according to [Thorup, 1999], even earlier in Russian by [Dinic, 1978]. We make extensive use of the latter partial ordering in the current paper. Let v1, . . . , vn denote the order in which Dijkstra's algorithm processes nodes. FO (Full Ordering) A full ordering of nodes based on path-length level-sets is a sequence v1, . . . , vn such that: i < j ⇒ d(vi) ≤ d(vj). in other words, the fact that the j-th node is extracted after the i-th node implies that the shortest path from the j-th node is at least as long as the one from the i-th node. δ-PO (Partial Ordering Based on δ) A partial ordering of nodes based on δ values is a sequence v1, . . . , vn such that: i < j ⇒ d(vi) < d(vj) + δ where δ is the minimum edge weight in the graph. Note that δ-PO is similar to FO except that nodes v and u can be swapped if d(v) and d(u) are within δ. As we will show shortly, δ-PO is sufficient for solving P-SSSP. 2.3 Monotonicity A monotone priority queue is, unfortunately, given a variety of definitions in the literature. According to [Raman, 1996] "A monotone priority queue has the property that the value of the minimum key stored in the priority queue is a don- decreasing function of time." [Cherkassky et al., 1999] alternatively state that "In monotone priority queues the extracted keys form a monotone, nondecreasing sequence." While all heaps that meet the second definition necessarily meet the first; the reverse is not true, in general. The difference between these two definitions is particularly important for our work. The queues we use to create δ-PO have the property that the minimum value stored in the priority queue is monotonically nondecreasing but do not, in general, extract nodes from the priority queue in a monotonically nondecreasing order. Moreover, they do not even guarantee that the node with the minimum value is extracted; but instead guarantee only that the node extracted from the heap has a key that is within δ of the minimum. We will use the term "δ-nonmonotonic" to describe the floating point heap we use/require, in order to highlight this important property. We note that the class of δ-nonmonotonic priority queues are a relaxed ver- sion of "monotone priority queues" (where we use quotation marks to denote that either the first or second definition may be used). Thus our special δ- nonmonotonic priority queues can be assumed to require no more runtime or space than "monotone priority queues" and may even require less. The spe- cial (useful) case of δ-nonmonotonicity should not be confused with standard nonmonotonicity. A nonmonotonic priority queue always extracts the minimum value and makes no assumptions on the order, partial or otherwise, that key values are added to and/or extracted from the queue (since less assumptions can be made on the values stored in the queue, "nonmonotonic priority queues" require more runtime and space than "monotone priority queues"; this is the opposite of our special case δ-nonmonotonicity). 2.4 Computational Model We assume the existence of an algorithmic solution to integer N-SSSP that cre- ates a FO using a monotone integer priority queue. As such, we inherit whatever computational model is assumed by this underlying integer-based algorithm. In general, basic arithmetic and related operations on w-length words are assumed to require O(1) time; where w = O(log C) so that extra computations cannot be "hidden" by performing them in parallel on unnecessarily ample numerical representations. Previous methods with runtimes dependent on C assume that w ≥ log C (i.e., so that it is possible to efficiently represent integers and floating point numbers in memory), and thus w = Θ(log C). We additionally assume that the computational model supports floating point numbers and that floating-point-to-integer conversion (with truncation) is sup- ported in O(1) time. Similar to other floating point algorithms, we also assume cumulative errors due to fixed floating point precision are tolerated within the definition of "correct solution." This is commonly handled by representing float- ing point numbers at twice the normal precision during mathematical operations within the CPU and then rounding to the nearest represented floating point number for RAM storage. 3 Sufficiency of δ-PO Partial Ordering for Solving P-SSSP We now prove that Dijkstra's algorithm will correctly solve (integer and floating point) P-SSSP if nodes are processed according to δ-PO, the partial ordering based on δ as defined in Section 2.2. We note that [Tsitsiklis, 1995] presents an alternative proof of the same idea. Recall that "processing" vi is the act of removing vi from the heap and updating its neighbors v ∈ {vj (vi, vj) ∈ E} with respect to any path-length decreases that can be achieved via edges from vi. Lemma 1. Assuming δ-PO exists, and nodes are processed according to δ-PO with Dijkstra's algorithm, and d(vi) = D(vi) when vi is processed for i = 1, . . . , j − 1, then d(vj) = D(vj). Proof. (by contradiction) Assume instead d(vj) < D(vj). Therefore, there must exist some vk and edge εkj such that d(vk) + (cid:107)εkj(cid:107) = d(vj) < D(vj). This has two ramifications, first: because δ ≤ (cid:107)εkj(cid:107) by definition; and second: d(vk) + δ ≤ d(vj) (2) (otherwise, if k < j, then we would have already set D(vj) = d(vj) = d(vk) + (cid:107)εkj(cid:107)). But by the definition of δ-PO the fact that j < k implies: j < k yielding the necessary contradiction. d(vk) + δ > d(vj) (3) (cid:117)(cid:116) Now we are able to prove the correctness of Dijkstra's algorithm using δ-PO by showing that all nodes v are processed from the δ-PO heap only if d(v) = D(v), i.e., the shortest path from v to s has already been computed. Theorem 1. Assuming a δ-PO exists, and nodes are processed according to δ-PO, then Dijkstra's algorithm correctly sets d(v) = D(v) for all v ∈ V . Proof. The proof is by induction on j. The inductive step relies on Lemma 1 for j = n, . . . , 2. The base case for j = 1 is given by the fact that v1 = s and (cid:117)(cid:116) d(s) = D(s) = 0 before the algorithm starts. 4 Any Heap that Constructs an FO for Integer N-SSSP is an Oracle for δ-PO for Floating Point P-SSSP We now show how any monotone integer heap H that produces a FO when given integer weights for integer P-SSSP can be used as an oracle to create a δ-nonmonotonic floating point heap that produces a δ-PO for floating point P-SSSP. Recall that (for floating point SSSP) the floating point key for a node δ (cid:99), and v is given by D(v). We define a companion "integer key" D(v) = (cid:98) D(v) maintain the position v within H using D(v) instead of D(v). In other words, whenever D(v) is decreased we also recalculate D(v) and then update v in H using D(v). By definition of the conversion with truncation operator (cid:98)·(cid:99) and the fact that δ > 0 we are guaranteed that D(v) − δ D(v) < δ for all nodes at any point during Dijkstra's execution. Assuming that i < j, then at the instant vj is processed there are two cases: D(vj) − D(vi) = 0 and D(vj) − D(vi) ≥ 1. In the first case, D(vj) − D(vi) = 0 implies that D(vi) − D(vj) < δ and so ei- ther D(vi) < D(vj) + δ, in the case that D(vi) > D(vj), or D(vi) ≤ D(vj) other- wise -- and so D(vi) < D(vj) + δ trivially. In the second case D(vj) − D(vi) ≥ 1 implies that D(vi) < D(vj) and so D(vi) < D(vj) + δ trivially. This discussion yields the following theorem: Theorem 2. Assuming a heap H exists that creates a FO when used by Dijk- stra's algorithm on integer P-SSSP, then that heap can be used to create a δ-PO partial ordering for floating point P-SSSP. Proof. By induction, it is easy to see (from the above discussion) that nodes are processed such that i < j ⇒ d(vi) < d(vj) + δ. Thus, nodes are processed in a (cid:117)(cid:116) δ-PO. Combining this result with Theorem 1 completes the proof. In the worst case, all nodes always require a unique integer key. Thus, worst- case runtime for the resulting float P-SSSP algorithm is identical to that for the underlying integer N-SSSP algorithm with respect to n and m. That said, it is easy to imagine adding additional machinery to some preexisting heaps so that all nodes with the same integer key D(vi) are inserted into a single bucket, and the heap sorts buckets in place of individual nodes -- an idea that may reduce the expected running time in some case, although we do not pursue it further in the current paper. A notable difference between using an integer solution as an oracle for floating point data vs. using that same integer solution on raw integer data is the fact that we calculate integer keys by dividing floating point values by C. Thus, when used in conjunction with an integer priority queue solution that normally has a runtime dependent on C (e.g., bucketing based queues), the C used in the raw integer N-SSSP solution must be replaced by C/δ in the resulting floating point P-SSSP algorithm. This leads to the following corollary: Corollary 1. Assuming an integer P-SSSP solution is used as an oracle to solve a floating point P-SSSP, the latter will have similar runtime vs. the former with respect to n and m, while C will be replaced by C/δ. Integer N-SSSP trivially includes all of P-SSSP, since N-SSSP is a super-set of P-SSSP. This leads to two additional corollaries. Corollary 2. Assuming a heap H exists that creates a FO when used by Dijk- stra's algorithm on integer N-SSSP, then that heap can be used to create a δ-PO partial ordering for floating point N-SSSP. Corollary 3. Assuming an integer N-SSSP solution is used as an oracle to solve a floating point P-SSSP, the latter will have similar runtime vs. the former with respect to n and m, while C will be replaced by C/δ. 5 Faster Runtimes For Floating Point P-SSSP We now discuss new runtimes for floating point P-SSSP that are enabled by Corollary 1. The work by [Thorup, 2004] solves integer N-SSSP in time O(m + n log log C), combining their result with corollary 1 gives: Corollary 4. Floating point P-SSSP can be solved in time O(m + n log log C δ ). Corollary 5. Floating point P-SSSP can be solved in expected time O(m + n log log C δ ). Similarly, [Raman, 1997] proves that a combination of [Ahuja et al., 1990] and [Cherkassky et al., 1999] can solve integer N-SSSP in time O(m+n(log C log log C)1/3) so: Corollary 6. Floating point P-SSSP can be solved in time O(m + n(log C δ log log C δ )1/3). While these algorithms/corollaries cover a large chunk of the problem space defined by n × m × C, there are a variety of additional integer N-SSSP and P-SSSP algorithms that provide the best theoretical runtime for less frequently addressed regions of that space. We now briefly summarize these. Leveraging integer-based result from [Thorup, 1996]: Corollary 7. Floating point P-SSSP can be solved in time O(n + m log log m). and [Raman, 1997]: Corollary 8. Floating point P-SSSP can be solved in time O(n + m log log C δ ). and [Cherkassky et al., 1996] for both: Corollary 9. Floating point P-SSSP can be solved in time O(m + n(B + C for user defined parameter B < C + 1 Bδ )) and: Corollary 10. Floating point P-SSSP can be solved in time O(m∆ + n(∆ + C for user defined ∆. ∆δ )), Corollary 10 is the final corollary regarding runtime presented in our current paper. 6 Correct Dijkstra's on N-SSSP Requires a Full Ordering It would be nice if our method could somehow be extended to handle the case δ = 0 in addition to δ > 0; however, we now prove this is impossible. We first show that δ-PO is insufficient to correctly solve N-SSSP, and then proceed to prove that correctly solving N-SSSP requires a full ordering. 6.1 Insufficiency of δ-PO to Solve N-SSSP using Dijkstra's Algorithm We have defined δ-PO such that it only applies to P-SSSP. Even if we at- tempt to accommodate N-SSSP by letting δ = 0 then δ-PO degenerates into i < j ⇒ d(vi) < d(vj) where the latter inequality is strict. Thus, δ-PO can only exist if (cid:107)εij(cid:107) > 0 for all εij ∈ E -- otherwise the existence of some (cid:107)εij(cid:107) = 0 would guarantee that for some i and j it is the case that i < j despite the fact that d(vi) = d(vj), which would violate δ-PO. This contradiction leads to the following lemma: Lemma 2. δ-PO is insufficient to solve N-SSSP. 6.2 A Necessary Condition for Correct Dijkstra's on N-SSSP Lemma 2 suggests that allowing zero-length edges fundamentally changes the nature of the problem. However, it falls short of disproving that all best-path- length-based partial orderings (that are not also full orderings) are similarly doomed with respect to N-SSSP. In pursuit of the latter, we now prove a condi- tion required for a correct Dijkstra's algorithm and then define another ordering that is related to δ-PO but slightly more general. We begin by proving a necessary condition for any ordering that correctly solves N-SSSP. This particular condition is useful as an analytical tool simply because we can show that it is necessary (Theorem 3) and we can also show that it implies a full ordering is required for floating point N-SSSP in the worst case (Theorem 4). In particular, the following condition guarantees that if the best path to vc involves a zero-length sub-path immediately before reaching vc, and also there exists a worse path to vc via some other node vb, then all of the nodes involved in the zero-length subpath must be processed before vc in order to correctly solve N-SSSP. Condition A. If for all P ∗(s, vc) it is the case that there exists some va and P ∗(va, vc) ⊂ P ∗(s, vc) such that (cid:107)P ∗(va, vc)(cid:107) = 0, then: d(vc) = d(va) < d(vb) (cid:107)P ∗(va, vc)(cid:107) = 0 (cid:107)P ∗(s, vb)(cid:107) + (cid:107)εbc(cid:107) > d(vc) if then i ≤ c for all i s.t. vi ∈ P ∗(va, vc) (4) where we technically only require that P ∗(va, vc) is a zero-length subset of any optimal path to vc such that va (cid:54)= vc and d(vc) = d(va). In other words, we can break ties between two or more optimal paths arbitrarily. Lemma 3. Condition A is necessary to correctly solve N-SSSP using Dijkstra's algorithm. Proof. (by contradiction) Assume that c < i. Then by construction it is possible to create a graph satisfying Condition A such that nodes are processed in an order such that b < c < i, and consequently D(vc) = (cid:107)P ∗(s, vb)(cid:107) + (cid:107)εbc(cid:107) ≥ d(vc) (cid:117)(cid:116) at the instant vc is processed. 6.3 Another Ordering Let AO be defined as a sequence v1, . . . , vn such that both: -- Condition A is satisfied -- i < j ⇒ d(vi) ≤ d(vj) +  where  is a constant that we are allowed to choose per each problem instance. The definition of AO allows d(vi) = d(vj) and so it can handle zero-length edges even when  = 0 (it handles them trivially when  > 0). 6.4 For All  ≥ 0, AO Induces a Full Ordering for N-SSSP in the Worst Case We now prove that, for all  ≥ 0, AO induces a full ordering for N-SSSP in the worst case. We begin by examining AO when  > 0. Consider Figure 1, the dotted edges have zero length while the solid edges have length defined by their height span in the figure (width is used for illus- trative purposes only). By construction, for all i and j such that 2 ≤ i < n and 2 < j ≤ n and i < j edge lengths are defined such that 0 < (cid:107)ε1i(cid:107) < (cid:107)ε1j(cid:107) and (cid:107)ε1j(cid:107) − (cid:107)ε1i(cid:107) <  and (cid:107)εij(cid:107) = 0 Therefore, d(vk) = d(v2) for all k such that 1 < k ≤ n. ε2n vn vn−1 ε23 v2 ε12 v3 ε13 ε1(n−1) ε1n  d(v2) v1 Fig. 1: Dotted edges have zero length while the solid edges have length defined by their height span in the figure (width is used for illustrative purposes only). For all i and j such that 2 ≤ i < n and 2 < j ≤ n and i < j edge lengths are defined such that 0 < (cid:107)ε1i(cid:107) < (cid:107)ε1j(cid:107) and (cid:107)ε1j(cid:107) − (cid:107)ε1i(cid:107) <  and (cid:107)εij(cid:107) = 0 Lemma 4. Condition A induces a full ordering in the worst case for any  > 0 Proof. (by construction) For each k such that 2 < k < n there exists P ∗(vk−1, vk) ⊂ P ∗(s, vk) such that (cid:107)P ∗(vk−1, v1)(cid:107) = 0 and d(vk) = d(v2) < d(vn) and (cid:107)P ∗(vn, vk)(cid:107) = 0 and (cid:107)P ∗(s, vn)(cid:107) + (cid:107)εnk(cid:107) = dvn > d(vk). Thus, Condition A requires that k − 1 ≤ k < n. Trivially we know that s = v1 and so 1 < k, thus there is only one possible ex- traction order that will enable Dijkstra's algorithm to yield a correct solution to this N-SSSP: 1, 2, . . . , n -- and this is a full ordering. Moreover, this can be (cid:117)(cid:116) accomplished for any  > 0. We are now ready to consider  ≥ 0. Theorem 3. Assuming that Dijkstra's algorithm processes nodes according to a partial ordering i < j ⇒ d(vi) ≤ d(vj) + , where  ≥ 0, any partial ordering that yields a correct algorithm will induce a full ordering in the worst case. Proof. There are two cases:  > 0 and  = 0. In the first case, we have  > 0 and Lemmas 3 and 4 guarantee that in the worst case we will create a full ordering. In the second case, we have  = 0 and so we recover the definition of a full ordering, i.e., i < j ⇒ d(vi) ≤ d(vj). (cid:117)(cid:116) 7 Contributions and Related Work Our primary problem of interest is the floating point version of P-SSSP. The primary result of this paper is a general technique that allows any monotonic integer priority queue to be used to solve floating point P-SSSP, as well as understanding why this is possible and where the technique breaks down. Our contributions regarding the theoretical runtime of Dijkstra's algorithm can most easily be seen by comparing Tables 1 and 2. It is important to note that our new runtime results are only applicable to cases involving directed graphs with positive floating point weights, i.e., floating point P-SSSP. For disconnected graphs it is possible that m < n, and so we report runtimes in terms of both m and n (other authors have occasionally omitted terms in- volving only n because n = O(m) for connected graphs). A technical report that includes some of the ideas in this work appears in [Otte, 2015]; however, [Otte, 2015] focuses on a few select applications of the general idea presented in the current paper. 7.1 Comparison Computational Model Dijkstra's algorithm for N-SSSP was originally presented in [Dijkstra, 1959] with a runtime of O(m + n2) and assuming a comparison based computational model. [Williams, 1964] refined this to O(m log(n) + n) using a more sophisticated heap. The Fibonacci heap by [Fredman and Tarjan, 1987] allows the (integer and floating point) N-SSSP to be solved in O(m + n log n) -- this is believed to be the fastest possible theoretical runtime for a comparison-based computational model. 7.2 RAM Computational Model An alternative style of algorithm assumes a RAM computational model in order to use heaps based on some form of bucketing. [Dial, 1969] uses an approximate heap data structure to achieve runtime O(m + Cn) for integer BN-SSSP. [Ahuja et al., 1990] proves that a combination of a Radix-heap and a Fibonacci-heap will log C). [Fredman and Willard, 1990] use AF- solve integer BN-SSSP in O(m + n heaps to achieve O(m + n log n log log n ). Note that AF-heaps rely on Q-heaps, which assume that edge weights are integers. The ideas of [Dial, 1969] are extended by [Tsitsiklis, 1995] to floating point BP-SSSP in a RAM model with a runtime of O(n + m + C/δ). √ For integer BN-SSSP in the RAM model, [Cherkassky et al., 1996] uses a more complex variation of [Dial, 1969] to achieve time O(m + n(B + C/B)) and time O(m∆ + n(∆ + C/∆)), for user defined parameters B < C + 1 and ∆. [Thorup, 1996] achieves O(n + m log log m). [Raman, 1997] shows that com- bining results from [Ahuja et al., 1990] with those from [Cherkassky et al., 1996] yields a O(m + n(log C log log C)1/3) solution to integer BN-SSSP, and that [Thorup, 1996] can be extended to achieve O(n + m log log C). A later so- lution by [Cherkassky et al., 1999] achieves O(m + n log C log log C ). Although this is slightly worse than the result by [Raman, 1997], it is of interest because the hot- queue data structure it uses can be modified to solve floating point BP-SSSP in O(m + n log C log log C δ ) by incorporating the earlier ideas from [Tsitsiklis, 1995]. δ [Thorup, 2004] presents an integer priority queue that has constant time for the decrease key operation and is thus able to achieve a runtimes of O(m + n log log n) and O(m+n log log C) for integer N-SSSP and BN-SSSP, respectively. Using the trick of interpreting IEEE floating point numbers as integers enables the algorithm to also solve floating point N-SSSP in time O(m + n log log n). However, as the author of [Thorup, 2004] notes, "for floating point numbers we [they] do not get bounds in terms of the maximal weight" (i.e., C). We note that, as proved in Corollary 4, our method can be combined with the integer result of O(m + n log log C) from [Thorup, 2004] to yields a new algorithm with a runtime of O(m + n log log C/δ) for floating point BP-SSSP. This highlights one way our work differs from previous work. A handful of other improvements that are newly obtained by combining our work with previous integer results appear in Table 2. 7.3 Expected Times in RAM Model With regard to expected running times over randomizations (of edge lengths) √ and assuming RAM and integer N-SSSP, [Fredman and Willard, 1993] gives log n + n). More recent results by [Thorup, 1996] yield expected time O(m the expected time of O(m + n(log n)1/2+), while [Raman, 1996] and [Raman, 1997] give expected times O(m + n(log n log log n)1/2) and O(m + n(log C)1/4+) and O(m + n(log n)1/3+). [Cherkassky et al., 1999] achieves the slightly worse expected time O(m + n(log C)1/3+); however, we note that this hot-queues- based solution can be combined with [Tsitsiklis, 1995] to solve floating point N-SSSP in expected time O(m + n(log C δ )1/3+) -- so we include this in Table 1. [Thorup, 2000b] proves a general reduction from N-SSSP to sorting that leverages the randomized sorting algorithm in [Han and Thorup, 2002] to produce an integer N-SSSP algorithm that runs in expected time m log log n (this can be extended to floating point P-SSSP using the trick of interpreting IEEE floats as integers). √ The more recent work of [Thorup, 2004] provides solutions in worst case time (and therefore also expected time) O(m + n log log n) and O(m + n log log C) for integer N-SSSP and BN-SSSP, respectively. As noted above [Thorup, 2004] can be applied directly to floating point N-SSSP (by assuming IEEE standard floats are interpreted as integers) with runtime O(m+n log log n), but analogous floating point results in terms of C could not be achieved. On the other hand, our results from the current paper can be combined with [Thorup, 2004] to yield a new algorithm with a runtime of O(m + n log log C/δ) for floating point BP-SSSP. 7.4 Undirected Graphs (BN-USSSP) For the case of undirected edges with bounded positive integer weights (integer BN-USSSP) [Thorup, 1999] presents a method that runs in O(m + n), and then extends this to floating point BN-USSSP in [Thorup, 2000a]. In [Thorup, 2000a] it is noted that an alternative solution with significantly less overhead is also possible in O(log(δ) + α(m, n)m + n), where α(m, n) is the inverse Ackermann function using m and n. [Wei and Tanaka, 2013, Wei and Tanaka, 2014] present modifications to [Thorup, 2000a] that achieve better practical performance by removing the necessity of an "unvisited node structure" but do not change the- oretical runtime bounds (or the constant factor). 7.5 Other Special Cases The special case of (integer or floating point) P-SSSP involving z distinct weights can be solved in time O(m + n) if zn ≤ 2m and O(m log zn m + n), otherwise, using [Orlin et al., 2010]. Integer or floating point N-SSSP on planar graphs can be solved in O(n n) with a method by [Federickson, 1987], note that m = O(n) for planar graphs. √ 7.6 Partial Orderings The main conceptual difference between [Thorup, 1999, Thorup, 2000a] and our work is in the details of the partial orderings that are used. These differences cause both (A) theoretical ramifications regarding the subsets of SSSP for which a particular is applicable, and (B) practical differences affecting ease of imple- mentation and performance. The particular partial ordering we investigate δ-PO is grounded in the notion of shortest-path-length. Our method is designed for floating point P-SSSP, while [Thorup, 1999, Thorup, 2000a] is for integer and floating point BN-USSSP. The floating point method in [Thorup, 2000a] uses the integer algorithm in [Thorup, 1999] as an oracle; our work extends the basic oracle concept to a greater subset of SSSP using a completely different technique. The observation that P-SSSP can be solved using δ-PO was first observed by [Dinic, 1978], who used the trick of dividing by minimum edge weight to improve the use of bucket based integer priority queues for solving integer SSSP. [Tsitsiklis, 1995] proves the result for floating point P-SSSP and uses it in a variation of [Dial, 1969] to solve floating point BP-SSSP; although, without explicitly considering the runtime of the resulting algorithm with respect to C or δ. Our work can be also be considered an application of [Dinic, 1978] and a generalization of [Tsitsiklis, 1995]. We show that any monotone integer priority queue that creates a FO for integer N-SSSP (or P-SSSP) can be used as an oracle to create a δ-PO for floating point P-SSSP, and thereby solve floating point P-SSSP. Finally, we prove that δ-PO is insufficient to solve floating point N-SSSP and that any related ordering that correctly solves floating point P-SSSP must create a FO in the worst-case. 8 Remarks We now discuss a few points that we find interesting. 8.1 Integer N-SSSP vs. Floating Point N-SSSP Even though we have shown that heaps designed to solve integer N-SSSP can immediately be used to solve floating point P-SSSP in general, we fall short of achieving a similarly general oracle method that can solve floating point N-SSSP. The reason for this discrepancy is intimately related to zero-length edges and enforcement of Condition A. It is impossible to make the granularity of the partial ordering small enough (i.e., without creating full ordering) to guarantee that processing nodes based on D(v) = D(v)/δ instead of D(v) yields a correct algorithm. Indeed, this result extends to any method relying on D(v) = D(v)/x, regardless of how x is chosen. There will always be problems when x = 0. More interesting is the result from Lemma 3, which proves that Condition A is necessary for any ordering that correctly solves N-SSSP. Note that this does not conflict with previous results for integer N-SSSP case -- it is trivial to show that full orderings guarantee Condition A, and all state-of-the-art in- teger N-SSSP algorithms based on shortest-path-length partial orders use full orderings. Indeed, the main ramification of Lemma 3 appears to be that it is impossible for any version of Dijkstra's algorithm to solve general-case float- ing point N-SSSP by using a (non-full) partial ordering based on shortest-path length. Thus, future work on the general floating point N-SSSP problem must either: (1) use an alternative method that in which orderings consider more than just best-path-length (as [Thorup, 1999] has done for the USSSP case), or (2) attempt to create faster full-order inducing heaps that use floating point keys directly. 8.2 Floats, Ints and the IEEE Standard It has often been remarked, e.g., by [Thorup, 2000a], that given the IEEE stan- dards for floating point and integer representations it is often possible to use floating point numbers directly in some integer heaps by reinterpreting their binary values directly as integers. This is obviously true for comparison based algorithms, but is even true for some of the bucket-based structures such as Radix heaps. In contrast, the idea presented in the current paper is representation agnostic. This is theoretically important because there are a variety of ways to represent real numbers for computational purposes other than IEEE standard, for example, unnormalized versions of binary and decimal floating point numbers and more exotic alternatives such as: continued fractions [Vuillemin, 1990], logarithmic [Swartzlander and Alexopoulos, 1975], semi-logarithmic [Muller et al., 1998], level-index [Clenshaw and Olver, 1984], floating-slash [Matula and Kornerup, 1985], and others [Vuillemin, 1994, Muller et al., 2009]. Our results hold for all binary representations of positive real numbers such that an O(1) integer conversion operation exists, and an integer-based heap exists that can solve N-SSSP or P-SSSP for the resulting integer representation. 9 Summary and Conclusions We provide a new proof that using Dijkstra's algorithm directly with partial ordering based on shortest-edge-length and best-path-length is sufficient to solve the floating point positive edge weight case of the single source shortest path planning problem (SSSP) -- we note this result has been previously obtained by [Dinic, 1978] and [Tsitsiklis, 1995] using alternative analysis. Based on this result, we present a simple yet general method that enables a large class of results from the nonnegative (and positive) integer case of SSSP to be extended to the positive floating point case of SSSP. In particular, any integer priority queue that solves integer SSSP by creating a full ordering (by extracting nodes in a monotonically nondecreasing sequence of best-path-length key values) can be used as an oracle to solve the floating point SSSP with positive edge weights (by creating a sufficient partial ordering). This immediately yields a handful of faster theoretical runtimes for the positive floating point case of SSSP -- both worst case and expected times and for various relationships between n, m, and C. The idea is easy to implement in practice, i.e., in conjunction with many practical heaps that solve integer SSSP. Moreover, it guarantees that many future advances for the integer case, both theoretical and practical, will immediately yield better results for the positive floating point case of SSSP. Finally, we prove that Dijkstra's Algorithm must use a full ordering to solve the nonnegative floating point of SSSP in the worst case (and thus our results cannot be extended to nonnegative floating point SSSP). The latter is due to complications inherent with using zero-length edges, and suggests that future work for the floating point case of SSSP must either involve a departure from Dijkstra's Algorithm or the discovery of heaps that are able to create full order- ings over floating point numbers more quickly. Acknowledgments This work was supported by the Control Science Center of Excellence at the Air Force Research Laboratory (AFRL), the National Science Foundation (NSF) grant IIP-1161029, and the Center for Unmanned Aircraft Systems. The majority of this work was completed while the author was "in residence" at AFRL. References Ahuja et al., 1990. Ahuja, R. K., Mehlhorn, K., Orlin, J., and Tarjan, R. E. (1990). Faster algorithms for the shortest path problem. Journal of the ACM (JACM), 37(2):213 -- 223. Cherkassky et al., 1996. Cherkassky, B. V., Goldberg, A. V., and Radzik, T. (1996). Shortest paths algorithms: Theory and experimental evaluation. Mathematical pro- gramming, 73(2):129 -- 174. Cherkassky et al., 1999. Cherkassky, B. V., Goldberg, A. V., and Silverstein, C. (1999). Buckets, heaps, lists, and monotone priority queues. SIAM Journal on Computing, 28(4):1326 -- 1346. Clenshaw and Olver, 1984. Clenshaw, C. W. and Olver, F. W. (1984). Beyond floating point. Journal of the ACM (JACM), 31(2):319 -- 328. Dial, 1969. Dial, R. B. (1969). Algorithm 360: Shortest-path forest with topological ordering [h]. Communications of the ACM, 12(11):632 -- 633. Dijkstra, 1959. Dijkstra, E. W. (1959). A note on two problems in connexion with graphs. Numerische mathematik, 1(1):269 -- 271. Dinic, 1978. Dinic, E. A. (1978). Economical algorithms for fidnding shortest paths in a network. In Popkov, Y. S. and Shmulyian, B. L., editors, Transportation Modeling Systems, pages 36 -- 44, Moscow. Institute for System Studies. Federickson, 1987. Federickson, G. N. (1987). Fast algorithms for shortest paths in planar graphs, with applications. SIAM Journal on Computing, 16(6):1004 -- 1022. Fredman and Tarjan, 1987. Fredman, M. L. and Tarjan, R. E. (1987). Fibonacci heaps and their uses in improved network optimization algorithms. Journal of the ACM (JACM), 34(3):596 -- 615. Fredman and Willard, 1990. Fredman, M. L. and Willard, D. E. (1990). Trans- dichotomous algorithms for minimum spanning trees and shortest paths. In Foun- dations of Computer Science, 1990. Proceedings., 31st Annual Symposium on, pages 719 -- 725. IEEE. Fredman and Willard, 1993. Fredman, M. L. and Willard, D. E. (1993). Surpassing the information theoretic bound with fusion trees. Journal of computer and system sciences, 47(3):424 -- 436. Han and Thorup, 2002. Han, Y. and Thorup, M. (2002). Integer sorting in o (n(log log n)) expected time and linear space. In Foundations of Computer Science, 2002. Proceedings. The 43rd Annual IEEE Symposium on, pages 135 -- 144. IEEE. Matula and Kornerup, 1985. Matula, D. W. and Kornerup, P. (1985). Finite precision rational arithmetic: Slash number systems. IEEE transactions on computers, (1):3 -- 18. Muller et al., 2009. Muller, J.-M., Brisebarre, N., De Dinechin, F., Jeannerod, C.-P., Lefevre, V., Melquiond, G., Revol, N., Stehl´e, D., and Torres, S. (2009). Handbook of floating-point arithmetic. Springer Science & Business Media. Muller et al., 1998. Muller, J.-M., Scherbyna, A., and Tisserand, A. (1998). Semi- logarithmic number systems. Computers, IEEE Transactions on, 47(2):145 -- 151. Orlin et al., 2010. Orlin, J. B., Madduri, K., Subramani, K., and Williamson, M. (2010). A faster algorithm for the single source shortest path problem with few distinct positive lengths. Journal of Discrete Algorithms, 8(2):189 -- 198. Otte, 2015. Otte, M. (2015). Modifying dijkstra's algorithm to solve many instances of sssp in linear time. Technical report, University of Colorado. Raman, 1996. Raman, R. (1996). Priority queues: Small, monotone and trans- dichotomous. In AlgorithmsESA'96, pages 121 -- 137. Springer. Raman, 1997. Raman, R. (1997). Recent results on the single-source shortest paths problem. ACM SIGACT News, 28(2):81 -- 87. Swartzlander and Alexopoulos, 1975. Swartzlander, E. E. and Alexopoulos, A. G. IEEE Transactions on Computers, (1975). The sign/logarithm number system. (12):1238 -- 1242. Thorup, 1996. Thorup, M. (1996). On ram priority queues. 81:59. Thorup, 1999. Thorup, M. (1999). Undirected single-source shortest paths with posi- tive integer weights in linear time. Journal of the ACM (JACM), 46(3):362 -- 394. Thorup, 2000a. Thorup, M. (2000a). Floats, integers, and single source shortest paths. Journal of Algorithms, 35(2):189 -- 201. Thorup, 2000b. Thorup, M. (2000b). On ram priority queues. SIAM Journal on Computing, 30(1):86 -- 109. Thorup, 2004. Thorup, M. (2004). Integer priority queues with decrease key in con- stant time and the single source shortest paths problem. Journal of Computer and System Sciences, 3(69):330 -- 353. Tsitsiklis, 1995. Tsitsiklis, J. N. (1995). Efficient algorithms for globally optimal tra- jectories. IEEE Transactions on Automatic Control, 40(9). Vuillemin, 1990. Vuillemin, J. E. (1990). Exact real computer arithmetic with contin- ued fractions. Computers, IEEE Transactions on, 39(8):1087 -- 1105. Vuillemin, 1994. Vuillemin, J. E. (1994). On circuits and numbers. Computers, IEEE Transactions on, 43(8):868 -- 879. Wei and Tanaka, 2013. Wei, Y. and Tanaka, S. (2013). An improved thorup shortest paths algorithm with a modified component tree. In Natural Computation (ICNC), 2013 Ninth International Conference on, pages 1160 -- 1165. IEEE. Wei and Tanaka, 2014. Wei, Y. and Tanaka, S. (2014). Improvement of thorup shortest path algorithm by reducing the depth of a component tree. Journal of Advances in Computer Networks, 2(2). Williams, 1964. Williams, J. W. J. (1964). Heapsort. Communications of the ACM, 7:347 -- 348.
1203.5675
1
1203
2012-03-26T14:12:48
Memory Hierarchy Sensitive Graph Layout
[ "cs.DS", "cs.DB", "cs.PF" ]
Mining large graphs for information is becoming an increasingly important workload due to the plethora of graph structured data becoming available. An aspect of graph algorithms that has hitherto not received much interest is the effect of memory hierarchy on accesses. A typical system today has multiple levels in the memory hierarchy with differing units of locality; ranging across cache lines, TLB entries and DRAM pages. We postulate that it is possible to allocate graph structured data in main memory in a way as to improve the spatial locality of the data. Previous approaches to improving cache locality have focused only on a single unit of locality, either the cache line or virtual memory page. On the other hand cache oblivious algorithms can optimise layout for all levels of the memory hierarchy but unfortunately need to be specially designed for individual data structures. In this paper we explore hierarchical blocking as a technique for closing this gap. We require as input a specification of the units of locality in the memory hierarchy and lay out the input graph accordingly by copying its nodes using a hierarchy of breadth first searches. We start with a basic algorithm that is limited to trees and then extend it to arbitrary graphs. Our most efficient version requires only a constant amount of additional space. We have implemented versions of the algorithm in various environments: for C programs interfaced with macros, as an extension to the Boost object oriented graph library and finally as a modification to the traversal phase of the semispace garbage collector in the Jikes Java virtual machine. Our results show significant improvements in the access time to graphs of various structure.
cs.DS
cs
Memory Hierarchy Sensitive Graph Layout Amitabha Roy University of Cambridge [email protected] 2 1 0 2 r a M 6 2 ] S D . s c [ 1 v 5 7 6 5 . 3 0 2 1 : v i X r a Abstract Mining large graphs for information is becoming an increasingly important workload due to the plethora of graph structured data be- coming available. An aspect of graph algorithms that has hitherto not received much interest is the effect of memory hierarchy on accesses. A typical system today has multiple levels in the mem- ory hierarchy with differing units of locality; ranging across cache lines, TLB entries and DRAM pages. We postulate that it is pos- sible to allocate graph structured data in main memory in a way as to improve the spatial locality of the data. Previous approaches to improving cache locality have focused only on a single unit of locality, either the cache line or virtual memory page. On the other hand cache oblivious algorithms can optimise layout for all lev- els of the memory hierarchy but unfortunately need to be specially designed for individual data structures. In this paper we explore hi- erarchical blocking as a technique for closing this gap. We require as input a specification of the units of locality in the memory hier- archy and lay out the input graph accordingly by copying its nodes using a hierarchy of breadth first searches. We start with a basic al- gorithm that is limited to trees and then extend it to arbitrary graphs. Our most efficient version requires only a constant amount of ad- ditional space. We have implemented versions of the algorithm in various environments: for C programs interfaced with macros, as an extension to the Boost object oriented graph library and finally as a modification to the traversal phase of the semispace garbage collec- tor in the Jikes Java virtual machine. Our results show significant improvements in the access time to graphs of various structure. Introduction 1. Modern computer systems usually consist of a complex path to memory. This is necessitated by the difference between the speed of computation and that of accessing memory, often referred to as the memory wall. While microprocessor performance has increased by 60% every year, memory systems have increased in performance by only 10% every year. The typical solution employed by memory designers is to use faster smaller caches to cache data from larger but slower lev- els of memory. For example, a typical CPU cache would cache 64 byte lines from main memory while a Translation Lookaside Buffer (TLB) would cache mappings for 4KB chunks of virtual ad- dress space. A typical access to memory therefore has to negotiate many levels of hierarchy. Locality therefore has an important role to play for the in-memory processing of large datasets. If accesses are clustered (blocked) on the same 64 byte or 4KB chunk of mem- ory (which we call units of spatial locality), it will lead to fewer transfers between levels in the memory hierarchy and consequently better performance. Graphs form an important and frequently used abstraction for the processing of large data. This is more so today, with increasing interest in mining graph structured data: common examples being page-ranking that examines the hyperlinking between web-pages, community detection in social networks, navigational queries on road-network data or simulating the spread of epidemics (viruses) over human (computer) networks. Thus far, little attention has been paid to mitigating the impact of the memory hierarchy on processing large graphs. This paper makes the case that sensitivity to the memory hierarchy can make a big difference to the costs of processing large graphs. Existing research along the same lines can be divided into two categories. The first category optimises object layout and connec- tivity taking into account only one level of the memory hierar- chy. These algorithms however are suitable for use at runtime on arbitrary graphs. The second category are cache-oblivious algo- rithms that can optimise data structure layouts without knowing the precise hierarchy in use on the machine. Unfortunately cache- oblivious algorithms have been designed only for specific data structures and the techniques cannot be applied to graphs in gen- eral. This paper proposes a Hierarchical Blocking Algorithm (HBA) as a solution. The HBA proposed in this paper takes arbitrary graphs as input and produces a layout that is sensitive to all levels of the memory hierarchy, information about which is supplied to the algorithm. We show that not only does this make a large difference to the processing of graphs, it also performs comparably to a cache oblivious layout. The HBA therefore, closes the gap between cache oblivious and cache sensitive (but limited to a single level) algorithms, an important contribution of this paper. The rest of this paper is organised as follows. We begin with some intuition about HBA and describe how it is motivated by cache oblivious algorithms in Section 2. We then describe a basic version of HBA applicable only to trees in Sections 3, 4 and 5. We then provide extensions that make it applicable to arbitrary graphs in Section 6 and extensions for space efficiency in Section 7. We then describe implementation in three different environments (custom graph processing in C, Boost C++ graph libraries and the semispace garbage collector in the Jikes Java Virtual Machine) in Section 8. We then evaluate HBA and show that it delivers significant speedups in all these environments (from 10% to as much as 21X). We then discuss related work and possible future extensions to HBA, before concluding. [Copyright notice will appear here once 'preprint' option is removed.] 1 2018/10/17 D/2 T0 D/2 T1 D Tk Layout in memory T0 T1 Tk Figure 1. van Emde Boas Layout 2. Motivation and Intuition The hierarchical blocking algorithm we have developed draws strong inspiration from the van Emde Boas (VEB) layout. The VEB tree, originally proposed in a paper outlining a design for a priority queue [20] is an arrangement that makes a tree data- structure cache oblivious i.e. likely to provide good performance regardless of the cache hierarchy or units of spatial locality in oper- ation. The van Emde Boas(VEB) layout had provided some of the initial motivation for this work. Figure 1 details the intuition behind the VEB layout. The VEB layout is a layout of a tree that is done by repeatedly splitting it at the middle and recursively laying out all the component subtrees in contiguous units of memory. In the figure, the tree of depth D is split into a subtree (rooted at the original tree) of depth D 2 and this is recursively laid out first. Next, the remaining subtrees, O(2 D 2 ) in number, are laid out recursively. The VEB layout is complex to setup and maintain for trees and difficult to apply to graphs in general. The first step in applying it to a graph is to traverse the graph and prepare a sub-graph in the form of a tree that covers it. This spanning tree could then be laid out in a VEB layout. The key difficulty however is determining where to cut the tree since a-priori knowing the diameter of a graph and its splits at runtime is a difficult business. Further, the VEB layout does not consider heterogeneous graphs where the objects representing graph vertices may have different sizes, rendering it impractical to apply. Our approach instead is to make the problem somewhat easier by assuming that the memory hierarchy (of caches) is known at runtime as an input to the algorithm. This can be used during the traversal to determine the spanning subtree in conjunction with information about the size of in-memory representations of graph vertices to determine the right split-point. Figure 2 shows graphically how this might be done. Assume an algorithm Pi that aims to copy a tree while traversing it, into blocks that fit into the cache at level i. Using breadth first search, it can discover the entire subtree that fits into a block at level i. It can then call breadth first searches for individual subtrees that are rooted at the leaves of this subtree (not shown in the Figure). For the subtree it has identified, it can recursively call Pi−1: an algorithm that can lay out a given tree into blocks that fit into the cache at level i − 1. This is shown in the Figure and corresponds (roughly) to the recursive layout achieved by VEB. The key difference is that we know where to cut the spanning tree based on runtime information about the memory hierarchy rather than simply using half the diameter of the graph. Level i T0 Level i - 1 T1 Tk Level i - 1 Level i - 1 Layout in memory T0 T1 Tk Figure 2. Hierarchical Blocking Layout Having provided intuition behind our Hierarchical Blocking Algorithm (HBA), we now proceed to discuss it in more detail below. 3. Hierarchical Blocking for Trees In this section we develop a hierarchical blocking algorithm appli- cable to trees. A tree is a graph (either directed or undirected) where every vertex has a unique parent and is itself connected to a number of children. We express the algorithm in terms of repeated breadth- first searches [13] each of which is bounded to produce roots for new searches. We begin by introducing some basic notation that we use in this section. We denote the application of an Algorithm A to a graph vertex x as A(x), which produces as output a list of vertices. We denote application of an algorithm A to a list of vertices L by A(L), which is done by applying it to each individual vertex and concatenating the outputs in order. We denote the repeated application of an algorithm (using the output of one as the input of the next) as Ak, which means that we apply algorithm A k times. An important concept for hierarchical blocking is the space occupied by representations of a vertex. For a vertex v we assume a way to measure the space occupied by the vertex, which we represent as v. This naturally extends to applying an algorithm A on input I as A(I), which is just the sum of the spaces occupied by every vertex that is processed to produce the output. The core algorithm is bounded breadth first search, which we abbreviate as BFSd that takes as input one vertex and produces a list of vertices that are at distance d from the start vertex. We measure distance as the number of edges traversed. We also delegate to BFSd the job of copying traversed vertices into a spatially contiguous unit of memory. We consider here a memory hierarchy of n levels with mono- tonically increasing units of spatial locality: si for level i, with si < si+1. We now define a blocking algorithm that takes as input a list of vertices and memory hierarchy levels, and recursively calls itself with decreasing levels. We denote the algorithm for level i as Pi taking as input a single vertex o. As indicated above, using Pi on a list of vertices naturally follows from the definitions given below. • P1(o) = BFSd(o) where we choose depth d such that : If BFS0(o) > s1 then d = 0 Else choose d such that BFSd−1(o) < s1 and BFSd(o) ≥ s1 • Pi(o) := Pk i−1(o) where we choose k such that: If Pi−1(o) > si then set k = 1 Else choose k such Pk−1 i−1 (o) < si and Pk i−1(o) ≥ si 2 2018/10/17 At the start we are given the root of the tree: r. For hierarchical blocking of the tree, we repeatedly apply Pn starting from r until we have copied all the vertices (the output list is empty). The formalism given above produces exactly the layouts that we have provided an intuition for in the previous section. A crucial point to note here is that we allow the copying to overshoot the set limit by an amount bounded by one application of the algorithm at the next underlying level. 4. Analysis A traversal of the tree needs to transfer blocks of size si from the ith level in the memory hierarchy. We now provide an upper bound on the number of such blocks transferred. We make the observation that any application of Pn can be ultimately expressed as repeated applications of Pi for any i < n. Consider a traversal of the copied tree generated by Pi(x) for an arbitrary vertex x in the input graph. We consider a traversal that starts from the copy of x produced by Pi(x) and terminates at some leaf in the copied subtree produced by Pi(x). For any memory hierarchy level i , regardless of the start vertex. i+1 = 2 + Bi+1 j this traversal leads to the transfer of some number of blocks of size s j. Let an upper bound on the number of memory blocks at level j accessed due to this traversal be B j Theorem 1. Bi+1 Proof. For any x: Pi+1(x) is defined as Pd (x) ≤ si+1. Now traversing a block of memory of size si+1 can incur accesses to at worst 2 blocks at level i + 1 (if the block start is not aligned). The remaining part of the traversal is to a subtree produced by Pi(y) for some leaf y of the previous traversal incurring at most Bi+1 block transfers. Hence we have: Bi+1 i (x) with Pd−1 i+1 = 2 + Bi+1 i i i i 1 < s2 and 4s j ≤ s j+1 then Bi Under the common conditions where each level in the memory 1 fits i for hierarchy is sufficiently smaller than the next level and B1 within s2 we can deduce a simple constant upper bound on Bi any i. Theorem 2. If ∀ j B1 Proof. The theorem is true at i = 1 due to the conditions of the theorem where B1 1 < s2 and s2 is at most 4 blocks of s1. We now give an inductive proof. Let the theorem be true till i = k. We have Bk+1 k ≤ 4. Four blocks at level k is at most one misaligned block at level k + 1 (due to the bounds on sizes at each level) which is at most two aligned blocks at level k + 1. Hence Bk+1 . From the induction hypothesis Bk k+1 = 2 + Bk+1 i ≤ 4 k+1 ≤ (2 + 2) = 4 k In the context of the whole tree a traversal from root to leaf in the copied tree incurs repeated costs of Bi n at memory hierarchy level i. If we assume that Pi(x) covers subtrees of depths at least di then the number of block accesses at memory hierarchy level i for a traversal of depth D is bounded by 4 D+1 di+1 . For a pseudorandom allocation of vertices to memory, one would normally expect every access to cause a transfer, leading to D + 1 transfers. The hierarchical blocking algorithm is therefore able to guarantee reduced transfers when di > 3. Note that this is a pessimistic upper bound. For example, at the lowest level (usually cache lines) any organisation that packs subtrees of depth one into a cacheline leads to better performance with one cacheline serving two access requests instead of one. Iterative Version 5. We now present an iterative version of the hierarchical blocking algorithm (HBA). In addition to being easier to understand, imple- ment and analyse; it forms the basis for extension to handle ar- bitrary graphs. The HBTreeIterative algorithm listed in Proce- dure 1 is a direct translation of the recursive algorithm described in the previous section. It takes as input a root vertex and a description of a memory hierarchy and performs runtime hierarchical blocking of the tree rooted at the supplied vertex. Starting from this section, we introduce the term 'node', that we use as an abstraction for the memory occupied by a graph vertex (and any associated edge data structure, such as an edge list). //////Promote leaves[level + 1].append(roots[level]) roots[level] := empty space[level + 1] := space[level + 1] + space[level] level := level + 1 continue loop if roots[level].is empty() then ////////Refill roots[level] := leaves[level] leaves[level] := empty if space[level] ≥ s[level] then Procedure 1 HBTreeIterative Input: root: root to block from Input: n: levels of hierarchy Input: s[1..n]: block sizes (monotonically increasing) Input: s[n+1] = INFINITY 1: Initialise to empty: Dequeue roots[1..n+1] 2: Initialise to empty: Dequeue leaves[1..n+1] 3: Initialise to zero: space[1..n+1] 4: roots[n+1].push back(root) 5: level := n + 1 6: loop 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: /////Do some copying work if UnconditionalCopyNode(node) then space[1] := space[1] + sizeof(node) leaves[1].append(children(node)) //////Push work down roots[level - 1].push back(node) space[level - 1] := 0 level := level - 1 node := roots[level].pop front() if level > 1 then //////Promote if level = (n + 1) then if roots[level].is empty() then TERMINATE else else else space[level + 1] := space[level + 1] + space[level] level := level + 1 Procedure 2 UnconditionalCopyNode Input: node: node to copy 1: Copy node to tospace 2: tospace := tospace + sizeof(node) 3: Update parent of node in tospace to point to copy 4: return true The core data structures used in the algorithm are lists of roots and leaves for each level of the hierarchy. In addition the space array maintains the amount of space used at each level. Lines 34 -- 36 of the algorithm implement BFSd. This is done by tak- ing the root node for the BFS, copying it (through the call to 3 2018/10/17 a b e c f d g Figure 3. Small Example Tree UnconditionalCopyNode and updating the space used. The chil- dren produced during this BFS step are added to leaves[1]. If the amount of space used is less than the unit of spatial locality for hi- erarchy level 1, all the leaves of the BFS are moved to roots[1] and a BFS step is subsequently performed for each of them to un- cover their children. Thus, only when the total space consumed at this lowest level is equal to, or exceeds the unit of spatial locality at the lowest level, is the level variable bumped and all the pro- duced leaves of the BFS moved to level 2. It is easy to see that this replicates the operation of BFSd described in the previous section and discovers d dynamically. For any level = i > 1, the remaining steps of HBTreeIterative implement Pi. Recall that the input to Pi is a list of nodes, this is held in roots[i]. Lines 11-17 check whether repeated applications of Pi−1 have exhausted the unit of spatial locality given by s[i]. If so, the output leaves are passed on to level i + 1. Else, we repeatedly call Pi−1 on the head of the roots[i] list. Finally, the level n + 1 is simply a placeholder for the output of Pn. For convenience, it is assumed to have an infinite amount of spatial locality, i.e. it covers the whole memory. Copying services are provided by UnconditionalCopyNode that copies nodes into a region of memory whose top is held in the tospace variable. We assume that this region of memory is infinite. A practical implementation of UnconditionalCopyNode could simply call a standard heap allocation function (such as malloc) to allocate memory to copy into, although this inserts metadata before the copied object that can reduce locality (as we discuss later). In order to better understand the operation of HBTreeIterative, consider the graph of Figure 3. If the input to HBTreeIterative is the node a then the first thing the algorithm does is to add a to roots[n+1]. The node a then bubbles down to roots[1] through repeated iterations of the loop. It is then passed to UnconditionalCopyNode at line 34. Next, line 36 adds its chil- dren, nodes b and c to leaves[1]. Since roots[1] is now empty, both b and c are copied into roots[1] at line 9. Assume for this example that at least one node fits into s[1] and so b and c are pro- cessed in turn resulting in roots[1] containing d, e, f, and g. If now the algorithm finds space[1] > s[1] then it promotes these four nodes to level 2 and then calls P2 on them (unless s[2] is also exhausted). This finally results in a consecutive layout in memory of nodes a, b and c, followed by (partial) subtrees rooted at d, e, f and g produced by P2. 5.1 Complexity Given a tree with N nodes and E edges, the HBTreeIterative algorithm performs a graph traversal on it. It visits every edge exactly once (in line 36). For any node, after discovery, the node is added to every one of the root and leaf lists at most once. Hence, given L levels in the memory hierarchy the algorithm has a worst- case complexity of O(LN + E). In a tree the number of edges is one less than the number of nodes and hence the complexity is O(LN). Note that in practice with settings such as s[1] = 64 for and s[2] = 1024 (used in this paper) most nodes are only added to lists at levels 1 and 2 before being processed and never make it to higher levels. Practically, this keeps the overhead of the algorithm (and its variants) close to O(N + E) or O(N) for trees. 5.2 Limitations A key limitation of HBTreeIterative is that it applies only to trees. There are two reasons why it cannot be used on arbitrary graphs. The first is that UnconditionalCopyNode expects that it is passed any node exactly once. This is easily violated in the case of multiple parents (as in directed acyclic graphs) or graphs with cycles. A related problem arises because more than one pointer may exist to a node and hence UnconditionalCopyNode should be able to update parent pointers even if the node has al- ready been copied. In the next section we describe extensions to HBTreeIterative that allow it to be used on arbitrary graphs. 6. Extension to Arbitrary Graphs Extending HBTreeIterative to arbitrary graphs first requires lowering our level of abstraction somewhat. Along these lines, we introduce the notion of a slot. A slot is simply a pointer to a node. Any given arbitrary graph is therefore 'rooted' at multiple slots. Readers familiar with garbage collectors in Java will notice that we have borrowed these two terms from there [14]. Processing an arbitrary graph requires processing each root slot in turn. This is done by calling InitiateCopy in Procedure 3. For every given root slot, it calls HBTreeIterative thereby process- ing individual components of the graph. Note that we do not require graphs with different roots to be unreachable from each other. Procedure 3 InitiateCopy Input: roots: queue of slots to start copying 1: while not roots.is empty() do 2: 3: slot := roots.pop front() HBTreeIterative(*slot, levels, Sizes[1..levels]) The only change we make to HBTreeIterative is to call ConditionalCopyNode at line 34 instead of UnconditionalCopyNode. Procedure 4 describes the former. The major change is the introduction of the Forward table that has an entry for each possible node, indicating whether that node has been forwarded. If not already forwarded, it forwards (determines the position in tospace) the node and returns an appropriate indication. HBTreeIterative then uses the returned indication to ensure that every node is considered at most once thereby solving the problem of multiple parents and cycles encountered in arbitrary graphs. Procedure 4 ConditionalCopyNode Input: node: node to copy 1: if Forward[node] = UNFORWARDED then 2: 3: 4: 5: else 6: Forward[node] := tospace tospace := tospace + sizeof(node) return true return FALSE Since ConditionalCopyNode no longer updates pointers or copies nodes, we introduce a post-processing phase called CompleteCopy. This is shown in Procedure 5 and is called af- ter InitiateCopy has completed. It traverses the graph starting 4 2018/10/17 slot := roots.pop front() if not Copied[*slot] then Procedure 5 CompleteCopy Input: roots: list of pointers to start copying 1: while not roots.is empty() do 2: 3: 4: 5: 6: 7: 8: *slot := Forward[*slot] for all child slot pointers in *slot do Copied[*slot] = true Copy *slot to Forward[*slot] roots.push back(child slot) at the roots again and maintains a Copied map to avoid copying a node more than once. It also updates all the slots to point to the copies in tospace. 6.1 Complexity We now consider the complexity of InitiateCopy, HBTreeIterative and CompleteCopy taken together. Slots now explicitly represent edges in the graph. Every slot (edge) is still considered at most once (or twice if it is a root slot), this includes lookups in the extra maps. Any given node is also processed at most once at copying and enters (and leaves) every one of the L lists at most once. Hence the asymptotic complexity of the algorithm remains at O(LN + E). 6.2 Limitations The extensions to deal with arbitrary graphs suffer from two key problems. The first problem naturally is the need to have two passes through the graph. The second problem is the space cost of maintaining the extra maps. A related problem that we have not thus far considered is the cost of maintaining the root and leaf dequeues. Even maintained as linked lists (as we do) they require one next pointer per node. Note that the space overheads are bounded by O(N) and do not depend on the number of edges. Nevertheless, it is desirable to try to eliminate them. In spite of these limitations, we use an actual implementation of the generalised HBA described in this section in the evaluation. For applications where offline Reorganisation of large graphs is acceptable it is simple to implement and effective. 7. Single-Pass and Possibly Metadata-Less Blocking We now introduce the final and most sophisticated HBA. Before introducing the algorithm, we make some observations about the operation of HBTreeIterative in the case of general graphs. For any node that is copied, all its unvisited children are added as a group to leaves[1]. This group of nodes continues unbroken through various lists until it enters a roots list. After that they are dequeued in order to be bubbled down and copied. Note that once a node is picked off a roots list at line 26 of HBTreeIterative it is copied immediately. The key idea we take away from this observation is that it is possible to represent this group of nodes by its parent. Once the group (parent) enters a roots list, instead of popping the parent, we pop slots in the parent one by one and bubble them down in turn to be processed. Processing the slot involves both conditionally copying the target and updating the slot to point to the new version of the node. We now introduce HBGraphOnePass that incorporates these ideas. Unlike the version for trees, it takes as input the root slot to start processing from (and not the root node pointed to by that slot). It still depends on (a slightly modified for interface reasons) InitiateCopy to iterate through roots but eliminates CompleteCopy. if roots[level].is empty() then space[1] := space[1] + sizeof(*root slot) leaves[1].append(old node) ////////Refill roots[level] := leaves[level] leaves[level] := empty if space[level] ≥ s[level] then Procedure 6 HBGraphOnePass Input: root slot: root slot to block from Input: n: levels of hierarchy Input: s[1..n]: block sizes (monotonically increasing) Input: s[n+1] = INFINITY 1: Initialise to empty: Dequeue roots[1..n+1] 2: Initialise to empty: Dequeue leaves[1..n+1] 3: Initialise to zero: space[1..n+1] 4: level := 1 5: /////Conditionally copy root slot 6: old node := *root slot 7: if CopySlot(root slot) then 8: 9: 10: loop 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: level := 1 /////Do some copying work old node := *slot if CopySlot(slot) then space[1] := space[1] + sizeof(*slot) leaves[1].append(old node) slot := roots[level].pop front slot() for all i > 1 and i < level do //////Init level space[i] := 0 if roots[level].is empty() then //////Promote if level = (n + 1) then TERMINATE else //////Promote leaves[level + 1].append(roots[level]) roots[level] := empty space[level + 1] := space[level + 1] + space[level] level := level + 1 continue loop space[level + 1] := space[level + 1] + space[level] level := level + 1 else Procedure 7 CopySlot Input: slot: slot to copy 1: copied := false 2: if Forward[*slot] = UNFORWARDED then 3: 4: 5: 6: 7: *slot := Forward[*slot] 8: return copied Forward[*slot] := tospace tospace := tospace + sizeof(*slot) copy *slot to Forward[*slot] copied := true 5 2018/10/17 HBGraphOnePass also uses a slightly different helper routine CopySlot to complete copying of nodes. It directly updates the slot with the copy of the node. Assuming that copying was required the node is then explored for children. Note that in line 39 of HBGraphOnePass we append the old node to the leaves[1] list. This node is bubbled up and ultimately moves to a roots list. In line 30, instead of popping the node, we pop its children one by one. This can be implemented by maintaining constant sized state about which child has been popped. Note that we hoist a copy of part of the processing for the root slot to lines 6 -- 9. Other than these changes HBGraphOnePass operates similarly to HBTreeIterative. To illustrate this, consider again the exam- ple graph in Figure 3. The algorithm is passed the slot pointing to node a. It then copies node a and adds a itself to leaves[1]. Assuming s[1] is not exhausted a then moves to roots[1]. Slots containing children of a are then popped off by the call to pop front slot and this b and c are copied next. Tracing the operation further, it should be evident that HBGraphOnePass pro- duces the same layout in memory as HBTreeIterative for the example. 7.1 Complexity The complexity analysis for HBGraphOnePass is substantially the same as in the previous section. Every slot is considered at most once from lines 30 -- 39 of HBGraphOnePass (other than be- ing passed in as a root slot). Nodes traverse every list at most once. Thus HBGraphOnePass also has an asymptotic complexity of O(LN + E). 7.2 Eliminating Metadata A simple observation also serves to eliminate the need for O(N) extra metadata. All nodes in a graph would have at least one pointer worth of space (unless the graph is using a particularly compressed format). Further if the graph is to represent any form of branching it would have space for at least two pointers in its node representation. We use the first available pointer to store a pointer to the for- warded copy. This eliminates to need for the Forward table since slots that need copying point to old objects that can be looked up to determine the forward pointer. In our implementations, we set the last bit to distinguish the forward pointer from the same field in objects that have not yet been copied (since they would point to objects aligned at 4 byte boundaries in our implementation). Fur- ther, we can use the other available pointer for manipulation of the lists representing the dequeues. This eliminates the need for any external metadata, removing the need for O(N) extra space. Note that this elimination is made possibly by the organisation of HBGraphOnePass that uses parent nodes to represent groups of children. In the absence of this observation, we would have been forced to use dequeues of slots in order to eliminate the extra pass thus rendering impossible elimination of extra metadata for the dequeues. Further, this metadata-less one pass HBGraphOnePass algorithm is a significant advancement over previous work. Ch- eney [10] had shown that it was possible to use a breadth-first traversal over objects in the heap without the need for any extra metadata. Although Wilson [22] had developed hierarchical BFS for a single level, it required one pointer per page of memory. HBGraphOnePass subsumes Wilson's algorithm as a special case of a single-level memory hierarchy and also admits implementation without the need for extra metadata, similar to Cheney's copying algorithm. Of course, the technique described in this subsection is optional. For example one could also allocate the extra O(N) metadata di- rectly in objects, such as we have done for integration with the Jikes Java Virtual Machine [1] garbage collector in one of our implemen- tations. There, the forwarding pointer already existed in the object header and we found it simplest to just add another field for manip- ulation in the dequeue lists. Implementations 8. In this section we describe three different environments into which we have integrated versions of our HBA. This section focuses on graph representation and concrete interfaces for HBA. Another im- portant focus area for this section is memory allocation. Allocat- ing target memory for copied nodes can broadly follow one of two strategies. One is to use the system provided memory manager that is already in use. This has the advantage of integrating cleanly with existing code that uses graphs since there is no need to write an additional memory manager and allocated nodes can be freed by the rest of the application. A disadvantage to this approach is that system memory managers (such as malloc) introduce additional metadata at the head of each object. This should be taken into ac- count when calculating object sizes in the HBA and additionally reduces the effectiveness of blocking in improving spatial locality. Also, memory managers such as malloc often use discontiguous pools for objects of different sizes. This introduces further frag- mentation if graph nodes are differently sized, which is often the case for variable sized edge lists attached to the nodes. The other option is to use a memory manager with external metadata to man- age to space copied to, which can introduce the complexity of using multiple memory managers. We have implemented HBA in three environments for evalua- tion: custom graph implementations written in C, as an add-on to the Boost Graph Library in C++ and finally as a modification to the traversal phase of the semispace copying collector in the Jikes Java Virtual Machine. We now discuss these implementations individu- ally. 8.1 Boost C++ Graph Library The Boost C++ Graph Library (BGL) [2] is a library for in-memory manipulation of graphs. It makes extensive use of C++ generics (making extensive use of templates) to provide a customisable interface for storing graph structured data. We wrote an extension to the library that takes as input a graph stored in the adjacency list representation and produces a new graph after hierarchical blocking. The adjacency list representation stores a list of vertices in an iterable container, that allows one to iterate over every vertex in a graph and then apply a suitable function. For each vertex the list of edges originating at (for directed graphs) or connected to (for undirected graphs) is maintained in another iterable container attached to the vertex. Although our implementation is generic, we experimented with C++ STL vectors as the container for both the types of components. Our HBA addition to Boost uses the simpler version of the algorithm described in Section 6. It makes use of two external O(N) sized vectors and assumes a canonical mapping from the set of vertices to non-negative integers: f : V → {1 .. V }. This is already provided by Boost and we use this integer to index into the O(N) sized vectors. The first vector is used to maintain a "next" pointer ( f (next) rather than next). The second vector (we call it the RemapVector) assigns, for each given node in the input graph a number indicating its position in the copied graph i.e if RemapVector(j) = RemapVector(i) + 1 then node j should be copied right after node i in the output graph. It is easy to see how the remap vector is set up by calls to ConditionalCopyNode. We use the produced remap vector in CompleteCopy to actually produce the output graph. We use the memory allocator provided by Boost thereby in- curring the overheads described above. We have assumed for ob- ject size calculation that each edge occupies an area equal to three 6 2018/10/17 pointers (for source, destination and edge-weight information) and two pointers worth of memory management metadata. Since the vertices are already laid out in a vector, we multiply the number of outgoing edges by the space occupied by five contiguous pointers to determine the object size for the HBA algorithm. Our decision to use the simpler algorithm for integration into Boost was guided in part by the observation that others have deemed the overheads of storing all the vertices of a graph in mem- ory acceptable [17]. 8.2 Custom Graph Implementations in C The Boost graph library introduces a number of overheads internal to the objects used to represent graph vertices and edges, in part due to the need to be generic and object-oriented. In order to explore the benefits that HBA can bring to graphs constructed out of carefully designed minimal objects we also wrote a custom implementation of binary search trees and undirected graphs for evaluation. For the C implementations, we allocated a large chunk of memory to copy the nodes into, this is done by maintaining the size of the graph as it is loaded and calculating the total space required for the copy, in advance. This eliminates all overhead due to memory manager metadata. It is easy to write a memory manager that makes use of external metadata [18] to manage this space, although we have not done so for this implementation. 8.2.1 Binary Search Trees We use the fairly minimalist representation of binary search tree nodes shown below: /* Basic bst node */ typedef struct node_st { unsigned long k; struct node_st *l, *r; #ifndef NO_REORG_PTR struct node_st **reorg_next; #endif }node_t; We have explored both HBTreeIterative (that makes use of the reorg next pointer) as well as HBGraphOnePass that elimi- nates that pointer. 8.2.2 Undirected Graphs We have also written representations for undirected graphs in C. These make use of the data structures described below: typedef struct node_st { int id; } node_t; struct node_st* neighbours[0]; node_t **node_vector; int *neighbour_cnts; int node_cnt; The graph node structure contains an integer identifier and an array of pointers to its neighbours. Since this is an undi- rected graph, two neighbouring nodes point to each other through their neighbours arrays. In addition, we have a list of vertices (node vector), a list of neighbour counts (neighbour cnts) and finally the count of the total number of nodes in the graph (node cnt). Maintaining the size of the neighbours array outside the data structure improves cache-line utilisation. Note that as with the Boost implementation, we have an enumeration of vertices as integers that allows indexing appropriate arrays. A point that might not be evident is that HBA also results in better utilisation of linear arrays such as neighbour cnts. This is because adjacent nodes are more likely to be placed close to each other in those arrays. This was key to our decision to move the neighbour count out of the containing node t object. Finally, we also wrote an extension to our implementation of undirected graphs to illustrate a beneficial and powerful application of the HBA algorithm. We allow the writing out of the entire graph after HBA to disk. The nodes are written out in the order that they are produced by HBA. Therefore, reloading the nodes results in an in-memory representation of the graph that is already blocked. Although we show in our evaluation that the overheads of HBA are tolerable enough to apply at runtime, this feature serves to illustrate that offline HBA of in-memory graphs and storing the results in a persistent manner is very much possible and eliminates the overheads of HBA when processing static graphs. 8.3 Jikes RVM We have also implemented HBA as an extension to the traversal phase of a semispace copying collector in the Jikes Java Virtual Machine. We have done this to illustrate the ability of HBA to oper- ate in dynamic environments with varying graphs. The fundamental idea of the semispace copying collector is to divide the heap into two 'spaces'. At any instance of time only one space is 'active', and is used to allocate objects. When a garbage collection is triggered, all mutator threads (that can change the connectivity or contents of objects on the heap) are stopped. A collector thread then runs a traversal phase that finds all reachable objects on the heap using a depth-first search in the baseline implementation and copies them (on discovery) to the other 'inactive' space. After completion of this traversal, the 'inactive' and 'active' spaces switch roles until the next garbage collection cycle. We have modified the traversal phase to use HBA in order to copy objects with appropriate clustering. We use the single pass HBGraphOnePass algorithm. Since the object-header used in the Jikes RVM had already allocated a pointer to hold miscellaneous information, we used this pointer to hold forwarding information. We added another pointer size field to hold next pointer information for maintaining the dequeues. We use this slightly bloated object representation as the baseline (without HBA) as we felt that this fairly reflected the fact that we could have eliminated this overhead with extra work. Our implementation in the Jikes RVM is at a pro- totype level only, in part to avoid the complexity of refactoring the garbage collection classes to implement an optimised version. For example, it is difficult to interrupt the scanning of objects on the heap to determine slots. Hence we have a suboptimal implemen- tation of pop front slot that simply uses an array of 32 slots to hold the results of a complete scan. Any overflows from this array are treated as new roots by the HBA implementation. Nevertheless, we found the implementation adequate to demonstrate the feasi- bility of integrating HBA into the garbage collector of a managed environment, thereby showing that is can be used in such environ- ments and on changing graphs. 9. Performance Evaluation We evaluate HBA on an system equipped with an Intel i5-2400S CPU and 16 GB of RAM. For uniformity (the JikesRVM is 32-bit only) we use 32 bit code and thus are limited to using under 4GB of main memory. We know a-priori that the system has the following caches in its memory hierarchy (with corresponding settings for the HBA): 1. Various caches (L1 data, L2 and L3) with a 64 byte line size. We set s[1] = 64. 2. Open-page mode DRAM that provides lower latencies for con- secutive accesses to the same 1024 byte page. We set s[2] = 1024. 3. TLB caching page table translations for 4KB pages. A TLB miss incurs significant penalty for page table walks. We set s[3] = 4096. 7 2018/10/17 ) c e s u ( i e m T y r e u Q 1.4 1.2 1 0.8 0.6 0.4 0.2 0 0 Binary Search Tree Binary Search Tree pseudorandom BFS DFS VEB HBA ) c e s u ( i e m T y r e u Q 0.65 0.6 0.55 0.5 0.45 0.4 6 4 1 4 2 K K M 5 10 15 20 25 Depth HBA Configuration 6 4 6 4 6 4 1 1 4 K K K 6 4 + 1 + 4 + 2 + 4 + 2 + 2 + 1 K K M K M M K + 4 K + 2 M Figure 4. Binary Search Tree Performance Figure 5. Varying HBA parameters 4. TLB caching of super page translations. The OS (linux) clusters groups of pages into 2MB superpages to reduce consumption of page table and TLB entries. We set s[4] = 2097152. It is unclear to us (as it would be to users of HBA in the field) about which level is most likely to impact performance for a par- ticular graph and particular traversal algorithm. Hence we usually use full HBA with the settings above, indicated as HBA(all) in the evaluation. Occasionally we use HBA for only a subset of lev- els: such as the page level HBA(4k), this is essentially produces the layouts of Wilson's hierarchical BFS [22]. L1d line DRAM page VM page VM superpage Pseudorandom BFS DFS VEB 64 1K 4K 2M 64+1K+4K+2M 0.42 0.36 0.33 0.24 0.25 0.31 0.32 0.33 0.25 0.53 0.43 0.23 0.15 0.19 0.19 0.25 0.34 0.17 0.44 0.26 0.19 0.05 0.10 0.07 0.07 0.14 0.06 Table 1. Cachegrind miss rates 0.42 0.07 0.11 0.02 0.03 0.02 0.02 0.02 0.02 9.1 C, Binary Search Tree We first consider the performance of a binary search tree written in C. The tree is setup to hold a contiguous integer keyspace and is then queried with random keys. We are interested in the average query time (measured over a minute of continuous queries) as the traversal is affected by the locality of the nodes. We investigate the following layouts of tree nodes in memory: 1. Psedorandom layout 2. BFS layout ((such as would be produced by Cheney et. al. [10]) 3. DFS layout, some researchers have suggested that this might be a better way to layout nodes for locality than BFS [19] 4. VEB layout and finally 5. HBA layout using the algorithm in this paper. The results are shown in Figure 4. As expected the pseudoran- dom layout performs the worst. BFS performs better than DFS. The best performance is provided by HBA, which performs almost com- parably to VEB. At a tree depth of 25 ( 64 million nodes) using HBA reduces query time by approximately 54% while using BFS reduces query time by approximately 31%. A notable feature of the graph is the knee around the tree depth of 18. This is because be- yond that depth the tree no longer fits in the 6MB last level cache leading to a sudden increase in query time. Not every level of cache has an equal impact on performance. To illustrate this, we ran the same experiment restricting HBA to various subsets of the memory hierarchy. The results, shown in Figure 5 illustrate that the cache (64 byte units of spatial locality) and the VM page (4K unit of spatial locality) have the maximum impact on tree access. Finally, we verify that HBA is indeed improving cache access. We used cachegrind [3] to instrument the queries and simulate var- ious levels of the memory hierarchy of the actual system. Table 1 shows the miss rates for various levels of the hierarchy. Although DFS and BFS both improve miss rates, HBA is most effective at reducing miss rates, explaining its better performance. It is inter- esting to note that HBA when run over all levels reduces miss rates for any level to that produced by running HBA to block only for that level. This is an important result, since it illustrates that HBA provides additive benefits for all the memory hierarchy levels it is ) c e s u ( i e m T y r e u Q 0.6 0.5 0.4 0.3 0.2 0.1 0 0 Binary Search Tree HBA HBA-no metadata 5 10 15 20 25 Depth Figure 6. Binary Search Tree: Effect of removing HBA metadata aware of. Finally, we note that HBA is almost as effective at tack- ling miss rates as the cache-oblivious VEB layout. Finally, we illustrate the effect of removing HBA related meta- data from the tree node, using the HBGraphOnePass algorithm and reusing pointer fields from the old version of the object (as dis- cussed in Section 7.2). The results shown in Figure 6 illustrate the improvements obtained due to the lower memory footprint of the tree nodes: approximately 14% lower than that with an extra pointer per tree node. 9.2 Arbitrary Graphs Trees represent an ideal workload for HBA, since they correspond exactly to the spanning tree built during traversal. In this section, we consider more complex graphs with a large number of connec- tions. We use a synthetic graph generator that is part of the SNAP suite [4]. We consider various kinds of graphs that are of current interest to the research community involved in mining information from graph structured data: 1. Watts-Strogatz small world model [21] (10 million nodes, 29 million edges): These graphs have logarithmically growing di- 8 2018/10/17 Graph Watts Strogatz Albert Barabasi 2d mesh 4ary tree SSSP BFS HBA(4K) HBA(all) HBA(4k) HBA(all) 1.41 1.01 2.38 1.00 1.44 1.02 2.35 1.00 1.38 1.09 3.85 20.70 1.40 1.11 3.80 21.31 Table 2. Graph Processing Speedups ameter and model small world networks, such as social net- works with the informally well known "six degrees of sepa- ration". 2. Barabasi-Albert model [6] (10 million nodes, 39 million edges) also models real world phenomena but provides graphs where the out-degree of nodes follows a power law distribution. This is often the case, for example, with web pages that link to each other. 3. 2d mesh (9 million nodes, 17 million edges) models real world road networks. Answering real time navigational queries on such networks are often a component of many online services. 4. 4ary tree (10 million nodes, one less edge). To provide some perspective on binary trees considered thus far, we also measure performance on trees where each node has 4 children. We use two different algorithms (in two different implementa- tions). The first is a single source shortest path algorithm (using Di- jkstra [13]) that finds shortest paths from a given source to all nodes in the graph. We use a random assignment of wights to edges (a uni- form random choice over a range of size the same as the number of vertices). We use an implementation of this algorithm in Boost (Section 8.1). We then turn the input graph into an undirected and unweighted version by adding a reverse edge for every given edge and performing a breadth-first search in our custom C environment (Section 8.2). The choice of algorithms and datasets is fairly similar to other approaches that evaluate the performance of graph process- ing solutions [17]. For each algorithm, data set and environment we measure the speedup of the algorithm after HBA on the graph using both HBA(4k) as well as HBA(all) i.e. blocking for VM pages and for all levels of the hierarchy respectively. The results shown in Ta- ble 2 underscore the efficacy of HBA for arbitrary graphs. Large speedups (as high as 21X !) are obtained with HBA. Speedups are generally higher for our custom C environment due to the opti- mised (reduced) object footprints. Optimising for all levels of the memory hierarchy often provides better performance than just op- timising for one level, underscoring the importance of a multi-level blocking algorithm. The results also illustrate an interesting exam- ple of destructive interference between levels. HBA(4k) performs slightly better than HBA(all) in the case of 2d meshes. Other than this example, we have found that in all cases HBA(all) performs at least as well as HBA(4k). 9.3 JikesRVM Our final set of results are from the Jikes Java Virtual machine. We measured the performance of the same binary search tree consid- ered in the C environment, when implemented in Java. We config- ured the JVM to use a 1GB heap for the experiments. We also con- figured it to perform a system-wide GC before starting the query phase of the test. The results, shown in Figure 7 indicated that the benefits seen with C are also replicated in the Java environment. HBA for all levels with a tree depth of 22 provides a 29% speedup over the baseline version, while HBA for only the VM page pro- vides a 19% speedup over the baseline version. Note that JVM memory limitations meant we were unable to build trees of larger depth. ) s m ( i e m T y r e u Q 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 Binary Search Tree - Jikesrvm HBA(4k) HBA(all) Baseline 5 10 15 20 25 Depth Figure 7. Binary Search Tree: JikesRVM Performance d a e h r e v O 1.18 1.16 1.14 1.12 1.1 1.08 1.06 1.04 1.02 1 0.98 Binary Search Tree - Jikesrvm Semispace Collector Overhead HBA(full) HBA(4k) 0 5 10 15 20 25 Depth Figure 8. Binary Search Tree: Semispace collector overheads DaCapo Overheads for HBA(all) d a e h r e v O 1.15 1.1 1.05 1 0.95 0.9 a ntlr blo at e clip s e lu s e p m d x ala n a r c h fo p h s jyth luin qld b o n d e x Figure 9. DaCapo Benchmarks: Semispace collector overheads Benchmark In a runtime environment the overhead of collection is also an important factor. With this in mind, we measured the time for a semispace copy of the entire heap after the tree has been completely built. The results are shown in Figure 8. In the worst case, HBA adds an overhead of only 18%. Crucially the overhead of optimising for all levels is the worst case only 10% more than optimising for only the page level. The average overheads are much lower, well under 10%. Finally we also measure overheads and performance with the more general DaCapo benchmark suite [8]. The results shown in Fig 9 indicate that the overhead of adding HBA to the garbage collector is under 15% in all cases and usually under 10%. In addition for two of the benchmarks (antlr and fop) we see improved performance due to more locality on the heap. 9 2018/10/17 10. Related Work There is a large body of existing research into improving the cache performance of in-memory data. Broadly the approaches can be divided into three classes. The first class of techniques deal with prefetching objects ahead of use. An example of this is the approach of Luk et al. [16], who place a prefetch pointer in linked list nodes to prefetch later nodes early enough to avoid cache miss penalties during traversals. Dynamic approaches are also possible such as that of Chilimbi et al. who profile a program to detect frequently occurring streams of accesses [12]. A second class of techniques is to statically modify the data structures themselves to make them more cache friendly. One way is to use knowledge of the cache hierarchy and transfer units to size data structure nodes, such as in B-trees [13]. This can be ex- tended to make the B-tree nodes cache friendly at various levels (similar to the objective of this work). Kim et al. [15] extend the basic idea of B-trees to be architecture sensitive at various levels using hierarchical blocking. Although their hierarchical blocking produces layouts similar to our reorganisation algorithm they have a static data structure redesign for B trees unlike our dynamic gen- eral purpouse algorithm. Another approach to data structure design is cache oblivious data structures. These are designed so as to im- prove spatial locality regardless of the level of memory hierarchy and block size being considered. The "van Emde Boas" layout [20] forms the basis for many cache oblivious designs including those for cache oblivious B-trees [7]. A third class of techniques (including the one in this paper) are used at runtime. One approach is to control memory allocation. Chilimbi et al. [11] investigated the use of a specialised memory allocator that could be given a hint about where to place the allo- cated node. Another approach is to use the data structure traversal done by garbage collectors to copy objects into new cache friendly locations [9]. Mark Adcock in his PhD thesis [5] considered a range of runtime data movement techniques including those triggered by pointer updates. However none of these techniques consider the ef- fect of multiple units of locality in the memory hierarchy and in that sense this work is orthogonal to all of them. It is possible to take the algorithm in this paper and use it to improve on all of these locality maximisation techniques, which are usually restricted to plain breadth-first search to discover nodes. 11. Future Work The current implementation of HBA ignores the last level in a usual memory memory hierarchy: persistent storage. It is extremely easy to add a 512 byte sector size to HBA to also optimise layouts for transfer from disk. Although we have not investigated this aspect yet, we believe HBA can also significantly improve access to the last (persistent) level in typical memory hierarchies. 12. Conclusion We have presented a hierarchical blocking algorithm (HBA) that takes as input an arbitrary graph and a description of a memory hierarchy and lays out graph nodes to be sensitive to and provide better performance for that hierarchy. We have investigated imple- mentations of HBA in various settings and shown that it provides non-trivial benefits in all of them; making the case the graph lay- out and memory hierarchy sensitivity are important factors in the performance of graph algorithms. References [1] http://jikesrvm.org/. [2] http://www.boost.org/doc/libs/graph/. [3] http://valgrind.org/info/tools.html#cachegrind. [4] http://snap.stanford.edu/snap/. [5] Mark Adcock. Improving cache performance by runtime data move- ment. Technical Report UCAM-CL-TR-757, University of Cam- bridge, Computer Laboratory, July 2009. [6] Reka Zsuzsanna Albert. Statistical mechanics of complex networks. PhD thesis, Notre Dame, IN, USA, 2001. AAI3000268. [7] Michael A. Bender, Martin Farach-Colton, Jeremy T. Fineman, Cache- Yonatan Fogel, Bradley Kuszmaul, and Jelani Nelson. oblivious streaming b-trees. In Proceedings of the Nineteenth ACM Symposium on Parallelism in Algorithms and Architectures, pages 81 -- 92, 2007. [8] S. M. Blackburn, R. Garner, C. Hoffman, A. M. Khan, K. S. McKin- ley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S. Z. Guyer, M. Hirzel, A. Hosking, M. Jump, H. Lee, J. E. B. Moss, A. Phansalkar, D. Stefanovi´c, T. VanDrunen, D. von Dincklage, and B. Wiedermann. The DaCapo benchmarks: Java benchmarking development and anal- ysis. In OOPSLA '06: Proceedings of the 21st annual ACM SIGPLAN conference on Object-Oriented Programing, Systems, Languages, and Applications, pages 169 -- 190, 2006. [9] Wen-ke Chen, Sanjay Bhansali, Trishul Chilimbi, Xiaofeng Gao, and Weihaw Chuang. Profile-guided proactive garbage collection for lo- cality optimization. In Proceedings of the ACM SIGPLAN conference on Programming language design and implementation, pages 332 -- 340, 2006. [10] C. J. Cheney. A nonrecursive list compacting algorithm. Communica- tions of the ACM, 13:677 -- 678, November 1970. [11] Trishul M. Chilimbi, Mark D. Hill, and James R. Larus. Cache- conscious structure layout. In Proceedings of the ACM SIGPLAN conference on Programming language design and implementation, pages 1 -- 12, 1999. [12] Trishul M. Chilimbi and Martin Hirzel. Dynamic hot data stream prefetching for general-purpose programs. In Proceedings of the ACM SIGPLAN Conference on Programming language design and implementation, pages 199 -- 209, 2002. [13] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. MIT Press, 2001. [14] Richard Jones. Garbage collection: Algorithms for automatic dynamic memory management. John Wiley and Sons, July 1996. [15] Changkyu Kim, Jatin Chhugani, Nadathur Satish, Eric Sedlar, An- thony D. Nguyen, Tim Kaldewey, Victor W. Lee, Scott A. Brandt, and Pradeep Dubey. Fast: fast architecture sensitive tree search on mod- ern cpus and gpus. In Proceedings of the international conference on Management of data, pages 339 -- 350, 2010. [16] Chi-Keung Luk and Todd C. Mowry. Compiler-based prefetching for recursive data structures. In Proceedings of the seventh international conference on Architectural support for programming languages and operating systems, pages 222 -- 233, 1996. [17] Roger Pearce, Maya Gokhale, and Nancy M. Amato. Multithreaded asynchronous graph traversal for in-memory and semi-external mem- ory. In Proceedings of the ACM/IEEE International Conference for High Performance Computing, Networking, Storage and Analysis, pages 1 -- 11, 2010. [18] Amitabha Roy, Steven Hand, and Tim Harris. Hybrid binary rewriting for memory access instrumentation. In Proceedings of the 7th ACM SIGPLAN/SIGOPS international conference on Virtual execution en- vironments, pages 227 -- 238, 2011. [19] James W. Stamos. Static grouping of small objects to enhance perfor- mance of a paged virtual memory. ACM Transactions in Computing Systems, 2:155 -- 180, 1984. [20] Peter van Emde Boas, R. Kaas, and E. Zijlstra. Design and implemen- tation of an efficient priority queue. Mathematical Systems Theory, 10:99 -- 127, 1977. [21] Duncan J. Watts and Steven H. Strogatz. Collective dynamics of small- world networks. Nature, 393(6684):440 -- 442, June 1998. 10 2018/10/17 [22] Paul R. Wilson, Michael S. Lam, and Thomas G. Moher. Effec- tive staticgraph reorganization to improve locality in garbagecollected systems. In Proceedings of the ACM SIGPLAN 1991 conference on Programming language design and implementation, pages 177 -- 191, 1991. 11 2018/10/17
1207.1141
2
1207
2012-07-08T13:45:05
The Longest Queue Drop Policy for Shared-Memory Switches is 1.5-competitive
[ "cs.DS" ]
We consider the Longest Queue Drop memory management policy in shared-memory switches consisting of $N$ output ports. The shared memory of size $M\geq N$ may have an arbitrary number of input ports. Each packet may be admitted by any incoming port, but must be destined to a specific output port and each output port may be used by only one queue. The Longest Queue Drop policy is a natural online strategy used in directing the packet flow in buffering problems. According to this policy and assuming unit packet values and cost of transmission, every incoming packet is accepted, whereas if the shared memory becomes full, one or more packets belonging to the longest queue are preempted, in order to make space for the newly arrived packets. It was proved in 2001 [Hahne et al., SPAA '01] that the Longest Queue Drop policy is 2-competitive and at least $\sqrt{2}$-competitive. It remained an open question whether a (2-\epsilon) upper bound for the competitive ratio of this policy could be shown, for any positive constant \epsilon. We show that the Longest Queue Drop online policy is 1.5-competitive.
cs.DS
cs
The Longest Queue Drop Policy for Shared-Memory Switches is 1.5-competitive Nicolaos Matsakis∗ [email protected] Department of Computer Science and DIMAP University of Warwick Coventry, United Kingdom Abstract We consider the Longest Queue Drop memory management policy in shared-memory switches consisting of N output ports. The shared memory of size M ≥ N may have an arbitrary number of input ports. Each packet may be admitted by any incoming port, but must be destined to a specific output port and each output port may be used by only one queue. The Longest Queue Drop policy is a natural online strategy used in directing the packet flow in buffering problems. According to this policy and assuming unit packet values and cost of transmis- sion, every incoming packet is accepted, whereas if the shared memory becomes full, one or more packets belonging to the longest queue are preempted, in order to make space for the newly arrived packets. It was proved in 2001 [Hahne et al., SPAA '01] that the Longest Queue Drop policy is 2- 2-competitive. It remained an open question whether a (2 − ) upper competitive and at least bound for the competitive ratio of this policy could be shown, for any positive constant . We show that the Longest Queue Drop online policy is 1.5-competitive. √ 2 1 0 2 l u J 8 ] S D . s c [ 2 v 1 4 1 1 . 7 0 2 1 : v i X r a ∗Research supported by the Centre for Discrete Mathematics and its Applications (DIMAP), University of Warwick, EPSRC award EP/D063191/1 1 1 Introduction Memory management policies constitute a large area of research for online algorithms. In the case of shared memory switches, memory may completely fill up, therefore an online policy should accept packets trying to maximize the total number of served packets, towards the total number of served packets of an optimal offline policy. The online policy has no knowledge of the future packet arrivals, contrary to the offline strategy which has the advantage of knowing the whole sequence of incoming packet flow in advance. Ensuring Quality of Service (QoS) in scheduling the packet traffic of buffering problems, is a task an online algorithm should aim at [7, 3, 11]. Two cases of online policies have been analyzed extensively: the preemptive policies where the rejection of packets already accepted is possible and the nonpreemptive policies where accepted packets cannot be rejected later. We consider packets of unit values and cost of transmission, organized in FIFO queues in case they are admitted. The idea of preempting packets from the longest queue when the shared memory becomes full, was proposed by Wei et al. [15]. According to this policy, every packet is accepted as long as the buffer is not full. If it is full and the packet waiting for admission is destined to the longest queue currently in the buffer, this packet is rejected, otherwise a packet from the longest queue is preempted and the packet waiting for admission is accepted. Since all packets are considered uniform in values and cost of transmission, we may assume that a packet from the longest queue is preempted in case an incoming packet is destined to the same queue and the latter packet is accepted. When we have two or more queues of lengths equal to the maximum one in the buffer, one of them is chosen arbitrarily for a packet rejection, for each accepted packet. This preemptive online policy is called Longest Queue Drop. Time is assumed to be discrete. For every timestep, the packet positioned in the head of every active queue is sent to an output link and afterwards, but before the next timestep begins, the policy decides which packets to accept between those placed in the input ports. An input port may accept any number of packets at the same timestep and the packets not accepted by the buffer are rejected, clearing up the input ports for the next timestep. When we refer to the buffer content at some timestep, we will be taking under account the packet admissions from the incoming packet flow of the same timestep. The throughput is defined as the number of served packets per timestep and the total transmission as the total number of served packets, from the first until the last timestep that at least one packet exists in the buffer. When we mention ratios of throughputs or total transmissions, we refer to the respective ratios of the optimal offline policy (OP T ) to that of the Longest Queue Drop policy (LQD). Former research on shared-memory switches [1], restricts them having an equal number of input and output ports. But, this buffer model is equivalent to the one having an arbitrary number of input ports, since we assume that there is no limit on the size of the input port queues. Also, since M ≥ N , we may work on the case M = N , leaving vacant the output ports that we do not intent to use. √ We will be using competitive analysis [8, 5]. It has been shown in [10, 1] that LQD is 2-competitive, where a lower bound of 2 is, also, obtained. In [10] it is, also, shown that no online policy can achieve a competitive ratio smaller than 4/3 for this problem. No (2 − ) upper bound (for some positive constant ) has been shown for the LQD competitive ratio, except for the special case of memory switches with two output ports, where an upper bound of (4M − 4)/(3M − 2) < 4/3 is given in [12]. In [12], an upper bound of 2 − o(1) is, also, shown for the general case of N output ports. We show that LQD is 1.5-competitive, closing significantly the gap with the lower bound of √ 2. 2 Analysis 2.1 Definitions We denote as pt i,OP T the length of the same queue in the OP T buffer at the same timestep, where i ∈ [N ]. We refer to an overflow as i,LQD the length of queue i in the LQD buffer at timestep t and as pt 2 i,OP T − pt the situation where the buffer filled up and at least one packet was rejected from it. We shall, also, call as overflowed the queues that a policy rejected packets from. Finally, we define as bursty flow the simultaneous arrival of at least M packets destined to the same queue, in the input ports. We denote as dt i the difference (pt i,LQD). We may skip the subscript or superscript of dt i when these are understood by the context. The total number of timesteps from the first timestep that at least one packet exists in any buffer1 until the last one that at least one packet exists in any buffer is denoted T tot > 0. We call free the queues having a greater length in the LQD buffer than that in OP T at the same timestep. As dominating we shall call the queues with a greater or equal length in the OP T buffer at timestep t than that in LQD, where pt i (i refers to a dominating queue, here). If dt−1 i, we will refer to the ith queue as semi-dominating and everything else stays the same as in the case of dominating queues. We gave these names to the last two sets of queues, since OP T dominates LQD in packet quantity, emphasizing on whether the difference of quantities between them has a decreasing tendency or not. Note that for a queue retaining packets in any of the two buffers at timestep t but not at timestep t − 1, we assume that dt−1 = 0. Finally, if pt i,LQD = 0 and pt i,OP T > 0, we call this ith queue established at timestep t. No queue may belong to two or more sets between the four sets we have defined, at the same timestep. We will denote as F t, Dt, St and as Et the numbers of free, dominating, semi-dominating and established queues at timestep t, respectively. Under these assumptions, LQD's competitive ratio is upper-bounded by the maximum over all possible incoming flows of RT tot t=1 (F t + Et + Dt + St)/(cid:80)T tot =(cid:80)T tot t=1 (F t + Dt + St). i,LQD > 0 and dt−1 i ≤ dt i > dt Before proceeding, we should mention that we may use the same variable names for different queues or timesteps in the analysis to follow. However, we will always refer, explicitly, to their current meaning. Also, in some cases we will be adding the name of the sequence of incoming flow as a subscript to the length of a queue or to the number of queues of a specific type, as defined before, when this may not be fully understood by the context. 2.2 An optimal offline policy It would be convenient to express the queues in mathematical formulae, using the first letter of their names, as in the following inequality. For any timestep t of a LQD overflow we have: (cid:88) i∈D∪S (cid:88) i∈E i,OP T ) ≤(cid:88) i∈F (dt i) + (pt (dt i) (1) since OP T dedicates more packets to specific queues than LQD does, letting LQD admit more packets in at least one other queue. Recall that both buffers have the same size M . In case the OP T buffer is full after the LQD buffer overflow, too, the equality holds in (1). A LQD packet holding a position in its queue that is not held by an OP T packet at the same timestep will be called a free packet and it is always located in free queues. The right part of (1) refers to the free packets at timestep t. A LQD packet that is not free will be called common and a free packet may become common before its transmission, or the opposite. Following [1], we call extra packet, a packet that is transmitted by OP T when its corresponding queue is inactive in the LQD buffer. A potential extra packet is a packet occupying a higher queue position in the OP T buffer than the same queue's length in the LQD buffer, at the same timestep. The potential extra packets may be held by all queues in the OP T buffer except for the free queues and upper-bounding their number by a percentage of the number of transmitted LQD packets, may give us an upper bound for the LQD competitive ratio, since the total number of extra packets is upper-bounded by the total number of potential extra packets, when considering all timesteps in [1, T tot]. 1We assume that each strategy uses its own buffer and, for the analysis to follow, we compare the two buffer contents at the same timestep. 3 At a timestep t of an overflow of one or more dominating or semi-dominating queues, it would be natural to define a threshold line in the two-dimensional combined buffer snapshot of LQD and OP T , indicating that no LQD packet may be located at a queue position above it, at the same timestep. This line defines the length of each of the overflowed queues at any overflow timestep in the LQD buffer. The only exception to this, is when we have more than one queues of equal lengths and LQD chooses arbitrarily some of them for the preemptions. This will cause one or more overflowed queues to surpass the threshold line by one packet, at the overflow timestep. In terms of defining the competitive ratio, we will assume that dominating or semi-dominating queues are always picked first to drop packets from at the same timestep, before the first free queue is chosen, in order to maximize the number of potential extra packets available in the OP T buffer and consequently, the additional number of packets that OP T may potentially send, compared to LQD. Wrapping up, we will allow free queues to surpass the current threshold line by one packet, in case a dominating queue overflows. An illustration of a two-dimensional combined buffer snapshot along with a threshold line is given in Figure 3 (see Appendix), though the specific figure illustrates further attributes, showed later on. Lemma 1. There exists an optimal offline strategy q1 that will never choose to have an empty queue at the same timestep this queue is not empty in the LQD buffer. Proof. (see Appendix) The following corollary is derived by Lemma 1 and (1): Corollary 1. Inequality (1) holds for any timestep t. Also, the next corollary comes directly from Lemma 1: Corollary 2. There will always exist at least one common packet in every active free queue in the LQD buffer. Next lemma shows that there exists an optimal offline strategy that will never choose to have semi-dominating queues in its buffer: Lemma 2. Assume that at some timestep t we have pt there exists an optimal offline strategy q2 which will never choose to have dt (cid:48) t > t, until queue i becomes established for the first time after t. i,OP T > pt i,LQD > 0, for some queue i. Then, (cid:48) i > dt i , for any subsequent (cid:48) after t, whereas the ith queue does not become established in [t, t Proof. Assume that the lemma does not hold for an optimal offline policy and dt for a timestep (cid:48) t ]. But then, there exists another offline policy (q2) which can dedicate a smaller packet quantity to queue i at timestep t and gain more buffer space for, possibly, admitting at least one packet destined to some other of its queues, until the (cid:48) point it holds that dt i . Policy q2 does not lack in total throughput compared to the optimal offline (cid:48) policy, since their buffer contents become identical at t and after. Therefore, q2 may be regarded as OP T . i (cid:54)> dt (cid:48) i > dt i =(cid:80)T tot t=1 (F t+Et+Dt)/(cid:80)T tot RT tot to a specific incoming packet sequence σ, then we may define rσ =(cid:80)T tot Due to Lemma 2, the competitive ratio of the LQD policy is upper-bounded by the maximum of t=1 (F t+Dt), over all sequences of incoming packet flow. In case we refer σ+Dt σ) σ)/(cid:80)T tot σ+Dt t=1 (F t σ+Et restricting all queue numbers per timestep, to the ones occurring for σ. According to that, we get: RT tot {rσ} = max σ 4 (2) t=1 (F t Note that we may have T tot → ∞ for a sequence of incoming packet flow. In such a case, an upper bound of the competitive ratio is equal to limT tot→∞(sup RT tot ). Next lemma shows that the properties of the optimal offline policies q1 and q2 do not conflict. Lemma 3. There exists an optimal offline strategy qo encapsulating the properties of both q1 and q2. Proof. (see Appendix) We will use qo as our optimal offline strategy from now on. Apart from that, we define as compact, a time period [tx, ty] (tx ≤ ty) for a queue, if there exists a presence of at least one of its packets in both buffers at any timestep of it, but not at tx − 1 and ty + 1. Definition 1. We call a dominating queue i immediate at a specific compact period when either 1) the queue attains a positive value for di at the first timestep of that compact period and there exists no more incoming packet flow (not necessarily accepted) for this queue until the end of this compact period, or 2) di = 0 during the whole compact period. Definition 2. We call a dominating queue j urgent for a specific compact period, when either 1) there exists no further incoming flow for this queue (not necessarily accepted) after the first timestep it attains its maximum dj > 0 at that compact period and until the last timestep of this compact period or 2) dj = 0 during the whole compact period. Note that an immediate queue is always urgent and that when we refer to the maximum di or dj as in the above definitions, we refer to their maximum values attained at specific compact periods. Lemma 4. Let a sequence of incoming packet flow giving rise to urgent dominating queues only, while two compact periods of two different urgent queues a and b overlap for at least one timestep. Assuming that a attains its maximum da > 0, for the first time in its compact period, before b attains its maximum db > 0 for the first time in its compact period, then the compact period of a cannot end after the compact period of b ends. Proof. (see Appendix) Before proceeding we should briefly give a sketch of our analysis to follow. According to Corollary 1 and since we want to maximize the number of potential extra packets per timestep, we must maximize the number of free packets located in the LQD buffer at the same timestep. In order to achieve that, the OP T buffer must keep as few as possible packets of free queues in its buffer, while the LQD buffer should accept as many packets for them as possible, when dominating queue overflows take place. A reasonable thought would be to constantly provide bursty incoming flows to the free queues, making OP T accept only one packet for each free queue per timestep and derive an upper bound for the ratio of total transmissions for this sequence of incoming flow. Lemma 5. Consider a sequence of incoming flow κ, giving rise to at least one non-urgent dominating queue. Then, there exists another sequence of incoming flow κ1, where rκ1 ≥ rκ, which gives rise to urgent dominating queues only. Proof. Assume that for the non-urgent dominating queue l, the maximum dl > 0 is attained at timestep tm, the current compact period ends at timestep tf > tm and there exists incoming packet flow for this queue -since it is non-urgent- for at least one timestep in [tm + 1, tf ]. Since, we referred to the maximum dl for this compact period, both LQD and OP T should accept an equal number of packets at any timestep of [tm + 1, tf ], regarding the non-urgent l. We are going to design a new sequence of (cid:48) incoming flow κ , where the packet flow ceases for l in [tm + 1, tf ], introducing currently inactive urgent dominating queues in both buffers. 5 Figure 1: On the upper part we have two consecutive timesteps for the non-urgent queue l. According to Lemma 5, we may cease any further incoming flow to l, introducing a new urgent queue n (below). The buffer snapshots below refer to the incoming sequence κ1 and correspond to the same timesteps, as for the snapshots above each of them (for κ). (cid:48) Regarding κ , the incoming packet flow for l ceases in [tm + 1, tf ] making l urgent for the current compact period, while for the first timestep in it (if such a timestep exists, we call it tu ≤ tf ) that another LQD queue overflows (for κ), an incoming packet flow is introduced for an urgent dominating queue n, currently inactive in both buffers. The number of packets arrived at tu for the new queue n is set to be (ptu (cid:48) The LQD buffer will accept all packets for n at tu, since the sum of the lengths of n and l (for κ ) is equal to the length of l (for κ) at the same timestep; therefore there exists available space for all the nth packets in its buffer. Also, LQD's queue lengths in [tu, tf ], except for n and l, do not change (for ) compared to the respective LQD queue lengths for κ, since for any t ∈ [tu, tf ] it holds that: (cid:48) κ l,LQD,κ − ptu l,LQD,κ (cid:48) ). pt l,LQD,κ (cid:48) + pt n,LQD,κ (cid:48) = pt l,LQD,κ (3) (cid:48) ) for (ptm (cid:48) In case we have more LQD overflows of other queues until tf , κ keeps feeding n with packet flow at the same timesteps that the overflows take place for κ, keeping (3) valid at any timestep t until tf . Note that there is no possibility for n to overflow, because of (3) and since we assumed that l already attained its maximum dl for this compact period, when considering κ; therefore l overflowed for the last time in the current compact period. Queue l is active in the LQD buffer (regarding κ l,LQD,κ - 1) timesteps after tm, while it was active for (tf − tm) timesteps, for κ, after tm again. The urgent queue n cannot be active (for κ (cid:48) ) for more than (tf − tm)− (ptm l,LQD,κ - 1) timesteps, since we subtract from the total number of timesteps of this compact period after tm, the maximum number of LQD packets that l and n together may have (cid:48) is decreased by 1 compared to Dt (due to (3)). Hence, Dt κ, for a number of timesteps not less than κ for any t ∈ [tu, tf ]. κ (cid:48) = Et the number of timesteps it increases by 1. Apart from that, we have Et (cid:48) ≥ rκ. κ Therefore, we obtain rκ are left. We call the last attained incoming sequence κ1 and we have rκ1 ≥ rκ now, we continue applying this procedure until no non-urgent dominating queues (cid:48) ≥ rκ ⇒ rκ1 ≥ rκ (cid:48) Starting from κ Note that we will always have available inactive queues to use as above, since in order for OP T to retain more packets in dominating queues than LQD by at least one packet per queue, we must have 6 OPTLQDOPTLQDOPTLQDOPTLQDOPT,LQDlllln Figure 2: According to Lemma 6, a non-immediate urgent queue (which we can see above in 4 different timesteps, assuming a sorting in chronological order) can be substituted by an immediate queue at the timestep te the former queue attains its maximum d for the first time in this compact period. Note that in the leftmost timestep (above), the queue is free and becomes dominating later on. at most M/2 dominating queues per timestep (recall that we assumed M = N ). This leaves us with at least M/2 inactive queues per timestep. Lemma 6. Consider a sequence of incoming flow σ, giving rise to urgent dominating queues only, where at least one of them is non-immediate. Then, there exists another sequence of incoming flow σ1 which gives rise to immediate dominating queues only and it holds that rσ1 ≥ rσ. Proof. We arrange the dominating queues according to the timesteps they become established queues. Regarding the urgent dominating queues that do not become established, keeping d = 0 for their whole compact period, we provide an alternative incoming flow enough to keep their queue lengths as they already are for σ in both buffers, but no more than that. Therefore, in case an overflow takes place for these queues in both buffers, we subtract their additional incoming flow that is being rejected. Every packet flow to any other queue stays as it is for σ. Obviously, all queue lengths for the new incoming flow stay the same at any timestep. We call the new incoming flow σ (cid:48) = rσ. (cid:48) and it holds rσ Assuming j is non-immediate and dte j Regarding the rest of the urgent dominating queues, we note that any of them may appear more than once in the arrangement we fixed, since it may de defined in more than one compact periods. We pick the first dominating queue that becomes established and we call it j. We denote as tb the timestep the incoming flow is triggered for j at the current compact period, and dj is assumed to take its maximum value for the first time in this compact period at a timestep denoted as te. (cid:54)= 0, we provide a new incoming sequence for which there is no packet flow for queue j in [tb, te − 1], while at te we have the arrival of a number of packets for j, equal to pte (cid:48) . No more incoming flow for this queue shall exist at this compact period. The OP T buffer will accept all of the packets for j at te, since there exists available space for them in its buffer, as it existed for σ (cid:48) , because the lengths of the rest LQD queues at te cannot be smaller than the respective queue lengths for σ , at the same timestep te. We, also, know that this is the maximum possible amount of packets . The LQD buffer will accept an amount of packets at least equal to pte j,LQD,σ (cid:48) j,OP T,σ (cid:48) 7 LQDOPTOPTLQDOPTLQDOPTLQDOPTLQDOPTLQDmaxd (cid:48) (cid:48) j,LQD,σ the LQD buffer can accept for j at te, since at timestep te we have a LQD overflow, for σ (because dj gets its maximum value at this timestep). So, the length of j in the LQD buffer for the new sequence will be equal to pte (cid:48) and this queue will overflow at te. Because of that, all other LQD queue lengths will adjust to their respective values for the new sequence of incoming flow at te, as they were for σ at the same timestep. The new sequence has one less occurrence of a non-immediate dominating queue; it is the jth queue. The new LQD buffer contents may change in [tb, te − 1], due to the absence of packets for queue j, making other queues accept more packets, compared to σ . However, since all queue lengths adjust to their values at te and for any subsequent timestep take their respective values, as for σ , the new ratio of total transmissions is not smaller than rσ (cid:48) j,OP T,σ jth packets at timestep te. No more incoming flow for this queue shall exist at this compact period. All of these packets will be accepted by OP T , while LQD will accept the number of packets it would have accepted for σ at te, for the same reason we discussed in the case of non-immediate queues. (cid:54)= 0, we provide a new incoming flow for it, existing of pte Assuming j is immediate and dtb j (cid:48) . (cid:48) (cid:48) (cid:48) We apply the same procedure, iteratively, on the new sequence of incoming flow we obtain, until no non-immediate queues have been left in the buffer2. We call the final alternative incoming flow σ1. It holds that rσ1 ≥ rσ σ1 is decreased equally, both in the numerator and the denominator of rσ1 compared to Dt σ (cid:48) , for one or more timesteps t. (cid:48) = rσ, since Dt Without Corollary 3 we would not be able to define the exact amount of new incoming flow or the timestep that the new incoming flow would have taken place, for every unsettled queue in the arrangement. In terms of defining an upper bound of the LQD competitive ratio and due to Lemmas 5 and 6, we shall focus only on those sequences of incoming flow for which every dominating queue is immediate. We shall call these sequences of incoming flow as fine sequences. Due to the definition of immediate dominating queues, we obtain the following corollary. Corollary 3. No free queue may transform into a dominating queue during the same compact period, for any fine sequence. Lemma 7. The free queues that are active at a timestep tv, for any fine sequence of incoming flow, will be active for any subsequent timestep of tv, too. Proof. (see Appendix) From Lemma 7 and Corollary 2, we have that for every fine sequence it holds T tot → ∞. Lemma 8. Assume we have a fine sequence φ1 of incoming flow that, either 1) there exists one free queue of non-unit length in the OP T buffer at any timestep, or 2) at a timestep a dominating queue overflows, at least one free queue length in the LQD buffer is strictly smaller than the length of the overflowed dominating queue in the same buffer. Then, there exists a fine sequence φ2 for which neither of these two conditions hold and rφ1 ≤ rφ2. Proof. We will describe φ2: it provides a bursty flow to all active free queues at any timestep, instead of the flow that φ1 provides for the same queues. Certainly, all free queue lengths in the OP T buffer stay unit at any timestep, while all free queues overflow in the LQD buffer, at any timestep. The incoming dt i i∈Fφ2 i,OP T ) ≤ (pt flow to the dominating queues stays the same as for φ1. Therefore, we get (cid:80) for any timestep t and due to Corollary 2 we are able to obtain (cid:80) i) +(cid:80) i ≤(cid:80) i∈Fφ1 (dt dt i∈Eφ1 i∈Dφ1 2In case we have two or more dominating queues becoming established at the same timestep, we arrange them by the timestep they attain their maximum d for the first time in their respective compact periods and pick up the first in this new arrangement (so attaining its maximum d earliest). In case two or more of them attain their maximum d at the same timestep, we apply the aforementioned procedure for each of them, again, picking the queues arbitrarily at this timestep. 8 (cid:80) i)+(cid:80) i∈Dφ2 (dt i∈Eφ2 (pt i,OP T ). Note that we deduce the last inequality, since each bursty flow overflows the OP T buffer, too, making (1) hold as an equality. φ1 = F t Hence, for each dominating queue overflow timestep, this queue's length in the LQD buffer cannot be greater for φ2 than its respective value for φ1 and the same queue's length in the OP T buffer cannot ≥ Dt be smaller for φ2 than its respective value for φ1. According to that, we have Et φ1 and F t φ2, for any t. It follows that rφ1 ≤ rφ2. Note that we may have a different sequence of incoming flow φ (cid:48) 2, than the described φ2, for which the two conditions of the lemma do not hold (as an example, consider a sequence providing bursty flows > rφ2 at to the free queues only when the dominating queues overflow). However, we cannot have rφ any case, since obviously F t φ2 for any timestep t and since by keeping every free queue overflowing φ at any timestep a dominating queue overflows (in order for the second condition to not hold), we will have Dt φ φ2, at any t again. = Dt φ2 and Et φ2, Dt φ1 ≤ Et = F t (cid:48) 2 φ2 (cid:48) 2 (cid:48) 2 = Et (cid:48) 2 φ Definition 3. An ideal fine sequence of incoming packet flow is a fine sequence providing bursty flow to each of its free queues, at any timestep. Providing an upper bound for the ratio of total transmissions for any ideal fine sequence, gives automatically an upper bound for the LQD competitive ratio, due to Lemmas 5, 6, 8 and since an upper bound of the competitive ratio is equal to limT tot→∞(sup RT tot ), as described before. For the analysis to follow, we shall restrict further our attention on ideal fine sequences, only. Finally, since M = N , we easily derive the next corollary. Corollary 4. Every established queue was dominating at the last timestep of its previous compact period. 2.3 The packet connections- in brief The way we are going to bound the competitive ratio is by matching the additional packets that OP T may send, with packets that LQD sends, resembling the way the upper bound of 2 is proved in [10]. We define as a valid connection, a matching of a potential extra packet with a LQD packet located at a strictly smaller queue position than it, not necessarily in the same queue. All matched LQD packets, will be, therefore, leaving the buffer earlier than their matched potential extra packets do, when they have been matched with valid connections. Note that in case LQD decides to drop a connected packet from its buffer, the packet that will take its position keeps this connection which stays valid, according to the LQD preemption policy. We will show that, for every ideal fine sequence of incoming flow, we can validly connect every potential extra packet with two different LQD packets, each of which will be connected with at most one potential extra packet. Since the number of extra packets is upper-bounded by the number of potential extra packets, the additional number of packets that OP T may send cannot be more than half the packets that LQD sends, for any ideal fine sequence. Therefore, we obtain an upper bound on the total transmission ratio of any ideal fine sequence, equal to 1.5. Each connection is assigned at the last overflow timestep of any dominating queue i, for its current compact period, since by Lemma 2, di is non-decreasing during each compact period. We separate the dominating queues into two categories, regarding the ideal fine sequences. A primary dominating queue i is a dominating queue which at the timestep t1 of its last overflow for each of its compact periods, it holds that dt1 i,LQD. Any dominating queue that is not primary at the timestep of its last LQD overflow, will be called secondary. The potential extra packets of any (cid:48) secondary queue i positions in their queues away from the output port at the queue's last overflow timestep t1, will be called pending potential extra packets. that are located more than 2pt1 (cid:48) i i ≤ pt1 ,LQD 9 Our connection assignment algorithm is trivial and it is described in Table 1, where t2 refers to the timestep each dominating queue becomes established, due to Corollary 4. The detailed justification on the assignment procedure for the primary and secondary queues will follow. Figure 3 (see Appendix) gives an illustration of the connection assignment procedure for a secondary dominating queue. Table 1: The connection assignment algorithm between the potential extra packets and LQD packets Queue Primary First Connection Assigned at timestep t1 with common packets located at the same dominating queue. The order we pick packets for connections is arbitrary. Secondary (i) Assigned at timestep t1 for the non- pending potential extra packets with common packets located at the same dominating queue (order does not mat- ter) and (ii) assigned at timestep t1 for the pending packets with free packets, connecting the highest pending packets with the highest free packets and mov- ing gradually to lower queue positions. Second Connection Assigned at timestep t1 with free packets. We start with the highest potential extra packets connecting them with the highest free packets that are located below the threshold line and move gradually to lower queue positions. (i) Assigned at timestep t1 for the non- pending potential extra packets with free packets and (ii) assigned at timestep t2 for the pending packets with free packets. In both cases we pick the highest potential ex- tra packets connecting them with the highest unmatched free packets that give valid con- nections and gradually move to lower queue positions. In case an established queue becomes dominating before it becomes inactive in the OP T buffer, we will have applied connections to potential extra packets that will not become extra packets, but this overestimates, only, the total transmission ratio upper bound of any ideal fine sequence. 2.4 The double connection of the potential extra packets for the primary domi- nating queues The first connection of any potential extra packet belonging to a primary queue is assigned at the timestep t1 that the queue overflows for the last time and for each of its compact periods. The potential extra packet is connected with a free packet. We assign the connections, starting from the highest free packets and potential extra packets (breaking ties arbitrarily between the potential extra and free packets respectively that occupy equal queue positions), connecting them together and gradually reach packets located at lower queue positions. The number of free packets suffices for valid connections, due to Corollary 1, unless we have arbitrary queue drops, which we must examine separately. So, in case we have arbitrary drops and, therefore, at most one free packet per free queue is located above the threshold line at t1, we may assign connections with (unmatched) common packets, if needed. Recall that the maximum number of free packets located above the threshold line is one packet per free queue and therefore it is at most the number of common packets located in free queues at that timestep, due to Corollary 2. We assign the connections as before, starting from the highest free packets located below the threshold line and continue as described before. Even if all common packets located in free queues are already matched before t1, the free packets located above the threshold line are not needed for connections, since we will need F t1 less free packets for connections. According to this connection procedure, for every connected free packet there will exist at least one LQD packet located at some dominating queue, at an equal queue position. The same applies to the case of secondary queues. The second connection is assigned, again at t1, with a common LQD packet belonging to the same primary dominating queue. Obviously, such a connection is valid and the number of common LQD packets suffices. The order we assign connections is arbitrary. 10 There is no possibility a LQD packet located in a dominating queue to be an accepted packet in a position of a formerly connected LQD packet that was preempted from a free queue in the previous timestep, since for every connected free packet there will exist at least one LQD packet located at some dominating queue, at an equal queue position, as stated before. But in such a case, the LQD packet belonging to the dominating queue should have been preempted first, since we assumed that LQD packets of dominating queues are always chosen first for preemptions, in case of arbitrary drops. That would increase d for this dominating queue and this is not allowed for the dominating queues which we have, already, applied connections, since we assign connections at each dominating queue's last overflow timestep. The same applies to the case of secondary dominating queues. 2.5 The double connection of the potential extra packets for the secondary domi- nating queues In the case of secondary dominating queues, we do not have the required number of common packets belonging to the same queue, to apply both connections at t1. The pending packets are matched only once at this timestep. We will have to wait until timestep t2, in order to apply the second connections to the pending potential extra packets, when all previously matched LQD packets with potential extra packets of this queue will have left the LQD buffer, in order to avoid duplicated connections. Since we refer to ideal fine sequences, all LQD free queue lengths cannot differ for more than one packet at any timestep. Therefore, whether the smallest free queue length at t2 in the LQD buffer has decreased or not compared to the smallest free queue length at t1 in the same buffer, choosing the highest potential extra packets and connecting them with the highest free packets that give valid connections at t2, while gradually moving to lower queue positions and applying connections to all pending packets, completes the assignment of the second connection to every pending packet. Note that we know we can assign valid connections at t2 to all pending packets, due to Lemma 7. Corollary 5. Every pending packet can be validly connected twice with formerly unmatched LQD packets, when we refer to ideal fine sequences. The first connection takes place at its secondary queue's last overflow timestep for its current compact period and the second when this queue becomes established. This completes the proof for the double connection of any potential extra packet belonging to a secondary dominating queue, regarding the ideal fine sequences of incoming packet flow. 2.6 An upper bound of the LQD competitive ratio We showed that every potential extra packet can be connected with two unique LQD packets, for any ideal fine sequence. Hence, the number of packets that OP T may additionally send is at most half the number of packets that LQD sends for any such sequence. We, also, showed that for every sequence of incoming flow that is not fine, there exists a fine sequence attaining at least the same ratio of total transmissions and that for every fine sequence that is not ideal, there exists an ideal fine sequence attaining at least the same ratio of total transmissions. Therefore, the ratio of total transmissions for any sequence of incoming flow is upper-bounded by 1.5 and LQD is 1.5-competitive, due to (2). 3 Concluding Remarks We proved that the Longest Queue Drop policy for shared-memory switches is 1.5-competitive, clos- ing significantly the gap with the lower bound of 2. Regarding future research, the application of randomization in the queues that are chosen for packet rejections would be very interesting, as well as the use of non-uniform packet transmission cost and values. √ 11 References [1] W. Aiello, A. Kesselman, and Y. Mansour. Competitive buffer management for shared-memory switches. ACM Transactions on Algorithms, 5(1), 2008. [2] S. Albers and T. Jacobs. An experimental study of new and known online packet buffering algorithms. Algorithmica, 57(4):725 -- 746, 2010. [3] N. Bansal, L. Fleischer, T. Kimbrel, M. Mahdian, B. Schieber, and M. Sviridenko. Further improvements in competitive guarantees for qos buffering. In ICALP, pages 196 -- 207, 2004. [4] Y. Bartal, A. Fiat, H. J. Karloff, and R. Vohra. New algorithms for an ancient scheduling problem. J. Comput. Syst. Sci., 51(3):359 -- 366, 1995. [5] A. Borodin and R. El-Yaniv. Online computation and competitive analysis. Cambridge University Press, 1998. [6] M. Englert and M. Westermann. Lower and upper bounds on fifo buffer management in qos switches. In ESA, pages 352 -- 363, 2006. [7] M. Englert and M. Westermann. Considering suppressed packets improves buffer management in qos switches. In SODA, pages 209 -- 218, 2007. [8] A. Fiat and G. J. Woeginger. Online Algorithms, The State of the Art. Lecture Notes in Computer Science. Springer. [9] M. H. Goldwasser. A survey of buffer management policies for packet switches. SIGACT News, 41(1):100 -- 128, 2010. [10] E. L. Hahne, A. Kesselman, and Y. Mansour. Competitive buffer management for shared-memory switches. In SPAA, pages 53 -- 58, 2001. [11] A. Kesselman, Z. Lotker, Y. Mansour, B. Patt-Shamir, B. Schieber, and M. Sviridenko. Buffer overflow management in qos switches. In STOC, pages 520 -- 529, 2001. [12] K. Kobayashi, S. Miyazaki, and Y. Okabe. A tight bound on online buffer management for two-port shared-memory switches. In SPAA, pages 358 -- 364, 2007. [13] Z. Lotker and B. Patt-Shamir. Nearly optimal fifo buffer management for diffserv. In PODC, pages 134 -- 142, 2002. [14] B. Suter, T. V. Lakshman, D. Stiliadis, and A. K. Choudhury. Design considerations for supporting tcp with per-flow queueing. In INFOCOM, pages 299 -- 306, 1998. [15] S. X. Wei, E. J. Coyle, and M.-T. T. Hsiao. An optimal buffer management policy for high- performance packet switching. In Globecom, pages 924 -- 928, 1991. 12 A Omitted Proofs A.1 Proof of Lemma 1 Proof. We need to show that for every optimal offline policy for which the lemma does not hold, if such one policy exists, there exists another offline policy, which we call q1, for which the lemma holds and this latter policy has at least the total transmission of the former one, for any possible sequence of packet arrivals σ. Suppose that, without loss of generality, LQD accepts a set of packets S2 belonging to the same queue i at timestep t, while an optimal offline policy q3 chooses to accept a set of packets S1 of the same queue at the same timestep (where S2 > S1 ≥ 0) which will cause the optimal buffer to become empty of ith packets earlier than LQD's buffer does. The ith queue may be already inactive in both buffers at timestep t. Note that we may have more than S2 incoming flow for this queue at timestep t, but we need only to concentrate on the amount of packets that LQD accepts. Also, there may exist later incoming flow for this queue, before it becomes inactive in the OP T buffer, assuming that q3 accepts at least the amount of packets that LQD accepts for it, for every timestep of a later incoming flow. Strategy q3 may admit S2 − S1 different packets in position of the packets that LQD decided to accept for this specific queue and we know that the queues the S2 − S1 packets may belong to, already appear in the LQD buffer, otherwise LQD would have accepted them, too. However, since we assumed that LQD accepted S2, the length of the ith queue in the LQD buffer at timestep t is not greater than each of the lengths of its queues that the S2 − S1 packets belong to, due to the LQD policy. Hence, q3 cannot transmit, compared to LQD, more than (S2 − S1) packets after the timestep the ith queue becomes inactive in the LQD buffer. Until this timestep, q3 will be lacking in throughput of one packet per timestep, after this queue becomes inactive in its buffer. So, q3 cannot gain something more in total transmission than the amount of total transmission it will have lost until this timestep. Finally, in case we have two or more queues staying inactive in the q3's buffer but not in the LQD one at one or more timesteps, the result stays the same by applying repetitively the aforementioned procedure. Therefore, offline strategy q1 does not lack in total transmission, compared to the optimal offline strategy q3. A.2 Proof of Lemma 3 Proof. Assume strategy q1 cannot have a non-empty queue (which we shall call q) at some timestep t (cid:48) when the specific queue is active in the LQD buffer, since otherwise it should be dt z > dt z for at least one of its dominating queues, which we call z, at some timestep t < t. (cid:48) (cid:48)(cid:48) ≤ t (cid:48) If q becomes empty at timestep t in the optimal buffer while it is active in the LQD buffer, then we for which OP T accepted less packets than LQD did < t), OP T admitted more packets than LQD did for z. But, OP T could have chosen to know from Corollary 1 that at some timestep t for q (t (cid:48)(cid:48) accept a smaller amount of packets for z, still having dt this gained amount of packets for increasing its packet quantity in q and decreasing dt(cid:48)(cid:48) q . (cid:48)(cid:48) By applying this procedure for -if necessary- more than one dominating queues at t or more , we can obtain an equal quantity of packets for q in the two buffers at timestep t or timesteps before t after but, certainly, before q becomes inactive in the OP T buffer. Therefore, there exists an optimal offline strategy retaining the properties of both q1 and q2 and we shall call it qo. . Hence, OP T could have dedicated (cid:48) (cid:48)(cid:48) (cid:48)(cid:48)−1) z ≥ d (t z 13 Figure 3: A secondary dominating queue at the timestep t1 of its last overflow, on the left. We have an ideal fine sequence, keeping each free queue length unit in the OP T buffer (there are two free queues on the left and three on the right). The pending potential extra packets (in dark) can be assigned only one connection and the rest potential extra packets (in light colour) two connections, with free packets. At timestep t2, on the right, when all previously matched LQD packets with potential extra packets of this queue have left the buffer (dashed-dotted arrows), we apply the second connections to the pending packets. If we had a primary queue, both connections would be assigned at t1. The dotted horizontal lines represent the current threshold lines and we assume that no dominating queue overflows on the right, causing only the free queues to overflow, since we have an ideal fine sequence. A.3 Proof of Lemma 4 Proof. We assume that the urgent dominating queue a attains its maximum da for the first time at to and the urgent dominating queue b attains its maximum db for the first time at tp > to. Since there exists no more incoming packet flow for a after to and da is maximized at this timestep (therefore no more preemptions take place for this queue in the LQD buffer and for this compact period), it holds that pt b,LQD for any timestep t until a becomes established. This completes the proof. a,LQD ≤ pt A.4 Proof of Lemma 7 Proof. In order for a free queue to become inactive in the LQD buffer at some timestep tc > tv, its length in the OP T buffer, due to Corollary 2, should become at least equal to that in the LQD buffer, at a timestep before tc. But then, a free queue becomes dominating during the same compact period and this cannot happen, due to Corollary 3. 14 OPTLQDLQDOPT
1601.04203
2
1601
2016-11-04T15:50:36
Determining Tournament Payout Structures for Daily Fantasy Sports
[ "cs.DS" ]
With an exploding global market and the recent introduction of online cash prize tournaments, fantasy sports contests are quickly becoming a central part of the social gaming and sports industries. For sports fans and online media companies, fantasy sports contests are an opportunity for large financial gains. However, they present a host of technical challenges that arise from the complexities involved in running a web-scale, prize driven fantasy sports platform. We initiate the study of these challenges by examining one concrete problem in particular: how to algorithmically generate contest payout structures that are 1) economically motivating and appealing to contestants and 2) reasonably structured and succinctly representable. We formalize this problem and present a general two-staged approach for producing satisfying payout structures given constraints on contest size, entry fee, prize bucketing, etc. We then propose and evaluate several potential algorithms for solving the payout problem efficiently, including methods based on dynamic programming, integer programming, and heuristic techniques. Experimental results show that a carefully designed heuristic scales very well, even to contests with over 100,000 prize winners. Our approach extends beyond fantasy sports -- it is suitable for generating engaging payout structures for any contest with a large number of entrants and a large number of prize winners, including other massive online games, poker tournaments, and real-life sports tournaments.
cs.DS
cs
Determining Tournament Payout Structures for Daily Fantasy Sports Christopher Musco ∗ Maxim Sviridenko † Justin Thaler ‡ November 7, 2016 Abstract With an exploding global market and the recent introduction of online cash prize tourna- ments, fantasy sports contests are quickly becoming a central part of the social gaming and sports industries. For sports fans and online media companies, fantasy sports contests are an opportunity for large financial gains. However, they present a host of technical challenges that arise from the complexities involved in running a web-scale, prize driven fantasy sports platform. We initiate the study of these challenges by examining one concrete problem in particular: how to algorithmically generate contest payout structures that are 1) economically motivating and appealing to contestants and 2) reasonably structured and succinctly representable. We formalize this problem and present a general two-staged approach for producing satisfying payout structures given constraints on contest size, entry fee, prize bucketing, etc. We then propose and evaluate several potential algorithms for solving the payout problem efficiently, including methods based on dynamic programming, integer programming, and heuris- tic techniques. Experimental results show that a carefully designed heuristic scales very well, even to contests with over 100,000 prize winners. Our approach extends beyond fantasy sports – it is suitable for generating engaging payout structures for any contest with a large number of entrants and a large number of prize winners, including other massive online games, poker tournaments, and real-life sports tournaments. 6 1 0 2 v o N 4 ] S D . s c [ 2 v 3 0 2 4 0 . 1 0 6 1 : v i X r a ∗Massachusetts Institute of Technology. Worked completed while at Yahoo Labs. Email: [email protected] †Yahoo Labs. Email: [email protected] ‡Georgetown University. Worked completed while at Yahoo Labs. Email: [email protected] Introduction 1 In many competitions, a large number of entrants compete against each other and are then ordered based on performance. Prize money is distributed to the entrants based on their rank in the order, with higher ranks receiving more money than lower ranks. The question that we are interested in is: how should prize money be distributed among the entrants? That is, how much money should go to the winner of the contest? How much to 2nd place? How much to 1,128th place? 1.1 Motivation We became interested in this problem in the context of daily fantasy sports 1, a growing sector of online fantasy sports competitions where users pay a fee to enter and can win real prize money. Daily fantasy sports were legalized in the United States in 2006 by the Unlawful Internet Gambling Enforcement Act, which classified them as games of skill. Since then, the industry has been dominated by two companies, FanDuel and DraftKings. In 2015, these companies collected a combined $3 billion in entry fees, which generated an estimated $280 million in revenue [12]. Analysts project continued industry growth as daily fantasy attracts a growing portion of the 57 million people who actively play traditional fantasy sports [7, 9]. Yahoo launched a daily fantasy sports product in July 2015. Work on the contest management portion of this product has led to interesting economic and algorithmic challenges involving player pricing, revenue maximization, fill-rate prediction and of course, payout structure generation. The Importance of Payout Structure. Payout structure has been identified as an important factor in determining how appealing a competition is to users. Payouts are regularly discussed on forums and websites devoted to the daily fantasy sports industry, and these structures have a substantial effect on the strategies that contest entrants pursue (see, e.g., [1, 14, 2, 6, 10]). Furthermore, considerable attention has been devoted to payout structures in related contexts. For example, popular articles discuss the payout structures used in World Series of Poker (WSOP) events (see Section 2.1 for details), and at least one prominent poker tournament director has said that "payout structure could determine whether or not a player comes back to the game." [18]. 1.2 Payouts in Daily Fantasy Sports For some types of fantasy sports contests, the appropriate payout structure is obvious. For example, in a "Double Up" contest, roughly half of the entrants win back twice the entry fee, while the other half wins nothing. However, some of the most popular contests are analogous to real-world golf and poker tournaments, in which the winner should win a very large amount of money, second place should win slightly less, and so on. We refer to such competitions as tournaments. Manually determining a reasonable payout structure for each tournament offered is unprinci- pled and laborious, especially when prize pools and contestant counts vary widely across contests. Furthermore, given typical constraints, manually constructing even a single payout structure is difficult, even "virtually impossible" in the words of a WSOP Tournament Director [18]. The chal- lenge is amplified for online tournaments where the number of contestants and prizes awarded can be orders of magnitude larger than in traditional gaming and sporting: FanDuel and DraftKings run contests with hundreds of thousands of entrants and up to $15 million in prizes. Accordingly, our goal is to develop efficient algorithms for automatically determining payouts. 1.3 Summary of Contributions Our contributions are two-fold. First, we (partially) formalize the properties that a payout structure for a daily fantasy tournament should satisfy. Second, we present several algorithms for calculating such payout structures based on a general two stage framework. In particular, we present an efficient heuristic that scales to extremely large tournaments and is currently in production at Yahoo. All methods are applicable beyond fantasy sports to any large tournament, including those for golf, fishing, poker, and online gaming (where very large prize pools are often crowd-funded [8]). 1In fantasy sports, participants build a team of real-world athletes, and the team earns points based on the actual real-world performance of the athletes. Traditional fantasy sports competitions run for an entire professional sports season; daily sports competitions typically run for just a single day or week. 1 2 Payout Structure Requirements We begin by formalizing properties that we want in a payout structure. A few are self-evident. • (Prize Pool Requirement) The total amount of money paid to the users must be equal to the Total Prize Pool. This is a hard requirement, for legal reasons: if a contest administrator says it will pay out $1 million, it must pay out exactly $1 million. • (Monotonicity Requirement) The prizes should satisfy monotonicity. First place should win at least as much as second place, who should win at least as much as third, and so on. There are less obvious requirements as well. • (Bucketing Requirement) To concisely publish payout structures, prizes should fall into a manageable set of "buckets" such that all users within one bucket get the same prize. It is not desirable to pay out thousands of distinct prize amounts. • (Nice Number Requirement) Prizes should be paid in amounts that are aesthetically pleasing. Paying a prize of $1, 000 is preferable to $1, 012.11, or even to $1, 012. • (Minimum Payout Requirement): It is typically unsatisfying to win an amount smaller than the entry fee paid to enter the contest. So any place awarded a non-zero amount should receive at least some minimum amount E. Typically, we set E to be 1.5 times the entry fee. Finally, the following characteristic is desirable: • (Monotonic Bucket Sizes): Buckets should increase in size when we move from higher ranks to lower ranks. For example, it is undesirable for 348 users to receive a payout of $20, 2 users to $15, and 642 users to receive $10. Of course, it is not enough to simply find a payout structure satisfying all of the requirements above. For example, a winner-take-all payout structure satisfies all requirements, but is not ap- pealing to entrants. Thus, our algorithms proceed in two stages. We first determine an "initial", or ideal, payout structure that captures some intuitive notions of attractiveness and fairness. We then modify the initial payout structure as little as possible to satisfy the requirements. Before discussing this process, three final remarks regarding requirements are in order. Small Contests. In tournaments with few entrants, it is acceptable to pay each winner a distinct prize. In this case, the bucketing requirement is superfluous and choosing payouts is much easier. Handling Ties. In daily fantasy sports and other domains such as poker and golf, entrants who tie for a rank typically split all prizes due to those entrants equally. Accordingly, even if the initial payout structure satisfies the Nice Number Requirement, the actual payouts may not. However, this is inconsequential: the purpose of the Nice Number Requirement is to ensure that aesthetically pleasing payouts are published, not to ensure that aesthetically pleasing payouts are received. What are "Nice Numbers"? There are many ways to define nice numbers, i.e., the numbers that we deem aesthetically pleasing. Our algorithms will work with any such definition, as long as it comes with an algorithm that, given a number a ∈ R, can efficiently return the largest nice number less than or equal to a. Here we give one possible definition. Definition 2.1 (Nice Number). A nonnegative integer X ∈ Z+ is a "nice number" if X = A · 10K where K, A ∈ Z+, and A ≤ 1000 satisfies all of the following properties: 1. if A ≥ 10 then A is a multiple of 5; 2. if A ≥ 100 then A is a multiple of 25; 3. if A ≥ 250 then A is a multiple of 50. Under Definition 2.1, the nice numbers less than or equal to 1000 are: {1, 2, 3, . . . , 10, 15, 20, . . . , 95, 100, 125, 150, . . . , 225, 250, 300, 350, . . . , 950, 1000} The nice numbers between 1000 and 3000 are {1000, 1250, 1500, 1750, 2000, 2250, 2500, 3000}. 2 2.1 Prior Work While our exact requirements have not been previously formalized, observation of published payout structures for a variety of contests suggests that similar guiding principals are standard. Moreover, manually determining payouts to match these requirements is, anecdotally, not an easy task. For example, it is not hard to find partially successful attempts at satisfying nice number constraints. 105 $51,400 ) i t u o y a p ( 104 0 1 g o l $15,200 $11,400 $10,200 $8900 $7600 $6400 $5100 $3800 $3500 $3200 $3000 103 0 5 10 15 $2500 20 winneri $2200 $1900 $1600 25 30 35 Figure 1: Bassmaster Open payouts are not quite "nice numbers" [3]. For example, consider the 2015 Bassmaster Open fishing tournament, which paid out a top prize of $51,400, instead of the rounder $51,000 or $50,000 (see Figure 1). The Bassmaster payout structure also violates our constraint on bucket size monotonicity. Similar "partially optimized" payout structures can be found for poker [19, 18], golf [21], and other tournaments. Payout Structures for Poker. Several popular articles describe the efforts of the World Series Of Poker (WSOP), in conjunction with Adam Schwartz of Washington and Lee University, to develop an algorithm for determining payout structures for their annual "Main Event" [23, 18]. Schwartz's solution, which was based on Newton's Method, was combined with manual intervention to de- termine the final payout structure in 2005. WSOP still utilized considerable manual intervention when determining payouts until an update of the algorithm in 2009 made doing so unnecessary. While a formal description of the algorithm in unavailable, it appears to be very different from ours; Schwartz has stated that their solution attempts to obtain payout structures with a "constant second derivative" (our solutions do not satisfy this property). Their work also departs qualitatively from ours in that they do not consider explicit nice number or bucket size requirements. Piecewise Function Approximation. As mentioned, our payout structure algorithms proceed in two stages. An initial payout curve is generated with a separate payout for every winning position. The curve is then modified to fit our constraints, which requires bucketing payouts so that a limited number of distinct prizes are paid. We seek the bucketed curve closest to our initial payout curve. This curve modification task is similar to the well studied problem of optimal approximation of a function by a histogram (i.e., a piecewise constant function). This problem has received considerable attention, especially for applications to database query optimization [15]. While a number of algorithmic results give exact and approximate solutions [17, 13], unfortunately no known solutions easily adapt to handle our additional constraints beyond bucketing. 3 Our Solution Let B denote the total prize pool, N denote the number of entrants who should win a non-zero amount, and Pi denote the prize that we decide to award to place i. In general, B, P1 and N are user-defined parameters. P1 can vary widely in fantasy sports contests, anywhere from .05 · B to nearly .5 · B, but .15 · B is a standard choice (i.e., first place wins 15% of the prize pool). Typically, N is roughly 25% of the total number of contest entrants, although it varies as well. Our solution proceeds in two stages. We first determine an initial payout structure that does not necessarily satisfy Bucketing or Nice Number requirements. The initial payout for place i is denoted πi. We then modify the payouts to satisfy our requirements. In particular, we search for feasible payouts P1, . . . , PN that are nearest to our initial payouts in terms of sum-of-squared error. 3 3.1 Determining the Initial Payout Structure First, to satisfy the Minimum Payout Requirement, we start by giving each winning place E dollars. This leaves B − N · E additional dollars to disperse among the N winners. How should we do this? We have decided that it is best to disperse the remaining budget according to a power law. That is, the amount of the budget that is given to place i should be proportional to 1/iα for some fixed constant α > 0. It is easy to see that for any positive value of α, the resulting payouts will satisfy the Monotonicity Requirement, but there is a unique value of α ensuring that the payouts sum to exactly the Total Prize Pool B. Specifically, we need to choose the exponent α to satisfy B − N · E = P1 − E iα . N Xi=1 We can efficiently solve this equation for α to additive error less than .01 via binary search. We then define the ideal payout to place i to be πi := E + P1−E iα . This definition ensures both that first place gets paid exactly $P1, and that the sum of all of the tentative payouts is exactly B. 106 105 104 i t u o y a p 103 102 101 0 2000 106 105 104 i t u o y a p 103 102 101 0 2000 8000 10000 4000 6000 winneri 8000 10000 4000 6000 winneri (a) Ideal payouts using power law method. (b) Ideal payouts using exponential distribution. Figure 2: Possible initial payout structure when N = 10,000, P1 = 150,000, and B = 1 million. Why use a power law? Empirically, a power law ensures that as we move from 1st place to 2nd to 3rd and so on, payouts drop off at a nice pace: fast enough that top finishers are richly rewarded relative to the rest of the pack, but slow enough that users in, say, the 10th percentile still win a lot of money. A power law curve also encourages increased prize differences between higher places, a property cited as a desirable by WSOP organizers [18]. For illustration, consider a tournament where 40,000 entrants vie for $1 million. If 1st place wins 15% of the prize pool and 25% of entrants should win a non-zero prize, then P1 = $150, 000 and N = 10, 000. Figure 2a reveals the initial payouts determined by our power law method. Figure 2b reveals what initial payouts would be if we used an exponential distribution instead, with prizes proportional to 1/αi rather than 1/iα. Such distributions are a popular choice for smaller tournaments, but the plot reveals that they yield much more top-heavy payouts than a power law approach. In our example, only the top few dozen places receive more than the minimum prize. FanDuel NFL Kickoff Tournament FanDuel MLB Monster Tuesday DraftKings PGA Millionaire Maker DraftKings NFL Kickoff Tournament 107 106 105 104 103 102 i t u o y a p 101 100 101 102 104 105 106 103 winneri i t u o y a p 107 106 105 104 100 World Series of Poker 2015 Masters 2015 (golf) Bassmaster 2015 (fishing) 101 102 103 winneri (a) Large fantasy sports tournaments. Figure 3: Log plots of existing tournament payout structures indicate linear structure. (b) Other well known tournaments. As further justification, we check in Figure 3 that a power law roughly models payouts for existing fantasy sports contests and other large tournaments. Since log(iα) = α log(i), plotting 4 payouts with both axes on a logarithmic scale will reveal a linear trend when the payout distribution approximates a power law. This trend is visible in all of the tournaments checked in Figure 3. Obtaining quantitative goodness-of-fit metrics for the power law can be difficult [4] especially given the heavy "value binning" present in payout structures [22]. Nevertheless, standard fitting routines [5] yield an average p-value of .237 for the Figure 3 tournaments. This value is in line with calculated p-values for well known empirical power law distributions with binned values [22]. Overall, the power law's simplicity, empirical effectiveness, and historical justification make it an ideal candidate for generating initial prize values. 3.2 Satisfying the Remaining Requirements Now that we have an initial payout structure (π1, . . . , πN ), our goal becomes to identify a related payout structure that is "close" to this ideal one, but satisfies our Bucketing and Nice Number requirements. To measure "closeness" of payout structures we have found that (squared) Euclidean distance works well in practice: we define the distance between two payout structures (P1, . . . , PN ) i=1(Pi − Qi)2. This metric is equivalent to the popular "V-optimal" measure for approximation of a function by a general histogram [16]. and (Q1, . . . , QN ) to be PN With a metric in hand, our task is formalized as an optimization problem, Problem 3.1. Specif- ically, suppose we are given a target number of buckets r. Then the goal is to partition the set {1, . . . , N } into r buckets S1, . . . , Sr (each containing a set of consecutive places), and to choose a set of payouts Π1, . . . , Πr for each bucket, forming a final solution (S1, . . . , Sr, Π1, . . . , Πr). Problem 3.1 (Payout Structure Optimization). For a given set of ideal payouts {π1, . . . , πN } for N contest winners, a total prize pool of B, and minimum payout E, find (S1, . . . , Sr, Π1, . . . , Πr) to optimize: r min Xj=1Xi∈Sj (πi − Πj)2 subject to: E ≤ Πr < Πr−1 < · · · < Π1, (Monotonicity & Min. Payout Requirements) ΠjSj = B, (Prize Pool Requirement) Πj is a "nice number" , j ∈ [r]∗ (Nice Number Requirement) Sj = N, (Ensure Exactly N Winners) r Xj=1 r Xj=1 0 ≤ S1 ≤ S2 < · · · ≤ Sr, (Monotonic Bucket Sizes†) where Sj =nPi<j Si + 1,Pi<j Si + 2, . . . ,Pi≤j Sio for j ∈ [r]. ∗For ease of notation we use [T ] to denote the set of integers {1, 2, . . . , T }. †Setting S1 = ∅, S2 = ∅, etc. chooses a payout structure with fewer buckets than the maximum allowed. One advantage of our approach is that Problem 3.1 is agnostic to the initial curve (π1, . . . , πN ). Our algorithms could just as easily be applied to an ideal payout curve generated, for example, using the "constant second derivative" methodology of the World Series of Poker [18]. Problem Feasibility. Note that, for a given set of constraints, Problem 3.1 could be infeasible as formulated: it may be that no assignment to (S1, . . . , Sr, Π1, . . . , Πr) satisfies the Nice Number and Bucket Size Monotonicity constraints while giving payouts that sum to B. While the problem is feasible for virtually all fantasy sports tournaments tested (see Section 6), we note that it is easy to add more flexible constraints that always yield a feasible solution. For example, we can soften the requirement on N by adding a fixed objective function penalty for extra or fewer winners. With this change, Problem 3.1 is feasible whenever B is a nice-number: we can award a prize 5 of B to first place and prizes of zero to all other players. Experimentally, there are typically many feasible solutions, the best of which are vastly better than the trivial "winner-take-all" solution. Exact Solution via Dynamic Programming. While Problem 3.1 is complex, when feasible it can be solved exactly in pseudo-polynomial time via multi-dimensional dynamic programming. The runtime of the dynamic program depends on the number of potential prize assignments, which includes all of the nice numbers between E and B. Since many reasonable definitions (including our Definition 2.1) choose nice numbers to spread out exponentially as they increase, we assume that this value is bounded by O(log B). Theorem 3.2 (Dynamic Programming Solution). Assuming that there are O(log B) nice numbers in the range [E, B], then Problem 3.1 can be solved in pseudo-polynomial time O(rN 3B log2 B). A formal description of the dynamic program and short proof of its correctness are included in Appendix A. Unfortunately, despite a reasonable theoretical runtime, the dynamic program requires O(rN 2B log B) space, which quickly renders the solution infeasible in practice. 4 Integer Linear Program Alternatively, despite its complexity, we show that it is possible to formulate Problem 3.1 as a standard integer linear program. Since integer programming is computationally hard in general, this does not immediately yield an efficient algorithm for the problem. However, it does allow for the application of off-the-shelf optimization packages to the payout structure problem. ideal payouts Problem 4.1 (Payout Structure Integer Program). For a given set of {π1, . . . , πN }, a total prize pool of B, a given set of acceptable prize payouts {p1 > p2 > . . . > pm}, and an allowed budget of r buckets solve: xi,j,k · (πi − pk)2 subject to: Problem constraints: min Xi∈[N ],j∈[r],k∈[m] Xk∈[m] Xi∈[N ],j∈[r],k∈[m] Xi∈[N ],k∈[m] (k + 1/2) · xj,k − k · xj+1,k ≤ 0, j ∈ [r − 1], (Monotonicity Requirements) xi,j,k · pk = B, (Prize Pool Requirement) xi,j,k − xi,j+1,k ≤ 0, Consistency constraints: xi,j,k = 1, j ∈ [r − 1], (Monotonic Bucket Sizes) i ∈ [N ], (One Bucket Per Winner) Xj∈[r],k∈[m] Xk∈[m] xj,k ≤ 1, j ∈ [r], (One Prize Per Bucket) xj,k − xi,j,k ≥ 0, i ∈ [N ], j ∈ [r], k ∈ [m], (Prize Consistency) To keep the formulation general, assume that we are given a fixed set of acceptable prize payouts, {p1 > p2 > . . . > pm}. These payouts may be generated, for example, using Definition 2.1 for nice numbers. In our implementation, the highest acceptable prize is set to p1 = P1, where P1 is the pre-specified winning prize. Additionally, to enforce the minimum payout requirement, we chose pm ≥ E. Our integer program, formalized as Problem 4.1, involves the following variables: • N × r × m binary "contestant variables" xi,j,k. In our final solution, xi,j,k = 1 if and only if contestant i is placed in prize bucket Sj and receives payout pk. • r × m binary "auxiliary variables" xj,k. xj,k = 1 if and only if bucket Sj is assigned payout pk. Constraints ensure that xi,j,k only equals 1 when xj,k = 1. If, for a particular j, xj,k = 0 for all k then Sj is not assigned a payout, meaning that the bucket is not used. 6 It is easy to extract a payout structure from any solution to the integer program. Showing that the payouts satisfy our Problem 3.1 constraints is a bit more involved. A proof is in Appendix B. 5 Heuristic Algorithm Next we describe a heuristic algorithm for Problem 3.1 that is used in production at Yahoo. The algorithm is less rigorous than our integer program and can potentially generate payout structures that violate constraints. However, it scales much better than the IP and experimentally produces stellar payouts. The heuristic proceeds in four stages. Stage 1: Initialize Bucket Sizes. First the algorithm chooses tentative bucket sizes S1 ≤ . . . ≤ Sr. We set S1 = S2 = S3 = S4 = 1. The choice to use 4 "singleton buckets" by default i=1 Si = 1, we define S5 = 1 and stop. Otherwise we set St = ⌈β · St−1⌉ where β ≥ 1 is a parameter of the heuristic. The i=1 Si ≤ N . We define is flexible: the algorithm can easily accommodate more. If N −P4 algorithm stops when ⌈β2St⌉ + ⌈βSt⌉ +Pt t i=1 Si > N and ⌈βSt⌉ +Pt ' . Si/2% , St+2 =& N −Pt i=1 Si 2 St+1 =$N − Xi=1 An initial value for β can be determined by solving β + β2 + . . . + βr−4 = N − 4 via binary search. If the heuristic produces more than r buckets using the initial β, we increase β and iterate. Stage 2: Initialize Prizes. Next, we begin by rounding the first tentative prize, π1, down to the nearest nice number. The difference between π1 and the rounded number is called the leftover, which we denote by L. Iteratively, for each bucket S2, . . . , St we sum all of the tentative prizes in the bucket with the leftover from the previous buckets. Let Rt be this number and define Πt to equal Rt/St rounded down to the nearest nice number. If Πt is greater than or equal to the prize in bucket t − 1, Πt−1, we simply merge all member of St into St−1, assigning them prize Πt−1. At the end we may have some non-zero leftover L remaining from the last bucket. Stage 3: Post-Process Non-monotonic Bucket Sizes. Although the initial buckets from Step 1 increase in size, potential bucket merging in Step 2 could lead to violations in the Monotonic Bucket Size constraint. So, whenever St is larger than St+1, we shift users to bucket t + 1 until the situation is corrected. As a result we decrease the prizes for some users and increase the leftover L. We repeat this process starting from S1 and ending at our lowest prize level bucket. Stage 4: Spend Leftover Funds. Finally, we modify payouts to spend any leftover L. We first spend as much as possible on singleton buckets 2 through 4. We avoid modifying first prize because it is often given as a hard requirement – e.g. we want pay exactly $1 million to the winner. In order from i = 2 to 4 we adjust Πi to equal min{Πi + L, (Πi−1 + Πi)/2}, rounded down to a nice number. This spends as much of L as possible, while avoiding too large an increase in each prize. If L remains non-zero, we first try to adjust only the final (largest) bucket, Sk. If L ≥ Sk then we set Πk = Πk + 1 and L = L − Sk, i.e. we increase the prize for every user in Sk by 1. Note that this could lead to nice number violations, which are not corrected. We repeat this process (possibly merging buckets) until L < Sk. If at this point L is divisible by Πk we increase Sk by L/Πk (thereby increasing the number of users winning nonzero prizes beyond N ). If L is not divisible by Πk, we rollback our changes to the last bucket and attempt to spend L on the last two buckets. Compute the amount of money available, which is the sum of all prizes in these buckets plus L. Fix the last bucket prize to be the minimal possible amount, E. Enumerate over possible sizes and integer prize amounts for the penultimate bucket, again ignoring nice number constraints. If the last bucket can be made to have integer size (with payout E), store the potential solution and evaluate a "constraint cost" to penalize any constraint violations. The constraint cost charges 100 for each unit of difference if the number of winners is less than N , 1 for each unit of difference if the number of winners is larger than N , and 10 for each unit of violation in bucket size monotonicity. From the solutions generated return the one with minimal constraint cost. 7 6 Experiments We conclude with experiments that confirm the effectiveness of both the integer program (Section 4) and our heuristic (Section 5). Both algorithms were implemented in Java and tested on a commodity laptop with a 2.6 GHz Intel Core i7 processor and 16 GB of 1600 MHz DDR3 memory. For the integer program, we employ the off-the-shelf, open source GNU Linear Programming Kit (GLPK), accessed through the SCPSolver front-end [11, 20]. The package uses a branch-and-cut algorithm for IPs with a simplex method for underlying linear program relaxations. We construct experimental payout structures for a variety of daily fantasy tournaments from Yahoo, FanDuel, and DraftKings and test on non-fantasy tournaments as well. For non-Yahoo contests, P1 is set to the published winning prize or, when necessary, to a nearby nice number. The maximum number of buckets r is set to match the number of buckets used in the published payout structure. For fantasy sports, E is set to the nearest nice number above 1.5 times the entry fee. For all other contests (which often lack entry fees or have a complex qualification structure) E is set to the nearest nice number above the published minimum prize. Quantitative Comparison. Our results can be evaluated by computing the Euclidean distance between our ideal pay out curve, {π1, . . . , πn}, and the bucketed curve {Π1, . . . Πm}. In heuristic solutions, if m does not equal n, we extend the curves with zeros to compute the distance (which penalizes extra or missing winners). Our experimental data is included in Table 1. Entries of "–" indicate that the integer program did not run to completion, possibly because no solution to Problem 4.1 exists. The cost presented is the sum of squared distances from the bucketed payouts to ideal power law payouts, as defined in Problem 3.1. Note that we do not provide a cost for the source payouts since, besides the Yahoo contests, these structures were not designed to fit our proposed ideal payout curve and thus cannot be expected to achieve small objective function values. Table 1: Accuracy and Runtime (in milliseconds) for Integer Program (IP) vs. Heuristic (Heur.) Source Prize Pool Top Prize Min. Prize # of # of Winners Buckets Yahoo Yahoo DraftKings Yahoo Yahoo FanDuel FanDuel DraftKings Yahoo DraftKings FanDuel FanDuel Bassmaster Bassmaster FLW Fishing FLW Fishing FanDuel DraftKings Bassmaster FanDuel PGA Golf PGA Golf DraftKings Poker Stars WSOP 90 180 500 2250 3000 4000 4000 5000 10000 10000 18000 100000 190700 190000† 751588 751500† 1000000 1000000 1031500 5000000 9715981 1000000† 10000000 10393400 60348000 25 55 100 650 300 900 800 1250 1000 1500 4000 10000 50000 50000 100000 100000 100000 100000 30000 1000000 1800000 1800000 2000000 1750000 8000000 2 3 8 150 2 50 75 150 7 75 150 2 2000 2000 9000 9000 15 5 10000 40 20000 20000 25 15000 15000 30 30 20 7 850 40 16 11 550 42 38 23000 40 40 60 60 16000 85000 55 46000 69 75 125000 160 1000 7 10 10 7 25 12 7 8 25 12 10 25 15 15 25 25 25 40 25 30 69 75 40 25 30 IP Cost .89 2.82 6.15 32.4 – 20.7 46.6 52.5 – 61.3 161.8 – – IP Time (ms) 7.6k 725k 2.1k 4.0k – 3716k 2.9k 6.8k – 1291k 131k – – 2.5k 3462k – – – – – – – – – – – – – – – – – – – – – – Heur. Cost 2.35 3.44 9.21 187.4 86.9 58.2 230.1 123.5 97.3 173.7 347.0 3.1k 3.5k* 2.8k 6.0k* 6.0k 5.3k 25.9k 13.5k* 44.3k 254.5k* 215.9k* 78.7k 133.0k* 462.3k* Heur. Time (ms) Heur. Extra Winners 1 1 1 1 7 2 1 1 8 2 5 152 3 1 3 2 203 1.2k 14 1.0k 24 23 1.7k 27 17 0 0 0 0 2 1 4 0 1 0 0 34 0 0 0 0 7 0 0 0 0 9 0 0 0 †Contest is identical to the contest in the preceding row, but with the prize pool rounded to a nearby number in an effort to force a solution involving only nice numbers to exist. *Heuristic produced solution with nice number constraint violation for a single bucket. As expected, when it succeeds in finding a solution, the integer program consistently outperforms the heuristic. However, the difference is rarely large, with heuristic cost typically below 5x that of the IP. Furthermore, the heuristic runs in less than 1.5 seconds for even the most challenging contests. Its ability to generate payouts when no solution to Problem 4.1 exists is also a substantial advantage: it always returns a solution, but potentially with a minor constraint violation. In our experiments, any such heuristic violation was a Nice Number Constraint Violations. violation, with no Bucket Size Monotonicity violations observed. 6 of the 7 Nice Number violations 8 are unavoidable given the input minimum prize and prize pool. For example, the Fishing League Worldwide (FLW) fishing tournament has a prize pool of $751,588 and a minimum prize of $9,000. Since all nice numbers greater than or equal to $9000 are multiples of $5000, it is impossible to construct a fully satisfiable set of payouts summing to $751,588. In all cases besides one (the PGA tournament with prize pool $9,715,981) simply rounding the prize pool to a nearby number produced an input for which the heuristic output a solution with no constraint violations. However, in settings where the prize pool must be a non-nice number (i.e., cannot be rounded up or down, for whatever reason), our heuristic's flexibility is an advantage over the more rigid integer program. 4000 3500 3000 2500 i t u o y a p 2000 1500 1000 500 FanDuel Heuristic Integer Program Ideal Payouts 800 600 400 200 i t u o y a p FanDuel Heuristic Integer Program Ideal Payouts 120 100 80 60 40 20 i t u o y a p DraftKings Heuristic Integer Program Ideal Payouts 0 0 10 20 winneri 30 40 0 0 10 20 winneri 30 40 0 0 5 10 winneri 15 20 (a) FanDuel, Baseball (b) FanDuel, Baseball (c) DraftKings, Baseball Figure 4: Payout structures for small daily fantasy contests Qualitative Comparison. Beyond quantitative measures to compare algorithms for Problem 3.1, evaluating our two stage framework as a whole requires a more qualitative approach. Accordingly, we include plots comparing our generated payout structures to existing published structures. For small fantasy sports contests (Figure 4) both of our algorithms match payouts from FanDuel and DraftKings extremely well, often overlapping for large sections of the discretized payout curve. To our knowledge, FanDuel and DraftKings have not publicly discussed their methods for computing payouts; their methods may involve considerable manual intervention, so matching these structures algorithmically is encouraging. In some cases, notably in Figures 4c and 4b, our payout curve is "flatter", meaning there is a smaller separation between the top prizes and lower prizes. Many poker and fantasy sports players prefer flatter structures due to reduced payout variance [1, 14]. ×104 10 i t u o y a p 8 6 4 2 FanDuel Heuristic Ideal Payouts ×106 2 i t u o y a p 1.5 1 0.5 DraftKings Heuristic Ideal Payouts 0 100 101 102 winneri 103 104 0 100 101 102 103 winneri 104 105 (a) FanDuel, Football (b) DraftKings, Football Figure 5: Payout structures for large daily fantasy contests We compare larger fantasy contest payouts in Figure 5, plotting the x axis on a log scale due to a huge number of winning places (16,000 and 125,000 for 5a and 5b respectively). Again our results are very similar to those of FanDuel and DraftKings. We also show that our algorithms can easily construct high quality payout structures for non- fantasy tournaments, avoiding the difficulties discussed in Section 2.1. Returning to the Bassmaster example from Figure 1, we show more satisfying structures generated by our IP and heuristic algorithm in Figure 6. For the IP, we rounded the prize pool to $190,000 from $190,700 to ensure a solution to Problem 4.1 exists. However, even for the original prize pool, our heuristic solution has just one non-nice number payout of $2,700 and no other constraint violations. Both solutions avoid the issue of non-monotonic bucket sizes exhibited by the published Bassmaster payout structure. 9 105 104 ) i t u o y a p ( 0 1 g o l Bassmaster Integer Program Heurisitc 103 0 5 10 15 25 30 35 40 20 winneri Figure 6: Alternative Bassmaster Open 2015 payouts We conclude with an example from the popular World Series of Poker (WSOP). The 2015 Main Event payed out $60,348,000 to 1000 winners in 31 buckets with far from "nice number" prizes [24]. However, several months prior to the tournament, organizers published a very different tentative payout structure [19], that appears to have attempted to satisfy many of the constraints of Problem 3.1: it uses mostly nice number prizes and nearly satisfies our Bucket Size Monotonicity constraint. This tentative structure (visualized in Figure 7) suggests that WSOP organizers originally sought a better solution than the payout structure actually used. Perhaps the effort was abandoned due to time constraints: the WSOP prize pool is not finalized until just before the event. We show in Table 2 that our heuristic can rapidly (in 17 milliseconds) generate an aesthetically pleasing payout structure for the final prize pool with the initially planned top prize of $8 million, and just one minor nice number violation (our final bucket pays $20,150). Our output and the actual WSOP payout structure are also compared visually in Figure 7 to the power curve used in the first stage of our algorithm. In keeping with the WSOP tradition of paying out separate prizes to places 1-9 (the players who make it to the famous "November Nine" final table) we run our heuristic with 9 guaranteed singleton buckets instead of 4 (see Section 5 for details). WSOP Tentative 2015 WSOP Payouts Our Alternative Payouts $8,000,000 $4,663,527 $3,500,000 $2,750,000 $2,000,000 $1,500,000 $1,250,000 $1,100,000 $1,000,000 $550,000 $142,500 $50,000 107 106 105 i t u o y a p 104 0 107 i t u o y a p 106 105 $20,850 $16,750 $15,000 200 400 winner i 600 800 1000 WSOP Payouts Heuristic Initial Power Law Place 1 2 3 4 5 6 7 8 9 10 11 - 12 13 - 15 16 - 18 19 - 27 28 - 36 36 - 45 46 - 54 55 - 63 64 - 72 73 - 81 82 - 90 91 - 99 100 - 162 163 - 225 226 - 288 289 - 351 352 - 414 415 - 477 478 - 549 550 - 648 649 - 1000 Prize $7,680,021 $4,469,171 $3,397,103 $2,614,558 $1,910,971 $1,426,072 $1,203,193 $1,097,009 $1,001,020 $756,897 $526,778 $411,453 $325,034 $262,574 $211,821 $164,086 $137,300 $113,764 $96,445 $79,668 $68,624 $55,649 $46,890 $40,433 $34,157 $29,329 $24,622 $21,786 $19,500 $17,282 $15,000 Place 1 2 3 4 5 6 7 8 9 Prize $8,000,000 $4,000,000 $2,250,000 $1,750,000 $1,250,000 $1,000,000 $950,000 $850,000 $700,000 10 - 13 $650,000 14 - 17 18 - 23 24 - 29 30 - 35 36 - 42 43 - 59 60 - 77 78 - 99 100 - 128 128 - 164 165 - 254 255 - 345 $500,000 $300,000 $225,000 $200,000 $150,000 $125,000 $95,000 $75,000 $60,000 $55,000 $45,000 $35,000 346 - 441 $25,000 442 - 710 $22,500 711 - 1000 $20,150 104 0 200 400 600 800 1000 winner i Figure 7: WSOP 2015 tentative prizes and our alternative "nice" payout structure. Table 2: Our alternative payouts vs. WSOP payouts. actual 10 References [1] Andres Alvarez. The perfect payout structure for GPPs. https://rotogrinders.com/articles/the-perfect-payout-structure-for-gpps-544688, 2015. Accessed: 2015-10-01. [2] Jon Bales. FanDuel the basics of how to win on FanDuel. https://rotogrinders.com/articles/fanduel-strategy-239679, 2015. Accessed: 2015- 10-01. strategy guide - [3] B.A.S.S. LLC. Bassmaster Opens. http://www.bassmaster.com/open, 2015. Accessed: 2015- 08-20. [4] Aaron Clauset, Cosma Rohilla Shalizi, and Mark EJ Newman. Power-law distributions in empirical data. SIAM Review, 51(4):661–703, 2009. [5] Aaron Clauset and Yogesh Virkar. Power-law distributions in empirical data, MATLAB code. http://tuvalu.santafe.edu/~aaronc/powerlaws/, 2012. [6] Michael Cohen. Bankroll tips for GPP players, 2015. Accessed: 2015-10-01. [7] Eilers Research. Daily fantasy sports: The future of US sports wagering?, 2014. Summary available at: https://dfsreport.com/1697/eilers-research-daily-fantasy-sports/. [8] Mike Fahey. How a first year eSports championship got a $2 million prize pool. http://kotaku.com/how-a-first-year-esports-championship-got-a-2-million-1673580974, 2014. Accessed: 2015-10-13. [9] Fantasy Sports Trade Association. Industry demographics. http://www.fsta.org/?page=Demographics, 2015. Accessed: 2015-08-07. [10] Derek Farnsworth. DFS NFL primer. http://www.scout.com/fantasy/story/1585583-dfs-nfl-primer, 2015. Accessed: 2015-10-01. [11] GNU project. GNU Linear Programming Kit, Version 4.44, 2010. [12] Bill Grinstead. FanDuel collected $600 million more in entry fees than DraftKings in 2015. http://dailyfantasynews.com/fanduel-collected-600-million-more-in-entry-fees-than-draftking 2016. Accessed: 2016-8-4. [13] Sudipto Guha, Nick Koudas, and Kyuseok Shim. Approximation and streaming algorithms for histogram construction problems. ACM Trans. Database Syst., 31(1):396–438, March 2006. [14] Huitcinq. DraftKings again nails a perfect payout structure. https://rotogrinders.com/threads/draftkings-again-nails-a-perfect-payout-structure-in-a-2- 2015. Accessed: 2015-10-01. [15] Yannis Ioannidis. The history of histograms (abridged). In Proceedings of the 29th Interna- tional Conference on Very Large Data Bases - Volume 29, VLDB '03, pages 19–30. VLDB Endowment, 2003. [16] Yannis E. Ioannidis and Viswanath Poosala. Balancing histogram optimality and practicality for query result size estimation. In Proceedings of the 1995 ACM SIGMOD International Conference on Management of Data, SIGMOD '95, pages 233–244, New York, NY, USA, 1995. ACM. 11 [17] H. V. Jagadish, Nick Koudas, S. Muthukrishnan, Viswanath Poosala, Kenneth C. Sevcik, and Torsten Suel. Optimal histograms with quality guarantees. In Proceedings of the 24rd International Conference on Very Large Data Bases, VLDB '98, pages 275–286, San Francisco, CA, USA, 1998. Morgan Kaufmann Publishers Inc. [18] Stephen A. Murphy. WSOP director says 2009 payout structure the best yet. http://www.cardplayer.com/poker-news/6741-dream-payout-world-series-of-poker-director-says- 2009. Accessed: 2015-09-25. [19] Seth Palansky. WSOP announces 2015 main event payout change. http://www.wsop.com/news/2015/Feb/5172/WSOP-Announces-2015-Main-Event-Payout-Change.html, 2015. Accessed: 2015-08-10. [20] Hannes Planatscher and Michael Schober. SCPSolver - an easy to use Java Linear Programming Interface. http://scpsolver.org/, 2013. [21] Mark Sandritter. U.S. Open payout 2015: Winning share is $1.8 million of purse. http://www.sbnation.com/golf/2015/6/21/8821291/us-open-2015-payout-purse-prize-money, 2015. Accessed: 2015-08-20. [22] Yogesh Virkar and Aaron Clauset. Power-law distributions in binned empirical data. The Annals of Applied Statistics, 8(1):89–119, 2014. [23] Washington and Lee News. Schwartz designs payout system for world series of poker. http://www2.wlu.edu/x33248.xml, 2009. Accessed: 2015-09-25. [24] World Series of Poker. Tournament payouts. http://www.wsop.com/tournaments/payouts.asp, 2015. Accessed: 2015-09-02. 12 A Dynamic Programming Details Theorem 3.2 (Dynamic Programming Solution). Assuming that there are O(log B) nice numbers in the range [E, B], then Problem 3.1 can be solved in pseudo-polynomial time O(rN 3B log2 B). Proof. We can construct a dynamic program that chooses buckets and prizes in order from the low- est awarded places to the winner: (Sr, Πr), (Sr−1, Πr−1), . . . (S1, Π1). Suppose you have already se- (πi − (πi − Πj)2, the task of choosing the optimal (Si, Πi), lected (Sr, Πr), . . . , (Si+1, Πi+1). Since our objective function can be separated asPr Πj)2 =Pi . . . , (S1, Π1) then reduces to solving a smaller instance of Problem 3.1, with: j=1Pi∈Sj j=1Pi∈Sj (πi − Πj)2 +Pr j=i+1Pi∈Sj 1. N = the number of winners remaining, i.e. those not placed in (Sr, Πr), . . . , (Si+1, Πi+1). 2. B = the prize budget remaining, i.e. whatever was not consumed by (Sr, Πr), . . . , (Si+1, Πi+1). 3. E = the smallest nice number greater than maximum prize given so far, Πi+1. 4. An additional constraint on maximum bucket size, which must be less than Si+1. Thus, for a given tuple of (winners consumed, budget consumed, Πi+1, Si+1), our choice for (Si, Πi), . . . , (S1, Π1) can ignore any other aspects of (Sr, Πr), . . . , (Si+1, Πi+1). Accordingly, it suffices to store the optimal assignment to (Sr, Πr), . . . , (Si+1, Πi+1) for each such 4-tuple. There are at worst N × B × O(log B) × N = O(N 2B log B) tuples. Now, given all assignments for (Sr, Πr), . . . , (Si+1, Πi+1) that are optimal for some tuple, one simple way to generate the set of optimal assignments for (Sr, Πr), . . . , (Si, Πi) is to try adding every possible (Si, Πi) (there are ≤ N log B of them) to each optimal assignment. For each new assignment generated, we check if it has lower cost than the current best assignment to (Sr, Πr), . . . , (Si, Πi) for the tuple induced by the choice of (Si, Πi) (or just store it if no other assignment has induced the tuple before). In total this update procedure takes time O(N log B) × O(N 2B log B) time. It must be repeated r times, once for each bucket added. Our total runtime is thus O(rN 3B log2 B). The dynamic program solution requires O(rN 2B log B) space to store the optimal assignment for each tuple at the current iteration. B Integer Programming Details Theorem B.1. thm:integer[Integer Programming Solution] Any solution satisfying the constraints of integer programming Problem 4.1 gives a solution to Problem 3.1. Proof. Given a solution to Problem 4.1, a solution to Problem 3.1 is obtained by first checking each auxiliary variable. If xj,k = 1, then Πj is set to pk. The second consistency constraint ensures that for a given j, xj,k can equal 1 for at most one value of k. Thus, each Πj is assigned at most once. If no xj,k is equal to 1 for a given j, then Πj and accordingly Sj, remain unused in our solution. The winners for bucket Sj are simply all values of i for which xi,j,k is equal to 1. Our first consistency constraint ensures that for a given i, xi,j,k is 1 exactly once, meaning that each winner is assigned to a single bucket. The third consistency constraint ensures that xi,j,k = 1 only when xj,k = 1, which ensures that each winner in bucket Sj is assigned the correct payout, Πj = pk. Accordingly, any solution to Problem 4.1 produces a valid payout structure. We just need to prove that it conforms to the constraints of our original optimization problem. Recalling that, for a given i, xi,j,k = 1 for exactly one pair (j, k), it is straight forward to see that the objective function and prize pool constraint are equivalent those from Problem 3.1 as long. The bucket size monotonicity constraint is also simple to verify: Pi∈[N ],k∈[m] xi,j,k is exactly equal to the number of winners assigned to bucket j, Sj. So our constraint correctly verifies that Sj ≤ Sj+1 for all j. 13 For the monotonicity requirement, notice thatPk∈[m](k + 1 Πj = pk in our solution. Similarly Pk∈[m] k · xj+1,k equals k when Πj+1 = pk. Since lower values 2 ) · xj,k simply equals k + 1 of k correspond to higher prize payouts (recall that p1 > p2 > . . . pk), the first constraint in our integer program therefore ensures that Πj is strictly greater than Πj+1. There are a number of ways to enforce the "strictly" requirement besides adding the 1 2 where we did. However, this particular approach gracefully allows the constraint to be satisfied when no prize is assigned to bucket Sj (i.e. 2 ) · xj,k will equal zero since xj,k will equal 0 for all k. We would run into an issue if say, bucket Sj is not used but bucket Sj−1 is. Accordingly, any solution to Problem 4.1 not using r buckets must leave the lowest number sets empty, in accordance with the convention from Problem 3.1. the bucket is not used in our solution. In that case Pk∈[m](k + 1 2 whenever Finally, note that we did not include any inequalities to ensure that each bucket contains a contiguous range of winners – for examples winners 6 through 11 or 54 through 75. We can avoid this costly constraint because it is implicitly enforced by our choice of objective function and the monotonicity of ideal payouts. Suppose some bucket contains a non-contiguous set of winners. Then for at least two winning positions i > j it must be that the prize given to winner i, plow, is less than the prize given to winner j, phigh. At the same time, we know that for our ideal payouts, πi ≥ πj. We argue that such a configuration cannot exist in an optimal solution to Problem 4.1 because switching the prizes so that i receives phigh and j receives plow gives a strictly better solution. First off, clearly switching the prizes will not effect our other constraints: total payout amount and bucket sizes will remain unchanged. Now, our cost function is simply additive over each winner, and the cost incurred by players i and j in the non-contiguous ordering is: (πi − plow)2+(πj − phigh)2 = π2 i − 2πiplow + p2 low + π2 j − 2πjphigh + p2 high. When the prizes are switched, the cost is: (πi − phigh)2+(πj − plow)2 = π2 i − 2πiphigh + p2 high + π2 j − 2πjplow + p2 low. The difference in cost after the switch is therefore equal to: −2πiphigh−2πjplow − (−2πiplow − 2πjphigh) = −2 (πiphigh − πiplow + πjplow − πjphigh) = −2(πi − πj)(phigh − plow) ≤ 0. The last step follows from the fact that (πi − πj) ≥ 0 and (phigh − plow) > 0. Since switching payouts reduces our cost, it follows that any solution without contiguous bucket members cannot be optimal. Note that, even with monotonic ideal payouts, this would not have been the case if we had used, for example, ℓ1 cost Pi∈[N ],j∈[r],k∈[m] xi,j,k · πi − pk. With this last implicit constraint verified, we conclude the proof that Problem 4.1 can be used to obtain a valid payout structure obeying all of the constraints of our original Problem 3.1. 14
1902.01727
1
1902
2019-02-05T15:00:23
Discovering bursts revisited: guaranteed optimization of the model parameters
[ "cs.DS" ]
One of the classic data mining tasks is to discover bursts, time intervals, where events occur at abnormally high rate. In this paper we revisit Kleinberg's seminal work, where bursts are discovered by using exponential distribution with a varying rate parameter: the regions where it is more advantageous to set the rate higher are deemed bursty. The model depends on two parameters, the initial rate and the change rate. The initial rate, that is, the rate that is used when there are no burstiness was set to the average rate over the whole sequence. The change rate is provided by the user. We argue that these choices are suboptimal: it leads to worse likelihood, and may lead to missing some existing bursts. We propose an alternative problem setting, where the model parameters are selected by optimizing the likelihood of the model. While this tweak is trivial from the problem definition point of view, this changes the optimization problem greatly. To solve the problem in practice, we propose efficient ($1 + \epsilon$) approximation schemes. Finally, we demonstrate empirically that with this setting we are able to discover bursts that would have otherwise be undetected.
cs.DS
cs
Discovering bursts revisited: guaranteed optimization of the model parameters HIIT, Aalto University, Finland, [email protected] Nikolaj Tatti 9 1 0 2 b e F 5 ] S D . s c [ 1 v 7 2 7 1 0 . 2 0 9 1 : v i X r a Abstract One of the classic data mining tasks is to discover bursts, time intervals, where events occur at abnormally high rate. In this paper we revisit Kleinberg's seminal work, where bursts are discovered by using exponential distribution with a varying rate parameter: the regions where it is more advantageous to set the rate higher are deemed bursty. The model depends on two parameters, the initial rate and the change rate. The initial rate, that is, the rate that is used when there are no burstiness was set to the average rate over the whole sequence. The change rate is provided by the user. it leads to worse likelihood, and may lead to missing some existing bursts. We propose an alternative problem setting, where the model parameters are selected by optimizing the like- lihood of the model. While this tweak is trivial from the problem definition point of view, this changes the optimiza- tion problem greatly. To solve the problem in practice, we propose efficient (1 + ) approximation schemes. Finally, we demonstrate empirically that with this setting we are able to discover bursts that would have otherwise be undetected. We argue that these choices are suboptimal: 1 Introduction Many natural phenomena occur unevenly over time, and one of the classic data mining tasks is to discover bursts, time intervals, where events occur at abnormally high rate. In this paper we revisit a seminal work by Klein- berg [13] that has been used, for example, in discov- ering trends in citation literature [3], analyzing top- ics [17], recommending citations [10], analyzing disas- ters [4], and analyzing social networks [1] and blogs [15]. Kleinberg [13] discovers bursts by modelling the time between events with an exponential model with varying rate parameter. The rate starts at the base level β and can be raised (multiple times) by a change parameter α, but it cannot descend β. Every time we raise the parameter, we need to pay a penalty. In the original approach, the change rate α is given as a parameter and the base rate is selected to be β = 1/µ, where µ is the average of the sequence. We argue that this choice of β is suboptimal: (i ) it does not maximize the likelihood of the model, and, more importantly, (ii ) a more optimized β may reveal bursts that would have gone undetected. We propose a variant of the original burstiness prob- lem, where we are no longer given the base parameter β but instead we are asked to optimize it along with discovering bursts. We also consider variants where we optimize α as well. These tweaks are rather mundane from the problem definition point of view but it leads to a surprisingly difficult optimization problem. We consider two different models for the delays: ex- ponential and geometric. First, we will show that we can solve our problem for exponential model in polynomial time, when α is given. Unfortunately, this algorithm requires O(cid:0)n3k4(cid:1) time,1 thus being impractical. Even worse, we cannot apply the same approach for geometric model. This is a stark contrast to the original approach, where the computational complexity is O(nk). Fortunately, we can estimate burst discovery in quasi-linear time w.r.t. the sequence length; see Table 1 for a summary of the algorithms. We obtain (1 + ) approximation guarantee for the geometric model. We also obtain, under some mild conditions, (1 + ) approximation guarantee for the exponential model. In all four cases, the algorithm is simple: we test multiple values of β (and α), and use the same efficient dynamic program that is used to solve the original problem. Among the tested sequences we select the best one. The main technical challenge is to test the multiple values of α and β such that we obtain the needed guarantee while still maintaining a quasi-linear running time with respect to sequence length. The remainder of the paper is as follows. We review the original burstiness problem in Section 2, and define our variant in Section 3. We introduce the exact algorithm in Section 4, and present the approximation algorithms in Section 5 -- 6. In Section 7, we present the related work. In Section 8, we compare demonstrate empirically that our approach discovers busts that may go unnoticed. We conclude with discussion in Section 9. The proofs are given in Appendix, available in the full version of this paper. 1 Here, n is the sequence length and k is the maximum number of times the rate can be increased. Table 1: Summary of algorithms discussed in this paper. Here k is the number of allowed levels, n is the length of the sequence, µ is the arithmetic mean, and g is the geometric mean, Ω is the maximum of the sequence, and ω is the minimum of the sequence. We assume that ω > 0. Exp(α, β) is the original problem considered by Kleinberg [13], and Geo(α, β) is a minor variation of the problem. The remaining results are the main contribution of this paper. Problem Exp(α, β) Exp(α) Exp(α) Exp running time O(nk) guarantee exact exact SOL − n log g ≤ (1 + )(OPT − n log g) SOL − n log g ≤ (1 + )(OPT − n log g) exact SOL ≤ (1 + )OPT SOL ≤ (1 + )OPT O(cid:0)n3k4(cid:1) O(cid:0)−1nk2 log α(cid:1) O(cid:0)−2nk3 log2(Ω/ω)(cid:1) O(cid:0)−1nk log log n(cid:1) O(cid:0)−2nk log(nµk/) log log n(cid:1) O(nk) Geo(α, β) Geo(α) Geo 2 Preliminaries In this section, we review the setting proposed by Klein- berg [13], as well as the dynamic program used to solve this setting. Assume that we observe an event at different time points, say t0, . . . , tn. The main idea behind discovering bursts is to model the delays between the events, si = if the events occur at higher pace, then we ti − ti−1: expect si to be relatively small. Assume that we are given a sequence of delays S = s1, . . . , sn. In order to measure the burstiness of the sequence, we will model it with an exponential distribution, pexp(s; λ) = λ exp(−λs). Larger λ dictates that the delays should be shorter, that is, the events should occur at faster pace. The idea behind modelling burstiness is to allow the parameter λ fluctuate to a certain degree: We start with λ = β, where β is a parameter. At any point we can increase the parameter by multiplying with another parameter α. We can also decrease the parameter by dividing by α. We can have multiple increases and decreases, however, we cannot decrease the parameter below β. Every time we change the rate from x to y, we have to pay a penalty, τ (x, y; γ), controlled by a parameter γ. More formally, assume that we have assigned the burstiness levels for each delays L = (cid:96)1, . . . , (cid:96)n, where each (cid:96)i is a non-negative integer. We will refer to this sequence as the level sequence. For convenience, let us write (cid:96)0 = 0. Then the score of burstiness qexp(L, S; α, β, γ) is equal to n(cid:88) i=1 (cid:0)si; βα(cid:96)i(cid:1) + τ ((cid:96)i−1, (cid:96)i; γ) . − log pexp quence, while the second term penalizes the erratic be- havior in L. Ideally, we wish to have both terms as small as possible. To reduce clutter we will often ignore γ in notation, as this parameter is given, and is kept constant. We will use the penalty function given in [13], τ (x, y) = max(y − x, 0)γ log n, where n is the length of the input sequence. Note that τ depends on γ and n but we have suppressed this from the notation to avoid clutter. We can now state the burstiness problem. Problem 2.1 (Exp(α, β)). Given a delay sequence S, parameters α, β, γ, and a maximum number of levels k, find a level sequence L = (cid:96)1, . . . , (cid:96)n, where (cid:96)i is an integer 0 ≤ (cid:96)i ≤ k, minimizing qexp(L, S; α, β, γ). Two remarks are in order: First of all, the origi- nal problem definition given by Kleinberg [13] does not directly use k, instead the levels are only limited im- plicitly due to τ . However, in practice, k is needed by the dynamic program, but it is possible to select a large enough k such that enforcing k does not change the op- timal sequence [13]. Since our complexity analysis will use k, we made this constraint explicit. Secondly, the parameter β is typically set to 1/µ, where µ = 1 n is the average delay. (cid:80) si We also study an altenative objective. Exponen- tial distribution is meant primarily for real-valued de- lays. If the delays are integers, then the natural coun- terpart of the distribution is the geometric distribution pgeo(s; λ) = (1 − λ)λs. Here, low values of λ dictate that the delays should occur faster. We can now define The first term -- negative log-likelihood of the data -- measures how well the burstiness model fits the se- qgeo(L, S; α, β, γ) = − log pgeo(si; βα(cid:96)i)+τ ((cid:96)i−1, (cid:96)i) . n(cid:88) i=1 Note that in qexp we use α > 1 while here we use α < 1. We can now define a similar optimization problem. Problem 2.2 (Geo(α, β)). Given an integer delay se- quence S, parameters α, β, γ, and a maximum number of levels k, find a level sequence L = (cid:96)1, . . . , (cid:96)n, where (cid:96)i is an integer 0 ≤ (cid:96)i ≤ k, minimizing qgeo(L, S; α, β, γ). We can solve Problem 2.1 or Problem 2.2 using the standard dynamic programming algorithm by Viterbi [18]. Off-the-shelf version of this algorithm requires algorithm to O(nk); for completeness we present this speed-up in Appendix A. O(cid:0)nk2(cid:1) time. However, we can easily speed-up the 3 Problem definition We are now ready to state our problem. The difference between our setting and Problem 2.1 is that here we are asked to optimize β, and possibly α, along with the levels, while in the original setting β was given as a parameter. We consider two problem variants. In the first variant, we optimize β while we are given α. Problem 3.1 (Exp(α)). Given a delay sequence S, parameters α, γ, and a maximum number of levels k, find a level sequence L = (cid:96)1, . . . , (cid:96)n, where (cid:96)i is an integer 0 ≤ (cid:96)i ≤ k, and a parameter β, minimizing qexp(L, S; α, β, γ). In the second variant, we optimize both α and β. Problem 3.2 (Exp). Given a delay sequence S, a parameter γ, and a maximum number of levels k, find a level sequence L = (cid:96)1, . . . , (cid:96)n, where (cid:96)i is an integer 0 ≤ (cid:96)i ≤ k, and parameters α and β, minimizing qexp(L, S; α, β, γ). While this modification is trivial and mundane from the problem definition point of view, it carries several crucial consequences. First of all, optimizing β may discover bursts that would otherwise be undetected. Example 3.1. Consider a sequence given in Figure 1, which shows a sequence of 500 delays. The burst between 100 and 400 is generated using exponential model with λ = 1/2, the remaining delays are generated using λ = 1. We applied Viterbi with β−1 equal to the average of the sequence, the value used by Kleinberg [13], and compare it to β = 1/2, which is the correct ground level of the generative model. The remaining parameters were set to α = 2, γ = 1, and k = 1. We see that in the latter case we discover a burst that is much closer to the ground truth. Our second remark is that if α and β are given, one can easily discover the optimal bursts using Viterbi . Figure 1: A toy data set S with a burst between 100 and 400. Low values indicate short delays, bursts. The indicated regions are (i ) the ground truth, (ii ) bursts discovered with β = 1/µ, where µ is the average delay, and (iii ) bursts discovered with β set to the exact value of the generative model. Figure 2: Score pexp(S, L∗; α, β, k) as a function of β, where α = 2, k = 4, and L∗ is the optimal level sequence for the given parameters. Low values are better. The optimization becomes non-trivial when we need to optimize α and β as well. To make matters worse, the score as a function of β is non-convex, as demonstrated in Figure 2. Hence, we can easily get stuck in local minima. Next, we introduce discrete variants of Exp(α) and Exp. Problem 3.3 (Geo(α)). Given an integer delay se- quence S, parameters α, γ, and a maximum number of levels k, find a level sequence L = (cid:96)1, . . . , (cid:96)n, where (cid:96)i is an integer 0 ≤ (cid:96)i ≤ k, and a parameter β, minimizing qgeo(L, S; α, β, γ). Problem 3.4 (Geo). Given an integer delay sequence S, a parameter α, and a maximum number of levels k, find a level sequence L = (cid:96)1, . . . , (cid:96)n, where (cid:96)i is an integer 0 ≤ (cid:96)i ≤ k, and parameters α and β, minimizing qgeo(L, S; α, β, γ). Despite being very similar problems, we need to analyze these problems individually. We will show that Exp(α) can be solved exactly in polynomial time, although, the algorithm is too slow for practice. This approach does not work for other problems but we will show that all four problems can be (1+)-approximated efficiently. 01002003004000510groundtruthβ=1/µβ=exact0.10.20.30.40.50.6700750800parameterβscore Before we continue, we need to address a patho- logical case when solving Exp: the problem of Exp is illdefined if the delay sequence S contains a zero. To see this, assume that si = 0. Then a level sequence (cid:96)i = 1, and (cid:96)j = 0, for j (cid:54)= i, with α = ∞ and β = 1 leads to a score of −∞. This is because pexp(si; βα) = ∞ and the remaining terms are finite. This is why we assume that whenever we deal with Exp, we have si > 0. If we have si = 0, then we can either set α manually by using Exp(α) or shift the delays by a small amount. 4 Exact algorithm for Exp(α) In this section we present an exact polynomial algorithm for solving Exp(α). Unfortunately, this algorithm is impractically slow for large sequences: the time complexity is O(cid:0)n3k4(cid:1) and the space complexity is O(cid:0)n3k3(cid:1). Thus, it only serves as a theoretical result. More practical algorithms are given in the next sections. In order to solve Exp we introduce a more compli- cated optimization problem. Problem 4.1 (BndBurst). Given a delay sequence S = s1, . . . , sn, a parameter α, budget parameters d and m, and a maximum number of levels k, find a level sequence L = (cid:96)1, . . . , (cid:96)n, with 0 ≤ li ≤ k, minimizing n(cid:88) (cid:88) αlisi max ((cid:96)i − (cid:96)i−1, 0) = d and (cid:88) (cid:96)i = m . such that i=1 i i We will show that this problem can be solved in polynomial time. But before, let us first show that Exp and BndBurst are intimately connected. See Appendix B for the proof. Proposition 4.1. Assume a delay sequence S, and parameters α and γ, and an upper bound for levels k. There are budget parameters d ≤ k(n+1)/2 and m ≤ kn for which the level sequence L solving BndBurst also solves Exp(α) along with n(cid:80) i siα(cid:96)i β = . We can solve BndBurst with a dynamic program. In order to do this, let us define a table o, where an entry o[i, j, a, b] is the optimal score of the first i symbols of the input sequence such that (cid:96)i = j, max ((cid:96)x − (cid:96)x−1, 0) = a, and (cid:96)x = b . i(cid:88) x=1 i(cid:88) x=1 o contains O(cid:0)n3k3(cid:1) entries. We can compute a single we can limit a ≤ k(n + 1)/2 and b ≤ kn. Consequently, entry with (4.1) o[i, j, a, b] = αjsi + min j(cid:48) o[i − 1, j(cid:48), a − max(0, j − j(cid:48)), b − j] . The computation of a single value thus requires O(k) time. So computing the whole table can be done in O(cid:0)n3k4(cid:1). Moreover, if we also store the optimal j(cid:48) as given in Equation 4.1, for each cell, we can recover the level sequence responsible for every o[i, j, a, b]. Proposition 4.1 now guarantees that we can solve Exp by comparing the level sequences responsible for o[n, j, a, b], where j = 0, . . . , k, a = 0, . . . , (k + 1)n/2, and b = 0, . . . , kn. 5 Approximating discrete burstiness In this section we will provide a (1 + )-approximation algorithms for Geo(α) and Geo. The time complexities are stated in Table 1. 5.1 Approximating Geo(α) Note that if we knew the optimal β, then Geo(α) reduces to Problem 2.2, which we can solve in O(nk) time by applying Viterbi . The idea behind our approximation is to test several val- ues of β, and select the best solution among the tested values. The trick is to select values densely enough so that we can obtain (1 + ) guarantee while keeping the number of tests low, namely O(cid:0)−1 log log n(cid:1). The pseudo-code of the algorithm is given in Algorithm 1. (cid:80) n i si; Algorithm 1: GeoAlpha(S, α, γ, k, ) 1 µ ← 1 2 if µ = 0 then return L = (0, . . . , 0) ; 3 η ← µ/(µ + 1); 4 c ← 1; 5 while ηc ≤ µ/(µ + 1/n) do β ← ηc; L ← Viterbi(S, α, β, γ, k, pgeo); c ← c/(1 + ); 6 7 8 9 return the best observed L; Next we state that the algorithm indeed yields an (1 + )-approximation ratio, and can be executed in O(cid:0)−1nk log log n(cid:1) time. The proofs are given in Appendix C -- D. In case, there is no level sequence satisfying the con- straints, we set o[i, j, a, b] = ∞. Due to Proposition 4.1, Proposition 5.1. Let S be an integer delay sequence, and let α, γ, and k be the parameters. Let L∗, β∗ be the solution to Geo(α). Assume  > 0. Let L, β be the solution returned by GeoAlpha(S, α, γ, k, ). Then qgeo(S, L; β) ≤ (1 + )qgeo(S, L∗; β∗) . GeoAlpha is O(cid:0)−1nk log log n(cid:1). Proposition 5.2. The computational complexity of 5.2 Approximating Geo We now turn to approxi- mating Geo. The approach here is similar to the pre- vious approach: we test multiple values of α and invoke GeoAlpha. The pseudo-code for the algorithm is given in Algorithm 2. (cid:80) i si; Algorithm 2: ApproxGeo(S, γ, k, ) 1 L ← GeoAlpha(S, 0, γ, k, ); 2 µ ← 1 3 η ← 1/(1 + nk); 4 σ ← µ/(µ + 1/n); 5 c ← 1; 6 while ηc ≤ σ/k do n α ← ηc; L ← GeoAlpha(S, α, γ, k, ); c ← c/(1 + ); 7 8 9 10 return the best observed L; Next we establish the correctness of the method as well as the running time. The proofs are given in Appendix E -- F. Proposition 5.3. Let L∗, α∗, β∗ be the solution to Geo. Assume  > 0. Let L, α, β be the solution returned by ApproxGeo(S, γ, k, ). Then qgeo(S, L; α, β) ≤ (1 + )qgeo(S, L∗; α∗, β∗) . Proposition 5.4. The computational complexity of ApproxGeo is O(cid:0)nk log log n(log n + log µ + log k − log )−2(cid:1) . 6 Approximating continuous burstiness In this section we will provide a (1 + )-approximation algorithms for Exp(α) and Exp. The time complexities are stated in Table 1. 6.1 Approximating Exp(α) In this section we in- troduce an approximation algorithm for Exp(α). The general approach of this algorithm is the same as in GeoAlpha: we test several values of β, solve the result- ing subproblem with Viterbi , and select the best one. The pseudo-code is given in Algorithm 3. Unlike with GeoAlpha, ExpAlpha does not yield an unconditional (1 + )-approximation guarantee. The (cid:80) Algorithm 3: ExpAlpha(S, α, γ, k, ) 1 µ ← 1 2 β ← 1/µ; 3 while β ≥ 1/(αkµ) do i si; n L ← Viterbi(S, α, β, γ, k, pexp); β ← β/(1 + ); 4 5 6 return the best observed L and β; key problem is that since exponential distribution is continuous, the term pexp(s; λ) may be larger than 1. Consequently, − log pexp(s; λ), as well as the actual score qexp, can be negative. However, if the delay sequence has a geometric mean larger or equal than 1, we can guarantee the approximation ratio. The proofs for the next two propositions are given in Appendix G -- H. . Proposition 6.1. Assume a delay sequence S, and parameters α and γ, and an upper bound for levels k. Let β∗ and L∗ be the solution to Exp(α(α)). Let i si]1/n be the geometric mean. Assume  > 0. g = [(cid:81) Let L, β be the solution returned by ExpAlpha. Then qexp(S, L; β)−n log g ≤ (1+)(qexp(S, L∗; β∗)−n log g) Moreover, if g ≥ 1, then qexp(S, L; β) ≤ (1 + )qexp(S, L∗; β∗) . Note that if the geometric mean g is less than 1, then we still have a guarantee, except now we need to shift the score by a (positive) constant of −n log g. Proposition 6.2. The computational complexity of ExpAlpha is O(cid:0)−1nk2 log α(cid:1). 6.2 Approximating Exp We now turn to approxi- mating Exp. The approach here is similar to the previ- ous approach: we test multiple values of α and invoke ExpAlpha. The pseudo-code for the algorithm is given in Algorithm 4. Algorithm 4: ApproxExp(S, γ, k, ) 1 α ← (max si)/(min si); √ 2 c ← 2k 3 while α ≥ 1 do 1 + ; L ← ExpAlpha(S, α, γ, k, /2); α ← α/c; 4 5 6 return the best observed L; Next we establish the correctness of the method as well as the running time. The proofs given in Appendix I -- J. and L∗ be the solution to Exp. Let g = [(cid:81) Proposition 6.3. Assume a delay sequence S, a pa- rameter γ, and an upper bound for levels k. Let α∗, β∗ i si]1/n be the geometric mean, and let ψ = n log g. Assume  > 0. Let L, α, β the solution returned by ApproxExp. Then qexp(S, L; α, β) − ψ ≤ (1 + )(qexp(S, L∗; α∗, β∗) − ψ) Moreover, if g ≥ 1, then . qexp(S, L; α, β) ≤ (1 + )qexp(S, L∗; α, β∗) . Proposition 6.4. Let Ω = max si and let ω = min si. The computational complexity of ApproxExp is O(cid:0)−2nk3 log2(Ω/ω)(cid:1). 6.3 Speeding up Exp(α) Our final step is to de- scribe how can we speed-up the computation of Exp(α) in practice. The following proposition allows us to ig- nore a significant amount of tests. Proposition 6.5. Assume a delay sequence S, and parameters α and γ. Let β be a parameter, and let L be the optimal solution for Exp(α, β). Define n(cid:80) i siα(cid:96)i . β(cid:48) = Let β∗ be the optimal parameter to Exp(α). Then either β∗ ≤ min(β, β(cid:48)) or β∗ ≥ max(β, β(cid:48)) . Proposition 6.5 allows us to ignore some tests: Let βi be the parameters tested by ExpAlpha, that is, βi = µ−1(1 + )−i. Assume that we test βi, and compute β(cid:48) as given in Proposition 6.5. If β(cid:48) > βi, we can safely ignore testing any βj such that βi < βj < β(cid:48). Similarly, if β(cid:48) < βi, we can safely ignore testing any βj such that β(cid:48) < βj < βi. The testing order of βi matters since we want to use both cases β(cid:48) < βi and β(cid:48) > βi efficiently. We propose the following order which worked well in our experimental evaluation: Let t be the number of different βi, and let m be the largest integer for which 2m ≤ t. Test the parameters in the order 0, 2m, 2m−1, 23(m−1), . . . , 1, 3, 5, 7, . . . , that is, we start with 0 and increment by 2m until we reach the end of the list. Then we decrease m by 1, and repeat. During the traverse, we ignore the parameters that were already tested, as well as the redundant parameters. Interestingly enough, this approach cannot be ap- plied directly to the discrete version of the problem. First of all, the technique for proving Proposition 6.5 cannot be applied directly to the score function for the geometric distribution. Secondly, there is no closed for- mula for computing the discrete analogue of β(cid:48) given in Proposition 6.5. 7 Related work Discovering bursts Modelling and discovering bursts is a very well-studied topic in data mining. We will highlight some existing techniques. We are modelling delays between events, but we can alternatively model event counts in some predetermined window: high count indicate burst. Ihler et al. [11] proposed modelling such a statistic with Poisson process, while Fung et al. [5] used Binomial distribution. If the events at hand are documents, we can model burstiness with time-sensitive topic models [12, 14, 20]. As an alternative methods to discover bursts, Zhu and Shasha [21] used wavelet analysis, Vlachos et al. [19] applied Fourier analysis, and He and Parker [9] adopted concepts from Mechanics. Lappas et al. [16] propose discovering maximal bursts with large discrepancy. Segmentation A sister problem of burstiness is a classic segmentation problem. Here instead of penaliz- ing transitions, we limit the number of segments to k. If the overall score is additive w.r.t. the segments, then this problem can be solved in O(cid:0)n2k(cid:1) time [2]. For cer- tain cases, this problem has a linear time solution [6]. Moreover, under some mild assumptions we can obtain a (1 + ) approximation in linear time [8]. Concept drift detection in data streams: A related problem setting to burstiness is concept drift detection. Here, a typical goal is to have an online al- gorithm that can perform update quickly and prefer- ably does not use significant amount of memory. For an overview of existing techniques see an excellent survey by Gama et al. [7]. The algorithms introduced in this paper along with the original approach are not strictly online because in every case we need to know the mean of the sequence. However, if the mean is known, then we can run Viterbi in online fashion, and, if we are only interested in the burstiness of a current symbol, we need to maintain only O(k) elements, per β. 8 Experimental evaluation In this section we present our experiments. As a baseline we use method by Kleinberg [13], that is, we derive the parameter β from µ, the mean of the sequence. For exponential model, β = µ−1; we refer to this model as ExpMean. For geometrical model, β = µ/(µ + 1); we refer to this approach as GeoMean. Throughout the experiments, we used  = 0.05 and γ = 1 for our algorithms. Experiments with synthetic data: We first focus on demonstrating when optimizing β is more advantageous than the baseline approach. For our first experiment we generated a sequence of 500 data points. We planted a single burst with a varying length 50 -- 250. The burst was generated with pexp(·; 1), while the remaining sequence was generated with pexp(·; 2). We computed bursts with ExpMean and ExpAlpha, the parameters were set to k = 1, α = 2. The obtained level sequence was evaluated by computing the hamming distance,(cid:80) i (cid:96)i − (cid:96)∗i , where (cid:96)∗i is the ground truth level sequence. We repeated each experiment 100 times. We see from the results given in Figure 3 that the bursts discovered by ExpAlpha are closer to the ground truth, on average, than the baseline. This is especially the case when burst becomes larger. The main reason for this is that short bursts do not affect significantly the average of the sequence, µ, so consequently, µ is close to the base activity level. As the burst increases, so does µ, which leads to underestimating of β. Figure 3: Hamming distance between the ground truth and the discovered level sequence as a function of the length of the planted burst. Low values are better. Figure 4: Hamming distance, normalized by the se- quence length, between the ground truth level sequence and the discovered level sequence as a function of the sequence length. Low values are better. Our next experiment is similar, expect now we vary the sequence length, n, (50 -- 500) and set the burst length to be n/3. We generated the sequence as before, and we use the same parameters. In Figure 4 we report, 1 n compared with the ground truth, normalized by n. Each experiment was repeated 300 times. (cid:80) i (cid:96)i − (cid:96)∗i , the number of disagreements of disagreement is same for both algorithm, around 0.2 -- 0.25. This is due that we do not have enough samples to override the transition penalty τ . Once the sequence becomes longer, we have more evidence of a burst, and here ExpAlpha starts to beat the baseline, due to a better model fit. Experiments with real-world data: We consid- ered two datasets: The first dataset, Crimes, consists of 17 033 crimes related to narcotics in Chicago between January and October, 2015. The second dataset, Mine, consists of 909 fatalities in U.S. mining industry dat- ing from 2000, January.2 This data is visualized in Fig- ure 6. In both datasets, each event has a time stamp: in Crimes we use minutes as granularity, whereas in Mine the time stamp is by the date. Using these time stamps, we created a delay sequence. We applied ApproxExp, ExpAlpha, and ExpMean to Crimes. We set k = 4, and for ExpAlpha and ExpMean we used α = 2. Since Crimes contains events with 0 delay, we added 1 minute to each delay to avoid the pathological case described in Section 3. The obtained bursts are presented in Figure 5. We also applied ApproxGeo, GeoAlpha, and GeoMean to Mine. Here we set α = 1/2 and k = 4, however the algorithm used only 3 levels. The obtained bursts are presented in Figure 7. In Mine, the results by GeoAlpha and GeoMean are the same. However, we noticed that the results differ if we use different α. The biggest difference between ApproxGeo and GeoAlpha is the last burst: GeoAlpha (and GeoMean) set the last burst to be on level 2, while ApproxGeo uses level 1. The reason for this is that ApproxGeo selects α to be very close to 0, that is, much smaller than 1/2, the parameter used by the other algoritms. This implies that when going one level up, the model expects the events to be much closer to each other. In Crimes, ApproxExp and ExpAlpha discover burstier structure than ExpMean. ExpAlpha uses 4 different levels. Interestingly enough, in this level se- quence, we spent most of the time at level 1, and we de- scended to level 0 for 3 short bursts. In other words, in addition to finding crime streaks, ExpAlpha also found three short periods when narcotics related crime rate was lower than usual. ApproxExp also spends most of its time on level 1 but often descends on level 0, while also highlighting one burst in early January. Number of Viterbi calls: Next, we study relative efficiency when compared Viterbi . Since all 4 approxi- mation schemes use Viterbi as a subroutine, a natural way of measuring the efficiency is to study the number of Viterbi calls. We report the number of calls as a We see that for the shortest sequences, the number 2Both datasets are available at http://data.gov/. 50100150200250020406080100ExpAlphaExpMeanlengthoftheimplantedbursthammingdistance5010015020025030035040045050000.050.10.150.20.25ExpAlphaExpMeansequencelengthnormalizedhamming Figure 5: Discovered bursts in Crimes dataset. Figure 6: The delay sequence Mine, as well as the discovered bursts. Figure 7: The delay sequence Mine, as well as the discovered bursts. Figure 8: Number of Viterbi calls as a function of . Both x and y-axis are logarithmic. We set k = 4, α = 0.5 for ExpAlpha, and α = 2 for ExpAlpha. Here, we did not use the speed-up version of ExpAlpha. function of  for datasets Mine and Crimes in Figure 8. Here, we did not use the speed-up version of ExpAlpha. We see that the behaviour depends heavily on the accuracy parameter : for example, if we use  = 0.5, then GeoAlpha uses 17 calls while ApproxGeo uses 561 calls; if we set  = 2−9, then GeoAlpha needs 3453 calls while ApproxGeo needs 32 810 406 calls. This implies that we should not use extremely small , especially if we also wish to optimize α. Nevertheless, the algorithms are fast when we use moderately small . Effect of a speed-up: Finally, we compare the effect of a speed-up for ExpAlpha described in Section 6. Here we used both datasets Mine and Crimes to which we apply ExpAlpha with k = 5 and α = 2. We vary  from 2−13 to 1/2 and compare the plain version vs. speed-up in Figure 9. We see in Figure 9 that the we gain significant speed-up as we decrease : At best, we improve by two orders of magnitude. 9 Concluding remarks In this paper we presented variants of [13] for discover- ing bursts: instead of deriving the base rate from µ, the average delay time between the events, we optimize this parameter along with the actual burst discovery. We showed that this leads to better burst discovery, espe- cially if the bursts are long. We also propose variants, where we optimize the change parameter α, instead of having it as a parameter. Despite being a minor tweak, the resulting opti- mization problems are significantly harder. To solve the problems, we introduce efficient algorithms yielding (1 + ) approximation guarantee. These methods are based on testing multiple values for the base rate, and selecting the burst sequence with the best score. Despite being similar problems, discrete and continuous versions of the problem required their own algorithms. In addi- tion, we were able significantly speed-up the exponential model variant by safely ignoring some candidate values OctSepAugJulJunMayAprMarFebJan123123412ApproxExpExpAlphaExpMeandate000102030405060708091011121314150204060year(from2000)daysw/ofatality0001020304050607080910111213141512123123ApproxExpExpAlphaExpMeanyear(from2000)2−02−12−22−32−42−52−62−72−82−925210215220225GeoAlphaApproxGeoparametertestsMine2−02−12−22−32−42−52−62−72−82−925210215220225ExpAlphaApproxExpparametertestsCrimes Inf. Process. Lett., 33(6):309 -- 311, 1990. [7] J. Gama, I. Zliobaite, A. Bifet, M. Pechenizkiy, and A. Bouchachia. A survey on concept drift adaptation. ACM Comput. Surv., 46(4):44:1 -- 44:37, 2014. [8] S. Guha, N. Koudas, and K. Shim. Approximation and streaming algorithms for histogram construc- tion problems. TODS, 31(1):396 -- 438, 2006. [9] D. He and D. S. Parker. Topic dynamics: An alternative model of bursts in streams of topics. In KDD, 2010. [10] Q. He, D. Kifer, J. Pei, P. Mitra, and C. L. Giles. Citation recommendation without author supervision. In WSDM, pages 755 -- 764, 2011. [11] A. Ihler, J. Hutchins, and P. Smyth. Adaptive event detection with time-varying poisson processes. In KDD, pages 207 -- 216, 2006. [12] N. Kawamae. Trend analysis model: Trend consists In of temporal words, topics, and timestamps. WSDM, pages 317 -- 326, 2011. [13] J. Kleinberg. Bursty and hierarchical structure in streams. DMKD, 7(4):373 -- 397, 2003. [14] A. Krause, J. Leskovec, and C. Guestrin. Data association for topic intensity tracking. In ICML, pages 497 -- 504, 2006. [15] R. Kumar, J. Novak, P. Raghavan, and A. Tomkins. On the bursty evolution of blogspace. In WWW, pages 568 -- 576, 2003. [16] T. Lappas, B. Arai, M. Platakis, D. Kotsakos, and D. Gunopulos. On burstiness-aware search for document sequences. In KDD, pages 477 -- 486, 2009. [17] K. K. Mane and K. Borner. Mapping topics and topic bursts in PNAS. PNAS, 101(suppl 1):5287 -- 5290, 2004. [18] A. Viterbi. Error bounds for convolutional codes and an asymptotically optimum decoding algo- rithm. IEEE IT, 13(2):260 -- 269, 1967. [19] M. Vlachos, C. Meek, Z. Vagena, and D. Gunopu- los. Identifying similarities, periodicities and bursts for online search queries. In SIGMOD, pages 131 -- 142, 2004. [20] X. Wang and A. McCallum. Topics over time: A non-markov continuous-time model of topical trends. In KDD, pages 424 -- 433, 2006. [21] Y. Zhu and D. Shasha. Efficient elastic burst detection in data streams. In KDD, pages 336 -- 345, 2003. Figure 9: Number of tests needed as a function of . Speed-up (see, Section 6) vs. vanilla version. for the base rate. The approximation algorithms are quasi-linear with respect to sequence length. However, especially when we optimize α, the algorithms depend also on the actual values of the sequence, see Table 1. A potential future work is to improve the algorithms, and develop polynomially strong approximation schemes. The other fruitful direction is to develop heuristics that allow us to ignore large parts of the parameters, similar to the speed-up we propose for the exponential model variant of the problem. References [1] L. Backstrom, D. Huttenlocher, J. Kleinberg, and X. Lan. Group formation in large social networks: Membership, growth, and evolution. In KDD, pages 44 -- 54, 2006. [2] R. Bellman. On the approximation of curves by line segments using dynamic programming. Com- munications of the ACM, 4(6), 1961. [3] C. Chen. Citespace II: Detecting and visualizing emerging trends and transient patterns in scientific literature. J. Am. Soc. Inf. Sci. Technol., 57(3): 359 -- 377, 2006. [4] R. Fontugne, K. Cho, Y. Won, and K. Fukuda. In SWID, Disasters seen through flickr cameras. 2011. [5] G. P. C. Fung, J. X. Yu, P. S. Yu, and H. Lu. Parameter free bursty events detection in text streams. In VLDB, pages 181 -- 192, 2005. [6] Z. Galil and K. Park. A linear-time algorithm for concave one-dimensional dynamic programming. 2−12−32−52−72−92−112−13012×10428394622parametertestsCrimesplainspeed-up2−12−32−52−72−92−112−13012×10428394312parametertestsMineplainspeed-up A Viterbi algorithm for solving Problem 2.1 or Problem 2.2 O(cid:0)nk2(cid:1) time. However, we can easily speed-up the We can solve Problem 2.1 or Problem 2.2 using the standard dynamic programming algorithm by Viterbi [18]. Off-the-shelf version of this algorithm requires algorithm to O(nk). To see this, let us first write o[i, j] to express the optimal score for the ith first symbols such that the last level (cid:96)i = j. The Viterbi algorithm uses the fact that o[i − 1, j(cid:48)] + τ (j(cid:48), j) o[i, j] = − log p(sj, βαj) + min j(cid:48) to solve the optimal sequence. Define two arrays o[i − 1, x] o[i − 1, x] + τ (x, j) = min j(cid:48)≥j o[i − 1, x] + τ (x, j) . a[j] = min x≥j b[j] = min x≤j and By definition, we have o[i, j] = − log p(sj, βαj)+ min j(cid:48)∈{a[j],b[j]} o[i−1, j(cid:48)]+τ (j(cid:48), j) , that is, we can compute o[i, j] in constant time as long as we have a[j] and b[j]. To compute a[j] fast, note that either a[j] = j or a[j] = a[j + 1], whichever produces better score. Similarly, due to linearity of τ , we have b[j] = j or b[j] = b[j − 1], whichever produces better score. This leads to a simple dynamic program given in Algorithm 5 that performs in O(nk) time. Algorithm 5: Viterbi(S, α, β, γ, k, p), a dynamic program in order to discover burstiness 1 foreach i = 1, . . . , n do 2 compute a and b in O(k) time; foreach j = 0, . . . , k do c1 ← o[i − 1, a[j]]; c2 ← o[i − 1, b[j]] + τ (b[j], j); o[i, j] ← min(c1, c2) − log p(si; βαj); 3 4 5 6 B Proof of Proposition 4.1 Proof. Let L and β be the solution to Exp(α). Since − log pexp(s; λ) = sλ − log λ, we can decompose the score qexp(L, S; α, β, γ) as n(cid:88) Define d =(cid:80) also write f (L) =(cid:80) i=1 (B.1) βα(cid:96)isi − log β − (cid:96)i log α + τ ((cid:96)i−1, (cid:96)i) i max ((cid:96)i − (cid:96)i−1, 0) and m =(cid:80) i α(cid:96)isi. Then the score becomes βf (L) − n log β − m log α + dγ log n . . i (cid:96)i. Let us Obviously, L satisfies the constraints posed in Bnd- Burst. Moreover, L minimizes f (L) (within the con- straints); otherwise we could replace L with L(cid:48), making the first term in Eq. B.1 genuinely smaller and keep- ing the remaining terms constant. This contradicts the optimality of L. Consequently, L solves BndBurst. To prove the remaining claims, first note that β optimizing Eq. B.1 must satisfy ∂qexp ∂β = f (L) − n/β = 0, proving the claim regarding β. Since (cid:96)i ≤ k, we have m ≤ nk. To bound d, let us write e =(cid:80) i max ((cid:96)i−1 − (cid:96)i, 0). We have d − e = (cid:96)i − (cid:96)i−1 = (cid:96)n ≤ k and d + e = (cid:96)i − (cid:96)i−1 ≤ nk . Summing the inequalities leads to 2d ≤ (n + 1)k, which proves the proposition. n(cid:88) n(cid:88) i=1 i=1 C Proof of Proposition 5.1 To prove the proposition we need several lemmas. Throughout this section, we assume that we are given an integer delay sequence S, and parameters α, γ, k, and  > 0. We will write µ = 1 n i si and c = 1 + . (cid:80) The first lemma states that the optimal β will be between the range that GeoAlpha tests. Lemma C.1. Let L and β be the solution of Geo(α). Then µ 1+µ ≤ β ≤ µ 1/n+µ . Proof. Since ∂qgeo(S, L; β) /∂β = 0. This implies that optimal is β we must have si β = 1 1 − βα(cid:96)i or µ = 1 n β 1 − βα(cid:96)i . Since α(cid:96)i ≤ 1 we must have β n(cid:88) µ = 1 n 1 − βα(cid:96)i ≤ β 1 − β , i=1 which can be rewritten as µ/(1 + µ) ≤ β. This gives us the lower bound of the lemma. To prove the other bound, note that we must have at least one (cid:96)i = 0. This leads to n(cid:88) i=1 n(cid:88) i=1 n(cid:88) i=1 n(cid:88) i=1 µ = 1 n β 1 − βα(cid:96)i ≥ 1 n β 1 − β , which can be rewritten as µ/(n−1 + µ) ≥ β. This proves the upper bound of the lemma. Next we show that if we vary α and β by little, while and it is decreasing as a function of y. This implies that keeping L constant, the score will not change a lot. Lemma C.2. Let α(cid:48) such that α1+ ≤ α(cid:48) ≤ α and let β(cid:48) such that β1+ ≤ β(cid:48) ≤ β. Then qgeo(L; α(cid:48), β(cid:48)) ≤ (1 + )qgeo(L; α, β) . Proof. We can decompose the score qgeo(L; α, β) as n(cid:88) i=1 −si log β − si(cid:96)i log α − log(1 − βα(cid:96)i) + τ ((cid:96)i−1, (cid:96)i) −(cid:80)n i=1 si, and E = −(cid:80)n i=1 (cid:96)isi. Note that C(α, β) ≥ 0 where C(α, β) is the sum of the last two terms, D = = D log β + E log α + C(α, β), and C(α, β) increases as a function of α and β. We can now upper bound the score qgeo(L; α(cid:48), β(cid:48)) = D log β(cid:48) + E log α(cid:48) + C(α(cid:48), β(cid:48)) ≤ D log βc + E log αc + C(α(cid:48), β(cid:48)) = cD log β + cE log α + C(α(cid:48), β(cid:48)) ≤ cD log β + cE log α + cC(α, β) = cqgeo(L; α, β) . Since c = 1 + , this completes the proof. We can now prove the main result. Proof of Prop. 5.1. Lemma C.1 guarantees that GeoAl- pha tests β(cid:48) such that (β∗)1+ ≤ β(cid:48) ≤ β∗. Let L(cid:48) be the optimal solution for β(cid:48). Lemma C.2 guarantees that qgeo(S, L∗; β(cid:48)) ≤ (1 + )qgeo(S, L∗; β∗). Since qgeo(S, L; β) ≤ qgeo(S, L(cid:48); β(cid:48)) ≤ qgeo(S, L∗; β(cid:48)), the result follows. D Proof of Proposition 5.2 In order to prove the proposition we need two lemmas. The first lemma is a technical result that is needed to prove the second lemma. Lemma D.1. Define h(x, y) = log log y + x x . Then ∂h(x, y2) ∂x − ∂h(x, y1) ∂x ≤ 0, that is h(x, y2) − h(x, y1) is decreasing as a function of x, which proves the lemma. Our second lemma essentially shows that GeoAlpha does not test too many values. Lemma D.2. Let n be an integer, and let µ ≥ 1/n be a real number. Assume  > 0 and let c = 1 + . Let r be such that β(cr) ≥ µ 1 + µ , where β = Then r ≤ log log(n + 1) − log log 2 log c ∈ O µ 1/n + µ (cid:18) log log n . (cid:19)  . Proof. We begin by applying − log to the inequality β(cr) ≥ µ 1+µ and obtain cr log 1/n + µ µ ≤ log 1 + µ µ . Another application of log and using h, as defined in Lemma D.1, leads us to r log c ≤ h(µ, 1) − h(µ, 1/n) . Since µ ≥ 1/n, Lemma D.1 implies r log c ≤ h(µ, 1) − h(µ, 1/n) ≤ h(1/n, 1) − h(1/n, 1/n) − log log = log log = log log(n + 1) − log log 2, 1 + 1/n 1/n 2/n 1/n which gives us the needed inequality. Since 1/ log c ≤  ∈ O(1/), the result follows. 1+ We can now prove the main result. only test O(cid:0)−1 log log n(cid:1) values of β. Each test requires Proof of Prop. 5.2. Lemma D.2 guarantees that we O(nk) time, which proves the result. h(x1, y2) − h(x1, y1) ≥ h(x2, y2) − h(x2, y1) E Proof of Proposition 5.3 for x1 ≤ x2 and y1 ≤ y2. Proof. The partial derivative of h is equal to (cid:20) 1 (cid:21) ∂h(x, y) ∂x = y + x − 1 x 1 log(y + x) − log x , Assume a delay sequence S, parameter γ, and an upper bound for levels k. Let α, β and L be the solution to Geo. Let µ be the average of the S. Write ∆i = τ ((cid:96)i−1, (cid:96)i). Assume that we are given  > 0 and let c = 1 + . First, we upper-bound the search space for α. 1/n+µ and α(cid:48) = σ/k. If α ≥ α(cid:48), Lemma E.1. Let σ = µ then qgeo(L; α(cid:48), β) ≤ (1 + )qgeo(L; α, β) Proof. Decompose the score qgeo(L) to The next lemma addressed the case when the con- dition of the previous lemma fails. Lemma E.3. If sili = 0 for all i, then α = 0. −si log β − si(cid:96)i log α − log(1 − βα(cid:96)i) + ∆i . Proof. We can decompose the score qgeo(L) as n(cid:88) −si log β − log(1 − βα(cid:96)i) + ∆i . i=1 This score decreases as a function of α, and is minimized when α = 0. We can now prove the main result. Proof of Prop. 5.3. If the condition in Lemma E.3 is triggered, then α = 0, which is tested by ApproxGeo, and Proposition 5.1 guarantees the result. Otherwise, Lemmas C.1, E.1 and E.2 guarantee that ApproxGeo tests α(cid:48) and β(cid:48) such that (β∗)1+ ≤ β(cid:48) ≤ β∗ and (α∗)1+ ≤ α(cid:48) ≤ α∗. Let L(cid:48) be the optimal solution for α(cid:48), β(cid:48). The proposition follows since qgeo(L(cid:48); α(cid:48), β(cid:48)) ≤ qgeo(L∗; α(cid:48), β(cid:48)) ≤ cqgeo(L∗; α∗, β∗) , where the second inequality is due to Lemma C.2. F Proof of Proposition 5.4 Proof. Let σ = µ/(1/n + µ). Let m be the number of tests for different αs. The stopping condition now guarantees (cid:18) 1 (cid:19)c−m 1 + nk ≤ σ/k, which can be rewritten as −c−m log(1 + nk) ≤  k log σ ≤  k (σ − 1) = − k(1 + nµ) Reversing the sign, and taking logarithm leads to −m log c ≥ log()− log(k)− log(1 + nµ)− log log(1 + nk) which leads to m ≤ log(k) + log(1 + nµ) − log() + log log(1 + nk) ∈ O (cid:18) log n + log µ + log k − log  (cid:19) log c .  n(cid:88) i=1 Let C(α) be the sum of the last two terms. Since C(α) ≥ C(α(cid:48)) ≥ 0, we only need to show that −si log β − si(cid:96)i log α(cid:48) ≤ −csi log β − csi(cid:96)i log α . To show this, note that Lemma C.1 implies that β ≤ σ. We can now bound the first two terms by −si log β − si(cid:96)i log α(cid:48) = −si log β − si ≤ −si log β − si ≤ −si log β − si log β = −csi log β ≤ −csi log β − csi(cid:96)i log α . (cid:96)i k (cid:96)i k log σ log β This proves the lemma. Next, we lower-bound the search space for α. Lemma E.2. If there is an index j such that sjlj (cid:54)= 0, then α ≥ 1 1+nk . Proof. In order for α to be optimal, ∂qgeo ∂α = 0, or n(cid:88) n(cid:88) si(cid:96)i = i=1 i=1 β(cid:96)iα(cid:96)i 1 − βα(cid:96)i = n(cid:88) i=1 f (α, β, li), We can upper bound the right-hand side. If (cid:96)i = 0, then If (cid:96)i ≥ 1, then β(cid:96)iα(cid:96)i 1 − βα(cid:96)i β(cid:96)iα(cid:96)i 1 − βα(cid:96)i = 0 ≤ kα 1 − α . ≤ (cid:96)i βα 1 − βα ≤ k βα 1 − βα ≤ k α 1 − α . This leads to n(cid:88) i=1 si(cid:96)i ≤ kn α 1 − α . Since sjlj ≥ 1, we have α 1 − α ≥ 1 nk n(cid:88) i=1 si(cid:96)i ≥ 1 nk , which can be rewritten as α ≥ 1 1+nk . G Proof of Proposition 6.1 To prove the proposition we need several lemmas. Throughout this section, we assume that we are given a delay sequence S, and parameters α, γ and k. We will write µ = 1 n (cid:80) i si. First, we need to show that the optimal β stays within the bounds used by ApproxExp. Lemma G.1. Let β and L be the solution to Exp(α). Then 1 αkµ ≤ β ≤ 1 µ . Proof. Write ∆i = τ ((cid:96)i−1, (cid:96)i). We can decompose the score qexp(L; β) as n(cid:88) βα(cid:96)isi − log β − (cid:96)i log α + ∆i (cid:80) i=1 . i α(cid:96)isi. Due to optimality of β we must Let g = 1 n have ∂qexp ∂β = ng − n β = 0, that is, β = 1/g. As 0 ≤ (cid:96)i ≤ k, we have µ ≤ g ≤ αkµ. This proves the lemma. Our next result is a technical lemma that is needed to control the possible negative terms in the score. Lemma G.2. Let β and L be the solution to Exp. Let i si]1/n be the geometric mean. Then g = [(cid:81) . i α(cid:96)i(cid:3)1/n. The n(cid:88) i=1 − log β − (cid:96)i log α ≥ n log g (cid:80) i α(cid:96)isi and h = (cid:2)(cid:81) − log β − (cid:96)i log α = n log f − n(cid:88) ≥ n log gh − n(cid:88) = n log g + n log h − n(cid:88) (cid:96)i log α (cid:96)i log α i=1 i=1 n(cid:88) i=1 = n log g . i=1 n(cid:88) Let g = [(cid:81) Lemma G.3. Let β and L be the solution to Exp. i si]1/n be the geometric mean, and let ψ = n log g. Let 1, 2 > 0 and assume α(cid:48), β(cid:48) such that β ≤ β(cid:48) ≤ β(1 + 1) and α ≤ α(cid:48) ≤ α(1 + 2). Then qexp(L; α(cid:48), β(cid:48)) − ψ ≤ c(qexp(L; α, β) − ψ), where c = (1 + 1)(1 + 2)k. Proof. Write ∆i = τ ((cid:96)i−1, (cid:96)i). Decompose the score qexp(L; α, β) to βα(cid:96)isi − log β − (cid:96)i log α + ∆i, i=1 C(α, β) ≥ ψ. Also let F (α) =(cid:80)n and let C(α, β) be the sum of last three terms. Note that C(α(cid:48), β(cid:48)) ≤ C(α, β), and due to Lemma G.2 i=1 α(cid:96)isi be the sum of the first term without β. We can now write qexp(L; α(cid:48), β(cid:48)) − ψ = β(cid:48)F (α(cid:48)) + C(α(cid:48), β(cid:48)) − ψ ≤ cβF (α) + C(α, β) − ψ ≤ cβF (α) + c(C(α, β) − ψ) = c(qexp(L; α, β) − ψ), which proves the lemma. We can now prove the main result. Proof of Prop. 6.1. Lemma G.1 guarantees that Ap- proxExp tests β(cid:48) such that β∗ ≤ β(cid:48) ≤ β∗(1 + ). Let L(cid:48) be the optimal solution for β(cid:48). Lemma G.3 guarantees that qexp(L∗; β(cid:48))− n log g ≤ (1 + )(qexp(L∗; β∗) − n log g). Since qexp(L; β) ≤ qexp(L(cid:48); β(cid:48)) ≤ qexp(L∗; β(cid:48)), the result follows. ∈ O(cid:0)−1k log α(cid:1) r ≤ k log α log(1 + ) Consequently, ApproxExp has at most O(cid:0)−1k log α(cid:1) iterations. Since a single iteration costs O(nk) time, the result follows. . Proof. Let f = 1 arithmetic-geometric mean inequality states that hg ≤ n f . By definition, we must have β = 1/f . This leads to H Proof of Proposition 6.2 Proof. Assume that (1 + )−r/µ ≥ 1/(αkµ). Solving for r gives us (cid:96)i log α I Proof of Proposition 6.3 We first upper-bound the optimal α. This proves the lemma. The next lemma shows that if we vary β by little while keeping L constant, the score of the solution will not change a lot. Lemma I.1. Let Ω = max S and ω = min S. Then α ≤ Ω/ω. Proof. Assume that α > Ω/ω. To prove the result we use the fact that (I.2) siλ(cid:48) − log λ(cid:48) ≤ siλ − log λ, when si ≥ λ(cid:48) ≥ λ or si ≤ λ(cid:48) ≤ λ. We claim that βα ≥ ω. Assume otherwise. Con- sider an alternative level sequence (cid:96)(cid:48)i = max((cid:96)i − 1, 0) and β(cid:48) = βα. Under this transformation, the only mod- elling terms in pexp that change are the original levels for which (cid:96)i = 0, equal to (β(cid:48)si − log β(cid:48)) − (βsi − log β) . Eq. I.2 guarantees that this change is always negative. In addition, ∆i can only decrease. We can repeat this argument until βα ≥ ω. We now split in two separate cases. Case (i ): Assume βα ≥ Ω. We must have βα = Ω. Otherwise, since βα > si, Eq. I.2 now guarantees that we can safely decrease α at least until βα = Ω. The assumption α > Ω/ω implies that β ≤ ω. Similarly, if we increase β we must have β = ω. Otherwise, and decrease α such that βα remains constant, then Eq. I.2 implies that the score decreases until β = ω. Consequently, α = Ω/ω which contradicts the assumption α > Ω/ω. In other words we have β ≤ ω ≤ βα ≤ Ω ≤ βα2. We claim that β = ω or Ω = βα2. Otherwise, increase β and decrease α such that βα remains constant; Eq. I.2 states that we can only decrease the score at least until β = ω or Ω = βα2. This immediately implies α ≤ Ω/ω, which is a contradiction. Case (ii ): Assume βα ≤ Ω. √ Proof of Prop. 6.3. Lemma I.1 guarantees that Approx- Exp tests α(cid:48) such that α ≤ α(cid:48) ≤ α 2k 1 + . Lemma G.3 now guarantees the approximation ratio of k ≤ (1 + ), √ (1 + /2) 2k 1 +  which proves the result. J Proof of Proposition 6.4 Proof. The number of iterations done by ApproxExp is O(cid:0)−1k(log Ω − log ω)(cid:1). A single iteration requires O(cid:0)−1nk2 log α(cid:1) ∈ O(cid:0)−1nk2 log(Ω/ω)(cid:1) time. K Proof of Proposition 6.5 Let us write λ(β) to be an optimal solution using β as a parameter. Define n(cid:88) f (L) = siα(cid:96)i, i=1 and let h(β) = n/f (λ(β)). Note that we may have several optimal solutions for λ(β) and they may yield different values of f (L). We break the ties with a lexicographical order. We will first prove that h is monotonic. Lemma K.1. h(β1) ≥ h(β2) for β1 ≤ β2. Proof. Similar to Eq. B.1, we can decompose the score qexp(L, S; α, β, γ) = βf (L) − n log β + C(L), where C(L) = −(cid:96)i log α + τ ((cid:96)i−1, (cid:96)i) . n(cid:88) i=1 We will suppress S, α, and γ from the notation since they are constant. Assume that we have two level sequences L1 and L2. Note that if βf (L1) − n log β + C(L1) = βf (L2) − n log β + C(L2) then βf (L1) + C(L1) = βf (L2) + C(L2) . This implies that there are three possible cases: (i) L1 and L2 yield exact same cost for every β, (ii) the cost for L1 is always smaller than the cost for L2, or vice versa, or (iii) there is exactly one parameter, say β(cid:48), where qexp(L1; β(cid:48)) = qexp(L2; β(cid:48)). In the first case, we must have f (L1) = f (L2). In the last case, we must have f (L1) (cid:54)= f (L2). Assume that f (L1) < f (L2). Then for every β ≤ β(cid:48), qexp(L1; β) − qexp(L2; β) = β(f (L1) − f (L2)) + C(L1) − C(L2) ≥ β(cid:48)(f (L1) − f (L2)) + C(L1) − C(L2) = qexp(L1; β(cid:48)) − qexp(L2; β(cid:48)) = 0, and similarly qexp(L1; β) ≤ qexp(L2; β), for every β ≥ β(cid:48). Let β1 < β2, and let L1 = λ(β1) and L2 = λ(β2). There are four possible cases. Case (a): If qexp(L1; β1) = qexp(L2; β1) and qexp(L1; β2) = qexp(L2; β2), then Case (i) guarantees that f (L1) = f (L2). Case (b): If qexp(L1; β1) = qexp(L2; β1) and qexp(L1; β2) > qexp(L2; β2), then Case (iii) guarantees that β1 = β(cid:48) and f (L1) ≥ f (L2). Case (c): If qexp(L1; β1) < qexp(L2; β1) and qexp(L1; β2) = qexp(L2; β2), then Case (iii) guarantees that β2 = β(cid:48) and f (L1) ≥ f (L2). Case (d ): These cases immediately guarantee that h(β1) = If qexp(L1; β1) < qexp(L2; β1) and qexp(L1; β2) > qexp(L2; β2), then Case (iii) guarantees that β1 < β(cid:48) < β2 and f (L1) ≥ f (L2). n/f (L1) ≤ n/f (L2) = h(β2). Proof of Proposition 6.5. Since β∗ is optimal we must have β∗ = h(β∗). Assume that β ≤ β∗. Then Lemma K.1 states that β(cid:48) = h(β) ≤ h(β∗) = β∗. Assume that β∗ ≤ β. Then Lemma K.1 states that β∗ = h(β∗) ≤ h(β) = β(cid:48).
1307.6809
4
1307
2016-02-28T20:55:24
A strongly polynomial algorithm for generalized flow maximization
[ "cs.DS", "cs.DM", "math.OC" ]
A strongly polynomial algorithm is given for the generalized flow maximization problem. It uses a new variant of the scaling technique, called continuous scaling. The main measure of progress is that within a strongly polynomial number of steps, an arc can be identified that must be tight in every dual optimal solution, and thus can be contracted. As a consequence of the result, we also obtain a strongly polynomial algorithm for the linear feasibility problem with at most two nonzero entries per column in the constraint matrix.
cs.DS
cs
A strongly polynomial algorithm for generalized flow maximization L´aszl´o A. V´egh Department of Mathematics London School of Economics and Political Science [email protected] Abstract A strongly polynomial algorithm is given for the generalized flow maximization problem. It uses a new variant of the scaling technique, called continuous scaling. The main measure of progress is that within a strongly polynomial number of steps, an arc can be identified that must be tight in every dual optimal solution, and thus can be contracted. As a consequence of the result, we also obtain a strongly polynomial algorithm for the linear feasibility problem with at most two nonzero entries per column in the constraint matrix. 1 Introduction The generalized flow model is a classical extension of network flows. Besides the capacity constraints, for every arc e there is a gain factor γe > 0, such that flow amount gets multiplied by γe while traversing arc e. We study the flow maximization problem, where the objective is to send the maximum amount of flow to a sink node t. The model was already formulated by Kantorovich [19], as one of the first examples of Linear Programming; it has several applications in Operations Research [2, Chapter 15]. Gain factors can be used to model physical changes such as leakage or theft. Other common applications use the nodes to represent different types of entities, e.g. different currencies, and the gain factors correspond to the exchange rates. The existence of a strongly polynomial algorithm for Linear Programming is a major open ques- tion in the theory of computation. This refers to an algorithm with the number of arithmetic operations polynomially bounded in the number of variables and constraints, and the size of the numbers during the computations polynomially bounded in the input size. A landmark result by Tardos [30] is an algorithm with the running time dependent only on the size of numbers in the constraint matrix, but independent from the right-hand side and the objective vector. This gives strongly polynomial algorithms for several combinatorial problems such as minimum cost flows (see also Tardos [29]) and multicommodity flows. Instead of bounding the sizes of numbers, one might impose structural restrictions on the con- straint matrix. A natural question arises whether there exists a strongly polynomial algorithm for linear programs (LPs) with at most two nonzero entries per column (that can be arbitrary numbers). This question is still open; as shown by Hochbaum [17], all such LPs can be efficiently transformed to equivalent instances of the minimum cost generalized flow problem. (Note also that every LP can be efficiently transformed to an equivalent one with at most three nonzero entries per column.) In 1983, Megiddo [21] gave a strongly polynomial algorithm for solving the dual feasibility problem for such LPs; he introduced the concept of strongly polynomial algorithms in the same paper. A corollary of our result is the first strongly polynomial algorithm for the primal feasibility problem. 1 Generalized flow maximization is probably the simplest natural class of LPs where no strongly polynomial algorithm was known. The existence of such an algorithm has been a well-studied and longstanding open problem (see e.g. [9, 3, 35, 26, 28]). A strongly polynomial algorithm for a restricted class was given by Adler and Cosares [1]. In this paper, we exhibit a strongly polynomial algorithm for generalized flow maximization. Let n denote the number of nodes and m the number of arcs in the network, and let B denote the largest integer used in the description of the input (see Section 2 for the precise problem definition). A strongly polynomial algorithm for the problem entails the following (see [16]): (i) it uses only elementary arithmetic operations (addition, subtraction, multiplication, division), and comparisons; (ii) the number of these operations is bounded by a polynomial of n and m; (iii) all numbers occurring in the computations are rational numbers of encoding size polynomially bounded in n, m and log B – or equivalently, it is a polynomial space algorithm. Here, the encoding size of a positive rational number p/q is defined as ⌈log2(p + 1)⌉ + ⌈log2(q + 1)⌉. By the running time of a strongly polynomial algorithm we mean the total number of elementary arithmetic operations and comparisons. Combinatorial approaches have been applied to generalized flows already in the sixties by Dantzig [4] and Jewell [18]. However, the first polynomial-time combinatorial algorithm was only given in 1991 by Goldberg, Plotkin and Tardos [9]. This was followed by a multitude of further combinatorial algorithms e.g. [3, 11, 13, 31, 6, 12, 14, 35, 26, 27, 34]; a central motivation of this line of research was to develop a strongly polynomial algorithm. The algorithms of Cohen and Megiddo [3], Wayne [35], and Restrepo and Williamson [27] present fully polynomial time approximation schemes, that is, for every ε > 0, they can find a solution within ε from the optimum value in running time polynomial in n, m and log(1/ε). This can be transformed to an optimal solution for a sufficiently small ε; however, this value does depend on B and hence the overall running time will also depend on log B. The current most efficient weakly polynomial algorithms are the interior point approach of Kapoor an Vaidya [20] with running time O(m1.5n2 log B), and the combinatorial algorithm by Radzik [26] with running time O(m2n log B).1 For a survey on combinatorial generalized flow algorithms, see Shigeno [28]. The generalized flow maximization problem exhibits deep structural similarities to the minimum cost circulation problem, as first pointed out by Truemper [32]. Most combinatorial algorithms for generalized flows, including both algorithms by Goldberg et al. [9], exploit this analogy and adapt existing efficient techniques from minimum cost circulations. For the latter problem, several strongly polynomial algorithms are known, the first one given by Tardos [29]; others relevant to our discussion are those by Goldberg and Tarjan [10], and by Orlin [23]; see also [2, Chapters 9-11]. Whereas these algorithms serve as starting points for most generalized flow algorithms, the applicability of the techniques is by no means obvious, and different methods have to be combined. As a consequence, the strongly polynomial analysis cannot be carried over when adapting minimum cost circulation approaches to generalized flows, although weakly polynomial bounds can be shown. To achieve a strongly polynomial guarantee, further new algorithmic ideas are required that are specific to the structure of generalized flows. The new ingredients of our algorithm are highlighted in Section 2.4. Let us now outline the scaling method for minimum cost circulations, a motivation of our gener- alized flow algorithm. The first (weakly) polynomial time algorithm for minimum cost circulations was given by Edmonds and Karp [5], introducing the simple yet powerful idea of scaling (see also [2, Chapter 9.7]). The algorithm consists of ∆-phases, with the value of ∆ > 0 decreasing by a factor of at least two between every two phases, yielding an optimal solution for sufficiently small ∆. In 1The O() notation hides a polylogarithmic factor. 2 the ∆-phase, the flow is transported in units of ∆ from nodes with excess to nodes with deficiency using shortest paths in the graph of arcs with residual capacity at least ∆. Orlin [23], (see also [2, Chapters 10.6-7]) devised a strongly polynomial version of this algorithm. The key notion is that of "abundant arcs". In the ∆-phase of the scaling algorithm [5], the arc e is called abundant if it carries > 4n∆ units of flow. For such an arc e, it can be shown that x∗ e > 0 must hold for some optimal solution x∗. By primal-dual slackness, the corresponding constraint must be tight in every dual optimal solution. Based on this observation, Orlin [23] showed that such an arc can be contracted; the scaling algorithm is then restarted on the smaller graph. This leads to a dual optimal solution in strongly polynomial time; that provided, a primal optimal solution can be found via a single maximum flow computation. Orlin [23] also presents a more efficient but also more sophisticated implementation of this idea. Let us now turn to generalized flows. The analogue of the scaling method was an important component of the Fat-Path algorithm of [9]; the algorithm of Goldfarb, Jin and Orlin [13] and the one in [34] also use this technique. The notion of "abundant arcs" can be easily extended to these frameworks: if an arc e carries a "large" amount of flow as compared to ∆, then it must be tight in every dual optimal solution, and hence can be contracted. This idea was already used by Radzik [26], to boost the running time of [13]. Nevertheless, it is not known whether an "abundant arc" would always appear in any of the above algorithms within a strongly polynomial number of steps. Our contribution is a new type of scaling algorithm that suits better the dual structure of the generalized flow problem, and thereby the quick appearance of an "abundant arc" will be guaranteed. Whereas in all previous methods, the scaling factor ∆ remains constant for a linear number of path augmentations, our continuous scaling method keeps it decreasing in every elementary iteration of the algorithm, even in those that lead to finding the next augmenting path. The rest of the paper is structured as follows. Section 2 first defines the problem setting, in- troduces relabelings, gives the characterization of optimality, and defines the notion of ∆-feasibility. Section 2.4 then gives a more detailed account of the main algorithmic ideas. The algorithm is presented in three different versions. First, Section 2.5 describes a relatively simple scaling algorithm called Continuous Scaling, with a weakly polynomial running time guar- antee proved in Section 3. Our strongly polynomial algorithm Enhanced Continuous Scaling in Section 4 builds on this, by including one additional subroutine, and a framework for contracting arcs. The running time analysis is given in Section 5. This achieves a strongly polynomial bound on the number of steps. A strongly polynomial algorith must also satisfy requirement (iii) on bounded number sizes. This requires further modifications of the algorithm in Section 6 by introducing certain rounding steps. Section 7 shows reductions between different formulations; in particular, the corollary on LP feasibility problems with at most two nonzeros per column is shown here. Section 7 is independent from the preceding sections and can be read directly after Section 2. Section 8 concludes with some additional remarks and open questions. 2 Preliminaries We start by introducing the most general formulation our approach is applicable to. Consider the linear feasibility problem Ax = b 0 ≤ x ≤ u, 3 (LP2) such that every column of A contains at most two nonzero entries. By making use of a reduction by Hochbaum [17], in Section 7.2 we show that every problem of this form can be reduced to the generalized flow maximization problem as defined next. Let G = (V, E) be a directed graph with a designated sink node t ∈ V . Let n = V , m = E, and for each node i ∈ V , let di denote total number of arcs incident to i (both entering and leaving). We will always assume n ≤ m. We do not allow parallel arcs and hence we may use ij to denote the arc from i to j. This is for notational convenience only, and all results straightforwardly extend to the setting with parallel arcs. All paths and cycles in the paper will refer to directed paths and directed cycles. The following is the standard formulation of the problem. Let us be given arc capacities u : E → Q>0 ∪ {∞} and gain factors γ : E → Q>0. max Xj:jt∈E Xj:ji∈E γjtfjt − Xj:tj∈E γjifji − Xj:ij∈E 0 ≤ f ≤ u ftj fij ≥ 0 ∀i ∈ V − t (Pu) It is common in the literature to define the problem with equalities in the node constraints. The two forms are essentially equivalent, see e.g. [28]; moreover, the form with equality is often solved via a reduction to (Pu). In this paper, we prefer to use yet another equivalent formulation, where the arcs have no upper capacities, but there are node demands instead. A problem given in the standard formulation can be easily transformed to an equivalent instance in this form; the transformation is described in Section 7.1. Given a node demand vector b : V → Q and gain factors γ : E → Q>0, the uncapacitated formulation is defined as max Xj:jt∈E Xj:ji∈E γjtfjt − Xj:tj∈E γjifji − Xj:ij∈E 0 ≤ f ftj fij ≥ bi ∀i ∈ V − t (P ) Note the value of bt is irrelevant as it is not present in the formulation; we may e.g. assume bt = 0. For a vector f ∈ R E ≥0, let us define the excess of a node i ∈ V by ei(f ) := Xj:ji∈E γjifji − Xj:ij∈E fij − bi. The node constraints in (P ) can be written as ei(f ) ≥ 0, and the objective is equivalent to maximizing et(f ). When f is clear from the context, we will denote the excess simply by ei := ei(f ). By a E generalized flow we mean a feasible solution to (P ), that is, a nonnegative vector f ∈ R ≥0 with ei(f ) ≥ 0 for all i ∈ V − t. Let us define the surplus of f as It will be convenient to make the following assumptions. Ex(f ) := Xi∈V −t ei(f ). There is an arc it ∈ E for every i ∈ V − t; The problem (P ) is feasible, and an initial feasible solution ¯f is provided. The objective value in (P ) is bounded. (⋆) (⋆⋆) (⋆ ⋆ ⋆) 4 These assumptions are without loss of generality; it is shown in Section 7.1 that any problem in the standard form can be transformed to an equivalent one in the uncapacitated form that also satisfies assumptions (⋆) and (⋆⋆). Condition (⋆) can be easily achieved by adding new arcs to the sink with gain factors small enough not to influence the solution. To obtain (⋆⋆), observe that f ≡ 0 is feasible to (Pu); ¯f in (⋆⋆) will be the image of 0 under the transformation. To justify (⋆ ⋆ ⋆), in the same Section 7.1 we show how unboundedness can be detected. Furthermore, in Section 7.2 we show how an arbitrary instance of (LP2) can be reduced to solving two instances of (P ) satisfying these assumptions. Let us introduce some further notation. For an arc set H ⊆ E, let ←− H denote the set of reverse ←− arcs, that is, H by γji := 1/γij. For an arc set F ⊆ E and node sets S, T ⊆ V , let F [S, T ] := {ij ∈ F : i ∈ S, j ∈ T }. We also use F [S] := F [S, S] to denote the set of arcs in F spanned by S. For a node i ∈ V , let δin(i) and δout(i) denote the set of arcs entering and leaving i, respectively. We will use the vector norms ←− H . We define the gain factor of a reverse arc ji ∈ ←− H := {ji : ij ∈ H}; let ←→ H := H ∪ A vector f : ←→ E → R≥0 is called a path flow, if its support is a path P = w1w2 . . . wt ⊆ x1 =Pi xi and x∞ = maxi xi. For integers a ≤ b, let [a, b] := {a, a + 1, . . . , b}. ←→ E , and γwℓfwℓ = fwℓ+1 for every 1 ≤ ℓ ≤ t − 1. In other words, the incoming flow equals the outgoing flow in every internal node of the path. We say that a path flow f sends α units of flow from p to q, if the support of f is a p − q path, and the flow value arriving at q equals α. Note however, that the amount of flow leaving p is typically different from α. 2.1 Encoding size In the weakly polynomial algorithm, the running time will be dependent on the encoding size of the input, that consists of rational numbers. In a strongly polynomial algorithm, all numbers appearing during the computations must be rational of encoding size polynomially bounded in the input size. (We remark that the notion of strongly polynomial algorithms is also applicable to problems with arbitrary real numbers in the input; this model assumes that every basic arithmetic operation can be carried out in O(1) time.) Standard formulation. We are given an integer B such that all capacities u and gain factors γ are rational numbers, given as quotients of two integers ≤ B. Uncapacitated formulation. We give more complicated conditions on the encoding size of the different quantities. This is in order to maintain good bounds on the encoding size when transforming an instance from the standard to the uncapacitated formulation in Section 7.1. Assume the instance satisfies conditions (⋆), (⋆⋆) and (⋆ ⋆ ⋆). We use the integer ¯B to bound the encoding size of the input as follows. • The arcs can be classified into two types, regular and auxiliary, with t being the endpoint of every auxiliary arc. For a regular arc ij, the gain factor γij is given as a rational number, such that ¯B is an integer multiple of the product of the numerators and denominators of all γij values for regular arcs. For every auxiliary arc it, γit = 1/ ¯B. • For every i ∈ V − t, bi ≤ ¯B, and is an integer multiple of 1/ ¯B. • For the initial solution ¯f , and for every ij ∈ E, ¯fij ≤ ¯B and ¯fij is an integer multiple of 1/ ¯B. The reduction in Section 7.1 will transform an instance in the standard formulation with n nodes and m arcs and parameter B to an uncapacitated instance with ≤ m + n nodes, ≤ 2m arcs and ¯B ≤ 2B4m. Our main result is the following. 5 Theorem 2.1. There exists an O(n3m2) time strongly polynomial algorithm for the uncapacitated formulation (P ) with assumptions (⋆), (⋆⋆) and (⋆ ⋆ ⋆). Using the transformation in Section 7.1, this gives an O(m5) time strongly polynomial algorithm for the standard formulation (Pu). Finally, using the reduction in Section 7.2, we get an O(m5) algorithm for the linear feasibility problem (LP2) with n constraints and m variables. 2.2 Labelings and optimality conditions Dual solutions to (P ) play a crucial role in the entire generalized flow literature. Let y : V → R≥0 be a solution to the dual of (P ). Following Glover and Klingman [8], the literature standard is not to consider the y values but their inverses instead. With µi := 1/yi, we can write the dual of (P ) in the following form. bi µi maxXi∈V γijµi ≤ µj ∀ij ∈ E (D) µi > 0 ∀i ∈ V − t µt = 1 A feasible solution µ to this program will be called a relabeling or labeling. An optimal labeling is an optimal solution to (D). Whereas there could be values µi = ∞ corresponding to yi = 0, assumption (⋆) guarantees that all µi values must be finite. A useful and well-known property is the following. Proposition 2.2. Given an optimal solution to (D), an optimal solution to (P ) can be obtained in strongly polynomial time, and conversely, given an optimal solution to (P ), an optimal solution to (D) can be obtained in strongly polynomial time. In fact, our strongly polynomial algorithm proceeds via finding an optimal solution to (D), and computing the primal optimal solution via a single maximum flow computation. The first part of the above proposition is proved in Theorem 2.6(i), whereas the second part (which is not needed for our algorithm) can be shown using an argument similar to the proof of Lemma 3.1. Relabelings will be used in all parts of the algorithm and proofs. For a generalized flow f and a labeling µ, we define the relabeled flow f µ by f µ ij := fij µi for all ij ∈ E. This can be interpreted as changing the base unit of measure at the nodes (i.e. in the example of the currency exchange network, it corresponds to changing the unit from pounds to pennies). To get a problem setting equivalent to the original one, we have to relabel all other quantities accordingly. That is, we define relabeled gains, demands, excesses and surplus by γµ ij := γij µi µj , bµ i := bi µi , eµ i := ei µi , and Exµ(f ) := Xi∈V −t eµ i , respectively. Another standard notion is the residual network Gf = (V, Ef ) of a generalized flow f , defined as Ef := E ∪ {ij : ji ∈ E, fji > 0}. Arcs in E are called forward arcs, while arcs in the second set are reverse arcs. Recall that for a reverse arc ji we defined γji = 1/γij . Also, we define fji := −γijfij for every reverse arc ji ∈ Ef . 6 By increasing (decreasing) fji by α on a reverse arc ji ∈ Ef , we mean decreasing (increasing) fij by α/γij . The input graph G = (V, E) is allowed to have pairs of oppositely directed arcs ij and ji, making our notation slightly ambiguous: for an arc ij, we will denote its reverse arc by ji, which might be an arc parallel to the original arc from j to i in the input. However, this should not be a source of confusion: whenever the arc ji is mentioned in the context of ij, it will always refer to the reverse arc. The crucial notion of conservative labelings is motivated by primal-dual slackness. Let f be a generalized flow (that is, a feasible solution to (P )), and let µ : V → R>0. We say that µ is a conservative labeling for f , if µ is a feasible solution to (D) with the further requirement that γµ ij = 1 whenever fij > 0 for ij ∈ E. The following characterization of optimality is a straightforward consequence of primal-dual slackness in Linear Programming. We state the optimality conditions both for the uncapacitated formulation (P ), and for the standard formulation (Pu). In the latter part we do not assume (⋆), and therefore µi = ∞ is also allowed. Theorem 2.3. (i) Assume (⋆) holds. A generalized flow f is an optimal solution to (P ) if and only if there exists a finite conservative labeling µ, and ei = 0 for all i ∈ V − t. (ii) A feasible solution f to the standard form (Pu) is optimal if and only if there exists a function µ : V → R>0 ∪ {∞} such that µt = 1, and γijµi ≤ µj if fij = 0, γijµi = µj if 0 < fij < uij, and γijµi ≥ µj if fij = uij; further, ei = 0 whenever µi < ∞. Given a labeling µ, we say that an arc ij ∈ Ef is tight if γµ ij = 1. A directed path in Ef is called tight if it consists of tight arcs. 2.3 ∆-feasible labels Let us now introduce a relaxation of conservativity crucial in the algorithm. This is new notion, although similar concepts have been used in previous scaling algorithms [11, 34]. Section 2.4 explains the background and motivation of this notion. Given a labeling µ, let us call arcs in E with γµ ij < 1 non-tight, and denote their set by For every i ∈ V , let F µ := {ij ∈ E : γµ ij < 1}. Ri := Xj:ji∈F µ γjifji denote the total flow incoming on non-tight arcs; let Rµ i let us define the ∆-fat graph as := Ri µi = Pj:ji∈F µ γµ jif µ ji. For some ∆ ≥ 0, We say that µ is a ∆-conservative labeling for f , or that (f, µ) is a ∆-feasible pair, if Eµ f (∆) = E ∪ {ij : ji ∈ E, f µ ji > ∆}. • γµ ij ≤ 1 holds for all ij ∈ Eµ f (∆), and • µt = 1, and µi > 0, ei ≥ Ri for every i ∈ V − t. Note that in particular, µ must be a feasible solution to (D). The first condition is equivalent to requiring f µ ij ≤ ∆ for every non-tight arc. Note that 0-conservativeness is identical to conser- vativeness: Eµ f (0) = Eµ f , and therefore every arc carrying positive flow must be tight; the second condition simply gives ei ≥ 0 whenever µi > 0. The next lemma can be seen as the converse of this observation. 7 Lemma 2.4. Let (f, µ) be a ∆-feasible pair for some ∆ > 0. Let us define the generalized flow f with fij = 0 if ij ∈ F µ and fij = fij otherwise. Then f is a feasible generalized flow, µ is a conservative labeling for f , and Exµ( f ) ≤ Exµ(f ) + F µ∆. Proof. For feasibility, we need to verify ei( f ) ≥ 0 for all i ∈ V − t. This follows since ei( f ) ≥ ei(f ) − Xj:ji∈F µ γjifji = ei(f ) − Ri ≥ 0. It is straightforward by the construction that γµ ij ≤ 1 for every ij ∈ E with equality whenever fij > 0. This shows that µ is a conservative labeling. For the last part, observe that decreasing the flow value to 0 on a non-tight arc ij may create f µ ij ≤ ∆ units of relabeled excess at i. Claim 2.5. In a ∆-conservative labeling, Rµ i < di∆ holds for every i ∈ V . Proof. If µ is a ∆-conservative labeling, then f µ the relabeled flow arriving from j on a non-tight arc is γµ jif µ ji < f µ ji ≤ ∆ holds for every non-tight arc ji; also note that ji ≤ ∆, and hence Rµ i < di∆. 2.4 Overview of the algorithms We now informally describe some fundamental ideas of our algorithms Continuous Scaling and Enhanced Continuous Scaling, and explain their relations to previous generalized flow algo- rithms. The precise algorithms and arguments will be given in the later sections. Basic features of the algorithms Given a generalized flow f , a cycle C in the residual graph Ef is called flow-generating, if γ(C) = Qe∈C γe > 1. If there exists a flow-generating cycle, then some positive amount of flow can be sent around it to create positive excess in an arbitrary node i incident to C. The notion of conservative labellings is closely related to flow generating cycles. Notice that for an arbitrary labeling µ, γ(C) = γµ(C). Therefore, if µ is a finite conservative labeling, then Ef cannot contain any flow-generating cycles. if there are no flow-generating cycles, then there exists a conservative labeling (see also Lemma 3.1). It is also easy to verify the converse: The Maximum-mean-gain cycle-canceling procedure, introduced by Goldberg et al. [9], can be used to eliminate all flow-generating cycles efficiently. The subroutine proceeds by choosing a cycle C ⊆ Ef maximizing γ(C)1/C, and from an arbitrary node i incident to C, sending the maximum possible amount of flow around C admitted by the capacity constraints, thereby increasing the excess ei. It terminates once there are no more flow-generating cycles left in Ef . This is a natural analogue of the minimum mean cycle cancellation algorithm of Goldberg and Tarjan [10] for minimum cost circulations. Radzik [25] (see also [28]) gave a strongly polynomial running time bound O(m2n log2 n) for the Maximum-mean-gain cycle-canceling algorithm. Our algorithm also starts with performing this algorithm, with the input being the initial solution ¯f provided by (⋆⋆). Hence one can obtain a feasible solution f along with a conservative labeling µ in strongly polynomial time. Such an f can be transformed to an optimal solution using Onaga's algorithm [22]: while there exists a node i ∈ V − t with ei > 0, find a highest gain augmenting path from i to t, that is, a path P in the residual graph Ef with the product of the gains maximum. Send the maximum amount of flow on this augmenting path enabled by the capacity constraints. A conservative labeling can be used to identify such paths: we can transform a conservative labeling to a canonical labeling (see [9]), where every node i is connected to the sink via a tight path. Such a canonical labeling 8 can be found via a Dijkstra-type algorithm, increasing the labels of certain nodes. The correctness of Onaga's algorithm follows by the observation that sending flow on a tight path maintains the conservativeness of the labeling, hence no new flow-generating cycles may appear. Unfortunately, Onaga's algorithm may run in exponentially many steps, and might not even terminate if the input is irrational. The Fat-Path algorithm [9] introduces a scaling technique to overcome this difficulty. The algorithm maintains a scaling factor ∆ that decreases geometrically. In the ∆-phase, flow is sent on a highest gain "∆-fat" augmenting path, that is, a highest gain path among those that have sufficient capacity to send ∆ units of flow to the sink. In our notation, these are paths in Eµ f (∆). However, path augmentations might create new flow-generating cycles, which have to be repeatedly cancelled by calling the cycle-canceling subroutine at the beginning of every phase. Our notion of ∆-feasible pairs in Section 2.3 is motivated by the idea of ∆-fat paths: note that every arc in the ∆-fat graph Eµ f (∆) has sufficient capacity to send ∆ units of relabeled flow. A main step in our algorithm will be sending ∆ units of relabeled flow on a tight path in Ef (∆) from a node with "high" excess to the sink t or another node with "low" excess. This is in contrast to Fat-Path and most other algorithms, where these augmenting paths always terminate in the sink t. We allow other nodes as well in order to maintain ei ≥ Ri are througout the algorithm. The purpose of these conditions is to make sure that we always stay "close" to a conservative labeling: recall Lemma 2.4 asserting that if (f, µ) is a ∆-feasible pair, then if we set the flow values to 0 on every non-tight arc, the resulting f is a feasible solution to (P ) not containing any flow-generating cycles. That is the reason why we need to call the cycle-canceling algorithm only once, at the initialization, in contrast to Fat-Path. Similar ideas have been already used previously. The algorithm of Goldfarb, Jin and Orlin [11] also uses a single initial cycle-canceling and then performs highest-gain augmentations in a scaling framework, combined with a clever bookkeeping on the arcs. The algorithm in [34] does not perform any cycle cancellations and uses a homonymous notion of ∆-conservativeness that is closely related to ours; however, it uses a different problem setup (called "symmetric formulation"), and includes a condition stronger than ei ≥ Ri. The way to the strongly polynomial bound The basic principle of our strongly polynomial algorithm is motivated by Orlin's strongly polynomial algorithm for minimum cost circulations ([23], see also [2, Chapters 10.6-7]). The true purpose of the algorithm is to compute a dual optimal solution to (D). Provided a dual optimal solution, we can compute a primal optimal solution to (P ) by a single maximum flow computation on the network of tight arcs (see Theorem 2.6(i)). The main measure of progress is identifying an arc ij ∈ E that must be tight in every dual optimal solution. Such an arc can be contracted, and an optimal dual solution to the contracted instance can be easily extended to an optimal dual solution on the original instance (see Sections 4.1, 5.1). The algorithm could be simply restarted from scratch in the contracted instance. Our algorithm Enhanced Continuous Scaling is somewhat more complicated and keeps the previous primal solution to achieve better running time bounds by a global analysis of all contraction phases. We use a scaling-type algorithm to identify such arcs tight in every dual optimal solution. Our algorithm maintains a scaling parameter ∆, and a ∆-feasible pair (f, µ) such that Exµ(f ) ≤ 16m∆. Using standard flow decomposition techniques, it can be shown that an arc ij with f µ ij ≥ 17m∆ must be positive in some optimal solution f ∗ to (P ) (see Theorem 4.1). Then by primal-dual slackness it follows that this arc is tight in every dual optimal solution. Arcs with f µ ij ≥ 17m∆ will be called abundant. 9 A simple calculation (see the proof of Claim 5.4) shows that once bµ i ≥ 32mn∆ for a node i ∈ V − t, there must be an abundant arc leaving or entering i. Hence our goal is to design an algorithm where such a node appears within a strongly polynomial number of iterations. A basic step in the scaling approaches (e.g. [9, 11, 34]) is sending ∆ units of relabeled flow on a tight path; we shall call this a path augmentation. In all previous approaches, the scaling factor ∆ remained fixed for a number of path augmentations, and reduces by a substantial amount (by at least a factor of two) for the next ∆-phase. Our main idea is what we call continuous scaling: the boundaries between ∆-phases are dissolved, and the scaling factor decreases continuously, even during the iterations that lead to finding the next path for augmentation. The precise description will be given in Section 2.5; in what follows, we give a high-level overview of some key features. We shall have a set T0 with nodes of "high" relabelled excess; another set N will be the set consisting of the sink t and further nodes with "low" relabelled excess. We will look for tight paths connecting a node in T0 to one in N ; we will send ∆ units of relabeled flow along such a path. In an intermediate elementary step, we let T to denote the set of nodes reachable from T0 on a tight path; if it does not intersect N , then we increase the labels µi for all i ∈ T by the same factor α hoping that a new tight arc appears between T and V \ T , and thus T can be extended. We simultaneously decrease the value of ∆ by the same factor α. Thus the relabeled excess of nodes in V \ T increases relative to ∆. This might lead to changes in the sets T0 and N ; hence an elementary step does not necessarily terminate when a new tight arc appears, and therefore the value of α has to be carefully chosen. This framework is undoubtedly more complicated than the traditional scaling algorithms. The main reason for this approach is the phenomenon one might call "inflation" in the previous scaling- type algorithms. There it might happen that the relabeling steps used for identifying the next augmenting paths increase some labels by very high amounts, and thus the relabeled flow remains small compared to ∆ on every arc of the network - therefore a new abundant arc can never be iden- tified. It could even be the case that most ∆-scaling phases do not perform any path augmentations at all, but only label updates: the relabeled excess at every node becomes smaller than ∆ during the relabeling steps.2 The advantage of changing ∆ continuously in our algorithm is that the ratios bµ i /∆ are non- decreasing for every i ∈ V − t during the entire algorithm. In the above described situation, these ratios are unchanged for i ∈ T and increase for i ∈ V \ T . As remarked above, there must be an abundant arc incident to i once bµ i /∆ ≥ 32mn. We first present a simpler version of this algorithm, Continuous Scaling in Section 2.5, where we can only prove a weakly polynomial running time bound. Whereas the ratios bµ i /∆ are nonde- creasing, we are not able to prove that one of them eventually reaches the level 32mn in a strongly polynomial number of steps. This is since the set V \ T where the ratio increases might always consist only of nodes where bµ i /∆ is very small. The algorithm Enhanced Continuous Scaling in Section 4 therefore introduces one additional subroutine, called Filtration. In case bµ i < ∆/n for every i ∈ (V \ T ) − t, we "tidy-up" the flow inside V \ T , by performing a maximum flow com- putation here. This drastically reduces all relabeled excesses in V \ T , and thereby guarantees that most iterations of the algorithm will have to increase certain bµ i /∆ values that are already at least 1/n. In summary, the strongly polynomiality of our algorithm is based on the following three main new ideas. • The definition of ∆-feasible pairs, in particular, the condition on maintaining a security reserve 2However, to the extent of the author's knowledge, no actual examples are known for these phenomena in any of the algorithms. 10 Ri. It is a cleaner and more efficient framework than similar ones in [11] and [34]; we believe this is the "real" condition a scaling type algorithm has to maintain. • Continuous scaling, that guarantees that the ratios bµ i /∆ are nondecreasing during the algo- rithm. This is achieved by doing the exact opposite of [9, 11, 34] that use the natural analogue of the scaling technique for minimum cost circulations. • The Filtration subroutine that intervenes in the algorithm whenever the nodes on a certain, relatively isolated part of the network have "unreasonably high" excesses as compared to the small node demands in this part. 2.5 The maximum flow subroutine Standard maximum flow computation (see e.g. [2, Chapters 6-7]) will be a crucial subroutine in our algorithm. First and foremost, if an optimal labeling is provided, then an optimal solution to (P ) can be obtained by computing a maximum flow. We now describe the subroutine Tight-Flow(S, µ), to perform such computations. In the weakly polynomial algorithm (Section 2.5), it will be used only twice: at the initialization and at the termination of the algorithm, in both cases with S = V . However, it will also be the key part of the subroutine Filtration in the strongly polynomial algorithm (Section 4), also applied to subsets S ( V . The input of Tight-Flow(S, µ) is a node set S ⊆ V with t ∈ S, and a labeling µ, that is a feasible solution to (D) when restricted to S. The subroutine returns a generalized flow f ′ supported on E[S], such that µ restricted to S is a conservative labeling for f ′. Let us define the arc set E ⊆ E[S] as the set of tight arcs for µ: E := {ij ∈ E[S] : γµ ij = 1}. Let us extend S by a new source node s, and add an arc si from s to every i ∈ S − t; let E′ denote the union of E and these new arcs. Let us set lower and upper arc capacities ℓij := 0, uij := ∞ on all arcs of E; for i ∈ S − t, let ℓsi := −∞ and usi := −bµ i . Tight-Flow(S, µ) computes a maximum flow x from s to t on the network (S ∪ {s}, E′) with capacities ℓ and u. Let us define f ′ : E[S] → R≥0 by f ′ ij := 0 otherwise. This completes the description of the subroutine Tight-Flow. Because of the possibly negative upper capacities on the si arcs, the maximum flow problem might be infeasible; in this case, the subroutine returns an error. ij := xijµi if ij ∈ E and f ′ Theorem 2.6. (i) If µ is an optimal solution to (D), then Tight-flow(V, µ) returns an optimal solution to (P ). (ii) Assume that the maximum flow problem in Tight-flow(S, µ) is feasible, and returns a vector f ′. Then f ′ is a feasible solution to (P ) on S, and eµ i (f ′) ≤ n max j∈S−t bµ j ∀i ∈ S. (iii) Assume that the flow problem in Tight-flow(V, µ) is feasible and returns a generalized flow f ′ with Ex(f ′) < 1/ ¯B3. Then Ex(f ′) = 0 must hold, that is, f ′ is an optimal solution to (P ). Proof. To prove part (i), assume µ is an optimal labeling. Let g be an optimal solution to (P ). Let us define xij := gµ ji for every i ∈ V − t. By Theorem 2.3(i), xsi = −bµ i for all i ∈ V − t, and therefore x is a maximum flow, with ({s}, V ) forming a minimum cut. Conversely, an arbitrary maximum flow must saturate every arc leaving s, and therefore we get ij if ij ∈ E and xsi :=Pj:ij∈E gµ ij −Pj:ji∈E gµ 11 ei(f ′) = 0 for every i ∈ V − t for the f ′ returned by Tight Flow(V, µ). It is straightforward that all conditions in Theorem 2.3(i) are satisfied. For part (ii), first observe that if there is a feasible solution x to the flow problem, then ei(f ′) ≥ 0 must hold for every i ∈ V − t, due to the constraint xsi ≤ −bµ i ; further, µ is a conservative labeling for f ′. Let us pick a node r ∈ S − t with er(f ′) > 0, and let Z ⊆ S denote the set of nodes that can be reached from r on a directed path in the residual graph (S, Ef ′ ), defined by Ef ′ = E ∪ {ji : ij ∈ E, f ′ ij > 0}. µ = xij for every ij ∈ Ef ′. Assume that t ∈ Z, that is, there is a directed path P from i = usr; hence sr and P give an Note that f ′ ij r to t in the residual graph. Since er(f ′) > 0, we have xsr < −bµ augmenting path for the flow x, in a contradiction to its choice as a maximum flow. i (f ′) ≥ 0 for all i ∈ Z, and therefore We may thus conclude that t /∈ Z. Hence eµ 0 < eµ r (f ′) ≤Xi∈Z eµ i (f ′) =Xi∈Z xji − Xj∈Z:ij∈ E xij − bµ   Xj∈Z:ji∈ E i  = −Xi∈Z bµ i ≤ n max j∈S−t bµ j , (1) proving part (ii) of the Theorem. Here we used that if xij > 0 then i ∈ Z if and only if j ∈ Z. Let us turn to part (iii); assume that eµ r (f ′) > 0 for some r ∈ V − t. The equation (1) can be further written as 0 < eµ r (f ′) ≤Xi∈Z eµ i (f ′) = −Xi∈Z bµ i = − 1 µr Xi∈Z bi µr µi . (2) For every i ∈ Z, there is a tight path P in Ef ′ from r to i, that is, µr/µi = Qe∈P 1/γe. By our assumption on the encoding sizes, this product must be an integer multiple of 1/ ¯B. We further assumed that every bi value is an integer multiple of 1/ ¯B. Hence every term bi is an integer multiple of 1/ ¯B2. Further, by (⋆), we have rt ∈ E, and γrt ≥ 1/ ¯B. By the conservativeness of µ w.r.t. to f , 1 ≥ γrt ≥ 1/ ¯B. Consequently, the last expression in (2) must be at least 1/ ¯B3 whenever µr it is nonzero. Therefore µr µi 1/ ¯B3 ≤Xi∈Z eµ i (f ′) ≤ Exµ(f ′), contradicting our assumption. Hence it follows that er(f ) = 0 for all r ∈ V − t. sectionThe Continuous Scaling algorithm The algorithm Continuous Scaling is shown in Figure 1. The strongly polynomial algorithm Enhanced Continuous Scaling in Section 4 will be an improved variant of this. We shall always make assumptions (⋆), (⋆⋆) and (⋆ ⋆ ⋆). The algorithm starts with the subroutine Initialize, described in Section 2.6, that returns an initial flow f , along with a ∆ = ¯∆-conservative labeling µ such that eµ i < (di + 2)∆ holds for every i ∈ V . This is based on the Maximum-mean-gain cycle-canceling algorithm as in [9, 25]. The main part of the algorithm (the while loop) consists of iterations. The value of the scaling parameter ∆ is monotone decreasing, and all µi values are monotone increasing during the algorithm. In every iteration, a ∆-feasible pair (f, µ) is maintained. These iterations stop once the scaling parameter ∆ decreases below 1/(17m ¯B3). At this point we apply the subroutine Tight-flow(V, µ), as described in Section 2.5, to find an optimal solution by a single maximum flow computation. The set N denotes the set consisting of t and all nodes with eµ of a certain set of nodes (but not all) with eµ be reached from T0 on a tight path in the ∆-fat graph Eµ i < (di + 1)∆. The set T0 consists i ≥ (di + 2)∆. The set T denotes a set of nodes that can f (∆). Both T0 and T are initialized empty. 12 Algorithm Continuous Scaling Initialize(V, E, b, γ, ¯f ) ; T0 ← ∅ ; T ← ∅ ; While ∆ ≥ 1/(17m ¯B3) do N ← {t} ∪ {i ∈ V − t : eµ if N ∩ T 6= ∅ then i < (di + 1)∆} ; pick p ∈ T0, q ∈ N ∩ T connected by a tight path P in Eµ send ∆ units of relabeled flow from p to q along P ; if eµ T ← T0 ; p < (dp + 2)∆ then T0 ← T0 \ {p} ; f (∆) ; else if ∃ij ∈ Eµ else Elementary Step(T, T0, f, µ, ∆) ; f (∆), γµ ij = 1, i ∈ T , j ∈ V \ T then T ← T ∪ {j} ; Tight-Flow(V, µ) ; Figure 1: Description of the weakly polynomial algorithm Every iteration first checks whether N ∩ T 6= ∅. If yes, then nodes p ∈ T0 and q ∈ N ∩ T are picked connected by a tight path P in the ∆-fat graph. ∆ units of relabeled flow is sent from p to q on P : that is, fij is increased by ∆µi for every ij ∈ P (if ij was a reverse arc, this means decreasing fji by ∆µj). The only ei values that change are ep and eq. If the new value is eµ p < (dp + 2)∆, then p is removed from T0. The iteration finishes in this case by resetting T = T0 (irrespective to whether p was removed or not). Let us now turn to the case N ∩ T = ∅. If there is a node j ∈ V \ T connected by a tight arc in Eµ f (∆) to T , then we extend T by j, and the iteration terminates. Otherwise, the subroutine Elementary Step(T, T0, f, µ, ∆) is called. The precise description is given in Section 2.7; we give an outline below. For a carefully chosen α > 1, all µi values are multiplied by α for i ∈ T , and µi is left unchanged for i ∈ V \ T . At the same time, ∆ is divided by α (this is the only step in the main part of the algorithm modifying the µi's and the value of ∆). The flow is divided by α on all non-tight arcs in F µ[V \ T ], and on every arc entering T . The value of α is chosen to be the largest such that the labeling remains ∆-feasible with the above changes, and further eµ i ≤ 4(di + 2)∆ holds for all i ∈ V \ T . If α = ∞, then the algorithm terminates with an optimal solution. For finite α, all nodes i for which eµ i = 4(di + 2)∆ holds after the change are added both to T0 and to T . On the other hand, the eµ i values might also decrease both for i ∈ T and i ∈ V \ T . If for some i ∈ T0, the value of eµ i drops below (di + 2)∆, then i is removed from T0, and T is reset to T = T0. In every step when T0 is not changed, a tight arc in Eµ f (∆) leaving T must appear. Consequently, T will be extended in the next iteration. We shall prove the following running time bound: Theorem 2.7. The algorithm Continuous Scaling can be implemented to find an optimal solution for the uncapacitated formulation (P ) in running time max{O(m(m+n log n) log ¯B), O(m2n log2 n)}. The high level idea of the analysis is the following. The eµ i values for nodes i ∈ T0 are non- increasing, and a path augmentation starting from i reduces eµ i by ∆. The node i leaves T0 once eµ i drops below (di + 2)∆, and may enter again once it increases to 4(di + 2)∆. As shown in Lemma 3.7, the value of ∆ must decrease by at least a factor 2 between two such events. Also, it is easy to 13 verify that within every 2n Elementary step operations, either a path augmentation must be carried out, or a node i must leave T0 due to decrease in eµ i caused by label changes. These two facts together give a polynomial bound on the running time. In the proof of Theorem 2.7, we outline a more efficient implementation of the algorithm, with all iterations between two path augmentations performed together. For a problem in the standard form on n nodes, m arcs and complexity parameter B, the reduction in Section 7.1 shows that it can be transformed to an equivalent instance with ≤ n + m nodes, ≤ 2m arcs, and ¯B ≤ 2B4m. Hence the theorem gives a running time O(m3 log n log B), assuming n ≤ B. Our algorithm could be naturally adapted to work on a problem instance with both node demands and arc capacities; the reason for choosing the uncapacitated instance is its suitability for the strongly polynomial algorithm in Section 4. Such a modification would run in time O(m2(m + n log n) log B), matching the bound of Goldfarb et al. [13]. 2.6 The Initialization subroutine In this section we describe the Initialize(V, E, b, γ, ¯f ) subroutine. The input is a graph G = (V, E), node demands bi : V → R, gain factors γ : E → R>0 and the initial generalized flow ¯f guaranteed by the assumption (⋆⋆). The initial value of ∆ = ¯∆ is computed and a ∆-feasible pair (f, µ) is returned such that eµ i < (di + 2)∆ holds for every i ∈ V − t. First, we use the Maximum-mean-gain cycle-canceling algorithm by Radzik [25]. This paper uses the standard capacitated formulation (Pu) with finite capacities on the arcs. As a con- sequence, every flow-generating cycle can only generate a finite amount of flow. Our boundedness assumption (⋆ ⋆ ⋆), together with (⋆), guarantees the same property. Provided this boundedness property, Radzik's strongly polynomial bound extends verbatim to the uncapacitated formulation (P ). This returns a generalized flow g such that the residual graph Eg contains no flow generating cycles, that is, no cycles C with γ(C) > 1. Let us define µt := 1 and for i ∈ V − t, µi := 1/ max {γ(P ) : P ⊆ Eg is a walk from i to t.} (3) Such a path must exist according to assumption (⋆), and since γ(C) ≤ 1 for all cycles C, the walk giving the maximum can always be chosen to be a path. The µi values can be computed efficiently: note that they correspond to shortest paths with respect to the cost function − log γe. To avoid computing logarithms, we may use a multiplicative version of Dijkstra's algorithm to obtain the µi values in strongly polynomial time. After the cycle cancelling subroutine and computing the µi values, the subroutine Tight Flow(V, µ) is called, as described in Section 2.5. This computes a generalized flow f ′. We set f = f ′, and set the initial ∆ = ¯∆ := maxi∈V −t eµ i . 2.7 The Elementary step subroutine Let (f, µ) be a ∆-feasible pair for ∆ > 0. Let T ⊆ V be a (possibly empty) set of nodes with eµ i ≤ 4(di + 2)∆ for every i ∈ V , with strict inequality whenever i ∈ V \ T . The subroutine (Figure 2) perfoms the following modifications for some α > 1. The µi values are multiplied by α for i ∈ T , and left unchanged for i ∈ V \ T . The new value of the scaling parameter is set to ∆/α. Finally, the flow on non-tight arcs ij ∈ F µ[V \ T ] and on all arcs ij ∈ E[V \ T, T ] is divided by α. The value of α is chosen maximal such that for the new values of f, µ, and ∆, (f, µ) is ∆-feasible, and further the modified excess ei ≤ 4(di + 2)∆µi holds for every i ∈ V . For the latter, we need the 14 Subroutine Elementary step(T, T0, f, µ, ∆) α1 ← min {δi : i ∈ (V \ T ) − t}, with δi as defined in (5) ; α2 ← min(cid:26) 1 γµ ij : ij ∈ E[T, V \ T ](cid:27) ; α ← min{α1, α2} ; if α = ∞ then set fti = 0 for all ti ∈ E: γµ return optimal flow f and optimal relabeling µ ; TERMINATE. ti < 1 ; α ; ∆ ← ∆ for i ∈ T do µi ← αµi ; for ij ∈ F µ[V \ T ] ∪ E[V \ T, T ] do fij ← fij T0 ← T0 ∪ {i : i ∈ V \ T, eµ i = 4(di + 2)∆} ; T ← T ∪ T0 ; if ∃i ∈ T0 : eµ i < (di + 2)∆ then α ; T0 ← T0 \ {i : eµ T ← T0 ; i < (di + 2)∆} ; Figure 2: The Elementary Step subroutine r1(i) :=Pj:ji∈F1(i) γjifji, r2(i) :=Pj:ji∈F2(i) γjifji, r3(i) :=Pj:ij∈F3(i) fij, r4(i) :=Pj:ij∈F4(i) fij. (4) following definitions for every i ∈ (V \ T ) − t. Let F1(i) := δin(i) ∩ F µ[V \ T ], F2(i) := δin(i) \ F1(i), F3(i) := δout(i) ∩ (F µ[V \ T ] ∪ E[V \ T, T ]), F4(i) := δout(i) \ F3(i), Note that F1(i) and F3(i) denote the set of those incoming and outgoing arcs where we wish to decrease the flow by a factor α. For every i ∈ (V \ T ) − t, let us define δi := 4(di + 2)∆µi + r3(i) − r1(i) r2(i) − r4(i) − bi . (5) If the denominator is 0 then δi := ∞ is set. We shall verify in the proof of Lemma 3.3 that the denominator is always nonnegative and the numerator is positive. The subroutine (Figure 2) chooses α as the largest value subject to α ≤ δi for all i ∈ (V \ T ) − t, for all arcs ij ∈ E leaving the set T . If α = ∞, then f becomes an optimal solution, and α ≤ 1 γµ ij after setting the value on all non-tight arcs leaving t to 0. If α is finite, the algorithm performs the above described modifications. Nodes i with eµ i = 4(di + 2)∆ (that is, α = δi) are added to both T0 and T . Finally, if eµ i drops below (di + 2)∆ for some i ∈ T0, then all such nodes i will be removed from T0, and T is reset to T = T0. The validity of this subroutine is proved in Lemma 3.3. 3 Analysis of the Continuous Scaling algorithm Lemma 3.1. The subroutine Initialize(V, E, b, γ, ¯f ) returns a ∆-feasible pair (f, µ) with eµ (di + 2)∆ for every i ∈ V − t, and ∆ = ¯∆ ≤ n ¯B2. i ≤ 15 Proof. First, we have to verify that the flow problem in Tight-flow(V, µ) is feasible. We use the generalized flow g obtained by the Maximum-mean-gain cycle-canceling algorithm to verify this, by showing that µ is a conservative labeling for g. The nontrivial part is to prove γµ ij ≤ 1 for every residual arc ij ∈ Eg. Let ij ∈ Eg be an arbitrary residual arc. Consider the j − t path P j with µj = 1/γ(P j ) in (3). Let P ′ denote the path resulting by adding the arc ij ∈ Eg to the beginning of P j. Then by definition, 1/µi ≥ γ(P ′) = γij/µj, showing γµ Let us now consider the maximum flow instance in Tight-flow(V, µ). Setting xij := gµ ij ≤ 1. ij if ji for every i ∈ V − t gives a feasible solution. This ij ∈ E and xsi := Pj:ij∈E gµ ij − Pj:ji∈E gµ guarantees the existence of the optimal solution f ′. is ∆-feasible for arbitrary ∆ > 0. The condition eµ It is straightforward by the construction that µ is a conservative labeling for f , and hence (f, µ) i ≤ (di + 2)∆ is also straightforward by definition. Let us verify the bound on ∆. By Theorem 2.6(ii), we have ∆ ≤ n maxi∈V −t bi/µi. Our assumption on the encoding sizes give bi ≤ ¯B. Further, we have 1/µi ≤ ¯B, according to the definition of 1/µi = γ(P i) for some i− t path P i, and the encoding assumptions on the γe values. The next straightforward claim justifies the path augmentation step carried out between p ∈ T0 and q ∈ N ∩ T whenever N ∩ T 6= ∅. Claim 3.2. Let (f, µ) be a ∆-feasible pair, and assume P is a tight path in Eµ f (∆) from node p to node q, with eµ p . Let us increase fij by ∆µi if ij ∈ P is a forward arc, and decrease fji by ∆µj if ij ∈ P is a backward arc; let f ′ denote the resulting flow. Then (f ′, µ) is also a ∆-feasible pair. p (f ) ≥ ∆ + Rµ We next prove some fundamental properties of the subroutine Elementary step, most im- portantly, that it maintains the ∆-feasibility of (f, µ). By induction, we may assume that the four conditions in the lemma always hold when Elementary step(T, T0, f, µ, ∆) is called in the algorithm. Lemma 3.3. Let (f, µ) be a ∆-feasible pair for some ∆ > 0, and let T ⊆ V − t satisfy the following conditions: • eµ i < 4(di + 2)∆ for all i ∈ (V \ T ) − t; • eµ i ≥ (di + 1)∆ for all i ∈ T ; • γµ ij < 1 for all ij ∈ E[T, V \ T ]; • f µ ij ≤ ∆ for all ij ∈ E[V \ T, T ]. Let f ′, µ′, ∆′, and e′ If α < ∞, then the pair (f ′, µ′) is ∆′-feasible. Further, the following statements hold. i denote the respective values at the end of Elementary step(T, T0, f, µ, ∆). (i) α > 1. If α = ∞ then the modified flow returned by the algorithm is optimal to (P ), and µ is optimal to (D). (ii) e′ i µ′ i ≤ 4(di + 2)∆′ for all i ∈ V \ T , and if α = α1, then ∃i ∈ V \ T such that equality holds. (iii) e′ i ≤ ei for all i ∈ T . (iv) If α = α2 then ∃ij ∈ E with i ∈ T , j ∈ V \ T , and γµ′ ij = 1. 16 ij. If ij ∈ E[T, V \ T ], then we have γµ′ Proof. For ∆′-feasibility, let us first verify γµ′ γµ′ ij = γµ ij ∈ E[V \ T, T ], then γµ′ for ∆′-feasibility. Claim 3.4. If γµ′ ij < 1 for an arc ij ∈ E, then f ′ ij ij = γµ ij ≤ 1 for all ij ∈ E. If ij ∈ E[T ] or ij ∈ E[V \ T ], then ij ≤ 1 due to the choice α ≤ α2. Finally, if ij/α < 1. The next two claims verify the remaining properties needed ij = αγµ µ′ = f µ ij/α ≤ ∆/α = ∆′. Proof. Let us first assume i ∈ T ; the first equality follows by f ′ f µ ij ≤ ∆ is due to the ∆-feasibility of f , because of γµ assumptions, whereas if j ∈ T , then it follows by γµ ij < 1. Consider now the case i ∈ V \ T . If also j ∈ V \ T , then γµ ij = fij, µ′ i = µiα. The inequality ij < 1. If j ∈ V \ T , this is included among the ij = γµ′ ij < 1, and hence f ′ ij = γµ′ we decrease the flow values by a factor α on arcs F µ[V \ T ]; the inequality f µ the ∆-feasibility of f . If j ∈ T , that is, ij ∈ E[V \ T, T ], then we must again have f ′ f µ ij ≤ ∆ is included among the assumptions. ij = fij/α, as ij ≤ ∆ follows again by ij = fij/α, and Claim 3.5. The inequality e′ on non-tight arcs for µ′. i ≥ R′ i holds for all i ∈ V − t, where R′ i denotes the f ′ flow entering i Proof. We have ei ≥ Ri by the ∆-feasibility of f . Case I: i ∈ V \ T . Since f ′ ≤ f , the change of flow on outgoing arcs may only increase ei. If ji < fji on an incoming arc ji ∈ E, then j ∈ V \ T must hold. Therefore γµ′ f ′ ji, and hence ji must be a non-tight arc for both µ and µ′. The change on ji decreases ei by (1 − 1/α)γjifji, and causes the same change in the value of Ri. Case II: i ∈ T . By the assumption of the lemma, eµ is unchanged. Let ji ∈ E be an incoming arc with f ′ fji ≤ ∆µj by assumption; further, γµ γjifji < ∆γjiµj ≤ ∆µi. This enables us to bound the value e′ with j ∈ V \ T . Using also the assumption ei ≥ (di + 1)∆µi, we have i ≥ (di + 1)∆. The flow on outgoing arcs ji < fji. We must have j ∈ V \ T and thus ji ≤ 1 by the ∆-feasibility of (f, µ). Hence it follows that i. Let λ denote the number of arcs ji ji = γµ e′ i = ei − Xj∈V \T :ji∈E ≥ Xj∈V \T :ji∈E γjif ′ (γjifji − γjif ′ ji) ≥ ei − Xj∈V \T :ji∈E ji + (di + 1 − λ)∆µi > R′ i. (∆µi − γjif ′ ji) In the last inequality, we use that if ji is a non-tight arc with j ∈ T , then γjif ′ that the total number of such arcs is ≤ di − λ. ji ≤ ∆′µ′ i = ∆µi, and Let us now verify claims (i)-(iv). We first show that in the formula (5) defining δi, the denomi- nator is nonnegative and δi > 1. Note that r1(i) + r2(i) − r3(i) − r4(i) − bi = ei ≥ Ri ≥ r1(i). (6) The equality is by the definition of the four terms; the first inequality is required by ∆-feasibility, and the second since the definition of Ri includes all terms in r1(i). This shows that the denominator is r2(i) − r4(i) − bi ≥ r3(i) ≥ 0. The inequality δi > 1 then follows by the equality in (6) and the assumption 4(di + 2)∆µi > ei. For (i), the above argument gives α1 > 1. It is easy to see that α2 > 1, and hence α > 1 follows. For the second part, let us analyze the α = ∞ case. First, we show that T = ∅ must hold. For a contradiction, assume T 6= ∅. We have t ∈ V \ T is assumed, and every j ∈ V − t is connected by an 17 arc to t by (⋆). Therefore the set of arcs defining α2 is always nonempty, showing that α must be finite. We thus have T = ∅. Since α1 = ∞, we must have δi = ∞ for every i ∈ V − t, that is, the denominator in (5) is always 0. According to (6), this is only possible if r3(i) = 0 for every i ∈ V − t. This means that for every ij ∈ F µ, if fij > 0, then i = t must hold. As a further consequence of (6), we have ei = Ri = r1(i) for every i ∈ V − t. Combining these two, for every i ∈ V − t we obtain ei = r1(i) = γtifti if ti ∈ F µ, and ei = r1(i) = 0 if ti /∈ F µ. After the algorithm sets the value of all these arcs to 0, µ becomes a conservative labeling, and ei = 0 for all i ∈ V − t, yielding primal and dual optimality according to Theorem 2.3(i). Let us now prove claim (ii). The flow on the arcs incident to i is divided by α on all arcs in µ′ i ≤ 4(di + 2)∆′ follows F1(i) and F3(i), and left unchanged on arcs in F2(i) and F4(i). Therefore, e′ i whenever α ≤ δi. The claims on nodes/arcs with equalities in (ii) and (iv) are straightforward. Finally, (iii) follows since if i ∈ T , then the flow is unchanged on outgoing arcs and on arcs incoming from T , but decreases on arcs incoming from V \ T . 3.1 Bounding the number of iterations Let ∆(τ ) denote the value of the scaling factor at the beginning of the τ 'th iteration; clearly, ∆(1) ≥ ∆(2) ≥ . . . ≥ ∆(τ ). Let f (τ ), µ(τ ), e(τ ) and T (τ ) denote the respective vectors and set T at the beginning of iteration τ . Let us classify the iterations into three categories. The iteration θ is shrinking, if T (θ)\T (θ+1) 6= ∅. Every iteration with a path augmentation is shrinking, since T is reset to T0, although it contained some other nodes, in particular, the endpoint q of the path previously. The other type of shrinking iteration is when Elementary step is performed, and for some i ∈ T0, the value of eµ is decreased i below (di + 2)∆. The iteration θ is expanding, if T (θ) ( T (θ+1). This can either happen if the iteration only consists of extending T by adding a new node reachable by a tight arc in the ∆-fat graph, or if T0 is extended in Elementary step, and no node is removed from T0. An iteration that is neither shrinking nor expanding is called neutral. Note that in a neutral iteration we must perform Elementary step, and further we must have T (θ) = T (θ+1). We claim that the iteration following the neutral iteration θ must be either expanding or shrinking. Indeed, if T (θ+1) ∩ N (θ+1) 6= ∅, then it will be shrinking. Otherwise, Lemma 3.3(iv) guarantees that it must be expanding. The main goal of this section is to prove the following lemma. Lemma 3.6. For the starting value ∆(1) = ¯∆ and arbitrary integer τ ≥ 1, we have Further, the total number of shrinking iterations among the first τ is at most τ ≤ 26mn log2 ¯∆ ∆(τ +1) . 13m log2 ¯∆ ∆(τ +1) . An important quantity in our analysis will be βi := ei ∆µi ; let β(τ ) denote the corresponding value at the beginning of iteration τ . Let α(τ ) denote the value of α in iteration τ if the subroutine Elementary Step is called, and let α(τ ) = 1 otherwise. Note i 18 that the value of the scaling factor only changes in the subroutine Elementary Step. Therefore ¯∆ ∆(τ +1) = Yθ∈[1,τ ] α(θ) ∀τ ∈ Z, τ > 1. Lemma 3.7. During the first τ iterations, a node i may enter the set T0 altogether at most log2 times. ¯∆ ∆(τ +1) Before proving the lemma, let us show how it can be used to bound the number of iterations. Proof of Lemma 3.6. Let us consider the potential ⌊βi − (di + 1)⌋. Ψ := Xi∈T0 (7) Initially, T0 = ∅ and therefore Ψ = 0. Note that every term is positive in every step of the algorithm, since nodes with βi < (di + 2) are immediately removed from T0. The subroutine Elementary step may only decrease the value of Ψ: Lemma 3.3(iii) guarantees that if i ∈ T0, then βi may only decrease during the subroutine, since e′ i ≤ ei and ∆′µ′ i = ∆µi. Every shrinking iteration must decrease Ψ by at least one. Indeed, a path augmentation decreases ep by ∆µp for the starting node p, which decreases ⌊βp − (dp + 1)⌋ by one. No other βi value is modified for i ∈ T0. Next, consider the case when a shrinking iteration removes some nodes i from T0 after performing Elementary step because of βi < (di + 2). In the previous iteration, we must have had βi ≥ (di + 2) for such nodes, hence Ψ decreases by at least 1. When a node i enters T0, then it increases Ψ by (3di + 7). Assume that the node i enters T0 ∆(τ +1) . Therefore altogether λi times between iterations 1 and τ . Then Lemma 3.7 gives λi ≤ log2 the total increase in the Ψ value between iterations 1 and τ is bounded by ¯∆ Xi∈V −t (3di + 7)λi ≤ Xi∈V −t (3di + 7) log2 ¯∆ ∆(τ +1) ≤ (6m + 7n) log2 ¯∆ ∆(τ +1) ≤ 13m log2 ¯∆ ∆(τ +1) This bounds the number of shrinking iterations (recall the assumption n ≤ m). Between two subse- quent shrinking iterations, all phases are expanding or neutral. Every expanding iteration increases T , and every neutral iteration is followed by a shrinking or an expanding iteration. Therefore the total number of iterations between two subsequent shrinking iterations is ≤ 2n, giving an overall bound 26mn log2 ¯∆ ∆(τ +1) on the number of iterations. The proof of Lemma 3.7 is based on the following simple claim. Claim 3.8. Let β′ that computes the value α. For every node i ∈ V − t, we have i denote the new value of βi after performing the subroutine Elementary Step(T, T0, f, µ, ∆), β′ i ≤ α2 max {βi, di} . Proof. Let ∆ and ∆′ = ∆/α denote the scaling factor before and after performing the subroutine Elementary Step(T, T0, f, µ, ∆). If i ∈ T , then e′ i = ∆µi, and i ≤ βi, implying the claim. Assume therefore that i ∈ V \ T . We have f ′ ≤ f , and the flow hence β′ i ≤ ei by Lemma 3.3(iii) and ∆′µ′ 19 changes on arcs entering i may only decrease ei. Recall that F3(i) denotes the set of outgoing arcs ij where f ′ ij < fij. Note that fij ≤ ∆µi on every such arc. We get the upper bound e′ i ≤ ei + Xj:ij∈F3(i) (1 − 1/α)fij ≤ ei + (1 − 1/α)F3(i)∆µi ≤ ei + (α − 1)F3(i)∆µi. In the last inequality, we used 1 − 1/α ≤ α − 1, which is true for every α > 0. Using further that ∆′µ′ i = ∆µi/α, we get β′ i = e′ i ∆′µ′ i ≤ α(ei + (α − 1)F3(i)∆µi) ∆µi = α ei ∆µi + (α − 1)F3(i) ≤ αβi + (α − 1)di ≤ (2α − 1) max{βi, di} ≤ α2 max{βi, di}, completing the proof. Proof of Lemma 3.7. Let τ1 < τ2 < . . . < τλ ≤ τ denote the iterations when i enters T0 up to iteration τ . This means that β(τℓ+1) = 4(di + 2) for 1 ≤ ℓ ≤ λ. i For 1 ≤ ℓ ≤ λ, let us define τ ′ that these values must exist and satisfy τℓ−1 < τ ′ that at the beginning of the algorithm β(1) iteration θ between τℓ−1 and τℓ, and this can happen only if β(θ) ℓ to be the largest value τ ′ (τ ′ ℓ) i < (di + 2). Note ℓ ≤ τℓ for ℓ > 1. Indeed, for ℓ = 1, we assumed i < (di + 2). For ℓ > 1, note that i must leave T0 in some ℓ ≤ τℓ such that β i < (di + 2). In iteration τ ′ ℓ, we have i /∈ T0, since once the excess ei drops below (di + 2)∆µi, the node i is immediately removed from T0. By definition, i will be added to T0 in iteration τℓ. The ei values may change in two ways between iterations τ ′ ℓ and τℓ: either during a path aug- mentation or in the subroutine Elementary step. We claim that no path augmentation changes ei in the iterations τ ′ ℓ ≤ θ ≤ τℓ. Indeed, the only values that change are at the starting point p and endpoints q of the tight path P . We cannot have i = p as i /∈ T0 during these iterations. Assume now i = q is the endpoint; therefore e(θ) i < (di + 1)∆(θ)µ(θ) . This clearly cannot be the case for ℓ. Let us consider the case θ = τ ′ ℓ < θ ≤ τℓ by the maximal choice of τ ′ τ ′ ℓ. The path augmentation (τ ′ (τ ′ ℓ) ℓ) i < (di + 1)∆(τ ′ , and terminating in i = q increases e i therefore . However, we had e by ∆(τ ′ (τ ′ ℓ) i (τ ′ ℓ) i ℓ)µ ℓ)µ i ℓ+1) (τ ′ e i = e (τ ′ ℓ) i + ∆(τ ′ ℓ)µ (τ ′ ℓ) i < (di + 2)∆(τ ′ ℓ+1)µ (τ ′ i ℓ+1) , again a contradiction to the choice of τ ′ then the values of ∆ and µ do not change). ℓ. (Note that if a path augmentation is done in iteration τ ′ ℓ, Hence all changes in the value of ei are due to modifications in Elementary step. Consequently, (8) . The same β(θ) ≤(cid:0)α(θ)(cid:1)2 4 = 4(di + 2) (di + 2) < β(τℓ+1) max{β(τ ′ ℓ), di} ≤ β(τ ′ ℓ+1) max{β(τ ′ ℓ), di} Yθ∈[τ ′ ℓ+1,τℓ] β(θ+1) β(θ) For θ ∈ [τ ′ ℓ + 1, τℓ], we assumed β(θ) > di, and hence Claim 3.8 gives that β(θ+1) ℓ)(cid:17)2 claim bounds the first term by ≤(cid:16)α(τ ′ 4 ≤  Yθ∈[τ ′ ℓ,τℓ] . Hence we get 2 α(θ)  . 20 Adding the logarithms of these inequalities for all ℓ = 1, . . . , λ, we obtain log2 α(θ) = log2 ¯∆ ∆(τ +1) , λ ≤ Xθ∈[1,τ ] completing the proof. 3.2 The termination of the algorithm The algorithm either terminates in Elementary step or by the final subroutine Tight-flow(V, µ). Optimality for the first case was already proved in Lemma 3.3(i). The next claim addresses the second case. Lemma 3.9. The final f ′ and µ returned by the subroutine Tight-flow(V, µ) are a primal and a dual optimal solution to (P ) and (D), respectively. Proof. We show that the flow problem in Tight-flow(V, µ) is feasible and Exµ(f ′) < 1/ ¯B3. Then optimality follows by Theorem 2.6(iii). At the termination of the While iterations of the algorithm Continuous Scaling, we have Exµ(f ) = Xi∈V −t eµ i ≤ 4∆Xi∈V (di + 2) = (8m + 8n)∆. Let us define f by fij = 0 if ij ∈ F µ and fij = fij otherwise. By Lemma 2.4, Exµ( f ) < Exµ(f ) + F µ∆ ≤ (9m + 8n)∆ < 1/ ¯B3, since ∆ < 1/(17m ¯B3) at the termination. The proof is complete by verifying the feasibility of the flow problem and showing that Exµ(f ′) ≤ Exµ( f ). notation introduced in the description of the subroutine in Section 2.5. Let xij := f µ Let us define the feasible solution x to the flow problem in Tight Flow as follows. We use the ij for ij ∈ E. f µ ji. The conservativeness of f implies i = usi. Therefore x is a feasible solution to the flow problem. The value of this flow Further, for i ∈ V − t, let us set xsi := Pj:ij∈E that xsi ≤ −bµ x (i.e. the sum of the flow on the arcs leaving s) is ij −Pj:ji∈E f µ Xi∈ V −t xsi = − Xi∈V −t (bµ i + eµ i ( f )) = −Exµ( f ) − Xi∈V −t bµ i . Similarly, the value of the flow x found by Tight Flow is −Exµ(f ′) − Pi∈V −t bµ maximal, it follows that Exµ(f ′) ≤ Exµ( f ). i . Since x is 3.3 Running time analysis Proof of Theorem 2.7. The starting value of the scaling factor is ¯∆ ≤ n ¯B2 by Lemma 3.1, and we terminate once ∆(τ +1) < 1/(17m ¯B3). Therefore log ∆(τ +1) ∈ O(log ¯B) (we may assume log ¯B is larger than m). According to Lemma 3.6, the number of iterations of the algorithm is O(mn log ¯B), out of them O(m log ¯B) shrinking ones. We have to execute two maximum flow computations, that can be done in O(nm) time using the recent algorithm by Orlin [24]. The initial cycle canceling subroutine can be executed in time O(m2n log2 n), see Radzik [25]. The proof is complete by showing that the part of the algorithm between two shrinking iterations can be implemented in O(m+n log n) time. ¯∆ 21 We implement all these iterations together via a Dijkstra-type algorithm, using the Fibonacci- heap data structure [7], see also [2, Chapter 4.7]. The precise details are given in Section 6, see Figure 5; here we outline the main ideas only. Each label is modified only once, at the beginning of the subsequent shrinking iteration; for every i, it is sufficient to record the value of α at the moment when i enters T . We have to modify the fij values accordingly. We maintain a heap with elements i ∈ V \ T , with five keys associated to each of them. The main key for i ∈ V \ T corresponds to the minimum of the 1/γµ ji's for j ∈ T , and of δi. The four auxiliary keys store the flow values r1(i), . . . , r4(i), as in the definition (5) of δi. We choose the next i who enters T with the minimal main key. If the minimal key corresponds to the δi value, then i enters both T and T0; otherwise, it enters only T . We remove i from the heap, and update the keys on the adjacent nodes. We maintain another heap structure on T to identify events when for a node i ∈ T0, eµ i < (di + 2)∆ happens, or when a node in T \ T0 enters N . Overall, these modifications entail O(m) key modifications only; the keys can be initialized in total time O(m). We therefore obtain the running time O(m+n log n) as for Dijkstra's algorithm. 4 The strongly polynomial algorithm The while loop of the algorithm Enhanced Continuous Scaling proceeds very similarly to Con- tinuous Scaling, with the addition of the special subroutine Filtration, described in Section 4.2. However, the termination criterion is quite different. As discussed in Section 2.4, the goal is to find a node i ∈ V − t with bµ i ∆ ≥ 32mn. There must be an abundant arc incident to such a node that we can contract and continue the algorithm in the smaller graph. Section 4.1 describes the abundant arcs and the contraction operation. Let us now give some motivation for the algorithm; we focus on the sequence of iterations leading to the first abundant arc. Consider the set D :=(cid:26)i ∈ V − t : bµ i ∆ ≥ 1 n(cid:27) . Our aim is to guarantee that most iterations when ∆ is multiplied by α will multiply bµ i ∆ by α for some i ∈ D. This will ensure that bµ i ∆ ≥ 32mn happens within O(nm log n) number of steps. Note that in the subroutine Elementary step(T, f, µ, ∆), the bµ i ∆ ratio is multiplied by α for all nodes i ∈ V \ T and remains unchanged for i ∈ T . Therefore we modify the while loop of Continuous Scaling as follows. If (V \ T ) ∩ D 6= ∅, Elementary step(T, f, µ, ∆) is performed identically. If (V \T )∩D = ∅, then before Elementary step(T, f, µ, ∆), the special subroutine Filtration(V \T, f, µ) is executed, performing the following changes. The value of f is set to 0 for every arc entering T , and fij is left unchanged for i ∈ T . The flow value on arcs inside E[V \ T ] is replaced by an entirely new flow f ′ computed by Tight Flow(V \ T, µ). An important part of the analysis is Theorem 2.6(ii), asserting that eµ i (f ′) ≤ n maxj∈(V \T )−t bµ j . This will imply that either the set D must be extended in the iteration following Filtration(V \ T, f, µ), or there must be a shrinking one among the next two iterations (Lemma 5.11(ii)). Note that once a node enters D, it stays there until the next contraction. 4.1 Abundant arcs and contractions Given a ∆-feasible pair (f, µ), we say that an arc pq ∈ E is abundant, if f µ pq ≥ 17m∆. The importance of abundant arcs is that they must be tight in all dual optimal solutions. This is a corollary of the 22 following theorem. Theorem 4.1. Let (f, µ) be a ∆-feasible pair. Then there exists an optimal solution f ∗ such that f µ − f ∗µ∞ ≤ Exµ(f ) + (F µ + 1)∆. The standard proof using flow decompositions is given in the Appendix; it can also be derived from Lemma 5 in Radzik [26]. For the flow f in an iteration with scaling factor ∆, we have Exµ(f ) ≤Pi∈V −t 4(di + 2)∆ < (8m + 8n − 8)∆ ≤ (16m − 8)∆. Further, F µ ≤ m. This gives the following corollary; the last part follows by primal-dual slackness conditions. Corollary 4.2. Let (f, µ) be the ∆-feasible pair during the algorithm. If for an arc pq ∈ E, f µ 17m∆, then f ∗ optimal solution µ∗ to (D). pq > 0 for some optimal solution f ∗ to (P ). Consequently, γpqµ∗ pq ≥ q for every p = µ∗ Once an abundant arc pq is identified in the Enhanced Continuous Scaling algorithm, it is possible to reduce the problem by contracting pq. Consider the problem instance (V, E, t, b, γ). The contraction of the arc pq returns a problem instance (V ′, E′, t′, b′, γ′) with t′ := t, as follows. Case I: p 6= t. Let V ′ = V \ {p}, and add an arc ij ∈ E′ if ij ∈ E and i, j 6= p. For every arc ip ∈ E, add an arc iq ∈ E′, and for every arc pi ∈ E, i 6= q, add an arc qi ∈ E′. Set the gain factors as γ′ i := bi if i 6= q, and b′ q := bq + γpqbp. qi := γpi/γpq. Let us set b′ ij := γij if i, j 6= p, γ′ iq := γipγpq and γ′ Case II: p = t. Let V ′ = V \ {q}, and add an arc ij ∈ E′ if ij ∈ E and i, j 6= q. For every arc iq ∈ E, i 6= p, add an arc ip ∈ E′, and for every arc qi ∈ E, add an arc pi ∈ E′. Set the gain factors as γ′ i := bi if i 6= p, and b′ p := bp + bq/γpq. pi := γqiγpq. Let us set b′ ij := γij if i, j 6= p, γ′ ip := γiq/γpq and γ′ In both cases, if parallel arcs are created, keep only one that maximizes the γ′ value. Let s := q in the first and s := p in the second case. If a loop incident to s is created (corresponding to a qp arc), remove it. Assume further we are given a generalized flow f and a labeling µ with γµ pq = 1 in the instance. i = µi for all i ∈ V ′ in both cases. Note that we We define the image labels µ′, by simply setting µ′ will have b′ s p + bµ = bµ µ′ q in both cases. As for the generalized flow, let f ′ is := fip + fiq. Further, in Case I, we let f ′ si := fpi + fqi/γpq. If one of these arcs is not in E, then we substitute the corresponding value by 0. Recall that in the construction, we keep the larger gain factor from two parallel incoming or outgoing arcs. ij := fij whenever i, j 6= s. For every i ∈ V ′ \ {s}, we let f ′ si := γpqfpi + fqi, whereas in Case II, we let f ′ The above transformation of an instance, generalized flow and labels will be executed by the subroutine Contract(pq). Note that if the original instance satisfies (⋆), (⋆⋆), and (⋆ ⋆ ⋆), then these also hold for the contracted instance; the contracted image of the initial feasible solution ¯f is feasible for the contracted instance. Let us also describe the reverse operation, Reverse(pq), that transforms a dual solution on the contracted instance to a dual solution in the original one. Assume µ′ is a dual solution in the graph obtained by the contraction of pq. Let us set µi := µ′ i for all i ∈ V − s. In the first case (p 6= t, s = q), let us set µp := µ′ q/γpq, whereas in the second case (p = t, s = p), let us set µq := µ′ pγpq = γpq. 4.2 The Filtration subroutine A typical iteration of the Enhanced Continuous Scaling algorithm (Figure 4) will be the same as in Continuous Scaling, with adding one additional subroutine, Filtration(V \ T, f, µ) before 23 performing Elementary step(T, T0, f, µ, ∆). This subroutine is executed if bµ for all i ∈ (V \ T ) − t, where k is the number of arcs contracted so far, initially k = 0. i < ∆/(16kn) holds Filtration(V \ T, f, µ) (Figure 3) performs the subroutine Tight Flow(V \ T, µ), as described in Section 2.5. This replaces f by an entirely new flow f ′ on the arcs in E[V \ T ]. We further set fij = 0 on all arcs entering T , and keep the original f value on all other arcs (that is, arcs in E[T ] ∪ E[T, V \ T ]). Subroutine Filtration(V \ T, f, µ) f ′ ← Tight Flow(V \ T, µ) ; for ij ∈ E do if ij ∈ E[V \ T ] then fij ← f ′ ij ; if ij ∈ E[V \ T, T ] then fij ← 0 ; Figure 3: The Filtration subroutine 4.3 The Enhanced Continuous Scaling Algorithm We are ready to describe our strongly polynomial algorithm, shown on Figure 4. The algorithm consists of iterations similar to Continuous Scaling, with the addition of the above described Filtration subroutine. This subroutine might decrease eµ i values below (di + 2)∆ for some i ∈ T0; also, eµ i < (di +1)∆ might happen for some i ∈ T , that is, i is added to the set N ∩T . If either of these events happen, we proceed to the next iteration without performing the subroutine Elementary step(T, T0, f, µ, ∆). Further, if there are nodes i ∈ T0 where the eµ i values drop below (di + 2)∆, then we remove all such nodes from T0, and reset T = T0. The termination criterion is not on the value of ∆, but on the size of the graph: we terminate once it is reduced to a single node. The main progress is done when an abundant arc pq appears: in this case, we first set the flow value on every non-tight arc to 0, and then reduce the number of nodes by one using the above described subroutine Contract(pq). Further, the value of the scaling factor ∆ is multiplied by 16, and the counter k is increased by one. The sets T0 and T are reset to ∅. A sequence of such contractions is performed until all abundant arcs are contracted. The iterations between two phases where contractions are performed (and those up to the first contraction) will be referred to as a major cycle of the algorithm. In the description and the analysis, n and m will always refer to the size of the original instance and not the actual contracted one. At termination, the subroutine Expand-to-Original finds primal and dual optimal solutions in the original graph. This is done by first expanding all contracted arcs pq by the subroutine Reverse(pq), taking these arcs in the reverse order of their contraction. Hence we obtain a dual op- timal solution µ∗ in the original graph (see Lemma 5.1). Finally, the subroutine Tight-flow(V, µ∗) obtains a primal optimal solution, as guaranteed by Theorem 2.6(i). Theorem 4.3. The algorithm Enhanced Continuous Scaling finds an optimal solution for the uncapacitated formulation (P ) in running time O(n3m2) elementary arithmetic operations and comparisons. To get a truly strongly polynomial algorithm, we also need to guarantee that the size of the numbers during the computations remain polynomially bounded. We shall modify the algorithm in Section 6 by incorporating additional rounding steps to achieve that. 24 Algorithm Enhanced Continuous Scaling Initialize(V, E, b, γ, ¯f ) ; T0 ← ∅ ; T ← ∅ ; k ← 0 ; While V > 1 do N ← {t} ∪ {i ∈ V − t : eµ if N ∩ T 6= ∅ then i < (di + 1)∆} ; pick p ∈ T0, q ∈ N ∩ T connected by a tight path P in Eµ send ∆ units of relabeled flow from p to q along P ; if eµ T ← T0 ; p < (dp + 2)∆ then T0 ← T0 \ {p} ; f (∆) ; else if ∃ij ∈ Eµ else f (∆), γµ ij = 1, i ∈ T , j ∈ V \ T then T ← T ∪ {j} ; if (eµ if (cid:0)∀i ∈ (V \ T ) − t : bµ i ≥ (di + 2)∆ for all i ∈ T0) and (eµ then Elementary step(T, T0, f, µ, ∆) ; 16kn(cid:1) then Filtration(V \ T, f, µ) ; i ≥ (di + 1)∆ for all i ∈ T ) i < ∆ elseif ∃i ∈ T0 : eµ T0 ← T0 \ {i : eµ T ← T0 ; i < (di + 2)∆ then i < (di + 2)∆} ; while ∃ pq ∈ E: f µ pq ≥ 17m∆ do ij < 1 do fij ← 0 ; for all ij ∈ E : γµ Contract(pq) ; ∆ ← 16∆ ; k ← k + 1 ; T0 ← ∅ ; T ← ∅ ; Expand-to-Original(µ) ; Figure 4: Description of the strongly polynomial algorithm We remark that the algorithm can be simplified by terminating once the first abundant arc is found, and restarting from scratch on the contracted graph. This would give a running time bound O(n3m2 log n): hence, we are able to save a factor log n by continuing with the contracted image of the current flow instead of a fresh start. 5 Analysis of the strongly polynomial algorithm In Many properties of the Continuous Scaling algorithm derived in Section 3 remain valid. particular, Lemmas 3.1 and 3.3, and Claims 3.2 and 3.8 are applicable with repeating the proofs verbatim. The argument bounding the number of iterations will be an extension of the one in Section 3.1. 25 5.1 Properties of dual solutions Let us first verify that expanding the dual optimal solution of the contracted instance results in a valid dual optimal solution of the original instance. q for every optimal solution µ∗ to (D) for Lemma 5.1. Assume that pq ∈ E satisfies γpqµ∗ the problem instance (V, E, t, b, γ). Let µ′ be an optimal solution to (D) to the contracted instance (V ′, E′, t′, b′, γ′) obtained by the subroutine Contract(pq). If p 6= t, then let µi := µ′ i for every i ∈ V − p and let µp := µ′ i for every i ∈ V − q and let µq = γpq. Then µ is an optimal solution to (D) in the original instance (V, E, t, b, γ). q/γpq. If p = t, then let µi := µ′ p = µ∗ Proof. We give the proof to the p 6= t case only; the other case follows similarly. First, let us verify that µ is a feasible solution to (D). It is straightforward that µt = 1 and µi > 0 if i ∈ V − t. Also, γµ ij ≤ 1 is straightforward if i, j 6= q, and γµ pq = 1. For an arc ip ∈ E, let iq ∈ E′ denote its image. Then γ′ pi ≤ 1 for iq every pi ∈ E analogously. ≤ 1, which can be written as γipγpq ip ≤ 1. One can verify γµ ≤ 1, giving γµ µpγpq µ′ i µ′ q µi Assume for a contradiction that µ is not optimal to (D): there exists an optimal solution µ∗ q must hold. Consider the restriction of µ∗ to V ′ = V \ {p}; it is easy to check that it is feasible to (D) in the contracted instance. Using p = bp + γpqbq, and thus b′ b′ s with Pi∈V bµ∗ i > Pi∈V bµ i . By our assumption, γpqµ∗ q , we obtain a contradiction by q , and b′ s p + bµ∗ p = µ∗ p + bµ = bµ∗ µ′ = bµ µ∗ Xi∈V bµ′ i <Xi∈V bµ∗ i = Xi∈V ′ µ∗ b′ i µ′ b′ i ≤ Xi∈V ′ =Xi∈V µ′ . bi Our next claim justifies that the feasibility properties are maintained during the algorithm. Claim 5.2. Let ∆′ abundant arc pq. Then µ′ is a conservative labeling for f ′, with eµ′ := 16∆, and let f ′ and µ′ denote the flow and labels after contracting the i (f ′) < (di + 2)∆′ for all i ∈ V − t. Proof. Before the contraction, the flow on every non-tight arcs is set to 0; this increases eµ i on every node by at most di∆. Let s = p or s = q denote the contracted node. It is straightforward by the properties of the contraction that if e′ is the image of the arc e, then γµ′ e . Since µ is conservative for f before the contraction, it follows that µ′ is conservative for f ′. e′ = γµ Consider a node i 6= s. Setting the flow values on non-tight arcs to 0 increased eµ i (f ′) = eµ i (f ), and hence eµ′ di∆, and eµ′ contracted node s. There is nothing to prove about eµ′ Before the contraction, we had eµ eµ′ s (f ′) = eµ that eµ′ s (f ′) ≤ (ds + 2)∆′, as required. p (f ) ≤ (5dp + 8)∆, eµ p (f ) + eµ i by at most i (f ′) ≤ (5di + 8)∆ < (di + 2)∆′. Let us now consider the s (f ′) if s = t, hence we may assume s 6= t. q (f ) ≤ (5dq + 8)∆, and it is easy to verify that 2 − 1, implying q (f ) ≤ (5dp + 5dq + 16)∆. Note that ds ≥ max{dp, dq} − 1 ≥ dp+dq 5.2 Bounding the number of iterations Recall the notions of shrinking, expanding and neutral iterations from Section 3.1. We shall prove the following bound. Theorem 5.3. The total number of iterations in Enhanced Continuous Scaling is at most 390n3m, among them at most 195n2m shrinking ones. 26 The ground set V changes due to the arc contractions. Let us say that a node s is born in iteration τ + 1 if s ∈ {p, q} for an abundant arc contracted in iteration τ ; the original nodes are born in iteration 1. Note that we keep the same notation p or q for the new node. Further, we say that a node is alive until the first iteration when an incident arc gets contracted, when it dies. Also note that multiple contractions may happen in the same iteration; in this case, some nodes die immediately after they are born; such nodes will be ignored in the analysis. A key quantity in the analysis is 32mn∆ , Γi := log2 bµ i for all nodes i ∈ V − t. Let Γ(τ ) Γi ≥ 0 must hold for every i ∈ V − t, as otherwise some abundant arcs would appear. denote the value at the beginning of iteration τ . We first show that i Claim 5.4. Γi ≥ 0 holds for all i ∈ V − t in every iteration after the first one. Proof. Assume Γi ≤ 0, that is, bµ i ≥ 32mn∆ holds for some node i ∈ V − t at a certain iteration after the first one. We show that there is an abundant incoming or outgoing arc incident to i. This contradicts the fact that all such arcs were contracted at the end of the previous iteration. Since f is generalized flow in every iteration, we have eµ i ≥ 0. If there are no abundant arcs incident, then f µ ji < 17m∆ on every incoming arc ji and f µ ij < 17m∆ on all outgoing arcs ij. First, consider the case when bµ i > 0. Now 0 ≤ eµ i = Xj:ji∈E jif µ γµ ji − Xj:ij∈E f µ ij − bµ i < 17dim∆ − 32nm∆ < 0 a contradiction. On the other hand, if bµ i < 0, then (4di + 8)∆ ≥ eµ i = Xj:ji∈E jif µ γµ ji − Xj:ij∈E f µ ij − bµ i > −17dim∆ + 32nm∆ ≥ (15nm + 17m)∆, using di ≤ n − 1. This is a contradiction since m ≥ n ≥ di + 1. Let us introduce the following set; recall that k is the number of abundant arcs contracted so far. D :=(cid:26)i ∈ V − t : bµ i ≥ ∆ 16kn(cid:27) . (9) Let D(τ ) denote this set at the beginning of iteration τ . Note that the condition for calling Filtra- tion in the algorithm is precisely (V \ T ) ∩ D = ∅. Lemma 5.5. (i) The Γ(τ ) i values are monotone decreasing inside every major cycle, and they increase by 4 when an abundant arc is contracted. (ii) After the contraction of k abundant arcs, holds for every i ∈ D(τ ). Γ(τ ) i ≤ 4k + 5 + 4 log2 n (iii) D(τ ) ⊆ D(τ +1) inside a major cycle. When an abundant arc pq is contracted at the end of iteration τ , then D(τ ) \ {p, q} ⊆ D(τ +1) \ {p, q}. 27 Proof. Inside a major cycle of the algorithm, the ratio bµ i /∆ can never decrease: in Elementary step(T, T0, f, µ, ∆), it is unchanged for i ∈ T and increases for i ∈ V \ T . At the end of a major cycle, every ratio bµ i /∆ decreases by a factor of 16. This proves (i). Part (ii) is straightforward by bµ i ≥ ∆/(16kn) and log2(mn2) ≤ 4 log2 n. For part (iii), it is straightforward that if no arcs are contracted, then no node may leave D. Further, when an abundant arc is contracted, the threshold in the definition of D is unchanged since ∆/16k = (16∆)/16k+1. Therefore if i ∈ D \ {p, q} before the contraction, then i remains in D after the contraction. Let us introduce some further classification of iterations. Let C denote the set of iterations when contractions are performed. Clearly, C ≤ n − 1. Let F denote the set of iterations when the subroutine Filtration is performed; such iterations will be called filtrating. Notice that τ ∈ F, that is, iteration τ is filtrating if and only if (V \ T (τ )) ∩ D(τ ) = ∅. Let D denote the set of iterations τ when D is extended: D(τ ) ( D(τ +1). By the above claim, this may happen at most 2n − 1 times, as every node may enter D only once during its lifetime. Hence D ≤ 2n − 1. Let us define Γ(τ ) := Xi∈D(τ ) Γ(τ ) i Claim 5.6. During the entire algorithm, the total increase in the value of Γ(τ ) can be bounded by 14n2. Proof. When a node i enters D after the contraction of k arcs, by Lemma 5.5(ii) we have Γi ≤ 4k + 5 + 4 log2 n. There are ≤ n − 1 − k more contractions, accounting for a total increase of ≤ 4(n − 1 − k) in all later iterations. Hence the total increase for a node i is bounded by 4n + 1 + 4 log2 n ≤ 7n. On the other hand, there are altogether ≤ 2n − 1 nodes born during the entire algorithm. The following claim is straightforward, since for every i ∈ V \ T , bµ i mentary step(T, T0, f, µ, ∆), whereas ∆ decreases by a factor α. is unchanged during Ele- Claim 5.7. If iteration τ /∈ F, then for at least one i ∈ D(τ ), the Γi value decreases by log2 α(τ ). Together with Claim 5.6, it yields the following. Lemma 5.8. During the entire algorithm, we have log2 α(τ ) ≤ 14n2, Xτ /∈C∪F Proof. The right hand side bounds the total increase in Γ according to Claim 5.6. By the previous claim, at least one Γ(τ ) ≥ 0 and therefore Γ(τ ) i ≥ log2 α(τ ), as otherwise an abundant arc incident to i should have been contracted at the end of iteration τ , giving τ ∈ C. decreases by at least log2 α(τ ) in iteration τ /∈ F. By Claim 5.4, Γ(τ +1) i i The following lemma is the analogue of Lemma 3.7. Lemma 5.9. While alive, every node i ∈ V − t may enter the set T0 at most D +Pτ /∈C∪F log2 α(τ ) times. Before proving the lemma, let us show how it can be used to bound the total number of iterations. 28 Proof of Theorem 5.3. The proof follows the same lines as that of Lemma 3.6, analyzing the invariant Ψ as defined by (7). Consider an iteration τ ∈ C when some abundant arcs are contracted. According to Claim 5.2, the value of Ψ decreases to 0 in all such iterations. Every shrinking iteration decreases Ψ by one, and the only steps when Ψ increases is when some node i ∈ V − t enters T0. Let λi denote the number of times this happens. Lemmas 5.8 and 5.9 imply λi ≤ D + 14n2 ≤ 2n + 14n2 ≤ 15n2. Consequently, the total increase in Ψ is bounded by Xi∈V −t (3di + 7)λi ≤ 15n2 Xi∈V −t (3di + 7) ≤ 15n2(6m + 7n) ≤ 195n2m. As in the proof of Lemma 3.6, this bounds the number of shrinking iterations, and there can be ≤ 2n iterations between two subsequent shrinking iterations. This completes the proof. The next claims are needed for the proof of Lemma 5.9. Claim 5.10. Consider a filtrating iteration τ ∈ F. The maximum flow problem in Filtration(V \ T, f, µ) is feasible, and after the subroutine, every i ∈ V \ T satisfies eµ i ≤ Rµ i + n max j∈(V \T )−t bµ j . Proof. Feasibility is verified by the restriction of f (τ ) to tight arcs in E[V \ T ]. This gives a feasible solution as in the proof of Lemma 3.9; note that the arcs entering V \T are all non-tight, as otherwise we would have extended T in this iteration instead. Let f ′ denote the generalized flow on V \ T returned by Tight Flow(V \ T, µ), and f the generalized flow returned by Filtration(V \ T, f, µ). Inside E[V \ T ], f is nonzero only on tight arcs, and equals fij = f ′ ij for all ij ∈ E[V \ T ]. The value of f is set to zero on arcs leaving V \ T and the original values f (τ ) ij are kept if i ∈ T . We obtain i (f ) = eµ eµ i for i ∈ V \ T , since the non-tight arcs are precisely those coming from T . The claim then follows by Theorem 2.6(ii). i (f ′) + Rµ Lemma 5.11. Let τ ∈ F \ C be a filtrating iteration when no contraction is performed. (i) If β(τ +1) i ≥ (di + 1) for some i ∈ V \ T (τ ), then τ ∈ D, that is, D(τ +1) ) D(τ ). (ii) Either τ ∈ D, or one of the iterations τ , (τ + 1) and (τ + 2) must be shrinking. Proof. (i): Let ∆ = ∆(τ ) and T = T (τ ). First, let us prove that Elementary step(T, T0, f, µ, ∆) must have been performed in iteration τ . This follows by Claim 5.10. Indeed, if Elementary step(T, T0, f, µ, ∆) is skipped after calling Filtration(V \ T, f, µ), then for every i ∈ V \ T we have eµ i ≤ Rµ i + n max j∈(V \T )−t bµ j < (di + 1)∆ at the beginning of iteration τ +1. This follows by Claim 2.5 (Rµ i < di∆), and since maxj∈(V \T )−t bµ j < ∆/n by (V \ T ) ∩ D(τ ) = ∅. This is a contradiction to β(τ +1) ≥ (di + 1). This shows Elementary step(T, T0, f, µ, ∆) must have been performed in iteration τ , setting ∆′ = ∆(τ +1) = ∆(τ )/α(τ ) (note that we assumed τ /∈ C as well). i Consider a node i ∈ V \ T in iteration τ for which βi increased above (di + 1). After Filtra- tion(V \ T, f, µ), F µ[V \ T ] = ∅ and fpq = 0 for every pq ∈ E[V \ T, T ]. Therefore Elementary step(T, T0, f, µ, ∆) does not change the flow f at all; also by definition, the labels µi are unchanged 29 for i ∈ V \ T . Hence eµ before and after Elementary step(T, T0, f, µ, ∆). We have i and bµ i do not change for i ∈ V \ T . Let ∆ and ∆′ denote the scaling factor di + 1 ≤ eµ i ∆′ ≤ i + n maxj∈(V \T )−t bµ Rµ j ∆′ ≤ di + n maxj∈(V \T )−t bµ j ∆′ . In the second inequality we use that Rµ i must be at most di∆′ by Claim 2.5. This implies ∆′/n ≤ maxj∈(V \T )−t bµ was assumed, it follows that D must be extended in this iteration, that is, τ ∈ D. is unchanged in Elementary step(T, T0, f, µ, ∆) and it j . Since (V \ T ) ∩ D(τ ) = ∅ For part (ii), assume τ /∈ D. Some nodes i ∈ T0 might be removed in iteration τ if eµ i decreases below (di + 2); in this case, iteration τ itself is shrinking. Otherwise, part (i) implies that V \ T (τ ) ⊆ N (τ +1), and that α = α2 in iteration τ . Therefore at the beginning of iteration τ + 1, there exists a tight arc ij ∈ E with i ∈ T (t), j ∈ V \ T (t). Now either T (τ ) ∩ N (τ ) 6= ∅ already holds, in which case a path augmentation is performed; or iteration τ + 1 extends T using the tight arc ij. In this case, j ∈ T (τ +2) ∩ N (τ +2), and iteration τ + 2 is shrinking. We are ready to prove Lemma 5.9. The proof is based on that of Lemma 3.7, also making use of the above claims. Proof of Lemma 5.9. Let τ1 < τ2 < . . . < τλ denote the iterations when i enters T0. This number is not necessarily finite; hence λ = ∞ is allowed. We have β(τℓ+1) = 4(di + 2) for 1 ≤ ℓ ≤ λ. i For 1 ≤ ℓ ≤ λ, let us define τ ′ ℓ to be the largest value τ ′ existence of these values follows as in the proof of Lemma 3.7. ℓ ≤ τℓ such that β (τ ′ ℓ) i < (di + 2). The In iteration τ ′ ℓ, we have i /∈ T0, since once the excess ei drops below (di + 2)∆µi, the node i is immediately removed from T0. Also, i will be added to T0 in iteration τℓ. We claim that C ∩ [τ ′ < (di + 2) by Claim 5.2; this would contradict the maximal choice of τ ′ ℓ. ℓ, τℓ] = ∅. Indeed, if θ ∈ C, then β(θ+1) i Let us analyze the case when D ∩ [τ ′ ℓ, τℓ] = ∅. Indeed, if θ ∈ F ∩ [τ ′ F ∩ [τ ′ to the maximal choice of τ ′ ℓ. ℓ, τℓ] = ∅ holds. According to Lemma 5.11(i), this implies < (di + 1) would follow, a contradiction again ℓ, τℓ], then β(θ+1) i With the same argument as in the proof of Lemma 3.7, making use of Claim 3.8, we obtain 4 ≤  Yθ∈[τ ′ ℓ,τℓ] 2 . α(θ)  Note that we have [τ ′ values ℓ = 1, . . . , λ where [τ ′ ℓ, τℓ] ∩ D = ∅. Hence we obtain ℓ, τℓ] ∩ (C ∪ F ∪ D) = ∅. Let us add the logarithms of these inequalities for those λ − D ≤ Xθ /∈C∪F log2 α(θ) completing the proof. 5.3 Running time analysis Proof of Theorem 4.3. As shown in Theorem 5.3, the total number of shrinking steps is O(n2m). If Filtration is not called between two shrinking iterations, then this part of the algorithm can be implemented in O(m + n log n) time using Fibonacci heaps, using the variant described in Section 6. If Filtration is called, then we must execute a maximum flow computation in O(nm) time [24]. 30 According to Lemma 5.11(ii), in this case we must have a shrinking one within the next three iterations. Consequently, the running time between two shrinking iterations is dominated by O(nm). This gives a total estimation of O(n3m2); all other steps of the algorithm (contractions, initial and final flow computations, etc.) are dominated by this term. 6 Bounding the encoding size In this section, we complete the proof of Theorem 2.1: we modify the algorithm to guarantee that the encoding size of the numbers during the computations remain polynomially bounded in the input size. Further, we present a more efficient implementation, by jointly performing the elementary steps between two shrinking iterations; this enables a better running time bound, as already indicated in the proofs of Theorems 2.7 and 4.3. We describe the modifications for the Enhanced Continuous Scaling algorithm, but they are naturally applicable for the weakly polynomial Continuous Scaling algorithm as well. In this section, let us assume that (10) Indeed, if ¯B is polynomially bounded in n, then any of the previous weakly polynomial algorithms has strongly polynomial running time. We define the following quantities needed for the roundings; as in the previous section, n and m will always refer to the size of the original input instance (and not the actual contracted one). ¯B ≥ 500n5. q := 40m ¯B4, ¯q := 40m ¯B2 = q/ ¯B2 For a real number a ∈ R≥0, let ⌊a⌋q denote the largest number p/q with p ∈ Z, p/q ≤ a, and similarly, let ⌈a⌉q denote the smallest number p/q with p ∈ Z, p/q ≥ a. The same notation will also be used for ¯q. s < (ds + 1)∆. The case s = N U LL means that some node i leaves T0, that is, eµ The main subroutine Aggregate steps(T0, f, µ, ∆) is shown in Figure 5. The input is a set T0 with eµ i ≥ (di + 2)∆ for every i ∈ T0. The output is either a node s ∈ V or s = N U LL. If s 6= N U LL, then we can find a tight path in Eµ f (∆) between a node p ∈ T0 and s, where either s = t or eµ i drops below (di + 2)∆. In the first case, we can perform a path augmentation from s to t. The entire algorithm is exhibited in Figure 6. Note that termination can happen either because the graph is shrunk to a single node, or because ∆ decreases below a certain threshold as in the weakly polynomial algorithm Continuous Scaling. We now describe the main features of the subroutine Aggregate steps and compare it to the algorithm Enhanced Continuous Scaling. Apart from the rounding and contraction steps, it performs essentially the same as a sequence of Elementary steps starting with T = T0, until a next shrinking iteration. The difference is that in Enhanced Continuous Scaling, whenever the set T is extended by a node, Elementary step needs to update the labels of every node in T and change flow values on certain arcs. During a sequence of iterations between two shrinking steps, this can lead to O(n) value updates in certain nodes and arcs. In contrast, Aggregate steps changes the labels only once and the flow values at most twice. The key quantity in Aggregate steps is α∗. This corresponds to the product of the α multipliers of the sequence of Elementary steps thus far in Enhanced Continuous Scaling. The subroutine Aggregate steps starts with T = T0 and extends T by adding nodes one-by- one, until t ∈ T , or eµ i < (di + 2)∆ for some i ∈ T0. Node labels are changed at the end of the subroutine only. For a node i ∈ T , we store the value αi at the s < (ds + 1)∆ for some s ∈ T \ T0, or eµ 31 Subroutine Aggregate steps(T0, f, µ, ∆) for all i ∈ (V \ T0) − t do update r1(i), r2(i), r3(i), r4(i) and δi as in (4) and (5) ; αi ← minn⌊δi⌋q, min{1/γµ jt : jt ∈ Eµ αt ← min{1/γµ for all i ∈ T0 do f (∆), j ∈ T0} ; ji : ji ∈ Eµ f (∆), j ∈ T0}o ; update ρi, νi as in (11) ; αi ← 1 ; T ← T0 ; α∗ ← 1 ; λ ← min{νj : j ∈ T0} ; while (α∗ ≤ λ) and (t /∈ T ) do α∗ ← min{αi : i ∈ V \ T } ; if α∗ = ∞ then set fti = 0 for all ti ∈ E: γµ return optimal flow f and optimal relabeling µ ; TERMINATE. ti < 1 ; i ← argmin{αi : i ∈ V \ T } ; T ← T ∪ {i} ; if αi = ⌊δi⌋q then T0 ← T0 ∪ {i} ; for all ij ∈ E : j ∈ T do fij ← fij/α∗ ; update ρj, νj as in (11) ; λ ← min{λ, νj} ; for all ij ∈ E : j ∈ V \ T do ij < 1 then fij ← fij/α∗ ; if γµ if j 6= t then update r1(j), r2(j), δj as in (4) and (5) ; ijo ; αj ← minnαj, ⌊δj ⌋q, αi/γµ if j = t then αt ← min {αt, αi/γµ it} ; for all ji ∈ E : j ∈ V \ T do if γµ ji = 1 then fji ← fjiα∗ ; if fji > ∆µj then αj ← α∗ ; if j 6= t then update r3(j), r4(j), δj as in (4) and (5) ; αj ← min {αj, ⌊δj ⌋q} ; update ρi, νi as in (11) ; λ ← min{λ, νi} ; if (cid:16)∀j ∈ (V \ T ) − t : bµ Filtration(V \ T, f, µ) ; for all j ∈ T do j < ∆ 16kn(1+1/ ¯B)g(cid:17) then ej ← ej − ρj ; ρj ← 0 ; update νj as in (11) ; for all j ∈ V \ T do update r1(i), r2(i), r3(i), r4(i), δi as in (4) and (5) ; αi ← min {⌊δi⌋q, αi} ; λ ← min{νj : j ∈ T } ; ∆ ← ⌈∆/α∗⌉q ; for all ij ∈ F µ[V \ T ] ∪ E[V \ T, T ] do fij ← fij/α∗ ; for all i ∈ T do µi ← µiα∗/αi ; for all j ∈ T0 : νj < α∗ do T0 ← T0 \ {j} ; Round Label(f, µ) ; if t ∈ T then RETURN s = t ; elseif ∃s ∈ T \ T0 : νs < α∗ then RETURN such an s ; otherwise RETURN s = N U LL. 32 Algorithm Modified Enhanced Continuous Scaling Initialize; T0 ← ∅ ; k ← 0 ; g ← 0 ; While V > 1 and ∆ ≥ 1/(17m ¯B3) do s ← Aggregate Steps(T0, f, µ, ∆) ; g ← g + 1 ; if s 6= N U LL then pick a tight p − s path P in Eµ send ∆ units of relabeled flow from p to s along P ; if eµ p < (dp + 2)∆ then T0 ← T0 \ {p} ; f (∆) with p ∈ T0 ; while ∃ pq ∈ E: f µ pq ≥ 17m∆ do ij < 1 do fij ← 0 ; for all ij ∈ E : γµ Contract(pq) ; ∆ ← 16∆ ; k ← k + 1 ; T0 ← ∅ ; if ∆ < 1/(17m ¯B3) then Tight-Flow(V, µ) else Expand-to-Original(µ) ; Figure 6: Description of the modified strongly polynomial algorithm time when i enters T , and multiply the label µi at the end by α∗/αi. The flow on an arc ij may change when its endpoints enter T , or at the end of the subroutine, altogether at most twice. For nodes i ∈ V \ T , we use αi to denote the candidate value of α∗ when i must enter T , either due to a new tight arc ji ∈ Eµ f (∆), j ∈ T , or because the excess ei reaches the threshold 4(di + 2)∆µi and hence i must be included in T0. We define δi as in (5), representing the value of α∗ when i would enter T because of ei = 4(di + 2)∆µi, provided that no other node enters T before. We let αi := minn⌊δi⌋q, min{αj/γµ ji : ij ∈ Eµ f (∆), j ∈ T }o . Note the rounding ⌊δi⌋q in the first case. This means that ei might be slightly less than 4(di + 2)∆µi when i enters T . The second event corresponds to the case when i enters T due to a new tight arc from a node j ∈ T . Note that either ji ∈ E, or ji is a reverse arc with ij ∈ E, γµ ij > ∆. In the latter case the corresponding term equals αj. ij = 1, f µ For i ∈ T \ T0, wish to estimate when ei < (di + 1)∆µi would be attained, and for i ∈ T0, we wish to estimate when ei < (di + 2)∆µi would be attained. To provide a unified notation for these two cases, let us define ξi = 1 if i ∈ T \ T0 and ξi = 2 if i ∈ T0. We let ρi := Xj∈V \T νi :=(∞ γjifji, ρi (di+ξi)∆µi+ρi−ei if ei − ρi ≥ (di + ξi)∆µi; otherwise. (11) Here ρi denotes the total flow entering i on arcs from V \ T , these are the ones where the flow value will be reduced. We define νi as the smallest value of α∗ when ei = (di + ξi)∆µi is reached. λ will denote the minimum value of {νi : i ∈ T }. The iterations terminate once λ < α∗. 33 In every iteration, we set the new value α∗ := min{αi : i ∈ V \ T }, pick a node i minimizing this value, and include it into T . The modifications of the incident fij and fji values are in order to guarantee the same change as in the sequence of Elementary step operations in Enhanced Continous Scaling. We update the corresponding r1(j), . . . , r4(j), δj and ej, ρj, νj values on the neighbours of i accordingly. These updates can be performed in O(1) time. Indeed, for each of the sums r1(j), . . . , r4(j), ej , ρj, only one term changes. Provided these, δj and νj are obtained by simple formulae. The Filtration subroutine is used similarly as in Enhanced Continuous Scaling, but the j is different, containing a term (1 + 1/ ¯B)g necessary due to the roundings. The counter bound on bµ g denotes the total number of times the subroutine Aggregate steps was performed. Compared to Enhanced Continuous Scaling, there is a further minor difference regarding In Enhanced Continuous Scaling, a contraction can be performed after every contractions. Elementary step, whereas in the modified algorithm, only after the entire sequence represented by Aggregate steps(T0, f, µ, ∆). If Filtration is not called, then the subroutine Aggregate Steps can be implemented in O(m + n log n) time using the Fibonacci heap data structure. To see this, we maintain two heap structures, one for the αi's for i ∈ V \ T , an one for the νi's, i ∈ T . Besides, we maintain the r1(i), . . . , r4(i) values for i ∈ V \ T , and the ei, ρi values for i ∈ T . Every arc is examined O(1) times, and the corresponding key modifications can be implemented in O(1) time. Consequently, the bound in [7] is applicable. It is easy to verify that all µi and fij values are modified exactly as in a sequence of Elementary step operations. For example, consider an arc ji with originally i, j ∈ V \ T , such that i enters T before j. The scaling factor when i enters T is ∆/αi. If ij ∈ Eµ ji > ∆/αi, then j enters T in the next neutral phase. Accordingly, Aggregate Steps sets αj = α∗ in the same case. If ji was a non-tight arc already at the beginning, then fji is decreased in every elementary step until j enters T ; in our subroutine, fji is divided by αj. However, if ji was tight initially, and f µ ji < ∆αi, then it becomes non-tight after i enters T . Notice that in this case our subroutine divides fji by αj/αi. The other cases can be verified similarly. f (∆/αi), that is, f µ At termination, we perform the subroutine Round Label, shown in Figure 7. This is a Dijkstra- type algorithm that takes labeling µ, and changes it to a labeling µ′ ≥ µ such that the set of tight arcs in Ef may only increase. Consequently, if (f, µ) is a ∆-feasible pair for some ∆, then so is (f, µ′). We repeatedly extend the set S starting from S = {t} until S = V is achieved. In every iteration we multiply all µi's for i ∈ V \ S by ε > 1, so that either a new tight arc between V \ S and S is created, or some value µi for i ∈ V \ S becomes an integer multiple of 1/¯q. 6.1 Analysis It is easy to adapt Theorem 2.6 and Lemma 3.9 to show that if in any contracted graph during the algorithm Modified Enhanced Continuous Scaling, we have ∆ ≤ 1/(17m ¯B3) for the original values of B, m and n, then the current labeling µ is optimal and thus we may terminate. Also note that 2 ¯B/q ≤ 1/(17m ¯B3), and therefore we may assume that 2 ¯B/q ≤ ∆ in all iterations of the algorithm except the last one. Claim 6.1. The subroutine Round Label returns a labeling µ′ such that every µ′ multiple of ¯B/q. If (f, µ) is ∆-conservative for some ∆ ≥ 0, then so is (f, µ′). Finally, µi ≤ µ′ i is an integer i ≤ (cid:0)1 + 1/(40m ¯B)(cid:1) µi. 34 Subroutine Round Label(f, µ) S ← {t} ; while S 6= V do µi ε1 ← minn ⌈µi⌉¯q ε2 ← min(cid:26) 1 : i ∈ V \ So ; : ij ∈ Ef , i ∈ V \ S, j ∈ S(cid:27) ; γµ ij ε ← min{ε1, ε2} ; for i ∈ V \ S do µ ← µ/ε ; S ← S ∪ {i ∈ V \ S : ⌈µi⌉¯q = µi} ∪ {i ∈ V \ S : ∃j ∈ S, ij ∈ Ef , γµ ij = 1} ; Figure 7: The Round Label subroutine Proof. A node i enters S either if µi is an integer multiple of 1/¯q = ¯B2/q, or if it is connected by a tight path P in Ef to a node j such that µj is an integer multiple of 1/¯q. In the latter case, µi = µj/γ(P ), and since ¯B is an integer multiple of γ(P ) by definition of ¯B in Section 2.1, it follows that µi is an integer multiple of ¯B/q. The claim on conservativeness follows since every tight arc in Ef remains tight. Finally, it is clear that µ′ i ≤ ⌈µi⌉¯q < µi + 1/¯q = µi(1 + 1/(¯qµi)). On the other hand, µi ≥ 1/ ¯B because of the initial definition (3), and hence 1 + 1/(¯qµi) ≤(cid:0)1 + 1/(40m ¯B)(cid:1). In the original algorithm, ∆µi is nonincreasing during every Elementary step iteration. Due to the roundings, this is not true anymore; however, we have the following bound (the possible increase corresponds to the case αi ≤ 1 + 1/ ¯B). Claim 6.2. When performing Aggregate steps, ∆µi decreases by at least a factor of αi/(1+1/ ¯B) for every i ∈ T , and by α∗/(1 + 1/ ¯B) for every i ∈ V \ T , except for possibly the ultimate iteration. Proof. Without the rounding, we would set the new value of the scaling factor to ∆/α∗ and the new value of µi as µiα∗/αi if i ∈ T and leave it unchanged if i ∈ V \ T . Let us focus on the case i ∈ T ; the same argument works for i ∈ V \ T as well. These will be rounded to ∆′ = ⌈∆/α∗⌉q and i ≤ (1 + 1/(40m ¯B))µiα∗/αi by the previous claim. As remarked above, we have 2 ¯B/q ≤ ∆′ in all µ′ save the last step of the algorithm. Therefore ∆′ = ⌈∆/α∗⌉q ≤ (1 + 1/(2 ¯B))∆/α∗. Consequently, proving the claim. ∆′µ′ i ≤(cid:0)1 + 1/(2 ¯B)(cid:1)(cid:0)1 + 1/(40m ¯B)(cid:1) ∆µi/αi ≤(cid:0)1 + 1/ ¯B(cid:1) ∆µi/αi, Provided this, one can derive the bound O(n2m) on the total number of calls to Aggregate steps as in Theorem 5.3. This subroutine corresponds to a sequence of Elementary step, however, the argument can be easily adapted. We now outline the changes in the analysis. Instead of (9), we define the set D as D :=(cid:26)i ∈ V − t : bµ i ≥ ∆ 16kn(1 + 1/ ¯B)g(cid:27) . According to the above claim, if no arc is contracted, then no node may leave the set D, as in Lemma 5.5. After the contraction of k arcs, the maximum value of Γi can be at most Γ(τ ) i ≤ 4k + 5 + 4 log2 n + g log(cid:0)1 + 1/ ¯B(cid:1) ≤ 4k + 5 + 4 log2 n + g/ ¯B. By the assumption (10), the last term is at most 1/n even after 500n2m iterations. Hence the proof of Claim 5.6 can be easily modified to prove the following. 35 Claim 6.3. After at most 500n2m executions of Aggregate steps, the total increase in the value of Γ(τ ) can be bounded by 14n2. Another change in the argument is due to the fact that when a node i enters T0 in Aggregate steps, it might have ei < 4(di + 2)µi due to the rounding of δi. This affects the way Claim 3.8 is applied in the proof of Lemmas 3.7 and 5.9. In (8), 4 has to be replaced by a slightly smaller number; consequently, we have to replace log2 by log2−ε in the argument for some small ε. However, this increases the running time estimation only by a small constant factor. One can show that the O(n3m2) bound on the number of elementary arithmetic operations and comparisions is still applicable for the modified algorithm. The proof of Theorem 2.1 is complete by showing that the size of the variables remain polynomially bounded. Due to the rounding steps, ∆ and the µi's are always of polynomially bounded size. It is left to show that the same holds for the fij values. Lemma 6.4. Every fij value is a rational number of polynomially bounded size in ¯B. Proof. The fij values can be changed in two ways. One is via maximum flow computations in the initial Tight-flow subroutine and during the later Filtration iterations. We can always assume that the flow computations return a basic optimal solution; since the flow problem is defined by polynomially bounded capacities and demands, such steps reset a polynomially bounded rational value for fij. Every Aggregate Steps iteration either leaves fij unchanged, or modifies it to fij/αi, or to fijαj/αi. We claim that αi and αj are both integer multiples of 1/q. Indeed, either αi = ⌊δi⌋q and thus this property is straightforward; or αi = µp/γ(P ) for some p − i path P with p ∈ T0; note that µi is an integer multiple of ¯B/q by Claim 6.1, and ¯B is an integer multiple of γ(P ). Further, it is easy to verify that αi, αj ≤ ¯B2. Consequently, fij is multiplied in Aggregate steps(T0, f, µ, ∆) by a number Q that is the quotient of two integers ≤ q ¯B2. During a path augmentation, fij is modified by adding or subtracting ∆µi, that is an integer multiple of ¯B/q2. Since Aggregate Steps is executed O(n2m) times, these arguments show that all fij's remain polynomially bounded. 7 Problem transformations 7.1 Transformation to an uncapacitated instance Consider an instance (V ′, E′, t′, u′, γ′) of the standard formulation (Pu) with V ′ = n′, E′ = m′, and encoding parameter B. We now show how it can be transformed to an equivalent instance (V, E, t, b, γ) of the uncapacitated formulation (P ) with V ≤ n′ + m′, E ≤ 2m′, and ¯B ≤ 2B4m′ satisfying assumptions (⋆), (⋆⋆), (⋆ ⋆ ⋆), and all assumptions on the encoding size in Section 2.1. The transformation proceeds in three steps. First, we remove all arc capacities by introducing new nodes for arcs with finite capacities. In the second step, the boundedness condition (⋆ ⋆ ⋆) is checked; if the problem turns out to be unbounded, we terminate by returning the optimum value ∞. Finally, new auxiliary arcs are added in order to satisfy (⋆). Removing arc capacities Let us divide the arc set as E′ = E′ ∞ if e = ∞. Let the node set V consist of the original node set V ′ and a new node corresponding to u′ u; let t := t′. The original nodes are called primary nodes, and those corresponding to every arc e ∈ E′ e is finite, and e ∈ E′ u if the capacity u′ u ∪ E′ ∞, where e ∈ E′ 36 arcs secondary nodes. Let k = aij be the node corresponding to arc ij ∈ E′ u. The transformed graph contains two corresponding arcs, ik and jk. We leave all arcs in ij ∈ E′ ∞ unchanged between the primary nodes i and j. Let us define ¯B to be twice the product of the numerators and denominators of all rational numbers γ′ ij for every ij ∈ E′ and u′ u; clearly, ¯B ≤ 2B4m′ ij for every ij ∈ E′ . For a primary node i ∈ V , let us set the node demand bi = −Pj:ji∈E ′ ij. Furthermore, let us define the gain factors by γik := γ′ ji. For the secondary ij, γjk := 1. For u γ′ jiu′ iju′ node k = aij, let bk := γ′ ij ∈ E′ ∞, we let γij := γ′ ij. The transformed instance satisfies (⋆⋆), since the following ¯f is a feasible solution. For every secondary node k = aij, let us set ¯fjk := γ′ iju′ ij, and let us set ¯fpq = 0 for all other arcs pq. Boundedness Let us now address the boundedness of the problem. The following lemma gives a simple character- ization of boundedness of the objective. Lemma 7.1. Consider a problem instance (V, E, t, b, γ) in the uncapacitated formulation (P ) that is feasible. The objective in (P ) is bounded if and only if there is no cycle C ⊆ E with γ(C) > 1 and a path P ⊆ E between a node incident to C and t. Proof. If such a cycle exists, then we can increase the flow value in t arbitrarily by generating flow on C and sending it to t via P . For the converse direction, consider the dual program (D); recall that the labels µi are simply the inverses of the dual variables. Since (P ) is feasible according to (⋆⋆), the objective is bounded if and only if (D) is feasible. Assume C ⊆ E is a cycle such that a path P ⊆ E connects a node incident to C to t. Using the condition γpqµp/µq ≤ 1 on every arc pq ∈ P , it follows that in every feasible labeling, µi is finite for every node i incident to C. Therefore γ(C) = γµ(C) ≤ 1, completing the proof. Let V ′ denote the set of nodes i such that there exists an i − t path in E. This set V ′ can be found by a simple search algorithm. Boundedness can be decided by checking for a flow generating cycle in the restriction of G to V ′. This is equivalent to finding a negative cycle for the cost function cij = − log γij and can be solved by any negative cycle detection algorithm, see e.g. [2, Chapter 5.5]. Computations with logarithms can be avoided by devising a multiplicative analogue of these algorithms working directly with the γij's. After removing the arc capacities, we run this algorithm to decide boundedness. If the problem is unbounded, we terminate with optimum value ∞. Otherwise, we can assume the validity of (⋆ ⋆ ⋆). (Note that since all secondary nodes have only two incoming arcs incident, all arcs used in C and P are necessarily from E∞. Therefore, the same subroutine could also be performed before the transformation.) Auxiliary arcs To satisfy (⋆), for every node i ∈ V − t for which it /∈ E, let us further add an arc it to E with γit := 1/ ¯B. Let us call these auxiliary arcs. The following lemma justifies our transformation. Lemma 7.2. The transformed instance satisfies assumptions (⋆), (⋆⋆) and (⋆ ⋆ ⋆), and ¯B satisfies the assumptions on the encoding sizes in Section 2.1. An optimal solution f to the modified problem can be transformed to an optimal solution f ′ to the original problem in O(m′) time. 37 Proof. The first part is straightforward. For the second statement, let f be an optimal solution to the modified problem with an optimal labeling µ as in Theorem 2.3(i). For a secondary node k = aij, it = 1, that is µi = ¯B. Let let us set f ′ S ⊆ V denote the set of nodes that can be reached from S0 on a residual path P ⊆ Ef . ij := fik. Let S0 ⊆ V denote the set of nodes i ∈ V for which γµ Let S′ ⊆ V ′ denote the set of primary nodes in S. Let us set µ′ i := ∞ if i ∈ S′. In what follows, we shall verify the optimality conditions in Theorem 2.3(ii) for f ′ and µ′. ij ≤ u′ u. This follows since for the secondary node ij, and ek(f ) = 0 due to the optimality of f . Next, we claim that t /∈ S t = 1. Indeed, assume for a contradiction there exists a path P ⊆ Ef from a node k = aij we have bk = γ′ and therefore µ′ i ∈ S0 to t. Then µi ≤ 1/γ(P ) < ¯B by the definition of ¯B, a contradiction to µi = ¯B. We first claim that f ′ iju′ i := µi if i ∈ V ′ \ S′ and µ′ ij for all arcs ij ∈ E′ The condition on arcs ij ∈ E′[S′] is straightforward since µ′ j = ∞. Consider an arc ij ∈ E′ ∞, then ij ∈ Ef , contradicting the definition of S. Hence ij ∈ E′ with i ∈ S′, j ∈ V ′ \ S′. If ij ∈ E′ u; let k = aij be the corresponding secondary node. By definition, ik ∈ E ⊆ Ef . By the definition of S′, we must have kj /∈ Ef , that is, fjk = 0 and therefore f ′ ij due to the constraint ek(f ) = bk. It follows similarly that fij = 0 for all arcs ij ∈ E′ with Then γijµi = ∞ > µj, as required. i ∈ V ′ \ S′, j ∈ S′, and they satisfy γijµi < ∞ = µj. ij = u′ i = µ′ Let us focus on arcs ij ∈ E′[V ′ \ S′]; assume ij ∈ E′ ij. This means that for the corresponding secondary node k = aij, we had fik, fjk > 0, and thus γijµi = µk, and µk = µj, implying γijµ′ ij = fij on all such arcs. The other cases, including the case of arcs in E′ j. Note that k /∈ S0 and ek(f ) = 0 implies that fij ≤ u′ ij, therefore f ′ u and 0 < f ′ ij < u′ i = µ′ ∞, follow similarly. It is left to prove that ei(f ′) = 0 whenever i ∈ V ′ \ S′. By definition, i /∈ S0 and hence fit = 0. ji). Together with For every incoming arc ji with secondary node k = aji, we have fjk = γ′ ei(f ) = 0 and the definition of bi, this implies ei(f ′) = 0. ji − f ′ ji(u′ 7.2 Linear programs with two nonzeros per column In this Section, we show how our algorithm can be used to solve arbitrary linear feasibility problems of the form (LP2). The main part of this argument was given by Hochbaum [17], showing how an arbitrary instance of (LP2) can be transformed to another one where every column of the matrix A contains exactly one positive entry and a −1 entry. With the rows corresponding to nodes and the columns to arcs, let us use γij > 0 to denote the positive entry in row j and column ij. (The construction creates two copies of the vertex set, and columns with two positive or two negative entries are represented by two arcs crossing between the copies, whereas columns with two different signs are represented by two arcs, one in each copy.) The transformed version may contain upper capacities on the arcs. These can be removed using the same construction as in Section 7.1, at the cost of increasing the number of nodes to O(m). After removing the arc capacities, we can write the system in the form Xj:ji∈E γjifji − Xj:ij∈E fij = bi ∀i ∈ V (LP 2M ) f ≥ 0. Given an instance of (LP 2M ), let the value ¯B be chosen as an integer multiple of the products of all numerators and denominators of the γij values, and furthermore, assume bi ≤ ¯B and bi is an integer multiple of 1/ ¯B for all i ∈ V . (LP 2M ) is an uncapacitated generalized flow feasibility problem, where all node demands must be exactly met (M stands for monotone, following Hochbaum's terminology.) Compared to the formulation (P ), the differences are as follows: (i) (LP 2M ) is a feasibility problem and does not have a distinguished sink node, in contrast to the optimization problem (P ); (ii) the node demands 38 must be exactly met in (LP 2M ), whereas in (P ), nodes are allowed to have excess. For this reason, we introduce two relaxations of (LP 2M ) with inequalities. Xj:ji∈E Xj:ji∈E fij ≥ bi ∀i ∈ V (LP 2M≥) γjifji − Xj:ij∈E f ≥ 0 fij ≤ bi ∀i ∈ V (LP 2M≤) γjifji − Xj:ij∈E f ≥ 0 Our main insight (Lemma 7.4 below) is that if both these relaxations are feasible, then (LP 2M ) is also feasible, and a solution can be found efficiently provided the solutions to the relaxed instances. The second relaxation (LP 2M≤) can be reduced to (LP 2M≥) by reversing all arcs in E, setting γji = 1/γij on the reverse arc ji of ij ∈ E, and changing the node demands to −bi. We show that (LP 2M≥) – and consequently, (LP 2M≤) – can be solved using our algorithm for (P ). Solving (LP 2M≥) As a preprocessing step, we identify the set Z of nodes that can be reached via a path in E from a flow generating cycle in E. That is, i ∈ Z if there exists a cycle C ⊆ E, γ(C) > 1, and a path P ⊆ E connecting a node of C to i. This set Z can be found efficiently using algorithms for negative cycle detection, similarly as in Section 7.1. Using the flow generating cycles, arbitrary demands bi for i ∈ Z can be met. This solves (LP 2M≥) if Z = V ; in the sequel let us assume V \ Z 6= ∅. By the definition of Z, there is no arc in E between Z and V \ Z. If (LP 2M≥) is feasible, then there is a feasible solution with no arc carrying flow from V \ Z to Z. Thus we can reduce the problem to solving (LP 2M≥) on V \ Z. Let us add an artifical sink node t to V . For every i ∈ V \ Z with bi > 0, add a new arc ti with gain factor γti = 1. For every i ∈ V \ Z, add an it arc with γit = 1/ ¯B. This gives an instance of (P ) with sink t. The condition (⋆) is guaranteed by the it arcs; for (⋆⋆), we have a simple feasible solution: send bi units of flow on γti for every i with bi > 0, and set the flow to 0 on all other arcs. The boundedness condition (⋆ ⋆ ⋆) is guaranteed by Lemma 7.1; note that by the definition of Z, there are no flow generating cycles in E[V \ Z]. Lemma 7.3. Let f be an optimal solution to the (P ) instance as constructed above. Then (LP 2M≥) is feasible if and only if fti = 0 for all i ∈ V \ Z. Proof. Consider an optimal solution f to the instance of (P ) with an optimal labeling µ. If fti = 0 for i ∈ V \ Z, then f restricted to V \ Z is a feasible solution (LP 2M≥). Conversely, assume ftj > 0 for a certain node j ∈ V \ Z; we show that (LP 2M≥) is infeasible. As in the proof of Lemma 7.2, we let S0 denote the set of nodes i ∈ V \ Z with µi = ¯B, and let S be the set of nodes that can be reached from S0 on a residual path in Ef . We claim that j /∈ S. To see this, first observe that µj = 1 because of ftj > 0. If there were a path P ⊆ Ef from a node i ∈ S to j, then 1 ≥ γµ(P ) = γ(P )µi/µj = γ(P ) ¯B gives a contradiction to the choice of ¯B. Therefore X = V \ (Z ∪ S) contains j, and there is no arc entering this set. Further, ei(f ) = 0 and fit = 0 for every i ∈ X. Then yi := 1/µi for i ∈ X and yi := 0 for i /∈ X gives a Farkas certificate of infeasibility for (LP 2M≥).3 Indeed, y ≥ 0, yi − yjγij ≥ 0 holds for every arc ij ∈ E, 3The Farkas certificate is described after the proof of Lemma 7.4. 39 and Pi∈V biyi > 0 because biyi =Xi∈X Xi∈V completing the proof. Here we used that γµ ji = 1 whenever fji > 0. bµ i = Xi∈X Xj∈V ∪{t}:ji∈E jif µ γµ ji − Xj∈V :ji∈E f µ ji =Xi∈V f µ ti > 0, Solving (LP 2M ) We solve (LP 2M≥) as described above, and (LP 2M≤) the same way, after reversing the arcs. If either of the two problems is infeasible, then (LP 2M ) is also infeasible. Assume now that f is a feasible solution to (LP 2M≥), and g is a feasible solution to (LP 2M≤). We show that in this case the equality version (LP 2M ) is also feasible. To prove this, we use a flow decomposition of the difference of the two solutions f and g to transform g to a solution of (LP 2M≤). Lemma 7.4. Given feasible solutions to (LP 2M≥) and (LP 2M≤), a feasible solution to (LP 2M ) can be found in strongly polynomial time. Proof. Let f be a feasible solution to (LP 2M≥), and g a feasible solution to (LP 2M≤). Then for every i ∈ V , ei(f ) ≥ 0 ≥ ei(g) holds. Let us define the flow h as hij :=(fij − gij γji(fji − gji) if ij ∈ E, fij > gij if ji ∈ E, fji > gji. Let H ⊆ ←→ E denote the support of h; clearly, hij > 0 for every ij ∈ H. With the convention holds for every i ∈ V. hij = −γjihji, we have f = g+h. Since ei(f ) ≥ 0 ≥ ei(g), the inequalityPj:ji∈H γjihji ≥Pj:ij∈H hij We apply the standard generalized flow decomposition for h as in e.g. [15, 9]: every generalized flow can be written as the sum of five types of elementary flows. Such a decomposition can be found in O(nm) time, and the number of terms is at most the number of arcs with positive flow. Among the five types of elementary flows listed in [9], Types I and III cannot be present the decomposition of h, as there are no deficit nodes (more outgoing than incoming flow). Type IV are unit gain cycles, and Type V are pairs of flow generating and flow absorbing cycles connected by a path ("bicycles"); these do not generate any excess or deficit and are not needed for out argument. The important one is Type II: a flow generating cycle and a path connecting it to an excess node (more incoming than outgoing flow). We now describe how to modify g to a feasible solution g′ to (LP 2M ) using the decomposition of h. Consider a node i with ei(f ) > ei(g); this is an excess node for h. We could add all Type II flows in the decomposition terminating at i to increase ei(g) to ei(f ). Since we want achieve the equality ei(g′) = 0, we only use some of the Type II flows. We add them one-by-one until ei(g′) becomes nonnegative. Then for the last flow, we add only a fractional amount to set precisely ei(g′) = 0. Repeating this for every i with ei(f ) > ei(g), we obtain a feasible solution g′ to (LP 2M ). We also present a second proof of the claim that if both (LP 2M≥) and (LP 2M≤) are feasible, then (LP 2M ) is also feasible. The proof is based on Farkas's lemma and is not algorithmic, but may contribute to a better understanding of the claim. We show that if (LP 2M ) is infeasible, then either (LP 2M≥) or (LP 2M≤) is also infeasible. A Farkas-certificate to the infeasibility of (LP 2M ) can be written as yi − yjγij ≥ 0 ∀ij ∈ E biyi > 0 Xi∈V 40 A Farkas-certificate to the infeasibility (LP 2M≥) is the same with the additional constraint y ≥ 0, whereas the certificate to the infeasibility of (LP 2M≤) is with y ≤ 0. In the case of (LP 2M≥), µi = 1/yi gives the usual labeling. Let us define the sets Y + := {i ∈ V : yi > 0} and Y − := {i ∈ V : yi < 0}. Further, let y+ i := yi if i ∈ Y + and y+ i We claim that the y+ := 0 otherwise; similarly, let y− i := yi if i ∈ Y − and 0 outside Y −. j γij ≥ 0 hold for every ij ∈ E. We only verify this for y+; the proof is the same for y−. If i, j ∈ Y +, then this holds because y+ is identical to y inside Y +. If i, j ∈ V \ Y +, then y+ j = 0 and thus the claim is trivial. Next, let i ∈ Y + and j ∈ V \ Y +. The claim follows by y+ j = 0. Finally, we claim that there is no ij ∈ E with i ∈ V \ Y +, j ∈ Y +. Indeed, this would mean yi − yjγij < 0, contradicting the choice of y. i = y+ i > 0, and y+ j γij ≥ 0 and y− i − y− i − y+ Since 0 < Pi∈V biyi =Pi∈V biy+ i > 0. In the first case, y+ is an infeasibility certificate for (LP 2M≥), and in the second case, y− is an infeasibility certificate for (LP 2M≤). i , either Pi∈V biy+ i > 0 or Pi∈V biy− i +Pi∈V biy− 8 Conclusion We have given a strongly polynomial algorithm for the generalized flow maximization problem, and also for solving feasibility LPs with at most two nonzero entries in every column of the constraint matrix. A natural next question is to address the minimum cost generalized flows, or equivalently, finding optimal solutions to LPs with two nonzero entries per column. In contrast to the vast literature on the flow maximization problem, there is only one weakly polynomial combinatorial algorithm known for this setting, the one by Wayne [35]. This setting is more challenging since the dual structure cannot be characterized via the convenient relabeling framework, and thereby most tools for minimum cost circulations, including the scaling approach also used in this paper, become difficult if not impossible to apply. Another possible line of research would be to extend the flow maximization algorithm to nonlinear settings. The paper [34] gave a simple scaling algorithm for concave generalized flows, where instead of the gain factors γe, there is a concave increasing function Γe(.) associated to every arc e. In [33], a strongly polynomial algorithm is given to the analogous problem of minimum cost circulations with separable convex cost functions satisfying certain assumptions. One could combine the techniques of [34] and [33] with the ideas of the current paper to obtain strongly polynomial algorithms for some special classes of concave generalized flow problems. This could also lead to strongly polynomial algorithms for certain market equilibrium computation problems, see [34]. Acknowledgment The author is grateful to Joseph Cheriyan, Ian Post, and the anonymous referees for several sugges- tions that helped to improve the presentation. References [1] I. Adler and S. Cosares. A strongly polynomial algorithm for a special class of linear programs. Operations Research, 39(6):955–960, 1991. [2] R. K. Ahuja, T. L. Magnanti, and J. B. Orlin. Network Flows: Theory, Algorithms, and Applications. Prentice-Hall, Inc., feb 1993. 41 [3] E. Cohen and N. Megiddo. New algorithms for generalized network flows. Mathematical Pro- gramming, 64(1):325–336, 1994. [4] G. B. Dantzig. Linear Programming and Extensions. Princeton University Press, Princeton, 1963. [5] J. Edmonds and R. M. Karp. Theoretical improvements in algorithmic efficiency for network flow problems. Journal of the ACM (JACM), 19(2):248–264, 1972. [6] L. K. Fleischer and K. D. Wayne. Fast and simple approximation schemes for generalized flow. Mathematical Programming, 91(2):215–238, 2002. [7] M. L. Fredman and R. E. Tarjan. Fibonacci heaps and their uses in improved network opti- mization algorithms. Journal of the ACM (JACM), 34(3):596–615, 1987. [8] F. Glover and D. Klingman. On the equivalence of some generalized network problems to pure network problems. Mathematical Programming, 4(1):269–278, 1973. [9] A. V. Goldberg, S. A. Plotkin, and ´E. Tardos. Combinatorial algorithms for the generalized circulation problem. Mathematics of Operations Research, 16(2):351, 1991. [10] A. V. Goldberg and R. E. Tarjan. Finding minimum-cost circulations by canceling negative cycles. Journal of the ACM (JACM), 36(4):873–886, 1989. [11] D. Goldfarb and Z. Jin. A faster combinatorial algorithm for the generalized circulation problem. Mathematics of Operations Research, 21(3):529–539, 1996. [12] D. Goldfarb, Z. Jin, and Y. Lin. A polynomial dual simplex algorithm for the generalized circulation problem. Mathematical Programming, 91(2):271–288, 2002. [13] D. Goldfarb, Z. Jin, and J. B. Orlin. Polynomial-time highest-gain augmenting path algorithms for the generalized circulation problem. Mathematics of Operations Research, 22(4):793–802, 1997. [14] D. Goldfarb and Y. Lin. Combinatorial interior point methods for generalized network flow problems. Mathematical Programming, 93(2):227–246, 2002. [15] M. Gondran and M. Minoux. Graphs and Algorithms. John Wiley and Sons, NY, USA, 1984. [16] M. Grotschel, L. Lov´asz, and A. Schrijver. Geometric Algorithms and Combinatorial Optimiza- tion. Springer-Verlag, 1993. [17] D. S. Hochbaum. Monotonizing linear programs with up to two nonzeroes per column. Opera- tions Research Letters, 32(1):49–58, 2004. [18] W. S. Jewell. Optimal flow through networks. Operations Research, 10:476–499, 1962. [19] L. V. Kantorovich. Mathematical methods of organizing and planning production. Publication House of the Leningrad State University, page 68, 1939. English translation in Management Science 6(4):366-422, 1960. [20] S. Kapoor and P. M. Vaidya. Speeding up Karmarkar's algorithm for multicommodity flows. Mathematical Programming, 73(1):111–127, 1996. 42 [21] N. Megiddo. Towards a genuinely polynomial algorithm for linear programming. SIAM Journal on Computing, 12(2):347–353, 1983. [22] K. Onaga. Optimum flows in general communication networks. Journal of the Franklin Institute, 283(4):308–327, 1967. [23] J. B. Orlin. A faster strongly polynomial minimum cost flow algorithm. Operations Research, 41(2):338–350, 1993. [24] J. B. Orlin. Max flows in O(nm) time or better. In Proceedings of STOC, 2013. [25] T. Radzik. Approximate generalized circulation. Technical Report93-2, Cornell Computational Optimization Project, Cornell University, 1993. [26] T. Radzik. Improving time bounds on maximum generalised flow computations by contracting the network. Theoretical Computer Science, 312(1):75–97, 2004. [27] M. Restrepo and D. P. Williamson. A simple GAP-canceling algorithm for the generalized maximum flow problem. Mathematical Programming, 118(1):47–74, 2009. [28] M. Shigeno. A survey of combinatorial maximum flow algorithms on a network with gains. Journal of the Operations Research Society of Japan, 47:244–264, 2004. [29] ´E. Tardos. A strongly polynomial minimum cost circulation algorithm. Combinatorica, 5(3):247– 255, 1985. [30] ´E. Tardos. A strongly polynomial algorithm to solve combinatorial linear programs. Operations Research, pages 250–256, 1986. [31] ´E. Tardos and K. D. Wayne. Simple maximum flow algorithms in lossy networks. In Proceedings of IPCO, Lecture Notes in Computer Science, volume 1412, pages 310–324, 1998. [32] K. Truemper. On max flows with gains and pure min-cost flows. SIAM Journal on Applied Mathematics, 32(2):450–456, 1977. [33] L. A. V´egh. Strongly polynomial algorithm for a class of minimum-cost flow problems with separable convex objectives. In Proceedings of STOC, pages 27–40. ACM, 2012. [34] L. A. V´egh. Concave generalized flows with applications to market equilibria. Mathematics of Operations Research, 39(2):573–596, 2014. [35] K. D. Wayne. A polynomial combinatorial algorithm for generalized minimum cost flow. Math- ematics of Operations Research, pages 445–459, 2002. Appendix Theorem 4.1. Let (f, µ) be a ∆-feasible pair. Then there exists an optimal solution f ∗ such that f µ − f ∗µ∞ ≤ Exµ(f ) + (F µ + 1)∆. 43 Proof. First, let us modify (f, µ) to a conservative pair ( f , µ) by setting the flow values on non-tight arcs to 0, as in Lemma 2.4. We shall prove the existence of an optimal f ∗ such that f µ − f ∗µ∞ ≤ Exµ( f ). (12) This implies the claim, since Lemma 2.4 asserts Exµ( f ) ≤ Exµ(f ) + F µ as the two flows differ only on non-tight arcs. f ∆, and f µ − f µ∞ ≤ ∆ Let us pick an optimal solution f ∗ to (P ) such that f − f ∗1 is minimal, and let µ∗ be an optimal solution to (D). Note that because of (⋆), all values of µ and µ∗ are finite. We use a similar argument as in the proof of Lemma 7.4. Let us define hij :=(f ∗ ij − fij γji(f ∗ ji − fji) if ij ∈ E, f ∗ if ji ∈ E, f ∗ ij > fij ji > fji. ←→ E denote the support of h; clearly, h > 0 and H ⊆ E f whereas Let H ⊆ convention hij = −γjihji, we have f ∗ = f + h. ←− H ⊆ Ef ∗ . Again, with the Claim 8.1. The arc set H does not contain any directed cycles. ←− C ) = 1/γ(C) = 1/γµ∗ Proof. First, let C ⊆ H be a cycle. Since µ is a conservative labeling for f and C ⊆ E f , we ←− have γ(C) = γµ(C) ≤ 1. On the other hand, µ∗ is conservative for f ∗ and C ⊆ Ef ∗. Therefore ←− C ) = 1, and also γµ∗ e = 1 for γ( every e ∈ C. Hence we can modify f ∗ to another optimal solution by decreasing every f ∗ value e by a small ε > 0. This gives a contradiction to our extremal choice of f ∗ as the optimal solution minimizing f − f ∗1. (C) ≤ 1. These together give γ(C) = γ( µ∗ Observe that ei( f ) − ei(f ∗) = Xj:ij∈H hij − Xj:ji∈H γjihji By the optimality of f ∗, the left hand side is ≤ 0 for i = t and is equal to ei( f ) ≥ 0 otherwise. The above claim guarantees that H, the support of h, is acyclic. Consequently, we can easily decompose h to the form hℓ, h = X1≤ℓ≤k where each hℓ is a path flow with support P ℓ from a node pℓ with epℓ( f ) > 0 to t, and k ≤ m. Such a decomposition is easy to construct by using a topological order of the nodes for H. It is also a special case of the flow decomposition argument used in Lemma 7.4, see also [15, 9]. (The difference is that according to Claim 8.1, four out of the five types of elementary flows, Types II-V cannot exist as they contain cycles.) Let λℓ denote the value of hℓ on the first arc of P ℓ. Since µ is a conservative labeling and ij ≤ 1 for all arcs of P ℓ and therefore the relabeled flow (hℓ)µ is monotone P ℓ ⊆ H ⊆ E f , we have γµ decreasing along P ℓ. Hence it follows that for every arc ij, hµ ij = X1≤ℓ≤k (hℓ ij)µ ≤ X1≤ℓ≤k λℓ µpℓ = Xi:V −t eµ i ( f ) = Exµ( f ). This completes the proof, since f µ − f ∗µ∞ = maxij∈E hµ must hold). ij (note that if f ∗ ij < fij, then γµ ij = 1 44
1008.5332
2
1008
2010-09-14T14:42:26
Multiple-source single-sink maximum flow in directed planar graphs in $O(n^{1.5} \log n)$ time
[ "cs.DS", "cs.DM" ]
We give an $O(n^{1.5} \log n)$ algorithm that, given a directed planar graph with arc capacities, a set of source nodes and a single sink node, finds a maximum flow from the sources to the sink . This is the first subquadratic-time strongly polynomial algorithm for the problem.
cs.DS
cs
Multiple-source single-sink maximum flow in directed planar graphs in O(n1.5 log n) time Philip N. Klein and Shay Mozes Brown University October 28, 2018 Abstract We give an O(n1.5 log n) algorithm that, given a directed planar graph with arc capacities, a set of source nodes and a single sink node, finds a maximum flow from the sources to the sink . This is the first subquadratic- time strongly polynomial algorithm for the problem. 1 Introduction The study of maximum flow in planar graphs has a long history. In 1956, Ford and Fulkerson introduced the max st-flow problem, gave a generic augmenting- path algorithm, and also gave a particular augmenting-path algorithm for the case of a planar graph where s and t were on the same face (that face is tra- ditionally designated to be the infinite face). Researchers have since published many algorithmic results proving running-time bounds on max st-flow for (a) planar graphs where s and t are on the same face, (b) undirected planar graphs where s and t are arbitrary, and (c) directed planar graphs where s and t are arbitrary. The best bounds known are (a) O(n) [11], (b) O(n log n) [6], and (c) O(n log n) [1]. Schrijver [19] has written about the history of this problem. Ford and Fulk- erson, who worked at RAND, were apparently motivated by classified work of Harris and Ross on interdiction of the Soviet railroad system. (Of course, Har- ris and Ross were interested in the min cut, not the max flow, as seems to be true for most applications.) This article was downgraded to unclassified in 1999. It contains a diagram of a network that models the Soviet railroad system indicating "ORIGINS" (sources) and what is apparently a sink (marked "EG"). In max-flow applied to general graphs, multiple sources presents no problem: one can reduce the problem to the single-source case by introducing an artificial source and connecting it to all the sources. However, as Miller and Naor [17] pointed out, this reduction violates planarity unless all the sources are on the same face to begin with. Miller and Naor raise the question of computing a maximum flow in a planar graph with multiple sources and multiple sinks. 1 Figure 1: The soviet rail network 2 Even when there is one sink, until now the best known algorithm for computing multiple-source max-flow in a planar graph is to use the reduction in conjunction with a max-flow algorithm for general graphs. That is, no planarity-exploiting algorithm was known for the problem. There are workarounds. For example, in the Soviet rail network, there are two faces that together include all the sources, so solving the instance can be reduced to solving two single-source max flows in a planar graph. However, a more realistic motivation comes from selecting multiple nonoverlapping regions in a planar structure. Consider, for example, the following image-segmentation problem. A grid is given in which each vertex represents a pixel, and edges connect orthogonally adjacent pixels. Each edge is assigned a cost such that the edge between two similar pixels has higher cost than that between two very different pixels. In addition, each pixel is assigned a weight. High weight reflects a high likelihood that the pixel belongs to the foreground; a low-weight pixel is more likely to belong to the background. The goal is to find a partition of the pixels into foreground and background to minimize the sum weight of background pixels + cost of edges between foreground pixels and background pixels subject to the constraints that, for each component K of foreground pixels, the boundary of K forms a closed curve in the planar dual that surrounds all of K (essentially that the component is simply connected). This problem can be reduced to multiple-source, single-sink max-flow in a planar graph (in fact, essentially the grid). For each pixel vertex v, a new vertex v(cid:48), designated a source, is introduced and connected only to v. Then the sink is connected to the pixels at the outer boundary of the grid. New result We prove the following: Theorem 1.1 There is an O(n1.5 log n) algorithm to compute multiple-source, single-sink max flow in an n-node directed planar graph. Before our work, the best strongly polynomial bound for the problem is O(n2 log n), which comes from the reduction to general graphs and then use of an algorithm such as that of Goldberg and Tarjan [8]. For integer capacities less than U , one could instead use the algorithm of Goldberg and Rao [7], which leads to a running time of O(n1.5 log n log U ), or the planarity-exploiting min- cost flow algorithm of [12], which gives a bound of O(n1.595 log U ) that depends on fast matrix multiplication and interior-point methods. However, even if one assumes integer capacities and U = Θ(n), our planarity-exploiting algorithm is asymptotically faster. We have learned (personal communication) that Borradaile and Wulff-Nilsen have independently proved the same theorem. 3 1.1 Organization The structure of the paper is as follows. In Section 2 we give some definitions and general technical background. In Section 3, we give the main algorithm. Finally, in Section 4 we describe how to efficiently convert a feasible preflow to a feasible flow. 2 Preliminaries 2.1 Embedded Planar Graphs A planar embedding of a graph assigns each node to a distinct point onto the sphere, and assigns each edge to a simple arc between the points corresponding to its endpoints, with the property that no arc-arc or arc-point intersections occur except for those corresponding to edge-node incidence in the graph. A graph is planar if it has a planar embedding. Assume the graph is connected, and consider the set of points on the sphere that are not assigned to any node or edge; each connected component of this set is a face of the embedding. It is convenient to designate one face as the infinite face (by analogy to embeddings on the plane). With respect to a choice of the infinite face, we say a Jordan curve strictly encloses an edge or node if the Jordan curve separates the edge or node from the infinite face. Similarly, for a subgraph, the choice of infinite face f∞ for the whole graph induces a choice of infinite face for each connected component of the subgraph, namely that face of the connected component that contains f∞. In implementations, an embedding onto the sphere can be represented com- binatorially, using a rotation system. 2.2 Flow Let G be a directed graph with arc set A, node set V and sink t. For notational simplicity, we assume here and henceforth that G has no parallel edges and no self-loops. We associate with each arc a two darts d and d(cid:48), one in the direction of a and the other in the opposite direction. We say that those two darts are reverses of each other, and write d = rev(d(cid:48)). A flow assignment f (·) is a real-valued function on darts that satisfies anti- symmetry: f (rev(d)) = −f (d) (1) A capacity assignment c(·) is a function from darts to real numbers. A flow assignment f (·) respects capacities if, for every dart d, f (d) ≤ c(d). Note that, by antisymmetry, f (d) ≤ c(d) implies f (rev(d)) ≥ −c(rev(d)). Thus a negative capacity on a dart acts as a lower bound on the flow on the reverse dart. In this paper, we assume all capacities are nonnegative, and therefore the all-zeroes flow respects the capacities. 4 is inflowf (v) = (cid:80) a∈A:head(a)=v f (a) −(cid:80) For a given flow assignment f (·), the net inflow (or just inflow) node v a∈A:tail(a)=v. The outflow of v is outflowf (v) = −inflowf (v). The value of f (·) is the inflow at the sink, inflowf (t). A flow assignment f (·) is said to obey conservation if for every node v other than t, outflowf (v) ≥ 0. A supply assignment σ(·) is a function from the non-sink nodes to R ∪ {∞}. For any node v, σ(v) specifies the amount of flow that can originate at v. A flow assignment f (·) is said to respect the supplies σ(·) if, for every node v other than the sink t, outflowf (v) ≤ σ(v). In this paper, we assume all supply values are nonnegative. A flow assignment is a feasible preflow if it respects both capacities and supplies. A feasible preflow is called a feasible flow if in addition it obeys conservation. In this paper, we give an algorithm to find a maximum (feasible) preflow, and then an algorithm to convert that preflow to a maximum (feasible) flow. The residual graph of G with respect to a flow assignment f (·) is the graph Gf with the same arc-set, node-set and sink, and with capacity assignment cf (·) and supply assignment σf (·) defined as follows: • For every dart d, cf (d) = c(d) − f (d). • For every node v, σf (v) = σ(v) − outflowf (v). Single-source limited max flow For a particular node s, a limited max st-flow is a flow assignment f (·) of maximum value that obeys capacities and for which inflowf (v) = 0 for every node except s and t and such that outflowf (s) ≤ σ(s). An algorithm for ordinary max st-flow can be used to compute limited max st-flow by introducing an artificial node s(cid:48) and an arc s(cid:48)s of capacity σ(s), and running the algorithm on the transformed graph. This transformation preserves planarity. Since there is an O(n log n) algorithm for max st-flow in a planar directed graph [1], we assume a subroutine for limited max st-flow. 2.3 Jordan Separators for Embedded Planar Graphs For an n-node planar embedded simple graph G, we define a Jordan separator to be a Jordan curve S such that, for any arc a of G, the set of points in the sphere corresponding to a either (i) does not intersect S or (ii) coincides with a subcurve of S. We require in addition that, if the two endpoints of a are consecutive nodes on S, then (ii) must hold. The boundary nodes of S are the nodes S goes through. We say a Jordan separator is balanced if at most 2n/3 nodes are strictly enclosed by the curve and at most 2n/3 nodes are not enclosed. Miller [16] gave a linear-time algorithm that, given a triangulated two- connected n-node planar embedded graph, finds a simple cycle in the graph, 5 consisting of at most 2 enclosed by the cycle, and at most 2n/3 nodes are not enclosed. n nodes, such that at most 2n/3 nodes are strictly √ √ 2 To find a balanced Jordan separator in a graph that is not necessarily tri- angulated or two-connected, add artificial edges to triangulate the graph and make it two-connected. Now apply Miller's algorithm to find a simple cycle sep- arator with the desired property. Viewed as a curve in the sphere, the resulting separator S satisfies the requirements of a balanced Jordan separator, and it has at most 2 n boundary nodes. √ 2 √ 3 The Algorithm The main algorithm finds a maximum preflow in the following, slightly more general, setting. • Input: -- A directed planar embedded graph G, -- a sink node t, -- a nonnegative capacity assignment c(·), and -- a nonnegative supply assignment σ(·). • Output: A feasible preflow G of maximum value. We present the main algorithm as a recursive procedure with calls to a single- source limited-max-flow subroutine. We omit discussion of the base case of the recursion (the case where the graph size is smaller than a certain constant.) Each of the recursive calls operates on a subgraph of the original input graph. We assume one global flow assignment f (·) for the original input graph, one global capacity assignment c(·), and one global supply assignment σ(·). Whenever the single-source limited-max-flow subroutine is called, it takes as part of its input • the current residual capacity function cf (·) and • the current residual supply function σf (·). It computes a limited max flow assignment (cid:98)f (·), and then updates the global flow assignment f (·) by f (d) := f (d) + (cid:98)f (d) for every dart in the subgraph. In the pseudocode, we do not explicitly mention f (·), c(·) σ(·), cf (·), or σf (·). The pseudocode for the algorithm is given below. We assume that the sink is on the boundary of the face designated the infinite face. The algorithm proceeds in iterations as long as the current graph, Gi, con- sists of more than N0 nodes, for some constant N0 to be specified later. For graphs of constant size, output the solution in constant time. At iteration i it finds a small Jordan separator Si in Gi−1 as described in Section 2.3. Let Hi be the subgraph of Gi−1 enclosed by Si. Intuitively, one would like to think of Si as the external face of Hi. However, Si might cross some earlier Sj, so Si 6 9: 10: 11: 12: 13: designate one of the nodes of C as an artificial sink t(cid:48) and add artificial infinite-capacity edges parallel to C MultipleSourceMaxPreFlow(Hi, t(cid:48)) remove the infinite-capacity artificial edges let Gi be the subgraph of Gi−1 that is not strictly enclosed by Si Algorithm 1 MultipleSourceMaxPreFlow(graph G0, sink t) 1: triangulate G0 with zero-capacity edges. 2: i := 0 3: while Gi consists of more than N0 nodes do 4: 5: 6: 7: 8: i := i + 1 find a Jordan separator Si in Gi−1 let Hi be the subgraph of Gi−1 enclosed by Si let Ci be the external face of Hi. let Bi be the set of cycles {Cj : Cj is contained in Hi} for C in Bi do 14: for C in {Cj} do 15: 16: for every node v of C do limited max-flow from v to t in G does not entirely coincide with edges of Hi (recall that the separator procedure first triangulates the input). To overcome this technical issue we consider Ci, the external face of Hi, instead of just Si. For every cycle Cj that is contained in Hi we compute a maximum preflow to Cj in Hi. We then set Gi to be the part of Gi−1 not strictly enclosed by Si and continue to the next iteration. When all iterations are done, for every node v of every cycle Cj we compute a maximum v-to-t flow in G0. However, we do not push more than σ(v), the excess flow present at v. We call this step limited max-flow (Line 16). 3.1 Correctness of Algorithm 1 Definition 3.1 (Admissible path) A u-to-v path P is called admissible if σ(u) > 0 and if P is residual. Lemma 3.2 Fix an iteration i of the while loop. At any time in that iteration after Line 11 is executed for some cycle C(cid:48), there are no admissible to-C(cid:48) paths is Hi. Proof: By induction on the number of iterations of the loop in Line 9. For the base case, immediately after Line 11 is executed for cycle C(cid:48), by maximality of the preflow pushed when the edges of C(cid:48) had infinite capacity, the lemma holds. Assume the lemma holds before Line 11 is executed for cycle C(cid:48)(cid:48) and let f be the flow pushed in that execution. Assume for contradiction that after the execution there exists an admissible u-to-C(cid:48) path P in Hi for some node u ∈ Hi. 7 Figure 2: A possible situation in the proof of Lemma 3.2. P is shown in solid blue, Q in dashed red. If P was residual before f is pushed, then σ(u) must have been zero at that time. Since P is admissible after he push, σ(u) > 0 after f is pushed. Therefore, before the execution, there must have been an admissible x-to-u path R in Hi for some x ∈ Hi. Thus, R ◦ P is an admissible x-to-C(cid:48) path in Hi before the execution, a contradiction. If P was not residual before f was pushed, there must be some dart of P whose reverse is used by f . Let d be the latest such dart in P . The fact that rev(d) is assigned positive flow by f implies that before f is pushed there exists an admissible path Q from some node x ∈ Hi to head(d), see Fig. 2. By choice of d this implies that Q◦P [head(d), v] is an admissible x-to-C(cid:48) path in Hi before Line 11 is executed for cycle C(cid:48)(cid:48), a contradiction. QED Lemma 3.3 Just before the loop in Line 14 is executed, for every i, there are no admissible to-Bi paths in Hi. Proof: Lemma 3.2 implies that, for every i, at the end of iteration i of the while loop, there are no admissible to Bi paths in Hi. Since for j > i Hi ∩ Hj ⊆ Ci and since Ci ∈ Bi, there are no admissible to-Bi paths in Hi at any later iteration as well. QED are no v-to-t admissible paths for any node v ∈ G0 −(cid:83) Lemma 3.4 Just before the loop in Line 14 is executed for the first time, there j Cj. Proof: Let v be a node of G0 that does not belong to any Cj. Let i be the unique index such that v ∈ Hi. Observe that any v-to-t admissible flow path in G0 must visit some node of Bi before getting to t, so it consists of a v-to-C(cid:48) admissible path in Hi for some C(cid:48) ∈ Bi, contradicting Lemma 3.3 QED Lemma 3.5 For any node u, if there are no u-to-t admissible paths before an execution of Line 16 then there are none after the execution as well. 8 uxdC'PQ Proof: well, so there are no admissible u-to-t paths. If σ(u) = 0 before the execution then σ(u) = 0 after the execution as Otherwise, there is no u-to-T residual path before the execution. let f be the v-to-t flow pushed at Line 16. Assume for contradiction that after the ex- ecution there exists a u-to-t residual path P . Since P was not residual before f was pushed there must be some dart of P whose reverse is used by f . Let d be the earliest such dart in P . The fact that rev(d) is assigned positive flow by f implies that before f is pushed there exists a residual path Q from tail(d) to t. By choice of d this implies that P [tail(d)] ◦ Q is a residual (and therefore admissible) u-to-t path before the execution, a contradiction. QED We can now prove the correctness of the algorithm claimed in Theorem 1.1. v ∈ G0−(cid:83) for v ∈ (cid:83) Proof: (Of correctness of algorithm in Theorem 1.1) By Lemma 3.4, imme- diately before Line 14, there are no v-to-t admissible paths in G0 for any node j Cj. By Lemma 3.5 there are no such paths after the loop in Line 14 terminates. Since the executions of Line 16 eliminate all v-to-t admissible paths j Cj, there are no admissible paths to t in G0 upon termination, so the flow computed is a maximum preflow. QED 3.2 Running Time of Algorithm 1 Lemma 3.6 Every cycle Cj appears at most twice as the cycle stored by the variable C in the loop in line 9. Proof: Consider Cj. It appears as the cycle stored by the variable C in the following two cases: 1. when i = j (i.e., when Cj is the external face of Hi). 2. when Cj is contained by some Hi but is not the external face of Hi. Note that case (2) implies that Cj has some dart that is strictly enclosed by Si, so this can happen for exactly one value of i since the subgraph strictly enclosed i with i(cid:48) > i. QED by Si is not part of Gi+1. Thus, Cj is not contained by any H(cid:48) We first consider the cost of the recursive calls in Line 11. In both cases in Lemma 3.6, the recursive call is on the graph Hi, so if T (n) denotes the running time of Algorithm 1 on an input graph with n nodes, the cycle Cj contributes at most T (Hj) + T (Hp(j)), where p(j) is the unique value such that Cj is contained by Hp(j) but is not the external face of Hp(j). Therefore, the total time required by all recursive calls is(cid:88) T (Hj) + T (Hp(j)). j 9 √ 3Gi−1 ≤ Hi − 2 j=k1 2Gi−1 ≤ 2 Observe that, since for every i, 1 Hj1.5 ≤ 0.7Gk1−11.5. 3Gi−1, we have Hi < Hj for i > j. Also note that, if Cj is not the external face of Hi j T (Hj) + T (Hp(j)) is bounded j≥2 T (Hj). and Hi contains Cj, then i > j. Therefore,(cid:80) by(cid:80) j T (Hj) + T (Hj+1) = T (H1) + 2(cid:80) Lemma 3.7 (cid:80)k2 2(cid:112)2Gj−1. By inspection, for k2 = k1, ( 2 Proof: By induction on k2 − k1. Recall that, for every j, Hj ≤ 2 provided Gk1−1 > N0 = 105. k1+1+k−1(cid:88) k1+k(cid:88) ≤ Hk11.5 + 0.7Gk11.5 3Gk1−1+2(cid:112)2Gk1−1)1.5 ≤ 0.7Gk1−1 Assume the claim holds for k2 − k1 = k − 1. Hj1.5 ≤ Hk11.5 + 3Gj−1 + Hj1.5 j=k1 ≤ (cid:16) j=k1+1 θGk1−1 + 2(cid:112)2Gk1−1(cid:17)1.5 (cid:16) (1 − θ)Gk1−1 + 2(cid:112)2Gk1−1(cid:17)1.5 , + 0.7 where θ is the balance parameter of the separator Sk1 . In the first inequality we have used the inductive assumption. Using the convexity of the above expres- sion, it can be bounded by setting θ = 2 3 , which satisfies the lemma provided that all graphs have at least N0 = 105 nodes. QED Lemma 3.8 Assume T (n) ≤ α1n1.5 log n for every N0 ≤ n < G0. Then, T (H1) + 2(cid:80) j≥2 T (Hj) < 0.98α1G01.5 log G0 (cid:88) Proof: Let θ1 denote the balance parameter for separator S1. T (H1) + 2 T (Hj) ≤ α1H11.5 log G0 + 2α1 log G0(cid:88) ≤ α1(θ1G0 + 2(cid:112)2G0)1.5 log G0 + 2 · 0.7α1 log G0(cid:16) Hj1.5 ≤ α1H11.5 log G0 + 2 · 0.7α1 log G0G11.5 (1 − θ1)G0 + 2(cid:112)2G0(cid:17)1.5 j≥2 j≥2 , where in the second inequality we have used Lemma 3.7. Using the convexity of the above expression, it can be bounded by setting θ = 1 3 , which yields the desired bound 0.98α1G01.5 log G0 provided G0 ≥ N0. QED Lemma 3.9 for every i, every node of Ci belongs to some Jordan separator Sj. 10 Proof: Ci, the external face of Hi consists of nodes that either belong to Si or to a face of Gi−1 that is not triangulated. To see that, consider a clockwise traversal of Si. For every two consecutive nodes of Si that are connected in Gi−1 by an edge, Si coincides with that edge (see Section 2.3), so it belongs to Ci. The only parts of Ci and Si that do not coincide correspond to Si crossing some non-triangulated face f of Gi−1, say at nodes u and v. In those cases, Ci consists of the clockwise subpath f between u and v. Since G0 is triangu- lated in the first line of the algorithm and Line 13, every face of Gi−1 that is not triangulated corresponds to regions that were strictly enclosed by previous separators, or more formally, to a union of the portions of G0 that are strictly enclosed by some Jordan separators in {Sj : j < i}. Therefore, every node on these faces belongs to some Jordan separator Sj, which proves the lemma. QED We can now put together the pieces to prove the running time stated in Theorem 1.1. Proof: (Of running time in Theorem 1.1. ) We have already argued that j T (Hj) + T (Hp(j)). The work done outside the recursive calls is dominated by the single-source single-sink flow computations in Line 16. Each of these computations takes O(G0 log G0) time. The overall time required for the non-recursive calls is j SjG0 log G0). thus O the time required for all recursive calls is bounded by(cid:80) . By lemma 3.9 this is O((cid:80)  ≤ α2G0 log G0(cid:88) (cid:12)(cid:12)(cid:12)G0 log G0(cid:17) (cid:88) Since Si is O((cid:112)Gi−1) and since the size of the Gis decreases exponentially, j Cj (cid:113)Gj−1 SjG0 log G0 (cid:16)(cid:12)(cid:12)(cid:12)(cid:83) we have O j ≤ α(cid:48) 2G01.5 log G0 j for some constants α2, α(cid:48) 2. T (G0) ≤(cid:88) The overall running time is therefore bounded by T (Hj) + T (Hp(j)) + α(cid:48) 2G01.5 log G0. j Assume inductively T (n) ≤ α1G01.5 log G0 for some constant α1. Then, by 2G01.5 log G0 which at most Lemma 3.8, T (G0 ≤ 0.98α1G01.5 log G0 + α(cid:48) α1G01.5 log G0 for appropriate choice of α1. QED 4 Converting a maximum feasible preflow into a maximum flow In this section we describe a linear time algorithm that, given a feasible preflow in a planar graph, converts it into a feasible flow of the same value. This 11 algorithm can be used to convert the maximum preflow output by Algorithm 1 into a maximum flow. This section contains no novel ideas and is included for completeness. A similar procedure was used in [14], but was not described in detail. First, use the technique of Kaplan and Nussbaum [15] to make the preflow acyclic. The running time of this step is dominated by a shortest paths compu- tation in the dual of the residual graph. This can be done in O(n log n) using Dijkstra, or in linear time using [11]. Let f denote the acyclic feasible maximum preflow in G. Let p(v) denote the net inflow of node v. Let D denote the DAG induced by arcs with f (d) > 0. Reverse every arc of D and compute a topological order on the nodes of D. The following algorithm pushes back flow from nodes with positive net inflow to the sources and runs in linear time. Upon termination, f is a feasible maximum flow. Algorithm 2 An algorithm that converts acyclic preflow p on a DAG D into a flow. 1: for v ∈ D in topological order do 2: 3: 4: 5: 6: 7: if v is not a sink then while p(v) > 0 do let uv be a dart, where u comes after v in topological order and f (d) > 0 x := min{f (d), p(v)} f (d) := f (d) − x p(v) := p(v) − x Acknowledgments We thank Glencora Borradaile for pointing out that computing a maximum preflow may be useful in solving the multiple source flow problem. References [1] Glencora Borradaile and Philip N. Klein. An ( log ) algorithm for maximum t-flow in a directed planar graph. J. ACM, 56(2), 2009. [2] E. Dinic. Algorithm for solution of a problem of maximum flow in networks with power estimation. Soviet Mathematics Doklady, 11:1277 -- 1280, 1970. [3] J. Edmonds and R. Karp. Theoretical improvements in algorithmic ef- ficiency for network flow problems. Journal of the ACM, 19(2):248 -- 264, 1972. 12 [4] J. Fakcharoenphol and S. Rao. Planar graphs, negative weight edges, short- est paths, near linear time. In Proceedings of the 42th Annual Symposium on Foundations of Computer Science, pages 232 -- 241, 2001. [5] C. Ford and D. Fulkerson. Maximal flow through a network. Canadian Journal of Mathematics, 8:399 -- 404, 1956. [6] G. Frederickson. Fast algorithms for shortest paths in planar graphs with applications. SIAM Journal on Computing, 16:1004 -- 1022, 1987. [7] A. Goldberg and S. Rao. Beyond the flow decomposition barrier. Journal of the ACM, 45(5):783 -- 797, 1998. [8] A. Goldberg and R. Tarjan. A new approach to the maximum-flow problem. Journal of the ACM, 35(4):921 -- 940, 1988. [9] R. Hassin. Maximum flow in (s, t) planar networks. Information Processing Letters, 13:107, 1981. [10] R. Hassin and D. B. Johnson. An O(n log2 n) algorithm for maximum flow in undirected planar networks. SIAM Journal on Computing, 14:612 -- 624, 1985. [11] M. R. Henzinger, P. N. Klein, S. Rao, and S. Subramanian. Faster shortest- path algorithms for planar graphs. Journal of Computer and System Sci- ences, 55(1):3 -- 23, 1997. [12] Hiroshi Imai and Kazuo Iwano. Efficient sequential and parallel algorithms for planar minimum cost flow. In Algorithms, volume 450 of Lecture Notes in Computer Science, pages 21 -- 30. Springer Berlin / Heidelberg, 1990. [13] A. Itai and Y. Shiloach. Maximum flow in planar networks. SIAM Journal on Computing, 8:135 -- 150, 1979. [14] D. B. Johnson and S. Venkatesan. Using divide and conquer to find flows in directed planar networks in O(n3/2 log n) time. In Proceedings of the 20th Annual Allerton Conference on Communication, Control, and Computing, pages 898 -- 905, 1982. [15] Haim Kaplan and Y. Nussbaum. Maximum flow in directed planar graphs with vertex capacities. In ESA 2009, pages 397 -- 407, 2009. [16] G. L. Miller. Finding small simple cycle separators for 2-connected planar graphs. Journal of Computer and System Sciences, 32(3):265 -- 279, 1986. [17] G. L. Miller and J. Naor. Flow in planar graphs with multiple sources and sinks. SIAM Journal on Computing, 24(5):1002 -- 1017, 1995. [18] J. Reif. Minimum s-t cut of a planar undirected network in O(n log2 n) time. SIAM Journal on Computing, 12:71 -- 81, 1983. 13 [19] A. Schrijver. On the history of the transportation and maximum flow problems. Mathematical Programming, 91(3):437 -- 445, 2002. [20] K. Weihe. Maximum (s, t)-flows in planar networks in O(V logV ) time. Journal of Computer and System Sciences, 55(3):454 -- 476, 1997. 14
1207.3586
2
1207
2012-09-28T13:10:18
Directed Acyclic Subgraph Problem Parameterized above the Poljak-Turzik Bound
[ "cs.DS", "cs.CC" ]
An oriented graph is a directed graph without directed 2-cycles. Poljak and Turz\'{i}k (1986) proved that every connected oriented graph $G$ on $n$ vertices and $m$ arcs contains an acyclic subgraph with at least $\frac{m}{2}+\frac{n-1}{4}$ arcs. Raman and Saurabh (2006) gave another proof of this result and left it as an open question to establish the parameterized complexity of the following problem: does $G$ have an acyclic subgraph with least $\frac{m}{2}+\frac{n-1}{4}+k$ arcs, where $k$ is the parameter? We answer this question by showing that the problem can be solved by an algorithm of runtime $(12k)!n^{O(1)}$. Thus, the problem is fixed-parameter tractable. We also prove that there is a polynomial time algorithm that either establishes that the input instance of the problem is a Yes-instance or reduces the input instance to an equivalent one of size $O(k^2)$.
cs.DS
cs
Directed Acyclic Subgraph Problem Parameterized above the Poljak-Turzík Bound Robert Crowston1, Gregory Gutin1, and Mark Jones1 1 Royal Holloway, University of London Egham TW20 0EX, UK [robert,gutin,markj]@cs.rhul.ac.uk Abstract An oriented graph is a directed graph without directed 2-cycles. Poljak and Turzík (1986) proved that every connected oriented graph G on n vertices and m arcs contains an acyclic subgraph with at least m2 + n−1 4 arcs. Raman and Saurabh (2006) gave another proof of this result and left it as an open question to establish the parameterized complexity of the following problem: does G have an acyclic subgraph with least m2 + n−1 4 + k arcs, where k is the parameter? We answer this question by showing that the problem can be solved by an algorithm of runtime (12k)!nO(1). Thus, the problem is fixed-parameter tractable. We also prove that there is a polynomial time algorithm that either establishes that the input instance of the problem is a Yes-instance or reduces the input instance to an equivalent one of size O(k 2). 1998 ACM Subject Classification F.2.2 Nonnumerical Algorithms and Problems Keywords and phrases Acyclic Subgraph, Fixed-parameter tractable, Polynomial Kernel Digital Object Identifier 10.4230/LIPIcs.xxx.yyy.p Introduction 1 The problem of finding the maximum acyclic subgraph in a directed graph1 is well-studied in the literature in graph theory, algorithms and their applications alongside its dual, the feedback arc set problem, see, e.g., Chapter 15 in [2] and references therein. This is true, in particular, in the area of parameterized algorithmics [3, 11, 12, 19]. Each directed graph D with m arcs has an acyclic subgraph with at least m/2 arcs. To obtain such a subgraph, order the vertices x1, . . . , xn of D arbitrarily and consider two spanning subgraphs of D: D0 with arcs of the form xixj, and D00 with arcs of the form xjxi, where i < j. One of D0 and D00 has at least m/2 arcs. Moreover, m/2 is the largest size of an acyclic subgraph in every symmetric digraph S (in a symmetric digraph the existence of an arc xy implies the existence of an arc yx). Thus, it makes sense to consider the parameterization2 above the tight bound m/2: decide whether a digraph D contains an acyclic subgraph with at least m/2 + k arcs, where k is the parameter. Mahajan et al. [14] and Raman and Saurabh [19] asked what the complexity of this problem is. For the case of oriented graphs (i.e., directed graphs with no directed cycles of length 2), Raman and Saurabh [19] proved that the problem is fixed-paramter tractable. A generalization of this 1 We use standard terminology and notation on directed graphs which almost always follows [2]. Some less standard and this-paper-specific digraph terminology and notation is provided in the end of this section. 2 We use standard terminology on parameterized algorithmics, see, e.g., [7, 8, 17]. 2 1 0 2 p e S 8 2 ] S D . s c [ 2 v 6 8 5 3 . 7 0 2 1 : v i X r a © Robert Crowston, Gregory Gutin, and Mark Jones; licensed under Creative Commons License NC-ND Conference title on which this volume is based on. Editors: Billy Editor, Bill Editors; pp. 1 -- 12 Leibniz International Proceedings in Informatics Schloss Dagstuhl -- Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany 2 Directed Acyclic Subgraph Problem Parameterized above the Poljak-Turzík Bound problem to integer-arc-weighted digraphs (where m/2 is replaced by the half of the total weight of D) was proved to be fixed-parameter tractable in [11]. For oriented graphs, m/2 is no longer a tight lower bound on the maximum size of an acyclic subgraph. Poljak and Turzík [18] proved the following tight bound on the max- imum size of an acyclic subgraph of a connected oriented graph D: m2 + n−1 4 . To see that the bound is indeed tight consider a directed path x1x2 . . . x2t+1 and add to it arcs x3x1, x5x3, . . . , x2t+1x2t−1. This oriented graph Ht consists of t directed 3-cycles and has 2t + 1 vertices and 3t arcs. Thus, m2 + n−1 4 = 2t and 2t is the maximum size of an acyc- lic subgraph of Ht: we have to delete an arc from every directed 3-cycle as the cycles are arc-disjoint. Raman and Saurabh [19] asked to determine the parameterized complexity of the follow- ing problem: decide whether a connected oriented graph D has an acyclic subgraph with at least m2 + n−1 4 + k arcs, where k is the parameter. Answering this question, we will prove 2) vertices and that this problem is fixed-parameter tractable and admits a kernel with O(k O(k 2) arcs. Observe that we may replace k by k4 to ensure that the parameter k is always integral. Therefore, the complexity of the Raman-Saurabh problem above is equivalent to that of the following parameterized problem. Acyclic Subgraph above Poljak-Turzík Bound (ASAPT) Instance: An oriented connected graph G with n vertices and m arcs. Parameter: k. Question: Does G contain an acyclic subgraph with at least m2 + n−1 4 + k4 arcs? Just a few years ago, as recorded by Mahajan et al. [14], there were only very few sporadic results on problems parameterized above or below nontrivial tight bounds. By now the situation has changed quite dramatically: most of the open questions in [14] on parameterized complexity of problems parameterized above or below tight bounds have been solved. In the process of solving these problems, some methods and approaches have been developed. One such method is the use of lower bounds on the maximum value of a pseudo-boolean function. The lower bounds are obtained using either a combination of probabilistic arguments and Fourier analysis inequalities [1, 9, 10, 11] or a combination of linear algebraic, algorithmic and combinatorial results and approaches [4]. Unfortunately, this method appears to be applicable mainly to constraint satisfaction problems rather than those on graphs and, thus, development of other methods applicable to problems on graphs parameterized above or below tight bounds, is of great interest. Recently, such a method based on linear programming was investigated in [6, 16]. This paper continues development of another such method, which is a combination of structural graph-theoretical and algorithmic approaches, recently introduced in [5]; in fact, this paper demonstrates that the approach of [5] for designing a fixed-parameter algorithm and producing a polynomial-size kernel for a problem on undirected graphs parameterized above tight bound can be modified to achieve the same for a problem on directed graphs. In a nutshell, the method uses both two-way reduction rules (i.e., rules reducing an instance to an equivalent one) and one-way reduction rules (in such a rule if the reduced instance is a Yes-instance, then the original instance is also a Yes-instance) to transform the input instance to a trivial graph. If the reduction rules do not allow us to conclude that the input instance is a Yes-instance, then the input instance has a relatively "regular" structure that can be used to solve the problem by a fixed-parameter dynamic programming Robert Crowston, Gregory Gutin, and Mark Jones 3 algorithm. To establish the reduction rules and to show their "completeness", a structural result on undirected graphs is used, such as Lemma 8 in this paper or Lemma 3 in [5]. While the underlying approach in both papers is the same, the proofs used are different due to the specifics of each problem. In particular, a different set of reduction rules is used, and the "regular" structure derived in our paper is rather different from that in [5]. The dynamic programming algorithm and kernel proof are also completely different, other than the fact that in both papers the proofs are based on the "regular" structure of the graph. 5) vertices, we obtain a kernel Finally, note that whilst the kernel obtained in [5] has O(k with just O(k 2) vertices and O(k 2) arcs. The paper is organized as follows. In the next section,we obtain two basic results on oriented graphs. Two-way and one-way reduction rules are introduced in Sections 3 and 4, respectively. Fixed-parameter tractability of ASAPT is proved in Section 5. Section 6 is devoted to proving the existence of a polynomial kernel. In Section 7, we briefly mention another recent paper that showed that ASAPT is fixed-parameter tractable. We also discuss two open questions. Some Digraph Terminology and Notation. Let D be a directed graph on n vertices +(x) is the number of arcs of D leaving x and m arcs. For a vertex x in D, the out-degree d and the in-degree d−(x) is the number of arcs of D entering x. For a subset S of vertices of +(S) denote the number of arcs of D leaving S and d−(S) the number of arcs of D D, let d entering S. For subsets A and B of vertices of D, let E(A, B) denote the set of arcs with exactly one endpoint in each of A and B (in both directions). For a set S of vertices, D[S] is the subgraph of D induced by S. When S = {s1, . . . , sp}, we will write D[s1, . . . , sp] instead of D[{s1, . . . , sp}]. The underlying graph UN(D) of D is the undirected graph obtained from D by replacing all arcs by edges with the same end-vertices and getting rid of one edge in each pair of parallel edges. The connected components of D are connected components of UN(D); D is connected if UN(D) is connected. Vertices x and y of D are neighbors if there is an arc between them. The maximum number of arcs in an acyclic subgraph of D will be denoted by a(D). Let γ(D) = m2 + n−c4 , where c is the number of connected components of D. By the Poljak-Turzík bound, we have a(G) ≥ γ(G) (1) for every oriented graph G. A tournament is an oriented graph obtained from a complete graph by orienting its edges arbitrarily. A directed p-cycle is a directed cycle with p arcs. 2 Basic Results on Oriented Graphs In our arguments we use the following simple correspondence between acyclic digraphs and orderings of vertices in digraphs. Let H be an acyclic spanning subgraph of a digraph D. It is well-known [2] and easy to see that there is an ordering x1, . . . , xn of vertices of D such that if xixj is an arc of H then i < j. On the other hand, any ordering x1, . . . , xn of vertices of a digraph D = (V, A) leads to an acyclic spanning subgraph of D: consider the subgraph induced by {xixj : xixj ∈ A, i < j}. As we study maximum-size acyclic subgraphs, we may restrict ourselves to acyclic spanning subgraphs. Thus, we may use interchangeably the notions of acyclic spanning subgraphs and vertex orderings. There are some known lower bounds on a(T) for tournaments T on n vertices, see, e.g., [20] and references therein. We show the following useful bound which we were unable to find in the literature. 4 Directed Acyclic Subgraph Problem Parameterized above the Poljak-Turzík Bound (cid:73) Lemma 1. For a tournament T on n vertices with m =(cid:0)n (cid:1) arcs, we can, in polynomial arcs, if n is odd. 4 − 1 = γ(T) + 2n−6 4 time, find an acyclic subgraph with at least m2 + 3n4 − 1 = γ(T) + 2n−3 4 m2 + 3(n−1) Proof. We prove the lemma by induction. The claim can easily be checked for n = 1 and n = 2 and we may assume that n ≥ 3. Consider first the case when n is even. Suppose that there exists a vertex x such that +(x) ≥ n2 + 1. Consider the tournament T 0 = T − x, with m0 = m − (n − 1) arcs and d n0 = n − 1 vertices. By induction, there is an ordering on T 0 that produces an acyclic spanning subgraph H0 of T 0 such that arcs, if n is even, or 2 a(H0) ≥ m0 2 + 3(n0 − 1) 4 − 1 = m − (n − 1) 2 + 3(n − 2) 4 − 1 = m 2 + 3n 4 − n 2 − 2. 2 + 3n0 Otherwise, for every vertex x of T, d Now add x to the beginning of this ordering. This produces an acyclic spanning subgraph H of T such that a(H) ≥ a(H0) + n2 + 1 ≥ m2 + 3n4 − 1. If there is a vertex x such that d−(x) ≥ n2 +1, the same argument applies, but x is added to the end of the ordering. +(x) ∈ { n2 − 1, n2}. Moreover, by considering the sum of out-degrees, exactly half the vertices have out-degree n2 . Hence, if n ≥ 4, there are at least two vertices with out-degree n2 . Let x and y be two such vertices, and suppose, without loss of generality, that there is an arc from x to y. Now consider T 0 = T −{x, y} with m0 = m − (2n − 3) edges and n0 = n − 2 vertices. By induction, there is an ordering on the 4 −1 = m2 + 3n4 −n−1 arcs. vertices of T 0 that produces an acyclic subgraph with at least m0 Place x and y at the beginning of this ordering, with x occurring before y. Then this will add all the arcs from x and y to the acyclic subgraph. Thus, a(T) ≥ m2 + 3n4 −n−1+n = m2 + 3n4 −1. Now suppose that n is odd. Let x be any vertex in T, and let T 0 = T − x. By induction, 4 − 1 arcs, there is an ordering on T 0 that produces an acyclic subgraph with at least m0 where n0 = n− 1 is the number of vertices and m0 = m− (n− 1) is the number of arcs in T 0. By placing x either at the beginning or end of this ordering, we may add at least (n − 1)/2 arcs. Thus, a(T) ≥ m−(n−1) (cid:74) (cid:73) Lemma 2. Let S be a nonempty set of vertices of an oriented graph G such that both 4 and a(G[S]) ≥ γ(G[S]) + k00 G − S and G[S] are connected. If a(G − S) ≥ γ(G − S) + k0 4 , then a(G) ≥ γ(G) + k0+k00−1 In particular, a(G) ≥ γ(G) + k0+k00−1 if E(S, V (G) \ S) is even and a(G) ≥ γ(G) + k0+k00+1 4 Proof. Form an acyclic subgraph on G as follows. Assume without loss of generality that +(S) ≥ d−(S). Pick the arcs leaving S together with the arcs of the acyclic subgraphs in d G− S and G[S]. This forms an acyclic subgraph H. Let m = m0 + m00 + ¯m and n = n0 + n00, where G− S has m0 arcs and n0 vertices, G[S] has m00 arcs and n00 vertices and ¯m = d +(S)+ 4 + ¯m2 + d+(S)−d−(S) d−(S). The acyclic subgraph H has at least γ(G−S)+ k0 = 2 + d+(S)−d−(S) m0+m00+ ¯m2 arcs, as (cid:74) required. 4 +γ(G[S])+ k00 = γ(G) + k0+k00−1 , if E(S, V (G) \ S) is odd. 2 = m2 + 3(n−1) 4 + d+(S)−d−(S) 4 + n00−1 4 + k0 + 3(n−1) 4 − 1 + n−1 + d+(S)−d−(S) 4 − 1. 2 + 3n0 4 + k00 + n0−1 2 . 4 2 2 4 4 2 Two-way Reduction Rules 3 In the rest of this paper, G stands for an arbitrary connected oriented graph with n vertices and m arcs. We initially apply two 'two-way' reduction rules to (G, k) to form a new instance (G0, k) such that (G0, k) is a Yes-instance of ASAPT if and only if (G, k) is a Yes-instance Robert Crowston, Gregory Gutin, and Mark Jones 5 of ASAPT (i.e., the value of the parameter remains unchanged). We denote the number of vertices and arcs in G0 by n0 and m0, respectively. (cid:73) Reduction Rule 1. Let x be a vertex and S a set of two vertices such that G[S] is a component of G − x and G[S ∪ {x}] is a directed 3-cycle. Then G0 := G − S. (cid:73) Lemma 3. If (G0, k) is an instance obtained from (G, k) by an application of Rule 1, then G0 is connected, and (G0, k) is a Yes-instance of ASAPT if and only if (G, k) is a Yes-instance of ASAPT. Proof. Any two components of G0 − x will be connected by x and so G0 is connected. Since a(G0) = a(G) − 2, m0 = m − 3 and n0 = n − 2, we have a(G) ≥ m2 + n−1 4 + k4 if and only if a(G0) ≥ m0 (cid:74) (cid:73) Reduction Rule 2. Let a, b, c, d, e be five vertices in G such that G[a, b, c] and G[c, d, e] are directed 3-cycles, G[a, b, c, d, e] = G[a, b, c] ∪ G[c, d, e] and a, e are the only vertices in {a, b, c, d, e} that are adjacent to a vertex in G − {a, b, c, d, e}. To obtain G0 from G, delete b, c and d, add a new vertex x and three arcs such that G[a, x, e] is a directed 3-cycle. (cid:73) Lemma 4. If (G0, k) is an instance obtained from (G, k) by an application of Rule 2, then G0 is connected, and (G0, k) is a Yes-instance of ASAPT if and only if (G, k) is a Yes-instance of ASAPT. Proof. Clearly, G0 is connected. Note that a(G0) = a(G) − 2, m0 = m − 3 and n0 = n − 2. Thus, we have a(G) ≥ m2 + n−1 (cid:74) 4 + k4 if and only if a(G0) ≥ m0 2 + n0−1 2 + n0−1 4 + k4 . 4 + k4 . 4 One-way Reduction Rules Recall that G stands for an arbitrary connected oriented graph with n vertices and m arcs. We will apply reduction rules transforming an instance (G, k) of ASAPT into a new instance (G0, k0), where G0 is an oriented graph with n0 vertices and m0 arcs, and k0 is the new value of the parameter. We will see that for the reduction rules of this section the following property will hold: if (G0, k0) is a Yes-instance then (G, k) is a Yes-instance, but not necessarily vice versa. Thus, the rules of this section are called one-way reduction rules. (cid:73) Reduction Rule 3. Let x be a vertex such that G − x is connected, and d To obtain (G0, k0) remove x from G and reduce k by 2d (cid:73) Lemma 5. If (G0, k0) is an instance reduced from (G, k) by an application of Rule 3, then G0 is connected, and if (G0, k0) is a Yes-instance then (G, k) is a Yes-instance. Proof. Let (G0, k0) be a Yes-instance. Then by Lemma 2 with S = {x} and k00 = 0, a(G) ≥ γ(G) + k0−1 (cid:74) (cid:73) Reduction Rule 4. Let S be a set of vertices such that G − S is connected, G[S] is a tournament, and S ≥ 4. To obtain (G0, k0), remove S from G and reduce k by 2S − 4 if S is even, or 2S − 7 if S is odd. (cid:73) Lemma 6. If (G0, k0) is an instance obtained from (G, k) by an application of Rule 4, then G0 is connected, and if (G0, k0) is a Yes-instance then (G, k) is a Yes-instance. Proof. Suppose S is even. By Lemma 1, a(G[S]) ≥ γ(G[S]) + 2S−3 a(G0) ≥ γ(G0) + (k − 2S + 4)/4, then a(G) ≥ γ(G) + (k−2S+4)+(2S−3)−1 required. . By Lemma 2, if = γ(G) + k4 , as = γ(G) + k4 , as required. 4 + d+(S)−d−(S) +(x) − d−(x) − 1. +(x) 6= d−(x). 2 4 4 6 Directed Acyclic Subgraph Problem Parameterized above the Poljak-Turzík Bound 4 , and so k0 = k − (2S − 7) is applied. A similar argument applies in the case when S is odd, except the bound from Lemma 1 is γ(G[S]) + 2S−6 (cid:74) (cid:73) Reduction Rule 5. Let S be a set of three vertices such that the underlying graph of G[S] is isomorphic to P3, and G−S is connected. To obtain (G0, k0), remove S from G and reduce k by 1. (cid:73) Lemma 7. If (G0, k0) is an instance obtained from (G, k) by an application of Rule 5, then G0 is connected, and if (G0, k0) is a Yes-instance then (G, k) is a Yes-instance. Proof. Observe that a(G[S]) = γ(G[S])+ 1 then a(G) ≥ γ(G) + k/4. 2. Hence, by Lemma 2, if a(G0) ≥ γ(G0)+(k−1)/4, (cid:74) Fixed-Parameter Tractability of ASAPT 5 The next lemma follows immediately from a nontrivial structural result of Crowston et al. (Lemma 3 in [5]). (cid:73) Lemma 8. Given any connected undirected graph H, at least one of the following properties holds: A There exist v ∈ V (H) and X ⊆ V (H) such that X is a connected component of H − v B There exist a, b, c ∈ V (H) such that H[{a, b, c}] is isomorphic to P3 and H − {a, b, c} is and X is a clique; connected; C There exist x, y ∈ V (H) such that {x, y} /∈ E(H), H − {x, y} is disconnected, and for all connected components X of H − {x, y}, except possibly one, X ∪ {x} and X ∪ {y} are cliques. (cid:73) Lemma 9. For any connected oriented graph G with at least one edge, one of Rules 1, 3, 4, 5 applies. Proof. If there is a vertex x ∈ X such that G − x is connected and d +(x) 6= d−(x) (we will call such a case an unbalanced case), then Rule 3 applies. Thus, assume that for each x ∈ X such that G − x is connected we have d +(x) = d−(x). Consider the case when property A holds. If X = 3, there has to be exactly one arc between X and v and G[X] is a directed 3-cycle as otherwise we have an unbalanced case. Let x ∈ X be the endpoint of this arc in X. Then Rule 1 applies with S = X\{x}. If X = 2, then G[X ∪ {v}] is a directed 3-cycle (as otherwise we have an unbalanced case) and so Rule 1 applies. We cannot have X = 1 as this is an unbalanced case. If X ≥ 4, Rule 4 applies on S = X. If property B holds, then Rule 5 can be applied to the path P3 formed by a, b, c in the underlying graph of G. Consider the case when property C holds. We may assume without loss of generality that the non-tournament component is adjacent to y. Consider the subcase when G − {x, y} has two connected components, X1 and X2, that are tournaments. Let x1 ∈ X1, x2 ∈ X2 and observe that the subgraph induced by x1, x, x2 forms a P3 in the underlying graph of G and G − {x1, x, x2} is connected, and so Rule 5 applies. Now consider the subcase when G − {x, y} has only one connected component X that is a tournament. If X ≥ 3, then X ∪ {x} is a tournament with least four vertices, and so Rule 4 applies. If X = 2, then let X = {a, b}. Observe that a is adjacent to three vertices, Robert Crowston, Gregory Gutin, and Mark Jones 7 b, x, y, and so we have an unbalanced case to which Rule 3 applies. Finally, X = {a} is a singleton, then observe that x, a, y form a P3 in the underlying graph of G and G−{x, a, y} (cid:74) is connected, and so Rule 5 applies. In this paper, we consider the one-vertex undirected graph as 2-connected. A maximal 2-connected induced subgraph of an undirected graph is called a block. An undirected graph H is called a forest of cliques if each block of H is a clique. A subgraph B of an oriented graph G is a block if UN(B) is a block in UN(G). An oriented graph G is a forest of cliques if UN(G) is a forest of cliques. A connected graph H that is a forest of cliques is known as a tree of cliques. (cid:73) Lemma 10. Given a connected oriented graph G and integer k, we can either show that (G, k) is a Yes-instance of ASAPT, or find a set U of at most 3k vertices such that G− U is a forest of cliques with the following properties: 1. Every block in G − U contains at most three vertices; 2. Every block X in G − U with X = 3 induces a directed 3-cycle in G; 3. Every connected component in G − U has at most one block X with X = 2 vertices; 4. There is at most one block in G − U with one vertex (i.e., there is at most one isolated vertex in G − U). Proof. Apply Rules 1, 3, 4, 5 exhaustively, and let U be the set of vertices removed by Rules 3, 4, and 5 (but not Rule 1). If we reduce to an instance (G00, k00) with k00 ≤ 0, then by Lemmas 3, 5, 6 and 7, (G, k) is a Yes-instance and we may return Yes. Now assume that, in the completely reduced instance (G00, k00), k00 > 0. We will prove that U ≤ 3k and G − U satisfies the four properties of the lemma. Observe that each time k is decreased by a positive integer q, at most 3q vertices are added to U. Thus, U ≤ 3k. The rest of our proof is by induction. Observe that, by Lemma 9, for the completely reduced instance (G00, k00) either G00 = ∅ or G00 consists of a single vertex. Thus, G00− U satisfies the four properties of the lemma, which forms the basis of our induction. For the induction step, consider an instance (G00, k00) obtained from the previous instance (G0, k0) by the application of a reduction rule. By the induction hypothesis, G00 − U satisfies the four properties of the lemma. In the application of each of Rules 3, 4 and 5, the vertices deleted are added to U. Hence G00− U = G0− U and we are done unless G00 is obtained from G0 by an application of Rule 1. Recall that in Rule 1 we delete a set S such that G[S ∪{x}] forms a directed 3-cycle. We do not add S to U. If x ∈ G00 − U, then in G0 − U, S ∪ {x} forms a block of size 3 that is a directed 3-cycle. If x /∈ G00 − U, then in G0 − U, S forms a new connected component with one block S with S = 2 vertices. Thus, G0 − U satisfies (cid:74) the four properties. (cid:73) Theorem 11. There is an algorithm for ASAPT of runtime O((3k)!nO(1)). Proof. We may assume that for a connected oriented graph G we have the second alternative in the proof of Lemma 10, i.e., we are also given the set U of at most 3k vertices satisfying the four properties of Lemma 10. Consider an algorithm which generates all orderings of U, in time O((3k)!) as U ≤ 3k. An ordering u1, u2, ..., uU of U means that in the acyclic subgraph of G we are constructing, we keep only arcs of G[U] of the form uiuj, i < j. For each ordering we perform the following polynomial-time dynamic programming procedure. For each vertex x ∈ G − U, we define a vector (x0, . . . , xt+1). Initially, set xi to be the number of vertices uj ∈ U with an arc from uj to x if j ≤ i, or an arc from x to uj if 8 Directed Acyclic Subgraph Problem Parameterized above the Poljak-Turzík Bound i < j. Note that xi is the number of arcs between x and U in the acyclic subgraph under the assumption that in the ordering of the vertices of G, x is between ui and ui+1. Given v, w ∈ V (G − U) and an ordering of U ∪ {v, w}, an arc vw is satisfiable if there is no up such that v is after up and w is before up, for some p ∈ [U]. Let T be a set of arcs and let V (T) be the set of end-vertices of T. For an ordering of U ∪ V (T), T is satisfiable if each arc is satisfiable, and the set T induces an acyclic subgraph. If G−U contains a block S that is itself a connected component, consider S and arbitrarily select a vertex x of S. Otherwise, find a block S in G − U with only one vertex x adjacent to other vertices in G − U (such a block exists as every block including an end-vertex of a longest path in UN(G) − U is such a block). Without loss of generality, assume that S has three vertices x, y, z (the case S = 2 can be considered similarly). For each i ∈ {0, . . . , t + 1}, we let αi be the maximum size of a set of satisfiable arcs between S and U under the restriction that x lies between ui and ui+1. Observe that αi = maxj,h(xi + yj + zh + β(i, j, h)), where β(i, j, h) is the maximum size of a set of satisfiable arcs in G[S] under the restriction that x lies between ui and ui+1, y lies between uj and uj+1, and z lies between uh and uh+1. Now delete S\{x} from G, and set xi = αi for each i. Continue until each component of G − U consists of a single vertex. Let x be such a single vertex, let G∗ be the original graph G (i.e., given as input to our algorithm), and let X be the component of G∗ − U containing x. By construction, xi is the maximum number of satisfiable arcs from arcs in X and arcs between X and U in G∗, under the assumption x is between ui and ui+1. Since each vertex x represents a separate component, the maximum x∈V (G−U)(maxi xi) arcs, where Q is the number of arcs acyclic subgraph in G has Q +P uiuj in G[U] such that i < j. Since the dynamic programming algorithm runs in time polynomial in n, running the (cid:74) algorithm for each permutation of U gives a runtime of O((3k)!nO(1)). Polynomial Kernel 6 (cid:73) Lemma 12. Let T be a directed 3-cycle, with vertices labeled 0 or 1. Then there exists an acyclic subgraph of T with two arcs, such that there is no arc from a vertex labeled 1 to a vertex labeled 0. Proof. Let V (T) = {a, b, c} and assume that a, b are labeled 0. Since T is a cycle, either the arc ac or bc exists. This arc, together with the arc between a and b, form the required (cid:74) acyclic subgraph. A similar argument holds when two vertices in T are labeled 1. Recall that U was introduced in Lemma 10 as the set of vertices removed by Rules 3, 4, and 5. We say that a set {u, a, b} of vertices is a dangerous triangle if u ∈ U, G[a, b] is a block in G − U, and G[u, a, b] is a directed 3-cycle. (cid:73) Lemma 13. For a vertex u ∈ U, let tu denote the number of neighbors of u in G−U which do not appear in a dangerous triangle containing u. If tu ≥ 4k, then we have a Yes-instance. Proof. Let S denote the subgraph of G − U consisting of all components C of G − U which have a neighbor of u. For each component C of S, let tu(C) denote the number of neighbors of u in C which do not appear in a dangerous triangle containing u. For each vertex x ∈ G − U, label it 0 if there exists an arc from x to u, or 1 if there is an arc from u to x. Recall from Lemma 10 each connected component in G − U has at Robert Crowston, Gregory Gutin, and Mark Jones 9 most one block X = {x, y} with X = 2. If one vertex x is labeled, assign y the same label. Finally, assign label 1 to any remaining unlabeled verticies in G − U. We will now construct an acyclic subgraph H0 of G − U such that there is no arc from a vertex labeled 1 to a vertex labeled 0. We then extend this to an acyclic subgraph H containing all the arcs between u and S. Consider each block X in G− U. If X = 3, and X is a directed 3-cycle, then by Lemma 12 there is an acyclic subgraph of X with two arcs. Add this to H0. Now suppose X = 2, If G[X ∪ {u}] is a dangerous and let a, b be the vertices of X with an arc from a to b. triangle, then a is labeled 1 and b is labeled 0. In this case we do not include the arc ab in H0. However, H will include the two arcs between X and u, which do not count towards tu(C). If G[X ∪ {u}] is not a dangerous triangle, then we include the arc ab in the acyclic subgraph H0. Finally, let H be the acyclic subgraph formed by adding all arcs between u and S to H0. Observe that for each component C of S, if G[C∪{u}] contains no dangerous triangle then H contains at least γ(C) arcs in G[C] (by the construction of H0) and tu(C) arcs between C and u (since all arcs between S and u are in H), and γ(C ∪ {u}) := γ(G[C ∪ {u}]) = 4 arcs. Since G[C ∪ {u}] γ(C) + tu(C) 2 + 1 contains no dangerous triangle but C is adjacent to u, tu(C) ≥ 1, and so H contains at least γ(C ∪ {u}) + tu(C) 4 4. So H contains at least γ(C ∪ {u}) + tu(C) If G[C ∪ {u}] contains a dangerous triangle then H contains at least γ(C) − 3 2 − 1 arcs. arcs. ) = γ(S ∪ {u}) + tu4 . arcs. Hence, if tu ≥ 4k, we have a Yes-instance. Let C1, C2, . . . , Cq be the components of S. Observe that γ(S∪{u}) =Pq 4 arcs in G[C] (this can be seen by contracting the arc in C appearing in the dangerous triangle, and observing that in the resulting component C0, H has at least γ(C0) arcs) and tu(C) + 2 arcs between C and u, and γ(C ∪ {u}) = γ(C) + tu(C)+2 4. Thus, H contains at least γ(C ∪ {u}) + tu(C) 2 i=1 γ(Ci∪{u}). Pq Then by combining the acyclic subgraphs for each G[Ci∪{u}], we have that a(G[S∪{u}]) ≥ i=1(γ(Ci ∪ {u}) + tu(Ci) 4 Finally, observe G−S−u has at most 3k component, since each component must contain a vertex of U. By repeated application of Lemma 2, this implies there is an acyclic subgraph of G with at least γ(G) + tu−3k4 (cid:74) Using the above lemma and the fact that U ≤ 3k (by Lemma 10), we have that unless 2 vertices in G − U that are adjacent to a (G, k) is a Yes-instance, there are at most 12k vertex in U and do not appear in a dangerous triangle with that vertex. (cid:73) Lemma 14. Let s be the number of components in G − U in which every neighbor x of a vertex u ∈ U appears in a dangerous triangle together with u. If s ≥ k, we have a Yes-instance. Proof. By Lemma 10 such a component Ci contains at most one block of size 2. Since only blocks of size 2 can have vertices in dangerous triangles, only the vertices from this block in Ci may be adjacent to a vertex in U. But since G is reduced by Rule 1, component Ci must consist of only this block. Moreover, this block must appear in at least two dangerous triangles. Let ai, bi be the vertices of Ci, i = 1, . . . , s and let C = ∪s i=1{ai, bi}. Let aibi be an arc for each i = 1, . . . , s and note that every arc of G containing ai (bi, respectively) is either aibi or is from U to ai (from bi to U, respectively). Let δi be the number of dangerous triangles containing ai and bi; note that δi ≥ 2. By (1), G − C has an acyclic subgraph H with at least γ(G − C) arcs. Observe that we can add to H all arcs entering each ai and leaving each bi, i = 1, . . . , s, and obtain an acyclic subgraph H∗ of G. We will prove that H∗ contains enough arcs to show that (G, k) + 1 2 10 Directed Acyclic Subgraph Problem Parameterized above the Poljak-Turzík Bound vertices and 2Ps is a Yes-instance. Observe that G − C has at most U ≤ 3k components and G[C] has 2s i=1 δi + s arcs, and recall that each δi ≥ 2. Thus, the number of arcs in H∗ sX is at least sX + n − 2s − 3k + 2 γ(G − C) + 2 δi ≥ m − 2Ps i=1 δi − s sX 2 ≥ γ(G) + i=1 4 δi i=1 δi − s − 3k 4 ≥ γ(G) + k 4 . i=1 (cid:74) Let H be an undirected forest of cliques, where each block contains at most three vertices. A block B of H is called a leaf-block if there is at most one vertex of B belonging to another block of H. We denote the set of leaf-blocks of H by L(H). A block B of H is called a path-block if there is another block B0 of H such that B and B0 have a common vertex c which belongs only to these two blocks, at most one vertex of B belongs to a block other than B0, and at most one vertex of B0 belongs to a block other than B. We denote the set of path-blocks which are not leaf-blocks by P(H). (cid:73) Lemma 15. For a forest of cliques H, with each block of size at most three, if l = L(H) and p = P(H) then V (H) ≤ 8l + 2p. Proof. We prove the claim by induction on the number of blocks in H. The case when H has only one block is trivial. Thus, we may assume that H has at least two blocks and H is connected. Let B be a leaf-block of H, and obtain subgraph H0 by deleting the vertices of B not belonging to another block. Note that V (H) ≤ V (H0) + 2. Assume that H0 has a leaf-block B0 which is not a leaf-block in H. Observe that B0 ∈ P(H) and by induction V (H) ≤ 2 + 8l + 2(p − 1) ≤ 8l + 2p. 2) arcs. Now assume that L(H0) = l − 1. Observe that removal of B from H may lead to a neighbour of B, B0, becoming a path-block in H0, together with at most two blocks neighbouring B0. Thus, at most three blocks may become path-blocks in H0. By the induction hypothesis, V (H0) ≤ 8(l−1)+2(p+3). Hence, V (H) ≤ 8(l−1)+2(p+3)+2 ≤ (cid:74) 8l + 2p. (cid:73) Theorem 16. Acyclic Subgraph above Poljak-Turzík Bound (ASAPT) has a kernel with O(k Proof. Consider an instance of (G∗, k) of ASAPT. Apply Rules 1 and 2 to obtain an instance (G, k) reduced by Rules 1 and 2. 2) vertices and O(k Assume that (G, k) is reduced by Rules 1 and 2 and it is a No-instance. Now we will apply all reduction rules but Rule 2. As a result, we will obtain the set U of vertices deleted in Rules 3, 4, and 5. By Lemma 10, U ≤ 3k and, by Lemma 13, each u ∈ U has at most 4k neighbors that do not appear in a dangerous triangle with u. By Lemma 14, there are at most 2k vertices in G − U that appear in a dangerous triangle with every neighbor in U (there are at most k components, and each component has two vertices). Hence the number of neighbors in G− U of vertices of U is at most 4kU + 2k = 12k 2 + 2k. Now we will adopt the terminology and notation of Lemma 15 (we extend it from UN(G− U) to G− U as we have done earlier). Consider a leaf-block B. Since G is reduced by Rules 1 and 3, B must contain a vertex v adjacent to U, and furthermore, v is not contained in any other block. Hence, L(G − U) ≤ 12k 2 + 2k. Robert Crowston, Gregory Gutin, and Mark Jones 11 Next, we observe that Rule 2 implies there do not exist two adjacent 3-vertex blocks B = {a, b, c}, B0 = {c, d, e} such that only a and e belong to other blocks, unless one of b, c, d has a neighbor in U. Observe that each connected component of G − U contains 2 + 2k 2-vertex path blocks. Each at most one 2-vertex block, so there are at most 12k 2-vertex path block is adjacent to at most two 3-vertex path blocks. Hence, P(G − U) ≤ 2), and 6(12k so V (G) ≤ O(k 2) + 3k = O(k 2). 2) arcs. There are at most U2 arcs in U. Between G − U Finally, we show G has O(k and U there are at most (4k + 2k)U arcs. Finally, observe that G − U has at most 2 +2k) blocks, and each block contains at most 3 arcs. Hence, A(G) ≤ V (G− U) ≤ 20(12k U2 + 60(12k 2 + 2k). So, by Lemma 15, V (G − U) ≤ 8(12k 2 + 2k) + 2 · 6(12k 2 + 2k) ≤ 9k 2 + 2k) = O(k 2 + 60(12k 2 + 2k) = O(k 2). Thus, either (G, k) is a Yes-instance, or (G, k) forms a kernel with O(k 2) arcs. 2) vertices and (cid:74) O(k 7 Discussion After this paper was submitted to FSTTCS 2012, we learned that Mnich et al. [15] combined modified approaches of [5] and [18] to prove that a number of graph problems parameterized above tight lower bounds are fixed-parameter tractable. In particular, they proved that ASAPT is fixed-parameter tractable. However, [15] did not obtain any results on polynomial kernels. The algorithm of Theorem 11 has runtime 2O(k log k) It would be interesting to design an algorithm of runtime 2O(k) nO(1) or to prove that such an algorithm does not exist, subject to a certain complexity hypothesis, as in [13]. It would also be interesting to see whether ASAPT admits a kernel with O(k) vertices. nO(1). 1 2 3 4 5 6 7 8 9 10 11 References N. Alon, G. Gutin, E. J. Kim, S. Szeider, and A. Yeo, Solving MAX-r-SAT above a tight lower bound. Algorithmica 61 (2011) 638 -- 655. J. Bang-Jensen and G. Gutin, Digraphs: Theory, Algorithms and Applications, Springer- Verlag, London, 2nd Ed., 2009. J. Chen, Y. Liu, S. Lu, B. O'Sullivan, and I. Razgon, A fixed-parameter algorithm for the directed feedback vertex set problem. J. ACM 55(5) (2008). R. Crowston, M. Fellows, G. Gutin, M. Jones, F. Rosamond, S. Thomassé and A. Yeo. Sim- ultaneously Satisfying Linear Equations Over F2: MaxLin2 and Max-r-Lin2 Parameterized Above Average. In FSTTCS 2011, LIPICS Vol. 13, 229 -- 240, 2011. R. Crowston, M. Jones and M. Mnich, Max-Cut Parameterized above the Edwards-Erdős Bound, In ICALP 2012, Lect. Notes Comput. Sci. 7391 (2012) 242 -- 253. M. Cygan, M. Pilipczuk, M. Pilipczuk, and J. O. Wojtaszczyk. On multiway cut paramet- erized above lower bounds. In IPEC 2011, Lect. Notes Comput. Sci. 7112 (2011), 1 -- 12. R. G. Downey and M. R. Fellows, Parameterized Complexity. Springer-Verlag, 1999. J. Flum and M. Grohe, Parameterized Complexity Theory, Springer-Verlag, 2006. G. Gutin, L. van Iersel, M. Mnich, and A. Yeo, All ternary permutation constraint satisfac- tion problems parameterized above average have kernels with quadratic number of vertices. J. Comput. Syst. Sci. 78 (2012), 151 -- 163. G. Gutin, E. J. Kim, M. Mnich, and A. Yeo. Betweenness parameterized above tight lower bound. J. Comput. Syst. Sci. 76 (2010), 872 -- 878. G. Gutin, E.J. Kim, S. Szeider, A. Yeo, A probabilistic approach to problems parameter- ized above or below tight bounds, J. Comput. Syst. Sci. 77 (2011) 422 -- 429. 12 Directed Acyclic Subgraph Problem Parameterized above the Poljak-Turzík Bound 12 13 14 15 16 17 18 19 20 G. Gutin and A. Yeo, Some Parameterized Problems on Digraphs. The Computer Journal 51 (2008) 363 -- 371. D. Lokshtanov, D. Marx and S. Saurabh, Slightly superexponential parameterized prob- lems, In SODA 2011, 760 -- 776, 2011. M. Mahajan, V. Raman, S. Sikdar, Parameterizing above or below guaranteed values, J. Comput. System Sci. 75 (2) (2009) 137 -- 153. M. Mnich, G. Philip, S. Saurabh, and O. Suchý, Beyond Max-Cut: λ-Extendible Properties Parameterized Above the Poljak-Turzík Bound. In FSTTCS 2012, to appear. N.S. Narayanaswamy, V. Raman, M.S. Ramanujan, and S. Saurabh, LP can be a cure for Parameterized Problems, In STACS 2012, LIPICS Vol. 14, 338 -- 349, 2012. R. Niedermeier. Invitation to Fixed-Parameter Algorithms, Oxford UP, 2006. S. Poljak and D. Turzík, A polynomial time heuristic for certain subgraph optimization problems with guaranteed worst case bound. Discrete Mathematics, 58 (1) (1986) 99 -- 104. V. Raman and S. Saurabh, Parameterized algorithms for feedback set problems and their duals in tournaments. Theor. Comput. Sci., 351 (3) (2006) 446 -- 458. J. Spencer, Optimal ranking of tournaments. Networks 1 (1971) 135 -- 138.
1101.3448
1
1101
2011-01-18T12:58:02
Inducing the LCP-Array
[ "cs.DS" ]
We show how to modify the linear-time construction algorithm for suffix arrays based on induced sorting (Nong et al., DCC'09) such that it computes the array of longest common prefixes (LCP-array) as well. Practical tests show that this outperforms recent LCP-array construction algorithms (Gog and Ohlebusch, ALENEX'11).
cs.DS
cs
Inducing the LCP-Array Johannes Fischer∗ 1 1 0 2 n a J 8 1 ] S D . s c [ 1 v 8 4 4 3 . 1 0 1 1 : v i X r a Abstract We show how to modify the linear-time construction algorithm for suffix arrays based on induced sorting (Nong et al., DCC'09) such that it computes the array of longest common prefixes (LCP-array) as well. Practical tests show that this outperforms recent LCP-array construction algorithms (Gog and Ohlebusch, ALENEX'11). 1 Introduction The suffix array is an important data structure in text indexing. It is used to solve many tasks in string processing, from exact and inexact string matching to more involved tasks such as data compression, repeat recognition, and text mining. It is also the basic building block for the more complex text index called the suffix tree, either indirectly for index construction, or directly when dealing with compressed suffix trees. In all of the above applications (possibly apart from exact string matching), the suffix array is accompanied by its sister-array, the array of longest common prefixes (LCP-array for short). Since their introduction in the early 1990's, much research has been devoted to the fast construc- tion of suffix arrays. Although it is in principle possible to derive the suffix array from the suffix tree, for which linear-time algorithms had already been discovered earlier [22], for reasons of time and space the aim was to construct the suffix array directly, without help of the tree. This long line of research (see [20] for a good reference) culminated in three linear-time algorithms [11,13,14]. However, these algorithms were notorious for being "linear but not fast" [2], as they were slower than other non-linear algorithms that had been discovered before and continued to be discovered afterwards. This un-satisfactory situation (at least for theoretical practioners or practical theoreticians, who want linear-time algorithms to perform faster than super-linear ones) changed substantially when in 2009 a new linear-time algorithm based on induced sorting was presented [18]. A careful implemen- tation of this approach due to Yuta Mori led to one of the fastest known suffix array construction algorithms, often outperforming all other linear or super-linear implementations. Less emphasis has been put on the efficient construction of the LCP-array. Manber and Myers [15] mentioned that it can be constructed along with their method for constructing the suffix array, but their algorithm ran in O(n lg n) time and performed rather poor in practice. Kasai et al. [12] gave an elegant algorithm for constructing the LCP-array in linear time. A few refinements of ∗Computer Science Department, Karlsruhe University, [email protected] 1 this algorithm led to improvements in either space [16] or in running time [10]. However, these algorithms could not compete with the carefully tuned algorithms for suffix arrays. This led to the odd situation that the rather difficult task of sorting suffixes could be solved faster than the seemingly simpler task of computing longest common prefixes. This situation changed only recently when a theoretically slow O(n2) but practically fast LCP- array construction algorithm was presented [7]. Their algorithm exploits properties of the Burrows- Wheeler-Transformation (BWT) of the text, which must be computed before. The authors of [7] also sketch how their approach yields a linear-time algorithm (for constant alphabets, otherwise it takes O(n lg σ) time). Driven by the success of the fast linear-time algorithm based on induced sorting [18], we show in this paper how it can be adapted such that it also induces the LCP-values (Sect. 3). This results in a new linear-time algorithm for constructing LCP-arrays (for integer alphabets). In Sect. 4 we show that an ad-hoc implementation of the theoretical ideas leads to a fast practical algorithm that outperforms all other previous algorithms. An additional advantage of our algorithm is that it does not rely on the BWT, and is hence preferable in situations where the BWT is not already present (such as compressed suffix arrays not based on the BWT [17], for example). Before detailing our theoretical and practical contributions, in Sect. 2 we first introduce some notations, and then review the induced sorting algorithm for suffix arrays. 2 Previous Work and Concepts 2.1 Suffix- and LCP-Arrays Let T = t1 . . . tn be a text consisting of n characters drawn from an ordered alphabet Σ of size σ = Σ. The substring of T ranging from i to j is denoted by Ti..j, for 1 ≤ i ≤ j ≤ n. The substring Ti..n is called the i'th suffix of T and is denoted by Si. As usual, for convenience we assume that T ends in a unique character $ which is not present elsewhere in the text, and that $ < a for all a ∈ Σ. The suffix array SA[1, n] of T is a permuation of the integers in [1, n] such that SSA[i−1] <lex SSA[i] for all 1 < i ≤ n. In other words, SA describes the lexicographic order of the suffixes. The array LCP of longest common prefixes is based on the suffix array. It holds the lengths of the longest common prefixes of lexicographically adjacent suffixes, in symbols: LCP[i] = max{ℓ > 0 TSA[i]..SA[i]+ℓ−1=SA[i−1]..SA[i−1]+ℓ−1} for 1 < i ≤ n, and LCP[0] = 0. 2.2 Constructing Suffix Arrays by Induced Sorting As the basis of our new LCP-array construction algorithm is the induced sorting algorithm for constructing suffix arrays [18], we explain this latter algorithm in the following. Induced sorting has a venerable history in suffix sorting, see [9, 14, 21]. Its basic idea is to sort a certain subset of suffixes, either directly or recursively, and then use this result to induce the order of the remaining suffixes. In the rest of this section, we follow the presentation of Okanohara and Sadakane [19]. Definition 1. For 1 ≤ i < n, suffix Si is said to be S-type if Si <lex Si+1, and L-type otherwise. 2 The last suffix is defined to be S-type. The type of each suffix can be determined in linear time by a right-to-left scan of T : first, Sn is declared as S-type. Then, for every i from n − 1 to 1, Si is classified by the following rule: Si is S-type iff either ti < ti+1, or ti = ti+1 and Si+1 is S-type. We further say that an S-suffix Si is of type S* iff Si−1 is of type L. In SA, all suffixes starting with the same character c ∈ Σ form a consecutive interval, called the c- bucket henceforth. Oberve that in any c-bucket, the L-suffixes precede the S-suffixes. Consequently, we can sub-divide buckets into S-type buckets and L-type buckets. Now the induced sorting algorithm can be explained as follows: 1. Sort the S*-suffixes. This step will be explained in more detail below. 2. Put the sorted S*-suffixes into their corresponding S-buckets, without changing their order. 3. Induce the order of the L-suffixes by scanning SA from left to right: for every position i in SA, if SSA[i]−1 is L-type, write SA[i] − 1 to the current head of the L-type c-bucket (c = tSA[i]−1), and increase the current head of that bucket by one. Note that this step can only induce "to the right" (the current head of the c-bucket is larger than i). 4. Induce the order of the S-suffixes by scanning SA from right to left: for every position i in SA, if SSA[i]−1 is S-type, write SA[i] − 1 to the current end of the S-type c-bucket (c = tSA[i]−1), and decrease the current end of that bucket by one. Note that this step can only induce "to the left," and might intermingle S-suffixes with S*-suffixes. It remains to explain how the S*-suffixes are sorted (step 1 above). To this end, we define: Definition 2. An S*-substring is a substring Ti..j with i 6= j of T such that both Si and Sj are S*-type, but no suffix in between i and j is also of type S*. Let R1, R2, . . . , Rn′ denote these S*-substrings, and σ′ be the number of different S*-substrings. We assign a name vi ∈ [1, σ′] to any such Ri, such that vi < vj if Ri <lex Rj and vi = vj if Ri =lex Rj. We then construct a new text T ′ = v1 . . . vn′ over the alphabet [1, σ′], and build the suffix array SA′ of T ′ by applying the inducing sorting algorithm recursively to T ′ if σ′ < n′ (otherwise there is nothing to sort). The crucial property [18] to observe here is that the order of the suffixes in T ′ is the same as the order of the respective S*-suffixes in T ; hence, SA′ determines the sorting of the S*-suffixes in T . Further, as at most every second suffix in T can be of type S*, the complete algorithm has worst-case running time T (n) = T (n/2) + O(n) = O(n), provided that the naming of the S*-substrings also takes linear time, which is what we explain next. The naming of the S*-substrings is similar to the inducing of the S-suffixes in the induced sorting algorithm (steps 2–4 above), with the difference that in step 2 we put the unsorted S*-suffixes into their corresponding buckets (hence they are only sorted according to their first character). Steps 3 and 4 work exactly as described above. At the end of step 4, we can assign names to the S*-substrings by comparing adjacent S*-suffixes naively until we find a mismatch or reach their end; this takes overall linear time. 3 3 Inducing the LCP-Array We now explain how the induced sorting algorithm (Sect. 2.2) can be modified to also compute the LCP-array. The basic idea is that whenever we place two S- or L-suffixes Si−1 and Sj−1 at adjacent places k − 1 and k in the final suffix array (steps 3 and 4 in the algorithm), the length of their longest common prefix can be induced from the longest common prefix of the suffixes Si and Sj. As the latter suffixes are exactly those that caused the inducing of Si−1 and Sj−1, we already know their LCP-value ℓ (by the order in which we fill SA), and can hence set LCP[k] to ℓ + 1. 3.1 Basic Algorithm We now describe the algorithm in more detail. We augment the steps of the induced sorting algorithm as follows: 1′. Compute the LCP-values of the S*-suffixes (see Sect. 3.3). 2′. Whenever we place an S*-suffix into its S-bucket, we also store its LCP-value at the correspond- ing position in LCP. 3′. Suppose that the inducing step just put suffix SSA[i]−1 into its L-type c-bucket at position k. If SSA[i]−1 is the first suffix in its L-bucket, we set LCP[k] to 0. Otherwise, suppose further that in a previous iteration i′ < i the inducing step placed suffix SSA[i′]−1 at k − 1 in the same c- bucket. Then if i′ and i are in different buckets, the suffixes SSA[i] and SSA[i′] start with different characters, and we set LCP[k] to 1, as the suffixes SSA[i]−1 and SSA[i′]−1 share only a common character c at their beginnings. Otherwise (i′ and i are in the same c′-bucket), the length ℓ of the longest common prefix of the suffixes SSA[i] and SSA[i′] is given by the minimum value in LCP[i′ + 1, i], all of which are in the same c′-bucket and have therefore already been computed in previous iterations. We can hence set LCP[k] to ℓ + 1. 4′. As in the previous step, suppose that the inducing step just put suffix SSA[i]−1 into its S-type c-bucket at position k. Suppose further that in a previous iteration i′ > i the inducing step placed suffix SSA[i′]−1 at k + 1 in the same c-bucket (if k is the last position in its S-bucket, we skip the following steps). Then if i′ and i are in different buckets, their suffixes start with different characters, and we set LCP[k + 1] to 1, as the suffixes SSA[i]−1 and SSA[i′]−1 share only a common character c at their beginnings. Otherwise (i′ and i are in the same c′-bucket), the length ℓ of the longest common prefix of the suffixes SSA[i] and SSA[i′] is given by the minimum value in LCP[i + 1, i′], all of which are in the same c′-bucket and have therefore already been computed. We can hence set LCP[k + 1] to ℓ + 1. 3.2 Finding Minima To find the minimum value in LCP[i′ + 1, i] or LCP[i + 1, i′] (steps 3′ and 4′ above), we have several alternatives. The simplest idea is to scan the whole interval from i′ + 1 to i; this results in overall O(n2) running time. A better alternative would be to keep an array M of size σ, such that the minimum is always given by M [c] if we induce an LCP-value in bucket c. To keep M up-to-date, after each step i we first set M [c] to LCP[i], and further update all other entries in M that are 4 larger than LCP[i] by LCP[i]; this approach has O(nσ) running time. A further refinement of this technique stores the values in M in sorted order and uses binary search on M to find the minima, similar to the stack used by [7]. This results in overall O(n lg σ) running time. Yet, we can also update the minima in O(1) amortized running time, as explained next. Let us first focus on the left-to-right scan (step 3′); we will comment on the differences to the right-to-left scan (step 4′) at the end of this section. Recall that the queries lie within a single bucket (called c′), and every bucket is subdivided into an L- and an S-bucket. The idea is to also subdivide the query into an L- and an S-query, and return the minimum of the two. The S-queries are simple to handle: in step 3′, only S*-suffixes will be scanned, and these are static. Hence, we can preprocess every S-type bucket with a static data structure for constant-time range minima, using overall linear space [4, Thm. 1]. The L-queries are more difficult, as elements keep being written to them during the scan. However, these updates occur in a very regular fashion, namely in a left-to-right manner. This makes the problem simpler: we maintain a Two-Dimensional Min-Heap [4, Def. 2] Mc′ for each bucket c′, which is initially empty (no L-suffixes written so far). When a new L-suffix along with LCP-value ℓ + 1 is written into its c′-bucket, we climb up the rightmost path of Mc′ until we find an element x whose corresponding array-entry is strictly smaller than ℓ + 1 (Mc′ has an artificial root holding LCP-value −∞ which guarantees that such an element always exists). The new element is then added as x's new rightmost leaf; an easy amortized argument shows that this results in overall linear time. Further, Mc′ is stored along with a data structure for constant-time lowest common ancestor queries (LCAs) which supports dynamic leaf additions in O(1) worst-case time [3]. Then the minimum in any range in the processed portion of the L-bucket can be found in O(1) time [4, Lemma 2]. 1 In the right-to-left scan (step 4′), the roles of the L- and S-buckets are reversed: the L-buckets are static and the S-buckets dynamic. For the former, we already have the range minimum data structures from the left-to-right scan (the 2d-Min-Heaps together with LCA). For the S-buckets, we now build an additional 2d-Min-Heap along with dynamic LCAs; this works because the S-buckets are filled in a strict right-to-left manner. What we have described in the preceding two paragraphs was actually more general than what we really needed: a solution to the semi-dynamic range minimum query problem with constant O(1) query- and amortized O(1) insertion-time, with the restriction that new elements can only be appended at the end (or beginning, respectively) of the array. Our solution might also have interesting applications in other problems. In our setting, though, the problem is slightly more specific: the sizes of the arrays to be prepared for RMQs are known in advance (namely the sizes of the buckets); hence, we can use any of the (more practical) preprocessing-schemes for (static) RMQs in O(1) worst-case time [1, 5], and update the respective structures, which are essentially precomputed RMQs over suitably-sized blocks, whenever enough elements have arrived. 1Note that it is important to use the Two-Dimensional Min-Heap rather than the usual Cartesian Tree for achieving overall linear time, for the following reason: Although the Cartesian Tree also has O(1) amortized update-time for the operation "append at end;" it also needs to relink entire subtrees, rather than only inserting new leaves to the rightmost path [6]. For the relink-operation, no constant-time solutions exist for maintaining O(1)-LCAs in the tree (not even in an amortized sense); the best solution we are aware of takes α(·, n) update time [8], α(·, ·) being the inverse Ackermann function. 5 3.3 Computing LCP-Values of S*-suffixes This section describes how to compute the LCP-values of the suffixes in the sample set (step 1′ above). The recursive call to compute the suffix array SA′ for the text T ′ (the text formed by the names of the S*-substrings) also yields the LCP-array LCP′ for T ′. The problem is that these LCP-values refer to characters vi in the reduced alphabet [1, σ′], which correspond to S*- substrings Ri in T . Hence, we need to "scale" every LCP-value in LCP′ by the lengths of the actual S*-substrings that constitute this longest common prefix: a value LCP′[k] refers to the substring vSA[k] . . . vSA[k]+LCP′[k]−1 of T ′, and actually implies an LCP-value of PLCP[k]−1 RSA[k]+i between the corresponding S*-suffixes in T . i=0 A naive implementation of this calculation could again result in O(n2) running time, consider the text T = abab . . . ab. However, we can make use of the fact that the suffixes of T ′ appear lexicographically ordered in T ′: when "scaling" LCP′[k], we know that the first m = min(LCP[k − 1], LCP[k]) S*-substrings match, and can hence compute the actual LCP-value as LCP[k]−1 X i=0 RSA[k]+i = m−1 X RSA[k]+i + i=0 already computed {z } m−1 X i=m RSA[k]+i . This way, by an amortized argument it is easy to see that each character in T contributes to at most 2 additions, resulting in an overall O(n) running time. It is possible to stop the recursive LCP-calculation at a certain depth and use any other LCP- array construction algorithm on the remaining (sparse) set of sorted suffixes. 3.4 Computing LCP-values at the L/S-Seam There is one subtlety in the above inducing algorithm we have withheld so far, namely that of computing the LCP-values between the last L-suffix and the first S-suffix in a given c-bucket (we call this position the L/S-seam). More precisely, when reaching an L/S-seam in step 3′, we have to re-compute the LCP-value between the first S*-suffix in the c-bucket (if it exists) and the last L-suffix in the same c-bucket (the one that we just induced), in order to induce correct LCP-values when stepping through the S*-suffixes in subsequent iterations. Likewise, when placing the very first S-suffix in its c-bucket in step 4′, we need to compute the LCP-value between this induced S-suffix and the largest L-suffix in the same c-bucket. (Note that step 4 might place an S-suffix before all S*-suffixes, so we cannot necessarily re-use the LCP-value computed at the L/S-seam in step 3′.) The following lemma shows that the LCP-computation at L/S-seams is particularly easy: Lemma 3. Let Si be an L-suffix, Sj an S-suffix, and ti = c = tj (the suffixes are in the same c-bucket in SA). Further, let ℓ ≥ 1 denote the length of the longest common prefix of Si and Sj. Then Ti...i+ℓ−1 = cℓ = Tj...j+ℓ−1 . Proof. Assume that ti+k = c′ = ti+k for some 2 ≤ k < ℓ and c′ 6= c. Then if c′ < c, both Si and Sj 6 are of type L, and otherwise (c′ > c), they are both of type S. In any case, this is a contradiction to the assumption that Si is of type L, and Sj of type S. (cid:4) In words, the above lemma states that the longest common prefix at the L/S-seam can only consist of equal characters. Therefore, a naive computation of the LCP-values at the L/S-seam is sufficient to achieve overall linear running time: every character ti contributes at most to the computation at the L/S-seam in the ti-bucket, and not in any other c-bucket for c 6= ti. 4 Experimental Results We implemented the algorithm from the previous section in C and ran several tests on an AMD Athlon 64 processor, running at 2200 MHz with a 512KB L2-cache and 4GB of main memory. The basis of our implementation was Yuta Mori's linear-time C-implementation of the induced-sorting algorithm [18], called sais-lite version 2.4.1 (http://sites.google.com/site/yuta256/sais). We made the following implementation decisions: instead of calculating the LCP-values of the S*- suffixes recursively, we used a sparse variant of the Φ-algorithm [10] immediately on the first level, which calculates the LCP-values of the S*-suffixes in overall linear time. For the inducing step, we used the simple O(nσ)-variant described in Sect. 3.2. The resulting algorithm is called inducing henceforth. We compared our implementation to the following LCP-array construction algorithms: KLAAP: the original linear-time method for constructing LCP [12], implemented in a space-saving variant [16]. Φ: the Φ-algorithm of Karkkainen et al. [10], which is a clever variant of KLAAP that avoids cache-misses by reorganizing the computations. GO: the hybrid algorithm as described by [7]. It needs the Burrows-Wheeler-Transformation (BWT) for LCP-array construction, and computes small LCP-values naively, from which the larger LCP-values are deduced. GO2: a semi-external variant of GO [7]. naive: for a sanity check, we also included the naive computation of the LCP-array (step through the suffix array and compare corresponding suffixes naively). We used the implementations from the succinct data structures library (sdsl 0.9.0) [7] wherever possible. All programs were compiled using the same compiler options (-ffast-math -O9 -funroll- loops -DNDEBUG). We chose the test suite from http://pizzachili.dcc.uchile.cl/ for evaluation, which is by It includes texts from natural languages (English), biology (dna and now a de-facto standard. proteins), and structured documents (dblp.xml and sources). Because the authors of [7] point out that the human chromosome 22 from Manzini's corpus (hs) is a particular hard case for some algorithms, it was also included. 7 The results are shown in Tbl. 1. The first block of columns shows the running times for pure LCP-array construction. For KLAAP and Φ, these times include construction of the inverse suffix- and the Φ-array, respectively, as they are needed for LCP-array computation. For GO and GO2, the times for computing the BWT are not included; the reason is that in some cases the BWT is also needed for other purposes, so it might already be in memory. As inducing is inherently coupled with SA-construction [18], we could not measure its running times for pure LCP-array construction directly; the figures in column "inducing" of Tbl. 1 are hence obtained by first running the pure SA-construction (sais-lite), then the combined LCP- and SA-construction, and finally taking the difference of both running times. Measured this way, inducing takes always less time than all other methods. A fairer comparison of the algorithms is shown in the last three columns of Tbl. 1, where the combined running times for SA- and LCP-array construction are given (for a selection of the best-performing LCP-algorithms). This is because all other methods for LCP-array construction are independent of the method for constructing SA, and can hence be combined with faster SA- construction algorithms. It is by now widely agreed that Yuta Mori's divsufsort in version 2.0.1 is the fastest known such algorithm (http://code.google.com/p/libdivsufsort/). Hence, for methods GO and naive we give the overall running times combined with divsufsort, whereas for inducing we give the overall running time of sais-lite, adapted to induce LCP-values as well. Further, for GO we also add the times to compute the BWT, as it is needed for LCP-array construction. Inspecting the results from Tbl. 1, we see that inducing+sais-lite is usually the best possible combination, sometimes outperformed by naive+divsufsort. In fact, the naive algorithm is rather competitive (especially for small inputs up to 50MB), apart from the English text, which consists of long repetitions of the same texts (and hence has large average LCP). 5 Conclusions and Outlook We showed how the LCP-array can be induced along with the suffix array. A rather ad-hoc im- plementation outperformed all state-of-the-art algorithms. We point out the following potentials for practical improvements: (1) As suffix- and LCP-values are always written to the same place, an interleaved storage of SA and LCP could result in fewer cache misses. (2) As the faster divsuf- sort is also based on induced sorting, incorporating our ideas into that algorithm could result in better overall performance. (3) Computing the LCP-values of the S*-suffixes recursively up to a certain (well-chosen) depth could be faster than just using the Φ-algorithm on level 0, as in our implementation. Acknowledgments We thank Moritz Kobitzsch for help on programming, and Peter Sanders for interesting discussions. 8 pure LCP-array construction SA BWT SA+LCP ] 2 1 [ P A A L K ] 0 1 [ Φ ] 7 [ O G ] 7 [ 2 O G e v i a n ] r e p a p s i h t [ ) ∗ ( g n i c u d n i t r o s f u s v i d e t i l - s i a s t r o s f u s v i d + T W B + O G t r o s f u s v i d + e v i a n 8.0 137.7 7.5 7.3 16.5 12.5 22.4 207.0 20.3 27.4 34.3 e t i l - s i a s + g n i c u d n i 9.4 9.3 8.1 7.9 9.8 15.4 25.2 26.0 21.0 20.9 29.4 B M 0 2 B M 0 5 dna english dblp.xml sources proteins hs (33MB) dna english dblp.xml sources proteins dna english dblp.xml sources proteins dna english dblp.xml sources proteins 7.1 6.3 5.4 5.1 6.0 10.8 20.6 18.0 15.1 14.4 19.1 47.0 40.8 32.0 30.3 43.5 104.4 90.7 69.2 65.9 91.6 6.3 5.5 5.0 5.0 5.6 12.2 18.0 16.0 14.0 13.6 17.1 41.1 36.3 30.0 28.6 38.6 92.7 80.9 64.6 62.0 82.9 4.2 9.9 4.1 4.5 7.6 6.6 10.8 21.2 10.7 14.7 15.4 22.0 38.9 21.7 28.2 35.9 46.1 82.3 44.1 58.7 82.0 6.2 12.2 6.0 6.7 9.8 10.0 16.0 26.5 15.8 20.2 20.7 32.9 49.6 31.9 38.7 46.7 68.5 104.3 64.3 79.9 105.0 3.1 132.8 3.5 3.8 11.4 4.3 8.3 193.7 9.2 17.7 18.6 17.4 547.0 19.5 109.4 49.3 51.0 3190.5 40.4 141.5 124.2 2.6 2.8 2.7 2.5 2.5 4.4 7.1 7.9 6.8 6.5 7.1 16.2 17.5 14.8 13.8 16.2 36.3 39.4 31.1 29.5 35.6 4.9 4.9 4.0 3.5 5.1 8.2 14.1 13.3 11.1 9.7 15.7 32.1 29.8 24.1 20.9 35.3 75.9 68.9 53.2 46.4 76.5 6.8 6.5 5.4 5.4 7.3 11.0 18.1 18.1 14.2 14.4 22.3 39.1 39.8 29.6 30.2 48.7 87.6 88.8 63.6 65.3 104.0 2.6 2.6 2.5 2.2 2.5 4.3 6.9 6.8 6.3 5.8 6.7 14.9 14.5 13.1 12.2 14.5 32.7 31.6 27.4 26.0 30.8 11.7 17.4 10.6 10.2 15.2 19.1 31.8 41.3 28.1 30.2 37.8 69.0 83.2 58.9 61.3 85.7 154.7 182.8 124.7 131.1 189.3 B M 0 0 1 B M 0 0 2 49.5 576.8 43.6 130.3 84.6 126.9 123.9 3259.4 128.2 94.7 93.6 187.9 94.8 200.7 139.6 (∗) As inducing is inherently coupled with SA-construction (sais-lite in our implementation), the running times for 55.3 57.3 44.4 44.0 64.9 pure LCP-array construction were calculated by taking the difference of "inducing+sais-lite" and "sais-lite." Table 1: Running times (in seconds) for LCP- and suffix-array construction. The first block of columns shows the running times for pure LCP-array construction (for KLAAP and Φ, these times include construction of the inverse suffix- and the Φ-array, respectively). The second block shows the construction times of those arrays that need to be constructed before LCP: SA (always) and BWT (for GO and GO2). The third block shows the overall running times for computing both SA and LCP for the best possible combinations of algorithms. 9 References [1] S. Alstrup, C. Gavoille, H. Kaplan, and T. Rauhe. Nearest common ancestors: A survey and a new algorithm for a distributed environment. Theory Comput. Syst., 37:441–456, 2004. [2] Antonitio, P. J. Ryan, W. F. Smyth, A. Turpin, and X. Yu. New suffix array algorithms - linear but not fast? In Proc. Fifteenth Australasian Workshop Combinatorial Algorithms (AWOCA), pages 148–156, 2004. [3] R. Cole and R. Hariharan. Dynamic LCA queries on trees. SIAM J. Comput., 34(4):894–923, 2005. [4] J. Fischer. Optimal succinctness for range minimum queries. In Proc. LATIN, volume 6034 of LNCS, pages 158–169. Springer, 2010. [5] J. Fischer and V. Heun. A new succinct representation of RMQ-information and improvements in the enhanced suffix array. In Proc. ESCAPE, volume 4614 of LNCS, pages 459–470. Springer, 2007. [6] H. N. Gabow, J. L. Bentley, and R. E. Tarjan. Scaling and related techniques for geometry problems. In Proc. STOC, pages 135–143. ACM Press, 1984. [7] S. Gog and E. Ohlebusch. Fast and lightweight LCP-array construction algorithms. In Proc. ALENEX, pages 25–34. SIAM Press, 2011. [8] D. Harel and R. E. Tarjan. Fast algorithms for finding nearest common ancestors. SIAM J. Comput., 13(2):338–355, 1984. See also FOCS'80. [9] H. Itoh and H. Tanaka. An efficient method for in memory construction of suffix arrays. In Proc. SPIRE/CRIWG, pages 81–88. IEEE Press, 1999. [10] J. Karkkainen, G. Manzini, and S. J. Puglisi. Permuted longest-common-prefix array. In Proc. CPM, volume 5577 of LNCS, pages 181–192. Springer, 2009. [11] J. Karkkainen, P. Sanders, and S. Burkhardt. Linear work suffix array construction. J. ACM, 53(6):1–19, 2006. [12] T. Kasai, G. Lee, H. Arimura, S. Arikawa, and K. Park. Linear-time longest-common-prefix computation in suffix arrays and its applications. In Proc. CPM, volume 2089 of LNCS, pages 181–192. Springer, 2001. [13] D. K. Kim, J. S. Sim, H. Park, and K. Park. Constructing suffix arrays in linear time. J. Discrete Algorithms, 3(2–4):126–142, 2005. [14] P. Ko and S. Aluru. Space efficient linear time construction of suffix arrays. J. Discrete Algorithms, 3(2–4):143–156, 2005. [15] U. Manber and E. W. Myers. Suffix arrays: A new method for on-line string searches. SIAM J. Comput., 22(5):935–948, 1993. 10 [16] G. Manzini. Two space saving tricks for linear time lcp array computation. In Proc. Scandina- vian Workshop on Algorithm Theory (SWAT), volume 3111 of LNCS, pages 372–383. Springer, 2004. [17] G. Navarro and V. Makinen. Compressed full-text indexes. ACM Computing Surveys, 39(1):Ar- ticle No. 2, 2007. [18] G. Nong, S. Zhang, and W. H. Chan. Linear suffix array construction by almost pure indeced- sorting. In Proc. DCC, pages 193–202. IEEE Press, 2009. [19] D. Okanohara and K. Sadakane. A linear-time burrows-wheeler transform using induced sort- ing. In Proc. SPIRE, volume 5721 of LNCS, pages 90–101. Springer, 2009. [20] S. J. Puglisi, W. F. Smyth, and A. Turpin. A taxonomy of suffix array construction algorithms. ACM Computing Surveys, 39(2), 2007. [21] J. Seward. On the performance of BWT sorting algorithms. In Proc. DCC, pages 173–182. IEEE Press, 2000. [22] P. Weiner. Linear pattern matching algorithms. In Proc. Annual Symp. on Switching and Automata Theory, pages 1–11. IEEE Computer Society, 1973. 11
1612.04209
1
1612
2016-12-13T14:45:29
Compact Trip Representation over Networks
[ "cs.DS" ]
We present a new Compact Trip Representation (CTR) that allows us to manage users' trips (moving objects) over networks. These could be public transportation networks (buses, subway, trains, and so on) where nodes are stations or stops, or road networks where nodes are intersections. CTR represents the sequences of nodes and time instants in users' trips. The spatial component is handled with a data structure based on the well-known Compressed Suffix Array (CSA), which provides both a compact representation and interesting indexing capabilities. We also represent the temporal component of the trips, that is, the time instants when users visit nodes in their trips. We create a sequence with these time instants, which are then self-indexed with a balanced Wavelet Matrix (WM). This gives us the ability to solve range-interval queries efficiently. We show how CTR can solve relevant spatial and spatio-temporal queries over large sets of trajectories. Finally, we also provide experimental results to show the space requirements and query efficiency of CTR.
cs.DS
cs
Compact Trip Representation over Networks ⋆ Nieves R. Brisaboa1, Antonio Farina1, Daniil Galaktionov1, and M. Andrea Rodr´ıguez2 1 Database Laboratory, University of A Coruna, Spain 2 Department of Computer Science, University of Concepci´on, Chile Abstract. We present a new Compact Trip Representation (CTR) that allows us to manage users' trips (moving objects) over networks. These could be public transportation networks (buses, subway, trains, and so on) where nodes are stations or stops, or road networks where nodes are intersections. CTR represents the sequences of nodes and time instants in users' trips. The spatial component is handled with a data structure based on the well-known Compressed Suffix Array (CSA), which provides both a compact representation and interesting indexing capabilities. We also represent the temporal component of the trips, that is, the time instants when users visit nodes in their trips. We create a sequence with these time instants, which are then self-indexed with a balanced Wavelet Matrix (WM). This gives us the ability to solve range-interval queries effi- ciently. We show how CTR can solve relevant spatial and spatio-temporal queries over large sets of trajectories. Finally, we also provide experimen- tal results to show the space requirements and query efficiency of CTR. 1 Introduction Current technology allows us to capture data about the usage of transporta- tion networks whose analysis could have an important impact on improving the quality of services. Data about the origin and destination of passengers of train services can be directly captured when selling tickets. Using more sophisticated technology, the movement of people or vehicles over networks of streets or roads can be collected from the mobile phone signals. Even more, nowadays many cities (from London to Santiago of Chile) provide smartcards to the users of their public transportation network. These smartcards (that can be recharged with money) allow users to pay the entrance to subways and buses. Even though there typically exists only a card reader in the entrance to the network (i.e., ⋆ Funded in part by European Union's Horizon 2020 research and innovation pro- gramme under the Marie Sklodowska-Curie grant agreement No 690941 (project BIRDS). N. Brisaboa, A. Farina, and D. Galaktionov are funded by MINECO (PGE, CDTI, and FEDER) [TIN2013-46238-C4-3-R, TIN2013-47090-C3-3-P, TIN2015- 69951-R, IDI-20141259, ITC-20151305, ITC-20151247]; by ICT COST Action IC1302; and by Xunta de Galicia (co-funded with FEDER) [GRC2013/053]. A. Rodr´ıguez is funded by Fondecyt 1140428 and the Complex Engineering Systems Institute (CONICYT: FBO 16) 2 N. Brisaboa, A. Farina, D. Galaktionov, and A. Rodr´ıguez there is no control at exits or in middle stops), it is possible to know how people actually use the public transportation by collecting the entrance and estimating the destination (e.g., as the entry point for the return trip) and the traversed stops (the shorter path among stops used as the entrance and exit) [11]. In all scenarios, the massive data about trips makes the problem of storing and efficiently accessing data about trips a challenging computational problem. This paper presents a compact and self-indexed data structure to represent trips over networks, which could be public transportation networks where nodes are stations or stops, or road networks where nodes are intersection points. Although there exist proposals of data structures for moving objects, they have addressed typical spatio-temporal queries such as time slice or time interval queries that retrieve trajectories or objects that were in a spatial region at a time instant or during a time interval. They were not designed to answer queries that are based on counting occurrences such as the number of trips starting or ending at some time instant in specific stops (nodes) or the top-k most used stops of a network during a given time interval, which are more meaningful queries for public-transportation or traffic administrators. Our proposal (CTR) is oriented to efficiently answering these types of queries, and it differs from previous ap- proaches in the use of compact self-indexed data structures to represent the big amount of trips in compact space. It is important to emphasize that our goal is to provide an indexed representation for a static collection of trips in order to allow an efficient batch processing of such data. CTR combines two well-known data structures. The first one, initially de- signed for the representation of strings, is Sadakane's Compressed Suffix Array (CSA) [18]. The second one is the Wavelet Matrix (WM) [1]. To make the use of the CSA possible in this domain, we define a trip or trajectory of a moving object over a network as the temporally-ordered sequence of the nodes the trip traverses. An integer id is assigned to each node such that a trip is a string of nodes' ids. Then a CSA, over the concatenation of these strings (trips) is built with some adaptations for this context. In addition, we discretize the time in periods of fixed duration (i.e. timeline split into 5-minute instants) and each time segment is identified by an integer id. In this way, it is possible to store the times when trips reach each node by associating the corresponding time id with each node in each trip. The sequence of times for all the nodes within a trip is self-indexed with a WM to efficiently answer spatio-temporal queries. We experimentally tested our proposal using two sets of synthetic data rep- resenting trips over two different real public transportation systems. Our results are promising because the representation uses only around 30% of its original size and answers spatial and spatio-temporal queries in microseconds. No exper- imental comparisons with classical spatial or spatio-temporal index structures are possible, because none of them were designed to answer the types of queries in this work. Our approach can be considered as a proof of concept that opens new application domains for the use of CSA and WM, creating a new strategy for exploiting trajectories represented in a self-indexed way. Compact Trip Representation over Networks 3 The organization of this paper is as follows. Section 2 reviews previous works on trip representations. It also makes reference to the CSA and WM, upon which we develop our proposal. Section 3.1 shows how CTR represents the spatial com- ponent and Section 3.2 the temporal component of trips. Section 4 presents the relevant queries that are solved by CTR and Section 5 gives our experimental results. Finally, conclusions and future work are discussed in Section 6. 2 Previous Work Trajectory indexing. Many data structures have been proposed to support efficient query capabilities on collections of trajectories. We refer to [13, Chapter 4] for a comprehensive and up-to-date survey on data management techniques for trajectories of moving objects. We can broadly classify these data structures into two groups: those that index trajectories in free space and those that index trajectories constrained to a network. The 3D R-tree (an extension of the classi- cal R-tree spatial index [7]), the TB-tree [14], and MV3R-tree [19] are examples of the former, whereas the FNR-tree [4], the MON-tree [2], and PARINET [15] are examples of the latter. While the former type of structures could also apply over networks, the second type exploits the constraints imposed by the topology of the network to optimize the data structure. From them, PARINET is the most efficient alternative [15]. It partitions trajectories into segments from an underlaying road network, and then adds one temporal B+-tree to index the tra- jectory segments from each road. Those indexes permit us to filter out candidate trajectory segments matching time constraints at query time. All previous data structures were designed to answer spatio-temporal queries, where the space and time are the main filtering criteria. Examples of such queries are: retrieve trajectories that crossed a region within a time interval, retrieve trajectories that intersect, or retrieve the k-best connected trajectories (i.e., the most similar trajectories in terms of a distance function). Yet, they could not easily support queries such as number of trips starting in X and ending at Y. The application of data compression techniques has been explored in the context of massive data about trajectories. The work by Meratnia and de By [10] adapts a classical simplification algorithm by Douglas and Peucker to reduce the number of points in a curve and, in consequence, the space use to represent trajectories. Ptomaias et al. [16] use concepts, such as speed and orientation, to improve compression. Both techniques work for trajectories in free space. In [17, 8, 5], they focus mainly on how to represent trajectories constrained to networks, and in how to gather the location of one or more given moving objects from those trajectories. Yet, these works are also out of our scope as they would poorly support queries oriented to exploit the data about the network usage such as those oriented to aggregate the number of trips with a specific spatio- temporal pattern (e.g. Count the trips starting at stop X and ending at stop Y in working days between 7:00 and 9:00). In [9], authors use a representation of trajectories where for each edge in a trajectory both the starting and ending times are kept, and present an index 4 N. Brisaboa, A. Farina, D. Galaktionov, and A. Rodr´ıguez called NETTRA. They used a relational database where those data are stored in a table and indexes are created in order to support a particular type of queries called Strict Path Queries. Although our CTR could also deal with those types of queries, this database-oriented representation is out of our scope as they do not consider space constraints (they do not compress data nor do they consider the size of the indexes used). Underlying Compact Structures of CTR. Our proposal is based on two well-known compact structures: a Compressed Suffix Array (CSA) [18] and a Wavelet Matrix (WM) [1]. We used the variant of CSA from [3], where au- thors adapted CSA to deal with large (integer-based) alphabets and created the integer-based CSA (iCSA). They also showed that the best compression of Ψ was obtained when combining differential encoding of runs with Huffman and run-length encoding. WM is a data structure originated from the Wavelet Tree [6], but requires less space and permits to make an efficient occurrence count of a continuous range of values [1] (see Section 3.2 for details). WM provides, as the Wavelet Tree a self-indexed representation of symbols based on the rearrangement of their bits in different bit maps at different levels. WM allows us to perform efficient operations over the sequence, among other operations: access(i) returns the symbol at the position i, rankα(i) counts the number of occurrences of a symbol α up to position i; and selectα(j) gives the position of the j-th α. Those operations are implemented using the classical bit operations rank and select on the underlying bitmaps and they need O(log σ) time, being σ the number of encoded symbols. 3 Compact Trip Representation (CTR) Trips on networks are temporally-ordered sequences of nodes (referred to as the spatial component) tagged with timestamps (referred to as the temporal component). We show how the proposed Compact Trip Representation (CTR) combines a Compact Suffix Array (CSA) to represent the spatial component and a Wavelet Matrix (WM) to represent the temporal one. 3.1 Representing the spatial component of CTR with a CSA In CTR, integer IDs identify stops of the network. The first step to build the CSA is to sort the trips. They are sorted by the first stop, then by the last stop, then by the start time of the trip, and finally by the second, third, and successive stops. For example, we have a dataset T with the following set of trips: {h2, 3, 10, 6i, h2, 3, 10, 4, 7i, h1, 2, 3i h3, 10, 5i, h1, 2, 3i h9, 8, 7i}. Let us assume that these trips start at time instants 10, 2, 0, 9, 5, 12, respectively. Following lexicographic order, the trip h2, 3, 10, 4, 7i should be before the trip h2, 3, 10, 6i. However, because after the first stop, we consider the last stop, the trip h2, 3, 10, 6i goes before the trip h2, 3, 10, 4, 7i. In addition, the two trips h1, 2, 3i are sorted by their starting Compact Trip Representation over Networks 5 time instants (0 and 5 respectively). This sorting of the trips will allow us to answer a useful query very efficiently (i.e., trips starting at X and ending at Y ). We concatenate the sorted trips and construct an array S where trips are sep- arated with a symbol $. We also add an additional ending $. Figure 1 shows the array S for the running example. Despite the standard suffix array construction in the CSA that compares two suffixes by their lexicographical order until the end of S, we introduced a modification so that two suffixes are now compared considering their trips as a cycle. Figure 1 depicts the structures Ψ and D used by the CTR over the trips in the dataset T . There is also the vocabulary V containing all the stops in their lexicographic order, as well as the $ symbol. We include the sequence S, the suffix array A, and Ψ ' only for clarity (they are not needed in the CTR). Ψ ′ contains the first entries of Ψ from a regular CSA, just to explain the difference of how we build Ψ . For example, A[8] = 1 points to the first stop of the first trip S[1]. Ψ [8] = 10 and A[10] = 2 points to the second stop. Ψ [10] = 14 and A[14] = 3 points to the third stop. Ψ [14] = 2 and A[2] = 4 points to the ending $ of the first trip. Therefore, in the standard CSA, Ψ ′[2] = 9 and A[9] = 5 points to the first stop of the second trip. However, in CTR, Ψ [2] = 8 and A[8] = 1 points to the first stop of the first trip. Thus, subsequent applications of Ψ will allow us to cyclically traverse the stops of the trip. Finally, note that aligned with sequence S, we could keep the times associated with the stops in each trip with the structures I and Icode, which are explained in the following subsection. Fig. 1. Structures involved in the creation of a CTR. The definition of a suffix proposed above explains why A[22] = 18 is placed before A[23] = 26. Note that the suffix starting at S[18] is "7 · $ · 2 · 3 . . ." and that suffix at S[26] is "7 · $ · 9 · . . .". Therefore, it holds that A[22] ≺ A[23]. However, considering the traditional definition of a suffix, these suffixes would be "7 · $ · 3 · · ·" and "7 · $ · $ · · ·" respectively, and A[22] ≺ A[23] would not hold. Note also that, in the shaded range Ψ [1, 7], the first entry is related to ter- minator $, whereas the next six entries correspond to the $ symbols that mark the end of each trip in S (sorted by the starting stop, then by the ending stop, then by their initial time, and finally by the second, third and following up 6 N. Brisaboa, A. Farina, D. Galaktionov, and A. Rodr´ıguez stops). This property makes it very simple to find starting stops. For example, the ending $ of the 4th trip is at the 5th position (because the first $ corre- sponds to the final $ at S[28]). Therefore, its starting stop can be obtained by Ψ [5] = 12 and rank1(D, 12) = 3; that is, the starting stop is the 3th entry in the vocabulary. The next stop of that trip would be obtained by Ψ [12] = 16 and rank1(D, 16) = 4, and so on. We expect to obtain good compressibility in CTR due to the structure of the network, and the fact that trips that start in a given stop or simply those going through that stop will probably share the same sequence of "next" stops. This will lead us to obtain many runs in Ψ [12], and consequently, good compression. 3.2 Representing the temporal component of CTR with a WM 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 8 12 (cid:524) Times 0 0 5 10 2 13 9 Bit 1 0 0 0 1 0 17 25 10 11 14 15 16 18 2 9 1 12 0 1 0 5 0 3 0 7 0 2 0 10 5 1 0 3 8 1 26 27 28 22 6 4 5 7 23 24 19 20 21 4 0 9 1 13 8 12 15 10 15 14 12 6 11 14 1 1 1 1 1 1 1 1 0 1 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Times 0 0 5 2 Bit 2 0 0 1 0 0 0 5 1 3 0 7 1 2 0 5 1 4 1 6 1 10 9 12 10 8 0 0 1 0 0 9 0 13 8 12 15 10 15 14 12 11 14 1 0 1 1 0 1 1 1 0 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Times 0 0 2 0 Bit 3 0 0 1 0 3 1 2 1 10 9 10 8 1 0 1 0 9 0 8 0 10 11 5 1 1 0 5 0 7 1 5 0 4 0 6 1 12 13 12 15 15 14 12 14 0 0 0 1 1 1 0 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Times 0 0 0 9 Bit 4 0 0 0 1 8 0 9 1 8 0 5 1 5 1 5 1 4 0 12 13 12 12 2 0 1 0 0 0 3 1 2 0 10 10 10 11 7 0 0 0 1 1 6 0 15 15 14 14 1 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Fig. 2. WM representation for the times associated with the trips in Figure 1. To exploit usage patterns of a network, we need to represent and query the time component of trips, which indicates when a moving object reaches each node along its trip. To represent this time component, we discretize time and assign an integer code to each resulting time interval. The size of the time interval is a parameter that can be adjusted to fit the required precision in each domain. For example, in a public transportation network, if we had data about five years of trips, a possibility would be to divide that five-years period into 10-minutes intervals, or in cyclical annual periods resulting in a vocabulary of roughly 365 × 24 × 60/10 = 52, 560 different codes. However, in public transportation networks queries such as "Number of trips using the stop X on May 10 between 9:15 and 10:00" may be not as useful as queries such as "Number of trips using stop X on Sundays between 9:15 and 10:00". For this reason, CTR can adapt how the time component is encoded depending on the queries that the system must answer. In Figure 1, sequence I contains the time associated with each stop in a trip, and Icode a possible encoding of times. In CTR we use a similar encoding to that in Icode, yet aligned to Ψ rather than to S. Those entries in Icodes are given a fixed-length binary code and are repre- sented with a balanced Wavelet Matrix (WM) [1]. That is, for any stop in a trip at the position i in Ψ , its timestamp ti can be recovered by accessing the WM Compact Trip Representation over Networks 7 at position i. Recall [1] that a WM is a grid of n × m bits. In our case n is the number of entries in the CSA and m = log σt are the bits needed to represent the different σt codes for the time instants of interest. Besides the typical access(i), rankα(i) and selectα(i), the WM provides a count operation that CTR heavily relies on. count(x1, x2, y1, y2) returns the number of occurrences of symbols between y1 and y2 in the range of positions [x1, x2] from the encoded sequence in O(m) time. While its implementation de- tails can be found in [1], we include an example of how to solve count(20, 28, 10, 15) over the sequence shown in Figure 2. The algorithm starts from the upper level (Bit1) of the WM and iterates downwards, refining the searching range. In Bit1 we are only interested in positions from [20, 28] that have a 1, because none of the symbols between 10 and 15 starts with a 0. Also, since rank0(Bit1, 28) = 12, in Bit2 we will have to search in the positions between 12+rank1(Bit1, 20) = 21 and 12 + rank1(Bit1, 28) = 28. Now, while the second bit for 10 and 11 is 0, it is 1 for the symbols between 12 and 15. Because of this, we need to perform both rank0 and rank1 on the limits of [21, 28] in Bit23, and split the search in two subranges for Bit3: [10, 11] using rank0 and [23, 28] using rank1. As the second subrange may only contain symbols from 12 to 15 (11xx), further refinement is not needed. In the case of the range [10, 11], it could contain symbols from 8 to 11, depending on their third bits, so we need to perform rank1 over its limits in Bit3, which leads to [21, 22] in Bit4. The number of 10 and 11 symbols is the size of this last range. If we wanted to return the positions of the results in the original sequence, we could do that with a simple algorithm, using select of bits over bitmaps, that iterates upwards from the level where each result is found until the first level where its position in the original sequence can be retrieved. Summarizing, CTR takes the advantage of the WM to count and report the occurrences of a continuous range of values. The starting positions in the CSA belonging to the $ symbols have no time by themselves, but it is useful to answer some queries to store the starting time instants of the corresponding trip in these positions too. The time intervals could be mapped to a variable-length code, instead of a fixed length codes, where the most frequent intervals would be represented by less bits and, therefore, requiring less levels in a Wavelet Tree. In the future we will explore this possibility. 4 Query processing We distinguish two types of queries to be answered by the CTR: spatial and spatio-temporal queries. We briefly sketch the algorithms to process these queries. Spatial queries. The following queries can be solved by only using the CSA that represents the spatial component of trips. 3 rank1(Bit2, i) = i − rank0(Bit2, i), and vice versa 8 N. Brisaboa, A. Farina, D. Galaktionov, and A. Rodr´ıguez -- Number of trips starting at stop X. Because Ψ was cyclically built in such a way that every $ symbol is followed by the first stop of its trip, this query is solved by performing the binary search of the pattern $X over the section of Ψ corresponding to $. The size of the resulting range gives the number of trips starting at X. -- Number of trips ending at stop X. In a similar way to the previous query, this one can be answered with a binary search for pattern X$ over the section of Ψ corresponding to stop X. -- Number of trips starting at X and ending at Y . Combining both ideas from above, this query is solved directly by searching for the Y $X pattern. -- Number of trips using stop X. Instead of performing a binary search over Ψ , we operate on bitmap D. Assuming that X is at position p in the vocabulary V of CTR, its total frequency is obtained by occsX ← select1(D, p + 1) − select1(D, p). If p is the last entry in V , we set occsX ← n + 1 − select1(D, p). -- Top-k most used stops. We provide two possible solutions for these queries: se- quential and binary-partition approaches. • To return the k most used stops using a sequential approach, we can apply select1 operation sequentially for every stop from 1 to δ, returning the k stops with highest frequency. We use a min-heap that is initialized with the first k stops, and for every stop s from k + 1 to δ, we compare its frequency with the frequency of the minimum stop in the heap. In case the new one is higher, the root of the heap is replaced and moved down to comply with the heap ordering. At the end of the process, the heap will contain the top-k most used stops, which can be sorted with the heapsort algorithm if needed. Note that this approach always performs δ select1 operations on D. • A binary-partition approach to solve queries about the top-k most used stops takes advantage of the skewed distribution of the stops that trips visit. Working over D and V , D is recursively split into segments of D after each iteration. Each partition must, if possible, leave the same number of different stops in each side of the partition. The segments created after the partition- ing step are pushed into a priority queue Q, storing the initial and the final positions of the segment in D, and also the initial and final corresponding entries in V . The priority of each segment in Q is directly its size. The prior- ity queue Q is initialized with a segment covering the whole D (without its initial range of δ $ symbols). When a segment extracted from the queue Q represents the instance of only one stop, that stop is returned as a result of the top-k algorithm. The algorithm stops when the first k stops are found. For example, when searching for the top-1 most used stops in the running example, Q is initialized with the segment [8, 28], corresponding to stops from 1 to 10 (positions from 2 to 11 in V ). Note that the entries of D from 1 to 7 and V [1] represent the $ symbol. These are not stops and must be skipped. Then [8, 28] is split producing the segments [8, 20] for stops 1 to 5 and [21, 28] for stops 6 to 10. After three more iterations, we extract the segment [14, 18] for the single stop 3, concluding that the top-1 most used stop is 3 with a frequency equal to 5. Compact Trip Representation over Networks 9 Spatio-temporal queries. These queries combine both the CSA and WM. The idea is to restrict spatial queries to a time interval [t1, t2]. An example of this type of query is to return the number of trips starting at stop X between t1 and t2, which we solve by relying on the count operation of the WM. The following are the spatio-temporal queries solved by the CTR: -- Number of trips starting at stop X during the time interval [t1, t2]. Remember that in the WM we also have timestamps associated with the area of $-symbols in Ψ ; each $ has associated the time of the first stop of its trip and, therefore, we can use the WM in that area of Ψ . Using the range in Ψ obtained by searching the $X pattern, as done in a regular spatial query, a count operation is performed over these positions in the WM searching for the limits of the interval. That is, we count the number of entries in the obtained range that have a timestamp in the WM inside [t1, t2]. -- Number of trips ending at stop X during the time interval [t1, t2]. As before, we use a count operation in the WM, restricted to the range in Ψ that corresponds to the pattern X$ found in the spatial query. -- Number of trips using stop X during the time interval [t1, t2]. As in the spatial query, the range in Ψ is obtained with two select1 on D. Then, a count operation is done over the WM to find the occurrences inside the time interval [t1, t2]. -- Number of trips starting at X and ending at Y occurring during time interval [t1, t2]. We consider two different semantics. A query with strong semantics will obtain trips that start and end inside [t1, t2]. Whereas, a query with weak se- mantics will obtain trips whose time intervals overlap [t1, t2] and, therefore, they could actually start before t1 or end after t2. We can binary search Ψ for the pattern Y $X, hence obtaining the corresponding continuous range of positions in the section of Ψ devoted to Y . We know that the range for Y $X in Ψ has pointers to the section $ in Ψ . But, note that taking into account the considerations in the sorting of trips when building the CSA, this section $XY is a continuous range of the same size than the range Y $X, and it also preserves the same order of the trips. Note that, the range Y $X of Ψ has associated the final time of each trip in the WM, whereas the range $XY has associated the timestamps of the starting time of each trip in increasing order (due to how we sorted the trips). Therefore, we can use these ranges, respectively, to check time constraints related to the ending stop (Y ) and to the starting stop ($X) of each trip. • Strong semantics. Since time instants within the range $XY are in increas- ing order, we can use the WM to obtain a continuous subrange (inside $XY ) of trips starting during the interval [t1, t2]. That subrange has a matching subrange inside of the range Y $X corresponding to the final stop of those trips (in the same order). We can again use the WM to count the number of those trips with valid ending times. That is, we can perform a count oper- ation in the WM over the subrange of Y $X corresponding to the subrange of $XY with valid starting times. • Weak semantics. In this case we need to consider all the trips in the range $XY starting within [t1, t2], as well as the ones starting before t1 but ending after t1. 10 N. Brisaboa, A. Farina, D. Galaktionov, and A. Rodr´ıguez 5 Experimental evaluation In this section we provide experimental results to show how CTR handles a large collection of trips. We discuss both the space requirements of our representation and also show its performance at query time. Although due to legal issues we could not provide experiments over real trips gathered from transport companies, we managed to use real data of the Madrid's public transportation network4 (in the GTFS5 format) to generate two datasets of synthetic trips: -- Subway trips. This combines the subway network with the Spanish com- muter rail system called "Cercan´ıas". In total, there are 313 different stations organized in 23 lines. They are open to the public from 6:00 AM to 2:00 AM, thus trips were always generated within 20 hours a day. -- Bus trips. It uses 4648 bus stops, organized in 206 lines. Some of these lines are from special night services, so we generated trips using 24 hours a day. Trip generation process choses a starting stop and an ending stop, and uses the network description to generate every stop that the trip must traverse. We generated 50 million trips in both datasets, whose lengths vary from 2 to 31 stops following a binomial distribution with a mean length of 11.81 stops. Based on the GTFS data, we also generated realistic timestamps along each stop, and built the WM-based time index in CTR discretizing these timestamps into 5-minute intervals. We distinguished four kinds of days in a week: regular working days, Fridays/holiday eves, Saturdays, and Sundays/holidays; and two kinds of weeks for high and low season representations. In total, a time interval may belong to eight types of day. Below, we show the space/time tradeoff for both datasets obtained by three settings of CTR. We tune its Ψ sample rate parameter to values 16, 64, and 256, respectively. All tests were run on a machine with an Intel(R) Core(TM) i5- [email protected] CPU, and 8GB DDR3 RAM. The operating system was Ubuntu 15.04 and the compiler gcc 4.9.2 (options -O3). We compare the space usage of the stops representation in the CTR with the space required by two baseline compressors: gzip and bzip2. To measure the compression, we assume, as a reference, a plain representation that uses the least amount of bits needed to represent every stop with a fixed width6. The sizes of these plain representations are 687.28 MiB for the subway trips dataset, and 992.59 MiB for the bus trips. Note that we ignore the space needed for the representation of time intervals, as WM does not offer any compression by itself, and needs 866.27 and 944.88 MiB for subway and bus trips, respectively. Results regarding space usage are given in Table 1. Note that an iCSA built on English text [3] typically reached the compression of gzip (around 35% in compression ratio). As expected, the high compressibility of our sorted dataset 4 Data from the EMT corporation https://www.emtmadrid.es/movilidad20/googlet.html 5 GTFS is a well-known specification for representing an urban transportation net- work. See https://developers.google.com/transit/gtfs/reference?hl=en 6 9 bits/stop for subway trips, 13 bits/stop for bus trips Compact Trip Representation over Networks 11 of trips permits CTR to improve those numbers with compression ratios under 30% in the most sparse setup, much better than gzip, and even than bzip2. Yet, CTR offers also indexing features that allow us to perform efficient searches. To provide a rough comparison with a database solution similar to NET- TRA [9] we included in a table a row containing each trip ID (represented with 4 bytes), stop ID (represented with 2 bytes), and time interval (represented with 2 bytes instead of a full datetime). The size of the whole table was around 4505 MiB, without taking any indexes into account. Therefore, such represen- tation would use at least more than twice the space of CTR while it could not efficiently support the queries discussed in this paper. Dataset Subway Bus Ψ16 467.07 (67.96%) 499.84 Ψ64 249.14 (36.25%) 283.12 Ψ256 193.10 (28.10%) 227.42 gzip 401.72 (58.45%) 957.03 bzip2 238.43 (34.69%) 389.74 (50.36%) Table 1. Comparison on space usage for stops. Space in MiB. (28.52%) (22.91%) (96.42%) (39.26%) To see the query performance of CTR, we generated 10, 000 random queries of each type, and measured the average time required to solve them. Table 2 shows the results of spatial queries. Almost any query can be solved in the order of ten µsecs and the heaviest Top-k within msecs per query in our experiments. As expected, the query "ends at X" performs slightly faster than "starts at X", as the region in Ψ for any stop X is smaller than the region of $, thus needing more time to search a pattern inside the later. It is also expected that the spatial "uses X" performs much faster than any other query as it does not operate over Ψ and its samples, using instead the select1 operator over D. For the same reasons, both spatial Top-k algorithms are also independent from the Ψ sample rate parameter. However, it is interesting to point out that even when the binary partitioning algorithm is much faster for small values of k, its sequential counterpart overcomes it for large values of k. This is a reasonable phenomena considering that for large values of k, the number of select1 operations that the binary partitioning algorithm needs to perform tends to be the same as in the sequential algorithm, but with the additional cost of maintaining a larger and more complex structure (a priority queue versus a binary heap). CTR Starts at X Ends at X Starts at X Uses X Sequential ends at Y Top 10 Binary Top 10 Sequential Top 1000 Binary Top 1000 Subway Ψ16 Subway Ψ64 Subway Ψ256 Bus Ψ16 Bus Ψ64 Bus Ψ256 6.03 8.22 18.78 7.51 9.58 22.77 Table 2. Time performance for spatial queries (in µsecs/query). 11.24 16.68 38.82 9.24 15.72 41.31 4.53 4.61 5.69 6.27 6.52 11.35 761.14 0.3902 0.7944 588.01 1031.84 50.42 39.36 62.79 75.09 1514.07 Table 3 shows the results of spatio-temporal queries. Looking at the differ- ences between spatial queries and their spatio-temporal counterparts, it can be 12 N. Brisaboa, A. Farina, D. Galaktionov, and A. Rodr´ıguez seen that computing a count query over the WM takes roughly around 3 µsec, so its time overhead is relatively small. CTR Starts at X Ends at X Starts at X ends at Y (strong) Starts at X ends at Y (weak) Uses X Subway Ψ16 Subway Ψ64 Subway Ψ256 Bus Ψ16 Bus Ψ64 Bus Ψ256 8.34 11.21 21.68 10.41 12.95 26.20 7.44 7.83 8.58 9.50 10.19 14.87 22.42 28.07 49.98 12.25 18.84 44.84 18.95 24.32 46.50 12.12 18.75 44.92 2.08 4.90 Table 3. Time performance for spatio-temporal queries (in µsecs/query). 6 Conclusions and future work As better tracking mechanisms will be installed, the problem of storing and querying trips to support network analysis will gain interest for network manage- ment administrations and even end-user applications. For instance, with enough data of vehicle trips from a significant amount of drivers over the network formed by the streets of a city, it would be possible to infer traffic rules by examining turns that nobody takes, their usual driving speed across the network, and other useful information. We showed that CTR is a powerful structure to represent user trips. Using compact data structures to represent trips over a transportation network allows us not only to keep a much larger amount of data in main memory (compression ratio is around 30%), but also to efficiently perform spatial and spatio-temporal queries oriented to understand the real usage of the network. We have presented CTR as a proof of concept development. It is flexible enough to allow new adaptations and functionality improvements we plan to do as future work, such as the analysis of line changes in switching stops (that would require storing the network topology) or providing compression for the time index. Also, future work considers providing new experiments over real data of trips. References 1. F. Claude, G. Navarro, and A. Ord´onez . The wavelet matrix: An efficient wavelet tree for large alphabets. Inf. Systems, 47:15 -- 32, 2015. 2. V. T. de Almeida and R.H. Guting. Indexing the Trajectories of Moving Objects in Networks. GeoInformatica, 9(1):33 -- 60, 2005. 3. A. Farina, N. Brisaboa, G. Navarro, F. Claude, A. Places, and E. Rodr´ıguez. Word- based self-indexes for natural language text. ACM TOIS, 30(1):article 1, 2012. 4. Elias Frentzos. Indexing Objects Moving on Fixed Networks. In Proc. 8th SSTD, pages 289 -- 305, 2003. 5. S. Funke, R. Schirrmeister, S. Skilevic, and S. Storandt. Compass-based navigation in street networks. In Proc. 14th W2GIS, LNCS 9080, pages 71 -- 88, 2015. 6. R. Grossi, A. Gupta, and J.S. Vitter. High-order entropy-compressed text indexes. In Proc. 14th SODA, pages 841 -- 850, 2003. Compact Trip Representation over Networks 13 7. A. Guttman. R-trees: A dynamic index structure for spatial searching. In Proc. SIGMOD, pages 47 -- 57, 1984. 8. G. Kellaris, N. Pelekis, and Y. Theodoridis. Map-matched Trajectory Compression. Journal of Systems and Software, 86(6):1566 -- 1579, 2013. 9. Benjamin Krogh, Nikos Pelekis, Yannis Theodoridis, and Kristian Torp. Path- based queries on trajectory data. In Proceedings of the 22nd ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems, pages 341 -- 350. ACM, 2014. 10. N. Meratnia and Rolf A. de By. Spatiotemporal compression techniques for moving point objects. In Proc. 9th EDBT 2004, LNCS 2992, pages 765 -- 782, 2004. 11. M. A. Munizaga and C. Palma. Estimation of a disaggregate multimodal public transport origin -- destination matrix from passive smartcard data from santiago, chile. Transportation Research Part C: Emerging Technologies, 24:9 -- 18, 2012. 12. G. Navarro and V. Makinen. Compressed full-text indexes. ACM Computing Surveys, 39(1):article 2, 2007. 13. N. Pelekis and Y. Theodoridis. Mobility Data Management and Exploration. Springer, 2014. 14. D. Pfoser, C. S. Jensen, and Y. Theodoridis. Novel Approaches in Query Processing for Moving Object Trajectories. In Proc. VLDB, pages 395 -- 406, 2000. 15. I. S. Popa, K. Zeitouni, V. Oria, D. Barth, and S. Vial. Indexing In-network Trajectory Flows. VLDB J., 20(5):643 -- 669, 2011. 16. M. Potamias, K. Patroumpas, and T. K. Sellis. Sampling Trajectory Streams with Spatiotemporal Criteria. In Proc 18th SSDBM, pages 275 -- 284, 2006. 17. K. Richter, F. Schmid, and P. Laube. Semantic Trajectory Compression: Repre- senting Urban Movement in a Nutshell. J. Spatial Information Science, 4(1):3 -- 30, 2012. 18. K. Sadakane. New text indexing functionalities of the compressed suffix arrays. Journal of Algorithms, 48(2):294 -- 313, 2003. 19. Y. Tao and D. Papadias. MV3R-Tree: A Spatio-Temporal Access Method for Timestamp and Interval Queries. In Proc. VLDB, pages 431 -- 440, 2001.
1610.04597
1
1610
2016-10-14T19:39:10
Application of Global Route-Planning Algorithms with Geodesy
[ "cs.DS" ]
Global Route-Planning Algorithms (GRPA) are required to compute paths between several points located on Earth's surface. A geodesic algorithm is employed as an auxiliary tool, increasing the precision of distance calculations. This work presents a novel simulator for GRPA, which compares and evaluates three GRPAs implemented to solve the shortest path problem for points located at different cities: A*, LPA*, and D*Lite. The performance of each algorithm is investigated with a set of experiments, which are executed to check the answers provided by the algorithms and to compare their execution time. It is shown that GRPAs implementations with consistent heuristics lead to optimal paths. The noticeable differences among those algorithms are related to the time execution after successive executions.
cs.DS
cs
Application of Global Route-Planning Algorithms with Geodesy William C. da Rosa, Iury V. de Bessa, Lucas C. Cordeiro Federal University of Amazonas, Brazil Abstract Global Route-Planning Algorithms (GRPA) are required to compute paths between several points located on Earth's surface. A geodesic algorithm is employed as an auxiliary tool, increasing the precision of distance calculations. This work presents a novel simulator for three GRPA – A*, LPA* and D*Lite – implemented to solve the shortest path problem for points located at different cities. The performance of each algorithm is investigated with a set of experiments, which are executed to check the answers provided by the algorithms and to compare their execution time. It is shown that GRPA implementations with consistent heuristics lead to optimal paths. The noticeable differences among those algorithms are related to the execution time after successive route calculations. Keywords-Route planning, Geodesy. I.INTRODUCTION Several Global Route-Planning Algorithms (GRPA), such as A* [1], LPA* [2] and D*Lite [3], have been developed in the last decades to offer paths with the lowest cost in short time intervals. These algorithms work with a discrete representation of an environment (i.e., route graph) [4], which describes different paths in which an agent may use for navigation. GRPA may also be referred to as planners. A graph is composed by vertices and edges, where an edge connects two consecutive vertices directly. The route is built after successive connections between vertices. In this paper, vertices are considered to be points located at different positions on Earth's surface. They are connected by edges, which have costs associated to them. These costs are calculated as the length of geodesics on the ellipsoid, which are curves on the ellipsoid's surface. Thus, the values of edge costs must be calculated with a high precision to guarantee the computation of optimal paths. For this purpose, a geodesic algorithm is applied. The geodesic algorithm adopted here is Karney's Geodesic Algorithm [5], [6]. An implementation of that algorithm is proposed for Interactive Data Language (IDL) [7]. It details the canonical representation of two vertices linked by an edge, located on Earth's surface, and defines numerical intervals to determine whether the pair of points is antipodal, i.e., it checks whether such vertices are located at diametrically opposite positions on a sphere or ellipsoid surface. In order to evaluate the planners performance and to calculate geodesic lengths, simulators are usually employed. Two important simulators may be mentioned, one for geodesic calculations and another one for a planner. The online simulator for geodesics, named as "Online geodesic calculations using the GeodSolve utility" [8], solves direct and inverse geodesic problems, offering tools to setup angular outputs, numerical precision and geodesic lengths for different ellipsoids. The simulator for a planner behavior, named as D*Lite Demonstration [9], is an open-source simulator for Java platform. It has a friendly interface, enabling the user to edit grid maps and execute them in debug mode. It is a practical tool for the comprehension of this planner, since it demonstrates how route computing, evolve during the algorithm execution. the variables, necessary for Both simulators are useful to validate different types of calculations. The first simulator provides a reliable answer for the geodesic length between two points on Earth's surface. The second one applies a specific planner to quickly compute a path in a graph with adjustable edge costs. Thus, it validates the correct performance of such planner in a graph with limited size, where all vertices have the same degree and are distributed in a geometric standard, i.e., a square-grid board. It is also useful to join and expand the functionalities of both simulators, creating a discrete environment, where vertices are represented in real world locations and have different direct connections from each other. A simulator that combines pathfinding and geodesic abilities computes optimal paths on Earth surface, in a graph where vertices do not follow a geometric standard and have different degrees. It generalizes the pathfinding problem to real situations. A simulator was created in this work to employ three different planners – A*, LPA*, and D*Lite – which must use geodesic functions to compute optimal paths on Earth's surface. The performances of planners are also compared in terms of execution time. Our simulator, named Geodesic Path Comparer (GPC), carries out an implementation of Karney's Algorithm. GPC considers a simplification made in [7], which determines the antipodal status of two points based on their geographic coordinates. Then, the geodesic lengths calculated by GPC are validated by comparison to the ones provided by [8]. GPC also expands concepts illustrated in [9] by generating paths with vertices whose placements follow no geometric standard. The main contributions of this article are: the employment of geodesy and adaptive data structures for the creation of GPC; and the evaluation of planners' behaviors in graphs with nodes at irregular positions and with different degrees. II. PRELIMINARIES 2.1. Path Planning Algorithms A* [1] is a best-first search algorithm, which uses heuristics and traversal costs, obtained from expanded nodes, to maintain a priority queue that represents a set of nodes of the graph. The order of nodes expansions follows the queue order, making the search for a path faster if compared to other algorithms with no heuristics or previous information from the graph. LPA* [2] is an expansion of A*, which is able to keep information between successive searches, provided that starting and ending vertices of a route remain static. LPA* does not need to compute all information for the graph from the scratch. It is possible by creating an extra variable for traversal costs and by checking nodes consistency, using heuristics to detect relevant nodes for new route computation. D*Lite [3] is similar to LPA*, but it is more suitable for graphs where a starting node changes over time. The search direction is the inverse of the adopted by LPA*, which can exempt nodes already traveled in the graph. D*Lite is able to update its priority queue without constant reordering, which is important for a fast and optimized response. This feature is derived from D* [10], an algorithm whose behavior is similar to A*, with the exception that edges costs are variable. In this paper, all heuristics are consistent, leading to the minimum cost paths computation. Since Earth's surface is an ellipsoid, the planners require special handling to compute heuristics and edge costs between cities with higher precision, which is provided by a geodesic algorithm [5], [6]. 2.2. Geodesic Algorithm The algorithm for computation of geodesic distances [5], [6] considers geodetic latitudes and ellipsoidal longitudes, applied to an oblate ellipsoid [11]. An auxiliary sphere is created with corresponding variables, such as reduced latitudes and spherical longitudes [12]. It serves as a mathematical tool for the association between geographic coordinates, azimuths, flattening, and eccentricity. The result is a set of integrals expanded by Taylor Series [5], [13], and [14], giving final values for the azimuths, longitudes, and geodesic distances [6]. 0) and ending vertices (ϕ2,λ2 It works as follows: geographic coordinates of starting 0) of an edge are represented (ϕ1,λ1 in a canonical form [7]. These vertices have their reduced latitudes (β1, β2) computed. Earth's first eccentricity [13], [14] is employed at β1 and β2 calculations. Both vertices are also classified as antipodal or not, according to their geographic coordinates. Then, an initial value for the azimuth of the starting point α1 is estimated. In case of non-antipodal extremities, a small set of equations expressed at [15], [16], [12] and [6] gives the initial value of α1. Otherwise, specific procedures for antipodal points are described in [6]. In the current article, only non-antipodal extremities are considered. The initial value of α1 must be further refined, leading to higher levels of precision. For this purpose, an auxiliary sphere is built to make an equivalence between the geodesic curve, which connects start vertex to goal vertex on an ellipsoid's surface, and an arch of a great circle. The values of α1, β1, and β2 are demanded for computation of spherical arc length variables (σ1,σ2). From σ1 and σ2, spherical longitudes (ω1,ω2) are obtained. From ω1 and ω2, the values of ellipsoidal longitudes (λ1,λ2) are given [17]. Then, the values for ellipsoidal longitudes obtained from the refinement procedure (λ1,λ2) are compared to the expected 0), defined earlier, in the beginning of the geodesic ones (λ1 algorithm. The difference between the obtained and the 0,λ2 expected values leads to an error, which is associated with the concept of reduced latitude m12 [18] to give a new, and more precise, value for α1. If the error is not equal to zero or is higher than an acceptable bound, calculations of σ1, σ2, ω1, ω2, λ1, λ2, m12 and α1 will be repeatedly performed (in a loop) until the ellipsoidal longitude error is reduced to a suitable value. When the final value of α1 is obtained, the other variables used in the refinement process are updated one last time. They will be used in distance and longitude integrals [6]. The distance integral employs spherical arc length σ, an expansion factor for integrals k and the polar semi-axis b. Factor k can be obtained from Earth's second eccentricity e' and the azimuth (α0) of the intersection point of the geodesic curve with the Equator [6]. Equation (1) shows the calculation of factor k. Equation (2) illustrates the distance integral. (1) (2) Equation (3) gives the longitude integral. It employs spherical arc length σ, factor k, Earth's first flattening f, spherical longitude ω, and the azimuth α0. (3) Equations (2) and (3) are expanded by Taylor Series up to 6th order, which enable the integrals to be encoded as a finite sum of factors. The results of such sums are the values of ellipsoidal longitudes, which must be identical or very close to the values initially expected, and the length of the geodesic curve connecting two vertices in a graph. The geodesic length is used by GPC as edge costs for graphs. III. SIMULATOR STRUCTURE 3.1. Databases A graph G = (V,E) is composed by a set V of vertices and a set E of edges. Each edge exy ϵ E connects elements vx ϵ V and vy ϵ V. G may be used for modelling aerial connections between cities. In this case, the cities are represented by the geographic coordinates of certain points located on Earth's surface. Such points are the elements of V. Connections between these points are elements of E. The coordinates and connections for each city are registered in memory. Two text files store such data. The first file is reserved for the geographic coordinates of vertices, while the second one stores all direct connections from a certain city, i.e., the coordinates file stores the locations of V elements, while the connections file keeps all E members. It is worth to mention that coordinates and connections files can be edited according to the user's needs, what modifies the format of the graph. The coordinates file can be edited when new cities must be inserted in the graph or when several cities, already inserted in the graph, must be removed from it. Figure 1.a. Position and connections of vertex A. The connections file can be edited whenever is necessary to modify direct connections from a city. The vertex degree may also be modified. As an example shown in Fig. 1, one can consider a graph where a vertex A, represented by coordinates (ϕA,λA), is connected to vertices B, C, D and J. Each city is represented by a set of coordinates and a set of connections. Vertices E, F, G, H and I are also present in the graph (Fig. 1.a). By removing vertex J and modifying the connection lists of vertices A, C, D, E and H, one creates another graph, with new edges between several vertices (Fig. 1.b). This graph modification can only be done by user's request. In Fig. 1, the coordinates for each vertex are declared by its latitude and longitude, in this order. The values are given in decimal degrees. For simplification, the coordinates are represented with 1 decimal place of precision. However, in practical tests, the coordinates have 4 decimal places of precision. The connections for each vertex are represented by the adjacent cities, sorted in alphabetical order. Both files (coordinates and connections) are read only once by a C program that creates an AVL tree, called Original_AVL, to store such data. The nodes of the tree represent cities locations on Earth's surface. Each node is identified by a name; a pair of geographic coordinates; an adjacencies list that registers all possible direct connections from a city; and pointers father, left and right, used in the assembly of the tree. Fig. 2 illustrates an example of the tree structure. Figure 1.b. Connections after modifications. 3.2. GPC Structure To calculate traversal costs between vertices, in kilometers, the planners need to consult coordinates stored in Original_AVL and run the geodesic algorithm. GPC supports A*, LPA* and D*Lite path-planning algorithms to find an optimal route between start and goal vertices and employs Original_AVL as a reference tree. The geodesic algorithm computes traversal costs and heuristics. The latter ones are geodesic distances between a certain vertex to start or goal destinations, depending of the planner executed. GPC structure is shown in Fig. 3. The text files contain all information about vertices coordinates and connections, which must be kept in Original_AVL, the reference tree. The header file AVL.h is responsible for the creation and balance of Original_AVL, storing the content of the text files in the tree, as shown in Fig.2. The tree follows alphabetical in-order sort. Another header file, named Geodesy.h, stores all functions necessary for the geodesic algorithm. The functions have, as input parameters, the geographic coordinates of two vertices. The result given by the geodesic algorithm is the length of the direct connection between the input vertices. Figure 3. GPC Structure 3.3. Toolboxes The planners must check the information stored in the reference tree and apply the geodesic functions in order to compute a final route, from a start to a goal vertex. To achieve Figure 2. Original_AVL Structure. this objective, each planning algorithm is implemented with a toolbox and three header files. The toolbox is a set of data structures required for the execution of the planner. The header files contain functions which manage and modify the variables shown in the toolbox. The planner algorithm (GRPA) is written in one of such files and gives a route. The in toolboxes are used this article as graphic representations of variables and structures. Each planner maintains the following structures inside a toolbox: a map of vertices, a priority queue, and a route. They also have pointers to handle special vertices, such as start, goal and, in case of D* Lite execution, last [8]. D* Lite needs an extra global variable, km, responsible for the correct calculation of new keys for the priority queue [8]. Fig 4 shows the structures and variables respectively related to A*, LPA*, and D* Lite. According to Fig.4, the colored description indicates the exclusive variables for a certain planner, thus, it shows the small differences between toolboxes. The priority queue for A* algorithm is different from the queue for LPA* and D*Lite. Each toolbox has only one map of vertices, which can be AVL_A*, AVL_LPA* or AVL_D*Lite. Two additional variables are used exclusively by D*Lite: pointer last and counter km. Routes are linked lists whose elements are identified by a name, a pair of geographic coordinates, the final traverse cost g for the respective element (optional), and a pointer to the next itinerary stop of the list. Priority queues are linked lists, whose terms are identified by a name and composed by the variables employed in priority calculations and a pointer to the next priority of the queue. A* employs traversal cost g and heuristic h [1] to compute priorities, also known as keys, for the vertices. LPA* behaves similarly, using costs g and rhs and heuristic h to create keys [2], which are expressed here by two terms: K1 and K2. D*Lite employs the same variables of LPA*, adding the extra global variable km [3] to create keys. keys have the same K1, the tiebreaker is the value of K2, calculated by min(g(s),rhs(s)) [2]. Similarly, D*Lite generates K1 by [min(g(s),rhs(s)) + h(start,s) + km], while K2 values are obtained by min(g(s),rhs(s)) [3]. A priority queue controls the way vertices will be analyzed by the respective planner during route computation. The procedure of scanning and upgrading a certain vertex is known as expansion. When a vertex is expanded, its traversal cost, heuristic and backpointer are updated. The adjacent vertices are inserted in the map (Fig.4) and also have heuristics and a traversal cost variable updated. A backpointer, known as back, is the pointer that registers the adjacent vertex from which the traversal cost will be the lowest possible. Consequently, routes are always extracted by tracking backpointers. Thus, priority queues are used by all planners to control vertices expansions while the algorithms are running. The vertex with the lowest key of the priority queue will be the first one to be expanded. The process of vertices expansions is carried out until a final route is obtained by the planner. The maps of vertices are independent AVLs – AVL_A*, AVL_LPA* and AVL_D*Lite – built by the planners from the information kept in Original_AVL. Each map is built and expanded only by request of its respective algorithm. Thus, AVL_A* is built and expanded by A*, AVL_LPA* is edited by LPA*, and AVL_D*Lite is controlled by D*Lite. Original_AVL is not modified by the planners. However, the independent maps can be edited and built again from scratch. The structures of maps resemble the model for Original_AVL. However, there are some differences, since the nodes of maps have extra fields: a blockage status, mentioning the availability of a certain node to be used as an itinerary stop; three variables for traversal costs and heuristics (f, g and h for A*; g, rhs and h for LPA* and D*Lite); and a pointer for back. Fig. 5 illustrates a model for maps of vertices, showing that AVL_A*, AVL_LPA* and AVL_D*Lite can be built in the same way. The queues are sorted in ascending order, i.e. first element of the queue has the lowest key. Figure 4. Toolboxes representation. The A* queue is arranged in ascending order of f, where f = g + h. If two or more keys have the same f, the tiebreaker is the value of g [1]. The LPA* queue is arranged in ascending order of K1, which is calculated by min(g(s),rhs(s)) + h(s), where s is the vertex associated to such key. If two or more Figure 5. Example of a map of vertices – AVL_A*, AVL_LPA* or AVL_D*Lite. The only differences between the independent AVLs are the contents of their nodes, which are presented in Fig. 6. Colored variables are specific for a certain planner. Every AVL_A* node contains a name; a blockage status; an identifier of OPEN or CLOSED status [1]; a pair of coordinates; variables of costs and heuristics, useful for key calculations; pointers for tree structure (father, left and right); a backpointer and a list of adjacencies. Similarly, AVL_LPA* nodes are identified by a name; a blockage status; a pair of coordinates; variables for priority computations; pointers for tree structure; backpointer and a list of adjacencies. The fields for AVL_D*Lite nodes are the same as those for AVL_LPA*. A* and LPA* expand vertices from start to goal. When they reach this objective, it is necessary to create a route from start to goal, a task performed by back. From goal vertex, the backtracking the backpointers from goal to start. Then, the final route is obtained by following the inverse path of the backtracking. is done by successively following D*Lite expands vertices to start. The backtracking is done from start to goal and the final route is the same path obtained by the backtracking search. from goal Each node of the independent AVLs has a list of adjacencies (Fig. 6). The lists of adjacencies found in the independent AVLs have elements composed by three fields: a name, a pointer to the next element and a value named Dist. The latter stores the geodesic distances between a certain city and its respective adjacency. Dist only appears in AVL_A*, AVL_LPA* and AVL_D*Lite nodes. Figure 6. Internal fields for the nodes of a map of vertices. An example with A* algorithm illustrates this: A city 'X' is directly connected to cities K, H and W. The city X has a node in Original_AVL, which is known as X-node of Original_AVL. Similarly, X has a node in AVL_A*, known as X-node of AVL_A*. In the X-node of Original_AVL, the list is described as ({K}; {H}; {W}). However, in the X-node of AVL_A*, the list is described as ({K, }; {H, }; {W, }). Let S be the list of adjacencies found in the X-node of AVL_A*. Formally, S can be described as (4) where x is the city represented by the node that contains the list of adjacencies (X in the example) and yi is the set of all adjacent cities (K, H and W in the example) to x. The value n is the maximum value of adjacent vertices of x. In other words, x = X, y1 = K, y2 = H, y3 = W. Thus, S = ({K, }; {H, }; {W, }). Dist values are memorized after the first expansion of X in AVL_A* because they are the geodesic distances used as traversal costs from X to all its neighbors. Such values are employed as edge costs while A* is computing a path. If they were not saved, they should always be calculated when A* needed some edge cost between two cities. The same logic applies to LPA* and D*Lite. This strategy aims to save time, avoiding repetitive executions of the geodesic algorithm. To manage a toolbox, three header files were created for it. The first header file builds and balances the map of vertices. The second file controls the priority queue. The third file contains the planner code and employs the two previous files to generate the final route. In other words, there are three header files for each toolbox. 3.4. Planning algorithms implementations As mentioned in the previous subsection, one of the header files designed for the planner contains the code lines and must deal with the data structures abstracted in the corresponding toolbox. The other two header files perform specific activities with some elements of the toolbox, like managing map of vertices and controlling priority queues. For example, DLite_III.h is a header file that keeps all code lines for D*Lite execution. In the implementation proposed for GPC, the planner needs to manipulate a map of vertices (AVL_D*Lite), a priority queue and some other variables abstracted inside a unit called Toolbox D*Lite (Fig.3). With the purpose of dealing with AVL_D*Lite, DLite_I.h was created. To work with the priority queue, DLite_II.h was written. GPC runs D*Lite by calling DLite_III.h, which contains the core of D*Lite and employs the other two headers, together with the toolbox, to calculate a final route. The current session details how A* is described in A_Star_III.h, LPA* in LPA_III.h and D*Lite in DLite_III.h. In other words, the next paragraphs describe how the path- planning algorithms work in GPC. A* [1] creates vertices start and goal, inserting them in the map. Keys are created for the vertices and inserted in the proper priority queue, considering that g(goal) is initially set to ∞. The map and the queue are initially empty. The status of start is set to open, and the vertex with the smallest key is selected for expansion. If the selected vertex for expansion is goal, one last update of neighbors is done, goal status is set to closed and the algorithm finishes. Otherwise, the status of the vertex is set to closed, its backpointer is updated, its neighbors will have their f, g and h values updated and the priority queue is modified to follow adjustments made in the map. Then, the algorithm selects the vertex with the smallest key for expansion in a loop procedure and checks, at each iteration, whether the vertex is goal. LPA* [2] creates start vertex and its key, setting g(start) to ∞ and rhs(start) to zero. The key is inserted in the priority queue, which is initially empty. Then, goal vertex and its key are created, where g(goal) = rhs(goal) = ∞. While the lowest key of the queue is smaller than goal's key or rhs(goal) differs from g(goal), the vertex with the lowest key has its consistency checked and updated, its neighbors have their rhs values and back pointers updated, and the priority queue registers keys from inconsistent vertices. When edge costs are changed, the updates of consistency, rhs values and back pointers are performed again over the affected vertices, leading to the calculation of other routes. This algorithm is able to maintain maps and queues from successive searches for static starting and ending vertices. D* Lite [3] initially sets last = start, km = 0, g(goal) = ∞ and rhs(goal) = 0. The priority queue is initially empty. Then, goal's key is inserted in the queue. Start vertex is created and g(start) = rhs(start) = ∞. While the lowest key of the queue is smaller than start's key or rhs(start) differs from g(start), the vertex with the lowest key will have its consistency checked and updated. Its neighbors will also have their rhs values and back pointers updated. This while-loop is executed until a route is calculated. Then, start vertex varies until it reaches goal. If obstacles are detected in the path, km = km + h(last, start), last = start and the affected vertices are updated. The changing of km interferes directly in future computation of keys and is important to avoid unnecessary reordering of queues and to guarantee optimal paths. To compute a new path, the while-loop previously mentioned is executed again. D*Lite is able to maintain maps and queues for successive calculations with dynamic starting and static ending points. Since the structures adopted by the planners are similar, the differences of performances are noticed when successive calculations are done after the change of blockage status of several nodes. Cities are "blocked" when they are forbidden to be used as route stops. Their blockage status may be modified to force the planners to find alternative paths. IV. EXPERIMENTAL EVALUATION The following section describes experiments where two cities are randomly chosen as starting and ending points. An initial path is computed. Then, several obstacles are randomly imposed in the path by changing blockage status of some intermediate nodes. The resulting routes must be the same for all three planning algorithms, but the time required by each of them varies according to the number of times a certain procedure must be done to achieve alternative paths. In the current session, three experiments are performed. 4.1. Experimental Objectives The first experiment investigates numerical precision of edge costs calculated by GPC. Two vertices are randomly selected from Original_AVL and have a geodesic distance between them computed. In this experiment, the connections database is not yet employed. The only objective is to measure the length of a curve on an ellipsoid's surface and check its precision. The second experiment compares time performances of A* and LPA* algorithms. Vertices start and goal are randomly selected from Original_AVL and the planners must compute a path from start to goal. Coordinates and connections databases are now employed, according to GPC structure (Fig.3). Blockage statuses of intermediate stops are randomly changed, leading to new routes. The length of routes and the time required to calculate them are registered for both algorithms and compared. Start and goal vertices do not change after successive searches. The third experiment compares time performances of LPA* and D*Lite algorithms. Vertices start and goal are also randomly selected. Coordinates and connections databases are also employed. Both planners must compute a path from start to goal. Blockage statuses of intermediate stops are randomly changed. The length of new routes and the time required to calculate them are registered for both algorithms and compared. Start vertex changes after successive searches, while goal stays static. 4.2. Experimental Setup All experiments require information provided by a Coordinate Database, which contains latitudes and longitudes of 124 cities. Second and third experiments require Connections Database, which contains all possible direct connections from a city. Heuristics are consistent and the graph does not follow a geometric standard. the Simulations were performed in a machine with Fedora 23 64-bits OS, Intel Core 2 Duo T6600 (2.2Ghz) processor and 4GB of RAM. The distances given by the execution of geodesic functions are compared to those measured on Google Earth, version 7.1.5. Google Earth is a freeware widely used to simulate routes between points located on Earth's surface. Among its tools, there is a GPS service, a flight simulator, a route calculator and a ruler to measure distances between points. The last two features are employed in this article. Karney's algorithm and Google Earth [18] are both based on World Geodetic System (WGS) [19] [20], whose latest revision is WGS84 (last updated in 2004). 4.3. Experimental Results Experiment A: The implementation of geodesic functions made for the present simulator had an average precision of 99,7%. This result was obtained after a set of tests, where geographic coordinates of two different points on Earth's surface were introduced as input parameters of the geodesic algorithm. The results were the geodesic lengths between both points. Then, such lengths were compared to distances measured on Google Earth and given by Karney's online simulator [8]. The best precision percentage was 99,9997%, while the lowest detected was 99,52%. Higher levels of imprecision may exist, but were not detected in a limited set of tests. Azimuths were approximately equal, proving the orientation between points was correct. that Errors equal to or higher than 25 meters were rare. This result satisfies simulation demands, where the connections between cities are made from one airport to another. The average length of a typical runway is no less than 1.8 km. Therefore, the error levels do not put security at risk for the purposes of this simulator. The results were obtained with no software or hardware costs. Since the edge costs were properly computed, the next experiments can be performed with the necessary precision. Experiment B: A graphic comparison of time efficiency between A* and LPA* algorithms is shown in Fig. 7. An arbitrary number of independent cycles are executed. In this case, 17 cycles are tested, since this quantity of cycles is sufficient for performance comparisons between planners. For each cycle, there is a static start, a static goal and ten iterations. For each iteration, the blockage status of an intermediate vertex is changed, forcing the creation of a new path, i.e., a cycle is completed after the computation of ten distinct routes for the same start and goal vertices. The execution time shown in the graph is the total sum of time after ten iterations of a cycle. Figure 7.Time efficiency - A* vs LPA*. difference is higher than 2 seconds. It is explained by the different degrees of vertices that are expanded during path computations, since higher degrees demands more geodesic calculations for edge costs. Experiment C: A graphic comparison of time efficiency between LPA* and D*Lite is given by Fig. 8. Again, an arbitrary number of cycles is executed. In this case, there are 17 cycles. Each cycle is also complete after ten iterations of path computations and obstacle insertions. In Experiment C, however, there is a dynamic start, i.e., an intermediate vertex of the path will become the new start vertex at every iteration inside a cycle. According to LPA* and D*Lite definitions, LPA* needs to recalculate graph information considering the new start vertex. D*Lite can maintain it. Consequently, D*Lite will require less executions of the geodesic algorithm. For example, the first cycle simulates the execution of A* and LPA* for start city K, goal city L and ten different routes connecting K to L. The overall times for A* and LPA* are registered and printed in a graph. The second cycle works with start city H, goal city V and ten different routes connecting H to V. Overall times for A* and LPA* are collected again. Then, the next overall times for 15 different cycles are registered and illustrated (Fig. 7). It is worth to mention that the times registered at one cycle do not interfere with the times collected for other cycles, meaning that each cycle is independent from the others. The behaviors shown in the graph of Fig.7 can be explained by the LPA* ability to reuse information from previous searches, keeping maps of vertices and priority queues. This allows the algorithm to compute new routes with less effort, considering that edge costs are maintained in AVL_LPA* nodes. Therefore, LPA* doesn't require frequent executions of the geodesic algorithm, saving time. A* needs to recalculate these values again and, depending of the vertices degrees, the computation of new routes can be more or less expensive in terms of time. LPA* is faster or, in the worst case, has the same performance than A*. The length of routes and the itinerary stops are the same for all situations, leading to optimized paths. AVL_A* and AVL_LPA* nodes maintain edge costs between vertices in Dist field (Fig. 6). GPC uses this strategy to call the geodesic algorithm only once for an edge, reducing time consumption for both planners. GPC will only recalculate edge costs when a planning algorithm cannot maintain maps and priority queues. Since each cycle has ten iterations, A* has to compute maps and queues from scratch ten times. LPA* can reuse such information, leading to different time performances between planners, as shown in Fig.7. The execution time for each cycle is the sum of time after ten iterations and is described in milliseconds. LPA* has a better performance and calculates the same routes faster. In some tests, time difference between planners was small, typically lower than 200 milliseconds. In other tests, the Figure 8.Time efficiency - LPA* vs D*Lite. D*Lite saves information from past searches, using the map already created to compute a new route in less time. In most situations, the D*Lite performance is better or equal than LPA*'s in terms of time consumption. In some cycles, the first iterations registered a faster performance for LPA*. It may be explained by the different direction of path calculation. Both planners must give a path from start to end vertices, but D*Lite calculates such path in a reverse order, from end to start. Thus the vertices initially expanded by LPA* are not the same as the ones expanded by D*Lite. If the vertices initially expanded by D*Lite have higher degrees than the ones processed by LPA*, the first iterations for D*Lite will take more time to be executed. However, as the last iterations were run, the D*Lite ability to maintain its map and priority queue pays off, which surpass the initial disadvantage of expanding vertices with higher degrees. As a consequence, the total time after ten iterations, which is the execution time of the respective cycle, is lower for D*Lite. Such consequence is illustrated in Fig. 8 where, for all 17 different cycles, the total execution time is lower for D*Lite, proving its better performance. This behavior can be noticed in bigger graphs. As D*Lite keeps more information, the difference of time performances becomes more visible with higher numbers of iterations at each cycle. As expected, the usage of consistent heuristics led to optimized paths. The length and itinerary stops are the same for both planners. V. RELATED WORK Two other simulators are related to the GPC: online geodesic simulator [8] and the D*Lite Demonstration [9]. The online geodesic simulator [8] provides solutions for direct and inverse geodesic problems. GPC implementation of the geodesic algorithm solves a hybrid problem [6], largely based on the inverse geodesic problem. The online simulator was used during GPC development phase to validate its implementation of Karney's Algorithm and to check costs precision. The online geodesic simulator also offers tools to setup angular outputs and to compute geodesic lengths for different ellipsoids. GPC calculates geodesic lengths in the form of Taylor Series, expanded up to 6th order, and gives the final azimuths of both extremities of an edge. This method allows (2) and (3) to be described as a finite sum of terms in code lines, without affecting numerical precision. The order of expansion can be set arbitrarily, but the results expressed by Karney [6] show that a 6th order expansion is sufficient to avoid the insertion of higher order terms. D*Lite Demonstration [9] simulates a limited sized square- grid board, which operates as a graph. Each square of the board works as a vertex, while direct connections with neighboring squares represent edges. Such simulator allows path calculations between start and end squares, considering the number of neighbors, which can be set up to four or eight. Graphs can be generated manually or automatically. Among its settings, users are enabled to determine the density of blocked squares and the weight of unblocked ones, which affects traversal costs for each square. GPC is partly based in such simulator [9], but is able to work with graphs of any size, where vertices dispositions don't follow a geometric standard. The degrees are not limited to a few options – vertices can be connected to a different number of adjacent nodes. GPC offers the execution of three different planners – D*Lite, LPA* and A* – while D*Lite Demonstration [9] works with one (D*Lite). GPC also offers a better edge cost precision by employing geodesy, which can be applied to real-life situations. VI. CONCLUSIONS A novel GRPA simulator, named GPC, is described and evaluated. This simulator is adapted to perform the execution of three different planners: D*Lite, LPA*, and A*. GPC creates data structures to save databases and functions, allowing the executions of planners and a geodesic algorithm. Some experiments were performed, aiming the GPC evaluation and the comparison among those GPRA's. The experimental results show that GPC presents a precision of 99,7% in geodesic distance computations. Several advantages of GPC implementation can be mentioned, e.g., structs and data processing functions can be adapted to different planners; geodesic calculations are fast and precise; the maintenance of coordinates and connections is restricted to databases; and the reutilization of maps and priority queues reduces the number of geodesic algorithm executions. Additionally, GPC is able to calculate distances with similar precision of the official online geodesic simulator and of widely known freeware (Google Earth). It also expands functionalities from the D*Lite demonstrator [9], since it compares three different path planners, employs consistent heuristics, works well on graphs with vertices located at non- standard positions and gives different route options automatically. Future work includes the implementation of more recent planners, designed for situations where goal node is also dynamic (MTD*Lite and GAA*), and the adaptation of the current simulator for mobile robots, where sensors can detect changes of blockage status over time. REFERENCES [1] NILSSON, N.J.; HART, P.E.; RAPHAEL, B. A Formal Basis for the Heuristic Determination of Minimum Cost Paths. Stanford Research Institute, 1971. [2] KOENIG, S.; LIKHACHEV, M. Incremental A*. College of Computing Science, Georgia Institute of Technology, Atlanta, 2001. [3] KOENIG, S.; LIKHACHEV, M. D* Lite. College of Computing Science, Georgia Institute of Technology, Atlanta e School of Computer Science, Carnegie Mellon University, Pittsburgh. 2002. [4] TENBRINK, T.; WIENER. J. M.; CLARAMUNT, C. Representing Space in Cognition: Interrelations of behavior, language and formal methods. Oxford University, 2013. [5] KARNEY, C.F.F. Geodesics on an ellipsoid of revolution. SRI International, Princeton, 2011. [6] KARNEY, C.F.F. Algorithms for geodesics. Journal of Geodesy, vol. 87, p.43-55, 2013. [7] ELVIDGE, S.; MANNIX, C. Inverse_Geodesic, 2013. Available at <http://seanelvidge.com/wp-content/uploads/ 2013/04/inverse_geodesic.pro>. [8] KARNEY, C.F.F. Online geodesic calculations using the GeodSolve utility, 2015. Available at <http:// geographiclib.sourceforge.net/cgi- bin/GeodSolve>. [9] RIOS, L.H.O. D*Lite Demonstration, 2014. Available at <http://luisrios.eti.br/public/en_us/research/d_star_lite_demo/>. [10] STENTZ, A. Optimal and efficientpath planning for partially known environments,in Proceedings of the International Conference on Robotics and Automation, 3310-3317. The Robotics Institute, Carnegie Mellon University, Pittsburgh. 1994. [11] JEKELI, C. Geometric Reference Systems in Geodesy. Division of Geodetic Science School of Earth Sciences, Ohio State University, 2012. [12] RAPP, R.H. Geometric Geodesy: Part II. Department of Geodetic Science and Surveying, Ohio State University, Columbus, 1993. [13] HELMERT, F.R. Mathematical and Physical Theories of Higher Geodesy. Translation of Mathematischen und Physikalischen Theorieen der Höheren Geodäsie. Publishing House of B.G.Teubner, Leipzig, 1880. [14] BESSEL, F. W. The calculation of longitude and latitude from geodesic measurements, 2009.Translation of Über die Berechnung der geographischen Längen und Breiten aus geodätischen Vermessungen. Königsberg Observatory, 1825. [15] SODANO, E.M.; ROBINSON, T.A. Direct and Inverse Solutions of Geodesics. U.S. Army Map Service, Washington D.C., 1963. [16] VICENTY, T. Direct and Inverse Solutions of Geodesics on the Ellipsoid with Application of Nested Equations.Directorate of Overseas Surveys, Ministry of Overseas Development, Tolworth, 1975. [17] RAPP, R.H. Geometric Geodesy: Part I. 1984. Publishedby Department of Geodetic Science and Surveying, Ohio State University, Columbus, 1991. [18] DRAGOMIR, V.C.; GHIŢĂU, D.N; MIHĂILESCU, M.S.; ROTARU, M.G. Theory of the Earth's Shape. Ed. Elsevier, 1982. Translation ofTeoriafiguriipămintului. Ed. Tehnică, Bucharest, 1977. [19] Google Earth, 2016. Available at <http://www.google.com/earth/> [20] Dma Technical Manual 8358.1 - Datums, Ellipsoids, Grids and Grid Reference Systems. The Defense Mapping Agency. Last updated September, 2014. Available at <http://earth-info.nga.mil/GandG/publications/tm8358.1/ toc.html>. [21] MARKS, M. Converting GIS Vector Data to KML. Google Geo APIs Team, 2009. Available at <http://developers.google.com/kml/articles/ vector>.
1902.06575
1
1902
2019-02-18T14:03:25
Extending Upward Planar Graph Drawings
[ "cs.DS", "cs.CG" ]
In this paper we study the computational complexity of the Upward Planarity Extension problem, which takes in input an upward planar drawing $\Gamma_H$ of a subgraph $H$ of a directed graph $G$ and asks whether $\Gamma_H$ can be extended to an upward planar drawing of $G$. Our study fits into the line of research on the extensibility of partial representations, which has recently become a mainstream in Graph Drawing. We show the following results. First, we prove that the Upward Planarity Extension problem is NP-complete, even if $G$ has a prescribed upward embedding, the vertex set of $H$ coincides with the one of $G$, and $H$ contains no edge. Second, we show that the Upward Planarity Extension problem can be solved in $O(n \log n)$ time if $G$ is an $n$-vertex upward planar $st$-graph. This result improves upon a known $O(n^2)$-time algorithm, which however applies to all $n$-vertex single-source upward planar graphs. Finally, we show how to solve in polynomial time a surprisingly difficult version of the Upward Planarity Extension problem, in which $G$ is a directed path or cycle with a prescribed upward embedding, $H$ contains no edges, and no two vertices share the same $y$-coordinate in $\Gamma_H$.
cs.DS
cs
Extending Upward Planar Graph Drawings Giordano Da Lozzo, Giuseppe Di Battista, and Fabrizio Frati Roma Tre University, Italy {dalozzo,gdb,frati}@dia.uniroma3.it Abstract. In this paper we study the computational complexity of the Upward Planarity Extension problem, which takes in input an upward planar drawing ΓH of a subgraph H of a directed graph G and asks whether ΓH can be extended to an upward planar drawing of G. Our study fits into the line of research on the extensibility of partial representations, which has recently become a mainstream in Graph Drawing. We show the following results. -- First, we prove that the Upward Planarity Extension problem is NP-complete, even if G has a prescribed upward embedding, the vertex set of H coincides with the one of G, and H contains no edge. -- Second, we show that the Upward Planarity Extension problem can be solved in O(n log n) time if G is an n-vertex upward planar st-graph. This result improves upon a known O(n2)-time algorithm, which however applies to all n-vertex single-source upward planar graphs. -- Finally, we show how to solve in polynomial time a surprisingly difficult version of the Upward Planarity Extension problem, in which G is a directed path or cycle with a prescribed upward embedding, H contains no edges, and no two vertices share the same y-coordinate in ΓH . 1 Introduction Testing whether a partial solution to a problem can be extended into a complete one is a classical algorithmic question. For instance, Kratochv´ıl and Sebo [27] studied the vertex coloring problem when few vertices are already colored, whereas Fiala [18] considered the problem of extending a partial 3-coloring of the edges of a graph. The study of the extensibility of partial representations of graphs has recently become a mainstream in the graph drawing community; see, e.g., [3,9,11,12,13,20,22,23,24,25,28]. Major contributions in this scenario are the result of Angelini et al. [3], which states that the existence of a planar drawing of a graph G extending a given planar drawing of a subgraph of G can be tested in linear time, and the result of Bruckner and Rutter [9], which states that the problem of testing the extensibility of a given partial level planar drawing of a level graph (where each vertex -- including the ones whose drawing is not part of the input -- has a prescribed y-coordinate, called level ) is NP-complete. Upward planarity is the natural counterpart of planarity for directed graphs. In an upward planar drawing of a directed graph no two edges cross and an edge directed from a vertex u to a vertex v is represented by a curve monotonically increasing in the y-direction from u to v; the latter property effectively conveys the information about the direction of the edges of the graph. The study of upward planar drawings is a most prolific topic in the theory of graph visualization [2,4,5,6,7,8,10,14,15,17,19,29]. Garg and Tamassia showed that deciding the existence of an upward planar drawing is an NP-complete problem [19]. On the other hand, Bertolazzi et al. [5] showed that testing for the existence of an upward planar drawing belonging to a fixed isotopy class of planar embeddings can be done in polynomial time. Further, Di Battista et al. [15] proved that any upward planar graph is a subgraph of a planar st-graph and as such it admits a straight-line upward planar drawing. In this paper, we consider the extensibility of upward planar drawings of directed graphs. Namely, we introduce and study the complexity of the Upward Planarity Extension (for short, UPE) problem, which is defined as follows. The input is a triple (cid:104)G, H, ΓH(cid:105), where ΓH is an upward planar drawing of a subgraph H of a directed graph G; we call H and ΓH the partial graph and the partial drawing, respectively. The UPE problem asks whether ΓH can be extended to an upward planar drawing of G; or, equivalently, whether an upward planar drawing of G exists which coincides with ΓH when restricted to the vertices and edges of H. We also study the Upward Planarity Extension with Fixed Upward Embedding (for short, UPE-FUE) problem, which is the UPE problem with the additional requirement 9 1 0 2 b e F 8 1 ] S D . s c [ 1 v 5 7 5 6 0 . 2 0 9 1 : v i X r a that the drawing of G we seek has to respect a given upward embedding, i.e., a left-to-right order of the edges entering and exiting each vertex. Related problems. Level planar drawings are special upward planar drawings. Klemz and Rote studied the Ordered Level Planarity (OLP) problem [26], where a partial drawing of a level graph is given containing all the vertices and no edges. The problem asks for the existence of a level planar drawing of the graph extending the partial one. They show a tight border of tractability for the problem by proving NP-completeness even if no three vertices have the same y-coordinate and by providing a linear-time algorithm if no two vertices have the same y-coordinate. Bruckner and Rutter studied the Partial Level Planarity (PLP) problem [9], that is, the extensibility of a partial drawing of a level graph, which might contain (not necessarily all) vertices and edges. Beside proving NP-completeness even for connected graphs, they provided a quadratic-time algorithm for single-source graphs. The NP-hardness of the Upward Planarity Testing problem [19] directly implies the NP-hardness of the UPE problem, as the former coincides with the special case of the latter in which the partial graph is the empty graph. Further, we have that any instance of the OLP problem in which no λ vertices have the same y-coordinate can be transformed in linear time into an equivalent instance of the UPE problem in which the partial graph contains all the vertices and no edges, and no λ vertices have the same y-coordinate in the partial drawing; moreover, a linear-time reduction can also be performed in the opposite direction. As a consequence of these reductions and of the cited results about the complexity of the OLP problem, we obtain that the UPE problem is NP-hard even if the partial graph contains all the vertices and no edges, and no three vertices share the same y-coordinate in the partial drawing, while it is linear-time solvable if the partial graph contains all the vertices and no edges, and no two vertices have the same y-coordinate in the partial drawing. Several constrained graph embedding problems that are NP-hard when the graph has a variable embedding are efficiently solvable in the fixed embedding setting; some examples are minimizing the number of bends in an orthogonal drawing [19,30], testing for the existence of an upward planar drawing [5,19], or testing for the existence of a windrose-planar drawing [1]. Observe that the NP-hardness of the UPE problem does not directly imply the NP-hardness of the UPE-FUE problem. However, by providing a non-trivial extension of the cited NP-hardness proof of Bruckner and Rutter [9] for the PLP problem, we show that the UPE-FUE problem is NP-hard even for connected instances whose partial graph contains all the vertices and no edges. These proofs of NP-hardness are presented in Section 3. Our contributions. We now present an overview of our algorithmic results. First, we identify two main factors that contribute to the complexity of the UPE and UPE-FUE problems: (i) The presence of edges in the partial graph and (ii) the existence of vertices with the same y-coordinate in the partial drawing. These two properties are strictly tied together. Namely, any instance of the UPE or UPE-FUE problems can be efficiently transformed into an equivalent instance (cid:104)G, H, ΓH(cid:105) of the same problem in which H contains no edges or no two vertices share the same y-coordinate in ΓH (see Section 2). Hence, the NP-hardness results for the UPE and UPE-FUE problems discussed above carry over to such instances, even when V (G) = V (H). When the partial graph contains no edges and no two vertices share the same y-coordinate in the partial drawing, then the UPE and UPE-FUE problems appear to be more tractable. Indeed, although we can not establish their computational complexity in general, we can solve them for instances (cid:104)G, H, ΓH(cid:105) such that G is a directed path or cycle (see Section 5). In particular, in order to solve the UPE-FUE problem for directed paths, we employ a sophisticated dynamic programming approach. Second, we look at the UPE and UPE-FUE problems for instances (cid:104)G, H, ΓH(cid:105) such that G is an upward planar st-graph (see Section 4), i.e., it has a unique source s and a unique sink t. The upward planarity of an st-graph is known to be decidable in O(n) time [15,17], where n is the size of the instance. We observe that a result of Bruckner and Rutter [9] implies the existence of an O(n2)-time algorithm to solve the UPE problem for upward planar st-graphs; their algorithm works more in general for upward planar single-source graphs. We present O(n log n)-time algorithms for the UPE and UPE-FUE problems for upward planar st-graphs. Notably, these results assume neither that the edge set of H is empty, nor that any two vertices have distinct y-coordinates in ΓH , nor that V (G) = V (H). 2 Preliminaries In the first part of this section we give some preliminaries and definitions. 2 A drawing of a graph is planar if no two edges intersect. A graph is planar if it admits a planar drawing. A planar drawing partitions the plane into topologically connected regions, called faces. The unique unbounded face is the outer face, whereas the bounded faces are the internal faces. Two planar drawings of a connected planar graph are equivalent if they have the same clockwise order of the edges around each vertex. A planar embedding is an equivalence class of planar drawings of the same graph. For a directed graph G we denote by (u, v) an edge that is directed from a vertex u to a vertex v; such an edge is incoming at v or enters v, and is outgoing from u or exits u. A source of G is a vertex v with no incoming edges; a sink of G is a vertex u with no outgoing edges. A path (u1, . . . , un) in G is monotone if the edge between ui and ui+1 exits ui and enters ui+1, for every i = 1, . . . , n − 1. A successor (predecessor ) of a vertex v in G is a vertex u such that there is a monotone path from v to u (resp. from u to v). We denote by SG(v) (by PG(v)) the set of successors (resp. predecessors) of v in G. An edge (u, v) of G is transitive if G contains a monotone path from u to v with at least one internal vertex. When the direction of an edge in G is not known or relevant, we denote it by {u, v} instead. A drawing of a directed graph G is upward if each edge (u, v) is represented by a curve monotonically increasing in the y-direction from u to v. A drawing of G is upward planar if it is both upward and planar. A graph is upward planar if it admits an upward planar drawing. Consider an upward planar drawing Γ of a directed graph G and consider a vertex v. The list S(v) = [w1, . . . , wk] contains the adjacent successors of v in "left-to-right order". That is, consider a half-line (cid:96) starting at v and directed leftwards; rotate (cid:96) around v in clockwise direction and append a vertex wi to S(v) when (cid:96) overlaps with the tangent to the edge (v, wi) at v. The list P(v) = [z1, . . . , zl] of the adjacent predecessors of v is defined similarly. Then two upward planar drawings of a connected directed graph are equivalent if they have the same lists S(v) and P(v) for each vertex v. An upward embedding is an equivalence class of upward planar drawings. If a vertex v in an upward planar graph G is not a source or a sink, then a planar embedding of G determines S(v) and P(v). However, if v is a source or a sink, then different upward planar drawings might have different lists S(v) or P(v), respectively. The combinatorial properties of the upward embeddings have been characterized by Bertolazzi et al. [5]. Given an upward planar graph G with a fixed upward embedding, and given a subgraph G(cid:48) of G, we assume that G(cid:48) is associated with the upward embedding corresponding to the upward planar drawing of G(cid:48) obtained from an upward planar drawing of G with the given upward embedding by removing the vertices and edges not in G(cid:48). In order to study the time complexity of the UPE and UPE-FUE problems, we assume that an instance (cid:104)G, H, ΓH(cid:105) of any of such problems is such that ΓH is a polyline drawing, that is, a drawing in which the edges are represented as polygonal lines. Then we define the size of (cid:104)G, H, ΓH(cid:105) as (cid:104)G, H, ΓH(cid:105) = V (G) + E(G) + s, where s is the number of segments that compose the polygonal lines representing the edges in ΓH . Consider an upward planar st-graph G with a fixed upward embedding. In any upward planar drawing Γ of G every face f is delimited by two monotone paths (u1, . . . , uk) and (v1, . . . , vl) connecting the same two vertices u1 = v1 and uk = vl. Assuming that S(u1) = [. . . , u2, v2, . . . ], we call (u1, . . . , uk) the left boundary of f and (v1, . . . , vl) the right boundary of f . For a vertex v (cid:54)= t in G, the leftmost outgoing path L+ G(v) = (w1, . . . , wm) of v is the monotone path such that w1 = v, wm = t, and S(wi) = [wi+1, . . . ], for each i = 1, . . . , m − 1. The rightmost outgoing path R+ G(v) and the rightmost incoming path R− G(s) are also called leftmost and rightmost path of G, respectively. Note that these paths delimit the outer face of G. Consider a monotone path Q from s to t. Let Q∗ be obtained by extending Q with a y-monotone curve directed upwards from t to infinity and with a y-monotone curve directed downwards from s to infinity. Then a vertex u is to the left (to the right) of Q if it lies in the region to the left (resp. to the right) of Q∗. In particular, u is to the left of a vertex v if it lies to the left of the monotone path composed of L+ G(v) and L− G(v). Analogously, u is to the right of v if it lies to the right of the monotone path composed of R+ G(v) and R− G(v). We denote by LG(v) (by RG(v)) the set of vertices that are to the left (resp. to the right) of a vertex v in G. Note that all the definitions introduced in this paragraph do not depend on the actual drawing of G, but only on its upward embedding. G(v) are defined similarly. The paths L+ G(v), the leftmost incoming path L− G(s) and R+ 3 Fig. 1: (left) A biconnected upward planar st-graph G and (right) the SPQR-tree T of G rooted at the R-node µ adjacent to the edge (s, t). The skeletons of all the non-leaf nodes of T are depicted; virtual edges corresponding to edges of G are thin, whereas virtual edges corresponding to S-, P-, and R-nodes are thick. The allocation nodes of the vertex v are in the yellow-shaded region; the node µ is the proper allocation node of v. 2.1 SPQR-Trees A cut-vertex in a graph G is a vertex whose removal disconnects G. A separation pair in G is a pair of vertices whose removal disconnects G. A graph is biconnected (triconnected ) if it has no cut-vertex (resp. no separation pair). A biconnected component of G is a maximal biconnected subgraph of G. Let G be an n-vertex biconnected upward planar st-graph containing the edge (s, t). A split pair of G is either a separation pair or a pair of adjacent vertices. A split component for a split pair {u, v} is either the edge (u, v) or a maximal subgraph G(cid:48) of G which is an upward planar uv-graph and such that {u, v} is not a split pair of G(cid:48). A split pair {u, v} is maximal if there is no distinct split pair {w, z} in G such that {u, v} is contained in a split component of {w, z}. The SPQR-tree T of G, defined as in [16], describes a recursive decomposition of G with respect to its split pairs and represents succinctly all the upward planar embeddings of G. The tree T is a rooted tree with four types of nodes: S, P, Q, and R (refer to Fig. 1). Any node µ of T is associated with an upward planar uv-graph, called skeleton of µ, which might contain multiple edges and which we denote by sk(µ). The edges of sk(µ) are called virtual edges. The tree T is recursively defined as follows. -- Trivial case. If G consists of a single edge (s, t), then T is a Q-node µ and sk(µ) also coincides with the edge (s, t). -- Series case. If G is not a single edge and is not biconnected, then let c1, . . . , ck−1 (for some k ≥ 2) be the cut-vertices of G, where ci belongs to two biconnected components Gi and Gi+1, for i = 1, . . . , k−1, with s ∈ V (G1) and t ∈ V (Gk). Further, set c0 = s and ck = t; then Gi is an upward planar ci−1ci- graph, for i = 1, . . . , k. The root of T is an S-node µ. Finally, sk(µ) is a monotone path (c0, c1, . . . , ck) plus the edge (s, t). -- Parallel case. If G is not a single edge, if it is biconnected, and if {s, t} is a split pair of G defining split components G1, . . . , Gk (for some k ≥ 2), then Gi is an upward planar st-graph, for i = 1, . . . , k. The root of T is a P-node µ. Finally, sk(µ) consists of k + 1 parallel edges (s, t). -- Rigid case. If G is not a single edge, if G is biconnected, and if {s, t} is not a split pair of G, then let {s1, t1}, . . . ,{sk, tk} be the maximal split pairs of G (for some k ≥ 1). Further, let Gi be the union of all the split components of {si, ti}, for i = 1, . . . , k. Then Gi is an upward planar siti-graph, for i = 1, . . . , k. The root of T is an R-node µ. Finally, the graph sk(µ) is obtained from G by replacing each subgraph Gi with an edge (si, ti) and by adding the edge (s, t). We have that sk(µ) is a triconnected upward planar st-graph. In each of the last three cases, the subtrees of µ are the SPQR-trees of G1, . . . , Gk, rooted at the children µ1, . . . , µk of µ, respectively. Further, the virtual edge (s, t) in sk(µ) (just one of the edges (s, t) in the case of a P-node) is associated with the parent of µ in T , while every other virtual edge ei is associated with a child µi of µ and with the graph Gi. The graph Gi corresponds to a virtual edge ei of sk(µ) and it is called the pertinent graph of ei and of µi. The overall tree T of G is rooted at the only neighbor of the Q-node (s, t); the skeleton for the root of T is defined slightly differently from the other nodes, as it does not contain the virtual edge representing 4 RPRSSRPGTtsPstSSvvvvR its parent. It is known that T has O(n) nodes and that the total number of virtual edges in the skeletons of the nodes of T is in O(n). All the upward embeddings of G can be obtained by suitably permuting the virtual edges of the skeletons of the P-nodes and by flipping the skeletons of the R-nodes. For a specific choice of such permutations and flips, an upward embedding is recursively obtained by substituting the virtual edges in the skeleton of a node µ with the upward embeddings associated to the children of µ. Let v be a vertex of G. The allocation nodes of v are the nodes of T whose skeletons contain v. Note that v has at least one allocation node. The lowest common ancestor of the allocation nodes of vertex v is itself an allocation node of v and it is called the proper allocation node of v. Let µ be a node of T . The representative of v in sk(µ) is the vertex or edge x of sk(µ) defined as follows: If µ is an allocation node of v, then x = v; otherwise, x is the edge of sk(µ) whose pertinent graph contains v. From a computational complexity perspective, the SPQR-tree T of an n-vertex upward planar st-graph G can be constructed in O(n) time. Further, within the same time bound, it is possible to set up a data structure that allows us to query for the proper allocation node of a vertex of G in O(1) time and to query for the lowest common ancestor of two nodes of T in O(1) time [16]. 2.2 Simplifications In this section we prove that it is not a loss of generality to restrict our attention to instances of the UPE and UPE-FUE problems in which the partial graph contains no edges or no two vertices share the same y-coordinate in the partial drawing. We first deal with instances in which the partial graph contains no edges. Lemma 1. Let (cid:104)G, H, ΓH(cid:105) be an instance of the UPE or UPE-FUE problem and let n = (cid:104)G, H, ΓH(cid:105). There exists an equivalent instance (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105) of the UPE or UPE-FUE problem, respectively, such that: (i) E(H(cid:48)) = ∅, (ii) if V (H) = V (G), then V (H(cid:48)) = V (G(cid:48)), and (iii) if G is an st-graph, then G(cid:48) is an st-graph. Further, the instance (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105) has O(n) size and can be constructed in O(n log n) time. The drawing ΓH(cid:48) may contain vertices with the same y-coordinate even if ΓH does not. compute it efficiently. Proof. Throughout this proof we will assume that ΓH is a straight-line drawing of H. This is not a loss of generality, as if an edge (u, v) of H is represented in ΓH by a polygonal line (u, b1, . . . , bh, v), where b1, . . . , bh are the bends of the polygonal line, then dummy vertices can inserted on b1, . . . , bh in ΓH ; further, the edge (u, v) becomes a monotone path (u, b1, . . . , bh, v) both in H and in G. Note that the size of the instance remains asymptotically the same. We now define the instance (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105) and argue about its size. We will later describe how to The graph G(cid:48) is obtained from G by replacing certain edges of G that are also in H by monotone paths; how to precisely perform such a replacement will be described later. If G has a prescribed upward embedding, then G(cid:48) derives its upward embedding from the one of G. That is, if an edge (u, v) is replaced by a monotone path (u = u1, u2, . . . , uk−1, uk = v), then u2 substitutes v in S(u) and uk−1 substitutes u in P(v); further, for i = 2, . . . , k − 1, we have S(ui) = [ui+1] and P(ui) = [ui−1]. Property (iii) of the lemma's statement is trivially satisfied. The graph H(cid:48) is composed of all the vertices of H plus all the vertices internal to the monotone paths that are inserted in G(cid:48) to replace edges of G that are also in H. Property (ii) of the lemma's statement is then satisfied. Further, H(cid:48) contains no edge, hence Property (i) of the lemma's statement is satisfied. The drawing ΓH(cid:48) coincides with ΓH when restricted to the vertices also belonging to H. It remains to specify the lengths of the monotone paths that are inserted in G(cid:48) to replace edges of G that are also in H and to describe how to place their internal vertices in ΓH(cid:48). This is done in the following. in ΓH . We examine the interesting y-coordinates in increasing order y∗ m. For any y∗ the line with equation y = y∗ (cid:96)∗ i and the edges of H crossing (cid:96)∗ edge e of H crosses (cid:96)∗ Refer to Fig. 2. Among all the possible y-coordinates, we call interesting the ones of the vertices of H 1, . . . , y∗ i , denote by (cid:96)∗ i in which the vertices of H lying on i appear in ΓH . We place a vertex v in ΓH(cid:48) at the point pv in which an i . We look at the left-to-right order X∗ i i in two cases: 5 Fig. 2: The drawings ΓH (left) and ΓH(cid:48) (right) in the proximity of (cid:96)∗ are gray; those inserted on (cid:96)∗ i+1 are not shown. i−1 and (cid:96)∗ i . The vertices that are inserted on (cid:96)∗ i i+1. i−1 or y∗ (i) If e is preceded or followed by a vertex of H in X∗ i ; or (ii) if e has an end-vertex whose y-coordinate in ΓH is y∗ If we place a vertex v at the crossing point pv of e with (cid:96)∗ i , then v is also a vertex that is internal to the monotone path that is inserted in G(cid:48) to replace e. Clearly, the edges of the monotone paths are directed so to connect vertices in increasing order of their y-coordinates. This concludes the construction of (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105). We prove that the size of (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105) is linear in the size of (cid:104)G, H, ΓH(cid:105). The only vertices which belong to G(cid:48) and not to G are those internal to the monotone paths that are inserted in G(cid:48) to replace edges of G that are also in H. The number of vertices that are inserted in G(cid:48) because of case (i) is at most 2V (H); further, the number of vertices that are inserted in G(cid:48) because of case (ii) is at most 2E(H). Since the only edges that belong to G(cid:48) and not to G are those of the monotone paths above, it follows that the number of such edges is also in O(V (H) +E(H)). The claim about the size of (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105) follows. We next show how to construct the instance (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105) efficiently. First, we construct a list V in which the vertices of H are ordered by increasing y-coordinate and, Handling the vertices that need to be inserted in G(cid:48) because of case (ii) is easy. Indeed, it suffices to j be the y-coordinates of its end-vertices, for some i < j; then j−1. This can be done in O(n) Handling the vertices that need to be inserted in G(cid:48) because of case (i) is more difficult. The rest of For each interesting y-coordinate y∗ secondarily, by increasing x-coordinate in ΓH . This is done in O(n log n) time. look at every edge e of H. Let y∗ insert vertices at the crossing points of e with the lines y = y∗ overall time. i+1 and y = y∗ i and y∗ We examine the interesting y-coordinates in increasing order y∗ For i = 1, . . . , m, our algorithm computes the list X∗ the analysis of the running time deals with this. i , a trivial algorithm would: (1) compute the crossing points between (cid:96)∗ i and the edges of H crossing it; (2) order such crossing points together with the vertices of H lying on (cid:96)∗ i by increasing x-coordinate; and (3) insert the new vertices at the crossing points which are preceded or followed by vertices of H. However, this might require Ω(n2 log n) time in total, as Ω(n) edges might span the y-coordinates of Ω(n) vertices of H in ΓH . We now describe how to bring the time complexity down to O(n log n). i the restriction of V to the vertices on (cid:96)∗ i . 1 coincides with V∗ 1 . Further, for i = 1, . . . , m − 1, our algorithm also computes a list Ei,i+1 which contains the edges of H crossing the line y = (y∗ i has been computed, for some i ∈ {1, . . . , m − 1}. We compute Ei,i+1 as follows. We initialize Ei,i+1 to X∗ i , we replace v in Ei,i+1 by its outgoing edges in left-to-right order as they appear in ΓH . The vertex v is accessed in X∗ i and in Ei,i+1 in O(1) time via a pointer associated to v in V∗ i . Thus, Ei,i+1 can be constructed in time proportional to the number of edges exiting vertices in V∗ We initialize X∗ entering v. In case it does, such edges are removed from X∗ inserted in their place; otherwise, v is just inserted in a suitable position in X∗ which compares x(v) to the x-coordinates of the intersection points of the edges in X∗ precisely, when the binary search considers an edge e in X∗ point with (cid:96)∗ the intersection points of the edges in X∗ i+1, i+1. More i+1, the x-coordinate xi(e) of its intersection i+1 is computed in O(1) time and then compared to x(v); we stress the fact that not all i+1 are computed, but only the O(log n) ones that are Now assume that Ei,i+1 has been computed, for some i ∈ {1, . . . , m− 1}. We compute X∗ i+1 (indeed, they "end" on (cid:96)∗ i+1 as follows. i+1, we determine whether Ei,i+1 contains edges i+1), and v is i + y∗ i . Then, for each vertex v in V∗ The above approach is realized by performing, for each vertex v in V∗ i+1 to Ei,i+1. Then, for each vertex v in V∗ i defined above; note that X∗ 1, . . . , y∗ m; denote by V∗ i+1)/2 in ΓH , in left-to-right order. i+1. i , a binary search on X∗ i+1 with (cid:96)∗ Assume that X∗ i , hence in total O(n) time. i+1 with (cid:96)∗ 6 (cid:96)∗i(cid:96)∗i+1(cid:96)∗i−1(cid:96)∗i(cid:96)∗i+1(cid:96)∗i−1 i+1). Finding the proper place where to insert v in X∗ compared with x(v) in the binary search. The binary search stops in two possible situations. The first is the one in which an edge e is found that enters v; that is, e is such that xi(e) = x(v). That edge and all the other edges entering v are then removed from X∗ i+1 and v is inserted in place of such edges (and a pointer to it is set in V ∗ i+1). The second situation in which the binary search stops is the one in which the x-coordinates of two consecutive elements of X∗ i+1 have been compared to x(v), and x(v) has been found to be in between such coordinates. Then v is inserted between such elements (and a pointer to it is set in V ∗ i+1 takes O(log n) time, and hence O(n log n) time over all the vertices of H. Further, removing the edges entering v can be done in O(PH (v)) time because all such edges appear consecutively in Ei,i+1, and hence in X∗ i+1, by the planarity of ΓH ; hence this takes O(n) time in total. i+1 has been computed, we determine the placement in ΓH(cid:48) of the vertices in V (H(cid:48)) \ V (H) i+1; then we look at the i+1, and if any of them is an edge we insert a vertex at its intersection i+1 this takes O(1) time, hence O(n) time in total. that are inserted on (cid:96)∗ two elements adjacent to v in X∗ i+1. For each v ∈ V∗ point with (cid:96)∗ i+1. In order to do that, we again access each vertex v ∈ V∗ Once X∗ It remains to prove the equivalence between (cid:104)G, H, ΓH(cid:105) and (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105). One direction is easy. Indeed, assume that an upward planar drawing ΓG of G exists which extends ΓH . We modify ΓG by placing each vertex v ∈ V (H(cid:48)) \ V (H) at the point pv where v lies in ΓH(cid:48). Let e be the edge of G that is also in H and that is replaced by a monotone path which includes v as an internal vertex in G(cid:48). By construction pv lies on the curve representing e in ΓG; hence, the insertion of all the vertices in V (H(cid:48)) \ V (H) in ΓG results in an upward planar drawing ΓG(cid:48) of G(cid:48) extending ΓH(cid:48). The other direction is much more involved. Assume that an upward planar drawing ΓG(cid:48) of G(cid:48) extending ΓH(cid:48) exists. By construction, all the vertices of V (H) are also in V (H(cid:48)); further, these vertices are placed at the same points in ΓH and ΓH(cid:48). Let ΓG be the drawing of G obtained from ΓG(cid:48) by interpreting the representation of each monotone path of G(cid:48) corresponding to an edge e of G as a representation of e. Then we have that ΓG is an upward planar drawing of G such that the vertices in V (H) are placed as in ΓH . However, it might be the case that the edges of G that are also in H are not drawn in ΓG as they are required to be drawn in ΓH . We hence need to modify the drawing of such edges in ΓG. Our proof that such a modification is always feasible is a direct consequence of Claim 1 below. We introduce some definitions. Every edge of E(G) ∩ E(H) corresponds to a monotone path in G(cid:48); we call replacement edge each edge of such monotone paths. Note that the end-vertices of a replacement edge are in H(cid:48), while the replacement edge itself is not in H(cid:48). Recall that, for i = 1, . . . , m, the list X∗ i and the edges of H crossing (cid:96)∗ i is also a vertex i either determines a vertex of H(cid:48) lying on (cid:96)∗ of H(cid:48) lying on (cid:96)∗ i or corresponds to a replacement edge of G(cid:48) crossing (cid:96)∗ i between X∗ i i and the replacement edges of G(cid:48) crossing (cid:96)∗ and a set Z∗ i . i along (cid:96)∗ in any upward planar i are drawn in ΓH , some elements of Z∗ drawing of G extending ΓH is fixed, as all the elements of X∗ do not have any fixed intersection with (cid:96)∗ i corresponding to vertices of H(cid:48) lying on (cid:96)∗ i corresponding to replacement edges of G(cid:48) crossing (cid:96)∗ i with respect to the other elements of Z∗ i . The following claim proves that such a restriction actually exists. Claim 1 In any upward planar drawing ΓG(cid:48) of G(cid:48) extending ΓH(cid:48) the left-to-right order of the elements of Z∗ i] represents the left-to-right order in which the vertices of H lying on (cid:96)∗ i in ΓH . By construction, each vertex of H lying on (cid:96)∗ i] of the elements of X∗ i . Namely, the elements of Z∗ i appear along (cid:96)∗ i ; further, each edge of H crossing (cid:96)∗ i do not have any restriction on where they should cross (cid:96)∗ i which contains the vertices of H(cid:48) lying on (cid:96)∗ i ; however, in principle, the elements of Z∗ i do have a fixed intersection with (cid:96)∗ i . Hence, there is a bijection γ : X∗ While the left-to-right order [x1 i → Z∗ i is [γ(x1 i ), γ(x2 i ), . . . , γ(xt i along (cid:96)∗ i = [x1 i , x2 i , . . . , xt i , x2 i , . . . , xt i)]. i i Proof. We prove the claim by induction on i. The base case, in which i = 1, is trivial, since all the elements of Z∗ 1 are vertices of H(cid:48), whose left-to-right order along (cid:96)∗ 1 is determined by ΓH(cid:48). Now suppose that the claim holds for Z∗ We first argue about the elements γ(xj i , for some 1 ≤ i ≤ m − 1; we prove the claim for Z∗ i+1) ∈ Z∗ i+1 that are associated with a y-monotone curve λj i+1. i and (cid:96)∗ that extends between (cid:96)∗ one of the following two cases: i+1 in ΓG(cid:48). More precisely, an element γ(xj i+1) of Z∗ i+1 i+1 is of interest here in (1) γ(xj (2) γ(xj i+1) is a replacement edge e of G(cid:48) crossing (cid:96)∗ i+1) is a vertex of H(cid:48) lying on (cid:96)∗ i+1. i that is incident to a replacement edge e which is incoming at γ(xj i+1). 7 Note that, in both cases, the edge e either crosses (cid:96)∗ i+1 as the part of the replacement edge e between (cid:96)∗ i+1). Hence, M∗ i+1 contains all the elements of Z∗ i or has its source on (cid:96)∗ i+1. Let M∗ i and (cid:96)∗ i . Then, in both cases, we i+1 ⊆ Z∗ i+1 be the set of i+1, except for the vertices of H(cid:48) lying define λj such elements γ(xj on (cid:96)∗ i+1 in ΓH(cid:48) corresponding to sources of H. Consider any element γ(xj i+1) ∈ M∗ i+1 is part of. If e crosses (cid:96)∗ edge e the curve λj Otherwise, e has its source on (cid:96)∗ correspond to elements xj a point of (cid:96)∗ which might cross (cid:96)∗ end-vertex on (cid:96)∗ i+1 and a point of (cid:96)∗ i+1 and/or (cid:96)∗ i+1 and/or (cid:96)∗ i i+1 and xl i in ΓH (then xj i in ΓH (then xj i ; we denote such a source also by γ(xl i+1, its associated y-monotone curve λj i in ΓG(cid:48), then e is represented by an element γ(xl i+1, and the replacement i) in Z∗ i . i+1) and γ(xl i) i+1 between i+1; this curve represents part of an edge of H i represent such an edge), or might have an i , respectively. A y-monotone curve δj i). The elements γ(xj i+1 and/or xl i+1 and X∗ i of X∗ is associated with xj Now consider any two distinct elements γ(xj i) and γ(xh i , respectively, via the curves λj i+1 in ΓG(cid:48). We establish that xj γ(xl left of γ(xk i+1 and/or xl i+1), γ(xk i represent the end-vertices of such an edge). i+1) ∈ M∗ i+1. These are associated to elements i+1) is to the i+1. Assume w.l.o.g. that γ(xj i+1 and λk i+1 precedes xk i+1 in X∗ i+1. i ) of Z∗ i+1) along (cid:96)∗ i) (cid:54)= γ(xh i+1 -- If γ(xl i) = γ(xh i in X∗ i . Hence xj i ), then γ(xl i ), then λj i) = γ(xh i+1 and λk i+1 precedes xk i ), as otherwise the y-monotone curves λj i is to the left of xh i+1 and δk i) is to the left of γ(xh would cross, while ΓG(cid:48) is planar. By induction, xl in X∗ i+1, as otherwise the y-monotone curves δj planar. -- If γ(xl i+1 and λk i ). Since γ defines a bijection between X∗ i+1 i+1 would cross, while ΓG(cid:48) is assumed to be i+1 represent parts of replacement edges of G(cid:48) whose sources i , hence i . By construction, a vertex is inserted in ΓH(cid:48) i+1, and a vertex is inserted in ΓH(cid:48) at the crossing point i+1 (these vertices are inserted in case (ii) of the construction of (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105)). i+1 are in this left-to-right coincide with γ(xl xj i+1 and xk at the crossing point between xj between xk Such vertices are in fact γ(xj order along (cid:96)∗ It follows that, in any upward planar drawing ΓG(cid:48) of G(cid:48) extending ΓH(cid:48), the left-to-right order in which i+1)] restricted i+1 are edges of H both incident to xl i+1 and (cid:96)∗ i+1 coincides with the order [γ(x1 i+1). Hence, the edges xj i+1 appear along (cid:96)∗ i+1 precedes xk i+1 and (cid:96)∗ i+1) and γ(xk i+1), . . . , γ(xr i+1 in X∗ i , we have xl i+1, thus xj i and Z∗ i+1 and xk i+1), γ(x2 i = xh i = xh i+1. the elements of M∗ to the elements of M∗ i+1. i+1, xj+1 i+1, xj+1 i+1 , . . . , xl i+1), γ(xj+1 i+1), γ(xj+1 i+1 ), . . . , γ(xl i+1 ), . . . , γ(xl i+1 ), . . . , γ(xl i+1 and xl+1 i+1 along (cid:96)∗ i+1. If xj−1 i+1 ) and γ(xl+1 i+1) along (cid:96)∗ i+1 of consecutive elements of X∗ i+1) belong to M∗ i+1 , . . . , xl i+1) along (cid:96)∗ Now consider any maximal sequence xj i+1, we have that γ(xj−1 i+1. Hence, we only have to ensure that γ(xj i+1 is a vertex of H, then γ(xj−1 i+1, xj+1 i+1 ) immediately preceding γ(xl+1 i+1) in left-to-right order along (cid:96)∗ i+1; however, since xj are sources of H. Since γ(xj γ(xj fit between the suitable elements of M∗ in which xj maximality of the sequence xj γ(xj−1 H(cid:48), hence γ(xj−1 i+1 ) precedes γ(xj xj−1 i+1 is an edge of H crossing (cid:96)∗ ΓH(cid:48) at the crossing point between xj−1 of (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105)). In fact γ(xj−1 along (cid:96)∗ left-to-right order along (cid:96)∗ i+1 , . . . , xl i+1 that i+1) are vertices of H(cid:48), they appear in the order i+1), γ(xj+1 i+1) i+1. Assume that xj−1 i+1 both exist (the case i+1 is an initial and/or final subsequence of X∗ i+1 is easier to handle). By the i+1, with i+1 ) is a vertex of i+1 in ΓH(cid:48) and hence in ΓG(cid:48). Otherwise, i+1 is a vertex of H, a vertex has been inserted in i+1 (this vertex is inserted in case (i) of the construction i+1) in left-to-right order i+1) precedes γ(xl+1 i+1) in (cid:117)(cid:116) Claim 1 implies that the desired modification of ΓG, which ensures that the edges of H are drawn as i+1. Then i , which consists of a set of y-monotone curves i+1, and independently draw the part of ΓG inside each region of (cid:117)(cid:116) This concludes the proof of the lemma. We next deal with instances of the UPE and UPE-FUE problems in which no two vertices have the in ΓH , can be performed "locally" to each strip S∗ one can start from the intersection between ΓH and S∗ connecting points on (cid:96)∗ i with points on (cid:96)∗ S∗ i defined by such y-monotone curves. i+1 ) precedes γ(xj i+1 in ΓH(cid:48) and hence in ΓG(cid:48). An analogous argument proves that γ(xl i delimited by two consecutive lines (cid:96)∗ i+1 ) is such a vertex. Then γ(xj−1 i+1 in ΓH(cid:48) and hence in ΓG(cid:48). The claim follows. i+1 and (cid:96)∗ i and (cid:96)∗ same y-coordinate in the given partial drawing. 8 Lemma 2. Let (cid:104)G, H, ΓH(cid:105) be an instance of the UPE or UPE-FUE problem and let n = (cid:104)G, H, ΓH(cid:105). There exists an equivalent instance (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105) of the UPE or UPE-FUE problem, respectively, such that: (i) no two vertices of H(cid:48) share the same y-coordinate in ΓH(cid:48) and (ii) if V (H) = V (G), then V (H(cid:48)) = V (G(cid:48)). Further, the instance (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105) has O(n) size and can be constructed in O(n log n) time. The graph H(cid:48) may contain edges even if H does not. Proof. First, we apply Lemma 1 in order to transform (cid:104)G, H, ΓH(cid:105) into an equivalent instance (cid:104)G∗, H∗, ΓH∗(cid:105) such that H∗ contains no edges and such that V (H∗) = V (G∗) if V (H) = V (G). The instance (cid:104)G∗, H∗, ΓH∗(cid:105) has O(n) size and can be constructed in O(n log n) time. Hence, it suffices to prove the statement of the lemma with (cid:104)G∗, H∗, ΓH∗(cid:105) in place of (cid:104)G, H, ΓH(cid:105). We define the desired instance (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105) as follows. Refer to Fig. 3. We initialize (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105) = (cid:104)G∗, H∗, ΓH∗(cid:105). We construct a list V of the vertices of H∗ ordered by increasing y-coordinates and, secondarily, by increasing x-coordinates in ΓH∗ . This is done in O(n log n) time. Among all the possible y-coordinates, we call interesting the ones of the vertices of H∗ in ΓH∗ . We examine the interesting i the line with equation y = y∗ y-coordinates in increasing order y∗ i ; further, denote by V∗ i the restriction of V to the vertices on (cid:96)∗ i . i , denote by (cid:96)∗ m. For any y∗ 1, . . . , y∗ (a) (b) Fig. 3: Illustration for the construction of (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105). The portions of ΓH∗ (a) and of ΓH(cid:48) (b) in the proximity of the strip S∗ is colored light yellow. The white disks represent vertices of H∗ and H(cid:48), while the black disks represent vertices in V (G∗) \ V (H∗) and V (G(cid:48)) \ V (H(cid:48)). i are shown; S∗ i 1 , . . . ,S∗ We replace vj i by increasing x-coordinate; let v1 i delimiting S∗ i and b∗ i lies below b∗ m such that: (i) for i = 1, . . . , m, the line (cid:96)∗ i , we draw a vertical straight-line segment sj i whose midpoint is vj i ). Note that sj i and crosses (cid:96)∗ i . i lies entirely in S∗ m be sufficiently thin. i by an edge. This is done as follows. Let h∗ We consider horizontal strips S∗ of S∗ i , at equal distance from the horizontal lines t∗ respectively; and (ii) for i = 1, . . . , m − 1, the line t∗ achieved by letting the strips S∗ 1 , . . . ,S∗ We now replace each vertex in V∗ i are ordered in V∗ Recall that the vertices lying on (cid:96)∗ an ordering. For j = 1, . . . ,V ∗ i /(3 · V ∗ whose length is j · h∗ i by two vertices vj,1 i in G(cid:48) now exit vj,2 i is in the interior i from above and from below, i+1. Observe that condition (ii) can be i be the height of S∗ i . be such i and i ), both in G(cid:48) and in H(cid:48). The , vj,2 . If G∗ has a i in G(cid:48) now enter vj,1 outgoing edges of vj i prescribed upward embedding, then the list of successors of the adjacent predecessors of vj i and the list of predecessors of the adjacent successors of vj , respectively. Further, P(vj,1 i ), while P(vj,2 i ) = [vj,1 i ) is represented in ΓH(cid:48) by the segment sj Vertices of H(cid:48) lying in different strips S∗ k do not share their y-coordinates in ΓH(cid:48), as such strips are horizontal and disjoint. By construction vertices of H(cid:48) lying in the same strip S∗ i do not share their y-coordinates in ΓH(cid:48). Thus, Property (i) is satisfied. If V (H∗) = V (G∗), then V (H(cid:48)) = V (G(cid:48)), as every vertex in H∗ is replaced by two vertices belonging to H(cid:48). Hence Property (ii) is also satisfied. i are updated by replacing vj ], and S(vj,2 i . This concludes the construction of (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105). and by an edge (vj,1 and the incoming edges of vj i ) coincides with P(vj ]. The vertex vj i is also removed from ΓH(cid:48). Finally, the edge (vj,1 i ), while S(vj,1 i with vj,1 i ) coincides with S(vj and vj,2 i i i and S∗ i , . . . , v V ∗ i i i ) = [vj,2 i and vj,2 i i i i i , vj,2 i 9 t∗ib∗ivji(cid:96)∗it∗ib∗ivj,1ivj,2i(cid:96)∗i The size of (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105) is linear in the size of (cid:104)G∗, H∗, ΓH∗(cid:105) as at most two vertices and one edge are introduced in G(cid:48) for each vertex of G∗. Constructing the order V∗ takes O(n log n) time. Every other step of the algorithm can be performed in O(n) time, hence the total O(n log n) running time. We prove the equivalence between the instances (cid:104)G∗, H∗, ΓH∗(cid:105) and (cid:104)G(cid:48), H(cid:48), ΓH(cid:48)(cid:105). Suppose that an upward planar drawing ΓG(cid:48) of G(cid:48) exists that extends ΓH(cid:48). For each vertex vj i of G∗ that has been replaced in G(cid:48) by two vertices vj,1 i ), we perform the following modification; see Fig. 4a. By construction and since ΓG(cid:48) extends ΓH(cid:48), the straight-line segment (vj,1 i is placed in ΓH∗ . Then a sufficiently small value ε > 0 can be defined so that the region Bj i obtained as the Minkowski sum of a ball with radius ε with the straight-line segment sj . For each vertex vj i , as in Fig. 4b, and we draw line segments connecting vj i with the endpoints of the removed line segments on the boundary of Bj i , as in Fig. 4c. This results in the desired drawing of G∗ extending ΓH∗ . i intersects ΓG(cid:48) only in a set of line segments incident to vj,1 i of H∗ we delete from ΓG(cid:48) the interior of Bj i ) in ΓG(cid:48) contains the point at which vj and by an edge (vj,1 and vj,2 , vj,2 and vj,2 i , vj,2 i i i i i (a) (b) (c) Fig. 4: Construction of ΓG∗ from ΓG(cid:48). Modifications in the proximity of an edge (vj,1 i , vj,2 i ) of G(cid:48). Conversely, suppose that an upward planar drawing ΓG∗ of G∗ exists that extends ΓH∗ . For each i = 1, . . . , m, we modify ΓG∗ as follows. First, we vertically perturb the position of each vertex that lies i and that does not belong to H∗. If the perturbation is small enough, then the curves representing on (cid:96)∗ (a) (c) (b) (d) Fig. 5: Construction of ΓG(cid:48) from ΓG∗ . Modifications in the proximity of a strip S∗ i , which is colored light yellow. (a) The drawing ΓG∗ after the perturbation which moves vertices not in H∗ away from (cid:96)∗ i . (b) Scaling down and translating the parts of ΓG∗ between (cid:96)∗ i . (c) Drawing the segments h and vj,2 . i . (d) Reconnecting the edges formerly incident to vj i,i+1 and between (cid:96)∗ i to the vertices vj,1 i−1,i and (cid:96)∗ i and (cid:96)∗ i i 10 vj,1ivj,2i(cid:96)∗i(cid:96)∗ivji(cid:96)∗ivjit∗ib∗i(cid:96)∗i(cid:96)∗i,i+1(cid:96)∗i−1,ip1ip6ip7ip2it∗ib∗i(cid:96)∗i(cid:96)∗i,i+1(cid:96)∗i−1,ip2it2ib2ib6ip6it6it∗ib∗i(cid:96)∗i(cid:96)∗i,i+1(cid:96)∗i−1,it∗ib∗i(cid:96)∗i(cid:96)∗i,i+1(cid:96)∗i−1,i i i and below b∗ i , . . . , pk(i) i of ΓG∗ on (cid:96)∗ i . Let (cid:96)∗ i and (cid:96)∗ i . We perform an analogous modification to the part of ΓG∗ comprised between (cid:96)∗ i−1,i above t∗ i−1 and below b∗ the points on b∗ i ; denote by b1 i , . . . , bk(i) i,i+1; after doing so, the points p1 i , . . . , pk(i) i,i+1 be a horizontal line above t∗ the edges incident to that vertex can also be suitably modified so that ΓG∗ remains an upward planar drawing of G∗. Refer to Fig. 5a and denote by p1 the left-to-right order of the points of ΓG∗ i ; note that each of such points might correspond to a vertex of H∗ or to a crossing point of an along (cid:96)∗ edge of G∗ with (cid:96)∗ i+1. As in Fig. 5b, we vertically scale down the part of ΓG∗ between (cid:96)∗ i,i+1 so that its vertical extension becomes equal to the distance between t∗ i,i+1. Further, we translate the scaled part of the drawing so that it lies between i and (cid:96)∗ t∗ i , . . . , tk(i) on t∗ i and a horizontal line (cid:96)∗ i , . . . , pk(i) , respectively. Now S∗ i , . . . , pk(i) . For every h = 1, . . . , k(i), we draw a vertical straight-line segment h i , as in Fig. 5c; note that h i in ΓG∗ , then h i reconnects that edge; indeed, the latter became disconnected after scaling and translating parts of ΓG∗ . Otherwise, ph i is a part of i h i ; see Fig. 5d. We remove a small disk around th i down along h i until they reach vj,2 i from ΓG∗ and extend the edges i up along h incoming vj . This completes the construction of the desired drawing ΓG(cid:48) (cid:117)(cid:116) of G(cid:48) extending ΓH(cid:48). i corresponding to p1 i does not contain any part of ΓG∗ in its interior, except for the points p1 i used to be a crossing point between an edge of G∗ and (cid:96)∗ . Analogously, we remove a small disk around bh i until they reach vj,1 i was placed in ΓG∗ and ΓH∗ . Then sj i from ΓG∗ and extend the edges outgoing vj i acquire corresponding points t1 is the point in which a vertex vj i passes through ph i . If ph i connecting th i with bh i i i and (cid:96)∗ i i i i 3 Complexity of the UPE and UPE-FUE Problems In this section we study the complexity of the UPE and UPE-FUE problems. We show the NP-hardness of such problems even for instances (cid:104)G, H, ΓH(cid:105) in which H contains no edges and V (H) = V (G), and for instances (cid:104)G, H, ΓH(cid:105) in which no two vertices share the same y-coordinate in ΓH and V (H) = V (G). We will then show that the instances (cid:104)G, H, ΓH(cid:105) in which H contains no edges, no two vertices share the same y-coordinate in ΓH , and V (H) = V (G) can be solved in polynomial time. We start with the following. Lemma 3. The UPE and UPE-FUE problems are in NP. Proof. Let (cid:104)G, H, ΓH(cid:105) be an instance of the UPE problem. Ideally, we would like to guess a solution for (cid:104)G, H, ΓH(cid:105), that is, a drawing ΓG of G, and then to verify in polynomial time whether the guess actually is a solution, that is, whether ΓG is an upward planar drawing of G extending ΓH . However, since there is an infinite number of drawings of G, we cannot explicitly guess one of them. Hence, we proceed by associating to each drawing a combinatorial structure, in such a way that: (1) the set of distinct combinatorial structures the drawings of G are associated to is finite; and (2) it is possible to test in polynomial time whether an upward planar drawing of G extending ΓH exists by assuming that such a drawing is associated with a fixed combinatorial structure. This is done in the following. First, we guess the order by increasing y-coordinates of the vertices of G in an upward planar drawing ΓG of G extending ΓH . This can be done by assigning a number in {1, 2, . . . , n} to each vertex of G. The assignment is, in general, not injective, i.e., the guess might result in several vertices having the same y-coordinate. Let Y be the guessed order of the vertices of G. Denote by V1, . . . , Vk the subsets of V (G) such that: (i) for any u, v ∈ Vi, the y-coordinates of u and v are the same in Y ; and (ii) for any u ∈ Vi and v ∈ Vi+1, the y-coordinate of u precedes the one of v in Y . Note that there are only finitely many such orders Y . Having guessed Y , we now know whether the horizontal line hi through the vertices in Vi crosses an edge (u, v) in ΓG. Indeed, this happens if and only if u ∈ Vj and v ∈ Vl, with j < i and l > i, or with j > i and l < i. For each i = 1, . . . , k, we independently guess a left-to order σi of the vertices in Vi together with the edges crossing hi in ΓG. Again, there are only finitely many such orders. We now show how to verify in polynomial time whether an upward planar drawing ΓG of G exists that extends ΓH and that respects Y and σ1, . . . , σk. We perform the checks described below. If any check fails, then we conclude that there is no upward planar drawing of G that extends ΓH and that respects Y and σ1, . . . , σk, otherwise we proceed to the next check. If all the checks succeed, then an upward planar drawing ΓG of G exists that extends ΓH and that respects Y and σ1, . . . , σk. 11 y(u) < y(v) in ΓH . 1. For any edge (u, v) of G such that u ∈ Vi and v ∈ Vj, we check whether i < j. 2. We say that an edge (u, v) of G, with u ∈ Vj and v ∈ Vl, spans Vi and Vi+1 if j ≤ i and l ≥ i + 1. For any two edges e and e(cid:48) that span Vi and Vi+1, we check whether the order of e and e(cid:48) (or of their end-vertices) in σi and σi+1 is the same. 3. For any two vertices u, v ∈ V (H) such that u ∈ Vi and v ∈ Vj with i < j, we check whether 4. For any two vertices u, v ∈ V (H) ∩ Vi, we check whether y(u) = y(v) in ΓH . 5. For any two vertices u, v ∈ V (H) ∩ Vi such that y(u) = y(v) in ΓH and such that u precedes v in σi, 6. For any vertex u ∈ V (H)∩ Vi and for any edge e ∈ E(H) in σi, we check whether e precedes u in σi if and and only if the crossing point between e and the horizontal line through u is to the left of u in ΓH . 7. For any vertex u in V (H) ∩ Vi and any two edges e, e(cid:48) ∈ E(H) in σi, we check whether e precedes e(cid:48) in σi if and only if the crossing point of e with the horizontal line through u is to the left of the crossing point of e(cid:48) with the horizontal line through u in ΓH . we check whether x(u) < x(v) in ΓH . If check 1. fails that any drawing of G that respects Y is not upward. If check 2. fails that any upward drawing of G that respects Y , σi, and σi+1 is not planar. If checks 3. or 4. fail, then any upward drawing of G that respects Y does not extend ΓH . If checks 5., 6., or 7. fail, then any drawing of G that respects Y and σi does not extend ΓH . On the other hand, if all the checks succeed, then we can construct an upward planar drawing ΓG of G that extends ΓH and that respects Y and σ1, . . . , σk as follows. First, for i = 1, . . . , k, we draw a horizontal line hi with equation y = yi on which the vertices in Vi are going to be placed, where y1 < y2 < ··· < yk. This is done so that hi passes through a vertex u if u ∈ V (H) ∩ Vi, which is possible since checks 3. and 4. succeed. For i = 1, . . . , k, we place the vertices in Vi that are not in V (H) along hi and we fix the crossing points between hi and the edges of G that are in σi but not in H, so that the left-to-right order of the vertices of Vi (including those in V (H)) and of the edges of G (including those in E(H)) along hi is σi. This is possible because checks 5., 6., and 7. succeed. Each edge (u, v) in E(G) \ E(H) is now drawn as a sequence of line segments, each connecting points on two consecutive lines hi and hi+1. Since check 2. succeeds, every such a line segment can be drawn in the horizontal strip delimited by hi and hi+1 without introducing any crossings, thus the resulting drawing ΓG of G is planar. Since check 1. succeeds, it follows that ΓG is also upward. The drawing ΓH has not been modified during the construction of ΓG, hence ΓG extends ΓH . By construction, for each i = 1, . . . , k − 1, the vertices in Vi have a smaller y-coordinate than the vertices in Vi+1, hence ΓG respects Y . Finally, by construction, for each i = 1, . . . , k, the left-to-right order of the vertices in Vi and of the edges of G crossing hi is σi, hence ΓG respects σ1, . . . , σk. Since all the above checks can be easily performed in polynomial time, we have that UPE is in NP. The membership in NP of the UPE-FUE problem can be proved analogously. In particular, a check has to be introduced in the above algorithm in order to verify whether the orders Y and σ1, . . . , σk define an (cid:117)(cid:116) upward embedding which is the one prescribed in the instance. We now prove the NP-hardness results. The NP-hardness of the UPE problem directly follows from the one of the Upward Planarity Testing problem [19], which coincides with the special case of the UPE problem in which the partial graph is the empty graph. However, we can establish the NP-hardness of the UPE problem even in a much more constrained scenario. In order to do that, we relate the complexity of the UPE problem to the one of a problem called Ordered Level Planarity [26] (OLP, for short), which is defined as follows. A level graph is a pair (G, (cid:96)), where G is a directed graph and (cid:96) : V (G) → {1, . . . , k} is a function that assigns each vertex to one of k levels in such a way that (cid:96)(u) < (cid:96)(v), for each (u, v) ∈ E(G). We denote Vi = {v ∈ V (G) : (cid:96)(v) = i}. A level graph is proper if (cid:96)(v) − (cid:96)(u) = 1, for each (u, v) ∈ E(G). A level drawing of (G, (cid:96)) is a drawing of G that maps each vertex to a point on the horizontal line with equation y = (cid:96)(v) and each edge (u, v) to a y-monotone curve connecting the points corresponding to u and v. A level drawing is level planar if it is crossing-free and a level graph is level planar if it admits a level planar drawing. An ordered level graph is a triple (G, (cid:96), ξ) where (G, (cid:96)) is a level graph and ξ is a set of total orders ξi : Vi → {1, . . . ,Vi} of the vertices in Vi. Given an ordered level graph (G, (cid:96), ξ), the OLP problem asks whether there exists an ordered level planar drawing of (G, (cid:96), ξ), that is, a level planar drawing of (G, (cid:96)) 12 in which, for every v ∈ Vi, the x-coordinate of v is ξi(v). As observed by Klemz and Rote [26], for an ordered level graph (G, (cid:96), ξ), the y- and x-coordinates assigned via (cid:96) and ξ, respectively, only serve the purpose of encoding a partial order among vertices of different levels and a total order among vertices of the same level, respectively. In particular, the OLP problem does not change its complexity if ξ and (cid:96) map to the reals. We exploit this fact in the proof of the following lemma. Lemma 4. The following statements hold true: (i) Let (G, (cid:96), ξ) be an instance of the OLP problem, where G is an n-vertex graph. It is possible to construct in O(n) time an equivalent instance (cid:104)G, H, ΓH(cid:105) of the UPE problem with H = (V (G),∅) such that if (G, (cid:96), ξ) contains at most λ vertices belonging to the same level, then ΓH contains at most λ vertices sharing the same y-coordinate. (ii) Let (cid:104)G, H, ΓH(cid:105) be an instance of the UPE problem, where G is an n-vertex graph and H = (V (G),∅). It is possible to construct in O(n log n) time an equivalent instance (G, (cid:96), ξ) of the OLP problem such that if ΓH contains at most λ vertices sharing the same y-coordinate, then (G, (cid:96), ξ) contains at most λ vertices belonging to the same level. Proof. (i) Given an ordered level graph (G, (cid:96), ξ) with k levels, where G is an n-vertex graph, we construct an instance (cid:104)G, H, ΓH(cid:105) of the UPE problem as follows. First, G coincides in the two instances. Second, we define H = (V (G),∅), as required. Third, for every i ∈ {1, . . . , k} and for every v ∈ Vi, we define the position of v in ΓH as (x(v), y(v)) = (ξi(v), (cid:96)(v)). This completes the construction of (cid:104)G, H, ΓH(cid:105); this construction can be clearly performed in O(n) time. By construction, if (G, (cid:96), ξ) contains at most λ vertices belonging to the same level, then ΓH contains at most λ vertices sharing the same y-coordinate. We claim that the instance (G, (cid:96), ξ) of the OLP problem and the instance (cid:104)G, H, ΓH(cid:105) of the UPE problem are equivalent. Specifically, we have that any ordered level planar drawing Γo of (G, (cid:96), ξ) is also an upward planar drawing of G that extends ΓH and that any upward planar drawing ΓG of G that extends ΓH is also an ordered level planar drawing of (G, (cid:96), ξ). In fact, it holds that (i) each vertex of G has the same coordinates both in Γo and in ΓG, and that (ii) the edges of G are drawn as y-monotone curves both in Γo and in ΓG. (ii) Given an instance (cid:104)G, H, ΓH(cid:105) of the UPE problem, where G is an n-vertex graph and H = (V (G),∅), we construct an ordered level graph (G, (cid:96), ξ) as follows. First, the graph G coincides in the two instances. Second, we define a partition V1, V2, . . . , Vk of V (G) such that, for each i = 1, . . . , k, all the vertices in Vi have the same y-coordinate in ΓH , and such that, for each i = 1, . . . , k − 1, the vertices in Vi have a y-coordinate smaller than the one of the vertices in Vi+1 in ΓH . This partition can be constructed in O(n) time after the vertices of G have been ordered by their y-coordinates in ΓH , which takes O(n log n) time. For each vertex v of G, we now assign (cid:96)(v) = i if and only v ∈ Vi. Finally, for each i = 1, . . . , k, we compute the order ξi of the vertices in Vi by increasing x-coordinates. Such an order can be constructed in O(Vi log Vi) time, hence in O(n log n) time over all sets V1, V2, . . . , Vk. We claim that the instance (cid:104)G, H, ΓH(cid:105) of the UPE problem and the instance (G, (cid:96), ξ) of the OLP problem are equivalent. Suppose that an upward planar drawing ΓG of G exists that extends ΓH . For each i = 1, . . . , k, we draw a horizontal line hi through the vertices in Vi in ΓG; let X∗ ) be the left-to-right order in which the vertices in Vi and the edges of G crossing hi appear along hi in ΓG. We construct a level planar drawing ΓL of (G, (cid:96), ξ) by placing, for each i = 1, . . . , k, a sequence Pi = (pi ) of ri points along the line y = i, such that: -- for each j = 1, . . . , ri − 1, the x-coordinate of pi -- for each j = 1, . . . , ri, if xi j corresponds to a vertex v of G, then the x-coordinate of pi j is smaller than the one of pi j is equal to ξi(v). 2, . . . , xi ri 2, . . . , pi ri i = (xi 1, xi 1, pi j+1; and The level planar drawing ΓL of (G, (cid:96), ξ) is completed by representing each edge e = (u, v) of G as a f (i,u) of f (i+1,e) of sequence of straight-line segments. Specifically, if u ∈ Vi and v ∈ Vl, then e starts at the point pi f (i,u) corresponds to u, then proceeds with a straight-line segment to the point pi+1 Pi such that xi Pi+1 such that xi+1 of Pi+2 such that xi+2 xl f (l,v) corresponds to v. of (G, (cid:96), ξ) is analogous. In particular, X∗ The proof that an upward planar drawing ΓG of G can be constructed from a level planar drawing ΓL i now represents the left-to-right order in which the vertices of f (i+1,e) corresponds to e, then proceeds with a straight-line segment to the point pi+2 f (i+2,e) corresponds to e, and so on until reaching the point pl f (i+2,e) f (l,v) of Pl such that 13 Vi and the edges of G crossing the line y = i appear along such a line. This order is used so to define a sequence of points along the horizontal line through the vertices of Vi in ΓH . Such points are used to (cid:117)(cid:116) represent each edge as a sequence of straight-line segments. The first NP-hardness result is a direct consequence of reduction (i) from Lemma 4 and of the NP-completeness of Ordered Level Planarity [26]. Theorem 1. The UPE problem is NP-complete even if (i) the partial graph contains all the vertices and no edges and (ii) no three vertices share the same y-coordinate in the partial drawing. Proof. The membership of UPE in NP follows from Lemma 3. Klemz and Rote proved the NP-hardness of the OLP problem even for ordered level graphs (G, (cid:96), ξ) such that G consists of a set of disjoint paths and (cid:96) assigns at most 2 vertices to any level [26]. Thus, by applying reduction (i) of Lemma 4 to an instance (G, (cid:96), ξ) of the OLP problem with the above properties, we obtain in linear time an equivalent instance (cid:104)G, H, ΓH(cid:105) of the UPE problem such that H = (V (G),∅) and such that no three vertices share (cid:117)(cid:116) the same y-coordinate in ΓH . This completes the proof. Lemma 2, together with Theorem 1, implies the following. Corollary 1. The UPE problem is NP-complete even if (i) the partial graph contains all the vertices and (ii) no two vertices share the same y-coordinate in the partial drawing. We now discuss the complexity of the UPE-FUE problem, in which the input graph comes with a prescribed upward embedding which the required drawing has to respect. We establish the NP-hardness of the UPE-FUE problem via a reduction from the Partial Level Planarity (for short, PLP) problem, recently introduced by Bruckner and Rutter [9]. This reduction is quite involved and requires a new analysis of some results in [9]. Given a 4-tuple (G, (cid:96), H, ΓH ) where (G, (cid:96)) is a level planar graph, H is a subgraph of G, and ΓH is a level planar drawing of (H, (cid:96)), the PLP problem asks whether a level planar drawing ΓG of (G, (cid:96)) exists that coincides with ΓH when restricted to the vertices and edges of H. The instance (G, (cid:96), H, ΓH ) is proper if (G, (cid:96)) is a proper level graph. A proper instance (G = (V, E), (cid:96), H, ΓH ) of the PLP problem can also be represented as a triple (G, (cid:96),≺), where ≺= {≺1, . . . ,≺k} is a set of total orders ≺i of Vi ∩ V (H) such that, for any two vertices u, v ∈ Vi ∩ V (H), we have that u ≺i v if and only if u precedes v along the horizontal line (cid:96)i with equation y = i. Then, (G, (cid:96)) admits a level planar drawing that extends ΓH if and only if (G, (cid:96),≺) admits a level planar drawing in which the order of the vertices in Vi along (cid:96)i is a linear extension of ≺i, for i = 1, . . . , k. Bruckner and Rutter [9] proved that the PLP problem is NP-complete even for instances that are proper and connected. Since the reduction they present does not exploit changes of the planar embedding in the produced instances, this allows them to further augment such instances to subdivisions of triconnected graphs, which have a unique planar embedding (up to a flip). Therefore, the PLP problem is NP-complete even for proper instances in which the planar embedding of the level graph is prescribed. Fig. 6: A socket gadget (thick black edges) and a plug gadget (thin blue edges). We claim that the hardness result of Bruckner and Rutter holds even when the upward embedding of the level graph is prescribed. The basic building blocks of their reduction are two gadgets: The 14 vtpspz1z2uz3P(cid:96)Prl(cid:48)l(cid:48)(cid:48)t(cid:96)srr(cid:48)r(cid:48)(cid:48) plug and the socket gadgets, which are illustrated in Fig. 6. The plug gadget is simply a directed path P = (u, . . . , z1, tp, z2, sp, z3 . . . , v) consisting of three monotone paths (u, . . . , z1, tp), (tp, z2, sp), and (sp, z3, . . . , v) that traverse several levels of the level graph. The vertices of the plugs are not subject to any ordering constraints, that is, there exists no ordering ≺i in ≺ such that a ≺i b or b ≺i a and a, b ∈ V (P ). The socket gadget consists of a left-boundary path P(cid:96) = (l(cid:48), . . . , t(cid:96), . . . , l(cid:48)(cid:48)) consisting of two monotone paths (l(cid:48), . . . , t(cid:96)) and (l(cid:48)(cid:48), . . . , t(cid:96)), and of a right-boundary path Pr = (r(cid:48), . . . , sr, . . . , r(cid:48)(cid:48)), consisting of two monotone paths (sr, . . . , r(cid:48)) and (sr, . . . , r(cid:48)(cid:48)), all traversing several levels of the level graph. The vertices in V (P(cid:96)) ∪ V (Pr) are totally ordered by the functions ≺i, for each level i traversed by such paths; in particular, the left-to-right order of the predecessors of t(cid:96) and the left-to-right order of the successors of sr is prescribed. The crucial property exploited throughout the constructions presented in [9] is that at most one plug can be placed between the left- and the right-boundary paths of a socket, in every level-planar drawing Γ of the input level graph that realizes the prescribed orders of the vertices on each level. Our Claim 2 below then follows by observing that in Γ the edges (z1, tp) and (z2, tp) appear in this left-to-right order and similarly for the edges (sp, z2) and (sp, z3). We thus have the following. Claim 2 The PLP problem is NP-complete even for proper instances (G, (cid:96),≺) such that G is connected and has a prescribed upward embedding. We exploit Claim 2 in order to prove the following. Theorem 2. The UPE-FUE problem is NP-complete. This result holds even if (i) the instance is connected and (ii) the partial graph contains all the vertices and no edges. Proof. The membership of the UPE-FUE problem in NP follows from Lemma 3. Let (G, (cid:96),≺) be a proper instance of the PLP problem such that (G, (cid:96)) is a connected level graph with a prescribed upward embedding. We show how to construct in polynomial time an equivalent instance (cid:104)U, H, ΓH(cid:105) of the UPE-FUE problem satisfying properties (i) and (ii) of the statement. Refer to Fig. 7. Fig. 7: (left) An instance (G, (cid:96),≺) of PLP with a prescribed upward embedding. (center) An instance (U, H, ΓH ) of UPE-FUE equivalent to (G, (cid:96),≺) constructed using the reduction of Theorem 2. (right) A drawing ΓU of U that extends ΓH , focused on the subgraph of U stemming from the vertices of the third level of (G, (cid:96)) and from their incident edges. 1, ua 2, . . . , ua 2, . . . , wb l ]. The graph U is defined as follows. For each vertex v of G, the graph U contains vertices va and vb and an edge (vb, va). Further, for each edge (u, v) in G, the edge set of U contains an edge (ua, vb). The graph U is connected, since G is connected, which implies property (i). We set the upward embedding of U as follows. For each vertex v of G such that P(v) = (u1, u2, . . . , uk) and S(v) = (w1, w2, . . . , wl), we set P(vb) = [ua k], S(vb) = [va], P(va) = [vb], and S(va) = [wb 1, wb The graph H is defined as H = (V (U ),∅), which implies property (ii). Finally, the drawing ΓH of H is defined as follows. Since H contains no edges, in order to construct ΓH we only need to assign a position to each vertex of H. For i = 1, . . . , k, let Fi ⊆ Vi be the subset of vertices of level i of (G, (cid:96)) whose left-to-right order is fixed by ≺i, and let vi,1 ≺i vi,2 ≺i ··· ≺i vi,ri be the vertices of Fi. Also, let xi,1, . . . , xi,di be the vertices in Vi \ Fi (whose left-to-right order is not prescribed by ≺i). Let F = maxk i=1 Vi \ Fi and α = 1 F +2 . 15 101234567v1v2v3va1vb1va2va3vb2vb3x1x2x3x4xa1xa2xa3xa4xb4xb3xb2xb12345t2(e)Level1Level2Level3es2(e(cid:48))Q1L2Q2q(v1)va1vb1Q1L2Q2L3Q3Q0L1ΓGΓHΓU Fig. 8: Construction of the curves representing the edges of G directed from level i to level i + 1. First, for i = 1, . . . , k and for j = 1, . . . , ri, we place the vertex va i,j at the point (j, 2i − 1 − α). Second, for q = 1, . . . , di, we place the vertex xa i,j at the point (j, 2i − 1 + α) and the vertex vb i,q at the point i,q at the point (ri + q, 2i − 1 − (q + 1)α). Observe that all the (ri + q, 2i − 1 + (q + 1)α) and the vertex xb vertices of H stemming from vertices in Vi lie above the horizontal line Qi−1 := y = 2i − 2 and below the horizontal line Qi := y = 2i. This concludes the construction of the instance (U, H, ΓH ), which can be carried out in polynomial time in the size of (G, (cid:96),≺). We now prove that (G, (cid:96),≺) and (U, H, ΓH ) are equivalent. For the first direction, suppose that the instance (U, H, ΓH ) of the UPE-FUE problem is positive, that is, there exists a drawing ΓU of U that extends ΓH and respects its prescribed upward embedding. We show how to construct a level planar drawing ΓG of (G, (cid:96)) that respects its prescribed upward embedding and such that the order of the vertices in Vi along the horizontal line Li := y = 2i− 1 is a linear extension of ≺i, for i = 1, . . . , k. We construct ΓG as follows; refer to Fig. 8. For i = 1, . . . , k and for each vertex v ∈ Vi, let q(v) be the crossing point between the edge (vb, va) and Li in ΓU . Observe that such a crossing point exists since vb and va lie below and above Li, respectively, in ΓH (and thus in ΓU ), by construction. We place the vertex v at q(v) in ΓG. We modify the drawings of the edges of U incident to va and vb as follows. We delete the parts of ΓU inside disks with radius ε > 0 centered at va and vb; if ε is sufficiently small, only va, vb, and parts of their incident edges are deleted from ΓU . We extend the edges that used to be incident to va and vb downwards and upwards, respectively, following the drawing of the edge (vb, va) in ΓU sufficiently close to it, until they reach q(v). Finally, we delete the rest of the drawing of the edge (vb, va). Repeating this process for every vertex v of G results in a drawing ΓG of G. We have that ΓG is a level drawing. Namely, each edge (u, v) of G is represented in ΓG by a y-monotone curve, given that the edge (ua, vb) of U is represented in ΓU by a y-monotone curve and given that the parts of the representation of (u, v) in ΓG that do not coincide with the representation of (ua, vb) follow the y-monotone curves representing the edges (ub, ua) and (vb, va). Further, by construction, for i = 1, . . . , k, the vertices of the level Vi lie on the horizontal line Li with equation y = 2i − 1. Hence, after a change of the coordinate system which maps any point (x, y) ∈ R2 to the point (x, y+1 2 ), we have that ΓG is a level drawing. The drawing ΓG is also planar, given that ΓU is planar and given that, for each edge (u, v) of G, the parts of the representation of (u, v) in ΓG that do not coincide with the representation of (ua, vb) in ΓU follow the crossing-free curves representing the edges (ub, ua) and (vb, va). We now show that ΓG respects the prescribed upward embedding of G. Consider any vertex v of G and let S(v) = [w1, w2, . . . , wl]. By construction, the left-to-right order in ΓG of the edges outgoing at v is (v, w1), (v, w2), . . . , (v, wl) if and only if the left-to-right order in ΓU of the edges outgoing at l ). Further, the left-to-right order in ΓU of the edges outgoing at va is va is (va, wb l ), given that S(va) = [wb indeed (va, wb l ] and given that ΓU respects the prescribed upward embedding of G. Analogously, the left-to-right order of the edges incoming at each vertex v of G in ΓG corresponds to the prescribed order of the adjacent predecessors of v. 2), . . . , (va, wb 2), . . . , (va, wb 1), (va, wb 1), (va, wb 1, wb 2, . . . , wb 16 Li+1q(u)uaLivbq(v)uvΓUΓGy=2i i,2, . . . , va i,1, vb i,ri i,2, . . . , vb i,j, vb Finally, we show that the ordering of the vertices in Vi along Li is a linear extension of ≺i, for i = 1, . . . , k. Recall that each vertex v ∈ Vi has been placed at the point q(v) in ΓG. Hence, it suffices to show that q(vi,1), q(vi,2), . . . , q(vi,ri ) appear in this left-to-right order along Li in ΓU , which follows i,1, va from the fact that the vertices va appear in this left-to-right order along the horizontal line y = 2i − 1 + α, that the vertices vb appear in this left-to-right order along the horizontal i,ri line y = 2i − 1 − α, and that the edges (va i,j) are drawn as non-crossing y-monotone curves in ΓU . For the second direction, suppose now that (G, (cid:96),≺) is a positive instance of the PLP problem, that is, there exists a level planar drawing ΓG of (G, (cid:96)) that respects its prescribed upward embedding and such that the left-to-right order of the vertices in Vi along the horizontal line y = i is a linear extension of ≺i, for i = 1, . . . , k. We show how to construct an upward planar drawing ΓU of U that extends ΓH and that respects its prescribed upward embedding. First, we change the coordinate system in ΓG so to map any point (x, y) ∈ R2 to the point (x, 2i − 1). Now the vertices of Vi lie on the horizontal line Li := y = 2i − 1. For i = 1, . . . , k and for each vertex v ∈ Vi, let q(v) be the point along Li the vertex v lies upon in ΓG. For i = 1, . . . , k, let Ti be the left-to-right order of the vertices in Vi as they appear along Li in ΓG. The proof is based on the following claim. Claim 3 There exists a drawing Γ (cid:48) of the edges (vb, va) of U such that Γ (cid:48) extends ΓH and such that each edge (vb, va) intersects Li at q(v). Fig. 9: Illustration for the proof of Claim 3. (left) A level planar drawing ΓG of G focused on level i. (middle) and (right) Γ (cid:48) after drawing the edges (qb, qa) and (sb, sa), respectively. The corresponding regions R are colored. Proof. First, we initialize Γ (cid:48) = ΓH . Then, for each i = 1, . . . , k and for each vertex v in Fi, we draw the edge (vb, va) as a y-monotone curve composed of the straight-line segments vbq(v) and q(v)va. We prove that Γ (cid:48) is crossing-free. First, for any two vertices u ∈ Fi and v ∈ Fj with i (cid:54)= j, the edges (ub, ua) and (vb, va) are vertically disjoint. Second, for any two vertices u, v ∈ Fi, the straight-line segments ubq(u) and q(v)va are vertically disjoint, as well as the straight-line segments vbq(v) and q(u)ua. Finally, the straight-line segments ubq(u) and vbq(v) do not cross since q(u) and q(v) have the same y-coordinate, since ub and vb have the same y-coordinate, and since the x-coordinate of q(u) is smaller than the one of q(v) if and only if the x-coordinate of ub is smaller than the one of vb; similarly, the straight-line segments uaq(u) and vaq(v) do not cross. In order to complete Γ (cid:48), it remains to draw each edge (vb, va), with v ∈ Vi \ Fi. To this aim, we process the vertices in Vi \ Fi in the order they appear in Ti. When we process a vertex v, we draw the edge (vb, va) as a y-monotone curve passing trough q(v), without introducing any crossings in Γ (cid:48); this is done so to maintain the invariant that in Γ (cid:48) there exists a region R that satisfies the following properties (refer to Fig. 9): (i) R is delimited from below and from above by Qi−1 and Qi, respectively, and from the left and from the right by y-monotone curves λR and ρR that extend from Qi−1 to Qi, respectively; 17 ΓGΓ(cid:48)Qi−1LiQiΓ(cid:48)vuaubsarapbrbsbqapaqbvazavbzbuzqrsasbsppapb (ii) for every unprocessed vertex u, the region R contains in its interior ub, ua, and q(u); and (iii) the region R does not contain in its interior any part of an edge (ub, ua), for any processed vertex u ∈ Vi \ Fi. Let v be the currently processed vertex. The edge (vb, va) is drawn as a y-monotone curve (cid:96)(v) lying inside R and composed of eight parts. The first part (cid:96)1(v) of (cid:96)(v) starts from vb and approaches λR by moving left while slightly and monotonically increasing in the y-coordinate. The second part (cid:96)2(v) of (cid:96)(v) follows λR, slightly to the right of it, until reaching a point slightly lower than the line y = 2i − 1 − α. The third part (cid:96)3(v) of (cid:96)(v) approaches a point from which q(v) is visible while slightly and monotonically increasing in the y-coordinate. The fourth part (cid:96)4(v) of (cid:96)(v) is a straight-line segment reaching q(v). The fifth part (cid:96)5(v), the sixth part (cid:96)6(v), the seventh part (cid:96)7(v), and the eighth part (cid:96)8(v) are symmetric to (cid:96)4(v), (cid:96)3(v), (cid:96)2(v), and (cid:96)1(v), respectively. Property (i) of R ensures that (cid:96)(v) can be drawn as a y-monotone curve. Properties (ii) and (iii) ensure that this can be done without introducing crossings in Γ (cid:48). The new region R is delimited from the right by the same y-monotone curve ρR as the old region R; the new y-monotone curve λR delimiting R from the left is composed of (cid:96)(v) and of the straight-line vertical segments connecting vb and va with Qi−1 and Qi, respectively. The new region R satisfies Properties (i) -- (iii); in particular, for every unprocessed vertex u, the new region R contains in its interior ub and ua, provided that (cid:96)2(v) and (cid:96)7(v) are sufficiently close to the y-monotone curve λR delimiting the old region R, and contains in its interior q(u), given that q(v) is to the left of q(u), by the definition of Ti. (cid:117)(cid:116) This concludes the proof of the claim. For i = 1, . . . , k − 1, denote by t(cid:48) i(e) the intersection point of an edge e of G directed from a vertex of the level Vi to a vertex of the level Vi+1 with the line Qi := y = 2i in ΓG. For each i = 1, . . . , k − 1, i(e1), t(cid:48) consider the left-to-right order Wi = t(cid:48) i(e2), . . . of the intersection points of the edges directed from the vertices of the level Vi to the vertices of the level Vi+1 with the line Qi in ΓG. The The sequence Wi has the following properties: (1) For any vertex v ∈ Vi, the intersection points of the edges exiting v with the line Qi are consecutive i(ev,1), t(cid:48) i(ev,2), . . . , t(cid:48) in Wi. This follows from the fact that ΓG is a level planar drawing. embedding of G; then t(cid:48) to the fact that ΓG respects the upward embedding of G. (2) Let ev,1, ev,2, . . . , ev,h be the left-to-right order of the edges exiting v as they appear in the upward i(ev,h) appear in this left-to-right order in Wi. This is due (3) For any two vertices u, v ∈ Vi such that u ≺i v, the intersection points of the edges exiting u precede the intersection points of the edges exiting v in Wi. This is due to the fact that ΓG is a level planar drawing and that the left-to-right order of the vertices in Vi in ΓG along Li is a linear extension of ≺i. We obtain a drawing ΓU of U from Γ (cid:48) by drawing, for each edge e = (u, v) of G where u ∈ Vi and v ∈ Vi+1, the edge (ua, vb) of U as a y-monotone curve between ua and vb passing trough t(cid:48) i(e). As in the previous direction, such curves can be drawn so that no two of them intersect, except possibly at common endpoints, by processing the edges directed from the vertices in Vi to the vertices in Vi+1 in the left-to-right order in which they cross Qi (that is, according to the sequence Wi of their crossing points with such a line). We have that ΓU is a drawing of U that extends ΓH . Further, Claim 3 and Properties (1) and (3) guarantee that ΓU is upward planar. Finally, Property (2) guarantees that ΓU respects the (cid:117)(cid:116) upward embedding of U . This concludes the proof of the theorem. Lemma 2, together with Theorem 2, implies the following. Corollary 2. The UPE-FUE problem is NP-complete even if (i) the partial graph contains all the vertices and (ii) no two vertices share the same y-coordinate in the partial drawing. We conclude this section by proving that the UPE problem is solvable in almost-linear time for instances in which the partial graph contains all the vertices and no edges, and no two vertices share the same y-coordinate in the partial drawing. Theorem 3. The UPE problem can be decided in O(n log n) time for instances (cid:104)G, H, ΓH(cid:105) such that G has n vertices, H = (V (G),∅), and no two vertices share the same y-coordinate in ΓH . Proof. By applying reduction (ii) of Lemma 4 to the instance (cid:104)G, H, ΓH(cid:105) of the UPE problem, we obtain in O(n log n) time an equivalent instance (G, (cid:96), ξ) of Ordered Level Planarity in which each level contains exactly one vertex. As observed by Klemz and Rote [26] such instances of Ordered Level Planarity are solvable in O(n) time, as a consequence of the fact that the Level Planarity problem (cid:117)(cid:116) can be solved in O(n) time [21]. 18 Fig. 10: Illustration for the proof that u ∈ LG∗ (v) implies that u ∈ LG(v). The cycle Cu is fat. 4 Upward Planar st-Graphs In this section we study the UPE and UPE-FUE problems for upward planar st-graphs. The following lemma will be useful for our algorithms. Lemma 5. Let G be an n-vertex upward planar st-graph with a given upward embedding. There exists a data structure to test in O(1) time, for any two vertices u and v of G, whether v ∈ SG(u), v ∈ PG(u), v ∈ LG(u), or v ∈ RG(u). Further, such a data structure can be constructed in O(n) time. Proof. First, we construct the transitive reduction G∗ of G, that is, the upward planar st-graph obtained from G by removing all its transitive edges. This can be done in O(n) time by examining each face of G; indeed, an edge (u, v) of an upward planar st-graph is transitive if and only if at least one of the two paths that connect u and v, that delimit the faces the edge (u, v) is incident to, and that are different from the edge (u, v) is monotone. Next, we show that G∗ can be used in place of G in order to answer the desired queries. G(v) and L+ G(v) and L+ Assume that u ∈ LG(v); hence, u lies to the left of the monotone path composed of L− G(v) in order to define L− G∗ (v) lie to the right of the monotone path composed of L− Claim 4 For each vertex v of G (and of G∗), we have SG∗ (v) = SG(v), PG∗ (v) = PG(v), LG∗ (v) = LG(v), and RG∗ (v) = RG(v). Proof. If u ∈ SG∗ (v), then u ∈ SG(v), as G∗ is a subgraph of G. Conversely, if u ∈ SG(v), then consider the longest monotone path from v to u in G; such a path also belongs to G∗, hence u ∈ SG∗ (v). This proves that SG∗ (v) = SG(v); the proof that PG∗ (v) = PG(v) is analogous. G(v). Since L− G(v) is the leftmost incoming path of v in G, all the monotone paths that replace transitive edges of L− G(v) in G. Analogous arguments apply to L+ G∗ (v). Thus, u lies to the left of the monotone path composed of G∗ (v) and L+ G∗ (v), hence u ∈ LG∗ (v). L− Conversely, assume that u ∈ LG∗ (v) and suppose, for a contradiction, that u /∈ LG(v), as in Fig. 10. It follows that there is a transitive edge (x, y) of G such that: (i) x and y both belong to L− G∗ (v) or both belong to L+ G∗ (v) -- assume the former, as the latter case can be treated analogously; (ii) the edge (x, y) lies to the left of the monotone path composed of L− G∗ (v) in G; and (iii) u lies inside the (undirected) cycle Cu of G delimited by the edge (x, y) and by the monotone path between x and y in L− G∗ (v). Consider any longest incoming path P− G (u) of u in G. Since these are longest paths, they also belong to G∗. Further, since they are incident to s and t, respectively, they share vertices with Cu. In particular, the subpaths of P− G (u) that are incident to u and whose edges are inside Cu determine a monotone path between two vertices of L− G∗ (v) that is to the left of the monotone path composed of L− G∗ (v) is the leftmost incoming path of v in G∗ and hence proves that u ∈ LG(v). It follows that LG∗ (v) = LG(v). (cid:117)(cid:116) The proof that RG∗ (v) = RG(v) is symmetric. We now compute a dominance drawing Γ ∗ of G∗. A dominance drawing of a directed graph is a straight-line drawing such that there is a monotone path from a vertex u to a vertex v if and only if x(u) ≤ x(v) and y(u) ≤ y(v). Di Battista et al. [17] presented an O(n)-time algorithm to construct a planar dominance drawing of an n-vertex upward planar st-graph without transitive edges. The dominance G (u) of u in G and any longest outgoing path P + G∗ (v) and L+ G (u) and P + G∗ (v) and L+ G∗ (v). This contradicts the fact that L− 19 vsL−G∗(v)yL+G∗(v)uP−G(u)P+G(u)tx drawings constructed by the cited algorithm satisfy the following properties: (i) x(v) < x(u) if and only if v ∈ PG(u) ∪ LG(u); and (ii) y(v) < y(u) if and only if v ∈ PG(u) ∪ RG(u). We use the algorithm by Di Battista et al. [17] in order to construct Γ ∗. Then, in order to query whether v ∈ PG(u), it suffices to check whether x(v) < x(u) and y(v) < y(u) in Γ ∗. The other queries (cid:117)(cid:116) can be similarly answered in O(1) time. We now characterize the positive instances of the UPE-FUE problem. Lemma 6. An instance (cid:104)G, H, ΓH(cid:105) of the UPE-FUE problem such that G is an upward planar st-graph with a given upward embedding and such that H contains no edges is a positive instance if and only if: Condition 1: For each vertex v of H, all its successors (predecessors) in G that belong to H have a y-coordinate in ΓH that is larger (smaller) than y(v); and Condition 2: For each vertex v of H, all the vertices of H whose y-coordinate is the same as y(v) and whose x-coordinate is larger (smaller) than x(v) in ΓH are to the right (to the left) of v in G. Proof. Concerning the necessity of Condition 1, assume that two vertices u and v exist in H such that G contains a monotone path P from u to v and such that the y(u) ≥ y(v) in ΓH . Then P cannot be upward in any drawing of G extending ΓH . Concerning the necessity of Condition 2, assume, for a contradiction, that two vertices u and v of H exist such that: (i) y(u) = y(v) and x(u) < x(v) in ΓH ; and (ii) u /∈ LG(v). If u ∈ SG(v), then a monotone path from v to u cannot be upward in any drawing of G extending ΓH . Analogously, u /∈ PG(v). Finally, if u ∈ RG(v), then consider any vertex w ∈ SG(u) ∩ SG(v) such that there are two edge-disjoint monotone paths Quw and Qvw from u to w and from v to w, respectively. Such paths can be found by considering any two monotone paths from u to t and from v to t, and by truncating these paths at their first common vertex; since u /∈ SG(v) and u /∈ PG(v), we have w (cid:54)= u, v. Since u ∈ RG(v), the left-to-right order of the edges entering w in G is: The edge of Qvw first and the edge of Quw second. However, since y(u) = y(v) and x(u) < x(v), the left-to-right order of the edges entering w in any upward planar drawing of G extending ΓH is: The edge of Quw first and the edge of Qvw second. This contradiction proves the necessity of Condition 2. To prove the sufficiency we construct an upward planar drawing ΓG of G that extends ΓH . We first augment ΓH by drawing every vertex v ∈ V (G) \ V (H), so that Conditions 1 and 2 are still satisfied after the augmentation. This is done by assigning to v any x-coordinate x(v) and a y-coordinate y(v) such that: (i) y(v) (cid:54)= y(u), for any vertex u ∈ V (G) with v (cid:54)= u; (ii) y(v) > y(u), for any u ∈ PG(v); and (iii) y(v) < y(w), for any w ∈ SG(v). We show how to construct such an assignment. We consider the vertices in V (G) \ V (H) one at a time. When a vertex v is considered, some of its successors in G might be already drawn in ΓH ; denote by S(cid:48) G(v) the set of such vertices. Analogously, let P (cid:48) G(v) be the set of the predecessors of v that are already drawn in ΓH . Each vertex w in S(cid:48) G(v) has a y-coordinate in ΓH that is larger than the y-coordinate of any vertex u in P (cid:48) G(v); namely, since w is a successor of v and since u is a predecessor of v, it follows that w is a successor of u and then Condition 1 ensures that y(u) < y(w) in ΓH . We place v at any point that is higher than all the vertices in P (cid:48) G(v), that is lower than all the vertices in S(cid:48) G(v), and whose y-coordinate is different from all the other vertices of H. Clearly, Conditions 1 and 2 are still satisfied by the new instance. After repeating this augmentation for all the vertices in V (G) \ V (H), we eventually get that V (H) = V (G) and the instance (cid:104)G, H, ΓH(cid:105) still satisfies Conditions 1 and 2. Now set ΓG = ΓH . We are going to draw the edges of G in ΓG; we start with the edges of the leftmost path L+ G(s) as follows. If there is no vertex w such that y(u) < y(w) < y(v), then we draw (u, v) as a straight-line segment. Otherwise, we draw (u, v) as a polygonal line composed of three straight-line segments: The first one connects u with a point pu whose y-coordinate is slightly larger than y(u) and whose x-coordinate is smaller than the one of every vertex of G in ΓG; the second one is a vertical straight-line segment connecting pu with a point pv whose y-coordinate is slightly smaller than y(v); the third one connects pv with v. By construction all the vertices of G not in L+ Now the algorithm proceeds in steps. After each step we maintain the invariants that: (i) the subgraph of G currently drawn consists of an upward planar st-graph G(cid:48) plus a set of isolated vertices; (ii) the current drawing of G(cid:48) in ΓG is upward planar; and (iii) the rightmost path of G(cid:48) is represented by a y-monotone curve γr such that all the isolated vertices lie to the right of γr in ΓG, when traversing γr from s to t. G(s) of G (see Fig. 11a). We draw each edge (u, v) of L+ G(s) are to the right of L+ G(s) in ΓG. 20 (a) (b) Fig. 11: (a) Drawing the leftmost path L+ f . G(s) of G. (b) Drawing the right boundary (u1, . . . , ul) of a face The invariants are initially satisfied with G(cid:48) = L+ G(s) and with the drawing ΓG constructed as above. In each step we consider a face f of G whose left boundary belongs to G(cid:48) and whose right boundary consists of edges not in G(cid:48). In order to draw the right boundary (u1, . . . , ul) of f , we draw each edge (ui, ui+1) independently (see Fig. 11b). We draw (ui, ui+1) as a polygonal line composed of three parts. The first part is a straight-line segment connecting ui with a point pui whose y-coordinate is slightly larger than y(ui) and whose x-coordinate is slightly larger than the x-coordinate of the point of the left boundary of f with the same y-coordinate. The second part is a polygonal line arbitrarily close to the left boundary of f , connecting pui with a point pui+1 whose y-coordinate is slightly smaller than y(ui+1). The third part is a straight-line segment connecting pui+1 with ui+1. Invariant (i) is maintained by the choice of the face f . Invariant (ii) is maintained since, for each i = 1, . . . , l − 1, we have y(ui) < y(ui+1) in ΓG, by Condition 1, and since the drawing of (ui, ui+1) is upward and does not cross any previously drawn edge, by construction. Invariant (iii) is maintained since each edge (ui, ui+1) is arbitrarily close to the drawing of the rightmost path of G(cid:48), except in the interior of arbitrarily narrow horizontal strips enclosing ui and ui+1; further, (ui, ui+1) does not keep any isolated vertex to its left inside such strips by Condition 2. By invariant (ii), ΓG respects the upward embedding of G. Further, by construction, the vertices of H (cid:117)(cid:116) have the same coordinates in ΓG as in ΓH , hence ΓG extends ΓH . We can now prove the following algorithmic theorem. Theorem 4. The UPE-FUE problem can be solved in O(n log n) time for instances (cid:104)G, H, ΓH(cid:105) with size n = (cid:104)G, H, ΓH(cid:105) such that G is an upward planar st-graph with a given upward embedding. Proof. If H contains edges, then Lemma 1 can be applied in O(n log n) time in order to transform (cid:104)G, H, ΓH(cid:105) into an equivalent instance, which we again denote by (cid:104)G, H, ΓH(cid:105), such that (cid:104)G, H, ΓH(cid:105) ∈ O(n), such that H contains no edges, and such that G is still an upward planar st-graph. We show an O(n log n)-time algorithm to test whether Conditions 1 and 2 of Lemma 6 are satisfied by (cid:104)G, H, ΓH(cid:105). In order to test Condition 1, we proceed as follows. We construct an auxiliary graph A, which we initialize to G. We order in O(h log h) ∈ O(n log n) time the vertices in H according to their y- coordinates in ΓH , where h = V (H). Let v1, v2, . . . , vh be such an ordering. For every two maximal sets {vi, vi+1, . . . , vj} and {vj+1, vj+2, . . . , vk} of vertices of H such that y(vi) = ··· = y(vj), such that y(vj+1) = ··· = y(vk), and such that y(vj) < y(vj+1), we add to A a vertex xi,k, directed edges (vl, xi,k), for l = i, . . . , j, and directed edges (xi,k, vl), for l = j + 1, . . . , k. The graph A can be constructed in O(n + h log h) ∈ O(n log n) time and has O(n) vertices and edges. Claim 5 (cid:104)G, H, ΓH(cid:105) satisfies Condition 1 if and only if A is acyclic. Proof. For the necessity, suppose that Condition 1 holds true; we show that A is acyclic. For a contradiction, suppose that a simple directed cycle C exists in A; then C can be partitioned into monotone paths P1, . . . , P2k where all the edges of Pi belong to G if i is even and all the edges of Pi do not belong to G if i is odd. Note that, for i = 1, . . . , 2k, the vertex ui shared by two consecutive paths Pi and Pi+1 belongs to H, where P2k+1 = P1. Condition 1 implies that y(ui) < y(ui+1) for i = 2, 4, . . . , 2k, where 21 tsts=u1u2u3u4f it follows that we can test Condition 1 in O(n log n) time. u2k+1 = u1. The construction of A implies y(ui) < y(ui+1) for i = 1, 3, . . . , 2k − 1. However, this implies that y(u1) < y(u1), a contradiction. For the sufficiency, suppose that A is acyclic; we show that Condition 1 holds true. For a contradiction, suppose that two vertices u, v ∈ V (H) exist such that v ∈ SG(u) and such that y(u) > y(v) in ΓH . We have that A contains a monotone path directed from u to v as A contains all the edges of G, and a monotone path directed from v to u composed of edges not in G, hence it contains a directed cycle, a (cid:117)(cid:116) contradiction. Since A has O(n) vertices and edges, it can be tested in O(n) time whether it is acyclic. By Claim 5 In order to test Condition 2, we proceed as follows. We sort each maximal set of vertices {vi, . . . , vj} in H with the same y-coordinate according to their x-coordinates. For all the vertices of H, this can be done in O(h log h) ∈ O(n log n) time. Hence, we assume that x(vl) < x(vl+1), for l = i, . . . , j − 1; then we test whether vl ∈ LG(vl+1), for l = i, . . . , j − 1. By Lemma 5, this can be done in O(1)-time per query, (cid:117)(cid:116) after an O(n)-time preprocessing. Therefore, the total time to test Condition 2 is also O(n log n). Next, we deal with the UPE problem. An instance (cid:104)G, H, ΓH(cid:105) of the UPE problem such that G is an upward planar st-graph can be transformed into an equivalent instance of the PLP problem. This is due to the fact that Condition 1 of Lemma 6 does not depend on the upward embedding of G and that we can assume: 1. the edges set of H to be empty, by Lemma 1; and 2. the partial drawing to contain all the vertices of G, by drawing each vertex in V (G) \ V (H) as in the proof of Lemma 6, without violating neither Condition 1 nor Condition 2 of the lemma. Hence, the UPE problem for upward planar st-graphs can be solved in quadratic time, due to the results of Bruckner and Rutter about the PLP problem for single-source graphs [9]. However, in the following theorem we show how to reduce the time bound to almost linear. Theorem 5. The UPE problem can be solved in O(n log n) time for instances (cid:104)G, H, ΓH(cid:105) with size n = (cid:104)G, H, ΓH(cid:105) such that G is an upward planar st-graph. Proof. We are going to test whether an upward embedding of G exists that satisfies the conditions in Lemma 6. Actually, Condition 1 does not depend on the upward embedding of G, hence it can be tested in O(n log n) time as described in the proof of Theorem 4 before any upward embedding of G is considered. If the test succeeds, we apply Lemma 1 in O(n log n) time to modify (cid:104)G, H, ΓH(cid:105) so that H contains no edges while G remains an upward planar st-graph, and proceed as described in the following, otherwise we conclude that the instance is negative. In order to test whether G admits an upward embedding satisfying Condition 2 of Lemma 6 we proceed as follows. First, we add the edge (s, t) to G, if G does not contain such an edge. Second, we compute in O(n) time the SPQR-tree T of G. Third, we compute in O(n log n) time the order v1, v2, . . . , vh of the vertices in H by increasing y-coordinates and, secondarily, by increasing x-coordinates in ΓH . We now aim to decide a left-to-right order of the virtual edges of the skeleton of each P-node of T and a flip for the triconnected skeleton of each R-node of T so that Condition 2 is satisfied. We outline the approach for such decisions. Consider two vertices u = vi and v = vi+1 sharing their y-coordinate. Note that x(u) < x(v) in ΓH . Then u has to belong to LG(v) in the upward embedding of G we look for. This imposes a constraint on sk(ν) for a node ν of T such that u and v are in the pertinent graphs of two different virtual edges eu and ev of sk(ν). Namely, if ν is a P-node, then eu has to precede ev in the left-to-right order of the virtual edges of sk(ν). Further, if ν is an R-node, then eu has to be to the left of ev in the chosen embedding of sk(ν). To impose these constraints, we employ several algorithmic tools; e.g., we compute in O(1) time the proper allocation nodes µu and µv of u and v in T , and the lowest common ancestor ν of µu and µv in T . This approach is detailed as follows. We compute the following data structures. 1. We equip each P-node ν of T with an auxiliary directed graph LRν containing a vertex for each virtual edge of sk(ν), except for the one corresponding to the parent of ν in T . The edge set of LRν is initially empty. 22 2. The skeleton of each R-node ν of T is triconnected, hence it admits two upward embeddings, which can be obtained from each other via a flip. We arbitrarily choose one of these upward embeddings. We equip sk(ν) with a data structure that, given a pair (x, y) where x and y are vertices or edges of sk(ν), determines in O(1) time whether x ∈ Lsk(ν)(y), x ∈ Rsk(ν)(y), or none of the previous, in the chosen upward embedding of sk(ν). Such a data structure can be constructed in O(sk(ν)) time, as in Lemma 5, by inserting a dummy vertex on each virtual edge in order to handle the fact that queries might involve vertices but also virtual edges of sk(ν). Further, we equip sk(ν) with two boolean variables preserve(ν) and f lip(ν) that we both initially set to false. We execute the following algorithm. 1. We consider each pair u = vi, v = vi+1 of vertices with the same y-coordinate that are consecutive in the computed order. Note that x(u) < x(v) in ΓH . We perform the following operations, which ensure that u ∈ LG(v) in the upward embedding of G constructed by the algorithm, if any. (a) We compute in O(1) time the proper allocation nodes µu and µv of u and v in T , respectively. (b) We compute in O(1) time the lowest common ancestor ν of µu and µv in T . Let xu and xv be the representatives of u and v in sk(ν), respectively. (c) We perform different operations depending on the type of ν. i. If u = s, u = t, v = s, or v = t, then we reject the instance. ii. If ν is an S-node, then we reject the instance. iii. If ν is a P-node, then we add in O(1) time a directed edge in LRν from the vertex corresponding to xu to the vertex corresponding to xv. iv. If ν is an R-node, then we query in O(1) time the data structure sk(ν) has been equipped with. If xu ∈ Lsk(ν)(xv), then we set preserve(ν) =true. If xu ∈ Rsk(ν)(xv), then we set f lip(ν) =true. If xu /∈ Lsk(ν)(xv) and xu /∈ Rsk(ν)(xv), then we reject the instance. 2. For each P-node ν of T , we test whether LRν contains a directed cycle. In case of a positive answer, 3. For each R-node ν of T , we test in O(1) time whether preserve(ν) =true and f lip(ν) =true. In we reject the instance. case of a positive answer, we reject the instance. 4. We accept the instance. We analyze the running time of the algorithm. Step 1 takes O(1) time for each pair [vi, vi+1], hence O(h) ∈ O(n) time in total. Step 2 takes, for each node ν, time proportional to the number of the edges that are inserted in LRν. Over all the P-nodes ν of T , at most h − 1 edges are inserted in the auxiliary graphs LRν, namely at most one for each pair [vi, vi+1]. Thus the overall time complexity of Step 2 is O(h) ∈ O(n). Step 3 takes O(1) time for each R-node, hence O(n) time in total. Finally, Step 4 takes O(n) time. Hence, the total running time is dominated by the sorting of the vertices in H and the algorithm runs in O(n log n) time. Finally, we argue about the correctness of the algorithm. Consider step 1.(c)i. If u or v coincides with s or t, then Condition 2 is not satisfied by any upward embedding of G, as s and t do not have any vertices to their left or to their right in any upward embedding. Consider step 1.(c)ii. If ν is an S-node, then four cases are possible. If ν (cid:54)= µu and ν (cid:54)= µv, as in Fig. 12a, then xu and xv are two distinct virtual edges of sk(ν). Further, if ν = µu and ν (cid:54)= µv, as in Fig. 12b (the case in which ν (cid:54)= µu and ν = µv is symmetric), then xu is a vertex of sk(ν) and xv is a virtual edge of sk(ν). Finally, if ν = µu and ν = µv, as in Fig. 12c, then xu and xv are distinct vertices of sk(ν). In all cases, we have that either u ∈ SG(v) or u ∈ PG(v), hence Condition 2 is not satisfied in any upward embedding of G. Consider step 1.(c)iii. If ν is a P-node, then xu and xv are two virtual edges of sk(ν). In fact if, say, u were a vertex of sk(ν), then it would also be a vertex of the skeleton of the parent of ν in T ; hence, its proper allocation node would be a proper ancestor of ν, thus contradicting the fact that ν is the lowest common ancestor of the proper allocation nodes of u and v in T . The insertion of the directed edge in LRν from the vertex corresponding to xu to the vertex corresponding to xv enforces u ∈ LG(v) in the upward embedding of G that is constructed by the algorithm, if any. Consider step 1.(c)iv. If ν is an R-node, then four cases are possible, as for an S-node. In all of them we check whether the arbitrarily chosen upward embedding of sk(ν) ensures that u ∈ LG(v) (then setting preserve(ν) =true ensures that such an embedding of sk(ν) is the one in the upward embedding of G that is constructed by the algorithm, if any), whether flipping the arbitrarily chosen upward embedding 23 (a) (b) (c) (d) (e) (f) Fig. 12: The cases in which the algorithm rejects an instance. Gray-filled regions represent pertinent graphs of the virtual edges of the skeleton of the node under investigation. The virtual edge representing the parent of the considered node is not shown. (a) -- (c) The node ν is an S-node. (d) The node ν is an R-node, u /∈ LG(v), and u /∈ RG(v). (e) For some P-node ν of T there is a directed cycle in LRν. (f) For some R-node ν of T , we have preserve(ν) =true and f lip(ν) =true. of sk(ν) ensures that u ∈ LG(v) (then setting f lip(ν) =true ensures that such an embedding of sk(ν) is flipped in the upward embedding of G that is constructed by the algorithm, if any), or whether u ∈ LG(v) is not obtained by any choice of the embedding of sk(ν), since u ∈ SG(v) or u ∈ PG(v); see Fig. 12d. Consider step 2. If a directed cycle is detected in LRν, for some P-node ν, then the left-to-right order of the pertinent graphs of the virtual edges of sk(ν) in any upward embedding of G does not satisfy all the constraints stemming from the left-to-right order of the vertices of H sharing the same y-coordinate in ΓH ; see Fig. 12e. Consider step 3. If there is an R-node ν with preserve(ν) =true and f lip(ν) =true, then no flip of sk(ν) allows us to construct an upward embedding of G satisfying Condition 2. For example, in Fig. 12f the pair [vi, vi+1] forces the upward embedding of sk(ν) to be the one shown in the illustration, given that vi+1 ∈ RG(vi) in such an embedding; however the pair [vj, vj+1] forces the upward embedding of sk(ν) not to be the one shown in the illustration, given that vj+1 ∈ LG(vj). Finally, consider step 4. In order to prove its correctness, we construct an upward embedding of G satisfying Condition 2; this is done as follows. For each R-node ν of T , if f lip(ν) =true, then we flip the arbitrarily chosen upward embedding of sk(ν), otherwise we keep it as it is. For each P-node ν in T , we select a total order for the virtual edges of sk(ν) corresponding to children of ν in T that extends the partial order given by LRν. Finally, if (s, t) was not originally in G, then we remove it. This leads to an (cid:117)(cid:116) upward embedding satisfying Condition 2 of Lemma 6. 5 Directed Paths and Cycles In this section we study the upward planarity extension problem for instances (cid:104)G, H, ΓH(cid:105) such that G is a directed path or cycle. Determining the time complexity of the UPE and UPE-FUE problems for such instances, despite the simplicity of their structure, has proved to be very challenging. However, in the following we exhibit polynomial-time decision algorithms for the cases in which H does not contain edges and no two vertices share the same y-coordinate in ΓH . We start with the UPE-FUE problem for directed paths. Theorem 6. The UPE-FUE problem can be solved in O(n4) time for instances (cid:104)G, H, ΓH(cid:105) such that G is an n-vertex directed path with a given upward embedding, H contains no edges, and no two vertices share the same y-coordinate in ΓH . Proof. Let G = (u1, . . . , un). We show a decision algorithm for the UPE-FUE problem employing dynamic programming. The idea is to decide whether (cid:104)G, H, ΓH(cid:105) is a positive instance of the UPE-FUE problem based on whether the subpaths of G admit upward planar extensions with given upward embedding. In particular, we fill a table with entries t(ui, uj, um, uM ), for all the indices i, j, m, M ∈ {1, . . . , n} such that i ≤ m ≤ j and i ≤ M ≤ j, with i (cid:54)= j and m (cid:54)= M . Consider the subpath Gi,j = (ui, . . . , uj) of G. Let ΓH,i,j be the restriction of ΓH to the vertices that belong to Gi,j. The entry t(ui, uj, um, uM ) has value true if there is an upward planar drawing ΓG,i,j of Gi,j that extends ΓH,i,j and such that 24 uvvuuvvuvi+1vivjvj+1 um and uM are the vertices with the smallest and largest y-coordinate in ΓG,i,j, respectively; the entry t(ui, uj, um, uM ) has value false otherwise. We start by computing the entries t(ui, uj, um, uM ) such that Gi,j is a monotone path; these include the entries t(ui, ui+1, um, uM ). Assume that the edge (ui, ui+1) of G is outgoing ui, the other case is symmetric. Then t(ui, uj, um, uM ) = true if and only if the following conditions are satisfied: (1) m = i; (2) M = j; and (3) for any two indices i(cid:48) and j(cid:48) such that i ≤ i(cid:48) < j(cid:48) ≤ j and such that ui(cid:48), uj(cid:48) ∈ V (Hi,j), we have y(ui(cid:48)) < y(uj(cid:48)) in ΓH,i,j. Assume now that Gi,j is not a monotone path and that the values of all the entries t(ui, uj, um, uM ) such that 1 ≤ j − i ≤ x have been computed, for some x ∈ {1, 2, . . .}. After the computation of the entries t(ui, uj, um, uM ) such that Gi,j is a monotone path, this is indeed the case with x = 1. We compute the values of the entries t(ui, uj, um, uM ) such that j − i = x + 1. We distinguish three cases, based on how many of the equalities i = m, i = M , j = m, and j = M are satisfied, that is, based on how many vertices among um and uM are end-vertices of Gi,j. Refer to Fig. 13. (a) (b) (c) Fig. 13: Three cases that might occur in an upward planar drawing of a path Gi,j. (a) The vertices um and uM with the smallest and largest y-coordinate are not end-vertices of Gi,j; (b) one of um and uM is an end-vertex of Gi,j, while the other one is not; and (c) um and uM are both end-vertices of Gi,j. Suppose first that neither um nor uM is an end-vertex of Gi,j. Recall that m (cid:54)= M ; in fact, assume that m < M , the case in which m > M can be treated symmetrically. We have the following. Claim 6 t(ui, uj, um, uM ) = true if and only if there exist indices M(cid:48) ∈ {i, . . . , m − 1} and m(cid:48) ∈ {M + 1, . . . , j} such that the following conditions hold true: (1) t(ui, um, um, uM(cid:48)) = true; (2) t(um, uM , um, uM ) = true; (3) t(uM , uj, um(cid:48), uM ) = true; (4) either um does not belong to H or um has the smallest y-coordinate among the vertices in ΓH,i,j; and (5) either uM does not belong to H or uM has the largest y-coordinate among the vertices in ΓH,i,j. Proof. We first prove the necessity. Suppose that t(ui, uj, um, uM ) = true, hence an upward planar drawing ΓG,i,j of Gi,j exists that extends ΓH,i,j and in which um and uM are the vertices with the smallest and largest y-coordinate, respectively. Restricting ΓG,i,j to the vertices and edges of Gm,M yields an upward planar drawing ΓG,m,M of Gm,M that extends ΓH,m,M and in which um and uM are the vertices with the smallest and largest y-coordinate, respectively, which proves Condition (2). Let uM(cid:48) be the vertex of Gi,m with the largest y-coordinate in ΓG,i,j. Then restricting ΓG,i,j to the vertices and edges of Gi,m yields an upward planar drawing ΓG,i,m of Gi,m that extends ΓH,i,m and in which um and uM(cid:48) are the vertices with the smallest and largest y-coordinate, respectively, which proves Condition (1). The proof of Condition (3) is analogous. By assumption um is the vertex with the smallest y-coordinate in ΓG,i,j, hence Condition (4) follows, given that ΓG,i,j extends ΓH,i,j. Condition (5) is proved analogously. The proof of the sufficiency is more involved. By Conditions (1) -- (3) there exist upward planar drawings ΓG,i,m, ΓG,m,M , and ΓG,M,j of Gi,m, Gm,M , and GM,j extending ΓH,i,m, ΓH,m,M , and ΓH,M,j in which the vertices with the smallest and largest y-coordinate are um and uM(cid:48), um and uM , and um(cid:48) and uM , respectively, for some M(cid:48) ∈ {i, . . . , m − 1} and m(cid:48) ∈ {M + 1, . . . , j}. We are going to glue together these 25 umuMuM(cid:48)uium(cid:48)ujuMui=umum(cid:48)ujuj=uMui=umum(cid:48)uM(cid:48) drawings in order to construct an upward planar drawing ΓG,i,j of Gi,j that extends ΓH,i,j and in which um and uM are the vertices with the smallest and largest y-coordinate, respectively. However, before doing so, we need to perform some modifications on ΓG,i,m, ΓG,m,M , and ΓG,M,j, while not altering the positions of the vertices of Hi,m, Hm,M , and HM,j, respectively. The first set of modifications aim to establish that: (i) um is at the same point in ΓG,i,m and in ΓG,m,M , and it has the smallest y-coordinate among all the vertices in ΓG,i,m, ΓG,m,M , and ΓG,M,j; and (ii) uM is at the same point in ΓG,m,M and in ΓG,M,j, and it has the largest y-coordinate among all the vertices in ΓG,i,m, ΓG,m,M , and ΓG,M,j. Note that um is the vertex with the smallest y-coordinate in both ΓG,i,m and ΓG,m,M , however there might be a vertex in ΓG,M,j whose y-coordinate is smaller than or equal to y(um). A similar problem might occur for uM . -- If um /∈ V (H), then let y∗ be the smallest y-coordinate of any vertex in ΓG,i,m, ΓG,m,M , or ΓG,M,j. Let p ≡ (x, y), where x and y are real numbers such that y < y∗. Let  > 0 be smaller than the vertical distance between any two vertices in ΓG,i,m, ΓG,m,M , and ΓG,M,j. We modify ΓG,i,m as follows. We delete the part of ΓG,i,m inside a disk with radius  centered at um. Since ΓG,i,m is an upward drawing, since um is the vertex with the smallest y-coordinate in ΓG,i,m, and by the choice of , only um and part of the edge (um, um−1) is deleted from ΓG,i,m. We place um at p. We extend the part of the edge (um, um−1) still in ΓG,i,m downwards, until it reaches a y-coordinate smaller than y∗ and larger than y, and then we connect it to um. We perform an analogous modification of ΓG,m,M . Fig. 14: Modifying ΓG,M,j if um ∈ V (H). Illustrations (a) and (b) show ΓG,M,j before and after the modification, respectively. -- If um ∈ V (H), as in Fig. 14, then um is at the same point in ΓG,i,m and ΓG,m,M , as such a point belongs to ΓH,i,m and ΓH,m,M . Let y∗ be a real number larger than y(um) and smaller than the y-coordinate of any vertex in V (H) ∩ ΓH,M,j. Such a real number exists by Condition (4). Vertically scale down the part of ΓG,M,j in the half-plane y ≤ y∗, while keeping fixed the points on the line y = y∗. As long as the scale factor is sufficiently small, the entire drawing ΓG,M,j lies above the line y = y(um) after the scaling. property (ii) above. The drawings ΓG,i,m, ΓG,m,M , and ΓG,M,j can be modified analogously in order to accomplish Gluing together ΓG,i,m, ΓG,m,M , and ΓG,M,j results in an upward drawing Γ (cid:48) G,i,j of Gi,j that extends ΓH,i,j and in which um and uM are the vertices with the smallest and largest y-coordinate, respectively. However, two problems arise. First, Γ (cid:48) G,i,j might contain crossings; indeed, while each of ΓG,i,m, ΓG,m,M , and ΓG,M,j is planar, two edges from different graphs among Gi,m, Gm,M , and GM,j might cross each G,i,j might not correspond to S(um) other. Second, the left-to-right order of the edges outgoing at um in Γ (cid:48) and the left-to-right order of the edges incoming at uM in Γ (cid:48) We show that both these problems can be overcome by redrawing the curves representing the edges of Gi,m, Gm,M , and GM,j, while leaving the position of every vertex unaltered. Refer to Fig. 15. Assume first that S(um) = [um−1, um+1] and P(uM ) = [uM−1, uM +1]. G,i,j might not correspond to P(uM ). 26 y=y∗y=y(um)uMujy=y∗y=y(um)uMuj Fig. 15: Modifications to Γ (cid:48) of Ri,m, except at um. (a) The drawing ΓG,i,m together with the vertices of Gm+1,j, as placed in Γ (cid:48) the edges incident to these vertices are not shown. (b) The curves γm and γ(cid:48) edges in Gi,m so that they lie in Ri,m. G,i,j that yield to an upward planar drawing of Gi,m which lies in the interior G,i,j; m. (c) Redrawing parts of the Let the vertices of Gi,j be placed as in Γ (cid:48) G,i,j. Let hm and hM be the horizontal lines through um and uM . Let S be the horizontal strip delimited by hm and hM . Let γm be a y-monotone curve that connects um with a point of hM , that does not pass through any vertex of Gi,j other than um, and such that the part of S to the left of γm contains in its interior all the vertices of Gi,m−1 and no vertex of Gm+1,j. Analogously, let γM be a y-monotone line that connects uM with a point of hm, that does not pass through any vertex of Gi,j other than uM , that does not intersect γm, and such that the part of S to the right of γM contains in its interior all the vertices of GM +1,j and no vertex of Gi,M−1. It is easy to see that such lines γm and γM exist; in particular, notice that there is no constraint on how these lines might intersect the edges of Gi,j in Γ (cid:48) G,i,j. The lines γm and γM partition S into three regions: one unbounded region Ri,m to the left of γm, one bounded region Rm,M between γm and γM , and one unbounded region RM,j to the right of γM . Notice that Ri,m, Rm,M , and RM,j contain in their interiors all the points at which the vertices of Gi,m, Gm,M , and GM,j are placed in Γ (cid:48) G,i,j, respectively, except for the vertex um which is on the common boundary of Ri,m and Rm,M , and for the vertex uM which is on the common boundary of Rm,M and RM,j. We now redraw the edges of Gi,m, Gm,M , and GM,j in the interiors of Ri,m, Rm,M , and RM,j, respectively. We construct an upward planar drawing of Gi,m inside Ri,m by modifying ΓG,i,m via a homeomorphism of the plane which does not alter the positions of the vertices of Gi,m. More precisely, this can be done as follows. Let  > 0 be the minimum horizontal distance between a vertex of Gi,m different from um and γm. Let γ(cid:48) m by /2 to the left. Delete the part of ΓG,i,m to the right of γ(cid:48) m, except for the vertex um. Now any y-monotone curve that has been deleted from ΓG,i,m and that used to connect two points p and q on γ(cid:48) m can be replaced by a y-monotone curve that connects p and q and that lies to the right of γ(cid:48) m, except at p and q, and to the left of γm. The end-points of any two such curves do not alternate along γ(cid:48) m, given that ΓG,i,m is planar, hence all such curves can be drawn without intersections. The curves that used to connect a point p with um can be similarly redrawn to the right of γ(cid:48) m, except at p, and to the left of γm, except at um. m be the translation of γ(cid:48) A similar modification allows us to construct an upward planar drawing of Gm,M inside Rm,M and an upward planar drawing of GM,j inside RM,j. Since the interiors of these regions are disjoint, the edges of two different graphs among Gi,m, Gm,M , and GM,j do not intersect, except for the edges (um, um−1) and (um, um+1), which intersect at um, and for the edges (uM , uM−1) and (uM , uM +1), which intersect at uM . Further, the left-to-right order of the edges outgoing at um is (um, um−1), (um, um+1), which corresponds to S(um) = [um−1, um+1], and the left-to-right order of the edges incoming at uM is (uM−1, uM ), (uM +1, uM ), which corresponds to P(uM ) = [uM−1, uM +1]. The drawing ΓG,i,j obtained as the union of the constructed drawings of Gi,m, Gm,M , and GM,j is hence the desired drawing of Gi,j. If S(um) = [um+1, um−1] and P(uM ) = [uM +1, uM−1], the construction is symmetric. In particular, γm is defined as before, except that the part of S to the right (and not to the left) of γm contains in its interior all the vertices of Gi,m−1 and no vertex of Gm+1,j, and the part of S to the left (and not to the right) of γM contains in its interior all the vertices of GM +1,j and no vertex of Gi,M−1. 27 hmuMhMumuihmuMhMumuiγmγ(cid:48)mhmuMhMumuiγmγ(cid:48)m If S(um) = [um−1, um+1] and P(uM ) = [uM +1, uM−1], then γm is defined as in the case in which S(um) = [um−1, um+1] and P(uM ) = [uM−1, uM +1]. However, the definition of γM is now slightly different. Indeed, γM is now a y-monotone line that connects uM with um (and not just with any point of hm), that does not pass through any vertex of Gi,j other than uM and um, that does not intersect γm, except at um, and such that the part of S to the right of γM contains in its interior all the vertices of Gm+1,M−1 and no vertex of Gi,m−1 or GM +1,j. The rest of the construction is analogous to the previous cases. Finally, if S(um) = [um+1, um−1] and P(uM ) = [uM−1, uM +1], then the construction is symmetric to the case in which S(um) = [um−1, um+1] and P(uM ) = [uM +1, uM−1]. (cid:117)(cid:116) This completes the proof of the claim. Suppose next that one of um and uM is an end-vertex of Gi,j, while the other one is not. Assume that um = ui, the cases in which um = uj, uM = ui, or uM = uj can be treated analogously. Recall that m (cid:54)= M , hence i < M < j. We have the following. Claim 7 t(ui, uj, ui, uM ) = true if and only if there exists an index m(cid:48) ∈ {M + 1, . . . , j} such that the following conditions hold true: (1) t(ui, uM , ui, uM ) = true; (2) t(uM , uj, um(cid:48), uM ) = true; and (3) either ui does not belong to H or ui has the smallest y-coordinate among the vertices in ΓH . Proof. The proof is very similar to (and in fact simpler than) the proof of Claim 6. Consider an upward planar drawing ΓG,i,j of Gi,j in which um and uM are the vertices with the smallest and largest y-coordinate, respectively. Restricting ΓG,i,j to the vertices and edges of Gi,M (of GM,j) provides an upward planar drawing ΓG,i,M of Gi,M (resp. ΓG,M,j of GM,j) extending ΓH,i,M (resp. ΓH,M,j) in which the vertices with the smallest and largest y-coordinate are ui and uM (resp. um(cid:48) and uM , for some m(cid:48) ∈ {M + 1, . . . , j}). This proves the necessity of Conditions (1) and (2). The property that um is the vertex with the smallest y-coordinate in ΓG,i,j implies the necessity of Condition (3). In order to prove the sufficiency we start from upward planar drawings ΓG,i,M and ΓG,M,j of Gi,M and GM,j extending ΓH,i,M and ΓH,M,j in which the vertices with the smallest and largest y-coordinate are ui and uM , and um(cid:48) and uM , respectively, for some m(cid:48) ∈ {M + 1, . . . , j}. These drawings exist by Conditions (1) and (2). We then modify ΓG,i,M and/or ΓG,M,j so that the following properties hold true: (i) uM is at the same point in ΓG,i,M and ΓG,M,j; and (ii) ui has the smallest y-coordinate among all the vertices in ΓG,i,M and ΓG,M,j. In order to accomplish property (ii) we act as follows. Let y∗ be a real number larger than y(ui) and smaller than the y-coordinate of any vertex in V (H)∩ ΓH,M,j. Such a real number exists by Condition (3). Vertically scale down the part of ΓG,M,j in the half-plane y ≤ y∗, while keeping fixed the points on the line y = y∗. As long as the scale factor is sufficiently small, the entire drawing ΓG,M,j has a y-coordinate larger than y(ui) after the scaling. The satisfaction of property (i) does not require any modifications to ΓG,i,M and ΓG,M,j if uM ∈ V (H); on the other hand, if uM /∈ V (H), then uM and parts of its incident edges in ΓG,i,M and ΓG,M,j are redrawn so to let uM be at the same point in ΓG,i,M and ΓG,M,j. Now gluing together ΓG,i,M and ΓG,M,j results in an upward drawing Γ (cid:48) G,i,j of Gi,j that extends ΓH,i,j in which ui and uM are the vertices with the smallest and largest y-coordinate, respectively. However, Γ (cid:48) G,i,j might contain crossings and the left-to-right order of the edges incoming at uM in Γ (cid:48) G,i,j might not correspond to P(uM ). Hence, we redraw the curves representing the edges of Gi,M and GM,j, while leaving the position of every vertex unaltered. This is done by defining two internally-disjoint regions Ri,M and RM,j that are separated by a y-monotone curve γM through uM and that contain in their interiors the points at which the vertices of Gi,M and GM,j are placed in Γ (cid:48) G,i,j, except for uM which is on the boundary of both such regions; whether Ri,M is to the left or to the right of RM,j depends on whether P(uM ) = [uM−1, uM +1] or P(uM ) = [uM +1, uM−1], respectively. We redraw the edges of Gi,M and GM,j inside Ri,M and RM,j, respectively. The drawing ΓG,i,j obtained as the union of the constructed (cid:117)(cid:116) drawings of Gi,M and GM,j is the desired drawing of Gi,j. This completes the proof of the claim. Suppose finally that both um and uM are end-vertices of Gi,j. Assume that um = ui and uM = uj, the other case is symmetric. We have the following. 28 Claim 8 t(ui, uj, ui, uj) = true if and only if there exist indices M(cid:48) ∈ {i + 1, . . . , j − 2} and m(cid:48) ∈ {M(cid:48) + 1, . . . , j − 1} such that the following conditions hold true: (1) t(ui, uM(cid:48), ui, uM(cid:48)) = true; (2) t(uM(cid:48), um(cid:48), um(cid:48), uM(cid:48)) = true; (3) t(um(cid:48), uj, um(cid:48), uj) = true; (4) either ui does not belong to H or ui has the smallest y-coordinate among the vertices in ΓH ; (5) either uj does not belong to H or uj has the largest y-coordinate among the vertices in ΓH ; and (6) either P(uM(cid:48)) = [uM(cid:48)−1, uM(cid:48)+1] and S(um(cid:48)) = [um(cid:48)−1, um(cid:48)+1], or P(uM(cid:48)) = [uM(cid:48)+1, uM(cid:48)−1] and S(um(cid:48)) = [um(cid:48)+1, um(cid:48)−1]. Proof. We first prove the necessity. Suppose that t(ui, uj, ui, uj) = true, hence an upward planar drawing ΓG,i,j of Gi,j exists that extends ΓH,i,j and in which ui and uj are the vertices with the smallest and largest y-coordinate, respectively. Since Gi,j is not a monotone path, there exist internal vertices of Gi,j which are sinks. Among all these vertices, let uM(cid:48) be the one with the largest y-coordinate in ΓG,i,j. Further, since uM(cid:48) and uj are both sinks in Gi,j (note that if uj were not a sink, then an upward drawing of Gi,j in which uj is the vertex with the largest y-coordinate would not exist), there exist internal vertices of GM(cid:48),j which are sources. Among all these vertices, let um(cid:48) be the one with the smallest y-coordinate in ΓG,i,j. Note that M(cid:48) ∈ {i + 1, . . . , m − 2} and m(cid:48) ∈ {M(cid:48) + 1, . . . , j − 1}. Restricting ΓG,i,j to the vertices and edges of Gi,M(cid:48) yields an upward planar drawing ΓG,i,M(cid:48) of Gi,M(cid:48) that extends ΓH,i,M(cid:48) and in which ui and uM(cid:48) are the vertices with the smallest and largest y-coordinate, respectively. In particular, no vertex u of ΓG,i,M(cid:48) has a y-coordinate larger than uM(cid:48), as otherwise the sink v such that there is a monotone path from u to v in Gi,M(cid:48) (possibly such a path is a single vertex if u is a sink itself) would have a y-coordinate larger than uM(cid:48), contradicting the choice of uM(cid:48). This proves Condition (1); the proofs of Conditions (2) and (3) are analogous. By assumption ui is the vertex with the smallest y-coordinate in ΓG,i,j, hence Condition (4) follows, given that ΓG,i,j extends ΓH,i,j. Condition (5) is proved analogously. Fig. 16: Illustration for the proof of the necessity of Condition (6). The interior of Cm is colored light yellow. In order to prove the necessity of Condition (6) suppose, for a contradiction, that P(uM(cid:48)) = [uM(cid:48)−1, uM(cid:48)+1] and S(um(cid:48)) = [um(cid:48)+1, um(cid:48)−1] (the case in which P(uM(cid:48)) = [uM(cid:48)+1, uM(cid:48)−1] and S(um(cid:48)) = [um(cid:48)−1, um(cid:48)+1] can be treated analogously). Refer to Fig. 16. Let hM(cid:48) and hm(cid:48) be the horizontal lines passing through uM(cid:48) and um(cid:48) in ΓG,i,j, respectively. Since y(ui) < y(um(cid:48)) < y(uM(cid:48)), it follows that Gi,M(cid:48) crosses hm(cid:48). Order the crossing points between Gi,M(cid:48) and hm(cid:48) as they are encountered when walking along Gi,M(cid:48) from ui to uM(cid:48) and let pm(cid:48) be the last point in this order. Analogously, let pM(cid:48) be the crossing point between Gm(cid:48),j and hM(cid:48) that is encountered last when walking along Gm(cid:48),j from uj to um(cid:48). Thus the part of ΓG,i,j connecting pm(cid:48) with pM(cid:48) entirely lies in the strip H delimited by hm(cid:48) and hM(cid:48) (note that ΓG,M(cid:48),m(cid:48) does not cross hm(cid:48) or hM(cid:48), since um(cid:48) is the source with the smallest y-coordinate and uM(cid:48) is the sink with the largest y-coordinate in ΓG,M(cid:48),m(cid:48)). Let Cm be the closed curve composed of the part of ΓG,i,j between pm(cid:48) and um(cid:48) (this includes uM(cid:48)) and of the part of hm(cid:48) between pm(cid:48) and um(cid:48). Since P(uM(cid:48)) = [uM(cid:48)−1, uM(cid:48)+1], since the part of ΓG,i,j between pm(cid:48) and um(cid:48) lies in H, and by the planarity of ΓG,i,j, the points pm(cid:48), uM(cid:48), and um(cid:48) appear in this clockwise order along Cm. Further, since 29 uM(cid:48)um(cid:48)uiujhM(cid:48)uM(cid:48)−1uM(cid:48)+1um(cid:48)−1um(cid:48)+1pM(cid:48)hm(cid:48)pm(cid:48) S(um(cid:48)) = [um(cid:48)+1, um(cid:48)−1] and by the upward planarity of ΓG,i,j, we have that um(cid:48)+1 lies inside Cm in ΓG,i,j; on the other hand, uj is outside Cm in ΓG,i,j. By the Jordan curve's theorem, the path Gm(cid:48)+1,j crosses Cm. Since the path Gm(cid:48)+1,j lies in the half-plane y ≥ y(um(cid:48)), it does not cross hm(cid:48), hence it crosses the part of ΓG,i,j between pm(cid:48) and um(cid:48), a contradiction to the planarity of ΓG,i,j. The proof of the sufficiency is similar to the ones of Claims 6 and 7. Namely, we start from upward planar drawings ΓG,i,M(cid:48), ΓG,M(cid:48),m(cid:48), and ΓG,m(cid:48),j of Gi,M(cid:48), GM(cid:48),m(cid:48), and Gm(cid:48),j extending ΓH,i,M(cid:48), ΓH,M(cid:48),m(cid:48), and ΓH,m(cid:48),j in which the vertices with the smallest and largest y-coordinate are ui and uM(cid:48), um(cid:48) and uM(cid:48), and um(cid:48) and uj, respectively, for some M(cid:48) ∈ {i + 1, . . . , j − 2} and m(cid:48) ∈ {M(cid:48) + 1, . . . , j − 1}. These drawings exist by Conditions (1) -- (3). We then modify ΓG,i,M(cid:48), ΓG,M(cid:48),m(cid:48), and ΓG,m(cid:48),j so that the following properties hold: (i) uM(cid:48) is at the same point in ΓG,i,M(cid:48) and ΓG,M(cid:48),m(cid:48); (ii) um(cid:48) is at the same point in ΓG,M(cid:48),m(cid:48) and ΓG,m(cid:48),j; (iii) ui has the smallest y-coordinate among all the vertices in ΓG,i,M(cid:48), ΓG,M(cid:48),m(cid:48), and ΓG,m(cid:48),j; and (iv) uj has the largest y-coordinate among all the vertices in ΓG,i,M(cid:48), ΓG,M(cid:48),m(cid:48), and ΓG,m(cid:48),j. The satisfaction of property (i) does not require any modifications to ΓG,i,M(cid:48) and ΓG,M(cid:48),m(cid:48) if uM(cid:48) ∈ V (H); on the other hand, if uM(cid:48) /∈ V (H), then uM(cid:48) and parts of its incident edges in ΓG,i,M(cid:48) and ΓG,M(cid:48),m(cid:48) are redrawn (in particular uM(cid:48) is placed higher than it was in ΓG,i,M(cid:48) and ΓG,M(cid:48),m(cid:48)) so to let uM(cid:48) be at the same point in ΓG,i,M(cid:48) and ΓG,M(cid:48),m(cid:48). Property (ii) is satisfied similarly. If ui /∈ V (H), then Property (iii) can be satisfied by redrawing ui (lower than every other vertex in ΓG,i,M(cid:48), ΓG,M(cid:48),m(cid:48), and ΓG,m(cid:48),j) and part of its incident edge in ΓG,i,M(cid:48). If ui ∈ V (H), then a real number y∗ larger than y(ui) and smaller than the y-coordinate of any vertex in V (H) ∩ ΓH,m(cid:48),j is chosen, which is possible by Condition (4), and the part of ΓG,m(cid:48),j in the half-plane y ≤ y∗ is vertically scaled down, while keeping fixed the points on the line y = y∗. As long as the scale factor is sufficiently small, the entire drawing ΓG,m(cid:48),j lies above the line y = y(ui) after the scaling. Property (iv) is ensured analogously exploiting Condition (5). Gluing together ΓG,i,M(cid:48), ΓG,M(cid:48),m(cid:48), and ΓG,m(cid:48),j results in an upward drawing Γ (cid:48) G,i,j might contain crossings, the left-to-right order of the edges incoming at uM(cid:48) in Γ (cid:48) G,i,j of Gi,j that extends ΓH,i,j and in which ui and uj are the vertices with the smallest and largest y-coordinate, respectively. However, Γ (cid:48) G,i,j might not correspond to P(uM(cid:48)), and the left-to-right order of the edges outgoing from um(cid:48) in Γ (cid:48) G,i,j might not correspond to S(um(cid:48)). Hence, we redraw the curves representing the edges of Gi,M(cid:48), GM(cid:48),m(cid:48), and Gm(cid:48),j, while leaving the position of every vertex unaltered. This is done by defining three internally-disjoint regions Ri,M(cid:48), RM(cid:48),m(cid:48), and Rm(cid:48),j containing in their interiors the points at which the vertices of Gi,M(cid:48), GM(cid:48),m(cid:48), and Gm(cid:48),j are placed in Γ (cid:48) G,i,j, respectively, except for uM(cid:48) which is on the boundary of both Ri,M(cid:48) and RM(cid:48),m(cid:48), and for um(cid:48) which is on the boundary of both RM(cid:48),m(cid:48) and Rm(cid:48),j. These regions are delimited by the horizontal lines hi and hj through ui and uj, and by two y-monotone curves γM(cid:48) and γm(cid:48) passing through uM(cid:48) and um(cid:48), respectively, and connecting points on hi and hj. The curves γM(cid:48) and γm(cid:48) are defined so that the regions Ri,M(cid:48), RM(cid:48),m(cid:48), and Rm(cid:48),j appear in this left-to-right order inside the horizontal strip delimited by hi and hj in the case in which P(uM(cid:48)) = [uM(cid:48)−1, uM(cid:48)+1] and S(um(cid:48)) = [um(cid:48)−1, um(cid:48)+1], or so that they appear in the opposite left-to-right order in the case in which P(uM(cid:48)) = [uM(cid:48)+1, uM(cid:48)−1] and S(um(cid:48)) = [um(cid:48)+1, um(cid:48)−1]. One of the two cases happens, because of Condition (6). We now redraw the edges of Gi,M(cid:48), GM(cid:48),m(cid:48), and Gm(cid:48),j inside Ri,M(cid:48), RM(cid:48),m(cid:48), and Rm(cid:48),j, respectively. The drawing ΓG,i,j obtained as the union of the constructed drawings of Gi,M(cid:48), GM(cid:48),m(cid:48), and Gm(cid:48),j is the desired drawing of (cid:117)(cid:116) Gi,j. This completes the proof of the claim. Claims 6 to 8 show how to compute the value of the entry t(ui, uj, um, uM ), if Gi,j is not a mono- tone path, based on the structure of the instance (cid:104)Gi,j, Hi,j, ΓH,i,j(cid:105) and on the value of the entries t(ui(cid:48), uj(cid:48), um(cid:48), uM(cid:48)) with j(cid:48) − i(cid:48) < j − i. Eventually the dynamic programming will compute the values of the entries t(u1, un, um, uM ), for all 1 ≤ m ≤ n and 1 ≤ M ≤ n with m (cid:54)= M ; then the instance (cid:104)G, H, ΓH(cid:105) of the UPE-FUE problem is positive if and only if at least one of these entries has value true. We now show how to implement the described algorithm so that it runs in O(n4) time. Observe that there are O(n4) entries t(ui, uj, um, uM ) whose value has to be computed. We start by computing, for each entry t(ui, uj, um, uM ), the smallest and largest y-coordinate of a vertex in V (H) ∩ ΓH,i,j, if any such a vertex exists. This can be done in O(1) time per entry by induction on j − i. Indeed, if j − i = 1, then at most two coordinates have to be compared in order to determine such two values. If j − i > 1, then the two values either coincide with those computed for t(ui+1, uj, um, uM ), 30 if ui /∈ V (H), or are computed by comparing the two values computed for t(ui+1, uj, um, uM ) with y(ui), if ui ∈ V (H). The computation of the true-false values for the entries t(ui, uj, um, uM ) such that Gi,j is a monotone path is done in O(n4) time as follows. First, for any pair (i, j) of integers such that 1 ≤ i < j ≤ n we check whether Gi,j is a monotone path. There are O(n2) such pairs of integers; further, for each pair (i, j), the monotonicity of Gi,j can be tested in O(n) time by simply checking whether all the edges of Gi,j are directed from ui to uj, or whether they are all directed from uj to ui. For each pair (i, j) such that Gi,j is monotone and its edges are directed from ui to uj (from uj to ui), we give value true to the entry t(ui, uj, ui, uj) (resp. t(ui, uj, uj, ui)) and false to all the other entries t(ui, uj, um, uM ); there are O(n2) such entries, hence the quartic running time. We now turn to the computation of the values of the entries t(ui, uj, um, uM ) such that Gi,j is not a monotone path. Consider a pair (i, j) of integers such that 1 ≤ i < j ≤ n, such that the values of the entries t(ui, uj, um, uM ) have not been determined yet, and such that the values of the entries t(ui(cid:48), uj(cid:48), um(cid:48), uM(cid:48)) have been determined for all the pairs (i(cid:48), j(cid:48)) of integers such that j(cid:48) − i(cid:48) < j − i. There are O(n2) such pairs (i, j). We perform the following preliminary check. For each index m ∈ {i + 1, . . . , j − 1}, we check whether any of the entries t(ui, um, um, uM(cid:48)) has value true, over all the indices M(cid:48) ∈ {i, . . . , m − 1}. There are O(n) indices m to be considered and for each of them we check the value of O(n) entries, hence this takes O(n2) time for the pair (i, j), and hence O(n4) time over all the pairs (i, j). Analogously, we check for each index M ∈ {i + 1, . . . , j − 1} whether any of the entries t(ui, uM , um(cid:48), uM ) has value true, for each index m ∈ {i + 1, . . . , j − 1} whether any of the entries t(um, uj, um, uM(cid:48)) has value true, and for each index M ∈ {i + 1, . . . , j − 1} whether any of the entries t(uM , uj, um(cid:48), uM ) has value true. This information can be stored in a separate table, whose entries are of the form t(ui, um, um,·), t(ui, uM ,·, uM ), t(um, uj, um,·), and t(uM , uj,·, uM ). By means of Claim 6, we now determine the values of the entries t(ui, uj, um, uM ) such that neither um nor uM is an end-vertex of Gi,j. For each entry t(ui, uj, um, uM ) such that i < m < M < j (the entries such that i < M < m < j are dealt with analogously) we test in O(1) time whether Conditions 1 -- 3 are satisfied by checking whether t(ui, um, um,·) = true, whether t(um, uM , um, uM ) = true, and whether t(uM , uj,·, uM ) = true. Condition 4 can be tested in O(1) time by checking whether um ∈ V (H) and, in case it does, whether y(um) is the smallest y-coordinate among the vertices in V (H) ∩ ΓH,i,j -- this information was computed at the beginning of the algorithm. Condition 5 can be tested in O(1) time analogously. Next, by means of Claim 7, we determine the values of the entries t(ui, uj, um, uM ) such that one of um and uM is an end-vertex of Gi,j. For each entry t(ui, uj, ui, uM ) (the entries t(ui, uj, uj, uM ), t(ui, uj, um, ui), and t(ui, uj, um, uj) are dealt with analogously) we test in O(1) time whether Conditions 1 -- 2 are satisfied by checking whether t(ui, uM , ui, uM ) = true and whether t(uM , uj,·, uM ) = true. Condition 3 can be tested in O(1) time by checking whether um ∈ V (H) and, in case it does, whether y(um) is the smallest y-coordinate among the vertices in V (H) ∩ ΓH,i,j. Finally, by means of Claim 8, we determine the values of the entries t(ui, uj, um, uM ) such that both um and uM are end-vertices of Gi,j. For each entry t(ui, uj, ui, uj) (the entries t(ui, uj, uj, ui) are dealt with analogously) we test in O(n2) time whether Conditions 1 -- 6 are satisfied as follows. First, we test in O(1) time whether Condition 4 is satisfied by checking whether um ∈ V (H) and, in case it does, whether y(um) is the smallest y-coordinate among the vertices in V (H)∩ ΓH,i,j. Condition 5 can be tested in O(1) time analogously. In order to test Conditions 1 -- 3 and Condition 6, we consider all the pairs of indices (M(cid:48), m(cid:48)) with M(cid:48) ∈ {i + 1, . . . , j − 2} and m(cid:48) ∈ {M(cid:48) + 1, . . . , j − 1}. For each such pair (M(cid:48), m(cid:48)) we check in O(1) time whether t(ui, uM(cid:48), ui, uM(cid:48)) = true, whether t(uM(cid:48), um(cid:48), um(cid:48), uM(cid:48)) = true, whether t(um(cid:48), uj, um(cid:48), uj) = true, and whether P(uM(cid:48)) = [uM(cid:48)−1, uM(cid:48)+1] and S(um(cid:48)) = [um(cid:48)−1, um(cid:48)+1], or P(uM(cid:48)) = [uM(cid:48)+1, uM(cid:48)−1] and S(um(cid:48)) = [um(cid:48)+1, um(cid:48)−1]. Note that there are O(n2) entries t(ui, uj, ui, uj); for each of them we consider O(n2) pairs of indices (M(cid:48), m(cid:48)), and then we check the above conditions in (cid:117)(cid:116) O(1) time. Thus the total running time is O(n4). By exploiting arguments analogous to those in the proof of Theorem 6 we can extend our quartic-time algorithm to cycles. Theorem 7. The UPE-FUE problem can be solved in O(n4) time for instances (cid:104)G, H, ΓH(cid:105) such that G is an n-vertex cycle with given upward embedding, H contains no edges, and no two vertices share the same y-coordinate in ΓH . 31 Proof. Let G = (u1, . . . , un). Suppose that an upward planar drawing ΓG of G extending ΓH exists. Let yM be the largest y-coordinate of a vertex in ΓG. Then it can be assumed without loss of generality that there is a unique vertex uM in ΓG such that y(uM ) = yM . Indeed, if more than one vertex has y-coordinate equal to yM in ΓG, then at least one vertex v exists such that y(v) = yM and v /∈ V (H). Hence v can be moved upwards and its incident edges can be extended upwards as well, so that v becomes the unique vertex with the largest y-coordinate in ΓG. It can be analogously assumed that there is a vertex um in ΓG whose y-coordinate is smaller than the one of every other vertex. Our strategy is to test, for every possible pair of vertices (um, uM ) with m, M ∈ {1, . . . , n} and with m (cid:54)= M , whether there is an upward planar drawing ΓG of G extending ΓH in which the vertices with the smallest and largest y-coordinate are um and uM , respectively. For any pair (um, uM ), the cycle G consists of two directed paths connecting um and uM , call them Gm,M = (um, um+1, . . . , uM ) and GM,m = (uM , uM +1, . . . , um), where indices are modulo n. Let ΓH,m,M and ΓH,M,m be the restrictions of ΓH to the vertices that belong to Gm,M and GM,m, respectively. The following claim is the key ingredient for the proof of the theorem. Claim 9 G has an upward planar drawing extending ΓH in which the vertices with the smallest and largest y-coordinate are um and uM , respectively, if and only if: (1) Gm,M has an upward planar drawing extending ΓH,m,M in which the vertices with the smallest and largest y-coordinate are um and uM , respectively; (2) GM,m has an upward planar drawing extending ΓH,M,m in which the vertices with the smallest and (3) either P(uM ) = [uM−1, uM +1] and S(um) = [um+1, um−1], or P(uM ) = [uM +1, uM−1] and S(um) = largest y-coordinate are um and uM , respectively; and [um−1, um+1]. Proof. Suppose that G has an upward planar drawing ΓG extending ΓH in which the vertices with the smallest and largest y-coordinate are um and uM , respectively. Restricting ΓG to the vertices and edges of Gm,M yields an upward planar drawing ΓG,m,M of Gm,M that extends ΓH,m,M and in which um and uM are the vertices with the smallest and largest y-coordinate, respectively. This proves the necessity of Condition (1). The necessity of Condition (2) is proved analogously. In order to prove the necessity of Condition (3) suppose, for a contradiction, that P(uM ) = [uM−1, uM +1] and S(um) = [um−1, um+1] (the case in which P(uM ) = [uM +1, uM−1] and S(um) = [um+1, um−1] can be treated analogously). Let hM and hm be the horizontal lines passing through uM and um in ΓG, respectively. The path Gm,M divides the strip delimited by hM and hm into two regions Rl and Rr, to the left and to the right of Gm,M , respectively. Since P(uM ) = [uM−1, uM +1] and S(um) = [um−1, um+1], and by the upward planarity of ΓG, it follows that um−1 and uM +1 are in Rl and Rr, respectively. Hence, the path GM +1,m−1 crosses the boundary of such regions. Since um and uM have the smallest and largest y-coordinate among the vertices in ΓG, and by the upwardness of ΓG, it follows that GM +1,m−1 does not cross hM or hm, hence it crosses Gm,M , a contradiction to the planarity of ΓG. The proof of the sufficiency is similar to the ones of Claims 6 to 8. Namely, we start from upward planar drawings ΓG,m,M and ΓG,M,m of Gm,M and GM,m extending ΓH,m,M and ΓH,M,m, respectively, in which the vertex with the smallest y-coordinate is um and the vertex with the largest y-coordinate is uM . These drawings exist by Conditions (1) and (2). We then modify ΓG,m,M and ΓG,M,m so that the following properties hold: Gluing together ΓG,m,M and ΓG,M,m results in an upward drawing Γ (cid:48) (i) uM is at the same point in ΓG,m,M and ΓG,M,m; and (ii) um is at the same point in ΓG,m,M and ΓG,M,m. If uM ∈ V (H), then Property (i) is already satisfied by ΓG,m,M and ΓG,M,m; on the other hand, if uM /∈ V (H), then we redraw uM and parts of its incident edges so to let uM be at the same point in ΓG,m,M and ΓG,M,m. Property (ii) is satisfied analogously. G of G that extends ΓH and in which um and uM are the vertices with the smallest and largest y-coordinate, respectively. However, Γ (cid:48) G might contain crossings. Hence, we redraw the curves representing the edges of Gm,M and GM,m, while leaving the position of every vertex unaltered. This is done by defining two internally-disjoint regions Rm,M and RM,m containing in their interiors the points at which the vertices of Gm,M and GM,m are placed in Γ (cid:48) G, respectively, except for um and uM which are on the boundary of both Rm,M and RM,m. These regions are delimited by the horizontal lines hm and hM through um and uM , and by a y-monotone 32 curve γ connecting um with uM . The curve γ is defined so that Rm,M is to the left of RM,m in the case in which P(uM ) = [uM−1, uM +1] and S(um) = [um+1, um−1], or so that Rm,M is to the right of RM,m in the case in which P(uM ) = [uM +1, uM−1] and S(um) = [um−1, um+1]. One of the two cases happens, because of Condition (3). We now redraw the edges of Gm,M and GM,m inside Rm,M and RM,m, respectively. The drawing ΓG obtained as the union of the constructed drawings of Gm,M and GM,m is the desired (cid:117)(cid:116) drawing of G. This completes the proof of the claim. From a computational point of view, we act as follows. First we compute, for every possible pair of vertices (um, uM ) with m, M ∈ {1, . . . , n} and with m (cid:54)= M , whether there are upward planar drawings of Gm,M and GM,m extending ΓH,m,M and ΓH,M,m, respectively, in which the vertex with the smallest y-coordinate is um and the vertex with the largest y-coordinate is uM . This can be done by considering the 2n-vertex path (u1, u2, . . . , un, un+1 = u1, un+2 = u2, . . . , u2n = un) and by setting up a dynamic programming table with entries t(ui, uj, um(cid:48), uM(cid:48)), for all the indices i, j, m(cid:48), M(cid:48) ∈ {1, . . . , 2n} such that i ≤ m(cid:48) ≤ j and i ≤ M(cid:48) ≤ j, with i (cid:54)= j, m(cid:48) (cid:54)= M(cid:48), and j − i ≤ n. The values of the entries of this table can be computed in total O(n4) time as in the proof of Theorem 6. Now, for each of the O(n2) pairs of vertices (um, uM ) with m, M ∈ {1, . . . , n} and with m (cid:54)= M , we exploit Claim 9 in order to check whether G has an upward planar drawing extending ΓH in which the vertices with the smallest and largest y-coordinate are um and uM , respectively. Concerning Conditions (1) and (2), we check in O(1) time whether t(um, uM , um, uM ) = true and t(uM , un+m, un+m, uM ) = true (if m < M ) or whether t(uM , um, um, uM ) = true and t(um, un+M , um, un+M ) = true (if m > M ). (cid:117)(cid:116) Condition (3) can also be trivially checked in O(1) time. This concludes the proof of the theorem. It turns out that directed paths and cycles are much easier to handle in the case in which they do not come with a given upward embedding, as in the next theorem. Theorem 8. The UPE problem can be solved in O(n) time for instances (cid:104)G, H, ΓH(cid:105) such that G is an n-vertex directed path or cycle, H contains no edges, and no two vertices share the same y-coordinate in ΓH . Proof. Suppose first that G is a directed path. We partition G into k monotone paths Gi = (ui for some integer k ≥ 1. Assume that the edge (u1 symmetric. Then for every odd i we have that ui that ui h(i)), 2, the other case being h(i+1) is a sink, while for every even i we have is a source. Our algorithm is based on the following characterization. 1, u1 h(i) = ui+1 1 and entering u1 2) is exiting u1 2, . . . , ui 1, ui 1 = ui+1 1 j(cid:48) ∈ V (H), it holds true that y(ui Claim 10 There exists an upward planar drawing of G extending ΓH if and only if, for every i, j, and j(cid:48) with j < j(cid:48) such that ui Proof. The necessity is trivial. Indeed, if there are indices i, j, and j(cid:48) with j < j(cid:48) such that ui and such that y(ui of G extending ΓH . j(cid:48) ∈ V (H) h(i)) cannot be upward in any drawing j(cid:48)), then the monotone path (ui j(cid:48)) in ΓH . j) < y(ui j) > y(ui 2, . . . , ui 1, ui j, ui j, ui 1, ui 2, . . . , ui For the sufficiency, we construct an upward planar drawing ΓG of G extending ΓH by drawing one monotone path Gi = (ui h(i)) at a time. Roughly speaking, this is done by drawing Gi "to the right" of what has been drawn so far. More precisely, for any i = 1, . . . , k, consider the path G1,...,i = (G1 ∪ ··· ∪ Gi) and let the end-vertex of G1,...,i different from u1 1 be the last vertex of G1,...,i. Denote by ΓH,i the restriction of ΓH to the vertices in G1,...,i. We show how to construct an upward planar drawing Γi of G1,...,i that extends ΓH,i and such that the last vertex of G1,...,i is visible from the right (meaning that a half-line starting at the last vertex and directed rightwards does not intersect Γi other than at its starting point). Assume that i is odd, the case in which i is even is similar. Then ui−1 1 is a source and is visible from the right in Γi−1 (the latter condition is vacuously true if i = 1). 1 = ui We proceed similarly to the proofs of Claims 6 to 8. Namely, we consider a y-monotone curve γi passing 1, having the vertices in V (G1,...,i−1) -- as they are placed in Γi−1 -- to the left (except for through ui 1) and the vertices in V (H) ∩ (V (Gi) ∪ ··· ∪ V (Gk)) to the right (except for ui ui 1). We redraw parts of the edges of G1,...,i−1 so that Γi−1 entirely lies to the left of γi, except at ui 1; note that this is possible 1 /∈ V (H) we further modify Γi−1 by moving ui because ui 1 downwards along γi and by extending the edge (ui−1 ) downwards as well (while keeping it to the left of γi), so that 1 ∈ V (H), y(ui then it is the condition of the claim that guarantees that y(ui 1) is smaller than the y-coordinate of every 1) is smaller than the y-coordinate of every vertex different from ui 1 is visible from the right. If ui , ui−1 2 1 in V (H) ∩ V (Gi). If ui 1 33 vertex in V (H) ∩ V (Gi). We next construct an upward planar drawing Gi of Gi, possibly intersecting Γi−1, extending the restriction of ΓH to the vertices in V (H) ∩ V (Gi). This is done by drawing Gi as a y-monotone curve passing through the vertices in V (H) ∩ V (Gi) and by then placing the vertices in V (Gi) not in V (H) at suitable points on this curve. Finally, we redraw parts of the edges of Gi so that Gi 1. Now there is no crossing between the edges in Γi−1 and those entirely lies to the right of γi, except at ui in Gi; further, ui h(i) is visible from the right. Hence, when i = k this algorithm constructs an upward (cid:117)(cid:116) planar drawing ΓG of G extending ΓH . The condition in Claim 10 can be easily checked in O(n) time. Indeed, each path (ui h(i)) can be independently traversed from ui h(i) while keeping track of the y-coordinate of the last encountered vertex in V (H): If the y-coordinate of any vertex in V (H) is smaller than the y-coordinate of the previous vertex in V (H), then the condition is not satisfied; vertices not in V (H) are ignored. 2, . . . , ui 1 to ui 1, ui 1, ui 2, . . . , ui 1 and a sink uj We now turn our attention to the case in which G is a cycle. We again partition G into k monotone h(i)), for some integer k ≥ 2. Then the characterization stated in Claim 10 paths Gi = (ui applies to this case as well. Whether (cid:104)G, H, ΓH(cid:105) satisfies the characterization can be checked in O(n) time, as for directed paths. The necessity of the characterization can be proved as in Claim 10. The sufficiency can also be proved similarly to Claim 10, however with one more ingredient. Namely, we have to find a source ui h(j) (possibly i = j) which are going to be the vertices with the smallest and largest y-coordinate in the upward planar drawing of G extending ΓH which we are going to construct. Any source ui 1 of G not in H can in fact be selected for the task; if all the sources of G are in H, then the source ui h(j) can be chosen analogously. We now split G into two directed paths G1 and G2 between ui h(j). We independently construct upward planar drawings ΓG1 and ΓG2 of G1 and G2 extending ΓH1 and ΓH2, respectively, in which the vertex with the smallest y-coordinate is ui h(j) -- ΓH1 and ΓH2 are the restrictions of ΓH to the vertices in V (H) ∩ V (G1) and in V (H) ∩ V (G2), respectively. The drawings ΓG1 and ΓG2 can be constructed as in the proof of Claim 10. We then modify ΓG1 and ΓG2 as in Claim 9 so that: 1 with the smallest y-coordinate can be chosen instead. The sink uj 1 and the vertex with the largest y-coordinate is uj 1 and uj 1 is at the same point in ΓG1 and ΓG2; and h(j) is at the same point in ΓG1 and ΓG2. (i) ui (ii) uj Gluing together ΓG1 and ΓG2 results in an upward drawing Γ (cid:48) G of G that extends ΓH and in which ui 1 and uj G might contain crossings. Hence, we redraw the curves representing the edges of G1 and G2, while leaving the (cid:117)(cid:116) position of every vertex unaltered. This is done again as in the proof of Claim 9. h(j) are the vertices with the smallest and largest y-coordinate, respectively. However, Γ (cid:48) 6 Conclusions and Open Problems In this paper we introduced and studied the Upward Planarity Extension (UPE) problem, which takes in input an upward planar drawing ΓH of a subgraph H of a directed graph G and asks whether an upward planar drawing of G exists which coincides with ΓH when restricted to the vertices and edges of H. We proved that the UPE problem is NP-complete, even if G has a prescribed upward embedding and H contains all the vertices and no edges. Conversely, the problem can be solved efficiently for upward planar st-graphs. Several questions are left open by our research. We cite our favorite two. First, is it possible to solve the UPE-FUE problem in polynomial time for instances (cid:104)G, H, ΓH(cid:105) such that H contains no edges and no two vertices have the same y-coordinate in ΓH ? We proved that if any of the two conditions is dropped, then the UPE-FUE problem is NP-hard, however we can only provide a positive answer to the above question if we further assume that G is a directed path or cycle. Second, are the UPE and UPE-FUE problems polynomial-time solvable for directed paths and cycles? Even with the assumption that H contains no edges and no two vertices have the same y-coordinate in ΓH , answering the above question in the affirmative was not a trivial task. Acknowledgments. Lemma 6 comes from a research session the third author had with Ignaz Rutter, to which our thanks go. 34 References 1. P. Angelini, G. Da Lozzo, G. Di Battista, V. Di Donato, P. Kindermann, G. Rote, and I. Rutter. Windrose planarity: Embedding graphs with direction-constrained edges. ACM Trans. Algorithms, 14(4):54:1 -- 54:24, 2018. 2. P. Angelini, G. Da Lozzo, G. Di Battista, and F. Frati. Strip planarity testing for embedded planar graphs. Algorithmica, 77(4):1022 -- 1059, 2017. 3. P. Angelini, G. Di Battista, F. Frati, V. Jel´ınek, J. Kratochv´ıl, M. Patrignani, and I. Rutter. Testing planarity of partially embedded graphs. ACM Trans. Algorithms, 11(4):32:1 -- 32:42, 2015. 4. P. Bertolazzi, G. Di Battista, and W. Didimo. Quasi-upward planarity. Algorithmica, 32(3):474 -- 506, 2002. 5. P. Bertolazzi, G. Di Battista, G. Liotta, and C. Mannino. Upward drawings of triconnected digraphs. Algorithmica, 12(6):476 -- 497, 1994. 6. P. Bertolazzi, G. Di Battista, C. Mannino, and R. Tamassia. Optimal upward planarity testing of single-source digraphs. SIAM J. Comput., 27(1):132 -- 169, 1998. 7. C. Binucci and W. Didimo. Computing quasi-upward planar drawings of mixed graphs. Comput. J., 59(1):133 -- 150, 2016. 8. F. Brandenburg. Upward planar drawings on the standing and the rolling cylinders. Comput. Geom., 47(1):25 -- 41, 2014. 9. G. Bruckner and I. Rutter. Partial and constrained level planarity. In P. N. Klein, editor, SODA 2017, pages 2000 -- 2011. SIAM, 2017. 10. S. Chaplick, M. Chimani, S. Cornelsen, G. Da Lozzo, M. Nollenburg, M. Patrignani, I. G. Tollis, and A. Wolff. Planar l-drawings of directed graphs. In F. Frati and K.-L. Ma, editors, GD 2017, volume 10692 of LNCS, pages 465 -- 478. Springer, 2017. 11. S. Chaplick, P. Dorbec, J. Kratochv´ıl, M. Montassier, and J. Stacho. Contact representations of planar graphs: Extending a partial representation is hard. In D. Kratsch and I. Todinca, editors, WG 2014, volume 8747 of LNCS, pages 139 -- 151. Springer, 2014. 12. S. Chaplick, R. Fulek, and P. Klav´ık. Extending partial representations of circle graphs. In S. K. Wismath and A. Wolff, editors, GD 2013, volume 8242 of LNCS, pages 131 -- 142. Springer, 2013. 13. S. Chaplick, G. Guspiel, G. Gutowski, T. Krawczyk, and G. Liotta. The partial visibility representation extension problem. Algorithmica, 80(8):2286 -- 2323, 2018. 14. G. Da Lozzo, G. Di Battista, F. Frati, M. Patrignani, and V. Roselli. Upward planar morphs. In T. C. Biedl and A. Kerren, editors, GD 2018, volume 11282 of LNCS, pages 92 -- 105. Springer, 2018. 15. G. Di Battista and R. Tamassia. Algorithms for plane representations of acyclic digraphs. Theor. Comput. Sci., 61:175 -- 198, 1988. 16. G. Di Battista and R. Tamassia. On-line planarity testing. SIAM J. Comput., 25(5):956 -- 997, 1996. 17. G. Di Battista, R. Tamassia, and I. G. Tollis. Area requirement and symmetry display of planar upward drawings. Discrete & Comput. Geometry, 7:381 -- 401, 1992. 18. J. Fiala. NP completeness of the edge precoloring extension problem on bipartite graphs. Journal of Graph Theory, 43(2):156 -- 160, 2003. 19. A. Garg and R. Tamassia. On the computational complexity of upward and rectilinear planarity testing. SIAM J. Comput., 31(2):601 -- 625, 2001. 20. V. Jel´ınek, J. Kratochv´ıl, and I. Rutter. A Kuratowski-type theorem for planarity of partially embedded graphs. Comput. Geom., 46(4):466 -- 492, 2013. 21. M. Junger, S. Leipert, and P. Mutzel. Level planarity testing in linear time. In S. Whitesides, editor, GD'98, volume 1547 of LNCS, pages 224 -- 237. Springer, 1998. 22. P. Klav´ık, J. Kratochv´ıl, T. Krawczyk, and B. Walczak. Extending partial representations of function graphs and permutation graphs. In L. Epstein and P. Ferragina, editors, ESA 2012, volume 7501 of LNCS, pages 671 -- 682. Springer, 2012. 23. P. Klav´ık, J. Kratochv´ıl, Y. Otachi, I. Rutter, T. Saitoh, M. Saumell, and T. Vyskocil. Extending partial representations of proper and unit interval graphs. Algorithmica, 77(4):1071 -- 1104, 2017. 24. P. Klav´ık, J. Kratochv´ıl, Y. Otachi, and T. Saitoh. Extending partial representations of subclasses of chordal graphs. Theor. Comput. Sci., 576:85 -- 101, 2015. 25. P. Klav´ık, J. Kratochv´ıl, Y. Otachi, T. Saitoh, and T. Vyskocil. Extending partial representations of interval graphs. Algorithmica, 78(3):945 -- 967, 2017. 26. B. Klemz and G. Rote. Ordered level planarity, geodesic planarity and bi-monotonicity. In F. Frati and K. L. Ma, editors, GD 17, volume 10692 of LNCS, pages 440 -- 453. Springer, 2017. 27. J. Kratochv´ıl and A. Sebo. Coloring precolored perfect graphs. Journal of Graph Theory, 25(3):207 -- 215, 1997. 28. M. Patrignani. On extending a partial straight-line drawing. Int. J. Found. Comput. Sci., 17(5):1061 -- 1070, 2006. 29. A. Rextin and P. Healy. Dynamic upward planarity testing of single source embedded digraphs. Comput. J., 60(1):45 -- 59, 2017. 30. R. Tamassia. On embedding a graph in the grid with the minimum number of bends. SIAM J. Comput., 16(3):421 -- 444, 1987. 35
1602.07422
2
1602
2016-03-07T09:32:20
The robust recoverable spanning tree problem with interval costs is polynomially solvable
[ "cs.DS" ]
In this paper the robust recoverable spanning tree problem with interval edge costs is considered. The complexity of this problem has remained open to date. It is shown that the problem is polynomially solvable, by using an iterative relaxation method. A generalization of this idea to the robust recoverable matroid basis problem is also presented. Polynomial algorithms for both robust recoverable problems are proposed.
cs.DS
cs
The robust recoverable spanning tree problem with interval costs is polynomially solvable Mikita Hradovich†, Adam Kasperski‡, Pawe l Zieli´nski† †Faculty of Fundamental Problems of Technology, Wroc law University of Technology, Wroc law, Poland ‡Faculty of Computer Science and Management, Wroc law University of Technology, Wroc law, Poland {mikita.hradovich,adam.kasperski,pawel.zielinski}@pwr.edu.pl Abstract In this paper the robust recoverable spanning tree problem with interval edge costs is considered. The complexity of this problem has remained open to date. It is shown that the problem is polynomially solvable, by using an iterative relaxation method. A gener- alization of this idea to the robust recoverable matroid basis problem is also presented. Polynomial algorithms for both robust recoverable problems are proposed. Keywords: robust optimization; interval data; spanning tree; matroids 1 Introduction In this paper, we wish to investigate the robust recoverable version of the following minimum spanning tree problem. We are given a connected graph G = (V, E), where V = n and E = m. Let Φ be the set of all spanning trees of G. For each edge e ∈ E a nonnegative cost ce is given. We seek a spanning tree of G of the minimum total cost. The minimum spanning tree problem can be solved in polynomial time by several well known algorithms (see, e.g. [1]). In this paper we consider the robust recoverable model, previously discussed in [3, 4, 12]. We are given first stage edge costs Ce, e ∈ E, recovery parameter k ∈ {0, . . . , n−1}, and uncertain second stage (recovery) edge costs, modeled by scenarios. Namely, each particular realization of the second stage costs S = (cS e )e∈E is called a scenario and the set of all possible scenarios is denoted by U . In the robust recoverable spanning tree problem (RR ST, for short), we Then, after scenario S ∈ U reveals, X can be modified by exchanging up to k edges. This new tree is denoted by Y , where Y \ X = X \ Y ≤ k. The second stage cost of Y under e . Our goal is to find a pair of trees X and Y such that e in the choose an initial spanning tree X in the first stage. The cost of this tree is equal to Pe∈X Ce. scenario S ∈ U is equal to Pe∈Y cS X \ Y ≤ k, which minimize the total fist and second stage cost Pe∈X Ce +Pe∈Y cS worst case. Hence, the problem RR ST can be formally stated as follows: where Φk the second, recovery stage. X = {Y ∈ Φ : Y \ X ≤ k} is the recovery set, i.e. the set of possible solutions in cS e! , (1) RR ST : min X∈Φ Xe∈X Ce + max S∈U min Y ∈Φk XXe∈Y 1 The RR ST problem has been recently discussed in a number of papers. It is a special case of the robust spanning tree problem with incremental recourse considered in [14]. Fur- thermore, if k = 0 and Ce = 0 for each e ∈ E, then the problem is equivalent to the robust min-max spanning tree problem investigated in [10, 9]. The complexity of RR ST depends on the way in which scenario set U is defined. If U = {S1, . . . , SK} contains K ≥ 1, explic- itly listed scenarios, then the problem is known to be NP-hard for K = 2 and any constant k ∈ {0, . . . , n − 1} [8]. Furthermore, it becomes strongly NP-hard and not at all approximable when both K and k are part of input [8]. Assume now that the second stage cost of each edge e ∈ E is known to belong to the closed interval [ce, ce + de], where de ≥ 0. Scenario set U l is then the subset of the Cartesian product Qe∈E[ce, ce + de] such that in each scenario in U l, the costs of at most l edges are greater than their nominal values ce, l ∈ {0, . . . , m}. Scenario set U l has been proposed in [2]. The parameter l allows us to model the degree of uncertainty. Namely, if l = 0 then U contains only one scenario. The problem RR ST for scenario set U l is known to be strongly NP-hard when l is a part of input [14]. In fact, the e , called the adversarial problem, is then strongly inner problem, maxS∈U l minY ∈Φk NP-hard [14]. On the other hand, U m is the Cartesian product of all the uncertainty intervals, and represents the traditional interval uncertainty representation [10]. XPe∈Y cS X whose total cost is minimal. The complexity of RR ST with scenario set U m is open to date. In [5] the incremental spanning tree problem was discussed. In this problem we are given an initial spanning tree X and we seek a spanning tree Y ∈ Φk It is easy to see that this problem is the inner one in RR ST, where X is fixed and U contains only one scenario. The incremental spanning tree problem can be solved in polynomial time by applying the Lagrangian relaxation technique [5]. In [3] a polynomial algorithm for a more general recoverable matroid basis problem (RR MB, for short) with scenario set U m was proposed, provided that the recovery parameter k is constant and, in consequence, for RR ST (a spanning tree is a graphic matroid). Unfortunately, the algorithm is exponential in k. No other result on the problem is known to date. In particular, no polynomial time algorithm has been developed when k is a part of the input. In this paper we show that RR ST for the interval uncertainty representation (i.e. for scenario set U m) is polynomially solvable (Section 2). We apply a technique called the it- erative relaxation, whose framework was described in [11]. The idea is to construct a linear programming relaxation of the problem and show that at least one variable in each optimum vertex solution is integer. Such a variable allows us to add an edge to the solution built and recursively solve the relaxation of the smaller problem. We also show that this technique al- lows us to solve the recoverable matroid basis problem (RR MB) for the interval uncertainty representation in polynomial time (Section 3). We provide polynomial algorithms for RR ST and RR MB. 2 Robust recoverable spanning tree problem In this section we will use the iterative relaxation method [11] to construct a polynomial algorithm for RR ST under scenario set U m. Notice first that, in this case, the formulation (1) can be rewritten as follows: RR ST : min X∈Φ Xe∈X Ce + min Y ∈Φk XXe∈Y (ce + de)! . (2) 2 In problem (2) we need to find a pair of spanning tree X ∈ Φ and Y ∈ Φk V − 1, the problem (2) is equivalent the following mathematical programming problem: X . Since X = Y = min Pe∈X Ce +Pe∈Y (ce + de) X ∩ Y ≥ V − 1 − k, X, Y ∈ Φ. s.t. (3) We now set up some additional notation. Let VX and VY be subsets of vertices V , and EX and EY be subsets of edges E, which induce connected graphs (multigraphs) GX = (VX , EX ) and GY = (VY , EY ), respectively. Let EZ be a subset of E such that EZ ⊆ EX ∪ EY and EZ ≥ L for some fixed integer L. We will use EX(U ) (resp. EY (U )) to denote the set of edges that has both endpoints in a given subset of vertices U ⊆ VX (resp. U ⊆ VY ). Let us consider the following linear program, denoted by LPRRST (EX , VX , EY , VY , EZ , L), that we will substantially use in the algorithm for RR ST: min Xe∈EX Cexe + Xe∈EY s.t. Xe∈EX Xe∈EX (U ) (ce + de)ye xe = VX − 1, xe ≤ U − 1, −xe + ze ≤ 0, ze = L, Xe∈EZ ze − ye ≤ 0, ye = VY − 1, ∀U ⊂ VX, ∀e ∈ EX ∩ EZ , ∀e ∈ EY ∩ EZ , Xe∈EY Xe∈EY (U ) ye ≤ U − 1, ∀U ⊂ VY , xe ≥ 0, ze ≥ 0, ye ≥ 0, ∀e ∈ EX, ∀e ∈ EZ , ∀e ∈ EY . (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) It is easily seen that if we set EX = EZ = EY = E, VX = VY = V , L = V − 1 − k, then the linear program LPRRST (EX , VX, EY , VY , EZ , L) is a linear programming relaxation Indeed, the binary variables xe, ye, ze ∈ {0, 1} indicate then the spanning trees X of (3). and Y and their common part X ∩ Y , respectively. Moreover, the constraint (8) takes the form of equality, instead of the inequality, since the variables ze, e ∈ EZ , are not present in the objective function (4). Problem LPRRST (EX , VX , EY , VY , EZ , L) has exponentially many constraints. However, the constraints (5), (6) and (10), (11) are the spanning tree ones for graphs GX = (VX , EX ) and GY = (VY , EY ), respectively. Fortunately, there exits a polyno- mial time separation oracle over such constraints [13]. Clearly, separating over the remaining constraints, i.e. (7), (8) and (9) can be done in a polynomial time. In consequence, an optimal vertex solution to the problem can be found in polynomial time. It is also worth pointing out that, alternatively, one can rewrite (4), (5), (6), (12), (10) and (14) in a "compact" form that has the polynomial number of variables and constraints (see [13]). 3 Let us focus now on a vertex solution (xxx, zzz, yyy) ∈ R of the linear programming problem LPRRST (EX, VX , EY , VY , EZ , L). If EZ = ∅, then the only constraints being left in (4)-(14) are the spanning tree constraints. Thus xxx and yyy are 0-1 incidence vectors of the spanning trees X and Y , respectively (see [13, Theorem 3.2]). EX ×EZ×EY ≥0 We now turn to a more involved case, when EX 6= ∅, EY 6= ∅ and EZ 6= ∅. We first reduce the sets EX, EY and EZ by removing all edges e with xe = 0, or ye = 0, or ze = 0. Removing these edges does not change the feasibility and the cost of the vertex solution (xxx, zzz, yyy). Note that VX and VY remain unaffected. From now on, we can assume that variables corresponding to all edges from EX , EY and EZ are positive, i.e. xe > 0, e ∈ EX , ye > 0, e ∈ EY and ze > 0, e ∈ EZ . Hence the constraints (12), (13) and (14) are not taken into account, since they are not tight with respect to (xxx, zzz, yyy). It is possible, after reducing EX , EY , and EZ , to characterize (xxx, zzz, yyy) by EX + EZ + EY constraints that are linearly independent and tight with respect to (xxx, zzz, yyy). Let F(xxx) = {U ⊆ VX : Pe∈EX (U ) xe = U − 1} and F(yyy) = {U ⊆ VY : Pe∈EY (U ) ye = U − 1} stand for the sets of subsets of nodes that indicate the tight constraints (5), (6) and (10), (11) for xxx and yyy, respectively. Similarly we define the sets of edges that indicate the tight constraints (7) and (9) with respect to (xxx, zzz, yyy), namely E(xxx, zzz) = {e ∈ EX ∩EZ : −xe+ze = 0} and E(zzz, yyy) = {e ∈ EY ∩ EZ : ze − ye = 0}. Let χX (W ), W ⊆ EX , (resp. χZ(W ), W ⊆ EZ , and χY (W ), W ⊆ EY ) denote the characteristic vector in {0, 1}EX × {0}EZ × {0}EY (resp. {0}EX × {0, 1}EZ × {0}EY and {0}EX × {0}EZ × {0, 1}EY ) that has 1 if e ∈ W and 0 otherwise. We recall that two sets A and B are intersecting if A ∩ B, A \ B, B \ A are nonempty. A family of sets is laminar if no two sets are intersecting (see, e.g., [11]). Observe that the number of subsets in F(xxx) and F(yyy) can be exponential. Let L(xxx) (resp. L(yyy)) be a maximal laminar subfamily of F(xxx) (resp. F(yyy)). The following lemma, which is a slight extension of [11, Lemma 4.1.5], allows us to choose out of F(xxx) and F(yyy) certain subsets that indicate linearly independent tight constraints. Lemma 1. For L(xxx) and L(yyy) the following equalities: span({χX (EX (U )) : U ∈ L(xxx)}) = span({χX (EX (U )) : U ∈ F(xxx)}), span({χY (EY (U )) : U ∈ L(yyy)}) = span({χY (EY (U )) : U ∈ F(yyy)}) hold. Proof. The proof is the same as that for the spanning tree in [11, Lemma 4.1.5]. A trivial verification shows that the following observation is true: Observation 1. VX ∈ L(xxx) and VY ∈ L(yyy). We are now ready to give a characterization of a vertex solution. Lemma 2. Let (xxx, zzz, yyy) be a vertex solution of LPRRST (EX , VX , EY , VY , EZ ) such that xe > 0, e ∈ EX , ye > 0, e ∈ EY and ze > 0, e ∈ EZ . Then there exist laminar families L(xxx) 6= ∅ and L(yyy) 6= ∅ and subsets E(xxx, zzz) ⊆ E(xxx, zzz) and E(zzz, yyy) ⊆ E(zzz, yyy) that must satisfy the following: (i) EX + EZ + EY = L(xxx) + E(xxx, zzz) + E(zzz, yyy) + L(yyy) + 1, 4 (ii) the vectors in {χX (EX (U )) : U ∈ L(xxx)} ∪ {χY (EY (U )) : U ∈ L(yyy)} ∪ {−χX({e}) + χZ ({e}) : e ∈ E(xxx, zzz)} ∪ {χZ ({e}) − χY ({e}) : e ∈ E(zzz, yyy)} ∪ {χZ (EZ )} are linearly independent. Proof. The vertex (xxx, zzz, yyy) can be uniquely characterized by any set of linearly independent constraints with the cardinality of EX + EZ + EY , chosen from among the constraints (5)- (11), tight with respect to (xxx, zzz, yyy). We construct such set by choosing a maximal subset of lin- early independent tight constraints that characterizes (xxx, zzz, yyy). Lemma 1 shows that there ex- ist maximal laminar subfamilies L(xxx) ⊆ F(xxx) and L(yyy) ⊆ F(yyy) such that span({χX (EX (U )) : U ∈ L(xxx)}) = span({χX (EX(U )) : U ∈ F(xxx)}) and span({χY (EY (U )) : U ∈ L(yyy)}) = span({χY (EY (U )) : U ∈ F(yyy)})). Observation 1 implies L(xxx) 6= ∅ and L(yyy) 6= ∅. More- over, it is evident that span({χX (EX(U )) : U ∈ L(xxx)} ∪ {χY (EY (U )) : U ∈ L(yyy)}) = span({χX (EX (U )) : U ∈ F(xxx)} ∪ {χY (EY (U )) : U ∈ F(yyy)}). Thus L(xxx) ∪ L(yyy) indi- cate certain linearly independent tight constraints that have been already included in the set constructed. We add (8) to the set constructed. Obviously, it still consists of lin- early independent constraints. We complete forming the set by choosing a maximal number of tight constraints from among the ones (7) and (9), such that they form a linearly in- dependent set with the constraints previously selected. We characterize these constraints by the sets of edges E(xxx, zzz) ⊆ E(xxx, zzz) and E(zzz, yyy) ⊆ E(zzz, yyy). Therefore the vectors in {χX (EX (U )) : U ∈ L(xxx)} ∪ {χY (EY (U )) : U ∈ L(yyy)} ∪ {−χX ({e}) + χZ ({e}) : e ∈ E(xxx, zzz)} ∪ {χZ ({e}) − χY ({e}) : e ∈ E(zzz, yyy)} ∪ {χZ (EZ )} are linearly independent and represent the constructed maximal set of independent tight constraints, with the cardinal- ity of L(xxx) + E(xxx, zzz) + E(zzz, yyy) + L(yyy) + 1, that uniquely describe (xxx, zzz, yyy). Hence EX +EZ+EY = L(xxx)+E(xxx, zzz)+E(zzz, yyy)+L(yyy)+1 which establishes the lemma. Lemma 3. Let (xxx, zzz, yyy) be a vertex solution of LPRRST (EX , VX , EY , VY , EZ ) such that xe > 0, e ∈ EX, ye > 0, e ∈ EY and ze > 0, e ∈ EZ. Then there is an edge e′ ∈ EX with xe′ = 1 or an edge e′′ ∈ EY with ye′′ = 1. Proof. On the contrary, suppose that 0 < xe < 1 for every e ∈ EX and 0 < ye < 1 for every e ∈ EY . Constraints (7) and (9) lead to 0 < ze < 1 for every e ∈ EZ . By Lemma 2 there exist laminar families L(xxx) 6= ∅ and L(yyy) 6= ∅ and subsets E(xxx, zzz) ⊆ E(xxx, zzz) and E(zzz, yyy) ⊆ E(zzz, yyy) indicating linearly independent constraints which uniquely define (xxx, zzz, yyy), namely xe = U − 1, ∀U ∈ L(xxx), Xe∈EX (U ) ∀e ∈ E(xxx, zzz), ∀e ∈ E(zzz, yyy), −xe + ze = 0, ze = L, Xe∈EZ ze − ye = 0, ye = U − 1, ∀U ∈ L(yyy). Xe∈EY (U ) (15) (16) (17) (18) (19) We will arrive to a contradiction with Lemma 2(i) by applying a token counting argument frequently in used in [11]. We give exactly two tokens to each edge in EX , EZ and EY . Thus we use 2EX + 2EZ + 2EY tokens. We then redistribute these tokens to the tight constraints (15)-(19) as 5 follows. For e ∈ EX the first token is assigned to the constraint indicated by the smallest set U ∈ L(xxx) containing its two endpoints (see (15)) and the second one is assigned to the constraint represented by e (see (16)) if e ∈ E(xxx, zzz). Similarly, for e ∈ EY the first token is assigned to the constraint indicated by the smallest set U ∈ L(yyy) containing its both endpoints (see (19)) and the second one is assigned to the constraint represented by e (see (18)) if e ∈ E(zzz, yyy). Each e ∈ EZ assigns the first token to the constraint corresponding to e (see (16)) if e ∈ E(xxx, zzz); otherwise to the constraint (17). The second token is assigned to the constraint indicated by e (see (18)) if e ∈ E(zzz, yyy). Claim 1. Each of the constraints (16) and (18) receives exactly two tokens. Each of the constraints (15) and (19) collects at least two tokens. The first part of Claim 1 is obvious. In order to show the second part we apply the same reasoning as [11, Proof 2 of Lemma 4.2.1]. Consider the constraint represented by any subset U ∈ L(xxx). We say that U is the parent of a subset C ∈ L(xxx) and C is the child of U if U is the smallest set containing C. Let C1, . . . , Cℓ be the children of U . The constraints corresponding to these subsets are as follows xe = U − 1, xe = Ck − 1, ∀k ∈ [ℓ]. Xe∈EX (U ) Xe∈EX (Ck) Subtracting (21) for every k ∈ [ℓ] from (20) yields: X e∈EX (U )\Sk∈[ℓ] EX (Ck) xe = U − Xk∈[ℓ] Ck + ℓ − 1. (20) (21) (22) the linear independence of the constraints. Since the right hand side of (22) is integer and Observe that EX(U ) \ Sk∈[ℓ] EX(Ck) 6= ∅. Otherwise, this leads to a contradiction with 0 < xe < 1 for every e ∈ EX , EX (U ) \Sk∈[ℓ] EX (Ck) ≥ 2. Hence U receives at least two tokens. The same arguments apply to the constraint represented by any subset U ∈ L(yyy). This proves the claim. Claim 2. Either constraint (17) collects at least one token and there are at least two extra tokens left or constraint (17) receives no token and there are at least three extra tokens left. To prove the claim we need to consider several nested cases: 1. Case: EZ \ E(xxx, zzz) 6= ∅. Since EZ \ E(xxx, zzz) 6= ∅, at least one token is assigned to constraint (17). We have yet to show that there are at least two token left. (a) Case: EZ \ E(zzz, yyy) = ∅. Subtracting (18) for every e ∈ E(zzz, yyy) from (17) gives: ye = L. Xe∈E(zzz,yyy) (23) i. Case: EY \ E(zzz, yyy) = ∅. Thus L = VY − 1, since (xxx, zzz, yyy) is a feasible solution. By Observation 1, VY ∈ L(yyy) and (23) has the form of constraint (19) for VY , which contradicts the linear independence of the constraints. 6 ii. Case: EY \ E(zzz, yyy) 6= ∅. Thus L < VY − 1. Since the right hand side of (23) is integer and 0 < ye < 1 for every e ∈ EY , EY \ E(zzz, yyy) ≥ 2. Hence, there are at least two extra tokens left. (b) Case: EZ \ E(zzz, yyy) 6= ∅. Consequently, EZ \ E(zzz, yyy) ≥ 1 and thus at least one token left over, i.e at least one token is not assigned to constraints (18). Therefore, yet one additional token is required. i. Case: EY \ E(zzz, yyy) = ∅. Consider the constraint (19) corresponding to VY . Adding (18) for every e ∈ E(zzz, yyy) to this constraint yields: ze = VY − 1. (24) Xe∈E(zzz,yyy) Obviously VY − 1 < L. Since L is integer and 0 < ze < 1 for every e ∈ EZ , EZ \ E(zzz, yyy) ≥ 2. Hence there are at least two extra tokens left. ii. Case: EY \E(zzz, yyy) 6= ∅. One sees immediately that at least one token left over, i.e at least one token is not assigned to constraints (18). Summarizing the above cases, constraint (17) collects at least one token and there are at least two extra tokens left. 2. Case: EZ \ E(xxx, zzz) = ∅. Subtracting (16) for every e ∈ E(xxx, yyy) from (17) gives: xe = L. Xe∈E(xxx,zzz) (25) Thus constraint (17) receives no token. We need yet to show that there are at least three extra tokens left. (a) Case: EX \ E(xxx, zzz) = ∅. Therefore L = VX − 1, since (xxx, zzz, yyy) is a feasible solution. By Observation 1, VX ∈ L(xxx) and (25) has the form of constraint (15) for VX , which contradicts with the linear independence of the constraints. (b) Case: EX \ E(xxx, zzz) 6= ∅ Thus L < VX − 1. Since the right hand side of (25) is integer and 0 < xe < 1 for every e ∈ EX, EX \ E(xxx, zzz) ≥ 2. Consequently, there are at least two extra tokens left. Yet at least one token is required. i. Case: EZ \ E(zzz, yyy) = ∅. Reasoning is the same as in Case 1a. ii. Case: EZ \ E(zzz, yyy) 6= ∅. Reasoning is the same as in Case 1b. Accordingly, constraint (17) receives no token and there are at least three extra tokens left. Thus the claim is proved. The method of assigning tokens to constraints (15)-(19) and Claims 1 and 2 now show that either 2EX + 2EZ + 2EY − 2 ≥ 2L(xxx) + 2E(xxx, zzz) + 2E(zzz, yyy) + 2L(yyy) + 1 or 2EX + 2EZ + 2EY − 3 ≥ 2L(xxx) + 2E(xxx, zzz) + 2E(zzz, yyy) + 2L(yyy). The above inequalities lead to EX + EZ + EY > L(xxx) + E(xxx, zzz) + E(zzz, yyy) + L(yyy) + 1. This contradicts Lemma 2(i). 7 It remains to verify two cases: EX = ∅ and VX = 1; EY = ∅ and VY = 1. We consider only for the first one, the second case is symmetrical. Then the constraints (8), (9) and the inclusion EZ ⊆ EY yield ye ≥ L. Xe∈EZ (26) Lemma 4. Let yyy be a vertex solution of linear program: (4), (10), (11), (14) and (26) such that ye > 0, e ∈ EY . Then there is an edge e′ ∈ EY with ye′ = 1. Moreover, using yyy one can construct a vertex solution of LPRRST (∅, VX , EY , VY , EZ ) with ye′ = 1 and the cost of yyy. Proof. Similarly as in the proof Lemma 2 we construct a maximal subset of linearly indepen- dent tight constraints that characterize yyy and get: EY = L(yyy) if (26) is not tight or adding (26) makes the subset dependent; EY = L(yyy) + 1 otherwise. In the first case the spanning tree constraints define yyy and, in consequence, yyy is integral (see [13, Theorem 3.2]). Consider the second case and assume, on the contrary, that 0 < ye < 1 for each e ∈ EY . Thus ye = L, Xe∈EZ ye = U − 1, ∀U ∈ L(yyy). Xe∈EY (U ) (27) (28) We assign two tokens to each edge in EY and redistribute 2EY tokens to constraints (27) and (28) in the following way. The first token is given to the constraint indicated by the smallest set U ∈ L(yyy) containing its two endpoints and the second one is assigned to (27). Since 0 < ye < 1 and L is integer, similarly as in the proof Lemma 3, one can show that each of the constraints (28) and (27) receives at least two tokens. If EY \ EZ = ∅ then L = VY − 1 since yyy is a feasible solution - a contradiction with the linear independence of the constraints. Otherwise (EY \ EZ 6= ∅) at least one token is left. Hence 2EY − 1 = 2L(yyy) + 2 and so EY > L(yyy) + 1, a contradiction. By (26) and the fact that there are no variables ze, e ∈ EZ , in the objective (4), it is obvious that using yyy one can construct zzz satisfying (8) and, in consequence, a vertex solution of LPRRST (∅, VX , EY , VY , EZ ) with ye′ = 1 and the cost of yyy. We are now ready to give the main result of this section. Theorem 1. Algorithm 1 solves RR ST in polynomial time. Proof. Lemmas 3 and 4 and the case when EZ = ∅ (see the comments in this section) ensure that Algorithm 1 terminates after performing O(V ) iterations (Steps 3-18). Let OPTLP denote the optimal objective function value of LPRRST (EX , VX, EY , VY , EZ , L), where EX = EZ = EY = E, VX = VY = V , L = V − 1 − k. Hence OPTLP is a lower bound on the optimal objective value of RR ST. It is not difficult to show that after the termination of the algorithm X and Y are two spanning trees in G such that Pe∈X Ce +Pe∈Y ce ≤ OPTLP. It remains to show that X ∩ Y ≥ V − k − 1. By induction on the number of iterations of Algorithm 1 one can easily show that at any iteration the inequality L + Z = V − 1 − k is satisfied. Accordingly, if, after the termination of the algorithm, it holds L = 0, then we are e ≥ L, EZ ≥ L ≥ 1 and EZ is the set with edges not belonging to X ∩ Y . Consider any e′ ∈ EZ . Of course z∗ e′ > 0 and it remained positive during the course of Algorithm 1. Moreover, at least one of done. Suppose, on the contrary that L ≥ 1 (L is integer). SincePe∈EZ z∗ 8 Algorithm 1: Algorithm for RR ST 1 EX ← E, EY ← E, EZ ← E, VX ← V , VY ← V , L ← V − 1 − k, X ← ∅, Y ← ∅, Z ← ∅; 2 while VX ≥ 2 or VY ≥ 2 do 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Find an optimal vertex solution (xxx∗, zzz∗, yyy∗) of LPRRST (EX , VX , EY , VY , EZ , L); foreach e ∈ EZ with z∗ e = 0 do EZ ← EZ \ {e}; foreach e ∈ EX with x∗ e = 0 do EX ← EX \ {e}; foreach e ∈ EY with y∗ e = 0 do EY ← EY \ {e}; if there exists edge e′ ∈ EX with x∗ e′ = 1 then X ← X ∪ {e′} ; contract edge e′ = {u, v} by deleting e and identifying its endpoints u and v in graph GX = (VX , EX ), induced by VX and EX , which is equivalent to: VX ← VX − 1 and EX ← EX \ {e′}; if there exists edge e′ ∈ EX with y∗ e′ = 1 then Y ← Y ∪ {e′}; contract edge e′ = {u, v} by deleting e and identifying its endpoints u and v in graph GY = (VY , EY ), induced by VY and EY , which is equivalent to: VY ← VY − 1 and EY ← EY \ {e′}; if there exists edge e′ ∈ EZ such that e′ ∈ X ∩ Y then /* Here (xxx∗, zzz∗, yyy∗) with Pe∈EZ z∗ the cost, to (xxx∗, zzz′, yyy∗) with z′ Z ← Z ∪ {e′}, L ← L − 1; EZ ← EZ \ {e′}; e′ = 1 and Pe∈EZ \{e′} z′ e = L can be always converted, preserving e = L − 1 */ 19 return X, Y , Z 9 the constraints −xe′ + ze′ ≤ 0 or ze′ − ye′ ≤ 0 is still present in the linear program (4)-(14). e′ > 0, Steps 10-12, Steps 13-15 and, in consequence, Steps 16-18 for e′ Otherwise, since z∗ must have been executed during the course of Algorithm 1 and e′ has been included to Z, a contradiction with the fact e′ 6∈ X ∩ Y . Since the above constraints are present, 0 < x∗ e′ < 1 or 0 < y∗ e′ < 1. Thus e′ ∈ EX or e′ ∈ EY , which contradicts the termination of Algorithm 1. 3 Robust recoverable matroid basis problem The minimum spanning tree can be generalized to the following minimum matroid basis problem. We are given a matroid M = (E, I) (see [15]), where E is a nonempty ground set, E = m, and I is a family of subsets of E, called independent sets. The following two axioms must be satisfied: (i) if A ⊆ B and B ∈ I, then A ∈ I; (ii) for all A, B ∈ I if A < B, then there is an element e ∈ B \ A such that A ∪ {e} ∈ I. We make the assumption that checking the independence of a set A ⊆ E can be done in polynomial time. The rank function of M , rM : 2E → Z≥0, is defined by rM (U ) = maxW ⊆U,W ∈I W . A basis of M is a maximal under inclusion element of I. The cardinality of each basis equals rM (E). Let ce be a cost specified for each element e ∈ E. We wish to find a basis of M of the minimum total cost, Pe∈M ce. It is well known that the minimum matroid basis problem is polynomially solvable by a greedy algorithm (see. [7]). A spanning tree is a basis of a graphic matroid, in which E is a set of edges of a given graph and I is the set of all forests in G. We now define two operations on matroid M = (E, I), used in the following (see also [15]). Let M \e = (EM \e, IM \e), the deletion e from M , be the matroid obtained by deleting e ∈ E from M defined by EM \e = E \ {e} and IM \e = {U ⊆ E \ {e} : U ∈ I}. The rank function of M \e is given by rM \e(U ) = rM (U ) for all U ⊆ E \ {e}. Let M/e = (EM/e, IM/e), the contraction e from M , be the matroid obtained by contracting e ∈ E in M , defined by EM/e = E \ {e}; and IM/e = {U ⊆ E \ {e} : U ∪ {e} ∈ I} if {e} is independent and IM/e = I, otherwise. The rank function of M/e is given by rM/e(U ) = rM (U ) − rM ({e}) for all U ⊆ E \ {e}. Assume now that the first stage cost of element e ∈ E equals Ce and its second stage cost is uncertain and is modeled by interval [ce, ce + de]. The robust recoverable matroid basis problem (RR MB for short) under scenario set U m can be stated similarly to RR ST. Indeed, it suffices to replace the set of spanning trees by the bases of M and U by U m in the formulation (1) and, in consequence, in (2). Here and subsequently, Φ denotes the set of all bases of M . Likewise, RR MB under U m is equivalent to the following problem: min Pe∈X Ce +Pe∈Y (ce + de) X ∩ Y ≥ rM (E) − k, X, Y ∈ Φ. s.t. (29) Let EX, EY ⊆ E and IX, IY be collections of subsets of EX and EY , respectively, (in- dependent sets), that induce matroids MX = (EX , IX) and MY = (EY , IY ). Let EZ be a subset of E such that EZ ⊆ EX ∪ EZ and EZ ≥ L for some fixed L. The following linear program, denoted by LPRRM B(EX , IX , EY , IY , EZ , L), after setting EX = EY = EZ = E, 10 IX = IY = I and L = rM (E) − k is a relaxation of (29): min Xe∈EX (ce + de)ye xe = rMX (EX), Cexe + Xe∈EY s.t. Xe∈EX Xe∈U xe ≤ rMX (U ), −xe + ze ≤ 0, ze = L, Xe∈EZ ze − ye ≤ 0, ye = rMY (EY ), ∀U ⊂ EX, ∀e ∈ EX ∩ EZ , ∀e ∈ EY ∩ EZ , ye ≤ rMY (U ), ∀U ⊂ EY , xe ≥ 0, ze ≥ 0, ye ≥ 0, ∀e ∈ EX, ∀e ∈ EZ , ∀e ∈ EY . Xe∈EY Xe∈U (30) (31) (32) (33) (34) (35) (36) (37) (38) (39) (40) The indicator variables xe, ye, ze ∈ {0, 1}, e ∈ E, describe the bases X, Y and their intersection X ∩Y , respectively have been relaxed. Since there are no variables ze in the objective (30), we can use equality constraint (34), instead of the inequality one. The above linear program is solvable in polynomial time. The rank constraints (31), (32) and (36), (37) relate to matroids MX = (EX , IX) and MY = (EY , IY ), respectively, and a separation over these constraints can be carried out in polynomial time [6]. Obviously, a separation over (33), (34) and (35) can be done in polynomial time as well. Consider a vertex solution (xxx, zzz, yyy) ∈ R of LPRRM B(EX , IX, EY , IY , EZ , L). Note that if EZ = ∅, then the only rank constraints are left in (30)-(40). Consequently, xxx and yyy are 0-1 incidence vectors of bases X and Y of matroids MX and MY , respectively (see [7]). Let us turn to other cases. Assume that EX 6= ∅, EY 6= ∅ and EZ 6= ∅. Similarly as in Section 2 we first reduce the sets EX , EY and EZ by removing all elements e with xe = 0, or ye = 0, or ze = EX ×EZ×EY ≥0 0. Let F(xxx) = {U ⊆ EX : Pe∈U xe = rMX (U )} and F(yyy) = {U ⊆ EY : Pe∈U ye = rMY (U )} denote the sets of subsets of elements that indicate tight constraints (31), (32) and (36), (37) for xxx and yyy, respectively. Similarly we define the sets of elements that indicate tight constraints (33) and (35) with respect to (xxx, zzz, yyy), namely E(xxx, zzz) = {e ∈ EX ∩ EZ : −xe + ze = 0} and E(zzz, yyy) = {e ∈ EY ∩ EZ : ze − ye = 0}. Let χX(W ), W ⊆ EX , (resp. χZ (W ), W ⊆ EZ , and χY (W ), W ⊆ EY ) denote the characteristic vector in {0, 1}EX × {0}EZ × {0}EY (resp. {0}EX × {0, 1}EZ × {0}EY and {0}EX × {0}EZ × {0, 1}EY ) that has 1 if e ∈ W and 0 otherwise. We recall that a family L ⊆ 2E is a chain if for any A, B ∈ L, either A ⊆ B or B ⊆ A (see, e.g., [11]). Let L(xxx) (resp. L(yyy)) be a maximal chain subfamily of F(xxx) (resp. F(yyy)). The following lemma is a fairly straightforward adaptation of [11, Lemma 5.2.3] to the problem under consideration and its proof may be handled in much the same way. 11 Lemma 5. For L(xxx) and L(yyy) the following equalities: span({χX (EX (U )) : U ∈ L(xxx)}) = span({χX (EX (U )) : U ∈ F(xxx)}), span({χY (EY (U )) : U ∈ L(yyy)}) = span({χY (EY (U )) : U ∈ F(yyy)}) hold. The next lemma, which characterizes a vertex solution, is analogous to Lemma 2. Its proof is based on Lemma 5 and is similar in spirit to the one of Lemma 2. Lemma 6. Let (xxx, zzz, yyy) be a vertex solution of LPRRM B(EX, IX , EY , IY , EZ , L) such that xe > 0, e ∈ EX, ye > 0, e ∈ EY and ze > 0, e ∈ EZ. Then there exist chain families L(xxx) 6= ∅ and L(yyy) 6= ∅ and subsets E(xxx, zzz) ⊆ E(xxx, zzz) and E(zzz, yyy) ⊆ E(zzz, yyy) that must satisfy the following: (i) EX + EZ + EY = L(xxx) + E(xxx, zzz) + E(zzz, yyy) + L(yyy) + 1, (ii) the vectors in {χX (EX (U )) : U ∈ L(xxx)} ∪ {χY (EY (U )) : U ∈ L(yyy)} ∪ {−χX({e}) + χZ ({e}) : e ∈ E(xxx, zzz)} ∪ {χZ ({e}) − χY ({e}) : e ∈ E(zzz, yyy)} ∪ {χZ (EZ )} are linearly independent. Lemmas 5 and 6 now lead to the next two ones and their proofs run as the proofs of Lemmas 3 and 4. Lemma 7. Let (xxx, zzz, yyy) be a vertex solution of LPRRM B(EX, IX , EY , IY , EZ , L) such that xe > 0, e ∈ EX, ye > 0, e ∈ EY and ze > 0, e ∈ EZ . Then there is an element e′ ∈ EX with xe′ = 1 or an element e′′ ∈ EY with ye′′ = 1. We now turn to two cases: EX = ∅; EY = ∅. Consider EX = ∅, the second case is symmetrical. Observe that (34) and (35) and EZ ⊆ EY implies constraint (26). Lemma 8. Let yyy be a vertex solution of linear program: (30), (36), (37), (40) and (26) such that ye > 0, e ∈ EY . Then there is an element e′ ∈ EY with ye′ = 1. Moreover using yyy one can construct a vertex solution of LPRRM B(∅, ∅, EY , IY , EZ , L) with ye′ = 1 and the cost of yyy. We are thus led to the main result of this section. Its proof follows by the same arguments as for RR ST. Theorem 2. Algorithm 2 solves RR MB in polynomial time. 4 Conclusions In this paper we have shown that the recoverable version of the minimum spanning tree problem with interval edge costs is polynomially solvable. We have thus resolved a problem which has been open to date. We have applied a technique called an iterative relaxation. It has been turned out that the algorithm proposed for the minimum spanning tree can be easily generalized to the recoverable version of the matroid basis problem with interval element costs. Our polynomial time algorithm is based on solving linear programs. Thus the next step should be designing a polynomial time combinatorial algorithm for this problem, which is an interesting subject of further research. 12 Algorithm 2: Algorithm for RR MB 1 MX = (EX , IX ) ← (E, I), MY = (EY , IY ) ← (E, I), L ← rM (E) − k, X ← ∅, Y ← ∅, Z ← ∅; 2 while EX 6= ∅ or EY 6= ∅ do 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Find an optimal vertex solution (xxx∗, zzz∗, yyy∗) of LPRRM B(EX , IX , EY , IY , EZ , L); foreach e ∈ EZ with z∗ e = 0 do EZ ← EZ \ {e}; foreach e ∈ EX with x∗ e = 0 do MX ← MX \e; foreach e ∈ EY with y∗ e = 0 do MY ← MY \e; if there exists element e ∈ EX with x∗ e = 1 then X ← X ∪ {e} ; MX ← MX /e ; if there exists element e ∈ EX with y∗ e = 1 then Y ← Y ∪ {e}; MY ← MY /e; if there exists element e ∈ EZ such that e ∈ X ∩ Y then /* Here (xxx∗, zzz∗, yyy∗) with Pe∈EZ z∗ the cost, to (xxx∗, zzz′, yyy∗) with z′ Z ← Z ∪ {e},L ← L − 1; EZ ← EZ \ {e}; e′ = 1 and Pe∈EZ \{e′} z′ e = L can be always converted, preserving e = L − 1 */ 19 return X, Y , Z Acknowledgements The first author was supported by Wroc law University of Technology, grant S50129/K1102. The second and the third authors were supported by the National Center for Science (Naro- dowe Centrum Nauki), grant 2013/09/B/ST6/01525. References [1] R. K. Ahuja, T. L. Magnanti, and J. B. Orlin. Network Flows: theory, algorithms, and applications. Prentice Hall, Englewood Cliffs, New Jersey, 1993. [2] D. Bertsimas and M. Sim. Robust discrete optimization and network flows. Mathematical Programming, 98:49 -- 71, 2003. [3] C. Busing. Recoverable Robustness in Combinatorial Optimization. PhD thesis, Technical University of Berlin, Berlin, 2011. [4] C. Busing. Recoverable robust shortest path problems. Networks, 59:181 -- 189, 2012. [5] O. S¸eref, R. K. Ahuja, and J. B. Orlin. Incremental Network Optimization: Theory and Algorithm. Operations Research, 57:586 -- 594, 2009. [6] W. H. Cunningham. Testing membership in matroid polyhedra. Journal of Combinatorial Theory, Series B, 36:161 -- 188, 1984. 13 [7] J. Edmonds. Matroids and the greedy algorithm. Mathematical Programming, 1:127 -- 136, 1971. [8] A. Kasperski, A. Kurpisz, and P. Zieli´nski. Recoverable robust combinatorial optimiza- tion problems. In Operations Research Proceedings 2012, pages 147 -- 153, 2014. [9] A. Kasperski and P. Zieli´nski. On the approximability of robust spanning problems. Theoretical Computer Science, 412:365 -- 374, 2011. [10] P. Kouvelis and G. Yu. Robust Discrete Optimization and its applications. Kluwer Academic Publishers, 1997. [11] L. C. Lau, R. Ravi, and M. Singh. Iterative Methods in Combinatorial Optimization. Cambridge University Press, 2011. [12] C. Liebchen, M. E. Lubbecke, R. H. Mohring, and S. Stiller. The Concept of Recoverable Robustness, Linear Programming Recovery, and Railway Applications. In Robust and Online Large-Scale Optimization, volume 5868 of Lecture Notes in Computer Science, pages 1 -- 27. Springer-Verlag, 2009. [13] T. L. Magnanti and L. A. Wolsey. Optimal Trees. In M. O. Ball, T. L. Magnanti, C. L. Monma, and G. L. Nemhauser, editors, Network Models, Handbook in Operations Re- search and Management Science, volume 7, pages 503 -- 615. North-Holland, Amsterdam, 1995. [14] E. Nasrabadi and J. B. Orlin. Robust optimization with incremental recourse. CoRR, abs/1312.4075, 2013. [15] J. G. Oxley. Matroid theory. Oxford University Press, 1992. 14
1512.03697
4
1512
2016-03-17T18:51:09
Computing Affine Combinations, Distances, and Correlations for Recursive Partition Functions
[ "cs.DS" ]
Recursive partitioning is the core of several statistical methods including CART, random forest, and boosted trees. Despite the popularity of tree based methods, to date, there did not exist methods for combining multiple trees into a single tree, or methods for systematically quantifying the discrepancy between two trees. Taking advantage of the recursive structure in trees we formulated fast algorithms for computing affine combinations, distances and correlations in a vector subspace of recursive partition functions.
cs.DS
cs
Computing affine combinations, distances and correlations of recursive partition functions Sean Skwerer and Heping Zhang Collaborative Center for Statistics in Sciences Yale University November 11, 2014 Abstract Recursive partitioning is the core of several statistical methods including Classifica- tion and Regression Trees, Random Forest, and AdaBoost. Despite the popularity of tree based methods, to date, there did not exist methods for combining multiple trees into a single tree, or methods for systematically quantifying the discrepancy between two trees. Taking advantage of the recursive structure in trees we formulated fast algorithms for computing affine combinations, distances and correlations in a vector subspace of recursive partition functions. 6 1 0 2 r a M 7 1 ] S D . s c [ 4 v 7 9 6 3 0 . 2 1 5 1 : v i X r a 1 Contents 1 Introduction 2 Preliminaries 2.1 Introduction to recursive partitioning . . . . . . . . . . . . . . . . . . . . . . 2.2 Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Combining trees 3.1 Extracting a subtree in a region of the domain . . . . . . . . . . . . . . . . . 3.2 Tree Combiner Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1 Case descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.2 Case: No Intersection . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.3 Case: crossing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.4 Case: parallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.5 Case: identical 3.2.6 Case: Terminal Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Correctness and Computational Cost . . . . . . . . . . . . . . . . . . . . . . 4 Tree distances and correlations 4.1 Tree Distances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Tree Correlations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Distances between Forests . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Solutions for subproblems in specific tree contexts 5.1 Checking if a split divides a region . . . . . . . . . . . . . . . . . . . . . . . 5.1.1 Univariate splits for discrete variable . . . . . . . . . . . . . . . . . . 5.1.2 Univariate splits for continuous variables . . . . . . . . . . . . . . . . 5.2 Multivariate splits for continuous variables . . . . . . . . . . . . . . . . . . . 5.2.1 Geometry of multivariate splits: hyperplanes and polytopes . . . . . . 5.2.2 Tests for intersection of a Hyperplane and a Polyhedron . . . . . . . 6 Concluding remarks and further research directions 3 4 4 6 7 8 10 10 11 12 12 13 13 14 15 15 18 19 20 20 20 20 21 21 23 24 2 1 Introduction Recursive partitioning is the core for many statistical and machine learning methods includ- ing Classification and Regression Trees, Multivariate Adaptive Regression Splines, AdaBoost and Random Forest. Methods based on recursive partitioning are regarded among the top data mining methods [Wu et al., 2007], and in a study of over 100 classification methods ver- sions of Random Forest occupied 3 out of the top five spots [Fern´andez-Delgado et al., 2014]. The widespread application of recursive partitioning methods can be attributed to their versatility, speed and robustness. Recursive partitioning has been used to solve regression, density estimation and classification problems. Recursive partitioning procedures are divide and conquer algorithms which find optimal partitions of the data at each recursive stage. The criteria for an optimal partition depends on the type of problem: regression, classification, or density estimation, but in all cases the partition is selected to optimize some quantification of purity e.g. reducing variance in regression or homogenizing the distribution in classification or density estimation -- for more details see [Hastie et al., 2009, Zhang and Singer, 2010]. The bifurcating structure created by recursive partitioning algorithms is often referred to as a tree -- we give a formal definition in Section 2.2. It is common for recursive partitioning algorithms to employ stopping rules aimed at preventing over-fitting such as stopping when the number of observations is below a certain quantity [Breiman et al., 1984] or stopping when the conditional p-value of a partition is to low [Strobl et al., 2009]. Researchers haven proven that recursive partitioning algorithms will produce trees that approach the true optimal decision rule as more and more data become available [Gordon and Olshen, 1978], however methods which use only a single tree are often out-performed by ensemble methods which use an average or mode of the predictions from a collection of trees. Currently, the two most widely used methods to build ensembles of trees are random forests and boosting. A complete theory for ensembles of trees has been a topic of research in statistics and machine learning since their introduction when they achieved state of the art performance in classification problems [Freund and Schapire, 1996, Breiman, 1996, Breiman, 2001]. An explanation of boosting as optimization in function space [Friedman et al., 2000], as op- posed to parameter space, has lead to (1) consistency results achieved through regulariza- tion techniques which were not part of the original algorithm [Zhang and Yu, 2005], and (2) new algorithms which minimize other cost functionals and in some cases improve on the original boosting algorithm [Mason et al., 2000, Buhlmann and Yu, 2003]. Considerable progress in theory for random forests has been made recently [Wager and Walther, 2015, Scornet et al., 2015, Mentch and Hooker, 2014]. These represent a frontier in analyses of random forests where the trend has been assumptions in the hypotheses of theorems which are more closely aligned with practice and more sophisticated results leading to estimators of prediction variance. All things considered this progress is a big step forward, and will contribute to methods of inference based on quantification of variation in point estimates from ensembles. However, the existing theory is not complete. The need to understand how ensembles of trees are able to avoid over-fitting by a mechanism which complements stopping rules and pruning has been emphasized [Friedman et al., 2000, Discussion: Breiman] and re- cently an explanation of how over-fit trees can form a reliable ensemble has been offered [Wyner et al., 2015]. Theory for ensembles of trees is continuing to mature, and hopefully 3 some unifying understanding will come soon. Recursive partitioning algorithms select optimal partitions at each stage, but generally there are no guarantees about their global optimality with respect to the trade off between purity and number of partitions, or expected error for predictions. Bayesian methods for building trees, which have been shown to outperform recursive partitioning in some cases, ap- ply sophisticated optimization procedures which employ Markov-Chain-Monte-Carlo search [Chipman et al., 2010, Chipman et al., 2012]. An affine combination of trees is a tree, and thus ensemble methods actually produce a single tree represented as a weighted sum of many trees. Therefore ensemble methods can be interpreted as better algorithms for finding an optimal tree, even if they do not explicitly give a single tree. This begs several questions: Are all the trees in an ensemble necessary? Is it possible to produce one tree or a few trees which can perform approximately as well as an entire ensemble? What is the trade-off between parsimony and predictive power of an ensemble? To this end we created an algorithm for computing a tree which represents an affine combination of trees. We extend this method to compute quantities which measure the similarity or difference between trees. These mea- sures can be used to explore and summarize the distribution of trees in an ensemble via multi-dimensional scaling or cluster analysis. To measure how well one forest approximates another, we introduce a method for computing the distance between two forests. The remaining content of this manuscript is organized as follows. The preliminary section focuses on the main element of interest: trees obtained from recursive partitioning algorithms. The basics of recursive partitioning are discussed in Section 2.1. The result of recursive partitioning algorithms is a tree, which we define in Section 2.2. A generic version of our algorithm for combining trees is presented in Section 3. In Section 4 we describe distances and correlations for the functions defined by trees. Implementation details for specific types of trees are discussed in Section 5. 2 Preliminaries 2.1 Introduction to recursive partitioning We introduce recursive partitioning with an example from Chapter 2 of [Zhang and Singer, 2010], which uses the database from the Yale Pregnancy Outcome Study. In this example a subset of 3,861 women whose pregnancies ended in a singleton live birth are selected from this database. Preterm delivery is the outcome variable of interest, and 15 variables are can- didates to be useful in representing routes to preterm delivery. The candidate predictor variables are listed in Table 1. Consider the example tree diagram in Fig. 1. The tree has three layers of nodes. The first layer contains the unique root node, which is the circle at the top of the tree. The root node is partitioned into two daughter nodes in the second layer of the tree: one terminal node, which is the box marked I, and one internal node, namely the circle down and to the right of the root node. The internal node is partition into two daughters, which are the terminal nodes marked II and III. The tree represents a recursive partition of the data. Recursive partitioning begins after the root node, which contains all the data. Moving down from the root node to the second 4 Variable name Maternal age Marital status Label Type x1 x2 Continuous Nominal Race x3 Nominal Marijuana use x4 Times of using marijuana x5 x6 Years of education x7 Employment x8 Smoker x9 Cigarettes smoked Passive smoking x10 Gravidity x11 Hormones/DES used by mother x12 Nominal Ordinal ≥ 5, 3 − 4, 2, 1(daily) 4-27 Nominal Nominal Continuous Nominal Ordinal Nominal Alcohol (oz/day) Caffeine (mg) Parity x13 x14 x15 Ordinal Continuous Ordinal Range/levels 13-46 Currently married, divorced, separated, widowed, never married White, Black, Hispanic, Asian, Others Yes, no Yes, no Yes, no 0-66 Yes, no 1-10 None, hormones, DES, both, uncertain 0-3 12.6-1273 0-7 Table 1: Candidate predictor variable for preterm delivery from the Yale Pregnancy Outcome Study database. Root node (cid:1876)(cid:2869)(cid:2871) >(cid:1855)(cid:2870)? yes no I (cid:1876)(cid:2869) >(cid:1855)(cid:2869)? no II Internal node yes III Figure 1: An illustrative tree structure for pathways to preterm birth. x1 is age and x13 is the amount of alcohol drinking. Circles and dots represent different outcomes. 5 layer data are partitioned to the right daughter if x13 > c2 and partitioned to the left daughter if x13 ≤ c2. Thus all data with x13 ≤ c2 are contained in the terminal node labeled I. On the other hand, moving down from the internal node to the third layer, data with x1 > c1 are partitioned to the right daughter, and data with x1 ≤ c1 are partition to the left daughter. Thus data at terminal nodes marked II and III are recursively partitioned first at the root node and then again at the internal node. Generally classification and regression trees can have many layers. Algorithms are used to construct trees. During tree construction two main decisions are made why and how a parent node is split into two daughter nodes and when to declare a terminal node. Criterion to make these decisions are based on homogeneity of the data in a node. There are several methods, for a full treatment see [Zhang and Singer, 2010]. In the next section we formally define a representation of recursive partition functions. 2.2 Trees A partition of a set A is a collection of subsets of A which form a disjoint cover of A. A binary tree T is a list of nodes v0, . . . , vm which have following attributes. Internal or terminal: Every node v has a parent node p(v), except one node which has no parent, called the root. A node, v, is internal if it has a left daughter l(v) and a right daughter r(v), which are elements of the set {v1, . . . , vm}, otherwise v has no daughters, and is called a terminal node. Parents For any two nodes u and v if u is the parent of v, p(v) = u, then v must be a daughter of u, that is either (i) l(u) = v or (ii) r(u) = v. Regions and Splits: Each node v is associated with a set called a region, A(v). The region of the root, A(v0) is given, while the regions of other nodes are defined recursively. Each internal node is associated with a split c(v) which is a condition that partitions A(v) into two complimentary sets. One set is called the left set, L(v), and the other is called the right set R(v). The left set is associated with the left daughter, and likewise the right set is associated with the right daughter. The region of node v is obtained by applying the appropriate split condition to the region of its parent: A(v) = L(p(v)) if v = l(p(v)) or A(v) = R(p(v)) if v = r(p(v)). Values: Every terminal node has a function, fv, which maps from A(v) to a set RT . These functions are collected into a set F = {fvterminal nodes v ∈ T }. The regions of the terminal nodes of a binary tree with root v0 are a partition of A(v0). Every point in x ∈ A(v0) is contained in the region of exactly one terminal node v, and each terminal node v is associated with a function fv which maps from A(v) to R, thus a binary tree defines a function mapping from A(v0) to R. We use the symbol for a tree as the function it represents - that is given a tree T with root v0, the tree maps from a point x ∈ A(v0) to T (x) or takes a subset B ⊆ A(v0) to its image in R, T (B). Given a tree T and a node v in T , the subtree at v, Tv, is defined recursively as v and all the nodes in T which are daughters of nodes in the subtree at v. A subtree Tv defines a function which is the same function as T but only defined on A(v). 6 Several tree-based methods use models at terminal nodes. Bayesian CART [Chipman et al., 2012] suggests using linear models at the terminal nodes, and Multivariate Adaptive Regression Splines use higher order models [Friedman, 1991]. However many methods, including CART, Random Forest, conditional trees and boosted trees, use constants for fv. Note that the algorithm in Section 3 is valid for any c(v) which bipartitions A(v) e.g. L(v) and R(v) could have non-linear boundaries. However, the complexity of determining if non-linear regions intersect can be very difficult. Many methods use conditions on one variables at a time. These issues are discussed further in Section 5. There may be multiple trees which define the same recursive partition function. For example the function in Figure 6 could be represented by the tree in Figure 6 or by the tree in Figure 7. The correlation and distance we define in Section 4 are based on the functions defined by trees and these measures do not account for discrepancies in the structures of trees. 3 Combining trees Recursive partitioning is typically applied to datasets with a univariate response y and p predictive variables x1, . . . , xp, which could be a mixture of categorical and quantitative predictive variables. The data structure we define and our algorithms for affine combinations and norms are generic, in the sense that they are independent from the types of the response and predictive variables. These algorithms operate on any structure which can be represented by the tree defined in Section 2.2 -- some examples are regression trees with multivariate response and splines. The main restrictions required for sums and norms to be well defined are that the trees which are to be combined are contained in the same subspace of a vector space of functions, that is: (1) trees must have the same domain and range, (2) the range must be a normed vector space, and (3) a measure must be provided for the domain so that the mean and variance of a tree are well-defined. As a precursor to computing affine combinations and norms of trees we give an algorithm which takes two trees with the same domain, D, such as T 1 and T 2 in Fig. 5 and combines them into a tree T, and a set of vectors of functions indexed by the terminal nodes of T, F = {Fv∀ terminal nodes v ∈ T}. The vectors of functions at the terminal nodes of T map from D to the product space RT 1 × RT 2. A single tree which represents a combination of T 1 and T 2 must exist, and can be obtained by partitioning the regions of terminal nodes of T 1 into smaller regions using the splits from T 2. More details about the method are presented in Sections 3.1 and 3.2. with a tree, T, mapping from D to the product space Qm A collection of trees, T 1, . . . , T m, mapping from the same domain D, can be represented j=1 RT j . T may be obtained by iteratively applying the Tree Combiner Algorithm. Suppose that T 1, . . . , T m map to the same vector space with real scalars. Let α = (α1, . . . , αm) be a vector in Rm. When the vector valued function (T 1, . . . , T m) is represented by T, then a tree representing the weighted sum α1T 1 + . . . + αmT m may be obtained from T, by replacing the vector of functions Fv = (f 1 v , . . . , f m v ) at each terminal node v in T by the inner product of Fv and α. The content of this Section is organized as follows. Section 3.1 describes the details of an important subroutine which collects the subtree of a recursive partition function restricted 7 to a subset of its domain. Section 3.2 describes the main algorithm, without assumptions about the type of domain, the types of partitions, or the types of functions at terminal nodes. Section 3.3 gives a proof of correctness and analysis of the computational cost of the algorithm. Section 5.1 describes details for how to check if a split intersects a region -- Section 5.1.1 concerns discrete sets, Section 5.1.2 deals with splits on one continuous variable, and Section 5.2.1 describes methods for multivariate splits. 3.1 Extracting a subtree in a region of the domain To begin with a simpler question than finding a tree which represents two trees simulta- neously, we ask, given a tree T , with root v0 and B ⊂ A(v0), find a tree T ′ such that T ′(B) = T (B), and T ′ only uses conditions from nodes of T with regions that intersect B. Initially, T ′ will be a single node w0 with no children, and the region of w0 is B. To begin with we must find the minimum part of T which contains B and then extract the parts of that subtree which intersect B. We define a recursive algorithm which operates on a terminal node of T ′, w, and a node v of T such that A(w) ⊆ A(v). We can start at the roots v = v0 and w = w0. If A(w) intersects both L(v) and R(v), then we must use c(v) to partition A(w). After splitting w continue recursively with the left and right daughters of w and v. However, if A(w) is a subset of either L(v) or R(v) then we must can move on to compare w with l(v) or r(v), whichever the case may be. Otherwise, if v is terminal then let fw = fv. Let x be an element of B and let q be the node of terminal node of T such that x ∈ A(q). Whenever the algorithm is called, the A(w) is the intersection of A(v) and B. Therefore, the terminal node in T ′ which contains x will be associated with fq. Thus, for all x ∈ B, T ′(x) = T (x). Data: w is a terminal node in T ′ v is a node in T s.t. for any q from T if A(q) ∩ A(w) 6= ∅ then q is in the subtree at v Result: T ′ if A(w) ∩ R(v) 6= ∅ and A(w) ∩ L(v) 6= ∅ then w is equivalent to Tv over A(w) c(w) ← c(v); create l(w) and r(w) ; collect(l(w), l(v)); collect(r(w), r(v)); else if A(w) ∩ L(v) 6= ∅ then collect(w, l(v)) end if A(w) ∩ R(v) 6= ∅ then collect(w, r(v)) end end Algorithm 1: collect(w, v) 8 (cid:1827)(cid:1874)(cid:2868) 1 2 (cid:1828) 3 5 4 (cid:3409) 1 > (cid:1846) (cid:1876)(cid:2869) = 0.25 (cid:1828) (cid:1876)(cid:2870) = 0.5 (cid:3409) (cid:1876)(cid:2869) = 0.5 (cid:1876)(cid:2870) = 0.25 (cid:3409) (cid:3409) > 5 3 > 2 > 4 Figure 2: Illustration for extracting part of a tree over a subset B. Algorithm 1 locates the node with smallest region containing A(w), and then splits T ′ according to the condition in that node. Recursion continues, either moving to the left or right daughter in T or partitioning until a terminal node of T is reached. 9 3.2 Tree Combiner Algorithm The combined tree, T, is initialized as a single node, w0, with region A(w0) equal to D. The main subroutine, combine is used recursively. The inputs for combine are a node u from T 1, a node v from T 2, and a terminal node w from T, such that A(w) is a subset of A(u) and A(v). When the recursion is over Tw and Fw are equivalent to (T 1 v ) over A(w). The algorithm reaches a base case when either u or v is a terminal node, where the problem of combining T 1 v reduces to the problem of extracting the part of a tree in a region. If neither u nor v is terminal and at least one of c(u) and c(v) can partition A(w) then the algorithm partitions A(w) and is called recursively on the daughters of w, and the appropriate nodes in T 1 and T 2. There are four recursive cases: intersection absent, crossing splits, parallel splits, and identical splits which are defined in Section 3.2.1. u and T 2 u , T 2 Details for how to proceed in each recursive case are described in Section 3.2.2, 3.2.3, 3.2.4, and 3.2.5. When Algorithm 2 reaches a terminal node of either T 1 or T 2, that branch of the recursion ends. Details for how to update T when a terminal node is reached are described in Section 3.2.6. Data: w is a terminal node in T u is a node in T 1 s.t. for any q from T 1 if A(q) ∩ A(w) 6= ∅ then q is in the subtree at u v is a node in T 2 s.t. for any q from T 2 if A(q) ∩ A(w) 6= ∅ then q is in the subtree at v Result: Tw and Fw which are equivalent to (T 1 if u or v is terminal then v ) over A(w) u , T 2 go to terminal node reached, Section 3.2.6 else if at least one of c(u) or c(v) do not intersect then A(w) go to intersection absent, Section 3.2.2 end if if c(u) and c(v) cross in A(w) then go to crossing splits, Section 3.2.3 end if if c(u) and c(v) are parallel in A(w) then go to parallel splits, Section 3.2.4 end if if c(u) and c(v) are identical in A(w) then go to identical splits, Section 3.2.5 end end Algorithm 2: combine(u, v, w) 3.2.1 Case descriptions Before we discuss the recursive cases of Algorithm 2 in more detail it is helpful to consider discuss the conditions for the recursive cases and the tasks achieved by the main subroutines. The following two subroutines check if parts of trees meet certain conditions. Check if a region can be partitioned by a condition: Given two nodes u and v check if the condition c(v) partitions A(u), that is check if both the sets A(u) ∩ L(v) 10 and A(u) ∩ R(v) are non-empty. Check if two splits are crossing, parallel or identical: Given two nodes u and v determine which of the following disjoint and exhaustive events is true: (i) (crossing) none of the following sets are empty: R(u) ∩ R(v), R(u) ∩ L(v), L(u) ∩ R(v), and L(u) ∩ L(v) (ii) (parallel) L(u) ∩ R(v) is empty and none of the following sets are empty: R(u) ∩ L(v), R(u) ∩ R(v), and L(u) ∩ L(v) (iii) (parallel) L(v) ∩ R(u) is empty and none of the following sets are empty: R(u) ∩ R(v), L(u) ∩ R(v), and L(u) ∩ L(v) (iv) (identicial) c(u) and c(v) are the same When a region A is reduced by both c(u) and c(v) it will be of interest to focus on whether these splits are crossing, parallel or identical inside of A. We can check if two splits are crossing, parallel or identical inside of A, by including intersection with A in all of the above events. For example, c(u) and c(v) are crossing in A if none of the following sets are empty: R(u) ∩ R(v) ∩ A, R(u) ∩ L(v) ∩ A, L(u) ∩ R(v) ∩ A, and L(u) ∩ L(v) ∩ A. Find subtreee in region: Given a region A and a tree T find a tree T ′ which is equivalent to T over A - see Section 3.1 for details. 3.2.2 Cases for Algorithm 2: Intersection Absent There are several cases for how at least one of the conditions c(u) and c(v) does not intersect A(w). Suppose c(u) does not intersect A(w). Then A(w) is contained either in the left piece at u, L(u), or the right piece at u, R(u). If A(w) is contained in R(u) then it is necessary to explore the subtree at the right daughter of u, r(u). Algorithm 2 checks if any of its split cross over A(w) and check how these pieces may interact with pieces in the subtree of V at v. Therefore, in that case, split and push is called for r(u), v and w. All the possible cases and how to proceed in each case are outlined here. Exactly one of the following is true: (u,i) the region of w is in the left region of u, A(w) ⊆ L(u) (u,ii) the region of w is in the right region of u, A(w) ⊆ R(u) (u,iii) c(u) splits the region of w, A(w) ∩ c(u) 6= ∅ and, exactly one of the following is true: (v,i) the region of w is in the left region of v, A(w) ⊆ L(v) (v,ii) the region of w is in the right region of v, A(w) ⊆ R(v) (v,iii) c(v) splits the region of w, A(w) ∩ c(v) 6= ∅ 11 if A(w) ⊆ L(u) and A(w) ⊆ L(v) then combine(l(u), l(v), w) if A(w) ⊆ L(u) and A(w) ⊆ R(v) then combine(l(u), r(v), w) if A(w) ⊆ L(u) and A(w) ∩ c(v) 6= ∅ then combine(l(u), v, w) if A(w) ⊆ R(u) and A(w) ⊆ L(v) then combine(r(u), l(v), w) if A(w) ⊆ R(u) and A(w) ⊆ R(v) then combine(r(u), r(v), w) if A(w) ⊆ R(u) and A(w) ∩ c(v) 6= ∅ then combine(r(u), v, w) if A(w) ∩ c(u) 6= ∅ and A(w) ⊆ L(v) then combine(u, l(v), w) if A(w) ∩ c(u) 6= ∅ and A(w) ⊆ R(v) then combine(u, r(v), w) 3.2.3 Cases for Algorithm 2: Crossing splits When c(u) and c(v) split A(w) into four non-empty subsets, these splits are said to cross inside A(w). Only one of c(u) and c(v) can be used as the split for c(w). Which of c(u) and c(v) is chosen is arbitrary, but this choice impacts which parts of T 1 and T 2 are used in the recursive calls to Algorithm 2. For example, if c(u) is chosen as the split for w, then there is a recursive call for l(u), v and l(w), and a recursive call for r(u), v and r(w). Pseudo-code for using c(u) is given below, but for brevity, pseudo-code for using c(v), which is analogous to the code for using c(u), is omitted. choose either u or v to split A(w) suppose u is chosen to split A(w) then do the following create daughters for w, l(w) and r(w) let c(w) = c(u) (thus A(l(w)) = A(w) ∩ L(u) and A(r(w)) = A(w) ∩ R(u)) combine(l(u), v, l(w)) combine(r(u), v, r(w)) if v is chosen to split w, then do the above, but swap the roles of u and v 3.2.4 Cases for Algorithm 2: Parallel Splits When c(u) and c(v) are parallel in A(w), it is possible to use either one as the split for w. Since c(u) and c(v) are parallel in A(w), that is the subsets they create are nested, when one is used for the split for w, the other is present in the region of just one of the daughters of w. For example if c(u) is used as the split for w, and R(v) ∩ A(w) ⊂ R(u) ∩ A(w) then c(v) intersects A(r(w)) but not A(l(w)). Therefore when Algorithm 2 is called on r(u), v, and r(w), and called on l(u), l(v), and l(w). The cases when c(u) is used to split A(w) are 12 outlined below, and since they are similar, the instructions for when c(v) is used to split A(w) are omitted. choose either u ro v to split the region of w suppose u is chosen to split w then do the following create daughters for w, l(w) and r(w) let c(w) = c(u) (thus A(l(w)) = A(w) ∩ L(u) and A(r(w)) = A(w) ∩ R(u)) There are two cases for recursion: (i) if c(v) intersects L(u) ∩ A(w) then combine(l(u), v, l(w)) combine(r(u), r(v), r(w)) (ii) if c(v) intersects R(u) ∩ A(w) then combine(l(u), l(v), l(w)) combine(r(u), v, l(w)) if v is chosen to split w then do the above, but swap the roles of u and v 3.2.5 Cases for Algorithm 2: Identical Splits When c(u) and c(v) induce the same partition on A(w) either one can be used as the split at w. Pseudo-code for this situation is given below: let c(w) = c(u) create daughters for w, l(w) and r(w) if R(u) ∩ A(w) = R(v) ∩ A(w) then combine(l(u), l(v), l(w)) combine(r(u), r(v), r(w)) else (R(u) ∩ A(w) = L(v) ∩ A(w)) if R(u) ∩ A(w) = R(v) ∩ A(w) then combine(l(u), r(v), l(w)) combine(r(u), l(v), r(w)) 3.2.6 Cases for Algorithm 2: Terminal Node Reached When either node u or node v is terminal a base case is reached. There are three possibilities: both u and v are terminal, only u is terminal, or only v is terminal. If both u and v are terminal, then node w is assigned their values, Fw = (fu, fv). If only u is terminal, then the region of w, A(w) is further partitioned by T 2. Therefore, it is necessary to collect the subtree of T 2, contained in A(w), denoted T 2 A(w). Details for how to obtain TA(w) are in Section 3.1. Once TA(w) is obtained, the values in its terminal nodes are combined with fu. The resulting tree is appended to T at w. When only v is terminal, the operations are similar, only the roles of u and v, and T 1 and T 2 are switched. Pseudo-code is given below: 13 if u is terminal then copy the subtree at v inside the region A(w), call it TA(w) for each terminal node v′ in TA(w) replace its value, fv′ with Fv′ = (fu, fv′) else if v is terminal then do the same, but swap the roles of u and v 3.3 Correctness and Computational Cost The proof of correctness is much simpler in the special case when we assume that whenever given the option to choose a split for w from either u or v, c(u) is always chosen. Assuming c(u) is chosen whenever possible, Algorithm 2 performs a depth first search of T 1, until a terminal node of T 1 is reached. In some calls to Algorithm 2, the split from v will not intersect A(u). In this case proceeds by a recursive call to Algorithm 2 for u, and for whichever daughter of v, either l(v) or r(v), has a region, L(v) or R(v) which contains A(u). Since T 2 is a tree, any splits from T 2 which intersect A(u) must be present in the subtree of that daughter. This guarantees that whenever u is a terminal node of T 2 any portion of T 2 that intersects A(u) will be contained in the subtree of T 2 at v. Hence, once a terminal node of T 1 is reached, the subtree at v contains the entire subtree of T 2 inside A(u). In general, the Algorithm 2 is valid whether c(u) or c(v) is used when given the choice to split w. Lemma 3.1. At each call to Algorithm 2 the subtrees at the nodes of u and v, contain any parts of T 1 and T 2 which intersect with A(w). Proof. For the first call to Algorithm 2, u and v are the roots of T 1 and T 2, respectively; and A(w) is the entire domain D. We will argue by induction. We must prove that the inductive hypothesis is true for the input to Algorithm 2, then it must be true for recursive calls to Algorithm 2. This can easily be verified the four recursive cases as follows: (i) (intersection absent) If neither c(u) nor c(v) intersects A(w), then A(w) is completely contained inside one daughter of u and one daughter of v. The algorithm locates the daughters which contain A(w) can calls Algorithm 2 on that case. Suppose just one of c(u) doesn't intersect A(w) but c(v) does, then the algorithm identifies which daughter of c(u) contains A(w), and calls split and push on that daughter, v, and w. The last case is symmetric. (ii) (crossing splits) In this case c(u) and c(v) divide A(w) into four non-empty subsets. Suppose c(u) is used for the split of A(w). Since we have assumed the inductive hypothesis, any subtrees of T 1 that intersect A(w) are in the subtree at u. Since the subtrees at l(u) and r(u) are restricted to L(u) and R(u), respectively, the only subtrees of T 1 which intersect with L(w) and R(w) in the subtree at l(u) and r(u), respectively. Since c(v) crosses c(w), subtrees in T 2 which intersect A(l(w)) and A(r(w)) are in the subtree at v. Hence Algorithm 2 is called l(u), v and l(w), and r(u), v and r(w). The symmetric case, i.e. using c(v) as the split for w, is similar. 14 (iii) (parallel splits) In this case c(u) and c(v) divide A(w) into three non-empty subsets. Suppose c(u) is used as the split for A(w). The split c(v) intersects with the region for one daughter of w and not the other. Suppose c(v) intersect with the region of the left daughter of w, A(l(w)). In this case an subtrees of T 1 and T 2 which intersect with A(l(w)) are in subtrees at l(u) and v, respectively. Since c(u) and c(v) are parallel and c(v) intersects A(l(w)), the region of the right daughter of w, A(r(w)), is completely contained in either A(l(v)) or A(r(v)). Suppose A(r(w)) ⊂ A(r(v)). Thus, subtrees of T 1 and T 2 which intersect A(r(w)) are in subtrees at r(u) and r(v). Symmetric cases, with the roles of u and v, and/or the roles of their left and right daughters switched, follow similar lines of reasoning. (iv) (identical splits) Splits c(u) and c(v) are the same, possibly swapping left and right partitions. Suppose that A(w) ∩ L(u) = A(w) ∩ L(v). Any subtrees of T 1 and T 2 which intersect A(l(w)) are contained in the subtrees at l(u) and l(v); and likewise, any subtrees of T 1 and T 2 which intersect A(r(w)) are contained in the subtrees at r(u) and r(v), respectively. Assuming u is chosen whenever the choice between u and v must be made, Algorithm 2 is called once for each node in T 1. Once a terminal node of T 1 is reached, then Algorithm 1 is called at most once for each node in T 2. Therefore, in the worst case the total number of calls to Algorithm 2, and Collect Subtree, is n1n2, where n1 and n2 are the number of nodes in T 1 and T 2 respectively. 4 Tree distances and correlations The goal of this section is to describe, distances and correlations for trees, which quantify the degree of difference between two trees. We also describe how to efficiently compute distance and correlation between trees as an extension of Algorithm 2. 4.1 Tree Distances The norm of a function, f , with respect to a measure, p, on its domain, D, is kf k = (cid:18)ZD f (x)2dp(x)(cid:19)1/2 . (1) The norm of the difference between two functions f and g, defines a metric, also called a distance, kf − gk = (cid:18)ZD (f (x) − g(x))2dp(x)(cid:19)1/2 . (2) For trees, the square of the norm can be decomposed into a sum of the squares of norms of the set of terminal nodes, W , kT k2 = Xw∈W ZA(w) kfw(x)k2dp(x), 15 (3) since the regions of the terminal nodes are a partition of the domain. The sqaure of the distance between two trees, kT 1 − T 2k2, can be computed by: (1) combining them into a single tree T with each terminal node w ∈ WT associated with a multifunction (f 1 w), as described in Section 3, and (2) computing the sum of the sqaure of the distance between the functions at each terminal node of T, WT, w, f 2 kT 1 − T 2k2 = Xw∈WT ZA(w) kf 1 w(x) − f 2 w(x)k2dp(x). (4) For regression problems with continuous response, it is common to use a single scalar value at each terminal node, fw(x) = aw, and in this case the distance between two trees simplifies to kT 1 − T 2k2 = Xw∈WT w)2ZA(w) (a1 w − a2 1dp(x). (5) However, a different formula is required for classification and density estimation since in this context the trees map to sets of classes, or assignments of probabilities to sets of classes, and typically a metric to quantify the difference between classes is not provided. Classification trees often provide estimates of the class probabilities. Treating estimates of class probabili- ties as vectors, we can quantify the difference between two estimates of class probabilities as the norm of their difference. For classification trees which do not provide estimates of class probabilities a simple solution is to use a probability of 1 for the predicted class. Consider a classification problem with S classes. We assume that classification tree, T i, at terminal node w maps every point x ∈ A(w), to a vector of class probabilities [f i wss ∈ S] ∈ RS. Let T 1 and T 2 be classification or density estimation trees. When T 1 and T 2 are represented by a single tree T, the values at each terminal node w ∈ WT is a S by 2 dimensional matrix [f 1 wss ∈ S]. Thus the distance between T 1 and T 2 is ws, f 2 kT 1 − T 2k2 = Xw∈WTXs∈S (f 1 ws − f 2 ws)2ZA(w) 1dp(x). (6) Equations 5 and 6, both depend on the measure p and the regions of terminal nodes, A(w), w ∈ WT. Ideally, the measure p should reflect the unknown density from which the sample is obtained. Since the distribution is unknown we will have to estimate it and/or make assumptions. For instance we could assume that the distribution of the data comes from a uniform distribution on D, and use the uniform measure when computing the weight of each terminal node w ∈ WT . If data is available when computing the distance between T 1 and T 2 then we can use the proportion of the sample in the region of a terminal node as the weight for that node. This choice of measure would cause the distance to capture the discrepancy between T 1 and T 2 in regions which support the majority of the mass of the observed distribution, while ignoring their difference in regions with no data. If we use a uniform density for p then the distance between T 1 and T 2 can be computed with a recursive algorithm, which is more efficient than computing each term of the sum in Equation 5 or Equation 6 independently. We use p(A) to denote the measure of region A, 16 (cid:1876)(cid:2869) = 6.5 (cid:1858): 0,1 × 0,1 (cid:1372) {1,2,3} (cid:3409) (cid:1876)(cid:2870) = 5.2 > 1 > 2 (cid:3409) 3 Figure 3: Tree model for computational experiments. p(A) = RA 1dp(x). Data: a node w in the combined tree T from trees T 1 and T 2 Result: kT 1 − T 2k2 over A(w) normalized by the measure of A(w) if w is terminal then w − f 2 wk2 return kf 1 else pr ← p(A(r))/p(A(w)) pl ← p(A(l))/p(A(w)) return pltree dist(l) + prtree dist(r) end Algorithm 3: tree dist(w) Generalizations of distances to cases when response variables are elements of metric spaces other than R, e.g. Rp, would require a different bifunction to measure the difference between T 1 and T 2, but nevertheless methods for computing such distances would follow the same two steps as the univariate response case: (1) combine the trees and (2) reduce the problem a sum over the terminal nodes of the combined tree. We created a sample of 100 multivariate predictor and univariate response pairs, (x1, y1), . . . , (x100, y100), sampled with xi uniformly random in the region [0, 10] × [0, 10] and yi is obtained by eval- uating the tree in Figure 3 at xi (yi is not corrupted with noise). We used the Random Forest R Package to generate an ensemble of trees from this data and computed the dis- tance between each pair of trees. Multidimensional scaling plots of these tree distances are in Figure 4. Non-linear structures are apparent in these projections of the ensemble into three dimensional Euclidean space. Such patterns suggest motifs or families of trees in the ensemble. This result indicates that this metric could be used in a method for selecting a subset of representative element from the ensemble. However, the development of a formal method is left as a topic for further research. 17 0.05 0.04 0.03 0.02 0.01 0 2 s e x a S D M −0.01 −0.02 −0.03 −0.02 0 0.02 0.04 0.06 MDS axes 1 0.06 0.04 0.02 0 3 s e x a S D M −0.02 −0.04 −0.02 0 0.02 0.04 0.06 MDS axes 1 Figure 4: Multidimensional scaling plots of point cloud of a sample of trees from Random Forest, where distances between trees are measured in L2 function space. 4.2 Tree Correlations The distance between trees will quantify their difference, however, it is not standardized relative to the norms of the functions. Correlation is an alternative quantification of the similarity between trees which is on a standardized scale between -1 and 1. In this section we define correlation between two trees as a generalization of the commonly used Pearson correlation for random variables. The correlation between two trees, T 1 and T 2, is their covariance standardized by the product of their standard deviations, ρT 1,T 2 = σT 1,T 2 σT 1σT 2 . (7) The covariance between regression trees T 1 and T 2 quantifies their similarity as the integral of the product of their deviance from their respective mean values at each point x in their domain with respect to a measure p(x), σ2 T 1,T 2 = ZD (T 1(x) − µT 1)(T 2(x) − µT 2)dp(x), where the mean and standard deviation of regression tree T i are and µT i = ZD T i(x)dp(x) σ2 T i = ZD (T i(x) − µT i)2dp(x). 18 (8) (9) (10) Separating these integrals over the disjoint regions of the terminal nodes the mean and standard deviation of regression tree T i can be expressed as sums over WT i, the set of terminal nodes, T i(x)dp(x) µT i = Xw∈WT i ZA(w) (11) (12) and σ2 T i = Xw∈WT i ZA(w) (T i(x) − µT i)2dp(x). Similarly, the covariance for T 1 and T 2 can be expressed as a sum over W , the set of nodes in a combined tree representing T 1 and T 2, σ2 T 1,T 2 = Xw∈W ZA(w) (T 1(x) − µT 1)(T 2(x) − µT 2)dp(x). (13) Recursive algorithms with the same pattern and assumptions as Algorithm 3 can be formu- lated to compute tree means, variances, and covariances. Regarding classification problems, as discussed in Section 4.1, a rule for quantifying the discrepancy between the classes is not always available, however we can use the norm of the difference between the probability estimates of different classes to quantify the discrepancy between class predictions. If the response of classification trees is a vector of class probabili- ties, the definitions of correlation, covariance, mean, and variance for regression trees (7-10) no longer apply. However, generalizations of these concepts can be defined. The variance covariance matrix for a probability density tree quantifies the degree to which the probability of classes vary together, either above or below the average class proba- bilities. This can be used to diagnose the extent to which it is hard to discriminate between two classes. 4.3 Distances between Forests to the real numbers, and their aggregate functions F (x) = PJ Consider two forests f 1, . . . , f J and g1, . . . , gK, where each tree maps from the same domain j=1 f j(x) and G(x) = g1(x) + . . . + gK(x). The squared of the 2-norm or squared-distance between F and G with respect to a measure p is d(F, G) = RD(F (x) − G(x))2dp(x) (14) (15) When the measure p is restricted to a finite set of points masses, not too large in number, it will be possible to compute this distance directly from the representation of F and G as sums of trees. However, when p is continuous, or the if the p is constituted by a vast number of discrete points, it is not possible to compute the value of the d(F, G) directly by formula 14. If J and K are not too large, and the dimension of the domain of F and G is not too large, then it may be possible to represent F −G as a single tree using Alg. 2, evaluate the distance using Alg. 3. However, since the size of the combined tree will grow multiplicatively due to 19 trees split on dimension m. The sum of the first k functions is Fk = Pk the intersection of splits from the different trees the size of the combined tree F − G will be much larger than the sum of the sizes of the individual trees f 1, . . . , f J and g1, . . . , gK. With simplifying assumptions we can show that the size of the combined tree could grow exponentially in the number of trees a forest. Suppose each tree partitions the domain D = [0, 1]M into two pieces by partitioning on dimension m. Let (x1, . . . , xM ) be a point in D. Suppose an ensemble is composed of K trees representing functions of the form f k(x) = ak if xmk ≤ ck and f (x) = bk if xmk > ck for k = 1, . . . , K. Suppose that the first k1 trees split on dimension 1, that is mk = 1, and for each m = 2, ..., M, the next km i=1 f k. How many rectangular cells does the function FK partition D into? Assuming non-degeneracy Fk1 has k1 splits on dimension 1, and thus partitions the D into k1 + 1 cells. The plane x = ck1+1 intersects all the planes x = c1, . . . , x = ck1, and thus Fk1+1 partitions D into 2(k1 + 1) cells. Since ck1+2 6= ck1+1, adding f k1+2 introduces another k1 cells, therefore Fk1+2 partitions D into 3(k1 + 1) cells. Following the same argument Fm1+m2 partitions D into (k1 + 1)(k2 + 1) cells. Continuing the same argument for m = 3, . . . , M, we find that FM partitions D into nM = (k1 + 1) × . . . × (kp + 1) cells. Representing a partition of D into this many cells requires a binary tree with nM of leaf nodes, and nM − 1 internal nodes. So for example with just one tree per dimension, m = 1, . . . , M, the representative CART would have 2M +1 − 1 nodes. In stark contrast the total number of nodes in all trees of such a forest is 3M. Expanding the squared difference (F (x) − G(x))2 and using the linearity of the integral operator the squared distance between F and G can be computed as sums of much simpler terms, d(F, G) = RD(Pj(f j(x))2 +Pk(gk(x))2 − 2Pj,k f j(x)gk(x))dp(x) = (Pj RD(f j(x))2 +PkRD(gk(x))2 − 2Pj,kRD f j(x)gk(x))dp(x). (16) (17) The inner product of two trees RD T 1(x)T 2(x) can be computed using an algorithm with the same data and recursive format as Alg. 3, and for the base case, when w is a terminal node, the algorithm will return f 1 w instead of kf 1 w × f 2 w − f 2 wk. 5 Solutions for subproblems in specific tree contexts 5.1 Checking if a split divides a region 5.1.1 Univariate splits for discrete variable Suppose split c acts on a discrete variable x. Then the condition c is intersect a subset of the domain A, if it divides the elements of x in A into two non-empty sets. 5.1.2 Univariate splits for continuous variables When splits are made on a single variable at a time the intersection of a split and a region can be achieved by testing the intersection of the split and the restriction of the region to the same variable. That is if the region is defined by univariate linear inequalities, then only the inequalities involving the variable for the split being tested are relevant. Likewise, for 20 categorical variables it would only be necessary to test subsets of the variable for the split being tested. 5.2 Multivariate splits for continuous variables The purpose of this section is to describe the geometry of recursive partitions when multivari- ate splits are used for continuous variables, which results in polyhedral regions. Generally, computing volumes of polyhedra or integrals of functions over polyhedra requires exponen- tial time algorithms, or randomized approximations are used. Hence computing the L2 distance between recursive partition function with multi-variate splits may require imprac- tical amounts time. Fortunately, some of the most popular classification and regression tree methods, such as CART, Random Forest, and boosting with trees, use splits on one vari- able. Recursive partitions based on splitting the data with one variable at a time yield much simpler cases. Splitting the data based on one variable yields a partition of the domain into rectangular boxes. However, we provide some details for checking intersections or comput- ing volumes regions for trees based on multivariate splits since this may be useful for some applications. 5.2.1 Geometry of multivariate splits: hyperplanes and polytopes Given a scalar b ∈ R, and a vector, c, in n-dimensional real Euclidean space, Rn, a linear equality, c′x = b, defines a hyperplane H = {x ∈ Rnc′x = b}. A hyperplane can be used to define two complementary regions, H > = {xc′x > b} and H ≤ = {xc′x ≤ b}, called its upper open half-space, and its lower half-space, respectively. A polyhedron is a subset S ⊂ Rn which is defined by intersections of half-spaces and open half-spaces. A polyhedron can be divided into two complementary polyhedra contained in the complementary half-spaces of an intersecting hyperplane. A recursive partition is a plane tree, T , with a root, r, a node set V which naturally partitions into a set of interior nodes, I, a set of terminal nodes, L, called leafs. Each leaf associated with a natural number, nl ∈ N Each interior node, v ∈ I, associated with a hyperplane, Hv ⊂ Rn. The root and each interior node are associated with a left daughter and a right daughter, v≤ ∈ V , and v> ∈ V , respectively. Data at v are split, as follows. Data in the upper half-space H > v are partitioned to the right daughter and data in the lower half-space H ≤ v are partitioned to the left daughter. The hyperplane associated with v is oriented to intersect with the polyhedral region defined by the half-spaces along the path from the root, r, to v. Thus a recursive partition is a tuple of a plane tree and a set of hyperplanes associated with its nodes, (T, {Hvv ∈ T }) which are assumed to intersect in this fashion. Each point x ∈ Rn is contained in one of the polyhedral regions defined by the paths from the root to each leaf. That is for all x ∈ Rn, there is a unique leaf node, l ∈ L, such that, x ∈ S(r, l). Thus, a recursive partition defines a polyhedral subdivision of Euclidean space. Mapping each point x ∈ Rn to nl for l such that x ∈ S(r, l) defines a function f : Rn → N. We assume that recursive partitions are used to define functions on a box B = {x ∈ Rnli ≤ 21 (cid:1858)(cid:2869):(cid:1828)(cid:1599)(cid:1337)(cid:2870)(cid:1372)(cid:1331) (cid:1876)(cid:2869) = 1 (cid:3409) (cid:1876)(cid:2870) = 1 > > 3 2 > 1 2 0 (cid:3409) (cid:1876)(cid:2869) =(cid:3398)1 (cid:3409) (cid:1337)(cid:2870) (cid:1828) 0 1 3 (cid:1858)(cid:2870):(cid:1828)(cid:1599)(cid:1337)(cid:2870)(cid:1372)(cid:1331) (cid:1876)(cid:2869) = 0 (cid:3409) (cid:1876)(cid:2870) = 0 > > 2 1 2 0 1 0 (cid:3409) (cid:1337)(cid:2870) (cid:1828) Figure 5: Two functions mapping polyhedral regions of two dimensional real Euclidean space, R2, defined by recursive partitioning, to the natural numbers, N. 22 (cid:1337)(cid:2870) (cid:1828) (0,2) > (2,2) (1,2) (3,2) (0,0) (1,0) (1,1) (3,1) > (cid:1876)(cid:2869) = 1 (cid:3409) (cid:1832) = (cid:1858)(cid:2869),(cid:1858)(cid:2870) :(cid:1828)(cid:1599)(cid:1337)(cid:2870)(cid:1372)(cid:1331)(cid:2870) (cid:3409) (cid:1876)(cid:2870) = 1 (cid:1876)(cid:2870) = 0 (cid:3409) (cid:1876)(cid:2869) =(cid:3398)1 (cid:1876)(cid:2870) = 0 (cid:3409)(cid:1876)(cid:2869) = 0 (cid:3409) 1,0 > 1,1 > 2,2 > 1,2 > 3,1 3,2 (cid:3409) (cid:1876)(cid:2870) = 0 > 1,0 (cid:3409) 0,0 Figure 6: Representation of two recursive partitions, T 1 and T 2, shown in Fig. 5, as a single recursive partition F = (T 1, T 2) mapping from the same domain, B, to a range which is the product of the range of T 1 and the range of T 2. xi ≤ ui}. For example consider the functions T 1 : B ⊂ R2 → N and T 2 : B ⊂ R2 → N in Fig. 5 which are defined by recursive partitions. 5.2.2 Tests for intersection of a Hyperplane and a Polyhedron Let S be a polyhedral region in Rn defined by the intersection of half-spaces, that is H + . . . ∩ H + H intersect S? If not, then is S in H + or H −? 1 ∩ ix = bi}. Let H = {x ∈ Rnc′x = b} be a hyperplane. Does k where Hi = {x ∈ Rnc′ Answering the questions of whether or not a hyperplane intersects a polytope is re- lated to the problem in linear programming, of determining a set of minimal constraints for bounding a polytope. Due to the prevalence of linear programming this question has been investigated previously. A simple method is presented here, and finding the most efficient method available in the literature will be a topic of further research. A linear program can be used to determine if H intersects S. max c′x s.t. c′ ix ≤ bi∀i = 1, . . . , k c′x ≤ b + 1 (18) (19) (20) If the linear program defined by (18-20) is infeasible then the polytope S is inside H +. In this case the test should be conducted with the signs elements of c reversed so that the polytope S is contained inside the half-space defined by c′x ≤ b + 1. Otherwise the polyhedron is contained inside of H −. Let x∗ be an optimal solution to the linear program defined by (18-20). If c′x∗ < b then the hyperplane H does not intersect the polyhedron S. On the other hand if c′x∗ ≥ b then the hyperplane H and the polyhedron S intersect. 23 > (cid:1832) = (cid:1858)(cid:2869),(cid:1858)(cid:2870) :(cid:1828)(cid:1599)(cid:1337)(cid:2870)(cid:1372)(cid:1331)(cid:2870) (cid:1876)(cid:2870) = 0 (cid:3409) (cid:1876)(cid:2869) = 1 (cid:1876)(cid:2869) = 1 (cid:3409) (cid:3409) (cid:1876)(cid:2869) = 0 (cid:1876)(cid:2870) = 1 (cid:3409) (cid:3409)(cid:1876)(cid:2869) =(cid:3398)1 (cid:1876)(cid:2869) =(cid:3398)1 (cid:3409) 3,1 1,0 > 1,2 > 1,1 0,2 > > 3,2 > 2,2 (cid:3409) 0,0 > Figure 7: An alternate representation of F = (T 1, T 2) (Figure 6). 6 Concluding remarks and further research directions We presented a novel algorithm for computing a single tree which represents multiple re- cursive partition functions. This algorithm facilitates quantifying the degree of difference or similarity between pairs of recursive partition functions. Ensembles of trees are generally regarded as block-boxes for making predictions. However, is it feasible to simplify an ensemble of trees to just a few trees which have a similar level of predictive power? Although the algorithm presented in this paper could be used to combine many trees into a single tree, it may yield a tree which has many nodes, and would therefore be to large to comprehend entirely. Methods for identifying clusters in ensembles of trees based on correlations or distances between trees could be useful for building a smaller ensemble of a core of essential trees. We leave these questions for further research. References [Breiman, 1996] Breiman, L. (1996). Bagging predictors. Machine Learning, 24(2):123 -- 140. [Breiman, 2001] Breiman, L. (2001). Random Forests. Machine Learning, 45(1):5 -- 32. [Breiman et al., 1984] Breiman, L., Friedman, J., Stone, C. J., and Olshen, R. A. (1984). Classification and regression trees. CRC press. [Buhlmann and Yu, 2003] Buhlmann, P. and Yu, B. (2003). Boosting With the L 2 Loss. Journal of the American Statistical Association, 98(462):324 -- 339. [Chipman et al., 2010] Chipman, H. A., George, E. I., and McCulloch, R. E. (2010). BART: Bayesian additive regression trees. The Annals of Applied Statistics, 4(1):266 -- 298. [Chipman et al., 2012] Chipman, H. A., George, E. I., and McCulloch, R. E. (2012). Bayesian CART Model Search. 24 [Fern´andez-Delgado et al., 2014] Fern´andez-Delgado, M., Cernadas, E., Barro, S., and Amorim, D. (2014). Do we Need Hundreds of Classifiers to Solve Real World Classifi- cation Problems? Journal of Machine Learning Research, 15:3133 -- 3181. [Freund and Schapire, 1996] Freund, Y. and Schapire, R. E. (1996). Experiments with a new boosting algorithm. Proceeding of the Internation Conference on Machine Learning. [Friedman et al., 2000] Friedman, J., Hastie, T., and Tibshirani, R. (2000). Additive logistic regression: a statistical view of boosting (With discussion and a rejoinder by the authors). The Annals of Statistics, 28(2):337 -- 407. [Friedman, 1991] Friedman, J. H. (1991). Multivariate Adaptive Regression Splines. The Annals of Statistics, 19(1):1 -- 67. [Gordon and Olshen, 1978] Gordon, L. and Olshen, R. A. (1978). Asymptotically Efficient Solutions to the Classification Problem. The Annals of Statistics, 6(3):515 -- 533. [Hastie et al., 2009] Hastie, T., Tibshirani, R., Friedman, J., Hastie, T., Friedman, J., and Tibshirani, R. (2009). The elements of statistical learning, volume 2. Springer. [Mason et al., 2000] Mason, L., Baxter, J., Bartlett, P. L., and Frean, M. R. (2000). Boosting Algorithms as Gradient Descent. In Advances in Neural Information Processing Systems, pages 512 -- 518. [Mentch and Hooker, 2014] Mentch, L. and Hooker, G. (2014). Ensemble Trees and CLTs: Statistical Inference for Supervised Learning. [Scornet et al., 2015] Scornet, E., Biau, G., and Vert, J.-P. (2015). Consistency of random forests. The Annals of Statistics, 43(4):1716 -- 1741. [Strobl et al., 2009] Strobl, C., Malley, J., and Tutz, G. (2009). An introduction to recursive partitioning: rationale, application, and characteristics of classification and regression trees, bagging, and random forests. Psychological methods, 14(4):323 -- 48. [Wager and Walther, 2015] Wager, S. and Walther, G. (2015). Uniform Convergence of Random Forests via Adaptive Concentration. [Wu et al., 2007] Wu, X., Kumar, V., Ross Quinlan, J., Ghosh, J., Yang, Q., Motoda, H., McLachlan, G. J., Ng, A., Liu, B., Yu, P. S., Zhou, Z.-H., Steinbach, M., Hand, D. J., and Steinberg, D. (2007). Top 10 algorithms in data mining. Knowledge and Information Systems, 14(1):1 -- 37. [Wyner et al., 2015] Wyner, A. J., Olson, M., Bleich, J., and Mease, D. (2015). Explaining the Success of AdaBoost and Random Forests as Interpolating Classifiers. page 40. [Zhang and Singer, 2010] Zhang, H. and Singer, B. H. (2010). Recursive Partitioning and Applications. Springer Series in Statistics. Springer New York, New York, NY. [Zhang and Yu, 2005] Zhang, T. and Yu, B. (2005). Boosting with early stopping: Conver- gence and consistency. The Annals of Statistics, 33(4):1538 -- 1579. 25
1110.6387
2
1110
2011-10-31T14:54:50
Backdoors to Satisfaction
[ "cs.DS", "cs.AI", "cs.CC", "math.CO" ]
A backdoor set is a set of variables of a propositional formula such that fixing the truth values of the variables in the backdoor set moves the formula into some polynomial-time decidable class. If we know a small backdoor set we can reduce the question of whether the given formula is satisfiable to the same question for one or several easy formulas that belong to the tractable class under consideration. In this survey we review parameterized complexity results for problems that arise in the context of backdoor sets, such as the problem of finding a backdoor set of size at most k, parameterized by k. We also discuss recent results on backdoor sets for problems that are beyond NP.
cs.DS
cs
Backdoors to Satisfaction⋆ Serge Gaspers and Stefan Szeider Institute of Information Systems, Vienna University of Technology, A-1040 Vienna, Austria [email protected], [email protected] Dedicated to Mike Fellows on the occasion of his 60th birthday. Abstract. A backdoor set is a set of variables of a propositional formula such that fixing the truth values of the variables in the backdoor set moves the formula into some polynomial-time decidable class. If we know a small backdoor set we can reduce the question of whether the given formula is satisfiable to the same question for one or several easy formulas that belong to the tractable class un- der consideration. In this survey we review parameterized complexity results for problems that arise in the context of backdoor sets, such as the problem of find- ing a backdoor set of size at most k, parameterized by k. We also discuss recent results on backdoor sets for problems that are beyond NP. 1 Introduction Satisfiability (SAT) is the classical problem of determining whether a propositional for- mula in conjunctive normal form (CNF) has a satisfying truth assignment. The famous Cook-Levin Theorem [22, 57], stating that SAT is NP-complete, placed satisfiability as the cornerstone of complexity theory. Despite its seemingly specialised nature, satisfi- ability has proved to be extremely useful in a wide range of different disciplines, both from the practical as well as from the theoretical point of view. Satisfiability provides a powerful and general formalism for solving various important problems including hardware and software verification and planning [8, 75, 96, 53]. Satisfiability is the core of many reasoning problems in automated deduction; for instance, the package depen- dency management for the OpenSuSE Linux distribution and the autonomous controller for NASA’s Deep Space One spacecraft are both based on satisfiability [6, 97]. Over the last two decades, SAT-solvers have become amazingly successful in solving formulas with hundreds of thousands of variables that encode problems arising from various ap- plication areas, see, e.g., [48]. Theoretical performance guarantees, however, are far from explaining this empirically observed efficiency. In fact, there is an enormous gap between theory and practice. To illustrate it with numbers, take the exponential factor 1.308n of the currently fastest known exact 3SAT algorithm [51]. Already for n = 250 variables this number exceeds by far the expected lifetime of the sun in nanoseconds. ⋆ Research supported by the European Research Council (ERC), project COMPLEX REASON 239962. Hidden Structure and Parameterized Complexity The discrepancy between theory and practice can be explained by the presence of a certain “hidden structure” in real-world problem instances. It is a widely accepted view that the structure of real-world problem instances makes the problems easy for heuristic solvers. However, classic worst-case analysis is not particularly well-suited to take this hidden structure into account. The classical model is one-dimensional, where only one aspect of the input (its size in bits, or the number of variables for a SAT formula) is taken into account, and it does not differentiate whether or not the instance is otherwise well-structured. Parameterized Complexity, introduced by Mike Fellows together with Rod Downey offers a two-dimensional theoretical setting. The first dimension is the input size as usual, the second dimension (the parameter) allows to take structural properties of the problem instance into account. The result is a more fine-grained complexity analysis that has the potential of being more relevant to real-world computation while still ad- mitting a rigorous theoretical treatment and firm algorithmic performance guarantees. There are various ways of defining the “hidden structure” in a problem instance, yielding various ways to parameterize a problem. Islands of Tractability One way of coping with the high complexity of important prob- lems within the framework of classical complexity is the identification of tractable sub- problems, i.e., of classes of instances for which the problem can be solved in polyno- mial time. Each class represents an “island of tractability” within an ocean of intractable problems. For the satisfiability problem, researchers have identified dozens of such is- lands – one could speak of an archipelago of tractability. Usually it is quite unlikely that a real-world instance belongs to a known island of tractability, but it may be close to one. A very natural and humble way of parameteriz- ing a problem is hence to take the distance to an island of tractability as a parameter. Guo et al. [50] called this approach “distance to triviality”. For SAT, the distance is most naturally measured in terms of the smallest number variables that need to be in- stantiated or deleted such that the instance gets moved to an island of tractability. Such sets of variables are called backdoor sets because once we know a small backdoor set we can solve the instance efficiently. Thus backdoor sets provide a “clever reasoning shortcut” through the search space and can be used as an indicator for the presence of a hidden structure in a problem instance. Backdoor sets where independently introduced by Crama et al. [27] and by Williams et al. [98], the latter authors coined the term “backdoor”. The backdoor set approach to a problem consists of two steps: first a small back- door set is computed (backdoor detection), second the backdoor set is used to solve the problem at hand (backdoor evaluation). It is hence natural to consider an upper bound on the size of a smallest backdoor set as a parameter for both backdoor detection and backdoor evaluation. 2 Satisfiability The propositional satisfiability problem (SAT) was the first problem shown to be NP- hard [22, 57]. Despite its hardness, SAT solvers are increasingly leaving their mark 2 as a general-purpose tool in areas as diverse as software and hardware verification, automatic test pattern generation, planning, scheduling, and even challenging problems from algebra [48]. A literal is a propositional variable x or a negated variable ¬x. We also use the notation x = x1 and ¬x = x0. A clause is a finite set literals that does not contain a complementary pair x and ¬x. A propositional formula in conjunctive normal form, or CNF formula for short, is a set of clauses. An rCNF formula is a CNF formula where each clause contains at most r literals. For a clause C we write var(C) = { x : x ∈ C or ¬x ∈ C }, and for a CNF formula F we write var(F ) = SC∈F var(C). An r-CNF formula is a CNF formula where each clause contains at most r literals. For a set S of literals we write S = { x1−ǫ : xǫ ∈ S }. We call a clause C positive if C = var(C) and negative if C = var(C). For a set X of propositional variables we denote by 2X the set of all mappings τ : X → {0, 1}, the truth assignments on X. For τ ∈ 2X we let true(τ ) = { xτ (x) : x ∈ X } and false(τ ) = { x1−τ (x) : x ∈ X } be the sets of literals set by τ to 1 and 0, respectively. Given a CNF formula F and a truth assignment τ ∈ 2X we define F [τ ] = { C \ false(τ ) : C ∈ F, C ∩ true(τ ) = ∅ }. If τ ∈ 2{x} and ǫ = τ (x), we simple write F [x = ǫ] instead of F [τ ]. A CNF formula F is satisfiable if there is some τ ∈ 2var(F ) with F [τ ] = ∅, other- wise F is unsatisfiable. Two CNF formulas are equisatisfiable if either both are satisfi- able, or both are unsatisfiable. SAT is the NP-complete problem of deciding whether a given CNF formula is satisfiable [22, 57]. Islands of Tractability and Backdoors Backdoors are defined with respect to a fixed class C of CNF formulas, the base class (or target class, or more more figuratively, island of tractability). From a base class we require the following properties: (i) C can be recognized in polynomial time, (ii) the satisfiability of formulas in C can be decided in polynomial time, and (iii) C is closed under isomorphisms (i.e., if two formulas differ only in the names of their variables, then either both or none belong to C). Several base classes considered in this survey also satisfy additional properties. Consider a class C of CNF formulas. C is clause-induced if it is closed under sub- sets, i.e., if F ∈ C implies F ′ ∈ C for each F ′ ⊆ F . C is clause-defined if for each CNF formula F we have F ∈ C if and only if {C} ∈ C for all clauses C ∈ F . C is closed under variable-disjoint union if for any two CNF formulas F1, F2 ∈ C with var(F1) ∩ var(F2) = ∅, also F1 ∪ F2 ∈ C. C is self-reducible if for any F ∈ C and any partial truth assignment τ, also F [τ ] ∈ C. A strong C-backdoor set of a CNF formula F is a set B of variables such that F [τ ] ∈ C for each τ ∈ 2B. A weak C-backdoor set of F is a set B of variables such that F [τ ] is satisfiable and F [τ ] ∈ C holds for some τ ∈ 2B. A deletion C-backdoor set of F is a set B of variables such that F −B ∈ C, where F −B = (cid:8)C \ (cid:8)x0, x1 : x ∈ B(cid:9) : C ∈ F(cid:9). If we know a strong C-backdoor set of F of size k, we can reduce the satisfiability of F to the satisfiability of 2k formulas in C. Thus SAT becomes fixed-parameter tractable in k. If we know a weak C-backdoor set of F , then F is clearly satisfiable, and we can verify it by trying for each τ ∈ 2X whether F [τ ] is in C and satisfiable. If C is clause-induced, any deletion C-backdoor set of F is a strong C-backdoor set of F . For several base classes, deletion backdoor sets are of interest because they are easier to 3 detect than strong backdoor sets. The challenging problem is to find a strong, weak, or deletion C-backdoor set of size at most k if it exists. For each class C of CNF formulas we consider the following decision problems. STRONG C-BACKDOOR SET DETECTION Instance: A CNF formula F and an integer k ≥ 0. Parameter: The integer k. Question: Does F have a strong C-backdoor set of size at most k? The problems WEAK C-BACKDOOR SET DETECTION and DELETION C-BACKDOOR SET DETECTION are defined similarly. In fact, for the backdoor approach we actually need the functional variants of these problems, where if a backdoor set of size at most k exists, such a set is computed. However, for all cases considered in this survey, where backdoor detection is fixed- parameter tractable, the respective algorithms also compute a backdoor set. We also consider these problems for formulas with bounded clause lengths. All such results are stated for 3CNF formulas, but hold, more generally, for rCNF formulas, where r ≥ 3 is a fixed integer. 3 Base Classes In this section we define the base classes for the SAT problem that we will consider in this survey. 3.1 Schaefer’s Base Classes In his seminal paper, Schaefer [90] classified the complexity of generalized satisfiability problems in terms of the relations that are allowed to appear in constraints. For CNF satisfiability, this yields the following five base classes1. 1. Horn formulas: CNF formulas where each clause contains at most one positive literal. 2. Anti-Horn formulas: CNF formulas where each clause contains at most one nega- tive literal. 3. 2CNF formulas: CNF formulas where each clause contains at most two literals. 4. 0-valid formulas: CNF formulas where each clause contains at least one negative literal. 5. 1-valid formulas: CNF formulas where each clause contains at least one positive literal. We denote the respective classes of CNF formulas by HORN, HORN−, 2CNF, 0-VAL, and 1-VAL, and we write Schaefer = (cid:8)HORN, HORN−, 2CNF, 0-VAL, 1-VAL(cid:9). We note that all these classes are clause-defined, and by Schaefer’s Theorem, these are the only maximal clause-defined base classes. We also note that 0-VAL and 1-VAL are the only two base classes considered in this survey that are not self-reducible. 1 Affine Boolean formulas considered by Schaefer do not correspond naturally to a class of CNF formulas, hence we do not consider them here 4 3.2 Base Classes Based on Subsolvers State-of-the-art SAT-solvers are based on variants of the so-called Davis-Logemann- Loveland (DPLL) procedure [29, 30] (see also [23]). The DPLL procedure searches systematically for a satisfying assignment, applying first unit propagation and pure literal elimination as often as possible. Then, DPLL branches on the truth value of a variable, and recurses. The algorithms stops if either there are no clauses left (the original formula is satisfiable) or all branches of the search lead to an empty clause (the original formula is unsatisfiable). Unit propagation takes as input a CNF formula F that contains a “unit clause” {xǫ} and outputs F [x = ǫ]. Pure literal elimination takes as input a CNF formula F that has a “pure literal” xǫ, where x ∈ var(F ) and x1−ǫ /∈ SC∈F C, and outputs F [x = ǫ]. In both cases F and F [x = ǫ] are equisatisfiable. If we omit the branching, we get an incomplete algorithm which decides satisfiability for a subclass of CNF formulas. Whenever the algorithm reaches the branching step, it halts and outputs “give up”. This incomplete algorithm is an example of a “subsolver” as considered by Williams et al. [98]. The DPLL procedure gives rise to three non-trivial subsolvers: UP + PL (unit propagation and pure literal elimination are available), UP (only unit propagation is available), PL (only pure literal elimination is available). We associate each subsolver with the class of CNF formulas for which it determines the satisfiability (this is well-defined, since unit propagation and pure literal elimination are confluent operations). Since the subsolvers clearly run in polynomial time, UP + PL, UP, and PL form base classes. We write Subsolver = {UP + PL, UP, PL}. 3.3 Miscellaneous Base Classes Renamable Horn Let X be a set of variables and F a CNF formula. We let rX (F ) denote the CNF formula obtained from F by replacing for every variable x ∈ X, all occurrences of xǫ in F with x1−ǫ, for ǫ ∈ {0, 1}. We call rX (F ) a renaming of F . Clearly F and rX (F ) are equisatisfiable. A CNF formula is called renamable Horn if it has a renaming which is Horn, and we denote the class of renamable Horn formulas as RHORN. It is easy to see that HORN is a strict subset of RHORN. One can find in polynomial time a Horn renaming of a given CNF formula, if it exists [58]. Hence RHORN is a further base class. In contrast to HORN, RHORN is not clause-defined. Forests Many NP-hard problems can be solved in polynomial time for problem in- stances that are in a certain sense acyclic. The satisfiability problem is no exception. There are various ways of defining a CNF formula to be acyclic. Here we consider acyclicity based on (undirected) incidence graphs: the incidence graph of a CNF for- mula F is the bipartite graph whose vertices are the variables and the clauses of F ; a variable x and a clause C are joined by an edge if and only if x ∈ var(C). Let FOREST denote the class of CNF formulas whose undirected incidence graphs are forests. It is well known that FOREST forms islands of tractability: the satisfiability of CNF formu- las whose incidence graphs have bounded treewidth can be decided in linear time [43, 88]. FOREST is the special case of formulas with treewidth at most 1. 5 Base Class C ∈ Schaefer C ∈ Subsolver FOREST RHORN CLU WEAK W[2]-h [65] (FPT) W[P]-c [93] W[2]-h [46] (FPT [46]) W[2]-h W[2]-h [66] (FPT) STRONG FPT [65] W[P]-c [93] ?† (?) W[2]-h (?) W[2]-h [66] (FPT [66]) DELETION FPT [65] n/a FPT FPT [78] FPT [66] ( ) It is indicated in parentheses if the complexity of the problem for 3CNF formulas is different from general CNF or unknown. ? It is open whether the problem is fixed-parameter tractable. † Theorem 5 gives an fpt approximation for this problem. n/a Deletion backdoor sets are undefined for base classes that are not clause-induced. Table 1. The parameterized complexity of WEAK, STRONG, and DELETION C-BACKDOOR SET DETECTION for various base classes C. Clusters A CNF formula F is called a hitting if any two distinct clauses clash. Two clauses C, C′ ∈ F clash if they contain a complimentary pair of literals, i.e., C ∩ C′ 6= ∅. A CNF formula is called a clustering formula if it is a variable disjoint union of hitting formulas. We denote by CLU the class of clustering formulas. Clustering formulas not only allow polynomial-time SAT decision, one can even count the number of satisfying truth assignments in polynomial time. This is due to the fact that each truth assignment invalidates at most one clause of a hitting formula [52, 66]. 4 Detecting Weak Backdoor Sets It turns out that for all base classes C considered in this survey, WEAK C-BACKDOOR SET DETECTION is W[2]-hard. In several cases, restricting the input formula to 3CNF helps, and makes WEAK C-BACKDOOR SET DETECTION fixed-parameter tractable. In the proof of the following proposition we use a general approach that entails previously published proofs (such as in [46, 65, 66]) as special cases. Proposition 1. WEAK C-BACKDOOR SET DETECTION is W[2]-hard for all base classes C ∈ Schaefer ∪ {RHORN, FOREST, CLU}. Proof. We show W[2]-hardness for C ∈ {2CNF, HORN, 0-VAL, RHORN, FOREST, CLU}. The hardness proofs for the remaining two classes 1-VAL and HORN− are sym- metric to the proofs for 0-VAL and HORN, respectively. Let G be a CNF formula with a set X ⊆ var(G) of its variables marked as external, all other variables of G are called internal. We call G an or-gadget for a base class C if G has the following properties: 1. G /∈ C. 2. G ∈ 1-VAL. 3. G[x = 1] ∈ C holds for all x ∈ X. 4. For each clause C ∈ G either X ⊆ C or var(C) ∩ X = ∅. 6 5. var(G) \ X 6= ∅. 6. G can be constructed in time polynomial in X. First, we show the following meta-result, and then we define or-gadgets for the different base-classes. Claim 1: If C is clause-induced, closed under variable-disjoint union, and has an or-gadget for any number ≥ 1 of external variables, then WEAK C-BACKDOOR SET DETECTION is W[2]-hard. i i , . . . , Gk+1 We prove the claim by giving a parameterized reduction from the W[2]-complete problem HITTING SET (HS) [33]. Let (S, k), S = {S1, . . . , Sm}, be an instance of HS. Let I = {1, . . . , m} × {1, . . . , k + 1}. For each Si we construct k + 1 or-gadgets whose external variables are exactly the elements of Si, and whose in- G1 ternal variables do not appear in any of the other gadgets Gj ′ i′ for (i′, j′) ∈ I \ {(i, j)}. Let F = S(i,j)∈I Gj i . From Property 6 it follows that F can be constructed from S in polynomial time. We show that S has a hitting set of size k if and only if F has a weak C-backdoor set of size k. Assume B ⊆ Sm i=1 Si is a hitting set of S of size k. Let τ ∈ 2B the truth assignment that sets all variables from B to 1. By Properties 2 and 3, Gj i [τ ] is satisfiable and belongs i [τ ])∩var(Gj ′ to C for each (i, j) ∈ I. By Property 4, var(Gj i′ [τ ]) = ∅ for any two distinct pairs (i, j), (i′, j′) ∈ I. Consequently F [τ ] is satisfiable, and since C is closed under variable-disjoint union, F [τ ] belongs to C. Thus B is a weak C-backdoor set of F of size k. i [τ ] is satisfiable (since Gj Conversely, assume that B ⊆ var(F ) is a weak C-backdoor set of F of size k. Hence, there exists a truth assignment τ ∈ 2B such that F [τ ] is satisfiable and belongs i [τ ] ⊆ F ), and Gj to C. Clearly for each (i, j) ∈ I, Gj i [τ ] ∈ C i /∈ C by Property 1, B ∩ var(Gj (since C is clause-induced). However, since Gj i ) 6= ∅ for i . . . , Gk+1 each (i, j) ∈ I. Let 1 ≤ i ≤ m. By construction, F contains k + 1 copies G1 of the same gadget. From Property 5 it follows that all the k + 1 copies are different. Since B ≤ k, there must be some xi ∈ B such that there are 1 ≤ j′ < j′′ ≤ k + 1 with xi ∈ var(Gj ′ i , hence xi ∈ B ∩ Si. Consequently, B is a hitting set of S. i ). It follows that xi is an external variable of Gj ′ i ) ∩ var(Gj ′′ i Hence we have indeed a parameterized reduction from HS to WEAK C-BACKDOOR SET DETECTION, and Claim 1 is shown true. We define for each class C ∈ {2CNF, HORN, 0-VAL, RHORN, FOREST, CLU} an or-gadget F (C) where X = {x1, . . . , xs} is the set of external variables; internal variables are denoted zi. – G(2CNF) = {X ∪ {z1, z2}}. – G(HORN) = G(0-VAL) = {X ∪ {z1}}. – G(RHORN) = {X ∪ {¬z1, ¬z2}, {z1, ¬z2}, {¬z1, z2}, {z1, z2}}. – G(FOREST) = {X ∪ {¬z1, ¬z2}, {z1, z2}}. – G(CLU) = {X ∪ {z1}, {z1}}. Since the considered classes C are clearly clause-induced and closed under variable- disjoint union, the proposition now follows from Claim 1. ⊓⊔ For base classes based on subsolvers, weak backdoor set detection is even W[P]-hard. This is not surprising, since the subsolvers allow a propagation through the formula 7 which is similar to the propagation in problems like MINIMUM AXIOM SET or DE- GREE 3 SUBGRAPH ANNIHILATOR [33]. The proof of the following theorem is based on a reduction from the W[P]-complete problem CYCLIC MONOTONE CIRCUIT AC- TIVATION. Theorem 1 ([93]). WEAK C-BACKDOOR SET DETECTION is W[P]-complete for all base classes C ∈ Subsolver. This even holds if the input formula is in 3CNF. In summary, we conclude that WEAK C-BACKDOOR SET DETECTION is at least W[2]-hard for all considered base classes. If we restrict our scope to 3CNF formulas, we obtain mixed results. Proposition 2. For every clause-defined class C, WEAK C-BACKDOOR SET DETEC- TION is fixed-parameter tractable for input formulas in 3CNF. Proof. The result follows by a standard bounded search tree argument, sketched as follows. Assume we are given a CNF formula F /∈ C and an integer k. We want to decide whether F has a weak C-backdoor set of size ≤ k. Since C is clause-defined, F contains a clause C such that {C} /∈ C. Hence some variable of var(C) must belong to any weak C-backdoor set of F . There are at most 3 such variables, each of which can be set to true or to false. Hence we branch in at most 6 cases. By iterating this case distinction we build a search tree T , where each node t of T corresponds to a partial truth assignment τt. We can stop building the tree at nodes of depth k and at nodes t where F [τt] ∈ C. It is now easy to see that F has a weak C-backdoor set of size at most k if and only if T has a leaf t such that F [τt] ∈ C and F [τt] is satisfiable. For each leaf we can check in polynomial time whether these properties hold. ⊓⊔ In particular, WEAK C-BACKDOOR SET DETECTION is fixed-parameter tractable for C ∈ Schaefer if the input formula is in 3CNF. The proof of Proposition 2 can be extended to the class CLU of clustering formulas. Nishimura et al. [66] have shown that a CNF formula is a clustering formula if and only if it does not contain (i) two clauses C1, C2 that overlap (C1 ∩ C2 6= ∅) but do not clash (C1 ∩ C2 = ∅), or (ii) three clauses D1, D2, D3 where D1 and D2 clash, D2 and D3 clash, but D1 and D3 do not clash. {C1, C2} is called an overlap obstruction, {D1, D2, D2} is called a clash obstruction. Each weak CLU-backdoor set of a CNF for- mula F must contain at least one variable from each overlap and each clash obstruction. However, if F is a 3CNF formula, the number of variables of an overlap obstruction is at most 5, and the number of variables of a clash obstruction is at most 7. Hence we can find a weak CLU-backdoor set of size at most k with a bounded search tree, which gives the following result. Proposition 3. WEAK CLU-BACKDOOR SET DETECTION is fixed-parameter tracta- ble for 3CNF formulas. Proposition 4. WEAK RHORN-BACKDOOR SET DETECTION is W[2]-hard, even for 3CNF formulas. Proof. Similarly to the proof of Proposition 1 we reduce from HS. As gadgets we use formulas of the form G = {{z1, ¬x1, ¬z2}, {z2, ¬x2, ¬z3}, . . . , {zs, ¬xs, ¬zs+1}, 8 {¬z1, zs+1}, {¬z1, ¬zs+1}, {z1, zs+1}}, where x1, . . . , xs are external variables and z1, . . . , zs+1 are internal variables. G can be considered as being obtained form the complete formula { {zǫ s+1} : ǫ, δ ∈ {0, 1} } by “subdividing” the clause {z1, ¬zs+1}. G /∈ RHORN but G[xi = 0] ∈ RHORN. In fact, rX (G[xi = 0]) ∈ HORN for X = {zi+1, . . . , zs+1}, hence no external variable needs to be renamed. Moreover, we can satisfy G[xi = 0] by setting all external variables and z1 to 0, and by setting zs+1 to 1. 1, zδ i , . . . , Gk+1 i Let (S, k), S = {S1, . . . , Sm}, be an instance of HS. For each Si we construct , each having Si as the set of its external variables, and the k + 1 gadgets G1 internal variables are new variables only used inside a gadget. We let F to be the union of all such gadgets Gj i for 1 ≤ i ≤ m and 1 ≤ j ≤ k + 1. Similar to the proof of Proposition 1 we can easily show that S has a hitting set of size k if and only if F has a weak RHORN-backdoor set of size k. The proposition follows. ⊓⊔ According to Propositions 2 and 3, WEAK C-BACKDOOR SET DETECTION is fixed-parameter tractable for certain base classes C and input formulas in 3CNF. For the classes C covered by Propositions 2 and 3 it holds that for every 3CNF formula F /∈ C we can find a set of variables of bounded size, an “obstruction”, from which at least one variable must be in any weak C-backdoor set of F . Hence a weak C back- door set of size at most k can be found by means of a bounded search tree algorithm. The next result shows that fixed-parameter tractability also prevails for the base class FOREST. However, the algorithm is considerably more complicated, as in this case we do not have obstructions of bounded size. Theorem 2 ([46]). WEAK FOREST-BACKDOOR SET DETECTION is fixed-parameter tractable for 3CNF formulas. Proof (Sketch). We sketch the fpt algorithm from [46] deciding whether a 3CNF for- mula has a weak FOREST-backdoor set of size k. We refer to [46] for the full details and the correctness proof. Let G denote the incidence graph of F . The first step of the algorithm runs an fpt algorithm (with parameter k′) by Bodlaender [9] that either finds k′ = 2k + 1 vertex-disjoint cycles in G or a feedback vertex set of G of size at most 12k′2 − 27k′ + 15. In case a feedback vertex set X is returned, a tree decomposition of G \ X of width 1 is computed and X is added to each bag of this tree decomposition. As the WEAK FOREST-BACKDOOR SET DETECTION problem can be defined in Monadic Second Order Logic, a meta-theorem by Courcelle [26] can use this tree decomposition to conclude. In case Bodlaender’s algorithm returns k′ vertex-disjoint cycles, the algorithm finds a set S∗ of O(4kk6) variables such that any weak FOREST-backdoor set of size k con- tains at least one variable from S∗. In this case, the algorithm recurses by considering all possibilities of assigning a value to a variable from S∗. Let C1, . . . , Ck′ denote the variable-disjoint cycles returned by Bodlaender’s algo- rithm. Consider a variable x ∈ var(F ) and a cycle C. We say that x kills C internally if x ∈ C. We say that x kills C externally if x /∈ C and C contains a clause u ∈ F such that x ∈ var(u). 9 As our k′ cycles are all vertex-disjoint, at most k cycles may be killed internally. The algorithm goes through all choices of k cycles among C1, . . . , Ck′ that may be killed internally. All other cycles, say C1, . . . , Ck+1, are not killed internally and need to be killed externally. The algorithm now computes a set S ⊆ var(F ) of size O(k6) such that any weak FOREST-backdoor set of size k, which is a subset of var(F ) \ Sk+1 i=1 var(Ci), contains at least one variable from S. The union of all such S, taken over all choices of cycles to be killed internally, forms then the set S∗ that was to be computed. For each cycle from C1, . . . , Ck+1, compute its set of external killers in var(F ) \ Sk+1 i=1 var(Ci). Only these external killers are considered from now on. If one such cycle has no such external killer, then there is no solution with the current specifications and the algorithm backtracks. For each i, 1 ≤ i ≤ k + 1, let xi denote an external killer of Ci with a maximum number of neighbors in Ci. The algorithm executes the first applicable from the following rules. Multi-Killer Unsupported If there is an index i, 1 ≤ i ≤ k + 1 such that xi has ℓ ≥ 4k neighbors in Ci and at most 4k2 + k external killers of Ci have at least ℓ/(2k) neighbors in Ci, then include all these external killers in S. Multi-Killer Supported If there is an index i, 1 ≤ i ≤ k + 1 such that xi has ℓ ≥ 4k neighbors in Ci and more than 4k2 + k external killers of Ci have at least ℓ/(2k) neighbors in Ci, then set S = {xi}. Large Overlap If there are two cycles Ci, Cj, 1 ≤ i 6= j ≤ k+1, with at least 16k4+k common external killers, then set S = ∅. Small Overlap Otherwise, include in S all vertices that are common external killers of at least two cycles from C1, . . . , Ck+1. The algorithm recursively checks for each s ∈ S∗ whether the formulas F [s = 0] and F [s = 1] have a weak FOREST-backdoor set of size k − 1 and returns YES if any such recursive call was successful and NO otherwise. ⊓⊔ 5 Detecting Strong Backdoor Sets Proposition 5 ([65]). STRONG C-BACKDOOR SET DETECTION is fixed-parameter tractable for every base class C ∈ Schaefer. For C ∈ {0-VAL, 1-VAL}, the problem is even solvable in polynomial time. Proof. Consider a CNF formula F . Strong HORN-backdoor sets of F are exactly the vertex covers of the positive primal graph of F , whose vertex set is var(F ), two vari- ables are joined by an edge if they appear together positively in a clause. Strong HORN−-backdoor sets can be characterized symmetrically. Strong 2CNF-backdoor sets of F are exactly the hitting sets of the hypergraph whose vertex set is var(F ) and whose hyperedges are all the subsets e ⊆ var(F ) of size three such that e ⊆ var(C) for a clause C ∈ F . Thus STRONG C-BACKDOOR SET DETECTION for C ∈ {HORN, HORN−, 2CNF} can be accomplished by fpt algorithms for VERTEX COVER [19] and 3-HITTING SET [40]. The smallest strong 1-VAL-backdoor set of F is exactly the union of var(C) for all negative clauses C ∈ F , the smallest strong 0-VAL-backdoor set of F is exactly the union of var(C) for all positive clauses C ∈ F . ⊓⊔ 10 Proposition 6. STRONG RHORN-BACKDOOR SET DETECTION is W[2]-hard. i for 1 ≤ i ≤ m and 1 ≤ j ≤ k + 1. Let V = Sm Proof. The proof uses a reduction from HS similar to the proof of Proposition 1. An instance (S, k), S = {S1, . . . , Sm}, of HS is reduced to a formula F which is the union of certain gadgets Gj i=1 Si. A gadget Gj i contains the four clauses Si ∪ {z1, z2}, {z1, ¬z2}, {¬z1, z2}, and V ∪ {¬z1, ¬z2}, where z1, z2 are internal variables that do not occur outside the gadget. Let B ⊆ V be a hitting set of S and let τ ∈ 2B. If τ sets at least one variable to 0, then τ removes from each gadget the only negative clause, hence rvar(F )(F [τ ]) ∈ HORN. On the other hand, if τ sets all variables from B to 1, then it removes from each gadget the only positive clause (B is a hitting set). Hence, F [τ ] ∈ HORN in this case. Consequently B is a strong RHORN-backdoor set of F . Conversely, assume B is a strong RHORN-backdoor set of F . Let τ ∈ 2B be the all-1-assignment. For the sake of contradiction, assume there is a set Si such that B ∩ Si = ∅. Since B = k, B ∩ var(Gj i [τ ] = {Si ∪ {z1, z2}, {z1, ¬z2}, {¬z1, z2}, {¬z1, ¬z2}} which is not renamable Horn, hence B is not a strong RHORN-backdoor set of F , a contradiction. Hence B is a hitting set of S. ⊓⊔ It is not known whether STRONG FOREST-BACKDOOR SET DETECTION is fixed- parameter tractable nor whether STRONG RHORN-BACKDOOR SET DETECTION is fixed-parameter tractable for 3CNF formulas. For the former problem, however, we know at least an fpt approximation [46]; see Theorem 5 below. i ) = ∅ for some 1 ≤ j ≤ k + 1. Now F [τ ] contains the subset Gj The following result is shown by a reduction from CYCLIC MONOTONE CIRCUIT ACTIVATION, similarly to Theorem 1. Theorem 3 ([93]). STRONG C-BACKDOOR SET DETECTION is W[P]-complete for ev- ery base class C ∈ Subsolver, even for formulas in 3CNF. The bounded search tree method outlined above for WEAK CLU-BACKDOOR SET DETECTION for 3CNF formulas can clearly be adapted for strong backdoors. Hence we get the following result. Proposition 7. STRONG CLU-BACKDOOR SET DETECTION is fixed-parameter trac- table for 3CNF formulas. 5.1 Empty Clause Detection Dilkina et al. [31] suggested to strengthen the concept of strong backdoor sets by means of empty clause detection. Let E denote the class of all CNF formulas that contain the empty clause. For a base class C we put C{} = C ∪E; we call C{} the base class obtained from C by adding empty clause detection. Formulas often have much smaller strong C{}-backdoor sets than strong C-backdoor sets [31]. Dilkina et al. show that, given a CNF formula F and an integer k, determining whether F has a strong HORN{}-back- door set of size k, is both NP-hard and co-NP-hard (here k is considered just as part of the input and not as a parameter). Thus, the non-parameterized search problem for strong HORN-backdoor sets gets harder when empty clause detection is added. It turns out that also the parameterized problem gets harder when empty clause detection is added. 11 Theorem 4 ([94]). For every clause-induced base class C such that at least one satis- fiable CNF formula does not belong to C the problem STRONG C{}-BACKDOOR SET is W[1]-hard. The theorem clearly applies to all base classes in Schaefer ∪ {RHORN, FOREST}. The proof from [94] relies on a reduction from [39], where a reduction to 3CNF formu- las is also given. Thus, Theorem 4 also holds for 3CNF formulas. 6 Detecting Deletion Backdoor Sets In this section we consider the parameterized complexity of DELETION C-BACKDOOR SET DETECTION for the various base classes C from above. For most of the classes the complexity is easily established as follows. For Schaefer classes, strong and deletion backdoor sets coincide, hence the FPT results carry over. The subsolver classes are not clause-induced, hence it does not make sense to consider deletion backdoor sets. DELETION FOREST-BACKDOOR SET DETECTION can be solved by algorithms for a slight variation of the feedback vertex set problem, and is therefore FPT. One has only to make sure that the feedback vertex set contains only variables and no clauses. This, however, can be achieved by using algorithms for WEIGHTED FEEDBACK VERTEX SET [77, 17]. It is tempting to use Chen et al.’s FPT algorithm for directed feedback vertex set [20] for the detection of deletion backdoor sets. The corresponding base class would contain all CNF formulas with acyclic directed incidence graphs (the orientation of edges indicate whether a variable occurs positively or negatively). Unfortunately this class is not suited as a base class since it contains formulas where each clause contains either only positive literals or only negative literals, and SAT is well known to be NP- hard for such formulas [45]. Hence we are left with the classes CLU and RHORN. For the detection of deletion CLU-backdoor sets we can use overlap obstructions and clash obstructions, as defined before Proposition 3. With each obstruction, we as- sociate a deletion pair which is a pair of sets of variables. With an overlap obstruction {C1, C2}, we associate the deletion pair {var(C1 ∩ C2), var((C1 \ C2) ∪ (C2 \ C1))}, and with a clash obstruction {D1, D2, D3}, we associate the deletion pair {var((D1 \ D3) ∩ D2), var((D3 \ D1) ∩ D2)}. For a formula F , let GF denote the graph with vertex set var(F ) that has an edge xy if and only if there is a deletion pair {X, Y } of F with x ∈ X and y ∈ Y . Nishimura et al. [66] have shown that a set X ⊆ var(F ) is a deletion CLU-backdoor set of F if and only if X is a vertex cover of GF . Thus, the detection of a deletion CLU-backdoor set of size k can be reduced to the problem of checking whether GF has a vertex cover of size k, for which there exist very fast algorithms (see for example [19]). Proposition 8 ([66]). DELETION CLU-BACKDOOR SET DETECTION is fixed-parame- ter tractable. 12 The remaining case is the class RHORN. As noted by Gottlob and Szeider [49] without proof (see also [79]), one can show fixed-parameter tractability of DELE- TION RHORN-BACKDOOR SET DETECTION by reducing it to the problem 2SAT DELETION. The latter problem takes as input a 2CNF formula and an integer k (the parameter), and asks whether one can make the formula satisfiable by deleting at most k clauses. 2SAT DELETION was shown fixed-parameter tractable by Razgon and O’Sullivan [79]. Here we give the above mentioned reduction. Lemma 1. There is a parameterized reduction from DELETION RHORN-BACKDOOR SET DETECTION to 2SAT DELETION. Proof. Let (F, k) be a given instance of DELETION RHORN-BACKDOOR SET DE- TECTION. We construct a graph G = (V, E) by taking as vertices all literals xǫ, for x ∈ var(F ) and ǫ ∈ {0, 1}, and by adding two groups of edges. The first group consists of all edges x0, x1 for x ∈ var(F ), the second group consists of all edges xǫyδ for x, y ∈ var(F ), ǫ, δ ∈ {0, 1}, such that xǫ, yδ ∈ C for some C ∈ F . Observe that the edges of the first group form a perfect matching M of the graph G. Claim 1. F has a deletion RHORN-backdoor set of size at most k if and only if G has a vertex cover with at most M + k vertices. (⇒) Let B be a deletion RHORN-backdoor set of F of size at most k and X ⊆ var(F )\B such that rX (F −B) ∈ HORN. Let N = { x0 : x ∈ var(F )\X }∪{ x1 : x ∈ X }. Let K = { x0, x1 : x ∈ B } ∪ N . By definition, K = M + B ≤ M + k. We show that K is a vertex cover of G. Consider an edge e = x0x1 ∈ M of the first group. If x ∈ X, then x1 ∈ N ⊆ K and if x /∈ X, then x0 ∈ N ⊆ K. Hence e is covered by K. It remains to consider an edge f = xǫyδ of the second group. If x ∈ B or y ∈ B, then this edge is covered by K. Hence assume x, y /∈ B. By construction of G, there is a clause C ∈ F with xǫ, yδ ∈ C. Since x, y /∈ B, there is also a clause C′ ∈ F − B with xǫ, yδ ∈ C. Since C′ corresponds to a Horn clause C′′ ∈ rX (F − B), at least one of the literals xǫ, yδ belongs to N , and hence K covers the edge f . Hence the first direction of Claim 1 follows. (⇐) Let K be a vertex cover of G with at most M + k vertices. Let B ⊆ var(F ) be the set of all variables x such that both x0, x1 ∈ K. Clearly B ≤ k. Let X ⊆ var(F ) \ B such that x1 ∈ K. We show that rX (F − B) ∈ HORN. Let xδ, yǫ be two literals that belong to a clause C′′ of rX (F − B). We show that ǫ = 0 or δ = 0. Let C′ ∈ F − B the clause that corresponds to C′′, and let xǫ′ ∈ C′. It follows that xǫ′ ∈ K. If xǫ′ ∈ K then ǫ = 0, if yδ′ ∈ K then δ = 0. Since xδ, yǫ ∈ C′′ ∈ rX (F − B) were chosen arbitrarily, we conclude that rX (F − B) ∈ HORN. Hence Claim 1 is shown. ∈ E, and since K is a vertex cover of G, xǫ′ yδ′ , yδ′ ∈ K or yδ′ Mishra et al. [63] already observed that a reduction from [16] can be adapted to show that this above-guarantee vertex cover problem can be reduced to 2SAT DELE- TION. For completeness, we give a reduction here as well. We construct a 2CNF formula F2 from G. For each vertex xǫ of G we take a variable xǫ. For each edge x0x1 ∈ M we add a negative clause {¬x0, ¬x1}, and for each edge xǫyδ ∈ E \ M we add a positive clause {xǫ, yδ}. Claim 2. G has a vertex cover with at most M + k vertices if and only if we can delete at most k negative clauses from F2 to obtain a satisfiable formula. 13 2. We define a truth assignment τ ∈ 2var(F ′ (⇒) Let K be a vertex cover of G. We delete from F2 all negative clauses {¬x0, ¬x1} where both x0, x1 ∈ K (there are at most k such clauses) and obtain a 2) by setting a variable to 1 2CNF formula F ′ if and only if it belongs to K. It remains to show that τ satisfies F ′ 2. The negative clauses are satisfied since τ sets exactly one literal of a negative clause {¬x0, ¬x1} ∈ F ′ 2 to 1 and exactly one to 0. The positive clauses are satisfied since each positive clause {xǫ, yδ} corresponds to an edge xǫyδ ∈ E, and since K is a vertex cover, τ sets at least one of the variables xǫ, yδ to 1. (⇐) Let F ′ 2 be a satisfiable formula obtained from F2 by deleting at most k negative 2 }. Let τ be a satisfying truth clauses. Let D = { x ∈ var(F ) : {¬x0, ¬x1} ∈ F2 \ F ′ assignment of F ′ 2. We define a set K of vertices of G by setting K = { x0, x1 : x ∈ D } ∪ { xτ (x) : x ∈ var(F ) \ D }, and we observe that K ≤ M + k. It remains to show that K is a vertex cover of G. Consider an edge e = x0x1 ∈ M of the first group. If x ∈ D then x0, x1 ∈ K; if x /∈ D then xτ (x) ∈ K, hence e is covered by K. Now consider an edge f = xǫyδ ∈ E \ M of the second group. If x ∈ D or y ∈ D then f is clearly covered by K. Hence assume x, y /∈ D. By definition, there is a positive clause 2, it follows that τ (xǫ) = 1 or τ (yδ) = 1. {xǫ, yδ} ∈ F ′ Consequently xǫ ∈ K or yδ ∈ K, thus K covers f . Hence Claim 2 is shown. 2 ⊆ F2. Since τ satisfies F ′ Next we modify F2 by replacing each positive clause C = {xǫ, yδ} with 2k + C are new C, yδ}, for 1 ≤ i ≤ k + 1, where the zi C}, {¬zi 2 “mixed” clauses {xǫ, zi variables. Let F ∗ 2 denote the 2CNF formula obtained this way from F2. Claim 3. We can delete at most k negative clauses from F2 to obtain a satisfiable 2 to obtain a satisfiable formula if and only if we can delete at most k clauses from F ∗ formula. C}, {¬zi The claim follows easily from the following considerations. We observe that each pair of mixed clauses {xǫ, zi C, yδ} is semantically equivalent with C = {xǫ, yδ}. Hence, if F2 can be made satisfiable by deleting some of the negative clauses, 2 satisfiable by deleting the same clauses. However, deleting some we can also make F ∗ of the mixed clauses does only help if we delete at least one from each of the k + 1 pairs that correspond to the same clause C. Hence also Claim 3 is shown true. Claims 1–3 together establish the lemma. ⊓⊔ Razgon and O’Sullivan’s result [79] together with Lemma 1 immediately give the following. Proposition 9. DELETION RHORN-BACKDOOR SET DETECTION is fixed-parameter tractable. 7 Permissive Problems We consider any function p that assigns nonnegative integers to CNF formulas as a satisfiability parameter. In particular we are interested in such satisfiability parameters p for which the following parameterized problem is fixed-parameter tractable: SAT(p) Instance: A CNF formula F and an integer k ≥ 0. Parameter: The integer k. Task: Determine whether F is satisfiable or determine that p(F ) > k. 14 Note that an algorithm that solves the problem has the freedom of deciding the satisfi- ability of some formulas F with p(F ) > k, hence the exact recognition of formulas F with p(F ) ≤ k can be avoided. Thus SAT(p) is not a usual decision problem, as there are three different outputs, not just two. If SAT(p) is fixed-parameter tractable then we call p an fpt satisfiability parameter, and we say that “the satisfiability of CNF formulas of bounded p is fixed-parameter tractable” (cf. [92]). We write 3SAT(p) if the input is restricted to 3CNF formulas. Backdoor sets provide a generic way to define satisfiability parameters. Let C be a base class and F a CNF formula. We define wbC(F ), sbC(F ) and dbC(F ) as the size of a smallest weak, strong, and deletion C-backdoor set of F , respectively. Of course, if the detection of the respective C-backdoor set is fixed-parameter tractable, then wbC, sbC, and dbC are fpt satisfiability parameters. However, it is possi- ble that wbC, sbC, or dbC are fpt satisfiability parameters but the corresponding C-back- door set detection problem is W[1]-hard. The problems SAT(wbC), SAT(sbC), and SAT(dbC) can therefore be considered as more “permissive” versions of the “strict” problems WEAK, STRONG, and DELETION C-BACKDOOR SET DETECTION, the latter require to find a backdoor set even if the given formula is trivially seen to be satisfiable or unsatisfiable. The distinction between permissive and strict versions of problems have been considered in a related context by Marx and Schlotter [61, 62] for parameter- ized k-neighborhood local search. Showing hardness for permissive problems SAT(p) seems to be a much more difficult task than for the strict problems. So far we could establish only few such hardness results. Proposition 10. SAT(wbC) is W[1]-hard for all C ∈ Schaefer ∪ {RHORN}. Proof. We will show a more general result, that W[1]-hardness holds for all base classes that contain all anti-monotone 2CNF formulas. A CNF formula is anti-monotone if all its clauses are negative. Let C be a base class that contains all anti-monotone 2CNF formulas. We show that SAT(wbC) is W[1]-hard by reducing from PARTITIONED CLIQUE, also known as MULTICOLORED CLIQUE. This problem takes as input a k-partite graph and asks whether the graph has a clique on k vertices. The integer k is the parameter. The problem is well-known to be W[1]-complete [73]. Let H = (V, E) with V = Sk i=1 Vi be an instance of this problem. We construct a CNF formula F as follows. We consider the vertices of H as variables and add clauses {¬u, ¬v} for any two distinct vertices such that uv /∈ E. For each 1 ≤ i ≤ k, we add the clause Vi. This completes the construction of F . We show that the following statements are equivalent: (1) F is satisfiable (2) H contains a k-clique. (3) F has a weak C-backdoor set of size at most k. (1)⇒(2). Let τ be a satisfying assignment of F . Because of the clause Vi, τ sets at least one variable of Vi to 1, for each 1 ≤ i ≤ k. As each Vi is an independent set, F contains a clause {¬u, ¬v} for every two distinct vertices in Vi. Thus, τ sets exactly one variable of Vi to 1, for each 1 ≤ i ≤ k. The clauses of F also imply that vivj ∈ E 15 for each 1 ≤ i < j ≤ k, since otherwise τ would falsify the clause {¬vi, ¬vj }. Hence v1, . . . , vk induce a clique in H. (2)⇒(3). Assume v1, . . . , vk induce a clique in H, with vi ∈ Vi. We show that B = {v1, . . . , vk} is a weak C-backdoor set of F . Let τ ∈ 2B be the truth assignment that sets all variables of B to 1. This satisfies all the clauses Vi, 1 ≤ i ≤ k. Thus, F [τ ] is an anti-monotone 2CNF formula. Therefore it is in C and it is satisfiable as it is 0-valid. Hence B is a weak C-backdoor set of F . (3)⇒(1). Any formula that has a weak backdoor set is satisfiable. Since all three statements are equivalent, we conclude that SAT(wbC) is W[1]-hard. This shows the proposition for the base classes HORN, 2CNF, 0-VAL, and RHORN, as they contain all anti-monotone 2CNF formulas. The hardness for HORN− and 1-VAL follows by symmetric arguments from the hardness of HORN and 0-VAL, respectively. ⊓⊔ In general, if we have an fpt approximation algorithm [14, 21, 34] for a strict back- door set detection problem, then the corresponding permissive problem SAT(p) is fixed-parameter tractable. For instance, if we have an fpt algorithm that, for a given pair (F, k) either outputs a weak, strong, or deletion C-backdoor set of F of size at most f (k) or decides that F has no such backdoor set of size at most k, then clearly wbC, sbC, and dbC, respectively, is an fpt satisfiability parameter. This line of reasoning is used in the next theorem to show that sbFOREST is an fpt satisfiability parameter. This result labels FOREST as the first nontrivial base class C for which sbC is an fpt satisfiability parameter and sbC 6= dbC. Hence the additional power of strong FOREST-backdoor sets over deletion FOREST-backdoor sets is accessible. Theorem 5 ([46]). STRONG FOREST-BACKDOOR SET DETECTION admits a 2k fpt- approximation. Hence SAT(sbFOREST ) is fixed-parameter tractable. Proof (Sketch). We sketch the fpt-approximation algorithm from [46] which either con- cludes that a CNF formula F has no strong FOREST-backdoor set of size k or returns one of size at most 2k. We refer to [46] for the full details and the correctness proof. Let G denote the incidence graph of F . The first step of the algorithm runs, similarly to the proof of Theorem 2, the fpt algorithm (with parameter k′) by Bodlaender [9] that either finds k′ = k22k−1 + k + 1 vertex-disjoint cycles in G or a feedback vertex set of G of size at most 12k′2 − 27k′ + 15. In case a feedback vertex set X is returned, a tree decomposition of G\X of width 1 is computed and X is added to each bag of this tree decomposition. As the STRONG FOREST-BACKDOOR SET DETECTION problem can be defined in Monadic Second Order Logic, a meta-theorem by Courcelle [26] can be used to decide the problem in linear time using this tree decomposition. In case Bodlaender’s algorithm returns k′ vertex-disjoint cycles, the algorithm finds a set S∗ of O(k2k2k2−k) variables such that every strong FOREST-backdoor set of size k contains at least one variable from S∗. In this case, the algorithm recurses by considering all possibilities of including a variable from S∗ in the backdoor set. Let C1, . . . , Ck′ denote the variable-disjoint cycles returned by Bodlaender’s algo- rithm. Consider a variable x ∈ var(F ) and a cycle C. We say that x kills C internally 16 if x ∈ C. We say that x kills C externally if x /∈ C and C contains two clause u, v ∈ F such that x ∈ u and ¬x ∈ v. We say in this case that x kills C externally in u and v. The algorithm goes through all (cid:0)k′ k (cid:1) ways to choose k cycles among C1, . . . , Ck′ that may be killed internally. All other cycles, say C1, . . . , Ck′′ with k′′ = k′ − k, are not killed internally. We refer to these cycles as C′′-cycles. The algorithm now computes a set S ⊆ var(F ) of size at most 2 such that any strong FOREST-backdoor set of size k, which is a subset of var(F ) \ Sk′′ i=1 var(Ci), contains at least one variable from S. The union of all such S, taken over all choices of cycles to be killed internally, forms then the set S∗ that was to be computed. From now on, consider only killers in var(F ) \ Sk′′ i=1 var(Ci). For each C′′-cycle Ci, consider vertices xi, ui, vi such that xi kills Ci externally in ui and vi and there is a path Pi from ui to vi along the cycle Ci such that if any variable kills Ci externally in two clauses u′ i}. Note that any variable that does not kill Ci internally, but kills the cycle Cxi = Pi ∪ {xi} also kills the cycle Ci externally in ui and vi. We refer to such external killers as interesting. i ∈ Pi, then {ui, vi} = {u′ i, v′ i and v′ i such that u′ i, v′ The algorithm executes the first applicable from the following rules. No External Killer If there is an index i, 1 ≤ i ≤ k′′, such that Cxi has no external killer, then set S := {xi}. Killing Same Cycles If there are variables y and z and at least 2k−1 + 1 C′′-cycles such that both y and z are interesting external killers of each of these C′′-cycles, then set S := {y, z}. Killing Many Cycles If there is a variable y that is an interesting external killer of at least k · 2k−1 + 1 C′′-cycles, then set S := {y}. Too Many Cycles Otherwise, set S = ∅. For each s ∈ S∗ the algorithm calls itself recursively to compute a strong FOREST- backdoor set for F [s = 0] and for F [s = 1] with parameter k − 1. If both recursive calls return backdoor sets, the union of these two backdoor sets and {s} is a strong FOREST-backdoor set for F . It returns the smallest such backdoor set obtained for all choices of s, or NO if for each s ∈ S∗ at least one recursive call returned NO. ⊓⊔ 8 Comparison of Parameters Satisfiability parameters can be compared with respect to their generality. Let p, q be satisfiability parameters. We say that p is at least as general as q, in symbols p (cid:22) q, if there exists a function f such that for every CNF formula F we have p(F ) ≤ f (q(F )). Clearly, if p (cid:22) q and SAT(p) is fpt, then so is SAT(q). If p (cid:22) q but not q (cid:22) p, then p is more general than q. If neither p (cid:22) q nor q (cid:22) p then p and q are incomparable. As discussed above, each base class C gives rise to three satisfiability parameters wbC(F ), sbC(F ) and dbC(F ). If C is clause-induced, then sbC (cid:22) dbC; and if C ⊆ C′, then sbC ′ (cid:22) sbC and dbC ′ (cid:22) dbC. By associating certain graphs with CNF formulas one can use graph parameters to define satisfiability parameters. The most commonly used graphs are the primal, dual, and incidence graphs. The primal graph of a CNF formula F has as vertices the 17 variables of F , and two variables are adjacent if they appear together in a clause. The dual graph has as vertices the clauses of F , and two clauses C, C′ are adjacent if they have a variable in common (i.e., if var(C) ∩ var(C′) 6= ∅). The incidence graph, as already defined above, is a bipartite graph, having as vertices the variables and the clauses of F ; a variable x and a clause C are adjacent if x ∈ var(C). The directed incidence graph is obtained from the incidence graph by directing an edge xC from x to C if x ∈ C and from C to x if ¬x ∈ C. The treewidth of the primal, dual, and incidence graph gives fpt satisfiability param- eters, respectively. The treewidth of the incidence graph is more general than the other two satisfiability parameters [56]. The clique-width of the three graphs provides three more general satisfiability parameters. However, these satisfiability parameters are un- likely fpt: It is easy to see that SAT remains NP-hard for CNF formulas whose primal graphs are cliques, and for CNF formulas whose dual graphs are cliques. Moreover, SAT, parameterized by the clique-width of the incidence graph is W[1]-hard, even if a decomposition is provided [67]. However, the clique-width of directed incidence graphs is an fpt satisfiability parameter which is more general than the treewidth of incidence graphs [25, 43]. How do fpt satisfiability parameters based on decompositions and fpt satisfiability parameters based on backdoor sets compare to each other? Each base class C considered above, except for the class FOREST, contains CNF formulas whose directed incidence graphs have arbitrarily large clique-width. Hence none of the decomposition based parameters is at least as general as the parameters sbC and dbC. On the other hand, taking the disjoint union of n copies of a CNF formula multiplies the size of backdoor sets by n but does not increase the width. Hence no backdoor based parameter is more general than decomposition based parameters. Thus, almost all considered backdoor based fpt satisfiability parameters are incom- parable with almost all considered decomposition based fpt satisfiability parameters. A notable exception is the satisfiability parameter dbFOREST . It is easy to see that the treewidth of the incidence graph of a CNF formula is no greater than the size of a small- est deletion FOREST-backdoor set plus one, as the latter forms a feedback vertex set of the incidence graph. Thus the treewidth of incidence graphs is a more general satisfia- bility parameter than the size of a smallest deletion FOREST-backdoor sets. However, one can construct CNF formulas F with sbFOREST (F ) = 1 whose directed incidence graph has arbitrarily large clique-width. Just take a formula whose incidence graph is a subdivision of a large square grid, and add a further variable x such that on each path which is a subdivision of one edge of the grid there is a clause containing x and a clause containing ¬x. Thus, the satisfiability parameter sbFOREST , which is fpt by Theorem 5, is incomparable to all the decomposition based satisfiability parameters considered above. Figure 1 shows the relationship between some of the discussed fpt satisfiability parameters. 9 Kernels The use of strong or deletion backdoor sets for SAT decision, with respect to a base class C, involves two tasks: 18 treewidth of dual graphs treewidth of primal graphs treewidth of incidence graphs deletion FOREST-backdoor sets strong FOREST-backdoor sets Fig. 1. Relationship between some fpt satisfiability parameters. An arrow from A to B means that B is more general than A. If there is now arrow between A and B then A and B are incomparable. 1. backdoor detection, to find a strong (or deletion) backdoor set of size at most k, or to report that such a backdoor set does not exist, 2. backdoor evaluation, to use a given strong (or deletion) backdoor set of size at most k to determine whether the CNF formula under consideration is satisfiable. In each case where backdoor detection is fixed-parameter tractable, one can now ask whether the detection problem admits a polynomial kernel. For instance, for the classes HORN and 2CNF, backdoor detection can be rephrased as VERTEX COVER or as 3-HITTING SET problems, as discussed above, and therefore admits polynomial kernels [18, 1]. Backdoor evaluation is trivially fixed-parameter tractable for any base class, but it is unlikely that it admits a polynomial kernel. Proposition 11 ([95]). C-BACKDOOR SET EVALUATION does not admit a polynomial kernel for any self-reducible base class C unless NP ⊆ co-NP/poly. This proposition is a trivial consequence of the well-known result that SAT parameter- ized by the number of variables has no polynomial kernel unless NP ⊆ co-NP/poly [10, 44], and the fact that var(F ) is always a strong C-backdoor set of F if C is self- reducible. Less immediate is the question whether C-BACKDOOR SET EVALUATION admits a polynomial kernel if the inputs are restricted to 3CNF formulas, as 3SAT parameterized by the number of variables has a cubic kernel by trivial reasons. However, for HORN and 2CNF this question can be answered negatively. Proposition 12 ([95]). C-BACKDOOR SET EVALUATION does not admit a polynomial kernel for C ∈ {HORN, 2CNF} unless NP ⊆ co-NP/poly, even if the input formula is in 3CNF. 10 Backdoor Trees Backdoor trees are binary decision trees on backdoor variables whose leaves correspond to instances of the base class. Every strong backdoor set of size k gives rise to a back- door tree with at least k + 1 and at most 2k leaves. It is reasonable to rank the hardness of instances in terms of the number of leaves of backdoor trees, thus gaining a more refined view than by just comparing the size of backdoor sets. 19 Consider the CNF formula F with variables x1, . . . , x2n and y1, . . . , yn consisting of all clauses of the form {yi, ¬x1, . . . , ¬x2i−2, x2i−1, ¬x2i, . . . , ¬x2n}, {yi, ¬x1, . . . , ¬x2i−1, x2i, ¬x2i+1, . . . , ¬x2n}, for 1 ≤ i ≤ n. The set B = {y1, . . . , yn} is a strong HORN-backdoor set (in fact, B is the smallest possible). However, every HORN-backdoor tree T with var(T ) = {y1, . . . , yn} has 2n leaves. On the other hand, the formula F has a HORN-backdoor tree T ′ with only 2n + 1 leaves where var(T ′) = {x1, . . . , x2n}. Thus, when we want to minimize the number of leaves of backdoor trees, we must not restrict ourselves to variables of a smallest strong backdoor set. The problem C-BACKDOOR TREE DETECTION now takes as input a CNF for- mula F , a parameter k, and asks whether F has a C-backdoor tree with at most k leaves. A base class C is said to admit a loss-free kernelization if there exists a polynomial- time algorithm that, given a CNF formula F and an integer k, either correctly decides that F has no strong C-backdoor set of size at most k, or computes a set X ⊆ var(F ) such that the following conditions hold: (i) X contains all minimal strong C-backdoor sets of F of size at most k; and (ii) the size of X is bounded by a computable function that depends on k only. Samer and Szeider [85] have shown that C-BACKDOOR TREE DETECTION is fixed- parameter tractable for every base class C that admits a loss-free kernelization. Since Buss-type kernelization is loss-free, the two classes HORN and 2CNF admit a loss-free kernelization. Hence C-BACKDOOR TREE DETECTION is fixed-parameter tractable for C ∈ {2CNF, HORN}. 11 Backdoors for Problems Beyond NP The backdoor approach has been successfully applied to obtain fixed-parameter tractability for problems whose unparameterized worst-case complexity lies beyond NP. In particular, FPT results have been obtained for the #P -complete problem Propo- sitional Model Counting, the PSPACE-complete QBF-SAT problem, and problems of nonmonotonic reasoning and abstract argumentation that are located on the second level of the Polynomial Hierarchy. In this section we briefly survey these results. 11.1 Propositional Model Counting The #SAT problem asks to compute for a given CNF formula F the number of as- signments τ ∈ 2var(F ) that satisfy F . This problem arises in several areas of Artificial Intelligence, in particular in the context of probabilistic reasoning [3, 83]. The problem is #P-complete and remains #P-hard even for monotone 2CNF formulas and Horn 2CNF formulas. It is NP-hard to approximate the number of satisfying assignments of a CNF formula with n variables within 2n1−ǫ for any ǫ > 0. This approximation hard- ness holds also for monotone 2CNF formulas and Horn 2CNF formulas [83]. However, if #SAT can be solved in polynomial time O(nc) for the formulas of a base class C, 20 and if we know a strong C-backdoor set of a formula F of size k, then we can com- pute the number of satisfying assignments of F in time O(2knc) [66, 87]. For some applications in probabilistic reasoning one is interested in the weighted model count- ing (WMC) problem, which is more general than #SAT (see, e.g., [89, 15]). Since the backdoor set approach applies also to the more general problem, we will use it for the following discussions. A weighting w of a CNF formula F is a mapping w that assigns each variable x ∈ var(F ) a rational number 0 ≤ w(x) ≤ 1; this generalizes to literals by w(x) = 1−w(x) and to truth assignments τ ∈ 2X by w(τ ) = Qx∈X w(xτ (x)). We define #w(F ) as the sum of the weights of all assignments τ ∈ 2var(F ) that satisfy F . The WMC problem asks to compute #w(F ) for a given CNF formula F and weighting w. WMC is clearly at least as hard as computing #(F ) as we can reduce #SAT to WMC by using the weight 1/2 for all n variables and multiplying the result by 2n. A strong C-backdoor set X of a CNF formula F can be used to compute #w(F ) via the equation #w(F ) = X w(τ ) · #w(F [τ ]). τ ∈2X It is easy to see that WMC is polynomial for the base classes CLU and FOREST as the corresponding algorithms for deciding satisfiability for these classes as discussed above allow a straightforward generalization to WMC. From Theorem 5 and Proposition 8 we conclude that WMC is fixed-parameter tractable parameterized by sbFOREST and dbCLU. 11.2 Quantified Boolean Formulas Many important computational tasks like planning, verification, and several questions of knowledge representation and automated reasoning can be naturally encoded as the evaluation problem of quantified Boolean formulas (QBF) [69, 81, 84]. A QBF consists of a propositional CNF formula F (the “matrix”) and a quantifier prefix. For instance F = ∀y ∀z ∃x ∃w F with F = {{¬x, y, ¬w}, {x, ¬y, w}, {¬y, z}, {y, ¬z}} is a QBF. The evaluation of quantified Boolean formulas constitutes a PSPACE-complete prob- lem and is therefore believed to be computationally harder than the NP-complete propo- sitional satisfiability problem [55, 71, 91]. Only a few tractable classes of quantified Boolean formulas are known where the number of quantifier alternations is unbounded. For example, the time needed to solve QBF formulas whose primal graph has bounded treewidth grows non-elementarily in the number of quantifier alternations [70]. Two prominent tractable classes with unbounded quantifier alternations are QHORN and Q2CNF which are QBFs where the matrix is a Horn or 2CNF formula, respectively. QHORN formulas and Q2CNF formulas can be evaluated in polynomial time due to well-known results of Kleine Buning et al. [13] and of Aspvall et al. [2], respectively. In order to evaluate a QBF formula with a small strong HORN- or 2CNF-backdoor set X efficiently, we require that X is closed under variable dependencies. That is, if x depends on y and x ∈ X, then also y ∈ X, where we say that x depends on y if the quantifier for y appears to the left of the quantifier for x, and one cannot move the quantifier for y to the right of x without changing the validity of the QBF. In gen- eral deciding whether a variable depends on the other is PSPACE complete, but there 21 are “over-approximations” of dependencies that can be computed in polynomial time. Such over-approximations can be formalized in terms of dependency schemes. Indeed, it is fixed-parameter tractable to detect strong HORN or 2CNF-backdoor sets of size at most k that are closed with respect to any fixed polynomial-time decidable dependency scheme [86]. This fpt result allows an unbounded number of quantifier alternations for each value of the parameter, in contrast to the results for parameter treewidth. 11.3 Nonmonotonic Reasoning Answer-Set Programming (ASP) is an increasingly popular framework for declarative programming [60, 64]. ASP allows to describe a problem by means of rules and con- straints that form a disjunctive logic program P over a finite universe U of atoms. A rule r is of the form (x1 ∨ · · · ∨ xl ← y1, . . . , yn, ¬z1, . . . , ¬zm). We write {x1, . . . , xl} = H(r) (the head of r) and {y1, . . . , yn, z1, . . . , zm} = B(r) (the body of r), B+(r) = {y1, . . . , yn} and B−(r) = {z1, . . . , zn}. A set M of atoms satisfies a rule r if B+(r) ⊆ M and M ∩ B−(r) = ∅ implies M ∩ H(r) 6= ∅. M is a model of P if it satisfies all rules of P . The GL reduct of a program P under a set M of atoms is the program P M obtained from P by first removing all rules r with B−(r) ∩ M 6= ∅ and second removing all ¬z where z ∈ B−(r) from all remaining rules r [47]. M is an answer set of a program P if M it is a minimal model of P M . For instance, from the program P = {(tweety-flies ← tweety-is-a-bird, ¬tweety-is-a-penguin), (tweety-is-a-bird ←)} we may conclude that tweety-flies, since this fact is contained in the only answer set {tweety-is-a-bird, tweety-flies} of P . If we add the fact tweety-is-a-penguin to the program and obtain P ′ = P ∪ {(tweety-is-a-penguin ←)}, then we have to retract our conclusion tweety-flies since this fact is not contained in any answer set of P ′ (the only answer set of P ′ is {tweety-is-a-bird, tweety-is-a-penguin}). This nonmonotonic behaviour that adding a fact may allow fewer conclusions is typical for many applications in Artificial Intelli- gence. The main computational problems for ASP (such as deciding whether a program has a solution, or if a certain atom is contained in at least one or in all answer sets) are of high worst-case complexity and are located at the second level of the Polynomial Hierarchy [38]. Also for ASP several islands of tractability are known, and it is possible to develop a backdoor approach [42]. Similar to SAT one can define partial truth assignments τ on a set of atoms and solve a disjunctive logic program P by solving all the reduced programs P [τ ]. However, the situation is trickier than for satisfiability. Although every answer set of P corresponds to an answer set of P [τ ] for some truth assignment τ, the reverse direction is not true. Therefore, one needs to run a check for each answer set of P [τ ] whether it gives rise to an answer set of P . Although this correctness check is polynomial, we must ensure that we do not need to carry it out too often. A sufficient condition for bounding the number of checks is that we can compute all answer sets of a program P ∈ C in polynomial time (“C is enumerable”). In particular, this means that P ∈ C has only a polynomial number of answer sets, and so we need to run the correctness check only a polynomial number of times. Several enumerable islands of tractability have been identified and studied regard- ing the parameterized complexity of backdoor set detection [42]. For instance, programs 22 where each rule head contains exactly one atom and each rule body is negation-free are well-known to have exactly one answer set. Such programs are called Horn programs, and similar to satisfiability, one can use vertex covers to compute backdoor sets with respect to Horn. Further enumerable islands of tractability can be defined by forbidding cycles in graphs, digraphs, and mixed graphs associated with disjunctive logic pro- grams. Now, one can use feedback vertex set (fvs) algorithms for the considered graphs to compute backdoor sets: undirected fvs [33], directed fvs [20], and mixed fvs [12]. One can get even larger enumerable islands of tractability by labeling some of the ver- tices or edges and by only forbidding “bad” cycles, namely cycles that contain at least one labeled edge or vertex. For the undirected case one can use subset feedback ver- tex set algorithms to compute backdoor sets [28, 54]. Currently it is open whether this problem is fixed-parameter tractable for directed or mixed graphs. Even larger islands can be obtained by only forbidding bad cycles with an even number of labeled vertices or edges [41]. This gives rise to further challenging feedback vertex set problems. 11.4 Abstract Argumentation The study of arguments as abstract entities and their interaction in form of attacks as introduced by Dung [35] has become one of the most active research branches within Artificial Intelligence, Logic and Reasoning [5, 7, 76]. Abstract argumentation provides suitable concepts and formalisms to study, represent, and process various reasoning problems most prominently in defeasible reasoning (see, e.g., [74, 11]) and agent in- teraction (see, e.g., [72]). An abstract argumentation system can be considered as a directed graph, where the vertices are called “arguments” and a directed edge from a to b means that argument a “attacks” argument b. A main issue for any argumentation system is the selection of acceptable sets of arguments, called extensions. Whether or not a set of arguments is accepted is consid- ered with respect to certain properties of sets of arguments, called semantics [4]. For instance, the preferred semantics requires that an extension is a maximal set of argu- ments with the properties that (i) the set is independent, and (ii) each argument outside the set which attacks some argument in the set is itself attacked by some argument in the set. Property (i) ensures that the set is conflict-free, property (ii) ensures that the set defends itself against attacks. Important computational problems are to determine whether an argument belongs to some extension (credulous acceptance) or whether it belongs to all extensions (skep- tical acceptance) [32, 37]. For most semantics, including the preferred semantics, the problems are located on the second level of the Polynomial Hierarchy [36]. It is known that the acceptance problems can be solved in polynomial time if the directed graph of the argumentation framework is acyclic, noeven (contains no even cycles), symmetric, or bipartite [35, 4, 24, 36]. Thus, these four properties give rise to islands of tractability for abstract argumentation, and one can ask whether a backdoor approach can be developed to solve the acceptance problems for instances that are close to an island. Here it is natural to consider deletion backdoor sets, i.e., we delete argu- ments to obtain an instance that belongs to the considered class. For the islands of acyclic, symmetric, and bipartite argumentation frameworks we can find a backdoor using the fixed-parameter algorithms for directed feedback vertex set [20], vertex cover 23 [33] and for graph bipartization [80], respectively. For finding a vertex set of size k that kills all directed cycles of even length we only know an XP algorithm which is based on a deep result [82]. However, it turns out that using the backdoor set is tricky and quite different from satisfiability and answer set programming [68]. The acceptance problems remain (co-)NP-hard for instances that can be made symmetric or bipartite by deleting one single argument. On the other hand, if an instance can be made acyclic or noeven by deleting k arguments, then the acceptance problems can be solved in time 3knc. The base 3 of the running time comes from the fact that the evaluation algorithm considers three different cases for the arguments in the backdoor set: (1) the argument is in the acceptable set, (2) the argument is not in the set and is attacked by at least one argument from the set, and (3) the argument is not in the set but is not attacked by any argument from the set. 12 Conclusion Backdoor sets aim at exploiting hidden structures in real-world problem instances. The effectiveness of this approach has been investigated empirically in [31, 42, 59, 85] and in many cases, small backdoor sets were found for large industrial instances. As several backdoor set problems reduce to well-investigated core problems from parameterized complexity, such as VERTEX COVER, 3-HITTING SET, FEEDBACK VERTEX SET, and their variants, a few decades of focused research efforts can be used to detect backdoor sets efficiently. Nevertheless, several questions remain open. In particular, the parameterized complexity classification of several permissive prob- lems seems challenging. As discussed at the end of Subsection 11.3, the classification of variants of the FEEDBACK VERTEX SET problem would also shed some light on backdoor set detection problems in nonmonotonic reasoning. We believe that more research in this direction is necessary if we want to explain the good practical performance of heuristic SAT solvers. Directions for future research could involve multivariate parameterizations of backdoor problems and the considera- tion of backdoors to combinations of different base classes. Acknowledgment We thank Ryan Williams for his comments on an earlier version of this survey. References 1. Faisal N. Abu-Khzam. A kernelization algorithm for d-hitting set. J. of Computer and System Sciences, 76(7):524–531, 2010. 2. Bengt Aspvall, Michael F. Plass, and Robert Endre Tarjan. A linear-time algorithm for testing the truth of certain quantified Boolean formulas. Information Processing Letters, 8(3):121– 123, 1979. 3. Fahiem Bacchus, Shannon Dalmao, and Toniann Pitassi. Algorithms and complexity results In 44th Annual IEEE Symposium on Foundations of for #SAT and Bayesian inference. Computer Science (FOCS’03), pages 340–351, 2003. 24 4. Pietro Baroni and Massimiliano Giacomin. Semantics of abstract argument systems. In Iyad Rahwan and Guillermo Simari, editors, Argumentation in Artificial Intelligence, pages 25–44. Springer Verlag, 2009. 5. T. J. M. Bench-Capon and Paul E. Dunne. Argumentation in artificial intelligence. Artificial Intelligence, 171(10-15):619–641, 2007. 6. Daniel Le Berre and Anne Parrain. On sat technologies for dependency management and beyond. In Steffen Thiel and Klaus Pohl, editors, Software Product Lines, 12th International Conference, SPLC 2008, Limerick, Ireland, September 8-12, 2008, Proceedings. Second Vol- ume (Workshops), pages 197–200. Lero Int. Science Centre, University of Limerick, Ireland, 2008. 7. Philippe Besnard and Anthony Hunter. Elements of Argumentation. The MIT Press, 2008. 8. Per Bjesse, Tim Leonard, and Abdel Mokkedem. Finding bugs in an alpha microprocessor using satisfiability solvers. In G. Berry, H. Comon, and A. Finkel, editors, Computer Aided Verification: 13th International Conference, CAV 2001, Paris, France, July 18-22, 2001, Pro- ceedings, pages 454–464, 2001. 9. Hans L. Bodlaender. On disjoint cycles. International Journal of Foundations of Computer Science, 5(1):59–68, 1994. 10. Hans L. Bodlaender, Rodney G. Downey, Michael R. Fellows, and Danny Hermelin. On problems without polynomial kernels. J. of Computer and System Sciences, 75(8):423–434, 2009. 11. A. Bondarenko, P. M. Dung, R. A. Kowalski, and F. Toni. An abstract, argumentation- theoretic approach to default reasoning. Artificial Intelligence, 93(1-2):63–101, 1997. 12. Paul Bonsma and Daniel Lokshtanov. Feedback vertex set in mixed graphs. Technical report, arXiv, 2010. http://arxiv.org/abs/1010.5974. 13. H. Kleine Buning, M. Karpinski, and A. Flogel. Resolution for quantified Boolean formulas. Information and Computation, 117(1):12–18, 1995. 14. Liming Cai and Xiuzhen Huang. Fixed-parameter approximation: Conceptual framework and approximability results. Algorithmica, 57(2):398–412, 2010. 15. Mark Chavira and Adnan Darwiche. On probabilistic inference by weighted model counting. Artificial Intelligence, 172(6-7):772–799, 2008. 16. J. Chen, , and I. A. Kanj. On approximating minimum vertex cover for graphs with perfect matching. Theoretical Computer Science, 337(1-3):305–318, 2005. 17. Jianer Chen, Fedor V. Fomin, Yang Liu, Songjian Lu, and Yngve Villanger. Improved algo- rithms for feedback vertex set problems. J. of Computer and System Sciences, 74(7):1188– 1198, 2008. 18. Jianer Chen, Iyad A. Kanj, and Weijia Jia. Vertex cover: further observations and further improvements. J. Algorithms, 41(2):280–301, 2001. 19. Jianer Chen, Iyad A. Kanj, and Ge Xia. Improved upper bounds for vertex cover. Theoretical Computer Science, 411(40–42):3736–3756, 2010. 20. Jianer Chen, Yang Liu, Songjian Lu, Barry O’Sullivan, and Igor Razgon. A fixed-parameter algorithm for the directed feedback vertex set problem. J. of the ACM, 55(5):Art. 21, 19, 2008. 21. Yijia Chen, Martin Grohe, and Magdalena Gruber. On parameterized approximability. In Proceedings of the 2nd International Workshop on Parameterized and Exact Computa- tion (IWPEC 2006), volume 4169 of Lecture Notes in Computer Science, pages 109–120. Springer Verlag, 2006. 22. Stephen A. Cook. The complexity of theorem-proving procedures. In Proc. 3rd Annual Symp. on Theory of Computing, pages 151–158, Shaker Heights, Ohio, 1971. 23. Stephen A. Cook and David G. Mitchell. Finding hard instances of the satisfiability problem: a survey. In Satisfiability problem: theory and applications (Piscataway, NJ, 1996), pages 1–17. American Mathematical Society, 1997. 25 24. Sylvie Coste-Marquis, Caroline Devred, and Pierre Marquis. Symmetric argumentation frameworks. In Lluis Godo, editor, Symbolic and Quantitative Approaches to Reasoning with Uncertainty, 8th European Conference, ECSQARU 2005, Barcelona, Spain, July 6-8, 2005, Proceedings, volume 3571 of Lecture Notes in Computer Science, pages 317–328. Springer Verlag, 2005. 25. B. Courcelle, J. A. Makowsky, and U. Rotics. On the fixed parameter complexity of graph enumeration problems definable in monadic second-order logic. Discr. Appl. Math., 108(1- 2):23–52, 2001. 26. Bruno Courcelle. Graph rewriting: an algebraic and logic approach. In Handbook of theoret- ical computer science, Vol. B, pages 193–242. Elsevier Science Publishers, North-Holland, Amsterdam, 1990. 27. Y. Crama, O. Ekin, and P. L. Hammer. Variable and term removal from Boolean formulae. Discr. Appl. Math., 75(3):217–230, 1997. 28. Marek Cygan, Marcin Pilipczuk, Michal Pilipczuk, and Jakub Onufry Wojtaszczyk. Sub- set feedback vertex set is fixed-parameter tractable. In Proceedings of the 38th International Colloquium on Automata, Languages and Programming (ICALP 2011), volume 6755 of Lec- ture Notes in Computer Science, pages 449–461. Springer Verlag, 2011. 29. M. Davis and H. Putnam. A computing procedure for quantification theory. J. of the ACM, 7(3):201–215, 1960. 30. Martin Davis, George Logemann, and Donald Loveland. A machine program for theorem- proving. Communications of the ACM, 5:394–397, 1962. 31. Bistra N. Dilkina, Carla P. Gomes, and Ashish Sabharwal. Tradeoffs in the complexity of backdoor detection. In Principles and Practice of Constraint Programming - CP 2007, 13th International Conference, CP 2007, Providence, RI, USA, September 23-27, 2007, Proceed- ings, volume 4741 of Lecture Notes in Computer Science, pages 256–270. Springer Verlag, 2007. 32. Yannis Dimopoulos and Alberto Torres. Graph theoretical structures in logic programs and default theories. Theoretical Computer Science, 170(1-2):209–244, 1996. 33. R. G. Downey and M. R. Fellows. Parameterized Complexity. Monographs in Computer Science. Springer Verlag, New York, 1999. 34. Rodney G. Downey, Michael R. Fellows, and Catherine McCartin. Parameterized approxi- mation problems. In Parameterized and Exact Computation, Second International Workshop, IWPEC 2006, volume 4169 of Lecture Notes in Computer Science, pages 121–129. Springer Verlag, 2006. 35. Phan Minh Dung. On the acceptability of arguments and its fundamental role in nonmono- tonic reasoning, logic programming and n-person games. Artificial Intelligence, 77(2):321– 357, 1995. 36. Paul E. Dunne. Computational properties of argument systems satisfying graph-theoretic constraints. Artificial Intelligence, 171(10-15):701–729, 2007. 37. Paul E. Dunne and T. J. M. Bench-Capon. Coherence in finite argument systems. Artificial Intelligence, 141(1-2):187–203, 2002. 38. Thomas Eiter and Georg Gottlob. On the computational cost of disjunctive logic program- ming: propositional case. Ann. Math. Artif. Intell., 15(3-4):289–323, 1995. 39. Michael R. Fellows, Stefan Szeider, and Graham Wrightson. On finding short resolution refutations and small unsatisfiable subsets. Theoretical Computer Science, 351(3):351–359, 2006. 40. Henning Fernau. A top-down approach to search-trees: Improved algorithmics for 3-hitting set. Algorithmica, 57(1):97–118, 2010. 41. Johannes Klaus Fichte. The good, the bad, and the odd: Cycles in answer-set programs. In ESSLII 2011, 2011. 26 42. Johannes Klaus Fichte and Stefan Szeider. Backdoors to tractable answer-set programming. In Toby Walsh, editor, Proceedings of the 22nd International Joint Conference on Artificial Intelligence, IJCAI 2011, pages 863–868. AAAI Press/IJCAI, 2011. 43. E. Fischer, J. A. Makowsky, and E. R. Ravve. Counting truth assignments of formulas of bounded tree-width or clique-width. Discr. Appl. Math., 156(4):511–529, 2008. 44. Lance Fortnow and Rahul Santhanam. Infeasibility of instance compression and succinct PCPs for NP. In Cynthia Dwork, editor, Proceedings of the 40th Annual ACM Symposium on Theory of Computing, Victoria, British Columbia, Canada, May 17-20, 2008, pages 133– 142. ACM, 2008. 45. Michael R. Garey and David R. Johnson. Computers and Intractability. W. H. Freeman and Company, New York, San Francisco, 1979. 46. Serge Gaspers and Stefan Szeider. Backdoors to acyclic SAT. Technical Report 1110.6384, arXiv, 2011. 47. Michael Gelfond and Vladimir Lifschitz. Classical negation in logic programs and disjunc- tive databases. New Generation Comput., 9(3/4):365–386, 1991. 48. Carla P. Gomes, Henry Kautz, Ashish Sabharwal, and Bart Selman. Satisfiability solvers. In Handbook of Knowledge Representation, volume 3 of Foundations of Artificial Intelligence, pages 89–134. Elsevier, 2008. 49. Georg Gottlob and Stefan Szeider. Fixed-parameter algorithms for artificial intelligence, constraint satisfaction, and database problems. The Computer Journal, 51(3):303–325, 2006. Survey paper. 50. Jiong Guo, Falk Huffner, and Rolf Niedermeier. A structural view on parameterizing prob- lems: Distance from triviality. In Rod Downey, Michael Fellows, and Frank Dehne, editors, 1st International Workshop on Parameterized and Exact Computation (IWPEC 2004), vol- ume 3162 of Lecture Notes in Computer Science, pages 162–173. Springer, 2004. 51. Timon Hertli. 3-SAT faster and simpler - unique-SAT bounds for PPSZ hold in general. In Proceedings of the 52nd Annual IEEE Symposium on Foundations of Computer Science (FOCS 2011), 2011. To appear. 52. Kazuo Iwama. CNF-satisfiability test by counting and polynomial average time. SIAM J. Comput., 18(2):385–391, 1989. 53. Henry A. Kautz and Bart Selman. Planning as satisfiability. In Proceedings ECAI 1992, pages 359–363, 1992. 54. Kenichi Kawarabayashi and Yusuke Kobayashi. Fixed-parameter tractability for the sub- set feedback set problem and the s-cycle packing problem. Technical report, University of Tokyo, Japan, 2010. 55. Hans Kleine Buning and Theodor Lettman. Propositional logic: deduction and algorithms. Cambridge University Press, Cambridge, 1999. 56. Phokion G. Kolaitis and Moshe Y. Vardi. Conjunctive-query containment and constraint satisfaction. J. of Computer and System Sciences, 61(2):302–332, 2000. Special issue on the Seventeenth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems (Seattle, WA, 1998). 57. Leonid Levin. Universal sequential search problems. Problems of Information Transmission, 9(3):265–266, 1973. 58. Harry R. Lewis. Renaming a set of clauses as a Horn set. J. of the ACM, 25(1):134–135, January 1978. 59. Zijie Li and Peter van Beek. Finding small backdoors in sat instances. In Cory J. Butz and Pawan Lingras, editors, Proceedings of the 24th Canadian Conference on Artificial In- telligence (AI 2011), volume 6657 of Lecture Notes in Computer Science, pages 269–280. Springer Verlag, 2011. 27 60. V. Wiktor Marek and Miroslaw Truszczynski. Stable models and an alternative logic pro- gramming paradigm. In The Logic Programming Paradigm: a 25-Year Perspective, pages 169–181. Springer, 1999. 61. D´aniel Marx and Ildik´o Schlotter. Parameterized complexity and local search approaches for the stable marriage problem with ties. Algorithmica, 58(1):170–187, 2010. 62. D´aniel Marx and Ildik´o Schlotter. Stable assignment with couples: parameterized complexity and local search. Discrete Optim., 8(1):25–40, 2011. 63. Sounaka Mishra, Venkatesh Raman, Saket Saurabh, Somnath Sikdar, and C. R. Subrama- nian. The complexity of finding subgraphs whose matching number equals the vertex cover number. In Proceedings of the 18th International Symposium on Algorithms and Compu- tation (ISAAC 2007), volume 4835 of Lecture Notes in Computer Science, pages 268–279. Springer Verlag, 2007. 64. Ilkka Niemela. Logic programs with stable model semantics as a constraint programming paradigm. Ann. Math. Artif. Intell., 25(3-4):241–273, 1999. Logic programming with non- monotonic semantics: representing knowledge and its computation. 65. Naomi Nishimura, Prabhakar Ragde, and Stefan Szeider. Detecting backdoor sets with re- spect to Horn and binary clauses. In Proceedings of SAT 2004 (Seventh International Con- ference on Theory and Applications of Satisfiability Testing, 10–13 May, 2004, Vancouver, BC, Canada), pages 96–103, 2004. 66. Naomi Nishimura, Prabhakar Ragde, and Stefan Szeider. Solving #SAT using vertex covers. Acta Informatica, 44(7-8):509–523, 2007. 67. Sebastian Ordyniak, Daniel Paulusma, and Stefan Szeider. Satisfiability of acyclic and al- most acyclic CNF formulas. In Kamal Lodaya and Meena Mahajan, editors, IARCS An- nual Conference on Foundations of Software Technology and Theoretical Computer Science, FSTTCS 2010, December 15-18, 2010, Chennai, India, volume 8 of LIPIcs, pages 84–95. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2010. 68. Sebastian Ordyniak and Stefan Szeider. Augmenting tractable fragments of abstract argu- mentation. In Toby Walsh, editor, Proceedings of the 22nd International Joint Conference on Artificial Intelligence, IJCAI 2011, pages 1033–1038. AAAI Press/IJCAI, 2011. 69. Charles Otwell, Anja Remshagen, and Klaus Truemper. An effective QBF solver for plan- ning problems. In Proceedings of MSV/AMCS, pages 311–316. CSREA Press, 2004. 70. Guoqiang Pan and Moshe Y. Vardi. Fixed-parameter hierarchies inside PSPACE. In 21th IEEE Symposium on Logic in Computer Science (LICS 2006), 12-15 August 2006, Seattle, WA, USA, Proceedings, pages 27–36. IEEE Computer Society, 2006. 71. Christos H. Papadimitriou. Computational Complexity. Addison-Wesley, 1994. 72. Simon Parsons, Michael Wooldridge, and Leila Amgoud. Properties and complexity of some formal inter-agent dialogues. J. Logic Comput., 13(3):347–376, 2003. 73. Krzysztof Pietrzak. On the parameterized complexity of the fixed alphabet shortest common supersequence and longest common subsequence problems. J. of Computer and System Sciences, 67(4):757–771, 2003. 74. John L. Pollock. How to reason defeasibly. Artificial Intelligence, 57(1):1–42, 1992. 75. M. Prasad, A. Biere, and A. Gupta. A survey of recent advances in SAT-based formal veri- fication. Software Tools for Technology Transfer, 7(2):156–173, 2005. 76. Iyad Rahwan and Guillermo R. Simari, editors. Argumentation in Artificial Intelligence. Springer Verlag, 2009. 77. Venkatesh Raman, Saket Saurabh, and C. R. Subramanian. Faster fixed parameter tractable algorithms for finding feedback vertex sets. ACM Transactions on Algorithms, 2(3):403–415, 2006. 78. Igor Razgon and Barry O’Sullivan. Almost 2-sat is fixed-parameter tractable (extended ab- stract). In Automata, Languages and Programming, 35th International Colloquium, ICALP 28 2008, Reykjavik, Iceland, July 7-11, 2008, Proceedings, Part I: Tack A: Algorithms, Au- tomata, Complexity, and Games, volume 5125 of Lecture Notes in Computer Science, pages 551–562. Springer, 2008. 79. Igor Razgon and Barry O’Sullivan. Almost 2-SAT is fixed parameter tractable. J. of Com- puter and System Sciences, 75(8):435–450, 2009. 80. Bruce Reed, Kaleigh Smith, and Adrian Vetta. Finding odd cycle transversals. Oper. Res. Lett., 32(4):299–301, 2004. 81. J. Rintanen. Constructing conditional plans by a theorem-prover. J. Artif. Intell. Res., 10:323–352, 1999. 82. Neil Robertson, P. D. Seymour, and Robin Thomas. Permanents, Pfaffian orientations, and even directed circuits. Ann. of Math. (2), 150(3):929–975, 1999. 83. Dan Roth. On the hardness of approximate reasoning. Artificial Intelligence, 82(1-2):273– 302, 1996. 84. A. Sabharwal, C. Ansotegui, C. Gomes, J. Hart, and B. Selman. QBF modeling: Exploiting player symmetry for simplicity and efficiency. In Proceedings of SAT 2006, Ninth Interna- tional Conference on Theory and Applications of Satisfiability Testing, August 12-15, 2006, Seattle, Washington, USA, volume 4121 of LNCS, pages 382–395, 2006. 85. Marko Samer and Stefan Szeider. Backdoor trees. In AAAI 08, Twenty-Third Conference on Artificial Intelligence, Chicago, Illinois, July 13–17, 2008, pages 363–368. AAAI Press, 2008. 86. Marko Samer and Stefan Szeider. Backdoor sets of quantified Boolean formulas. Journal of Automated Reasoning, 42(1):77–97, 2009. 87. Marko Samer and Stefan Szeider. Fixed-parameter tractability. In Armin Biere, Marijn Heule, Hans van Maaren, and Toby Walsh, editors, Handbook of Satisfiability, chapter 13, pages 425–454. IOS Press, 2009. 88. Marko Samer and Stefan Szeider. Algorithms for propositional model counting. J. Discrete Algorithms, 8(1):50–64, 2010. 89. Tian Sang, Paul Beame, and Henry A. Kautz. Performing bayesian inference by weighted model counting. In Proceedings, The Twentieth National Conference on Artificial Intelli- gence and the Seventeenth Innovative Applications of Artificial Intelligence Conference, July 9-13, 2005, Pittsburgh, Pennsylvania, USA, pages 475–482. AAAI Press / The MIT Press, 2005. 90. Thomas J. Schaefer. The complexity of satisfiability problems. In Conference Record of the Tenth Annual ACM Symposium on Theory of Computing (San Diego, Calif., 1978), pages 216–226. ACM, 1978. 91. L. J. Stockmeyer and A. R. Meyer. Word problems requiring exponential time. In Proc. Theory of Computing, pages 1–9. ACM, 1973. 92. Stefan Szeider. On fixed-parameter tractable parameterizations of SAT. In Enrico Giunchiglia and Armando Tacchella, editors, Theory and Applications of Satisfiability, 6th International Conference, SAT 2003, Selected and Revised Papers, volume 2919 of Lecture Notes in Computer Science, pages 188–202. Springer Verlag, 2004. 93. Stefan Szeider. Backdoor sets for DLL subsolvers. Journal of Automated Reasoning, 35(1- 3):73–88, 2005. Reprinted as Chapter 4 of the book SAT 2005 - Satisfiability Research in the Year 2005, edited by E. Giunchiglia and T. Walsh, Springer Verlag, 2006. 94. Stefan Szeider. Matched formulas and backdoor sets. J on Satisfiability, Boolean Modeling and Computation, 6:1–12, 2008. 95. Stefan Szeider. Limits of preprocessing. In Proceedings of the Twenty-Fifth Conference on Artificial Intelligence, AAAI 2011, pages 93–98. AAAI Press, Menlo Park, California, 2011. 96. Miroslav N. Velev and Randal E. Bryant. Effective use of Boolean satisfiability procedures in the formal verification of superscalar and VLIW microprocessors. J. Symbolic Comput., 35(2):73–106, 2003. 29 97. Daniel S. Weld. Recent advances in ai planning. AI Magazine, 20(2):93–123, 1999. 98. Ryan Williams, Carla Gomes, and Bart Selman. Backdoors to typical case complexity. In Georg Gottlob and Toby Walsh, editors, Proceedings of the Eighteenth International Joint Conference on Artificial Intelligence, IJCAI 2003, pages 1173–1178. Morgan Kaufmann, 2003. 30
1607.04787
4
1607
2018-12-04T10:43:40
Robust algorithms with polynomial loss for near-unanimity CSPs
[ "cs.DS", "cs.CC", "cs.LO" ]
An instance of the Constraint Satisfaction Problem (CSP) is given by a family of constraints on overlapping sets of variables, and the goal is to assign values from a fixed domain to the variables so that all constraints are satisfied. In the optimization version, the goal is to maximize the number of satisfied constraints. An approximation algorithm for CSP is called robust if it outputs an assignment satisfying a $(1-g(\varepsilon))$-fraction of constraints on any $(1-\varepsilon)$-satisfiable instance, where the loss function $g$ is such that $g(\varepsilon)\rightarrow 0$ as $\varepsilon\rightarrow 0$. We study how the robust approximability of CSPs depends on the set of constraint relations allowed in instances, the so-called constraint language. All constraint languages admitting a robust polynomial-time algorithm (with some $g$) have been characterised by Barto and Kozik, with the general bound on the loss $g$ being doubly exponential, specifically $g(\varepsilon)=O((\log\log(1/\varepsilon))/\log(1/\varepsilon))$. It is natural to ask when a better loss can be achieved: in particular, polynomial loss $g(\varepsilon)=O(\varepsilon^{1/k})$ for some constant $k$. In this paper, we consider CSPs with a constraint language having a near-unanimity polymorphism. We give two randomized robust algorithms with polynomial loss for such CSPs: one works for any near-unanimity polymorphism and the parameter $k$ in the loss depends on the size of the domain and the arity of the relations in $\Gamma$, while the other works for a special ternary near-unanimity operation called dual discriminator with $k=2$ for any domain size. In the latter case, the CSP is a common generalisation of Unique Games with a fixed domain and 2-SAT. In the former case, we use the algebraic approach to the CSP. Both cases use the standard semidefinite programming relaxation for CSP.
cs.DS
cs
Robust algorithms with polynomial loss for near-unanimity CSPs∗ V´ıctor Dalmau Marcin Kozik University Pompeu Fabra Jagiellonian University Andrei Krokhin Durham University Konstantin Makarychev Northwestern University Yury Makarychev TTIC Jakub Oprsal TU Dresden Abstract An instance of the Constraint Satisfaction Problem (CSP) is given by a family of constraints on overlapping sets of variables, and the goal is to assign values from a fixed domain to the variables so that all constraints are satisfied. In the optimization version, the goal is to maximize the number of satisfied constraints. An approximation algorithm for CSP is called robust if it outputs an assignment satisfying a (1 − g(ε))-fraction of constraints on any (1 − ε)-satisfiable instance, where the loss function g is such that g(ε) → 0 as ε → 0. We study how the robust approximability of CSPs depends on the set of constraint relations allowed in instances, the so-called constraint lan- guage. All constraint languages admitting a robust polynomial-time algo- rithm (with some g) have been characterised by Barto and Kozik, with the general bound on the loss g being doubly exponential, specifically g(ε) = O((log log(1/ε))/ log(1/ε)). It is natural to ask when a better loss can be achieved: in particular, polynomial loss g(ε) = O(ε1/k) for some constant k. In this paper, we consider CSPs with a constraint language having a near- unanimity polymorphism. This general condition almost matches a known necessary condition for having a robust algorithm with polynomial loss. We give two randomized robust algorithms with polynomial loss for such CSPs: ∗Marcin Kozik and Jakub Oprsal were partially supported by the National Science Centre Poland under grant no. UMO-2014/13/B/ST6/01812; Jakub Oprsal has also received fund- ing from the European Research Council (Grant Agreement no. 681988, CSP-Infinity). Yury Makarychev was partially supported by NSF awards CAREER CCF-1150062 and IIS-1302662. V´ıctor Dalmau was partially supported by MINECO under grant TIN2016-76573-C2-1-P and Maria de Maeztu Units of Excellence programme MDM-2015-0502. A preliminary version of this paper appeared in SODA 2017. 1 one works for any near-unanimity polymorphism and the parameter k in the loss depends on the size of the domain and the arity of the relations in Γ, while the other works for a special ternary near-unanimity operation called dual discriminator with k = 2 for any domain size. In the latter case, the CSP is a common generalisation of Unique Games with a fixed domain and 2-Sat. In the former case, we use the algebraic approach to the CSP. Both cases use the standard semidefinite programming relaxation for CSP. 1 Introduction The constraint satisfaction problem (CSP) provides a framework in which it is possible to express, in a natural way, many combinatorial problems encountered in computer science and AI [18, 20, 25]. An instance of the CSP consists of a set of variables, a domain of values, and a set of constraints on combinations of values that can be taken by certain subsets of variables. The basic aim is then to find an assignment of values to the variables that satisfies the constraints (deci- sion version) or that satisfies the maximum number of constraints (optimization version). Since CSP-related algorithmic tasks are usually hard in full generality, a ma- jor line of research in CSP studies how possible algorithmic solutions depend on the set of relations allowed to specify constraints, the so-called constraint lan- guage, (see, e.g. [11, 18, 20, 25, 42]). The constraint language is denoted by Γ and the corresponding CSP by CSP(Γ). For example, when one is interested in polynomial-time solvability (to optimality, for the optimization case), the ulti- mate sort of results are dichotomy results [10, 11, 25, 38, 50, 52], pioneered by [49], which characterise the tractable restrictions and show that the rest are NP-hard. Classifications with respect to other complexity classes or specific algorithms are also of interest (e.g. [4, 6, 39, 44]). When approximating (optimization) CSPs, the goal is to improve, as much as possible, the quality of approximation that can be achieved in polynomial time, see e.g. surveys [35, 47]. Throughout the paper we assume that P6=NP. The study of almost satisfiable CSP instances features prominently in the approximability literature. On the hardness side, the notion of approximation resistance (which, intuitively, means that a problem cannot be approximated better than by just picking a random assignment, even on almost satisfiable instances) was much studied recently, e.g. [1, 15, 29, 37]. Many exciting devel- opments in approximability in the last decade were driven by the Unique Games Conjecture (UGC) of Khot, see survey [35]. The UGC states that it is NP-hard to tell almost satisfiable instances of CSP(Γ) from those where only a small frac- tion of constraints can be satisfied, where Γ is the constraint language consisting of all graphs of permutations over a large enough domain. This conjecture (if true) is known to imply optimal inapproximability results for many classical op- 2 timization problems [35]. Moreover, if the UGC is true then a simple algorithm based on semidefinite programming (SDP) provides the best possible approxima- tion for all optimization problems CSP(Γ) [48], though the exact quality of this approximation is unknown. On the positive side, Zwick [53] initiated the systematic study of approxima- tion algorithms which, given an almost satisfiable instance, find an almost satis- fying assignment. Formally, call a polynomial-time algorithm for CSP robust if, for every ε > 0 and every (1 − ε)-satisfiable instance (i.e., at most a ε-fraction of constraints can be removed to make the instance satisfiable), it outputs a (1 − g(ε))-satisfying assignment (i.e., that fails to satisfy at most a g(ε)-fraction of constraints). Here, the loss function g must be such that g(ε) → 0 as ε → 0. Note that one can without loss of generality assume that g(0) = 0, that is, a robust algorithm must return a satisfying assignment for any satisfiable instance. The running time of the algorithm should not depend on ε (which is unknown when the algorithm is run). Which problems CSP(Γ) admit robust algorithms? When such algorithms exist, how does the best possible loss g depend on Γ? Related Work In [53], Zwick gave an SDP-based robust algorithm with g(ε) = O(ε1/3) for 2-Sat and an LP-based robust algorithm with g(ε) = O(1/ log(1/ε)) for Horn k-Sat. Robust algorithms with g(ε) = O(√ε) were given in [17] for 2-Sat, and in [16] for Unique Games(q) where q denotes the size of the domain. For Horn-2-Sat, a robust algorithm with g(ε) = 2ε was given in [27]. These bounds for Horn k-Sat (k ≥ 3), Horn 2-Sat, 2-Sat, and Unique Games(q) are known to be optimal [27, 34, 36], assuming the UGC. The algebraic approach to CSP [11, 18, 32] has played a significant role in the recent massive progress in understanding the landscape of complexity of CSPs. The key to this approach is the notion of a polymorphism, which is an n-ary operation (on the domain) that preserves the constraint relations. Intuitively, a polymorphism provides a uniform way to combine n solutions to a system of constraints (say, part of an instance) into a new solution by applying the oper- ation component-wise. The intention is that the new solution improves on the initial solutions in some problem-specific way. Many classifications of CSPs with respect to some algorithmic property of interest begin by proving an algebraic classification stating that every constraint language either can simulate (in a spe- cific way, via gadgets, -- see e.g. [5, 23, 44] for details) one of a few specific basic CSPs failing the property of interest or else has polymorphisms having certain nice properties (say, satisfying nice equations). Such polymorphisms are then used to obtain positive results, e.g. to design and analyze algorithms. Getting such a positive result in full generality in one step is usually hard, so (typically) progress is made through a series of intermediate steps where the result is ob- 3 tained for increasingly weaker algebraic conditions. The algebraic approach was originally developed for the decision CSP [11, 32], and it was adapted for robust satisfiability in [23]. One such algebraic classification result [45] gives an algebraic condition (re- ferred to as SD(∧) or "omitting types 1 and 2" -- see [4, 41, 45] for details) equivalent to the inability to simulate 3-Lin-p -- systems of linear equations over Zp, p prime, with 3 variable per equation. Hastad's celebrated result [28] im- plies that 3-Lin-p does not admit a robust algorithm (for any g). This result carries over to all constraint languages that can simulate (some) 3-Lin-p [23]. The remaining languages are precisely those that have the logico-combinatorial property of CSPs called "bounded width" or "bounded treewidth duality" [4, 9, 46]. This property says, roughly, that all unsatisfiable instances can be refuted via local propagation -- see [12] for a survey on dualities for CSP. Barto and Kozik used SD(∧) in [4], and then in [5] they used their techniques from [4] to prove the Guruswami-Zhou conjecture [27] that each bounded width CSP admits a robust algorithm. The general bound on the loss in [5] is g(ε) = O((log log(1/ε))/ log(1/ε)). It is natural to ask when a better loss can be achieved. In particular, the problems of characterizing CSPs where linear loss g(ε) = O(ε) or polynomial loss g(ε) = O(ε1/k) (for constant k) can be achieved have been posed in [23]. Partial results on these problems appeared in [23, 24, 43]. For the Boolean case, i.e., when the domain is {0, 1}, the dependence of loss on Γ is fully classified in [23]. Our Contribution We study CSPs that admit a robust algorithm with polynomial loss. As explained above, the bounded width property is necessary for admitting any robust algo- rithm. Horn 3-Sat has bounded width, but does not admit a robust algorithm with polynomial loss (unless the UGC fails) [27]. The algebraic condition that separates 3-Lin-p and Horn 3-Sat from the CSPs that can potentially be shown to admit a robust algorithm with polynomial loss is known as SD(∨) or "omitting types 1, 2 and 5" [23], see Section 2.2 for the description of SD(∨) in terms of polymorphisms. The condition SD(∨) is also a necessary condition for the logico- combinatorial property of CSPs called "bounded pathwidth duality" (which says, roughly, that all unsatisfiable instances can be refuted via local propagation in a linear fashion), and possibly a sufficient condition for it too [44]. It seems very hard to obtain a robust algorithm with polynomial loss for every CSP satisfying SD(∨) all in one step. From the algebraic perspective, the most general natural condition that is (slightly) stronger than SD(∨) is the near-unanimity (NU) condition [2]. CSPs with a constraint language having an NU polymorphism received a lot of attention in the literature (e.g. [25, 31, 6]). Bounded pathwidth duality for CSPs admitting 4 an NU polymorphism was established in a series of papers [21, 22, 6], and we use some ideas from [22, 6] in this paper. We prove that any CSP with a constraint language having an NU polymor- phism admits a randomized robust algorithm with loss O(ε1/k), where k depends on the size of the domain. It is an open question whether this dependence on the size of the domain is necessary. We prove that, for the special case of a ternary NU polymorphism known as dual discriminator (the corresponding CSP is a common generalisation of Unique Games with a fixed domain and 2-Sat), we can always choose k = 2. Like the vast majority of approximation algorithms for CSPs [47], our algorithms use the standard SDP relaxation. The algorithm for the general NU case follows the same general scheme as [5, 43]: 1. Solve the LP/SDP relaxation for a (1 − ε)-satisfiable instance I. 2. Use the LP/SDP solution to remove certain constraints in I with total weight O(g(ε)) (in our case, O(ε1/k)) so that the remaining instance satisfies a certain consistency condition. 3. Use the appropriate polymorphism (in our case, NU) to show that any instance of CSP(Γ) with this consistency condition is satisfiable. Steps 1 and 2 in this scheme can be applied to any CSP instance, and this is where essentially all work of the approximation algorithm happens. Polymorphisms are not used in the algorithm, they are used in step 3 only to prove the correctness. While the above general scheme is rather simple, applying it is typically quite challenging. Obviously, step 2 prefers weaker conditions (achievable by removing not too many constraints), while step 3 prefers stronger conditions (so that they can guarantee satisfiability), so reaching the balance between them is the main (and typically significant) technical challenge in any application of this scheme. Our algorithm is somewhat inspired by [5], but it is also quite different from the algorithm there. That algorithm is designed so that steps 1 and 2 establish a consistency condition that, in particular, includes the 1-minimality condition, and establishing 1-minimality alone requires removing constraints with total weight O(1/ log (1/ε)) [27], unless UGC fails. Since our requirement on the loss function g(ε) is stricter, we have to design a different "rounding" procedure (which is usually the hardest part to analyse for most approximation algorithms). As in [5], our rounding is non-traditional, since a solution to the SDP relaxation is used to decide which constraints to violate, rather than to immediately assign values to the variables. To show that our rounding gives the right dependency on ε, we introduce a new consistency condition somewhat inspired by [6, 40]. The proof that the new consistency condition satisfies the requirements of steps 2 and 3 of the above scheme is one of the main technical contributions of our paper. 5 Organization of the paper After some preliminaries, we formulate the two main results of this paper in Section 3. Section 4 then contains a description of SDP relaxations that we will use further on. Sections 5 and 6 contain the description of the algorithms for constraint languages compatible with NU polymorphism and dual discriminator, respectively; the following chapters prove the correctness of the two algorithms. 2 Preliminaries 2.1 CSPs Throughout the paper, let D be a fixed finite set, sometimes called the domain. An instance of the CSP is a pair I = (V,C) with V a finite set of variables and C is a finite set of constraints. Each constraint is a pair (x, R) where x is a tuple of variables (say, of length r > 0), called the scope of C and R an r-ary relation on D called the constraint relation of C. The arity of a constraint is defined to be the arity of its constraint relation. In the weighted optimization version, which we consider in this paper, every constraint C ∈ C has an associated weight wC ≥ 0. Unless otherwise stated we shall assume that every instance satisfies PC∈C wC = 1. An assignment for I is a mapping s : V → D. We say that s satisfies a constraint ((x1, . . . , xr), R) if (s(x1), . . . , s(xr)) ∈ R. For 0 ≤ β ≤ 1 we say that assignment s β-satisfies I if the total weight of the constraints satisfied by s is at least β. In this case we say that I is β-satisfiable. The best possible β for I is denoted by Opt(I). A constraint language on D is a finite set Γ of relations on D. The problem CSP(Γ) consists of all instances of the CSP where all the constraint relations are from Γ. Problems k-Sat, Horn k-Sat, 3-Lin-p, Graph H-colouring, and Unique Games(D) are all of the form CSP(Γ). The decision problem for CSP(Γ) asks whether an input instance I of CSP(Γ) has an assignment satisfying all constraints in I. The optimization problem for CSP(Γ) asks to find an assignment s where the weight of the constraints satisfied by s is as large as possible. Optimization problems are often hard to solve to optimality, motivating the study of approximation algorithms. 2.2 Algebra An n-ary operation f on D is a map from Dn to D. We say that f preserves (or is a polymorphism of) an r-ary relation R on D if for all n (not necessarily distinct) tuples (ai 1, . . . , ai r) ∈ R, 1 ≤ i ≤ n, the tuple (f (a1 1, . . . , ar n), . . . , f (ar 1, . . . , a1 n)) 6 belongs to R as well. Say, if R is the edge relation of a digraph H, then f is a polymorphism of R if and only if, for any list of n (not necessarily distinct) edges (a1, b1), . . . , (an, bn) of H, there is an edge in H from f (a1, . . . , an) to f (b1, . . . , bn). If f is a polymorphism of every relation in a constraint language Γ then f is called a polymorphism of Γ. Many algorithmic properties of CSP(Γ) depend only on the polymorphisms of Γ, see survey [7], also [11, 23, 32, 44]. An (n + 1)-ary (n ≥ 2) operation f is a near-unanimity (NU) operation if, for all x, y ∈ D, it satisfies f (x, x, . . . , x, x, y) = f (x, x, . . . , x, y, x) = ··· = f (y, x, . . . , x, x, x) = x. Note that the behaviour of f on other tuples of arguments is not restricted. An NU operation of arity 3 is called a majority operation. We mentioned in the introduction that (modulo UGC) only constraint lan- guages satisfying condition SD(∨) can admit robust algorithms with polynomial loss. The condition SD(∨) can be expressed in many equivalent ways: for exam- ple, as the existence of ternary polymorphisms d0, . . . , dt, t ≥ 2, satisfying the following equations [30]: (2.1) (2.2) (2.3) (2.4) dt(x, y, z) = z, d0(x, y, z) = x, di(x, y, x) = di+1(x, y, x) for all even i < t, di(x, y, y) = di+1(x, y, y) for all even i < t, di(x, x, y) = di+1(x, x, y) for all odd i < t. If line (2.2) is strengthened to di(x, y, x) = x for all i, then, for any constraint language, having such polymorphisms would be equivalent to having an NU poly- morphism of some arity [3] (this is true only when constraint languages are as- sumed to be finite). NU polymorphisms appeared many times in the CSP literature. For example, they characterize the so-called "bounded strict width" property [25, 31], which says, roughly, that, after establishing local consistency in an instance, one can always construct a solution in a greedy way, by picking values for variables in any order so that constraints are not violated. Theorem 1. [25, 31] Let Γ be a constraint language with an NU polymorphism of some arity. There is a polynomial-time algorithm that, given an instance of CSP(Γ), finds a satisfying assignment or reports that none exists. Every relation with an (n + 1)-ary NU polymorphism is n-decomposable (and in some sense the converse also holds) [2]. We give a formal definition only for the majority case n = 2. Let R be a r-ary (r ≥ 2) relation. For every i, j ∈ {1, . . . , r}, let pri,j R be the binary relation {(ai, aj) (a1, . . . , ar) ∈ R}. Then R is called 7 2-decomposable if the following holds: a tuple (a1, . . . , ar) ∈ Dr belongs to R if and only if (ai, aj) ∈ pri,j R for every i, j ∈ {1, . . . , r}. The dual discriminator is a majority operation f such that f (x, y, z) = x whenever x, y, z are pairwise distinct. Binary relations preserved by the dual discriminator are known as implicational [8] or 0/1/all [19] relations. Every such relation is of one of the four following types: 1. ({a} × D) ∪ (D × {b}) for a, b ∈ D, 2. {(π(a), a) a ∈ D} where π is a permutation on D, 3. P × Q where P, Q ⊆ D, 4. a intersection of a relation of type 1 or 2 with a relation of type 3. The relations of the first kind, when D = {0, 1}, are exactly the relations allowed in 2-Sat, while the relations of the second kind are precisely the relations allowed in Unique Games (D). We remark that having such an explicit description of relations having a given polymorphism is rare beyond the Boolean case. 3 Main result Theorem 2. Let Γ be a constraint language on D. 1. If Γ has a near-unanimity polymorphism then CSP(Γ) admits a randomized polynomial-time robust algorithm with loss O(ε1/k) for k = 6Dr + 7 where r is the maximal arity of a relation in Γ. Moreover, if Γ contains only binary relations then one can choose k = 6D + 7. domized polynomial-time robust algorithm with loss O(√ε). 2. If Γ has the dual discriminator polymorphism then CSP(Γ) admits a ran- It was stated as an open problem in [23] whether every CSP that admits a robust algorithm with loss O(ε1/k) admits one where k is bounded by an absolute constant (that does not dependent on D). In the context of the above theorem, the problem can be made more specific: is dependence of k on D in this theorem avoidable or there is a strict hierarchy of possible degrees there? The case of a majority polymorphism is a good starting point when trying to answer this question. As mentioned in the introduction, robust algorithms with polynomial loss and bounded pathwidth duality for CSPs seem to be somehow related, at least in terms of algebraic conditions. The condition SD(∨) is the common necessary condition for them, albeit it is conditional on UGC for the former and uncon- ditional for the latter. Having an NU polymorphism is a sufficient condition 8 for both. Another family of problems CSP(Γ) with bounded pathwidth duality was shown to admit robust algorithms with polynomial loss in [23], where the parameter k depends on the pathwidth duality bound (and appears in the alge- braic description of this family). This family includes languages not having an NU polymorphism of any arity -- see [13, 14]. It is unclear how far connections between the two directions go, but consistency notions seem to be the common theme. Returning to the discussion of a possible hierarchy of degrees in polynomial loss in robust algorithms -- there was a similar question about a hierarchy of bounds for pathwidth duality, and the hierarchy was shown to be strict [22], even in the presence of a majority polymorphism. 4 SDP relaxation Associated to every instance I = (V,C) of CSP there is a standard SDP relax- ation. It comes in two versions: maximizing the number of satisfied constraints and minimizing the number of unsatisfied constraints. We use the latter. We define it assuming that all constraints are binary, this will be sufficient for our purposes. The SDP has a variable xa for every x ∈ V and a ∈ D. It also contains a special unit vector v0. The goal is to assign (V kD)-dimensional real vectors to its variables minimizing the following objective function: (4.1) subject to: (4.2) (4.3) (4.4) (4.5) XC=((x,y),R)∈C wC X(a,b)6∈R xayb xayb ≥ 0 xaxb = 0 Pa∈D xa = v0 kv0k = 1 x, y ∈ V, a, b ∈ D x ∈ V, a, b ∈ D, a 6= b x ∈ V In the intended integral solution, x = a if xa = v0. In the fractional solution, we informally interpret kxak2 as the probability of x = a according to the SDP (the constraints of the SDP ensure that Pa∈D kxak2 = 1). If C = ((x, y), R) is a constraint and a, b ∈ D, one can think of xayb as the probability given by the solution of the SDP to the pair (a, b) in C. The optimal SDP solution, then, gives as little probability as possible to pairs that are not in the constraint relation. For a constraint C = ((x, y), R), conditions (4.4) and (4.5) imply that P(a,b)∈R xayb is at most 1. Let loss(C) = P(a,b)6∈R xayb. For a subset A ⊆ D, let xA =Pa∈A xa. Note that xD = yD(= v0) for all x, y ∈ D. 9 Let SDPOpt(I) be the optimum value of (4.1). It is clear that, for any instance I, we have Opt(I) ≥ SDPOpt(I) ≥ 0. There are algorithms [51] that, given an SDP instance I and some additive error δ > 0, produce in time poly (I, log(1/δ)) an output vector solution whose value is at most SDPOpt(I)+ δ. There are several ways to deal with the error δ. In this paper we deal with it by introducing a preprocessing step which will also be needed to argue that the algorithm described in the proof of Theorem 2(1) runs in polynomial time. Preprocessing step 1. Assume that C = {C1, . . . , Cm} and that wC1 ≥ wC2 ≥ . . . ≥ wCm. Using the algorithm from Theorem 1, find the largest j such that the subinstance Ij = (V,{C1, . . . , Cj}) is satisfiable. If the total weight of the constraints in Ij is at least 1 − 1/m then return the assignment s satisfying Ij and stop. Lemma 1. Assume that I is (1 − ε)-satisfiable. If ε ≤ 1/m2 then preprocessing step 1 returns an assignment that (1 − √ε)-satisfies I. Proof. Assume ε ≤ 1/m2. Let i be maximum with the property that wCi > ε. It follows that the instance Ii = (V,{C1, . . . , Ci}) is satisfiable since the assignment (1 − ε)-satisfying I must satisfy every constraint with weight larger than ε. It follows that i ≤ j and, hence, the value of the assignment satisfying Ij is at least 1 − wCi+1 − ··· − wCm ≥ 1 − mwCi+1 ≥ 1 − mε ≥ 1 − √ε. If the preprocessing step returns an assignment then we are done. So assume that it did not return an assignment. Then we know that ε ≥ 1/m2. We then solve the SDP relaxation with δ = 1/m2 obtaining a solution with objective value at most 2ε which is good enough for our purposes. 5 Overview of the proof of Theorem 2(1) We assume throughout that Γ has a near-unanimity polymorphism of arity n + 1 (n ≥ 2). It is sufficient to prove Theorem 2(1) for the case when Γ consists of binary relations and k = 6D + 7. The rest will follow by Proposition 4.1 of [5] (see also Theorem 24 in [7]), which shows how to reduce the general case to constraint languages consisting of unary and binary relations in such a way that the domain size increases from D to Dr where r is the maximal arity of a relation in Γ. Note that every unary constraint (x, R) can be replaced by the binary constraint ((x, x), R′) where R′ = {(a, a) a ∈ R}. instance of CSP(Γ). Throughout the rest of this section, let I = (V,C) be a (1 − ε)-satisfiable 10 5.1 Patterns and realizations A pattern in I is defined as a directed multigraph p whose vertices are labeled by variables of I and edges are labeled by constraints of I in such a way that the beginning of an edge labeled by ((x, y), R) is labeled by x and the end by y. Two of the vertices in p can be distinguished as the beginning and the end of p. If these two vertices are labeled by variables x and y, respectively, then we say that p is a pattern from x to y. For two patterns p and q such that the end of p and the beginning of q are labeled by the same variable, we define p + q to be the pattern which is obtained from the disjoint union of p and q by identifying the end of p with the beginning of q and choosing the beginning of p + q to be the beginning of p and the end of p + q to be the end of q. We also define jp to be p + ··· + p where p appears j times. A pattern is said to be a path pattern if the underlying graph is an oriented path with the beginning and the end being the two end vertices of the path, and is said to be an n-tree pattern if the underlying graph is an orientation of a tree with at most n leaves, and both the beginning and the end are leaves. A path of n-trees pattern is then any pattern of the form t1 + ··· + tj for some n-tree patterns t1, . . . , tj. A realization of a pattern p is a mapping r from the set of vertices of p to D such that if (vx, vy) is an edge labeled by ((x, y), R) then (r(vx), r(vy)) ∈ R. Note that r does not have to map different vertices of p labeled with same variable to the same element in D. A propagation of a set A ⊆ D along a pattern p whose beginning vertex is b and ending vertex is e is defined as follows. For A ⊆ D, define A + p = {r(e) r is a realization of p with r(b) ∈ A}. Also for a binary relation R we put A + R = {b (a, b) ∈ R and a ∈ A}. Observe that we have (A + p) + q = A + (p + q). x where 1 ≤ ℓ ≤ D + 1 and x runs through all variables in an instance I. Let p be a pattern in I with beginning b and end e. We call a realization r of p an ℓ-realization (with respect to the family {Dℓ x}) if, for any vertex v of p labeled by a variable x, we have r(v) ∈ Dℓ+1 Further, assume that we have non-empty sets Dℓ x . For A ⊆ D, define A +ℓ p = {r(e) r is an ℓ-realization of p with r(b) ∈ A}. Also, for a constraint ((x, y), R) or ((y, x), R−1) and sets A, B ⊆ D, we write B = A +ℓ (x, R, y) if B = {b ∈ Dℓ+1 5.2 The consistency notion (a, b) ∈ R for some a ∈ A ∩ Dℓ+1 x }. y Recall that we assume that Γ contains only binary relations. Before we formally introduce the new consistency notion, which is the key to our result, as we ex- plained in the introduction, we give an example of a similar simpler condition. 11 We mentioned before that 2-Sat is a special case of a CSP that admits an NU polymorphism (actually, the only majority operation on {0, 1}). There is a text- book consistency condition characterizing satisfiable 2-Sat instances, which can be expressed in our notation as follows: for each variable x in a 2-Sat instance I, there is a value ax such that, for any path pattern p in I from x to x, we have ax ∈ {ax} + p. Let I be an instance of CSP(Γ) over a set V of variables. We say that I satisfies condition (IPQ)n if the following holds: (IPQ)n For every y ∈ V , there exist non-empty sets D1 y ⊆ DD+1 x, and any two patterns p, q which are paths of n-trees in I from x to x, there exists j such that = D such that for any x ∈ V , any ℓ ≤ D, any a ∈ Dℓ y ⊆ . . . ⊆ DD y a ∈ {a} +ℓ (j(p + q) + p). Note that + between p and q is the pattern addition and thus independent of ℓ. Note also that a in the above condition belongs to Dℓ x, while propagation is performed by using ℓ-realizations, i.e., inside sets Dℓ+1 . y The following theorem states that this consistency notion satisfies the re- quirements of step 3 of the general scheme (for designing robust approximation algorithms) discussed in the introduction. Theorem 3. Let Γ be a constraint language containing only binary relations such that Γ has an (n + 1)-ary NU polymorphism. If an instance I of CSP(Γ) satisfies (IPQ)n, then I is satisfiable. 5.3 The algorithm Let k = 6D + 7. We provide an algorithm which, given a (1 − ε)-satisfiable instance I of CSP(Γ), removes O(ε1/k) constraints from it to obtain a subin- stance I ′ satisfying condition (IPQ)n. It then follows from Theorem 3 that I ′ is satisfiable, and we can find a satisfying assignment by Theorem 1. 5.3.1 More preprocessing By Lemma 1 we can assume that ε ≥ 1/m2. We solve the SDP relaxation with error δ = 1/m2 and obtain a solution {xa} (x ∈ V, a ∈ D) whose objective value ε′ is at most 2ε. Let us define α to be max{ε′, 1/m2}. It is clear that α = O(ε). Furthermore, this gives us that 1/α ≤ m2. This will be needed to argue that the main part of the algorithm runs in polynomial time. Let κ = 1/k (we will often use κ to avoid overloading formulas). Preprocessing step 2. For each x ∈ V and 1 ≤ ℓ ≤ D + 1, compute sets x ⊆ D as follows. Set DD+1 Dℓ x = {a ∈ D = D and, for 1 ≤ ℓ ≤ D, set Dℓ x 12 It is clear that the sets Dℓ kxak ≥ rx,ℓ} where rx,ℓ is the smallest number of the form r = α3ℓκ(2D)i/2, i ≥ 0 integer, with {b ∈ D r(2D)−1/2 ≤ kxbk < r} = ∅. It is easy to check that rx,ℓ is obtained with i ≤ D. x ⊆ D, x ∈ V , 1 ≤ ℓ ≤ D, can be computed in polynomial time. The sets Dℓ x contains relatively "heavy" elements (a's such that kxak2 is large). The thresholds are chosen so that there is a big gap (at least by a factor of 2D) between "heaviness" of an element in Dℓ x and outside. x are chosen such that Dℓ 5.3.2 Main part Given the preprocessing is done, we have that 1/α ≤ m2, and we precomputed sets Dℓ x for all x ∈ V and 1 ≤ ℓ ≤ D+1. The description below uses the number n, where n + 1 is the arity of the NU polymorphism of Γ. Step 0. Remove every constraint C with loss(C) > α1−κ. Step 1. For every 1 ≤ ℓ ≤ D do the following. Pick a value rℓ ∈ (0, α(6ℓ+4)κ) uniformly at random. Here we need some notation: for x, y ∈ V and A, B ⊆ D, we write xA (cid:22)ℓ yB to indicate that there is no integer j such that kyBk2 < rℓ + jα(6ℓ+4)κ ≤ kxAk2. Then, remove all constraints ((x, y), R) such that there are sets A, B ⊆ D with B = A +ℓ (x, R, y) and xA 6(cid:22)ℓ yB, or with B = A +ℓ (y, R−1, x) and yA 6(cid:22)ℓ xB. Step 2. For every 1 ≤ ℓ ≤ D do the following. Let m0 = ⌊α−2κ⌋. Pick a value sℓ ∈ {0, . . . , m0 − 1} uniformly at random. We define xA (cid:22)ℓ w yB to mean that there is no integer j such that kyBk2 < rℓ + (sℓ + jm0)α(6ℓ+4)κ ≤ kxAk2. w yB. Now, if A ⊆ B ⊆ Dℓ+1 Obviously, if xA (cid:22)ℓ yB then xA (cid:22)ℓ are such that kxB − xAk2 ≤ (2n − 3)α(6ℓ+4)κ and xB 6(cid:22)ℓ w xA, then remove all the constraints in which x participates. x Step 3. For every 1 ≤ ℓ ≤ D do the following. Pick mℓ = ⌈α−(3ℓ+1)κ⌉ unit vectors independently uniformly at random. For x, y ∈ V and A, B ⊆ D, say that xA and yB are cut by a vector u if the signs of u · (xA − xD\A) and u · (yB − yD\B) differ. Furthermore, we say that xA and yB are ℓ-cut if there are cut by at least one of the chosen mℓ vectors. For every variable x, if there exist subsets A, B ⊆ D such that A ∩ Dℓ x and the vectors xA and xB are not ℓ-cut, then remove all the constraints in which x participates. x 6= B ∩ Dℓ Step 4. For every 1 ≤ ℓ ≤ D, remove every constraint ((x, y), R) such that there are sets A, B ⊆ D with B = A +ℓ (x, R, y), and xA and yB are ℓ-cut, or with B = A +ℓ (y, R−1, x), and yA and xB are ℓ-cut. Step 5. For every 1 ≤ ℓ ≤ D do the following. For every variable x, If such that kxB − xAk2 ≤ (2n − 3)α(6ℓ+4)κ and xA and xB are ℓ-cut, A, B ⊆ Dℓ+1 remove all constraints in which x participates. x 13 Step 6. By Proposition 2 and Theorem 3, the remaining instance I ′ is satisfiable. Use the algorithm given by Theorem 1 to find a satisfying assignment for I ′. Assign all variables in I that do not appear in I ′ arbitrarily and return the obtained assignment for I. Note that we chose to define the cut condition based on xA − xD\A, rather than on xA, because the former choice has the advantage that kxA − xD\Ak = 1, which helps in some calculations. In step 0 we remove constraints such that, according to the SDP solution, have a high probability to be violated. Intuitively, steps 1 and 2 ensure that the loss in kxAk after propagating A by a path of n-trees is not too big. This is achieved first by ensuring that by following a path we do not lose too much (step 1) which also gives a bound on how much we can lose by following an n- tree pattern (see Lemma 14). Together with the removal of constraints in step 2, this guarantees that following a path of n-trees we do not lose too much. This ensures that {a} +ℓ (j(p + q) + p) is non-vanishing as j increases. Steps 3 -- 5 ensure that if A and B are connected by paths of n-trees in both directions (i.e., xA = xB +ℓ p1 and xB = xA +ℓ p2), then xA and xB do not differ too much (i.e., A ∩ Dℓ x). This is achieved by separating the space into cones by cutting it using the mℓ chosen vectors, removing the variables which have two different sets that are not ℓ-cut (step 3), and then ensuring that if we follow an edge (step 4), or if we drop elements that do not extend to an n-tree (step 5) we do not cross a border to another cone. This gives us both that the sequence Aj = {a} +ℓ (j(p + q) + p) stabilizes and that, after it stabilizes, Aj contains a. This provides condition (IPQ)n for the remaining instance I ′. The algorithm runs in polynomial time. Since D is fixed, it is clear that the steps 0 -- 2 can be performed in polynomial time. For steps 3 -- 5, we also need that mℓ is bounded by a polynomial in m, which holds because α ≥ 1/m2. The correctness of the algorithm is given by Theorem 3 and the two fol- lowing propositions whose proof can be found in Section 8. These propositions show that our new consistency notion satisfies the requirements of step 2 of the general scheme for designing robust approximation algorithms discussed in the introduction. x = B ∩ Dℓ Proposition 1. The expected total weight of constraints removed by the algorithm is O(ακ). Proposition 2. The instance I ′ obtained after steps 0 -- 5 satisfies the condition (IPQ)n (with the sets Dℓ x computed by preprocessing step 2 in Section 5.3.1). 14 6 Overview of the proof of Theorem 2(2) Since the dual discriminator is a majority operation, every relation in Γ is 2- decomposable. Therefore, it follows, e.g. from Lemma 3.2 in [23], that to prove that CSP(Γ) admits a robust algorithm with loss O(√ε), it suffices to prove this for the case when Γ consists of all unary and binary relations preserved by the dual discriminator. Such binary constraints are of one of the four kinds described in Section 2.2. Using this description, it follows from Lemma 3.2 of [23] that it suffices to consider the following three types of constraints: 1. Disjunction constraints of the form x = a ∨ y = b, where a, b ∈ D; 2. Unique game (UG) constraints of the form x = π(y), where π is any per- mutation on D; 3. Unary constraints of the form x ∈ P , where P is an arbitrary non-empty subset of D. We present an algorithm that, given a (1 − ε)-satisfiable instance I = (V,C) of the problem, finds a solution satisfying constraints with expected total weight 1 − O(pε log D) (the hidden constant in the O-notation depends neither on ε nor on D). We now give an informal and somewhat imprecise sketch of the algorithm and its analysis. We present details in Section 9. We use the SDP relaxation from Section 4. Let us call the value kxak2 the SDP weight of the value a for variable x. Variable Partitioning Step The algorithm first solves the SDP relaxation. Then, it partitions all variables into three groups V0, V1, and V2 using a threshold rounding algorithm with a random threshold. If most of the SDP weight for x is concentrated on one value a ∈ D, then the algorithm puts x in the set V0 and assigns x the value a. If most of the SDP weight for x is concentrated on two values a, b ∈ D, then the algorithm puts x in the set V1 and restricts the domain of x to the set Dx = {a, b} (thus we guarantee that the algorithm will eventually assign one of the values a or b to x). Finally, if the SDP weight for x is spread among 3 or more values, then we put x in the set V2; we do not restrict the domain for such x. After we assign values to x ∈ V0 and restrict the domain of x ∈ V1 to Dx, some constraints are guaranteed to be satisfied (say, the constraint (x = a) ∨ (y = b) is satisfied if we assign x the value a and the constraint x ∈ P is satisfied if Dx ⊆ P ). Denote the set of such constraints by Cs and let C′ = C \ Cs. 15 We then identify a set Cv ⊆ C′ of constraints that we conservatively label as violated. This set includes all constraints in C′ except those belonging to one of the following 4 groups: 1. disjunction constraints (x = a)∨(y = b) with x, y ∈ V1 and a ∈ Dx, b ∈ Dy; 2. UG constraints x = π(y) with x, y ∈ V1 and Dx = π(Dy); 3. UG constraints x = π(y) with x, y ∈ V2; 4. unary constraints x ∈ P with x ∈ V2. Our construction of sets V0, V1, and V2, which is based on randomized threshold rounding, ensures that the expected total weight of constraints in Cv is O(ε) (see Lemma 18). The constraints from the 4 groups above naturally form two disjoint sub-ins- tances of I: I1 (groups 1 and 2) on the set of variables V1, and I2 (groups 3 and 4) on V2. We treat these instances independently as described below. Solving Instance I1 The instance I1 with the domain of each x restricted to Dx is effectively an instance of Boolean 2-CSP (i.e., each variable has a 2-element domain and all constraints are binary). A robust algorithm with quadratic loss for this problem was given by Charikar et al. [17]. This algorithm finds a solution violating an O(√ε) fraction of all constraints if the optimal solution violates at most ε fraction of all constraints or SDPOpt(I1) ≤ ε. However, we cannot apply this algorithm to the instance I1 as is. The problem is that the weight of violated constraints in the optimal solution for I1 may be greater than ω(ε). Note that the unknown optimal solution for the original instance I may assign values to variables x outside of the restricted domain Dx, and hence it is not a feasible solution for I1. Furthermore, we do not have a feasible SDP solution for the instance I1, since the original SDP solution (restricted to the variables in V1) is not a feasible solution for the Boolean 2-CSP problem (because Pa∈Dx xa is not necessarily equal to v0 and, consequently, Pa∈Dx kxak2 may be less than 1). Thus, our algorithm first transforms the SDP solution to obtain a feasible solution for I1. To this end, it partitions the set of vectors {xa : x ∈ V1, a ∈ Dx} into two sets H and ¯H using a modification of the hyperplane rounding algorithm by Goemans and Williamson [26]. In this partitioning, for every variable x, one of the two vectors {xa : a ∈ Dx} belongs to H and the other belongs to ¯H. Label the elements of each Dx as αx and βx so that so that xαx is the vector in H and xβx is the vector in ¯H. For every x, we define two new vectors xαx = xαx and xβx = v0 − xαx. It is not hard to verify that the set of vectors {xa : x ∈ V1, a ∈ Dx} forms a feasible SDP solution for the instance I1. We show that for each disjunction constraint C 16 in the instance I1, the cost of C in the new SDP solution is not greater than the cost of C in the original SDP solution (see Lemma 20). The same is true for all but O(√ε) fraction of UG constraints. Thus, after removing UG constraints for which the SDP value has increased, we get an SDP solution of cost O(ε). Using the algorithm [17] for Boolean 2-CSP, we obtain a solution for I1 that violates constraints of total weight at most O(√ε). Solving Instance I2 The instance I2 may contain only unary and UG constraints as all disjunction constraints are removed from I2 in the variable partitioning step. We run the approximation algorithm for Unique Games by Charikar et al. [16] on I2 using the original SDP solution restricted to vectors {xa : x ∈ V2, a ∈ D}. This is a valid SDP relaxation because in the instance I2, unlike the instance I1, we do not restrict the domain of variables x to Dx. The cost of this SDP solution is at most ε. As shown in [16], the weight of constraints violated by the algorithm [16] is at most O(pε log D). We get the solution for I by combining solutions for I1 and I2, and assigning values chosen at the variable partitioning step to the variables from the set V0. 7 Proof of Theorem 3 In this section we prove Theorem 3. The proof will use constraint languages with relations of arity greater than two. In order to talk about such instances we need to extend the definition of a pattern. Note that patterns (in the sense of Section 5.1) are instances (with some added structure) and the realizations of patterns are solutions. We use the pattern/instance and solution/realization duality to generalize the notion of a pattern. Moreover we often treat patterns as instances and (whenever it makes sense) instances as patterns. We will often talk about path/tree instances; they are defined using the in- cidence multigraph. The incidence multigraph of an instance J is bipartite, its the vertex set consists of variables and constraints of J (which form the two parts), and if a variable x appears j times in a constraint C then the vertices corresponding to x and C have j edges between them. An instance is connected if its incidence multigraph is connected; an instance is a tree instance if it is connected and its incidence multigraph has no multi- ple edges and no cycles. A leaf variable in a tree instance is a variable which corresponds to a leaf in the incidence multigraph, and we say that two vari- ables are neighbours if they appear together in a scope of some constraint (i.e., the corresponding vertices are connected by a path of length 2 in the incidence multigraph). Note that the incidence multigraph of a path pattern in a binary in- 17 stance (treated as an instance, as described in the first paragraph of this section) is a path, and of an n-tree pattern is a tree with n leaves. The next definition captures, among other things, the connection between the pattern (treated as an instance) and the instance in which the pattern is defined. Let J1 and J2 be two instances over the same constraint language. An (instance) homomorphism e : J1 → J2 is a mapping that maps each variable of J1 to a variable of J2 and each constraint of J1 to constraint of J2 in such a way that every constraint ((y1, . . . , yk), R) in J1 is mapped to ((e(y1), . . . , e(yk)), R). Using these new notions, a path pattern in an instance I (see the definition in Section 5.1) can alternatively be defined as an instance, with beginning and end chosen among the leaf variables, whose incidence graph is a path from begin- ning to end, together with a homomorphism into I. Similarly we define a path pattern in a (not necessarily binary) instance I as an instance J , with chosen beginning/end leaf variables, whose incidence graph, after removing all the other vertices of degree one, is a path from beginning to end, together with a homo- morphism e : J → I. Addition of path patterns and propagation are defined in an analogous way as for patterns with binary constraints (see Section 5.1). For a k-ary relation R, let pri(R) = {ai (a1, . . . , ai, . . . , ak) ∈ R}. A CSP instance J is called arc-consistent in sets Dx (x ranges over variables of J ) if, for any variable x and any constraint ((x1, . . . , xk), R) in J , if xi = x then pri(R) = Dx. We say that a CSP instance J satisfies condition (PQ) in sets Dx if 1. J is arc-consistent in these sets and 2. for any variable x, any path patterns p, q from x to x, and any a ∈ Dx there exists j such that a ∈ {a} + (j(p + q) + p). Note that if the instance J is binary then (PQ) implies (IPQ)n for all n (setting x = D if i = D + 1 and Di Di The following fact, a special case of Theorem A.2 in [40], provides solutions for (PQ) instances. x = Dx if i < D + 1). Theorem 4. If Γ′ is a constraint language with a near-unanimity polymorphism, then every instance of CSP(Γ′) satisfying condition (PQ) is satisfiable. Finally, a standard algebraic notion has not been defined yet: having fixed Γ over a set D, a subset A ⊆ D is a subuniverse if, for any polymorphism g of Γ, we have g(a1, a2, . . .) ∈ A whenever a1, a2, . . . ∈ A. For any S ⊆ D, the subuniverse generated by S is defined as {g(a1, . . . , ar) r ≥ 1, a1, . . . , ar ∈ S, g is an r-ary polymorphism of Γ} 18 7.1 Into the proof x. Note that we can assume that all Dℓ We begin the proof of Theorem 3. We fix a binary language Γ compatible with an (n + 1)-ary NU polymorphism and an instance I of CSP(Γ) which satisfies (IPQ)n with sets Dℓ x's are subuniverses. If this is not the case, we replace each Dℓ x with the subuniverse generated by it. It is easy to check that (after the change) the instance I still satisfies (IPQ)n with such enlarged Dℓ x = Di+1 and call it the level of x. Note that each variable has a level (since the sets Dℓ x are non-empty and ℓ ranges from 1 to D + 1). Let V i denote the set of variables of level i and V <i, V ≤i, . . . be defined in the natural way. Our proof of Theorem 3 will proceed by applying Theorem 4 to I restricted to V 1, then to V 2 and so on. However, in order to obtain compatible solutions, we will add constraints to the restricted instances. For each variable x, choose and fix an arbitrary index i such that Di x's. x 7.2 The instances in levels Let I i (for i ≤ D) be the instance defined as follows: 1. V i is the set of variables of I i; 2. I i contains, for every n-tree pattern t of I, the constraint ((x1, . . . , xk), R) defined in the following way: let v1, . . . , vk be all the vertices of t labeled by variables from V i, then x1, . . . , xk are the labels of v1, . . . , vk respectively and R = {(r(v1), . . . , r(vk)) r is a i-realization of t (i.e., inside sets Di+1 x )}. This definition has a number of immediate consequences: First, every binary constraint between two variables from V i is present in I i (as it defines a two- element n-tree). Second, note that if some n-tree contains a vertex vj in V i which is not a leaf then by splitting the tree t at vj (with vj included in both parts) we obtain two trees defining constraints which together are equivalent to the constraint defined by t. This implies that by including only the constraints defined by n-trees t such that only the leaves can be from V i, we obtain an equivalent (i.e., having the same set of solutions) instance. Throughout most of the proof we will be working with such a restricted instance. In this instance the arity of constraints is bounded by n. Since the arity of a constraint in I i is bounded and the size of the universe is fixed, I i is a finite instance, even though some constraints in it can be defined via infinitely many n-tree patterns. It is easy to see that all the relations in the constraints are preserved by all the polymorphisms of Γ. 19 The instance I i is arc-consistent with sets Di x(= Di+1 be a constraint defined by v1, . . . , vk in t and let a ∈ Di a realization of t in Di+1 x mapping vj to a and thus Di hand, as Di sets Di+1 ): Let ((x1, . . . , xk), R) xj . By (IPQ)n there is xj ⊆ prj R. On the other xj and every tuple in R comes from a realization inside the xj = Di+1 's, we get prj R ⊆ Di xj . x x Next we show that I i has property (PQ). Part 1 of the definition was estab- lished in the paragraph above. For part 2, let p and q be arbitrary path patterns from x to x in I i. Define p′ and q′ to be the paths of trees in I obtained, from p and q, respectively, by replacing (in the natural way) each constraint in p and q with the tree that defines it (we use the fact that each constraint is defined by leaves of a tree). We apply property (IPQ)n for I with ℓ = i and patterns p′ and q′ to get that, for any x ∈ V i and any a ∈ Di x, there is a number j such that a ∈ {a} +i (j(p′ + q′) + p′). The property (PQ) follows immediately. Since I i has the property (PQ) then, by Theorem 4, it has a solution. The so- lution to I will be obtained by taking the union of appropriately chosen solutions to I 1, . . . ,I D. 7.3 A global solution, denoted sol : V → D, is constructed in steps. At the start, we define it for the variables in V 1 by choosing an arbitrary solution to I 1. In step i we extend the definition of sol from V <i to V ≤i, using a carefully chosen solution to I i. Our construction will maintain the following condition: (Ei) every n-tree pattern in I has a realization inside the sets Di+1 Invariant of the iterative construction x which agrees with sol on V ≤i. Note that, after the first step, the condition (E1) is guaranteed by the constraints of I 1. Assume that we are in step i: we have already defined sol on V <i and condition (Ei−1) holds. Our goal is to extend sol by a solution of I i in such a way that (Ei) holds. The remainder of Section 7 is devoted to proving that such a solution exists. Once we accomplish that, we are done with the proof: Condition (Ei) implies that sol is defined on V ≤i, and for every constraint ((x, y), R) between x, y ∈ V ≤i the pattern from x to y containing a single edge labeled by ((x, y), R) is an n- tree. This implies that sol satisfies ((x, y), R) i.e., it is a solution on V ≤i. After establishing (ED) we obtain a solution to I. 7.4 Restricting I i We begin by defining a new instance Ki: it is defined almost identically to I i, but in part 2 of the definition we require that the realization r sends vertices from 20 V <i according to sol. As in the case of I i we can assume that all the constraints are defined by leaves of the tree. Thus every n-tree pattern with no internal vertices in V i defines one constraint in I i and another in Ki. Just like I i, the instance Ki is finite. Note that we yet need to establish that constraints of Ki are non-empty, but the following claim, where f is the fixed (n+1)-ary near unanimity polymorphism, holds independently. Claim 1. Let ((x1, . . . , xk), R) and ((x1, . . . , xk), R′) be constraints defined by If a1, . . . , an+1 ∈ R′, a ∈ R, and the same tree t in I i and Ki (respectively). j ∈ {1, . . . , n + 1} then f (a1, . . . , aj−1, a, aj+1, . . . , an+1) belongs to R′. Proof. Let ri be a realization of t defining ai; this realization sends all the vertices of t labeled by variables from V <i according to sol. Let r be a realization of t defining a. Define a function, from vertices of t into D, sending a vertex v to f (r1(v), . . . , r(v), . . . , rn+1(v)) (where r(v) is in position j). This is clearly a realization, and if v is labeled by x ∈ V <i it sends v according to sol (since f is a near-unanimity operation). The new realization witnesses that f (a1, . . . , aj−1, a, aj+1, . . . , an+1) belongs to R′. In order to proceed we need to show that the instance Ki contains a non- empty, arc-consistent subinstance, i.e., an arc-consistent instance (in some non- empty sets Dx) obtained from Ki by restricting every constraint in it so that each coordinate can take value only in the appropriate set Dx. A proof of this claim is the subject of the next section. 7.5 Arc-consistent subinstance of Ki In order to proceed with the proof we need an additional definition. Let e : J1 → J2 be an instance homomorphism. If for any variable y of J1 and any constraint ((x1, . . . , xk), R) of J2 with e(y) = xi (for some i) the constraint ((x1, . . . , xk), R) has exactly one preimage ((y1, . . . , yk), R) with y = yi, we say that e is a cov- ering. A universal covering tree instance UCT(J ) of a connected instance J is a (possibly countably infinite) tree instance T together with a covering e : T → J satisfying some additional properties. If J is a tree instance, then one can take UCT(J ) = J , otherwise UCT(J ) is always infinite. If an instance J is discon- nected then UCT(J ) is a disjoint union of universal covering tree instances for connected components of J . Several equivalent (precise) definitions of UCT can be found in Section 5.4 of [40] or Section 4 of [43]. For our purposes, it is enough to mention that, for 21 any J , the instance UCT(J ) (with covering e) has the following two properties. For any two variables v, v′ satisfying e(v) = e(v′) there exists an endomorphism h of UCT(J ) (i.e., a homomorphism into itself) sending v to v′ and such that e ◦ h = e. Similarly for constraints C and C ′ if e(C) = e(C ′) then there is an endomorphism h such that h(C) = C ′ and e ◦ h = e. It is well known that UCT(J ) has a solution if and only if J has an arc-consistent subinstance. Consider UCT(Ki) and fix a covering e′ : UCT(Ki) → Ki. Let T i be an instance obtained from UCT(Ki) by replacing each constraint C in it by a tree that defines e′(C), each time introducing a fresh set of variables for the internal vertices of the trees. Let e be the instance homomorphism from T i to I defined in the natural way. We call a solution (or a partial solution) to T i nice if it maps each v into Di+1 e(v) and moreover if e(v) ∈ V <i then v is mapped to sol(e(v)). It should be clear that nice solutions to T i correspond to solutions of UCT(Ki) (although the correspondence is not one-to-one). Claim 2. There exists a nice solution of T i. Proof. If T i is not connected, we consider each connected component separately and then take the union of nice solutions. Henceforth we assume that T i is connected. By a standard compactness argument, it suffices to find a nice solution for every finite subtree of T i. Suppose, for a contradiction, that T is a minimal finite subtree of T i without nice solutions. First, only the leaf vertices of T can be mapped, by e, into variables from V <i. Indeed, if an internal vertex is mapped to a variable in V <i, we can split the tree at this vertex into two parts, obtain (from the minimality of T ) nice solutions to both parts (which need to map the splitting vertex according to sol, i.e., to the same element) and merge these solutions to obtain a nice solution to T . This is a contradiction. Second we show that T has more than n leaves mapped by e into V <i. Assume that T has n or fewer leaves mapped to V <i and let T ′ be the smallest subtree of T with these leaves. Then T ′ is an n-tree and by (Ei−1) we obtain a solution s to T ′ in Di x's which sends leaves of T ′ according to sol. It remains to extend s to a solution of T in Di+1 's. This extension is done in a sequence of steps. In each step s is defined for increasingly larger subtrees of T . Furthermore, in each step the following condition (*) is satisfied by s: if a vertex v has a value assigned by s and a neighbour without such value then s(v) belongs to Di e(v). Clearly, this condition holds in the beginning. In each step we pick a constraint C on a vertex v with an assigned value and a vertex v′ without such a value. (Note that the constraints of T i, and consequently of T , are binary.) C has been added to T i by replacing a constraint of UCT(Ki) with an n-tree TC that defines it. Let S be a maximal subtree of T such that it contains C, it has v as a leaf, and all other nodes in S have not been assigned by s and belong to TC. Since TC is a n-tree, S x 22 x e(u) = Di 's that sends v to s(v) ∈ Di is also an n-tree, and we can use (IPQ)n to derive that there exists a solution, s′, of S in Di+1 e(v). More specifically, we apply (IPQ)n with x = v, a = s(v), and both p and q being the same pattern t1 + t2 such that t1 is S with beginning v and end being any other leaf of S, and t2 is t1 with beginning and end swapped. This solution s′ can be added to s (as the values on v are the same). It remains to see that condition (*) is preserved after extending s with s′. Indeed, let u be any vertex such that after adding solution s′ has a neighbour u′ that has not yet been assigned. We can assume that u is one of the new variables assigned by s′. If e(u) ∈ V i then the claim follows from the fact that Di+1 e(u) so we can assume that e(u) 6∈ V i. However, in this case, all neighbours of u in T must be in TC, so the constraint in T containing both u and u′ must be also in TC contradicting the maximality of S. So the counterexample T must have at least n + 1 leaves mapped into V <i. Fix any n + 1 of such leaves v1, . . . , vn+1 and let Tj, for j = 1, . . . , n + 1, denote a subinstance of T obtained by removing vj together with the single constraint containing vj: ((vj, v′ j is not a leaf (as it would make our T a two-element instance) and by the fact that only leaves can be mapped into V <i we get that e(v′ j) ∈ V i j ) = Di+1 and sj(v′ j ) and i + 1 6= D + 1. j) ∈ Di′ In both cases sj(v′ j ) for i′ ≤ D and thus, by (IPQ)n, there exists aj ∈ D such that (aj, sj(v′ j)) ∈ Ri. We let s′ j be the realization of T obtained by extending sj by mapping vj to aj. The last step is to apply the (n + 1)-ary near unanimity operation coordinatewise to s′ j's (in a way identical to the one in the proof of Claim 1). The application produces a nice realization of T . This contradiction finishes the proof of the claim. By minimality, each Tj has a nice realization, say sj. Now either e(v′ j) ∈ V >i and, in the last case, i 6= D. j ) ∈ V i or e(v′ j ) or e(v′ e(v′ j), Rj) from T . Clearly, v′ j) ∈ Di e(v′ j ) ∈ V >i, si(v′ j) ∈ Di+1 e(v′ e(v′ We will denote the arc-consistent subinstance of Ki (which is about to be constructed) by Li. The variables of Li and Ki (or indeed I i) are the same. For every constraint (x, R) in Ki we introduce a constraint (x, R′) into Li where R′ = {a : a = s(y) where s is a solution to UCT(Ki) and e′((y, R)) = (x, R)} where e′ is an instance homomorphism mapping UCT(Ki) to Ki. In other words we restrict a relation in a constraint of Ki by allowing only the tuples which appear in a solution of the UCT(Ki) (at this constraint). All the relations of Li are preserved by all the polymorphisms of Γ, and are non-empty (by Claim 2). The fact that Li is arc-consistent is an easy consequence of the endomorphism structure of universal covering trees. Finally Claim 1 holds for Li: 23 Claim 3. Let ((x1, . . . , xk), R) and ((x1, . . . , xk), R′) be constraints defined by the same tree t in I i and Li, respectively. Let a1, . . . , an+1 ∈ R′ and a ∈ R, then f (a1, . . . , a, . . . , an+1), where f is the (n + 1)-ary near unanimity operation and a is in position j, belongs to R′. Proof. By Claim 1 the tuple f (a1, . . . , a, . . . , an+1) belongs to the relation in the corresponding constraint in Ki. Thus if it extends to a solution of UCT(Ki) it belongs to R′. However each ai extends to a solution of UCT(Ki) and a extends to a solution of UCT(I i). By applying the near-unanimity operation f to these extensions (coordinatewise), we obtain the required evaluation. 7.6 A solution to Ki In order to find a solution to Li, we will use Corollary B.2 from [40]. We state it here in a simplified form using the following notation: for subuniverses A′ ⊆ A, we say that A′ nu-absorbs A if, for some NU polymorphism f , f (a1, . . . , an) ∈ A′ whenever a1, . . . , an ∈ A and at most one ai is in A \ A′. Similarly, if R′ ⊆ R are relations preserved by all polymorphisms of Γ we say R′ nu-absorbs R, if for some near-unanimity operation f taking all arguments from R′ except for one which comes from R produces a result in R′. Corollary 1 (Corollary B.2 from [40]). Let I satisfy (PQ) condition in sets Ax. Let I ′ be an arc-consistent instance in sets A′ x on the same set of variables as I such that: 1. for every variable x the subuniverse A′ 2. for every constraint ((x1, . . . , xn), R′) in I ′ there is a corresponding con- straint ((x1, . . . , xn), R) in I such that R′ nu-absorbs R (and both respect the NU operation). x nu-absorbs Ax, and Then there are subuniverses A′′ tained from I ′ by restricting the domain of each variable to A′′ the constraint relations accordingly satisfies the condition (PQ). x (for every x) such that the instance I ′′ ob- x and by restricting x of A′ We will apply the corollary above using I i for I and Li for I ′. By our construction, I i satisfies condition (PQ), and the sets Di x (which play the role of Ax) are subuniverses of D. On the other hand Li is arc-consistent and all the relations involved in it are closed under the polymorphisms of Γ. Claim 3 shows that each relation R′ nu-absorbs the corresponding R. By arc-consistency, the projection of R′ on a variable x is the same for each constraint ((x1, . . . , xn), R′) x. Since each R′ nu-absorbs R, it containing x, call the corresponding sets A′ follows that each A′ x nu-absorbs the corresponding Ax. The corollary implies that we can restrict the instance Li to obtain an instance satisfying (PQ). By Theorem 4 such an instance, and thus both Ki and Li, has a solution. 24 7.7 Finishing the proof We choose any solution to Ki and extend the global solution sol to V i according to it. There exists a solution on V ≤i, because every constraint between two variables from this set is either in V <i or defines a two-variable n-tree which was used to define a constraint in Ki. It remains to prove that, with such an extension, condition (Ei) holds. Let t be an n-tree pattern in I. If it has no variables mapped to V i, then (Ei) follows from (Ei−1). Assume that it has such variables. By splitting t at internal vertices mapped to V i, it is enough to consider the case when only leaves of t are mapped to V i. Then t defines a constraint (x, R) in Ki. The solution to Ki mapping x to a ∈ R and the evaluation of t witnessing that a belongs to R can be taken to satisfy (Ei) for t. Theorem 3 is proved. 8 Full proof of Theorem 2(1) In this subsection we prove Propositions 1 and 2. The following equalities, which can be directly verified, are used repeatedly in this section: for any subsets A, B of D and any feasible solution {xa} of the SDP relaxation of I it holds that kxAk2 = xAyD and kyB − xAk2 = xD\AyB + xAyD\B. 8.1 Analysis of Preprocessing step 2 In some of the proofs it will be required that α ≤ c0 for some constant c0 de- pending only on D. This can be assumed without loss of generality, since we can adjust constants in O-notation in Theorem 2(1) to ensure that ε ≤ c0 (and we know that α ≤ ε). We will specify the requirements on the choice of c0 as we go along. Lemma 2. There exists a constant c > 0 that depends only on D such that the sets Dℓ x ⊆ D, x ∈ V , 1 ≤ ℓ ≤ D, obtained in Preprocessing step 2, are non-empty and satisfy the following conditions: 1. for every a ∈ Dℓ 2. for every a 6∈ Dℓ 3. for every a ∈ Dℓ 4. Dℓ x ⊆ Dℓ+1 x (with DD+1 x = D). x, kxak ≥ α3ℓκ, x, kxak ≤ cα3ℓκ, x, kxak2 ≥ 2kxD\Dℓ xk2, Proof. Let c = (2D)(D/2). It is straightforward to verify that conditions (1) -- (3) are satisfied. Let us show condition (4). Since c only depends on D we can 25 x ⊆ Dℓ+1 x choose c0 (an upper bound on α) so that cα3κ < 1. It follows that cα3(ℓ+1)κ < α3ℓκ. It follows from conditions (1) and (2) that Dℓ . Finally, let us show that Dℓ x is non-empty. By condition (4) we only need to take care of case ℓ = 1. We have by condition (2) that Xa∈D\D1 x kxak2 ≤ Dc2α6κ Note that we can adjust c0 to also satisfy Dc2α6κ < 1 because, again, c only depends on D. 8.2 Proof of Proposition 1 We will prove that the total weight of constraints removed in each step 0-5 of the algorithm in Section 5.3.2 is O(ακ). Lemma 3. The total weight of the constraints removed in step 0 is at most ακ. Proof. We have α ≥ XC∈C wC loss(C) ≥ XC∈C loss(C)≥α1−κ wC α1−κ, from which the lemma follows. Lemma 4. Let ((x, y), R) be a constraint not removed in step 0, and let A, B be such that B = A +ℓ (x, R, y). Then kyBk2 ≥ kxAk2− cα(6ℓ+6)κ for some constant c > 0 depending only on D. The same is also true for a constraint ((y, x), R) and A = B +ℓ (y, R−1, x). Proof. Consider the first case, i.e., a constraint ((x, y), R) and B = A+ℓ (x, R, y). We have xAyD\B = Xa∈A,b∈D\B (a,b)6∈R xayb + Xa∈A,b∈D\B (a,b)∈R xayb. The first term is bounded from above by the loss of constraint ((x, y), R), and hence is at most α1−κ, since the constraint has not been removed in step 0. Since B = A +ℓ (x, R, y) it follows that for every (a, b) ∈ R such that a ∈ A and b ∈ D \ B we have that a 6∈ Dℓ+1 . Hence, the second term is at most or b 6∈ Dℓ+1 x y xD\Dℓ+1 x yD + xDyD\Dℓ+1 y = kxD\Dℓ+1 x k2 + kyD\Dℓ+1 y k2 26 which, by Lemma 2(2), is bounded from above by dα(6ℓ+6)κ for some constant d > 0. From the definition of κ it follows that (6ℓ + 6)κ ≤ 1 − κ, and hence we conclude that xAyD\B ≤ (d + 1)α(6ℓ+6)κ. Then, we have that kyBk2 = xAyB + xD\AyB ≥ xAyB = xAyD − xAyD\B ≥ kxAk2 − (d + 1)α(6ℓ+6)κ. Lemma 5. The expected weight of the constraints removed in step 1 is O(ακ). Let A, B be such that B = A +ℓ (x, R, y). Proof. Let ((x, y), R) be a constraint not removed in step 0. We shall see that the probability that it is removed in step 1 is at most cακ where c > 0 is a constant. It follows from Lemma 4 that kyBk2 ≥ kxAk2 − dα(6ℓ+6)κ for some constant d > 0. Hence, the probability that a value rℓ in step 1 makes that yB 6(cid:22)ℓ xA is at most = dα2κ ≤ dακ. dα(6ℓ+6)κ α(6ℓ+4)κ We obtain the same bound if we switch x and y, and consider sets A, B such that A = B +ℓ R−1. Taking the union bound for all sets A, B and all values of ℓ we obtain the desired bound. Lemma 6. If there exists a constant c > 0 depending only on D such that for every variable x, the probability that all constraints involving x are removed in step 2, step 3, or step 5 is at most cακ, then the total expected weight of constraints removed this way in the corresponding is at most 2cακ. Proof. Let wx denote the total weight of the constraints in which x participates. The expected weight of constraints removed is at most Xx∈V wxcακ = (Xx∈V wx)cακ = 2cακ and the lemma is proved. Lemma 7. The expected weight of the constraints removed in step 2 is O(ακ). Proof. Let x be a variable. According to Lemma 6 it is enough to prove that the probability that we remove all constraints involving x in step 2 is at most cακ for some constant c > 0. Suppose that A ⊆ B are such that kxBk2 − kxAk2 = kxB − xAk2 ≤ (2n − 3)α(6ℓ+4)κ. Then the probability that one of the bounds of the form rℓ + (sℓ + jm0)α(6ℓ+4)κ separates kxBk2 and kxAk2 is at most (2n − 3)/m0 ≤ (2n − 3)/(α−2κ − 1) which is at most cακ for some constant c > 0 whenever ακ < 1/2. The latter can be ensured by adjusting constant c0 from Section 8.1. Taking the union bound for all sets A, B and all values of ℓ we obtain the desired bound. 27 Lemma 8. There exist constants c, d > 0 depending only on D such that for every pair of variables x and y and every A, B ⊆ D, the probability, p, that a unit vector u chosen uniformly at random cuts xA and yB satisfies c · kyB − xAk ≤ p ≤ d · kyB − xAk. Proof. Let 0 ≤ x ≤ 1 and let 0 ≤ θ ≤ π be an angle such that x = cos(θ). There exist constants a, b > 0 such that a · √1 − x ≤ θ ≤ b · √1 − x. Now, if θ is the angle between xA − xD\A and yB − yD\B then 1 − cos(θ) = 1 − (xA − xD\A)(yB − yD\B) = 2(xD\AyB + xAyD\B) = 2kyB − xAk2 Since p = θ/π, the result follows. Lemma 9. The expected weight of the constraints removed in step 3 is O(ακ). Proof. According to Lemma 6, it is enough to prove that the probability that we remove all constraints involving x in step 3 is at most cακ for some constant c. Let A and B be such that A∩Dℓ x. Let a be an element in symmetric dif- ference (A∩ Dℓ x). Then we have kxB − xAk =pxD\AxB + xAxD\B ≥ kxak ≥ α3ℓκ, where the last inequality is by Lemma 2(1). Then by Lemma 8 the probability that xA and xB are not ℓ-cut is at most x)△(B ∩ Dℓ x 6= B∩Dℓ (1 − cα3ℓκ)mℓ ≤ 1 exp(cα3ℓκmℓ) ≤ 1 exp(cα−κ) ≤ cακ. where c is the constant given in Lemma 8. Taking the union bound for all sets A, B and all values of ℓ we obtain the desired bound. Lemma 10. The expected weight of the constraints removed in step 4 is O(ακ). Proof. Let ((x, y), R) be a constraint not removed in steps 0 and 1. We shall prove that the probability that it is removed in step 4 is at most cακ for some constant c > 0. Fix ℓ and A, B such that B = A+ℓ (x, R, y). Since the constraint has not been removed in step 1, we have yB (cid:22)ℓ xA. Since B = A +ℓ p we have that xAyD\B ≤ c1α(6ℓ+6)κ, as shown in the proof of Lemma 4. Since kxAk2 = xA(yB + yD\B), it follows that xAyB ≥ kxAk2 − c1α(6ℓ+6)κ. Also, we have kyBk2 = (xAyB + xD\AyB) is at most kxAk2 +α(6ℓ+4)κ because yB (cid:22)ℓ xA. Using the bound on xAyB obtained above, it follows that xD\AyB is at most α(6ℓ+4)κ + c1α(6ℓ+6)κ ≤ (c1 + 1)α(6ℓ+4)κ. 28 Putting the bounds together, we have that kyB − xAk =pxD\AyB + xAyD\B ≤ for some constant c2 > 0. qc1α(6ℓ+6)κ + (c1 + 1)α(6ℓ+4)κ ≤ c2α(3ℓ+2)κ Applying the union bound and Lemma 8 we have that the probability that xA and yB are ℓ-cut is at most mℓdc2α(3ℓ+2)κ = O(ακ). We obtain the same bound if we switch x and y, and take R−1 instead of R. Taking the union bound for all sets A, B and all values of ℓ we obtain the desired bound. Lemma 11. The expected weight of the constraints removed in step 5 is O(ακ). Proof. Again, according to Lemma 6, it is enough to prove that the probability that we remove all constraints involving x in step 5 is at most c1ακ for some constant c1. Suppose that A, B are such that kxA − xBk2 ≤ (2n − 3)α(6ℓ+4)κ. Hence, by Lemma 8 and the union bound the probability that xA and xB are ℓ-cut is at most mℓd(2n − 3)1/2α(3ℓ+2)κ ≤ d(2n − 3)1/2ακ where d is the constant from Lemma 8. Taking the union bound for all sets A, B and all values of ℓ, we obtain the desired bound. 8.3 Proof of Proposition 2 All patterns appearing in this subsection are in I ′. The following notion will be used several times in our proofs: Let t be a tree and let y be one of its nodes. We say that a subtree t′ of t is separated by vertex y if t′ is maximal among all the subtrees of t that contain y as a leaf. In the first part of the proof (which consists of the following three lemmas), we prove that if we start with a set A ⊆ Dx and propagate it via a path p, from x to y, of n-tree patterns to obtain a set B ⊆ Dy, the value kyBk cannot be much smaller than kxAk. The first lemma proves that this is the case if we restrict to proprer path patterns. Lemma 12. Let 1 ≤ ℓ ≤ D, let p be a path pattern from x to y, and let A, B be such that B = A+ℓp. Then xA (cid:22)ℓ yB, and in particular, kxAk ≤ kyBk+α(6ℓ+4)κ. Proof. Since the relation (cid:22)ℓ is transitive, it is enough to prove the lemma for path patterns containing only one constraint. But this is true, since all the constraints ((x, y), R) or ((y, x), R) which would invalidate the lemma have been removed in step 1. 29 The second lemma proves that the weight of sets that vanish after following a tree pattern is small. x is such that A +ℓ p = ∅ then kxAk2 ≤ (2j − 1)α(6ℓ+4)κ. Lemma 13. If p is a tree pattern with at most j + 1 leaves starting at x, and A ⊆ Dℓ+1 Proof. We will prove the statement by induction on the number of leaves. For j = 1 this follows from Lemma 12. Suppose then that p is a tree pattern with j + 1 > 2 leaves and the statement is true for any tree pattern with at most j leaves. Choose y to be the first branching vertex in the unique path in p from x to the end of p, and let p0, t1, . . . , th be all subtrees of p separated by y where p0 is the subtree containing x. We turn p0 into a pattern by choosing x as beginning and y as end. Similarly, we turn every ti into a pattern by choosing y as beginning and any other arbitrary leaf as end. Since y is a branching vertex, i=1 ji = j. Now, : {a} +ℓ ti = ∅}. Since ji < j, we know that i=1 Bi, we have, using inductive we have that h ≥ 2, every ti has ji + 1 < j + 1 leaves, and Ph let Bi denote the set {a ∈ Dℓ+1 kyBik2 ≤ (2ji − 1)α(6ℓ+4)κ. Further, for B = Sh kyBk2 ≤ (2ji − 1)α(6ℓ+4)κ assumption, that = (2j − h)α(6ℓ+4)κ ≤ (2j − 2)α(6ℓ+4)κ. Finally, since A+ℓ p = ∅ then A+ℓ p0 ⊆ B, and the claim follows from Lemma 12. y h Xi=1 kyBik2 ≤ h Xi=1 The following lemma concludes the first part of the proof by proving that following a path of n-trees pattern cannot decrease the weight of a set too much. w yB. Since the relation (cid:22)ℓ Lemma 14. Let 1 ≤ ℓ ≤ D, let p be a pattern from x to y which is a path of n-trees. If A, B ⊆ D are such that A +ℓ p = B, then kxAk2 ≤ kyBk2 + α(6ℓ+2)κ. Proof. We claim that for any n-tree pattern t and A, B with A +ℓ t = B, we have xA (cid:22)ℓ w is transitive, the lemma is then a direct consequence. For a contradiction, suppose that t is a smallest (by inclusion) n-tree that does not satisfy the claim. Observe that t is not a path, due to Lemma 12 and the fact that xA (cid:22)ℓ yB implies xA (cid:22)ℓ w yB. Let vx and vy denote the beginning and the end vertex of t, respectively; and let vz be the last branching vertex that appears on the path connecting vx and vy, and let it be labeled by z. Let t1, t2, p1, . . . , pj be all subtrees of t separated by vz, where t1 and t2 are the subtrees containing vx and vy respectively. Let us turn p1, . . . , pj into patterns by choosing vz as beginning and any other leaf as end. Note that the sum of numbers of the leaves of p1, . . . , pj when excluding vz is less than n− 1 since t 30 was a path of n-trees. Furthermore, choose x and z to be the beginning and end, respectively, of t1 and z and y to be the beginning and end, respectively, of t2. Note that t2 is a path. Further, we know that for C = A +ℓ t1 we have xA (cid:22)ℓ w zC : {a} +ℓ pi = ∅}. Then by Lemma by minimality of t. Now, let Ci = {a ∈ Dℓ+1 13, we get that kzCik2 ≤ (2ji − 1)α(6ℓ+4)κ where ji + 1 is the number of leaves of pi, therefore for C ′ =S Ci we have kzC ′k2 ≤PkzCik2 ≤ (2n − 3)α(6ℓ+4)κ (we used that P ji ≤ n − 1). This implies that kzC\C ′k2 ≥ kzCk2 − (2n − 3)α(6ℓ+4)κ, and consequently zC (cid:22)ℓ w zC\C ′ as otherwise all constraints containing z would have been removed in step 2. Finally, observe that B = (C \ C ′) +ℓ t2, and therefore zC\C ′ (cid:22)ℓ yB and, hence, zC\C ′ (cid:22)ℓ w yB. Putting this together with all other derived (cid:22)ℓ w-relations, we get the required claim. z Next, we move to proving the condition (IPQ)n. For that we will need the following technical statement. Intuitively, the statment says that, starting with a set A, if we follow a circular path of n-tree patterns and end up back in the set A, then all values from A can be reached by this pattern. x = B ∩ Dℓ x. Lemma 15. Let 1 ≤ ℓ ≤ D, let p be a pattern from x to x which is a path of n-trees, and let A, B be such that A +ℓ p = B. If B ∩ Dℓ x then A ∩ Dℓ Proof. For a contradiction, suppose that there is an element a ∈ (Dℓ B. From Lemma 2 we get that kxA\Bk2 ≥ kxak2 ≥ 2kxD\Dℓ Therefore, we have x ∩ A) \ xk2 ≥ 2kxB\Ak2. x ⊆ A ∩ Dℓ kxBk2 = kxAk2 − kxA\Bk2 + kxB\Ak2 ≤ kxAk2 − kxak2 + (1/2)kxak2 = kxAk2 − (1/2)kxak2 ≤ kxAk2 − (1/2)α6ℓκ. On the other hand, since p is a path of n-trees, we get from the previous lemma that kxBk2 ≥ kxAk2 − α(6ℓ+2)κ. If we adjust constant c0 from Section 8.1 so that 1/2 > α2κ, the above inequalities give a contradiction. The final lemma of this section proves a slight generalization of the condition (IPQ)n. Lemma 16. Let x be a variable, let p and q be two patterns from x to x which are paths of n-trees, let 1 ≤ ℓ ≤ D, and let A ⊆ Dℓ x. Then there exists some j such that A ⊆ A +ℓ (j(p + q) + p). Proof. For every A, define A0, A1, . . . in the following way. If i = 2j is even then Ai = A +ℓ (j(p + q)). Otherwise, if i = 2j + 1 is odd then Ai = A +ℓ (j(p + q) + p). x = Au+1 ∩ Dℓ x. From the finiteness of D, we get that for every sufficiently large u there is u′ > u We claim that for every sufficiently large u, we have Au ∩ Dℓ 31 such that Au = Au′. It follows that there exists some path of n-trees pattern p′ starting and ending in x such that Au = Au+1 +ℓ p′. To prove the claim we will show that xAu and xAu+1 are not ℓ-cut. Then the claim follows as otherwise we would have removed all constraints involving x in step 3. Consider the path x1, . . . , xk in p′ which connects the beginning and end ver- tices. Further, let Ri = R if the i-th edge of the path is labeled by ((xi, xi+1), R), and let Ri = R−1 if the i-th edge is labeled by ((xi+1, xi), R). Now define 2, B2, . . . , Bm inductively by setting B1 = Au+1, B′ i+1 = Bi +ℓ a sequence B1, B′ (xi, Ri, xi+1). Further, if xi+1 is not a branching vertex, put Bi+1 = B′ i+1. If xi+1 is a branching vertex, then let Φi be the set of all subtrees separated by xi+1 in p′, excluding the two such subtrees containing the beginning and the end of p′. Then, turn each subtree in Φi into a pattern by choosing xi+1 as beginning and any other leaf as end, and define Bi+1 = {b ∈ B′ i+1 : {b} +ℓ t 6= ∅ for all t ∈ Φi}. As in Lemma 14, we know that the sum of the numbers of leaves of the trees from Φi that are also leaves of p′ is less than n − 1. Finally, if xAu are xAu+1 are ℓ-cut are ℓ-cut, or vectors xiBi and xiB ′ then, for some i, vectors xiBi and xi+1B ′ are ℓ-cut. The former case is impossible since B′ i+1 = Bi +ℓ (xi, Ri, xi+1), and hence if xB ′ and xBi are ℓ-cut, then either of the constraints ((xi, xi+1), Ri) or ((xi+1, xi), R−1) would have been removed in step 4. We now show that the latter case is impossible either. Clearly, in this case xi is a branching vertex. For t ∈ Φi, let Ct = {b ∈ B′ i : {b} +ℓ t = ∅} and let jt be the number of leaves of t. By Lemma 13 we get kxiCtk2 ≤ (2jt − 1)α(6ℓ+4)κ for any t ∈ Φi, and consequently, i+1 i+1 i kxiB ′ i − xiBik2 ≤ Xt∈Φi kxiCtk2 ≤ Xt∈Φi (2jt − 1)α(6ℓ+4)κ ≤ (2n − 3)α(6ℓ+4)κ. i x for all sufficiently large u. were ℓ-cut, then all constraints that include xi would x = Therefore, if xiBi and xiB ′ have been removed in step 5. We conclude that indeed we have Au ∩ Dℓ Au+1 ∩ Dℓ Au∪A2u+1. And also (Au∪A2u+1)∩Dℓ Lemma 15 we get that (A∪Au+1)∩Dℓ of the lemma, we have A ⊆ Au+1 ∩ Dℓ Now, take u = 2j +1 large enough. We have that (A∪Au+1)+ℓ (j(p+q)+p) = x, hence by x by assumption x = Au+1∩Dℓ x = Au+1∩Dℓ x ⊆ Au = A +ℓ (j(p + q) + p). x ⊆ (A∪Au+1)∩Dℓ x. Since A ⊆ Dℓ Finally, setting A = {a} in Lemma 16 gives Proposition 2. 9 Full proof of Theorem 2(2) In this section, we prove Theorem 2(2). A brief outline of the proof is given in Section 6. Throughout this section, I = (V,C) is a (1 − ε)-satisfiable instance of CSP(Γ) where Γ consists of implicational constraints. 32 9.1 SDP Relaxation We use SDP relaxation (4.1) -- (4.5) from Section 4. For convenience, we write the SDP objective function as follows. (9.1) C∈C equals (x=a)∨(y=b) X wC(v0 − xa)(v0 − yb) XC∈C equals x=π(y) Xa∈D + 1 2 wCkxπ(a) − yak2 wC  Xa∈D\P This expression equals (4.1) because of SDP constraint (4.4). kxak2  . As discussed before (Lemma 1) we can assume that ε ≥ 1/m2 where m is the number of constraints. We solve SDP with error δ = 1/m2 obtaining a solution, denoted SDP, with objective value O(ε). Note that every feasible SDP solution satisfies the following conditions. + XC∈C equals x∈P (9.2) (9.3) (9.4) (9.5) xa · xb = xav0, xb(cid:1) = xa · v0 −Xb6=a yb′) = kxak2 −Xb′6=b kxak2 = xa ·(cid:0)v0 −Xb6=a xayb = xa · (v0 −Xb′6=b kxak2 − kybk2 = kxa − ybk2 + 2(xayb − kybk2) ≤ kxa − ybk2, (v0 − xa)(v0 − yb) = Xa′6=a xayb′ ≤ kxak2, xa′Xb′6=b yb′ ≥ 0. 9.2 Variable Partitioning Step In this section, we describe the first step of our algorithm. In this step, we assign values to some variables, partition all variables into three groups V0, V1 and V2, and then split the instance into two sub-instances I1 and I2. Vertex Partitioning Procedure. Choose a number r ∈ (0, 1/6) uniformly at random. Do the following for every variable x. 1. Let Dx = {a : 1/2 − r < xav0}. 2. Depending on the size of Dx do the following: (a) If Dx = 1, add x to V0 and assign x = a, where a is the single element of Dx. 33 (b) If Dx > 1, add x to V1 and restrict x to Dx (see below for details). (c) If Dx = ∅, add x to V2. Note that each variable in V0 is assigned a value; each variable x in V1 is restricted to a set Dx; each variable in V2 is not restricted. Lemma 17. (i) If xav0 > 1 2 + r then x ∈ V0. (ii) For every x ∈ V1, Dx = 2. Proof. (i) Note that for every b 6= a, we have xav0 + xbv0 ≤ 1 and, therefore, xbv0 < 1/2 − r. Hence, b /∈ Dx. We conclude that Dx = {a} and x ∈ V0. (ii) Now consider x ∈ V1. We have, Dx < 3(1/2 − r)Dx = 3 Xa∈Dx (1/2 − r) ≤ 3 Xa∈Dx Therefore, Dx ≤ 2. Since x ∈ V1, Dx > 1. Hence Dx = 2. xav0 ≤ 3. We say that an assignment is admissible if it assigns a value in Dx to every x ∈ V1 and it is consistent with the partial assignment to variables in V0. From now on we restrict our attention only to admissible assignments. We remove those constraints that are satisfied by every admissible assignment (our algorithm will satisfy all of them). Specifically, we remove the following constraints: 1. UG constraints x = π(y) with x, y ∈ V0 that are satisfied by the partial assignment; 2. disjunction constraints (x = a) ∨ (y = b) such that either x ∈ V0 and x is assigned value a, or y ∈ V0 and y is assigned value b; 3. unary constraints x ∈ P such that either x ∈ V0 and the value assigned to x is in P , or x ∈ V1 and Dx ⊆ P . We denote the set of satisfied constraints by Cs. Let C′ = C \ Cs be the set of remaining constraints. We now define a set of violated constraints -- those constraints that we conservatively assume will not be satisfied by our algorithm (even though some of them might be satisfied by the algorithm). We say that a constraint C ∈ C′ is violated if at least one of the following conditions holds: 1. C is a unary constraint on a variable x ∈ V0 ∪ V1. 2. C is a disjunction constraint (x = a) ∨ (y = b) and either x /∈ V1, or y /∈ V1 (or both). 3. C is a disjunction constraint (x = a) ∨ (y = b), and x, y ∈ V1, and either a /∈ Dx, or b /∈ Dy (or both). 34 4. C is a UG constraint x = π(y), and at least one of the variables x, y is in V0. 5. C is a UG constraint x = π(y), and one of the variables x, y is in V1 and the other is in V2. 6. C is a UG constraint x = π(y), x, y ∈ V1 but Dx 6= π(Dy). We denote the set of violated constraints by Cv and let C′′ = C′ \ Cv. Lemma 18. E[w(Cv)] = O(ε). Proof. We analyze separately constraints of each type in Cv. Unary constraints A unary constraint x ∈ P in C is violated if and only if x ∈ V0 ∪ V1 and Dx 6⊆ P (if Dx ⊆ P then C ∈ Cs and thus C is not violated). Thus the SDP contribution of each violated constraint C of the form x ∈ P is at least wC Xa∈D\P The last two inequalities hold because the set Dx\P is nonempty; xav0 ≥ 1/2−r for all a ∈ Dx by the construction; and r ≤ 1/6. Therefore, the expected total weight of violated unary constraints is at most 3 SDP = O(ε). kxak2 = wC Xa∈Dx\P kxak2 ≥ wC Xa∈Dx\P xa · v0 ≥ wC(cid:16) 1 2 − r(cid:17) ≥ wC 3 . Disjunction constraints Consider a disjunction constraint (x = a) ∨ (y = b). Denote it by C. Assume without loss of generality that xav0 ≥ ybv0. Consider several cases. If xav0 > 1/2 + r then x ∈ V0 and x is assigned value a. Thus, C is satisfied. If xav0 ≤ 1/2 + r and ybv0 > 1/2 − r then we also have xav0 > 1/2 − r and hence x, y ∈ V0 ∪ V1 and a ∈ Dx, b ∈ Dy. Thus, C is not violated (if at least one of the variables x and y is in V0, then C ∈ Cs; otherwise, C ∈ C′). Therefore, C is violated only if xav0 ≤ 1/2 + r and ybv0 ≤ 1/2 − r, or equivalently, (9.6) xav0 − 1/2 ≤ r ≤ 1/2 − ybv0. 35 Since we choose r uniformly at random in (0, 1/6), the probability density of the random variable r is 6 on (0, 1/6). Thus the probability of event (9.6) is at most 6 max(cid:16)(cid:0)(1/2 − ybv0(cid:1) −(cid:0)xav0 − 1/2)(cid:1), 0(cid:17) = 6 max(cid:16)(v0 − xa)(v0 − yb) − xayb, 0(cid:17) by (4.2) and (9.5) ≤ 6(v0 − xa)(v0 − yb). The expected weight of violated constraints is at most, XC∈C equals (x=a)∨(y=b) 6wC (v0 − xa)(v0 − yb) ≤ 6 SDP = O(ε). UG constraints Consider a UG constraint x = π(y). Assume that it is violated. Then Dx 6= π(Dy) (note that if x and y do not lie in the same set Vt then Dx 6= Dy and necessarily Dx 6= π(Dy)). Thus, at least one of the sets π(Dy)\ Dx or Dx\ π(Dy) is not empty. If π(Dy) \ Dx 6= ∅, there exists c ∈ π(Dy) \ Dx. We have, Pr (c ∈ π(Dy) \ Dx) ≤ Pr(cid:0)kyπ−1(c)k2 > 1/2 − r and kxck2 ≤ 1/2 − r(cid:1) = Pr(cid:0)1/2 − kyπ−1(c)k2 < r ≤ 1/2 − kxck2(cid:1) ≤ 6 max(kyπ−1(c)k2 − kxck2, 0) by (9.4) ≤ 6kyπ−1(c) − xck2. By the union bound, the probability that there is c ∈ π(Dy) \ Dx is at most 6Xc∈D kyπ−1(c) − xck2 = 6Xb∈D kyb − xπ(b)k2. Similarly, the probability that there is b ∈ Dx \ π(Dy) is at most 6Pb∈D kyb − xπ(b)k2. Therefore, the probability that the constraint x = π(y) is violated is upper bounded by 12Pb∈D kyb − xπ(b)k2. Consequently, the total expected weight of all violated UG constraints is at most wC 12 Xb∈D XC∈C equals x=π(y) = 24 × XC∈C equals x=π(y)   ≤ 24 SDP = O(ε), kxπ(b) − ybk2 kxπ(b) − ybk2! here we bound the value of the SDP by the second term of the objective func- tion (9.1). wC Xb∈D 1 2 36 We restrict our attention to the set C′′. There are four types of constraints in C′′. 1. disjunction constraints (x = a)∨(y = b) with x, y ∈ V1 and a ∈ Dx, b ∈ Dy; 2. UG constraints x = π(y) with x, y ∈ V1 and Dx = π(Dy); 3. UG constraints x = π(y) with x, y ∈ V2; 4. unary constraints x ∈ P with x ∈ V2. Denote the set of type 1 and 2 constraints by C1, and type 3 and 4 constraints by C2. Let I1 be the sub-instance of I on variables V1 with constraints C1 in which every variable x is restricted to Dx, and I2 be the sub-instance of I on variables V2 with constraints C2. In Sections 9.3 and 9.4, we show how to solve I1 and I2, respectively. The total weight of constraints violated by our solution for I1 will be at most O(√ε); The total weight of constraints violated by our solution for I2 will be at most O(pε log D). Thus the combined solution will satisfy a subset of the constraints of weight at least 1 − O(pε log D). 9.3 Solving Instance I1 In this section, we present an algorithm that solves instance I1. The algorithm assigns values to variables in V1 so that the total weight of violated constraints is at most O(√ε). Lemma 19. There is a randomized algorithm that, given instance I1 and the SDP solution {xa} for I, finds a set of UG constraints Cbad ⊆ C1 and values αx, βx ∈ Dx for every x ∈ V1 such that the following conditions hold. • Dx = {αx, βx}. • for each UG constraint x = π(y) in C1 \ Cbad, we have αx = π(αy) and • The expected weight of Cbad is O(√ε). βx = π(βy). Proof. We use the algorithm of Goemans and Williamson for Min Uncut [26] to find values αx, βx. Recall that in the Min Uncut problem (also known as Min 2CNF≡ deletion) we are given a set of Boolean variables and a set of constraints of the form (x = a) ↔ (y = b). Our goal is to find an assignment that minimizes the weight of unsatisfied constraints. Consider the set of UG constraints in C1. Since Dx = 2 for every variable x ∈ V1, each constraint x = π(y) is equivalent to the Min Uncut constraint (x = π(a)) ↔ (y = a) where a is an element of Dy (it does not matter which of 37 the two elements of Dy we choose). We define an SDP solution for the Goemans -- Williamson relaxation of Min Uncut as follows. Consider x ∈ V1. Denote the elements of Dx by a and b (in any order). Let x∗ a = xa − xb kxa − xbk and x∗ b = −x∗ a = xb − xa kxa − xbk . a and x∗ Note that the vectors xa and xb are nonzero orthogonal vectors, and, thus, kxa− xbk is nonzero. The vectors x∗ b are unit vectors. Now we apply the random hyperplane rounding scheme of Goemans and Williamson: We choose a random hyperplane and let H be one of the half-spaces the hyperplane divides the space into. Note that for every x exactly one of the two antipodal vectors in {x∗ αx ∈ H and x∗ /∈ H. Let Cbad be the set of UG constraints such that αx 6= π(αy), or βx equivalently x∗ a : a ∈ Dx} lies in H (almost surely). Define αx and βx so that x∗ Values αx and βx satisfy the first condition. If a UG constraint x = π(y) is in C1 \ Cbad, then αx = π(αy); also since Dx = π(Dy), βx = π(βy). So the second condition holds. Finally, we verify the last condition. Consider a constraint x = π(y). Let A = xπ(αy ) − xπ(βy) and B = yαy − yβy . Since x ∈ V1, we have kxπ(αy )k2 > 1/2 − r > 1/3 and kxπ(βy)k2 > 1/3. Hence kAk2 = kxπ(αy )k2 + kxπ(βy )k2 > 2/3. Similarly, kBk2 > 2/3. Assume first that kAk ≥ kB. Then, π(αy) /∈ H. 2 B 2 = A kx∗ = 2 − kAk − π(αy ) − y∗ 2AB kAkkBk kBk(cid:13)(cid:13)(cid:13)(cid:13) αyk2 =(cid:13)(cid:13)(cid:13)(cid:13) We have 2(cid:16)kBk2 − kBk kA − Bk2 − 2(cid:16)kBk2 − kBk AB(cid:17) =(cid:16)kAk − kBk(cid:17)(cid:16)kAk + kBk − kAk because kAk ≥ AB/kAk and kBk ≥ AB/kAk. We conclude that kAk AB(cid:17) ≤ kA − Bk2, since kBk2 ×(cid:18)kBk2 − kBk kAk AB(cid:19) . 2AB kAk(cid:17) ≥ 0, kx∗ π(αy ) − y∗ αyk2 ≤ kA − Bk2 kBk2 ≤ 3 2 k(xπ(αy ) − yαy ) − (xπ(βy) − yβy )k2 3 2kA − Bk2 = ≤ 3kxπ(αy ) − yαyk2 + 3kxπ(βy ) − yβyk2. 38 If kAk ≤ kBk, we get the same bound on kx∗ in the formulas above. Therefore, π(αy ) − y∗ αyk2 by swapping A and B wCkx∗ π(αy ) − y∗ αyk2 ≤ 3 SDP = O(ε). XC∈C1 is of the form x=π(y) The analysis by Goemans and Williamson shows that the expected total weight of the constraints of the form x = π(y) such that x∗ π(αy ) /∈ H and y∗ αy ∈ H is at most O(√ε), see Section 3 in [26] for the original analysis or Section 2 in survey [47] for presentation more closely aligned with our notation. Therefore, the expected total weight of Cbad is O(√ε). We remove all constraints Cbad from I1 and obtain an instance I ′ 1 (with the domain for each variable x now restricted to Dx). We construct an SDP solution {xa} for I ′ 1. We let xαx = xαx and xβx = v0 − xαx . We define Sxαx = {αx} and Sxβx = D \ Sxαx. Since xβx = v0 − xαx = xSxβx , we have, (9.7) xa = xSxa for every a ∈ Dx. and xa = v0 1. Its cost is O(ε). Note that a ∈ Sxa for every a ∈ Dx. Lemma 20. The solution {xa} is a feasible solution for SDP relaxation (4.1) -- (4.5) for I ′ Proof. We verify that the SDP solution is feasible. First, we havePa∈Dx Then for a ∈ Dx and b ∈ Dy, we have xayb =Pa′∈Sxa,b′∈Syb each constraint (x = a) ∨ (y = b) to the SDP for I ′ to the SDP for I. That is, (9.8) First, we consider disjunction constraints. We prove that the contribution of 1 is at most its contribution xαx xβx = xαx · (v0 − xαx) = xαx v0 − kxαxk2 = 0. xa′ yb′ ≥ 0. We now show that the SDP cost is O(ε). (v0 − xa)(v0 − yb) ≤ (v0 − xa)(v0 − yb). 39 Observe that (v0− xa) = xD\Sxa, (v0− yb) = yD\Syb, (v0− xa) = xD\{a}, and (v0 − yb) = yD\{b}. Then, D \ Sxa ⊆ D \ {a} and D \ Syb ⊆ D \ {b}. Therefore, by (4.2), (v0 − xa)(v0 − yb) = (a′,b′)∈(D\Sxa)×(D\Syb) X xa′ yb′ ≤ ≤ (a′,b′)∈(D\{a})×(D\{b}) X xa′ yb′ = (v0 − xa)(v0 − yb). Now we consider UG constraints. The contribution of a UG constraint x = 1 equals the weight of the constraint times the π(y) in C1 \ Cbad to the SDP for I ′ following expression. kxπ(αy ) − yαyk2 + kxπ(βy) − yβyk2 = kxαx − yαyk2 + kxβx − yβyk2 = kxαx − yαyk2 + k(v0 − xαx) − (v0 − yαy )k2 = 2kxαx − yαyk2 = 2kxπ(αy ) − yαyk2. Thus, by the choice of αx and αy (Lemma 19) the contribution is at most twice the contribution of the constraint to the SDP for I. We conclude that the SDP contribution of all the constraints in C1 \ Cbad is at most 2 SDP = O(ε). Finally, we note that I ′ 1 is a Boolean 2-CSP instance. We round solution {xa} using the rounding procedure by Charikar et al. for Boolean 2-CSP [17] (when D = 2, the SDP relaxation used in [17] is equivalent to SDP (4.1) -- (4.5)). We get an assignment of variables in V1. The weight of constraints in C1 \ Cbad violated by this assignment is at most O(√ε). Since w(Cbad) = O(√ε), the weight of constraints in C1 violated by the assignment is at most O(√ε). 9.4 Solving Instance I2 Instance I2 is a unique games instance with additional unary constraints. We restrict the SDP solution for I to variables x ∈ V2 and get a solution for the unique game instance I2. Note that since we do not restrict the domain of variables x ∈ V2 to Dx, the SDP solution we obtain is feasible. The SDP cost of this solution is at most SDP. We round this SDP solution using a variant of the algorithm by Charikar et al. [16] that is presented in Section 3 of the survey [47]; this variant of the algorithm does not need ℓ2 2-triangle-inequality SDP constraints. Given a (1 − ε)-satisfiable instance of Unique Games, the algorithm finds a solution with the weight of violated constraints at most O(pε log D). We remark that paper [16] considers only unique game instances. However, in [16], we can restrict the domain of any variable x to a set Sx by setting xa = 0 for a ∈ D \ Sx. Hence, we can model unary constraints as follows. For every unary 40 constraint x ∈ P , we introduce a dummy variable zx,P and restrict its domain to the set P . Then we replace each constraint x ∈ P with the equivalent constraint x = zx,P . The weight of the constraints violated by the obtained solution is at most O(pε log D). Finally, we combine results proved in Sections 9.2, 9.3, and 9.3 and obtain Theorem 2(2). 10 Conclusion We have proved that every CSP with an NU polymorphism admits a robust algorithm with polynomial loss. Thus a small gap remains in our understanding of such algorithms -- between the sufficient condition of having an NU polymorphism and a necessary condition SD(∨). We remark that closing this gap is likely to require a structural result, similar to our Theorem 3, which would resolve the conjecture of Larose and Tesson [44] and characterise CSPs solvable by linear propagation. Such a result would immediately imply a characterisation of CSPs in the complexity class NL [21, 44] (and hence also L [33]), modulo complexity- theoretic assumptions. References [1] P. Austrin and J. Hastad. On the usefulness of predicates. ACM Transac- tions on Computation Theory, 5(1):1, 2013. [2] K. Baker and A. Pixley. Polynomial interpolation and the chinese remainder theorem. Mathematische Zeitschrift, 143:165 -- 174, 1975. [3] L. Barto. Finitely related algebras in congruence distributive varieties have near unanimity terms. Canadian Journal of Mathematics, 65(1):3 -- 21, 2013. [4] L. Barto and M. Kozik. Constraint satisfaction problems solvable by local consistency methods. Journal of the ACM, 61(1):Article 3, 2014. [5] L. Barto and M. Kozik. Robust satisfiability of constraint satisfaction prob- lems. SIAM Journal on Computing, 45(4):1646 -- 1669, 2016. [6] L. Barto, M. Kozik, and R. Willard. Near unanimity constraints have bounded pathwidth duality. In LICS, pages 125 -- 134, 2012. [7] L. Barto, A. Krokhin, and R. Willard. Polymorphisms, and how to use them. In A. Krokhin and S. Zivn´y, Eds., The Constraint Satisfaction Problem: Complexity and Approximability. Dagstuhl Follow-Ups, volume 7. Schloss Dagstuhl -- Leibniz-Zentrum fur Informatik. Pages 1 -- 44, 2017. 41 [8] W. Bibel. Constraint satisfaction from a deductive viewpoint. Artificial Intelligence, 35:401 -- 413, 1988. [9] A. Bulatov. Bounded relational width, 2009. manuscript. [10] A. Bulatov. A dichotomy theorem for nonuniform CSPs. In FOCS, pages 319 -- 330, 2017. [11] A. Bulatov, P. Jeavons, and A. Krokhin. Classifying complexity of con- straints using finite algebras. SIAM Journal on Computing, 34(3):720 -- 742, 2005. [12] A. Bulatov, A. Krokhin, and B. Larose. Dualities for constraint satisfaction problems. In Complexity of Constraints, volume 5250 of LNCS, pages 93 -- 124. 2008. [13] C. Carvalho, V. Dalmau, and A. Krokhin. CSP duality and trees of bounded pathwidth. Theoretical Computer Science, 411(34-36):3188 -- 3208, 2010. [14] C. Carvalho, V. Dalmau, and A. Krokhin. Two new homomorphism dualities and lattice operations. Journal of Logic and Computation, 21(6):1065 -- 1092, 2011. [15] S. O. Chan. Approximation resistance from pairwise independent subgroups. Journal of the ACM, 63(4):34:1-34:22, 2016. [16] M. Charikar, K. Makarychev, and Y. Makarychev. Near-optimal algorithms for unique games. In STOC'06, pages 205 -- 214, 2006. [17] M. Charikar, K. Makarychev, and Y. Makarychev. Near-optimal algorithms for maximum constraint satisfaction problems. ACM Transactions on Algo- rithms, 5(3), 2009. [18] D. Cohen and P. Jeavons. The complexity of constraint languages. In F. Rossi, P. van Beek, and T. Walsh, editors, Handbook of Constraint Pro- gramming, chapter 8. Elsevier, 2006. [19] M. Cooper, D. Cohen, and P. Jeavons. Characterising tractable constraints. Artificial Intelligence, 65:347 -- 361, 1994. [20] N. Creignou, S. Khanna, and M. Sudan. Complexity Classifications of Boolean Constraint Satisfaction Problems, volume 7 of SIAM Monographs on Discrete Mathematics and Applications. 2001. [21] V. Dalmau. Linear Datalog and bounded path duality for relational struc- tures. Logical Methods in Computer Science, 1(1), 2005. (electronic). 42 [22] V. Dalmau and A. Krokhin. Majority constraints have bounded pathwidth duality. European Journal of Combinatorics, 29(4):821 -- 837, 2008. [23] V. Dalmau and A. Krokhin. Robust satisfiability for CSPs: Hardness and algorithmic results. ACM Transactions on Computation Theory, 5(4):Article 15, 2013. [24] V. Dalmau, A. Krokhin, and R. Manokaran. Towards a characterization of constant-factor approximable Min CSPs. In SODA'15, pages 847 -- 857, 2015. [25] T. Feder and M. Vardi. The computational structure of monotone monadic SNP and constraint satisfaction: A study through Datalog and group theory. SIAM Journal on Computing, 28:57 -- 104, 1998. [26] M. Goemans and D. Williamson. Improved approximation algorithms for maximum cut and satisfiability problems using semidefinite programming. Journal of the ACM, 42(6):1115 -- 1145, 1995. [27] V. Guruswami and Y. Zhou. Tight bounds on the approximability of Almost- satisfiable Horn SAT and Exact Hitting Set. Theory of Computing, 8:Article 11, 2012. [28] J. Hastad. Some optimal inapproximability results. Journal of the ACM, 48:798 -- 859, 2001. [29] J. Hastad. On the NP-hardness of Max-Not-2. SIAM Journal on Computing, 43(1):179 -- 193, 2014. [30] D. Hobby and R. McKenzie. The Structure of Finite Algebras, volume 76 of Contemporary Mathematics. American Mathematical Society, Providence, R.I., 1988. [31] P. Jeavons, D. Cohen, and M. Cooper. Constraints, consistency and closure. Artificial Intelligence, 101(1 -- 2):251 -- 265, 1998. [32] P. Jeavons, D. Cohen, and M. Gyssens. Closure properties of constraints. Journal of the ACM, 44:527 -- 548, 1997. [33] A. Kazda. n-permutability and linear Datalog implies symmetric Datalog. Logical Methods in Computer Science, 14 (2), 2018. [34] S. Khot. On the power of unique 2-prover 1-round games. In STOC'02, pages 767 -- 775, 2002. [35] S. Khot. On the unique games conjecture. In CCC'10, pages 99 -- 121, 2010. 43 [36] S. Khot, G. Kindler, E. Mossel, and R. O'Donnell. Optimal inapproxima- bility results for Max-Cut and other 2-variable CSPs? SIAM Journal on Computing, 37(1):319 -- 357, 2007. [37] S. Khot, M. Tulsiani, and P. Worah. A characterization of strong approxi- mation resistance. In STOC'14, pages 634 -- 643, 2014. [38] V. Kolmogorov, A. Krokhin, and M. Rol´ınek. The complexity of general- valued CSPs. SIAM Journal on Computing, 46(3): 1087 -- 1110, 2017. [39] V. Kolmogorov, J. Thapper, and S. Zivn´y. The power of linear programming for general-valued CSPs. SIAM Journal on Computing, 44(1):1 -- 36, 2015. [40] M. Kozik Weak consistency notions for all the CSPs of bounded width. ArXiv:1605.00565, version 2, 2016. [41] M. Kozik, A. Krokhin, M. Valeriote, and R. Willard. Characterizations of several Maltsev conditions. Algebra Universalis, 73(3 -- 4):205 -- 224, 2015. [42] A. Krokhin and S. Zivn´y: Editors. The Constraint Satisfaction Problem: Complexity and Approximability. Dagstuhl Follow-Ups, volume 7. Schloss Dagstuhl -- Leibniz-Zentrum fur Informatik, 2017. [43] G. Kun, R. O'Donnell, T. Suguru, Y. Yoshida, and Y. Zhou. Linear program- ming, width-1 CSPs, and robust satisfaction. In ITCS'12, pages 484 -- 495, 2012. [44] B. Larose and P. Tesson. Universal algebra and hardness results for con- straint satisfaction problems. Theoretical Computer Science, 410(18):1629 -- 1647, 2009. [45] B. Larose, M. Valeriote, and L. Z´adori. Omitting types, bounded width and the ability to count. Internat. J. Algebra Comput., 19(5):647 -- 668, 2009. [46] B. Larose and L. Z´adori. Bounded width problems and algebras. Algebra Universalis, 56(3 -- 4):439 -- 466, 2007. [47] K. Makarychev and Y. Makarychev. Approximation Algorithms for CSPs. In A. Krokhin and S. Zivny, Eds., The Constraint Satisfaction Problem: Complexity and Approximability. Dagstuhl Follow-Ups, volume 7. Schloss Dagstuhl -- Leibniz-Zentrum fur Informatik. Pages 287 -- 325, 2017. [48] P. Raghavendra. Optimal algorithms and inapproximability results for every CSP? In STOC'08, pages 245 -- 254, 2008. 44 [49] T. Schaefer. The complexity of satisfiability problems. In STOC'78, pages 216 -- 226, 1978. [50] J. Thapper and S. Zivn´y. The complexity of finite-valued CSPs. Journal of the ACM, 63(4): 37:1 -- 37:33, 2016. [51] L. Vandenberghe and S. Boyd. Semidefinite programming. SIAM Review, 38(1):49 -- 95, 1996. [52] D. Zhuk. A proof of CSP Dichotomy Conjecture. In FOCS, pages 331 -- 342, 2017. [53] U. Zwick. Finding almost-satisfying assignments. In STOC'98, pages 551 -- 560, 1998. 45
1302.4016
3
1302
2013-07-06T20:34:41
Full-fledged Real-Time Indexing for Constant Size Alphabets
[ "cs.DS" ]
In this paper we describe a data structure that supports pattern matching queries on a dynamically arriving text over an alphabet ofconstant size. Each new symbol can be prepended to $T$ in O(1) worst-case time. At any moment, we can report all occurrences of a pattern $P$ in the current text in $O(|P|+k)$ time, where $|P|$ is the length of $P$ and $k$ is the number of occurrences. This resolves, under assumption of constant-size alphabet, a long-standing open problem of existence of a real-time indexing method for string matching (see \cite{AmirN08}).
cs.DS
cs
Full-fledged Real-Time Indexing for Constant Size Alphabets∗ Gregory Kucherov1,2 and Yakov Nekrich†3 1Laboratoire d'Informatique Gaspard Monge, Universit´e Paris-Est & CNRS, Marne-la-Vall´ee, Paris, France, [email protected] 2Department of Computer Science, Ben-Gurion University of the Negev, Be'er Sheva, Israel 3Department of Electrical Engineering & Computer Science, University of Kansas, [email protected] Abstract In this paper we describe a data structure that supports pattern matching queries on a dynamically arriving text over an alphabet of constant size. Each new symbol can be prepended to T in O(1) worst-case time. At any moment, we can report all occurrences of a pattern P in the current text in O(P + k) time, where P is the length of P and k is the number of occurrences. This resolves, under assumption of constant size alphabet, a long-standing open problem of existence of a real-time indexing method for string matching (see [3]). 1 Introduction Two main versions of the string matching problem differ in which of the two components -- pattern P or text T -- is provided first in the input (or is considered as fixed) and can then be preprocessed before processing the other component. The framework when the text has to be preprocessed is usually called indexing, as it can be viewed as constructing a text index supporting matching queries. Real-time variants of the string matching problem are about as old as the string matching itself. In the 70s, existence of real-time string matching algorithms was first studied for Turing machines. For example, it has been shown that the language {P #TP occurs in T} can be recognized by a Turing machine, while the language {T #PP occurs in T} cannot [10]. In the realm of the RAM model, the real-time variant of pattern-preprocessing string matching has been extensively studied, leading to very efficient solutions (see e.g. [4] and references therein). The indexing variant, however, still has important unsolved questions. Back in the 70s, Slisenko [18] claimed a real-time algorithm for recognizing the language {T #PP occurs in T} on the RAM model, but its complex and voluminous full description made it unacknowledged by the scientific community, and the problem remained to be considered open ∗This version is an update of the paper published in ICALP'13 proceedings. We strengthen the main result (Theorem 2) by replacing the expected worst-case time by deterministic worst-case time. This is achieved by using a simpler suffix tree update construction in Section 2.2 (Theorem 1). †This work was done while this author was at Laboratoire d'Informatique Gaspard Monge, Universit´e Paris-Est & CNRS 1 for many years. In 1994, Kosaraju [14] reported another solution to this problem. In our present work, however, we are interested in a more general problem, when matching queries can be made at all moments, rather than after the entire text has been received. Specifically, in our problem, a streaming text should be processed in real time so that at each moment, a matching query P can be made to the portion of the text received so far. We call this the real-time indexing problem. This problem has been considered in 2008 by Amir and Nor [3], who extended Kosaraju's algorithm to deal with repetitive queries made at any moment of the text scan. All the three existing real-time indexing solutions [18, 14, 3] support only existential queries asking whether the pattern occurs in the text, but are unable to report occurrences of the pattern. Designing a real-time text indexing algorithm that would support queries on all occurrences of a pattern is stated in [3] as the most important remaining open problem. The algorithms of [14, 3] assume a constant size alphabet and are both based on constructions of "incomplete" suffix trees which can be built real-time but can only answer existential queries. To output all occurrences of a pattern, a fully-featured suffix tree is needed, however a real-time suffix tree construction, first studied in [1], is in itself an open question. The best currently known algorithms spend on each character O(log log n) worst-case time in the case of constant-size alphabets [5], or O(log log n + log2 log A log log log A ) time for arbitrary alphabets A [7]. A truly real-time suffix tree construction seems unlikely to exist. Therefore, a suffix tree alone seems to be insufficient to solve the real-time indexing problem. In this paper, we propose the first real-time text indexing solution that supports reporting all pattern occurrences, under the assumption of constant size alphabet. Similar to the previous works on real-time indexing, we assume that the text is read right-to-left, or otherwise the pattern needs to be reversed before executing the query. The general idea is to maintain several data structures, three in our case, each supporting queries for different pattern lengths. Each of these structures is based on a suffix tree (or suffix-tree-like structure) exteded by some auxiliary data structures. To update a suffix tree, we use an implementation of Weiner's algorithm which is somewhat similar to but simpler than that of [5]. The simplification is achieved by using some external algorithmic tools, such as colored predecessor queries [16]. As a result, we can update a suffix tree in O(log log n) worst-case time per letter, under the assumption that alphabet size is bounded by O(log1/4 n) and without resorting to a deamortization as in [5]. This is an interesting result in itself. The paper is organized as follows. In Section 2, we describe auxiliary data structures and present our method for online update of suffix trees. In Section 3, we describe the three data structures for different pattern lengths that constitute a basis of our solution. These data structures, however, do not provide a fully real-time algorithm. Then in Section 4, we show how to "fix" the solution of Section 3 in order to obtain a fully real-time algorithm. Throughout the paper, Σ is an alphabet of constant size σ. Since the text T is read right-to-left, it will be convenient for us to enumerate symbols of T from the end, i.e. T = tn . . . t1 and substring ti+(cid:96)ti+(cid:96)−1 . . . ti will be denoted T [i + (cid:96)..i]. T [i..] denotes suffix T [i..1]. Throughout this paper, we reserve k to denote the number of objects (occurrences of a pattern, elements in a list, etc) in the query answer. 2 Preliminaries In this Section, we describe main algorithmic tools used by our algorithms. 2 2.1 Range Reporting and Predecessor Queries on Colored Lists We use data structures from [16] for searching in dynamic colored lists. Colored Range Reporting in a List. Let elements of a dynamic linked list L be assigned positive integer values called colors. A colored range reporting query on a list L consists of two integers col1 < col2 and two pointers ptr1 and ptr2 that point to elements e1 and e2 of L. An answer to a colored range reporting query consists of all elements e ∈ L occurring between e1 and e2 (including e1 and e2) such that col1 ≤ col(e) ≤ col2, where col(e) is the color of e. The following result on colored range reporting has been proved by Mortensen [16]. Lemma 1 ([16]) Suppose that col(e) ≤ logf n for all e ∈ L and some constant f ≤ 1/4. We can answer color range reporting queries on L in O(log log m + k) time using an O(m)-space data structure, where m is the number of elements in L. Insertion of a new element into L is supported in O(log log m) time. Note that the bound f ≤ 1/4 follows from the description in [12]: the data structure in [16] uses Q-heaps [9] to answer certain queries on the set of colors in constant time. Colored Predecessor Problem. The colored predecessor query on a list L consists of an element e ∈ L and a color col. The answer to a query (e, col) is the closest element e(cid:48) ∈ L which precedes e such that col(e) = col. The following Lemma is also proved in [16]; we also refer to [11], where a similar problem is solved. Lemma 2 ([16]) Suppose that col(e) ≤ logf n for all e ∈ L and some constant f ≤ 1/4. There exists an O(m) space data structure that answers colored predecessor queries on L in O(log log m) time and supports insertions in O(log log m) time, where m is the number of elements in L. 2.2 Online Update of Suffix Trees for Small Alphabets Classical suffix tree construction algorithms read the input text online and spend an amortized constant time on each text letter, however in the worst-case, they can spend as much as a linear time on an individual letter. Several papers studied the question of reducing the worst-case time spent on a letter, trying to approach the real-time update [2, 5, 12, 7]. All of them follow Weiner's algorithm and process the text right-to-left, as only one new suffix has to be added when a new letter is prepended from left, resulting in a constant amount of modifications. Breslauer and Italiano [5] showed how to deamortize Weiner's algorithm in the case of constant-size alphabets in order to obtain O(log log n) worst-case time on each new letter. Kopelowitz [12] proposed a solution for an arbitrary alphabet A spending O(log log n + log log A) worst-case expected time on each prepended letter. Very recently, Fischer and Gawrychowski [7] showed how to obtain a (deterministic) worst- case time O(log log n + log2 log A log log log A ) for arbitrary alphabets. In this Section, we show a simple implementation of Weiner's algorithm that achieves a worst- case O(log log n) time per letter in the case when the alphabet size is bounded by log1/4 n. Our solution uses Lemma 2 as well as a constant-time solution to dynamic lowest common ancestor (lca) problem [6]. Thus, the solution below can be viewed as a simpler and slightly more general version of the result of [5], extending it from constant-size alphabets to alphabets of size log1/4 n. 3 We first briefly recall the main idea of Weiner's algorithm using a description similar to [5]. Updating a suffix tree when a new letter a is prepended to the current text T is done through maintaining W-links defined as follows. For a suffix tree node labeled u and a letter a ∈ A, W-link Wa(u) points to the locus of string au in the suffix tree, provided that au is a substring of T (i.e. exists in the current suffix tree). Note that the locus of au can be an explicit or an implicit node, and Wa(u) is called a hard or soft W-link respectively. The following properties of W-links will be useful in the sequel. Lemma 3 ([7]) (i) If for some letter a, a node has a defined W-link Wa, then any its ancestor node has a defined W-link Wa too. (ii) If two nodes u and v have defined hard W-links Wa, then lca(u, v) has a defined hard W-link Wa too. When a is prepended to a current text T , a new leaf labeled aT must be created and attached to either an existing node or a new node created by splitting an existing edge. To find the attachment node, the algorithm finds the lowest ancestor u of the leaf labeled T for which a (possibly soft) W-link Wa(u) is defined. Then the target node Wa(u) is the branching node. The main difficulty of Weiner's approach is to find the lowest ancestor of a leaf with a defined W-link Wa(u). Another difficulty is to update (soft) W-links when the attachment node results from an edge split (see [5]). In our solution, we store only hard W-links and do not store soft W-links at all. Note that a hard W-link, once installed, does not need to be updated for the rest of the algorithm [7]. Information about soft W-links is computed "on the fly" using the following Lemma. Lemma 4 ([7]) Assume that for a node u, Wa(u) is defined and is a soft link pointing to an implicit node located on an edge (v, w). Then there exists a unique highest descendant u(cid:48) of u for which Wa(u(cid:48)) is a hard link, and, moreover, Wa(u(cid:48)) = w. To find the lowest ancestor u of a given node t with a defined (possibly soft) W-link Wa(u), consider the Euler tour of the current suffix tree in which each internal node occurs two times corresponding to its first and last visits. Then the following Lemma holds. Lemma 5 Consider a node t. Assume that Wa(t) is not defined and u is the lowest ancestor of t for which a (possibly soft) link Wa(u) is defined. Let v1 be the closest node preceding t in the Euler tour of the suffix tree such that Wa(v1) is a hard link. Let v2 be the closest node following u in Euler tour of the suffix tree such that Wa(v2) is a hard link. Then u is the lowest node between lca(t, v1) and lca(t, v2). Moreover, if lca(t, v1) is the lowest, then v1 is the highest descendant of u with a defined hard W-link Wa, otherwise v2 is such a descendant. Proof : By Lemma 3(i), if Wa(t) is not defined, then Wa is not defined for any descendant of t. Thus, no node occurring between the first and the second occurrences of t in the Euler tour has a defined link Wa. Consequently, definitions of nodes v1 and v2 are unambiguous. By Lemma 4, u has a unique closest descendant, say v, with a defined hard link Wa(v). If v occurs before t in the Euler tour, then v is the closest node preceding t in the Euler tour with defined Wa(v). To show this, assume there is a closer such node v(cid:48). Observe that v(cid:48) is also a descendant of u and v(cid:48) is not a descendant of v. By Lemma 3(ii), lca(v, v(cid:48)) is a node with a defined hard link Wa. On the other hand, lca(v, v(cid:48)) is a proper ancestor of v which is a contradiction. Therefore, v is node v1 from the Lemma. 4 Symmetrically, if v occurs after t in the Euler tour, then v is node v2 from the Lemma. Clearly, (cid:3) to compute u, it is sufficient to pick the lowest between lca(t, v1) and lca(t, v2). Based on the above, we implement Weiner's algorithm by maintaining the Euler tour of the current suffix tree in a colored list LW . If a node u has a defined hard W-link Wa(u), then both occurrences of u in LW are colored with a. Note that a node can have up to A hard W-links and therefore have up to 2A occurrences in LW . However, the total number of hard W-links is limited by the number of tree nodes, as a node has at most one incoming hard W-link. By Lemma 2, we can answer colored predecessor and successor queries on LW in O(log log LW) time. Therefore, nodes v1 and v2 defined in Lemma 5 can be found in O(log log LW) time. Us- ing lowest common ancestor queries on a dynamic tree [6], lca(t, v1) and lca(t, v2) can be com- puted in O(1) time. Therefore, updating the suffix tree after prepending a new symbol is done is O(lg lg LW) = O(lg lg T) time. As an update can introduce two new hard W-links, we also need to update the colored list Lw. This is easily done in O(1) time. (Details are left out and can be found e.g. in [15].) We conclude with the final result of this Section. Theorem 1 Consider a text over an alphabet A, A ≤ log1/4 n, arriving online right-to-left. After prepending a new letter to the current text T , the suffix tree of T can be updated in time O(log log T) using an auxiliary data structure of size O(T). 3 Fast Off-Line Solution In this section we describe the main part of our algorithm of real-time text indexing. Based on the suffix tree construction from the previous Section, the algorithm updates the index by reading the text in the right-to-left order. However, the algorithm we describe in this Section will not be on-line, as it will have to access symbols to the left of the currently processed symbol. Another "flaw" of the algorithm is that it will support pattern matching queries only with an additional exception: we will be able to report all occurrences of a pattern except for those with start positions among a small number of most recently processed symbols of T . In the next section we will show how to fix these issues and turn our algorithm into a fully real-time indexing solution that reports all occurrences of a pattern. The algorithm distinguishes between three types of query patterns depending on their length: long patterns contain at least (log log n)2 symbols, medium-size patterns contain between (log(3) n)2 and (log log n)2 symbols, and short patterns contain less than (log(3) n)2 symbols1. For each of the three types of patterns, the algorithm will maintain a separate data structure supporting queries in O(P + k) time for matching patterns of the corresponding type. Long Patterns 3.1 To match long patterns, we maintain a sparse suffix tree TL storing only suffixes that start at positions q · d for q ≥ 1 and d = log log n/(4 log σ). Suffixes stored in TL are regarded as strings over a meta-alphabet of size σd = log1/4 n. This allows us to use the method of Section 2.2 to update TL, spending O(log log n) time on each each meta-character encoding O(log log n) regular characters. (We recall that σ = O(1).) 1Henceforth, log(3) n = log log log n. 5 Using TL we can find occurrences of a pattern P that start at positions qd for q ≥ 1, but not occurrences starting at positions qd + δ for 1 ≤ δ < d. To be able to find all occurrences, we maintain a list LE defined similarly to list LW from Section 2.2. The list LE contains copies of all nodes of TL as they occur during the Euler tour of TL. LE contains one element for each leaf and two elements for each internal node of TL. If a node of LE is a ←− leaf that corresponds to a suffix T [i..], we mark it with the meta-character T [i, d] = ti+1ti+2 . . . ti+d which is interpreted as the color of the leaf for the suffix T [i..]. Colors are ordered by lexicographic order of underlying strings. If S = s1 . . . sj is a string with j < d, then S defines an interval of colors, denoted [minc(S), maxc(S)], corresponding to all character strings of length d with prefix S. Recall that there are log1/4 n different colors. On list LE, we maintain the data structure of Lemma 1 for colored range reporting queries. The update of TL and LE is done as follows. After reading character ti where i = qd for q ≥ 1, we add suffix T [i..], viewed as a string over the meta-alphabet of cardinality log1/4 n, to TL following the algorithm described in Section 2.2. In addition, we have to update LE, i.e. to insert to LE the new leaf holding the suffix T [i..] colored with ti+1ti+2 . . . ti+d. (Note that at this point the algorithm "looks ahead" for the forthcoming d letters of T .) If a new internal node has been inserted into TL, we also update the list LE accordingly. Since the meta-alphabet size is only log1/4 n, navigation in TL from a node to a child can be supported in O(1) time. Observe that the children of any internal node v ∈ TL are naturally ordered by the lexicographic order of edge labels. We store the children of v in a data structure Pv which allows us to find in time O(1) the child whose edge label starts with a string (meta-character) S = s1 . . . sd. Moreover, we can also compute in time O(1) the "smallest" and the "largest" child of v whose edge label starts with a string S = s1 . . . sj with j ≤ d. Pv will also support adding a new edge to Pv in O(1) time. Data structure Pv can be implemented using e.g. atomic heaps [9]; since all elements in Pv are bounded by log1/4 n, we can also implement Pv as described in [17]. We now consider a long query pattern P = p1 . . . pm and show how the occurrences of P are computed. An occurrence of P is said to be a δ-occurrence if it starts in T at a position j = qd + δ, for some q. For each δ, 0 ≤ δ ≤ d − 1, we find all δ-occurrences as follows. First we "spell out" Pδ = pδ+1 . . . pm in TL over the meta-alphabet, i.e. we traverse TL proceeding by blocks of up to d letters of Σ. If this process fails at some step, then P has no δ-occurrences. Otherwise, we spell out Pδ completely, and retrieve the closest explicit descendant node vδ, or a range of descendant nodes δ, vl+1 vl δ in the case when Pδ spells to an explicit node except for a suffix of length less than d. The whole spelling step takes time O(P/d + 1). , . . . , vr δ Now we jump to the list LE and retrieve the first occurrence of vδ (or vl δ) and the second δ ) in LE. A leaf u of T corresponds to a δ-occurrence of P if and only occurrence of vδ (or vr if u occurs in the subtree of vδ (or the subtrees of vl δ ) and the color of u belongs to In the list LE, these leaves occur precisely within the interval [minc(pδ . . . p1), maxc(pδ . . . p1)]. we computed. Therefore, all δ-occurrences of P can be retrieved in time O(log log n + kδ) by a colored range reporting query (Lemma 1), where kδ is the number of δ-occurrences. Summing up over all δ, all occurrences of a long pattern P can be reported in time O(d(P/d + log log n) + k) = O(P + d log log n + k) = O(P + k), as d = log log n/(4 log σ), σ = O(1) and P ≥ (log log n)2. δ, . . . , vr 3.2 Medium-Size Patterns Now we show how to answer matching queries for patterns P where (log(3) n)2 ≤ P < (log log n)2. In a nutshell, we apply the same method as in Section 3.1 with the main difference that the 6 sparse suffix tree will store only truncated suffixes of length (log log n)2, i.e. prefixes of suffixes bounded by (log log n)2 characters. We store truncated suffixes starting at positions spaced by log(3) n = log log log n characters. The total number of different truncated suffixes is at most σ(log log n)2. This small number of suffixes will allow us to search and update the data structures faster compared to Section 3.1. We now describe the details of the construction. We store all truncated suffixes that start at positions qd(cid:48), for q ≥ 1 and d(cid:48) = log(3) n, in a tree TM . TM is organized in the same way as the standard suffix tree; that is, TM is a compacted trie for substrings T [qd(cid:48)..qd(cid:48) − (log log n)2 + 1], where these substrings are regarded as strings over the meta-alphabet Σd(cid:48) .2 Observe that the same truncated suffix can occur several times. Therefore, we augment each leaf v with a list of colors Col(v) corresponding to left contexts of the corresponding truncated suffix S. More precisely, if S = T [qd(cid:48)..qd(cid:48) − (log log n)2 + 1] for some ←− q ≥ 1, then T [qd(cid:48), d(cid:48)] is added to Col(v). Note that the number of colors is bounded by σlog(3) n. Furthermore, for each color col in Col(v), we store all positions i = qd(cid:48) of T such that S occurs at ←− T [i, d(cid:48)] = col. Similar to Section 3.1, we maintain a colored list LM that stores the Euler i and tour traversal of TM . For each internal node, LM contains two elements. For every leaf v and for each value col in its color list Col(v), LM contains a separate element colored with col. Observe that since the size of LM is bounded by O(σ(log log n)2+log(3) n), updates of LM can be supported in O(log log(σ(log log n)2)) = O(log(3) n) time and colored reporting queries on LM can be answered in O(log(3) n + k) time (Lemma 1). Truncated suffixes are added to TM using a method similar to that of Section 3.1. After reading ←− a symbol tqd(cid:48) for some q ≥ 1, we insert Snew = T [qd(cid:48)..qd(cid:48) − (log log n)2 + 1] colored with T [qd(cid:48), d(cid:48)] into the tree TM . Insertion of Snew is done as described in Section 2.2, and the list LM is updated ←− accordingly. If LM already contains a leaf with string value Snew and color T [qd(cid:48), d(cid:48)], we add qd(cid:48) to the list of its occurrences, otherwise we insert a new element into LM and initialize its location list to qd(cid:48). Altogether, the addition of a new truncated suffix Snew requires O(log log TM) = O(log(3) n) time. A query for a pattern P = p1 . . . pm, such that (log(3) n)2 ≤ m < (log log n)2, is answered in the same way as in Section 3.1. For each ρ = 0, . . . , log(3) n − 1, we find locus nodes vl ρ, . . . , vr ρ ρ) of Pρ = pρ+1 . . . pm. Then, we find all elements in LM occurring between (possibly with vl ρ and the second occurrence of vr the first occurrence of vl ρ and colored with a color col that belongs to [minc(pρ . . . p1), maxc(pρ . . . p1)]. For every such element, we traverse the associated list of occurrences: if a position i is in the list, then P occurs at position (i + ρ). The total time needed to find all occurrences of a medium-size pattern P is O(d(cid:48)(P/d(cid:48) +log(3) n)+k) = O(P+(log(3) n)2 + k) = O(P + k) since P ≥ (log(3) n)2. ρ = vr 3.3 Short Patterns Finally, we describe our indexing data structure for patterns P with P < (log(3) n)2. We maintain the tree TS of truncated suffixes of length ∆ = (log(3) n)2 seen so far in the text. For every position i of T , TS contains the substring T [i..i − ∆ + 1]. TS is organized as a compacted trie. We support queries and updates on TS using tabulation. There are O(2σ∆) different trees, and O(σ∆) different queries can be made on each tree. Therefore, we can afford explicitly storing all possible trees TS and tabulating possible tree updates. Each internal node of a tree stores pointers to its lefmost 2For simplicity we assume that log(3) n and log log n are integers and log(3) n divides log log n. If this is not the case, we can find d(cid:48) and d that satisfy these requirements such that log log n ≤ d ≤ 2 log log n and log(3) n ≤ d(cid:48) ≤ 2 log(3) n. 7 and rightmost leaves, the leaves of a tree are organized in a list, and each leaf stores the encoding of the corresponding string Q. The update table Tu stores, for each tree TS and for any string Q, Q = ∆, a pointer to the tree T (cid:48) S (possibly the same) obtained after adding Q to TS. Table Tu uses O(2σ∆σ∆) = o(n) space. The output table To stores, for every string Q of length ∆, the list of positions in the current text T where Q occurs. To has σ∆ = o(n) entries and all lists of occurrences take O(n) space altogether. When scanning the text, we maintain the encoding of the string Q of ∆ most recently read symbols of T . The encoding is updated after each symbol using bit operations. After reading a new symbol, the current tree TS is updated using table Tu and the current position is added to the entry To[Q]. Updates take O(1) time. To answer a query P , P < ∆, we find the locus u of P in the current tree TS, retrieve the leftmost and rightmost leaves and traverse the leaves in the subtree of u. For each traversed leaf vl with label Q, we report the occurrences stored in To[Q]. The query takes time O(P + k). 4 Real-Time Indexing The indexes for long and medium-size patterns, described in Sections 3.1 and 3.2 respectively, do not provide real-time indexing solutions for several reasons. The index for long patterns, for example, requires to look ahead for the forthcoming d symbols when processing symbols ti for i = qd, q ≥ 1. Furthermore, for such i, we are unable to find occurrences of query patterns P starting at positions ti−1 . . . ti−d+1 before processing ti. A similar situation holds for medium-size patterns. Another issue is that in our previous development we assumed the length n of T to be known, whereas this may of course not be the case in the real-time setting. In this Section, we show how to fix these issues in order to turn the indexes real-time. Firstly we show how the data structures of Sections 3.1 and 3.2 can be updated in a real-time mode. Then, we describe how to search for patterns that start among most recently processed symbols. We describe our solutions to these issues for the case of long patterns, as a simple change of parameters provides a solution for medium-size patterns too. Finally, we will show how we can circumvent the fact that the length of T is not known in advance. In the algorithm of Section 3.1, the text is partitioned into blocks of length d, and the insertion of a new suffix T [i..] is triggered only when the leftmost symbol ti of a block is reached. The insertion takes time O(d) and assumes the knowledge of the forthcoming block ti+d . . . ti+1. To turn this algorithm real-time, we apply a standard deamortization technique. We distribute the cost of the insertion of suffix T [i− d..] over d symbols of the block ti+d . . . ti+1. This is correct, as by the time we start reading the block ti+d . . . ti+1, we have read the block ti . . . ti−d+1 and therefore have all necessary information to insert suffix T [i−d..]. In this way, we spend O(1) time per symbol to update all involved data structures. Now assume we are reading a block ti+d . . . ti+1, i.e. we are processing some symbol ti+δ for 1 ≤ δ < i. At this point, we are unable to find occurrences of a query pattern P starting at ti+δ . . . ti+1 as well as within the two previous blocks, as they have not been indexed yet. This concerns up to (3d − 1) most recent symbols. We then introduce a separate procedure to search for occurrences that start in 3d leftmost positions of the already processed text. This can be done by simply storing T in a compact form Tc where every logσ n consecutive symbols are packed into one computer word3. Thus, Tc uses O(T/ logσ n) words of space. Using Tc, we can test whether 3In fact, it would suffice to store 3d − 1 most recently read symbols in compact form. 8 T [j..j − P + 1] = P , for any pattern P and any position j, in O((cid:100)P/ logσ n(cid:101)) = o(P/d) + O(1) time. Therefore, checking 3d positions takes time o(P) + O(d) = O(P) for a long pattern P . We now describe how we can apply our algorithm in the case when the text length is not known beforehand. In this case, we assume T to take increasing values n0 < n1 < . . . , as long as the text T keeps growing. Here, n0 is some appropriate initial value and ni = 2ni−1 for i ≥ 1. Suppose now that ni is the currently assumed value of T. After we reach character tni/2, during the processing of the next ni/2 symbols, we keep building the index for T = ni and, in parallel, rebuild all the data structures under assumption that T = ni+1 = 2ni. In particular, if log log(2ni) (cid:54)= log log ni, we build a new index for long patterns, and if log(3)(2ni) (cid:54)= log(3) ni, we build a new index for meduim-size and short patterns. If logσ(2ni) (cid:54)= logσ ni, we also construct a new compact representation Tc introduced earlier in this section. Altogether, we distribute the construction cost of the data structures for T [ni..1] under assumption T = 2ni over the processing of tni/2+1 . . . tni. Since O(ni) = O(ni/2), processing these ni/2 symbols remains real-time. By the time tni has been read, all data structures for T = 2ni have been built, and the algorithm proceeds with the new value T = ni+1. Observe finally that the intervals [ni/2 + 1, ni] are all disjoint, therefore the overhead per letter incurred by the procedure remains constant. In conclusion, the whole algorithm remains real-time. We finish with our main result. Theorem 2 There exists a data structure storing a text T over a constant-size alphabet that can be updated in O(1) worst-case time after prepending a new symbol to T . This data structure supports reporting all occurrences of a pattern P in the current text T in O(P + k) time, where k is the number of occurrences. 5 Conclusions In this paper we presented the first real-time indexing data structure that supports reporting all pattern occurrences in optimal time O(P + k). As in the previous works on this topic [14, 3, 5], we assume that the input text is over an alphabet of constant size. It may be possible to extend our result to alphabets of poly-logarithmic size. Acknowledgements. GK has been supported by the Marie-Curie Intra-European fellowship for carrier development. We thank the anonymous reviewers of ICALP'13 for helpful comments. References [1] A. Amir, T. Kopelowitz, M. Lewenstein, and N. Lewenstein. Towards real-time suffix tree construction. In M. Consens and G. Navarro, editors, Proc. International Symposium on String Processing and Information Retrieval (SPIRE), volume 3772 of Lecture Notes in Computer Science, pages 67 -- 78. Springer Berlin Heidelberg, 2005. [2] A. Amir, T. Kopelowitz, M. Lewenstein, and N. Lewenstein. Towards real-time suffix tree construction. In Proc. 12th International Conference on String Processing and Information Retrieval (SPIRE 2005), pages 67 -- 78, 2005. [3] A. Amir and I. Nor. Real-time indexing over fixed finite alphabets. In Proc. 19th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2008), pages 1086 -- 1095, 2008. 9 [4] D. Breslauer, R. Grossi, and F. Mignosi. Simple real-time constant-space string matching. In R. Giancarlo and G. Manzini, editors, Combinatorial Pattern Matching, volume 6661 of Lecture Notes in Computer Science, pages 173 -- 183. Springer Berlin Heidelberg, 2011. [5] D. Breslauer and G. F. Italiano. Near real-time suffix tree construction via the fringe marked ancestor problem. In Proc. 18th International Symposium on String Processing and Informa- tion Retrieval (SPIRE 2011), pages 156 -- 167, 2011. [6] R. Cole and R. Hariharan. Dynamic LCA queries on trees. SIAM J. Comput., 34(4):894 -- 923, 2005. [7] J. Fischer and P. Gawrychowski. Alphabet-dependent string searching with wexponential search trees. CoRR, abs/1302.3347, 2013. [8] G. Franceschini and R. Grossi. A General Technique for Managing Strings in Comparison- Driven Data Structures. In Proc. International Colloquium on Automata, Languages and Programming (ICALP 2004), Lecture Notes in Computer Science, pages 606 -- 617. Springer Berlin / Heidelberg, 2004. [9] M. L. Fredman and D. E. Willard. Trans-dichotomous algorithms for minimum spanning trees and shortest paths. J. Comput. Syst. Sci., 48(3):533 -- 551, 1994. [10] Z. Galil. String matching in real time. J. ACM, 28(1):134 -- 149, 1981. [11] Y. Giyora and H. Kaplan. Optimal dynamic vertical ray shooting in rectilinear planar subdi- visions. ACM Transactions on Algorithms, 5(3), 2009. [12] T. Kopelowitz. On-line indexing for general alphabets via predecessor queries on subsets of an ordered list. In Proc. 53rd Annual IEEE Symposium on Foundations of Computer Science (FOCS 2012), pages 283 -- 292, 2012. [13] T. Kopelowitz and M. Lewenstein. Dynamic weighted ancestors. In Proc. 18th Annual ACM- SIAM Symposium on Discrete Algorithms (SODA 2007), pages 565 -- 574, 2007. [14] S. R. Kosaraju. Real-time pattern matching and quasi-real-time construction of suffix trees (preliminary version). In Proc. 26th Annual ACM Symposium on Theory of Computing (STOC 1994), pages 310 -- 316. ACM, 1994. [15] G. Kucherov, Y. Nekrich, and T. Starikovskaya. Cross-document pattern matching. In J. Karkkainen and J. Stoye, editors, Proceedings of the 23rd Annual Symposium on Combina- torial Pattern Matching (CPM), July 3-5, 2012, Helsinki (Finland), volume 7354 of Lecture Notes in Computer Science, pages 196 -- 207. Springer Verlag, 2012. [16] C. W. Mortensen. Fully-dynamic two dimensional orthogonal range and line segment intersec- tion reporting in logarithmic time. In Proc. 14th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2003), pages 618 -- 627, 2003. [17] G. Navarro and Y. Nekrich. Top-k document retrieval in optimal time and linear space. In Proc. 23rd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2012), pages 1066 -- 1077, 2012. 10 [18] A. Slisenko. String-matching in real time: Some properties of the data structure. In Math- ematical Foundations of Computer Science 1978, Proceedings, 7th Symposium, Zakopane, Poland, September 4-8, 1978, volume 64 of Lecture Notes in Computer Science, pages 493 -- 496. Springer, 1978. 11
1905.12987
2
1905
2019-07-26T19:34:44
Inducing the Lyndon Array
[ "cs.DS" ]
In this paper we propose a variant of the induced suffix sorting algorithm by Nong (TOIS, 2013) that computes simultaneously the Lyndon array and the suffix array of a text in $O(n)$ time using $\sigma + O(1)$ words of working space, where $n$ is the length of the text and $\sigma$ is the alphabet size. Our result improves the previous best space requirement for linear time computation of the Lyndon array. In fact, all the known linear algorithms for Lyndon array computation use suffix sorting as a preprocessing step and use $O(n)$ words of working space in addition to the Lyndon array and suffix array. Experimental results with real and synthetic datasets show that our algorithm is not only space-efficient but also fast in practice.
cs.DS
cs
Inducing the Lyndon Array Felipe A. Louza1, Sabrina Mantaci2, Giovanni Manzini3,4, Marinella Sciortino2, and Guilherme P. Telles5 1 Department of Computing and Mathematics, University of São Paulo, Brazil 2 Dipartimento di Matematica e Informatica, University of Palermo, Italy [email protected] {sabrina.mantaci,marinella.sciortino}@unipa.it 3 University of Eastern Piedmont, Alessandria, Italy 4 IIT CNR, Pisa, Italy [email protected] 5 Institute of Computing, University of Campinas, Brazil [email protected] Abstract. In this paper we propose a variant of the induced suffix sorting algorithm by Nong (TOIS, 2013) that computes simultaneously the Lyndon array and the suffix array of a text in O(n) time using σ +O(1) words of working space, where n is the length of the text and σ is the alphabet size. Our result improves the previous best space requirement for linear time computation of the Lyndon array. In fact, all the known linear algorithms for Lyndon array computation use suffix sorting as a preprocessing step and use O(n) words of working space in addition to the Lyndon array and suffix array. Experimental results with real and synthetic datasets show that our algorithm is not only space-efficient but also fast in practice. Keywords: Lyndon array, Suffix array, induced suffix sorting, lightweight algorithms 1 Introduction The suffix array is a central data structure for string processing. Induced suffix sorting is a remarkably powerful technique for the construction of the suffix array. Induced sorting was introduced by Itoh and Tanaka [10] and later refined by Ko and Aluru [11] and by Nong et al. [19,18]. In 2013, Nong [17] proposed a space efficient linear time algorithm based on induced sorting, called SACA-K, which uses only σ + O(1) words of working space, where σ is the alphabet size and the working space is the space used in addition to the input and the output. Since a small working space is a very desirable feature, there have been many algorithms adapting induced suffix sorting to the computation of data structures related to the suffix array, such as the Burrows-Wheeler transform [21], the Φ-array [8], the LCP array [4,14], and the document array [13]. The Lyndon array of a string is a powerful tool that generalizes the idea of Lyndon factorization. In the Lyndon array (LA) of string T = T [1] . . . T [n] over F. A. Louza et al. 2 the alphabet Σ, each entry LA[i], with 1 ≤ i ≤ n, stores the length of the longest Lyndon factor of T starting at that position i. Bannai et al. [2] used Lyndon arrays to prove the conjecture by Kolpakov and Kucherov [12] that the number of runs (maximal periodicities) in a string of length n is smaller than n. In [3] the authors have shown that the computation of the Lyndon array of T is strictly related to the construction of the Lyndon tree [9] of the string $T (where the symbol $ is smaller than any symbol of the alphabet Σ). In this paper we address the problem of designing a space economical linear time algorithm for the computation of the Lyndon array. As described in [5,15], there are several algorithms to compute the Lyndon array. It is noteworthy that the ones that run in linear time (cf. [1,3,5,6,15]) use the sorting of the suffixes (or a partial sorting of suffixes) of the input string as a preprocessing step. Among the linear time algorithms, the most space economical is the one in [5] which, in addition to the n log σ bits for the input string plus 2n words for the Lyndon array and suffix array, uses a stack whose size depends on the structure of the input. Such stack is relatively small for non pathological texts, but in the worst case its size can be up to n words. Therefore, the overall space in the worst case can be up to n log σ bits plus 3n words. In this paper we propose a variant of the algorithm SACA-K that computes in linear time the Lyndon array as a by-product of suffix array construction. Our algorithm uses overall n log σ bits plus 2n + σ + O(1) words of space. This bound makes our algorithm the one with the best worst case space bound among the linear time algorithms. Note that the σ + O(1) words of working space of our algorithm is optimal for strings from alphabets of constant size. Our experiments show that our algorithm is competitive in practice compared to the other linear time solutions to compute the Lyndon array. 2 Background Let T = T [1] . . . T [n] be a string of length n over a fixed ordered alphabet Σ of size σ, where T [i] denotes the i-th symbol of T . We denote T [i, j] as the factor of T starting from the i-th symbol and ending at the j-th symbol. A suffix of T is a factor of the form T [i, n] and is also denoted as Ti. In the following we assume that any integer array of length n with values in the range [1, n] takes n words (n log n bits) of space. Given T = T [1] . . . T [n], the i-th rotation of T begins with T [i + 1], corre- sponding to the string T (cid:48) = T [i + 1] . . . T [n]T [1] . . . T [i]. Note that, a string of length n has n possible rotations. A string T is a repetition if there exists a string S and an integer k > 1 such that T = Sk, otherwise it is called primitive. If a string is primitive, all of its rotations are different. A primitive string T is called a Lyndon word if it is the lexicographical least among its rotations. For instance, the string T = abanba is not a Lyndon word, while it is its rotation aabanb is. A Lyndon factor of a string T is a factor of T that is a Lyndon word. For instance, anb is a Lyndon factor of T = abanba. Inducing the Lyndon Array 3 Definition 1. Given a string T = T [1] . . . T [n], the Lyndon array (LA) of T is an array of integers in the range [1, n] that, at each position i = 1, . . . , n, stores the length of the longest Lyndon factor of T starting at i: LA[i] = max{(cid:96) T [i, i + (cid:96) − 1] is a Lyndon word}. The suffix array (SA) [16] of a string T = T [1] . . . T [n] is an array of integers in the range [1, n] that gives the lexicographic order of all suffixes of T , that is TSA[1] < TSA[2] < ··· < TSA[n]. The inverse suffix array (ISA) stores the inverse permutation of SA, such that ISA[SA[i]] = i. The suffix array can be computed in O(n) time using σ + O(1) words of working space [17]. Usually when dealing with suffix arrays it is convenient to append to the string T a special end-marker symbol $ (called sentinel) that does not occur elsewhere in T and $ is smaller than any other symbol in Σ. Here we assume that T [n] = $. Note that the values LA[i], for 1 ≤ i ≤ n − 1 do not change when the symbol $ is appended at the position n. Also, string T = T [1] . . . T [n − 1]$ is always primitive. Given an array of integers A of size n, the next smaller value (NSV) array of A, denoted NSVA, is an array of size n such that NSVA[i] contains the smallest position j > i such that A[j] < A[i], or n + 1 if such a position j does not exist. Formally: NSVA[i] = min(cid:8){n + 1} ∪ {i < j ≤ n A[j] < A[i]}(cid:9). As an example, in Figure 1 we consider the string T = banaananaanana$, and its Suffix Array (SA), Inverse Suffix Array (ISA), Next Smaller Value array of the ISA (NSVISA), and Lyndon Array (LA). We also show all the Lyndon factors starting at each position of T . If the SA of T is known, the Lyndon array LA can be computed in linear time thanks to the following lemma that rephrases a result in [9]: Lemma 1. The factor T [i, i + (cid:96) − 1] is the longest Lyndon factor of T starting (cid:117)(cid:116) at i iff Ti < Ti+k, for 1 ≤ k < (cid:96), and Ti > Ti+(cid:96). Therefore, LA[i] = (cid:96). Lemma 1 can be reformulated in terms of the inverse suffix array [5], such that LA[i] = (cid:96) iff ISA[i] < ISA[i + k], for 1 ≤ k < (cid:96), and ISA[i] > ISA[i + (cid:96)]. In other words, i + (cid:96) = NSVISA[i]. Since given ISA we can compute NSVISA in linear time using an auxiliary stack [7,20] of size O(n) words, we can then derive LA, in the same space of NSVISA, in linear time using the formula: LA[i] = NSVISA[i] − i, for 1 ≤ i ≤ n. (1) Overall, this approach uses n log σ bits for T plus 2n words for LA and ISA, and the space for the auxiliary stack. Alternatively, LA can be computed in linear time from the Cartesian tree [22] built for ISA [3]. Recently, Franek et al. [6] observed that LA can be computed in linear time during the suffix array construction algorithm by Baier [1] using overall n log σ bits plus 2n words for LA and SA plus 2n words for auxiliary 4 F. A. Louza et al. Fig. 1. SA, ISA, NSVISA, LA and all Lyndon factors for T = banaananaanana$ integer arrays. Finally, Louza et al. [15] introduced an algorithm that computes LA in linear time during the Burrows-Wheeler inversion, using n log σ bits for T plus 2n words for LA and an auxiliary integer array, plus a stack with twice the size as the one used to compute NSVISA (see Section 4). Summing up, the most economical linear time solution for computing the Lyndon array is the one based on (1) that requires, in addition to T and LA, n words of working space plus an auxiliary stack. The stack size is small for non pathological inputs but can use n words in the worst case (see also Section 4). Therefore, considering only LA as output, the working space is 2n words in the worst case. 2.1 Induced Suffix Sorting The algorithm SACA-K [17] uses a technique called induced suffix sorting to compute SA in linear time using only σ + O(1) words of working space. In this technique each suffix Ti of T [1, n] is classified according to its lexicographical rank relative to Ti+1. Definition 2. A suffix Ti is S-type if Ti < Ti+1, otherwise Ti is L-type. We define Tn as S-type. A suffix Ti is LMS-type (leftmost S-type) if Ti is S-type and Ti−1 is L-type. The type of each suffix can be computed with a right-to-left scanning of T [18], or otherwise it can be computed on-the-fly in constant time during Nong's algorithm [17, Section 3]. By extension, the type of each symbol in T can be classified according to the type of the suffix starting with such symbol. In particular T [i] is LMS-type if and only if Ti is LMS-type. 123456789101112131415banaananaanana$T=151494127210511383116SA=107134915612381451121ISA=2449779914121214141516NSVISA=121521215212111LA=banaananaanana$nanananannnnnLyndonfactors Inducing the Lyndon Array 5 Fig. 2. Induced suffix sorting steps (SACA-K) for T = banaananaanana$ Definition 3. An LMS-factor of T is a factor that begins with a LMS-type symbol and ends with the following LMS-type symbol. We remark that LMS-factors do not establish a factorization of T since each of them overlaps with the following one by one symbol. By convention, T [n, n] is always an LMS-factor. The LMS-factors of T = banaananaanana$ are shown in Figure 2, where the type of each symbol is also reported. The LMS types are the grey entries. Notice that in SA all suffixes starting with the same symbol c ∈ Σ can be partitioned into a c-bucket. We will keep an integer array C[1, σ] where C[c] gives either the first (head) or last (tail) available position of the c-bucket. Then, whenever we insert a value into the head (or tail) of a c-bucket, we increase (or decrease) C[c] by one. An important remark is that within each c-bucket S-type suffixes are larger than L-type suffixes. Figure 2 shows a running example of algorithm SACA-K for T = banaananaanana$. Given all LMS-type suffixes of T [1, n], the suffix array can be computed as follows: 123456789101112131415banaananaanana$T=LSLSSLSLSSLSLLStype=anaanaana$aanaaana$LMS-factors=1594127215941272151411383116151494127210511383116Step1SA=Step2SA=Step3SA=Step4SA=(LMS-type)(L-type)(S-type)recursive 6 F. A. Louza et al. Steps: 1. Sort all LMS-type suffixes recursively into SA1, stored in SA[1, n/2]. 2. Scan SA1 from right-to-left, and insert the LMS-suffixes into the tail of 4. Induce S-type suffixes by scanning SA right-to-left: for each suffix SA[i], 3. Induce L-type suffixes by scanning SA left-to-right: for each suffix SA[i], their corresponding c-buckets in SA. if TSA[i]−1 is L-type, insert SA[i] − 1 into the head of its bucket. if TSA[i]−1 is S-type, insert SA[i] − 1 into the tail of its bucket. Step 1 considers the string T 1 obtained by concatenating the lexicographic names of all the consecutive LMS-factors (each different string is associated with a symbol that represents its lexicographic rank). Note that T 1 is defined over an alphabet of size O(n) and that its length is at most n/2. The SACA-K algorithm is applied recursively to sort the suffixes of T 1 into SA1, which is stored in the first half of SA. Nong et al. [18] showed that sorting the suffixes of T 1 is equivalent to sorting the LMS-type suffixes of T . We will omit details of this step, since our algorithm will not modify it. Step 2 obtains the sorted order of all LMS-type suffixes from SA1 scanning it from right-to-left and bucket sorting then into the tail of their corresponding c-buckets in SA. Step 3 induces the order of all L-type suffixes by scanning SA from left-to-right. Whenever suffix TSA[i]−1 is L-type, SA[i] − 1 is inserted in its final (corrected) position in SA. Finally, Step 4 induces the order of all S-type suffixes by scanning SA from right-to-left. Whenever suffix TSA[i]−1 is S-type, SA[i] − 1 is inserted in its final (correct) position in SA. Theoretical costs. Overall, algorithm SACA-K runs in linear time using only an additional array of size σ + O(1) words to store the bucket array [17]. 3 Inducing the Lyndon array In this section we show how to compute the Lyndon array (LA) during Step 4 of algorithm SACA-K described in Section 2.1. Initially, we set all positions LA[i] = 0, for 1 ≤ i ≤ n. In Step 4, when SA is scanned from right-to-left, each value SA[i], corresponding to TSA[i], is read in its final (correct) position i in SA. In other words, we read the suffixes in decreasing order from SA[n], SA[n − 1], . . . , SA[1]. We now show how to compute, during iteration i, the value of LA[SA[i]]. By Lemma 1, we know that the length of the longest Lyndon factor starting at position SA[i] in T , that is LA[SA[i]], is equal to (cid:96), where TSA[i]+(cid:96) is the next suffix (in text order) that is smaller than TSA[i]. In this case, TSA[i]+(cid:96) will be the first suffix in TSA[i]+1, TSA[i]+2 . . . , Tn that has not yet been read in SA, which means that TSA[i]+(cid:96) < TSA[i]. Therefore, during Step 4, whenever we read SA[i], Inducing the Lyndon Array 7 Fig. 3. Running example for T = banaananaanana$. we compute LA[SA[i]] by scanning LA[SA[i] + 1, n] to the right up to the first position LA[SA[i] + (cid:96)] = 0, and we set LA[SA[i]] = (cid:96). The correctness of this procedure follows from the fact that every position in LA[1, n] is initialized with zero, and if LA[SA[i]+1], LA[SA[i]+2], . . . , LA[SA[i]+(cid:96)− 1] are no longer equal to zero, their corresponding suffixes has already been read in positions larger than i in SA[i, n], and such suffixes are larger (lexicographically) than TSA[i]. Then, the first position we find LA[SA[i] + (cid:96)] = 0 corresponds to a suffix TSA[i]+(cid:96) that is smaller than TSA[i], which was still not read in SA. Also, TSA[i]+(cid:96) is the next smaller suffix (in text order) because we read LA[SA[i] + 1, n] from left-to-right. Figure 3 illustrates iterations i = 15, 9, and 3 of our algorithm for T = banaananaanana$. For example, at iteration i = 9, the suffix T5 is read at position SA[9], and the corresponding value LA[5] is computed by scanning LA[6], LA[7], . . . , LA[15] up to finding the first empty position, which occurs at LA[7 = 5 + 2]. Therefore, LA[5] = 2. At each iteration i = n, n − 1, . . . , 1, the value of LA[SA[i]] is computed in additional LA[SA[i]] steps, that is our algorithm adds O(LA[i]) time for each iteration of SACA-K. 123456789101112131415banaananaanana$T=6SA=000001000000000LA=511383116SA=101021010010100LA=10511383116SA=101021010210100LA=94127210511383116SA=121521215212100LA=iteration15983 F. A. Louza et al. 8 (cid:80)n Therefore, our algorithm runs in O(n · avelyn) time, where avelyn = i=1 LA[i]/n. Note that computing LA does not need extra memory on top of the space for LA[1, n]. Thus, the working space is the same as SACA-K, which is σ + O(1) words. Lemma 2. The Lyndon array and the suffix array of a string T [1, n] over an alphabet of size σ can be computed simultaneously in O(n · avelyn) time using σ + O(1) words of working space, where avelyn is equal to the average value in (cid:117)(cid:116) LA[1, n]. In the next sections we show how to modify the above algorithm to reduce both its running time and its working space. 3.1 Reducing the running time to O(n) We now show how to modify the above algorithm to compute each LA entry in constant time. To this end, we store for each position LA[i] the next smaller position (cid:96) such that LA[(cid:96)] = 0. We define two additional pointer arrays NEXT[1, n] and PREV[1, n]: Definition 4. For i = 1, . . . , n − 1, NEXT[i] = min{(cid:96)i < (cid:96) ≤ n and LA[(cid:96)] = 0}. In addition, we define NEXT[n] = n + 1. Definition 5. For i = 2, . . . , n, PREV[i] = (cid:96), such that NEXT[(cid:96)] = i and LA[(cid:96)] = 0. In addition, we define PREV[1] = 0. The above definitions depend on LA and therefore NEXT and PREV are updated as we compute additional LA entries. Initially, we set NEXT[i] = i + 1 and PREV[i] = i − 1, for 1 ≤ i ≤ n. Then, at each iteration i = n, n − 1, . . . , 1, when we compute LA[j] with j = SA[i] setting: LA[j] = NEXT[j] − j we update the pointers arrays as follows: NEXT[PREV[j]] = NEXT[j], PREV[NEXT[j]] = PREV[j], if PREV[j] > 0 if NEXT[j] < n + 1 (2) (3) (4) The cost of computing each LA entry is now constant, since only two additional computations (Equations 3 and 4) are needed. Because of the use of the arrays PREV and NEXT the working space of our algorithm is now 2n + σ + O(1) words. Theorem 1. The Lyndon array and the suffix array of a string T [1, n] over an alphabet of size σ can be computed simultaneously in O(n) time using 2n+σ +O(1) (cid:117)(cid:116) words of working space. 3.2 Getting rid of a pointer array Inducing the Lyndon Array 9 We now show how to reduce the working space of Section 3.1 by storing only one array, say A[1, n], keeping NEXT/PREV information together. In a glace, we store NEXT initially into the space of A[1, n], then we reuse A[1, n] to store the (useful) entries of PREV. Note that, whenever we write LA[j] = (cid:96), the value in A[j], that is NEXT[j] is no more used by the algorithm. Then, we can reuse A[j] to store PREV[j + 1]. Also, we know that if LA[j] = 0 then PREV[j + 1] = j. Therefore, we can redefine PREV in terms of A: (cid:40) PREV[j] = j − 1 A[j − 1] if LA[j − 1] = 0 otherwise. (5) The running time of our algorithm remains the same since we have added only one extra verification to obtain PREV[j] (Equation 5). Observe that whenever NEXT[j] is overwritten the algorithm does not need it anymore. The working space is therefore reduced to n + σ + O(1) words. Theorem 2. The Lyndon array and the suffix array of a string T [1, n] over an alphabet of size σ can be computed simultaneously in O(n) time using n + σ + O(1) (cid:117)(cid:116) words of working space. 3.3 Getting rid of both pointer arrays Finally, we show how to use the space of LA[1, n] to store both the auxiliary array A[1, n] and the final values of LA. First we observe that it is easy to compute LA[i] when Ti is an L-type suffix. Lemma 3. LA[j] = 1 iff Tj is an L-type suffix, or i = n. Proof. If Tj is an L-type suffix, then Tj > Tj+1 and LA[j] = 1. By definition (cid:117)(cid:116) LA[n] = 1. Notice that at Step 4 during iteration i = n, n − 1, . . . , 1, whenever we read an S-type suffix Tj, with j = SA[i], its succeeding suffix (in text order) Tj+1 has already been read in some position in the interval SA[i + 1, n] (Tj+1 have induced the order of Tj). Therefore, the LA-entries corresponding to S-type suffixes are always inserted on the left of a block (possibly of size one) of non-zero entries in LA[1, n]. Moreover, whenever we are computing LA[j] and we have NEXT[j] = j + k (stored in A[j]), we know the following entries LA[j +1], LA[j +2], . . . , LA[j +k−1] are no longer zero, and we have to update A[j+k−1], corresponding to PREV[j+k] (Equation 5). In other words, we update PREV information only for right-most entry of each block of non empty entries, which corresponds to a position of an L-type suffix because S-type are always inserted on the left of a block. Then, at the end of the modified Step 4, if A[i] < i then Ti is an L-type suffix, and we know that LA[i] = 1. On the other hand, the values with A[i] > i remain 10 F. A. Louza et al. equal to NEXT[i] at the end of the algorithm. And we can use them to compute LA[i] = A[i] − i (Equation 2). Thus, after the completion of Step 4, we sequentially scan A[1, n] overwriting its values with LA as follows: (cid:40) LA[j] = 1 A[j] − j if A[j] < j otherwise. (6) The running time of our algorithm is still linear, since we added only a linear scan over A[1, n] at the end of Step 4. On the other hand, the working space is reduced to σ + O(1) words, since we need to store only the bucket array C[1, σ]. Theorem 3. The Lyndon array and the suffix array of a string of length n over an alphabet of size σ can be computed simultaneously in O(n) time using σ + O(1) (cid:117)(cid:116) words of working space. Note that the bounds on the working space given in the above theorems assume that the output consists of SA and LA. If one is interested in LA only, then the working space of the algorithm is n+σ +O(1) words which is still smaller that the working space of the other linear time algorithms that we discussed in Section 2. 4 Experiments We compared the performance of our algorithm, called SACA-K+LA, with algo- rithms to compute LA in linear time by Franek et al. [5,9] (NSV-Lyndon), Baier [1,6] (Baier-LA), and Louza et al. [15] (BWT-Lyndon). We also compared a version of Baier's algorithm that computes LA and SA together (Baier-LA+SA). We considered the three linear time alternatives of our algo- rithm described in Sections 3.1 -- 3.3. We tested all three versions since one could be interested in the fastest algorithm regardless of the space usage. We used four bytes for each computer word so the total space usage of our algorithms was respectively 17n, 13n and 9n bytes. We included also the performance of SACA-K [17] to evaluate the overhead added by the computation of LA in addition to the SA. The experiments were conducted on a machine with an Intel Xeon Pro- cessor E5-2630 v3 20M Cache 2.40-GHz, 384 GB of internal memory and a 13 TB SATA storage, under a 64 bits Debian GNU/Linux 8 (kernel 3.16.0- 4) OS. We implemented our algorithms in ANSI C. The time was measured with clock() function of C standard libraries and the memory was mea- sured using malloc_count library6. The source-code is publicly available at https://github.com/felipelouza/lyndon-array/. We used string collections from the Pizza & Chili dataset7. In particular, the datasets einstein-de, kernel, fib41 and cere are highly repetitive texts8, and 6 https://github.com/bingmann/malloc_count 7 http://pizzachili.dcc.uchile.cl/texts.html 8 http://pizzachili.dcc.uchile.cl/repcorpus.html Inducing the Lyndon Array 11 LA LA and SA SA ] 6 , 1 [ - n o d n y L - V S σ n/220 N ] 9 [ ] 6 , 1 [ n 7 1 - A L + K A C A S 0.26 0.46 0.52 0.69 0.84 0.89 0.57 0.53 0.66 0.43 0.05 Table 1. Running time (µs/input byte). A S + A L - r e i a B 0.26 0.37 0.42 0.43 0.57 0.66 0.39 0.38 0.18 0.17 0.03 A L - r e i a B 0.20 0.28 0.31 0.28 0.39 0.40 0.28 0.29 0.07 0.09 0.02 ] 5 1 [ n o d n y L - T W B 0.20 0.32 0.35 0.49 0.56 0.53 0.38 0.39 0.45 0.33 0.05 133 230 97 16 239 27 117 160 2 5 2 53 201 282 385 1,047 1,129 88 246 256 440 100 0.15 0.26 0.29 0.39 0.46 0.44 0.34 0.29 0.34 0.27 0.04 - n 3 1 - A L + K A C A S 0.22 0.41 0.47 0.60 0.74 0.69 0.54 0.47 0.57 0.41 0.04 n 9 - A L + K A C A S - 0.18 0.34 0.38 0.52 0.60 0.58 0.44 0.38 0.46 0.35 0.03 ] 7 1 [ - K A C A S 0.13 0.24 0.27 0.36 0.42 0.40 0.31 0.26 0.32 0.25 0.03 dataset pitches sources xml dna english.1GB proteins einstein-de kernel fib41 cere bbba the english.1G is the first 1GB of the original english dataset. We also created an artificial repetitive dataset, called bbba, consisting of a string T with 100× 220 copies of b followed by one occurrence of a, that is, T = bn−2a$. This dataset represents a worst-case input for the algorithms that use a stack (NSV-Lyndon and BWT-Lyndon). Table 1 shows the running time of each algorithm in µs/input byte. The results show that our algorithm is competitive in practice. In particular, the version SACA-K+LA-9n was only about 1.35 times slower than the fastest al- gorithm (Baier-LA) for non-repetitive datasets, and 2.92 times slower for repet- itive datasets. Also, the performance of SACA-K+LA-9n and Baier-LA+SA were very similar. Finally, the overhead of computing LA in addition to SA was small: SACA-K+LA-9n was 1.42 times slower than SACA-K, whereas Baier-LA+SA was 1.55 times slower than Baier-LA, on average. Note that SACA-K+LA-9n was consistently faster than SACA-K+LA-13n and SACA-K+LA-17n, so using more space does not yield any advantage. Table 2 shows the peak space consumed by each algorithm given in bytes per in- put symbol. The smallest values were obtained by NSV-Lyndon, BWT-Lyndon and SACA-K+LA-9n. In details, the space used by NSV-Lyndon and BWT-Lyndon was 9n bytes plus the space used by the stack. The stack space was negligible (about 10KB) for almost all datasets, except for bbba where the stack used 4n bytes for NSV-Lyndon and 8n bytes for BWT-Lyndon (the 12 F. A. Louza et al. LA LA and SA SA ] 9 [ - n 7 1 - A L + K A C A σ S 17 133 17 230 17 97 17 16 17 239 17 27 17 117 17 160 17 2 17 5 2 17 Table 2. Peak space (bytes/input size). n o d n y L - V S n/220 N 9 9 9 9 9 9 9 9 9 9 13 53 201 282 385 1,047 1,129 88 246 256 440 100 ] 5 1 [ n o d n y L - T W B 9 9 9 9 9 9 9 9 9 9 17 ] 6 , 1 [ A L - r e i a B 17 17 17 17 17 17 17 17 17 17 17 ] 6 , 1 [ A S + A L - r e i a B 17 17 17 17 17 17 17 17 17 17 17 - n 3 1 - A L + K A C A S 13 13 13 13 13 13 13 13 13 13 13 n 9 - A L + K A C A S - 9 9 9 9 9 9 9 9 9 9 9 ] 7 1 [ - K A C A S 5 5 5 5 5 5 5 5 5 5 5 dataset pitches sources xml dna english.1GB proteins einstein-de kernel fib41 cere bbba number of stack entries is the same, but each stack entry consists of a pair of integers). On the other hand, our algorithm, SACA-K+LA-9n, used exactly 9n + 1024 bytes for all datasets. 5 Conclusions We have introduced an algorithm for computing simultaneously the suffix array and Lyndon array (LA) of a text using induced suffix sorting. The most space- economical variant of our algorithm uses only n + σ + O(1) words of working space making it the most space economical LA algorithm among the ones running in linear time; this includes both the algorithm computing the SA and LA and the ones computing only the LA. The experiments have shown our algorithm is only slightly slower than the available alternatives, and that computing the SA is usually the most expensive step of all linear time LA construction algorithms. A natural open problem is to devise a linear time algorithm to construct only the LA using o(n) words of working space. Inducing the Lyndon Array 13 Acknowledgments The authors thank Uwe Baier for kindly providing the source codes of algorithms Baier-LA and Baier-LA+SA, and Prof. Nalvo Almeida for granting access to the machine used for the experiments. Funding: F.A.L. was supported by the grant #2017/09105-0 from the São Paulo Research Foundation (FAPESP). G.M. was partially supported by PRIN grant 2017WR7SHH, by INdAM-GNCS Project 2019 Innovative methods for the solution of medical and biological big data and by the LSBC_19-21 Project from the University of Eastern Piedmont. S.M. and M.S. are partially supported by MIUR-SIR project CMACBioSeq Combinatorial methods for analysis and compression of biological sequences grant n. RBSI146R5L. G.P.T. acknowledges the support of Brazilian agencies Conselho Nacional de Desenvolvimento Científico e Tecnológico (CNPq) and Coordenação de Aperfeiçoamento de Pessoal de Nível Superior (CAPES). References 1. Baier, U.: Linear-time suffix sorting -- a new approach for suffix array construction. In: Proc. Annual Symposium on Combinatorial Pattern Matching (CPM). pp. 23:1 -- 23:12 (2016) 2. Bannai, H., I, T., Inenaga, S., Nakashima, Y., Takeda, M., Tsuruta, K.: The "runs" theorem. SIAM J. Comput. 46(5), 1501 -- 1514 (2017) 3. Crochemore, M., Russo, L.M.: Cartesian and Lyndon trees. Theoretical Computer Science (2018). https://doi.org/10.1016/j.tcs.2018.08.011 4. Fischer, J.: Inducing the LCP-Array. In: Proc. Workshop on Algorithms and Data Structures (WADS). pp. 374 -- 385 (2011) 5. Franek, F., Islam, A.S.M.S., Rahman, M.S., Smyth, W.F.: Algorithms to compute the Lyndon array. In: Proc. PSC. pp. 172 -- 184 (2016) 6. Franek, F., Paracha, A., Smyth, W.F.: The linear equivalence of the suffix array and the partially sorted Lyndon array. In: Proc. PSC. pp. 77 -- 84 (2017) 7. Goto, K., Bannai, H.: Simpler and faster Lempel Ziv factorization. In: 2013 Data Compression Conference, DCC 2013, Snowbird, UT, USA, March 20-22, 2013. pp. 133 -- 142 (2013) 8. Goto, K., Bannai, H.: Space efficient linear time Lempel-Ziv factorization for small alphabets. In: Proc. IEEE Data Compression Conference (DCC). pp. 163 -- 172 (2014) 9. Hohlweg, C., Reutenauer, C.: Lyndon words, permutations and trees. Theor. Com- put. Sci. 307(1), 173 -- 178 (2003) 10. Itoh, H., Tanaka, H.: An efficient method for in memory construction of suffix arrays. In: Proceedings of the sixth Symposium on String Processing and Information Retrieval (SPIRE '99). pp. 81 -- 88. IEEE Computer Society Press (1999) 11. Ko, P., Aluru, S.: Space efficient linear time construction of suffix arrays. In: Proc. 14th Symposium on Combinatorial Pattern Matching (CPM '03). pp. 200 -- 210. Springer-Verlag LNCS n. 2676 (2003) 12. Kolpakov, R.M., Kucherov, G.: Finding maximal repetitions in a word in linear time. In: Proc. FOCS. pp. 596 -- 604 (1999) 14 F. A. Louza et al. 13. Louza, F.A., Gog, S., Telles, G.P.: Inducing enhanced suffix arrays for string collections. Theor. Comput. Sci. 678, 22 -- 39 (2017) 14. Louza, F.A., Gog, S., Telles, G.P.: Optimal suffix sorting and LCP array construction for constant alphabets. Inf. Process. Lett. 118, 30 -- 34 (2017) 15. Louza, F.A., Smyth, W.F., Manzini, G., Telles, G.P.: Lyndon array construction during Burrows-Wheeler inversion. J. Discrete Algorithms 50, 2 -- 9 (2018) 16. Manber, U., Myers, G.: Suffix arrays: a new method for on-line string searches. SIAM Journal on Computing 22(5), 935 -- 948 (1993) 17. Nong, G.: Practical linear-time O(1)-workspace suffix sorting for constant alphabets. ACM Trans. Inf. Syst. 31(3), 15 (2013) 18. Nong, G., Zhang, S., Chan, W.H.: Two efficient algorithms for linear time suffix array construction. IEEE Trans. Comput. 60(10), 1471 -- 1484 (2011) 19. Nong, G., Zhang, S., Chan, W.H.: Linear suffix array construction by almost pure induced-sorting. In: Proc. IEEE Data Compression Conference (DCC). pp. 193 -- 202 (2009) 20. Ohlebusch, E.: Bioinformatics Algorithms: Sequence Analysis, Genome Rearrange- ments, and Phylogenetic Reconstruction. Oldenbusch Verlag (2013) 21. Okanohara, D., Sadakane, K.: A linear-time Burrows-Wheeler transform using induced sorting. In: Proc. International Symposium on String Processing and Information Retrieval (SPIRE). pp. 90 -- 101 (2009) 22. Vuillemin, J.: A unifying look at data structures. Commun. ACM 23(4), 229 -- 239 (1980)
1707.02033
1
1707
2017-07-07T04:31:33
Networked Fairness in Cake Cutting
[ "cs.DS", "cs.AI", "cs.GT" ]
We introduce a graphical framework for fair division in cake cutting, where comparisons between agents are limited by an underlying network structure. We generalize the classical fairness notions of envy-freeness and proportionality to this graphical setting. Given a simple undirected graph G, an allocation is envy-free on G if no agent envies any of her neighbor's share, and is proportional on G if every agent values her own share no less than the average among her neighbors, with respect to her own measure. These generalizations open new research directions in developing simple and efficient algorithms that can produce fair allocations under specific graph structures. On the algorithmic frontier, we first propose a moving-knife algorithm that outputs an envy-free allocation on trees. The algorithm is significantly simpler than the discrete and bounded envy-free algorithm recently designed by Aziz and Mackenzie for complete graphs. Next, we give a discrete and bounded algorithm for computing a proportional allocation on descendant graphs, a class of graphs by taking a rooted tree and connecting all its ancestor-descendant pairs.
cs.DS
cs
Networked Fairness in Cake Cutting Xiaohui Bei ∗ Youming Qiao † Shengyu Zhang ‡ 7 1 0 2 l u J 7 ] S D . s c [ 1 v 3 3 0 2 0 . 7 0 7 1 : v i X r a Abstract We introduce a graphical framework for fair division in cake cutting, where comparisons between agents are limited by an underlying network structure. We generalize the classical fairness notions of envy-freeness and proportionality to this graphical setting. Given a simple undirected graph G, an allocation is envy-free on G if no agent envies any of her neighbor's share, and is proportional on G if every agent values her own share no less than the average among her neighbors, with respect to her own measure. These generalizations open new research directions in developing simple and efficient algorithms that can produce fair allocations under specific graph structures. On the algorithmic frontier, we first propose a moving-knife algorithm that outputs an envy-free allocation on trees. The algorithm is significantly simpler than the discrete and bounded envy-free algo- rithm recently designed in [3] for complete graphs. Next, we give a discrete and bounded algorithm for computing a proportional allocation on descendant graphs, a class of graphs by taking a rooted tree and connecting all its ancestor-descendant pairs. 1 Introduction In a nutshell, economics studies how resources are managed and allocated [13], and one of the most fun- damental targets is to achieve certain fairness in the allocation of resources. In a standard setting, different people have possibly different preferences on parts of a common resource, and a fair allocation aims to distribute the resource to the people so that everyone feels that she is treated "fairly". When the resource is divisible, the problem is also known as "cake cutting", and two of the most prominent fairness notions in this domain are envy-freenss and proportionality. Here an allocation is envy-free if no agent i envies any other agent j; formally, this requires that for all i, j ∈ [n], vi(Ai) ≥ vi(Aj), where vk is the valuation function of agent k and Ak is the part allocated to agent k. It is known that an envy-free allocatio always exists [7]. However, it is until recently that a finite-step procedure to find an envy-free allocation was proposed [3]. A weaker fairness solution concept is called proportionality, which requires that each agent gets at least the average of the total utility (with respect to her valuation). Envy-freeness implies proportionality, but not vice versa. When studying these fairness conditions, almost all previous works consider all (ordered) pairs of re- lations among agents. However, in many practical scenarios, the relations that need to be considered are restricted. Such restrictions are motivated from two perspectives: (1) the system often involves a large number of people with an underlying social network structure, and most people are not aware of their non- neighbors' allocation or even their existence. It is thus inefficient and sometimes meaningless to consider ∗Nanyang Technological University, Singapore. †University of Technology Sydney, Australia. ‡The Chinese University of Hong Kong, Hong Kong. 1 any potential envy between pairs of people who do not know each other; (2) institutional policies may intro- duce priorities among agents, and envies between agents of different priorities will not be considered toward unfairness. For example, when allocating network resources such as bandwidth to users, priorities will be given to users who paid a higher premium and they are expected to receive better shares even in a considered "fair" allocation. To capture the most salient aspect of the motivations above, in this paper, we initialize the study of fair cake cutting on graphs. Formally, we consider a graph G with vertices being the agents. An allocation is said to be envy-free on graph G if no agent envies any of her neighbors in the graph. An allocation is proportional on graph G if each agent gets at least the average of her neighbors' total allocation (with respect to her own valuation). By only considering the fairness conditions between connected pairs, the problem could potentially admit fair allocations with more desired properties such as efficiency, and lead to simpler and more efficient algorithms to produce them. With regard to envy-freeness, one can easily see that an envy-free allocation in the traditional definition is also an envy-free allocation on any graph. However, the algorithm to compute such a solution to the former [3] has extremely high complexity in terms of both the number of queries and the number of cuts it requires. One goal of this line of studies is to design simple and easy-to-implement algorithms for fair allocations on special graphs. It is easy to observe that (cf. Section 2.2), an envy-free allocation protocol on a connected graph G induces an envy-free protocol on any of its spanning trees. Therefore, trees form a first bottleneck to the design of envy-free algorithms for more sophisticated graph families. The first result we will show is an efficient moving-knife algorithm to find an envy-free allocation on an arbitrary tree, removing this bottleneck. The procedure allocates the cake from the tree root in a top-down fashion and is significantly simpler than the protocol proposed by Aziz et al. [3]. When the graph is more than a tree, the added edges significantly increase the difficulty of producing an envy-free allocation. However, if we lower the requirements and only aim at proportionality, then it is possible to go beyond trees. Note that though a proportional allocation can be produced for complete graphs by several algorithms, such globally proportional solutions may be no longer proportional on an incomplete graph. Our second result gives an discrete and efficient algorithm to find a proportional allocation on descendant graphs, a family of graphs that are generated from rooted trees by connecting all ancestor- descendant pairs in the tree. Descendant graphs are interesting from both practical and theoretical viewpoints (cf. Section 2.2). 1.1 Related Work Cake cutting has been a central topic in recource allocation for decades; see, e.g., [7,15,17]. As mentioned, envy-freeness and proportionality are two of the most prominent solution concepts for fairness consideration in this domain. An envy-free allocation always exists, even if only n − 1 cuts are allowed [18]. The computation of envy-free and proportional allocations has also received considerable attention, with a good number of discrete and continuous protocols designed for different settings [4–6, 8, 10, 14, 16, 17]. It had been a long standing open question to design a discrete and bounded envy-free protocol for n agents, until settled very recently by Aziz and Mackenzie [3]. For proportionality, much simpler algorithms are known that yield proportional allocations with a reasonable number of cuts. Even and Paz [12] gave a divide- and-conquer protocol that could produce a proportional allocation with O(n log n) cuts. Woeginger and Sgall [20] and Edmonds and Pruhs [11] later also showed a matching Ω(n log n) lower bound. The idea of restrictive relations, i.e., people comparing the allocation only with their peers, have also been considered in scenarios other than cake cutting. Chevaleyre et al. [9] proposed a negotiation framework with a topology structure, such that agents may only trade indivisible goods with their neighbors, and the 2 envy also could only happen between connected pairs. Todo et al. [19] generalized the envy-freeness to allow envies between groups of agents, and discussed the combinatorial auction mechanisms that satisfy these concepts. Shortly before our work, Abebe et al . [1] proposed the same notion of fairness on networks. Despite this, the paper and ours have completely different technical contents. Abebe et al . [1] shows that proportional allocations on networks do not satisfy any natural containment relations, characterizes the set of graphs for which a single-cutter protocol can produce an envy-free allocation, and analyzes the price of envy-freeness. In this paper, we focus on designing simple and efficient protocols for fair allocations on special classes of graphs. The graph families considered in these two papers are also different. 2 Our Framework In a cake cutting instance, there are n agents to share a cake, which is represented by the interval [0, 1]. Each agent i has an integrable, non-negative density function vi : [0, 1] (cid:55)→ R. A piece S of the cake is the union An allocation of the cake is a partition of [0, 1] into n disjoint pieces, denoted by A = (A1, . . . , An), of finitely many disjoint intervals of [0, 1]. The valuation of agent i for a piece S is Vi(S) =(cid:82) such that agent i receives piece Ai, where all pieces are disjoint and(cid:83) S vi(x)dx. i Ai = [0, 1]. 2.1 Fairness Notions on Graphs First we review two classic fairness notions in resource allocation. Envy-Freeness. An allocation A is called envy-free if for all i (cid:54)= j, vi(Ai) ≥ vi(Aj). Proportionality. An allocation A is called proportional if for all i, vi(Ai) ≥ 1 n vi([0, 1]). To account for a graphical topology, we generalize the above definitions by assuming a network structure over all agents. That is, we assume an undirected simple graph G = (V, E) in which each vertex i represents an agent. Let N (i) be the set of neighbors of agent i in G. Definition 1 (Envy-free on networks). An allocation A is called envy-free on a network G = (V, E) if for all i and all j ∈ N (i), vi(Ai) ≥ vi(Aj). Definition 2 (Proportional on networks). An allocation A is called proportional on a network G if for all i, vi(Ai) ≥ 1N (i) j∈N (i) vi(Aj). (cid:80) Both definitions can be viewed as generalizations of the original fairness concepts, which correspond to the case of G being the complete graph. For envy-freeness, we have the following properties. Fact 1. Any allocation that is envy-free on a graph G is also envy-free on any subgraph G(cid:48) Corollary 1. An envy-free allocation is also envy-free on any graph G. ⊆ G. The corollary implies that the envy-free protocol recently proposed by Aziz and Mackenzie [3] would also give an envy-free allocation on any graph. However, the protocol is highly involved and requires a large number of queries and cuts, which naturally raises the question of designing simpler protocols for graphs with special properties. Goal 1: Design simple protocols that could produce envy-free allocations on certain types of graphs. 3 While envy-freeness is closed under the operation of edge removal, proportionality is not, as removing edges changes the set of neighbors and thus also the average of neighbors' values. Therefore, although a number of proportional protocols are known, they do not readily translate to proportional allocations on subgraphs in any straightforward way. At a first glance, even the existence of a proportional allocation on all graphs is not obvious. Interest- ingly, the existence can be guaranteed from that of an envy-free allocation, since any envy-free allocation is also proportional on the same network. Therefore an envy-free protocol for complete graphs would also produce a proportional allocation on any graph. In light of this, we turn to the quests for simpler proportional protocols on interesting graph families as in the envy-free case. Goal 2: Design simple protocols that could produce proportional allocations on certain types of graphs. 2.2 Motivations for the Two Graph Families In this paper we focus on two graph families, trees and descendant graphs. Note that for both envy-freeness and proportionality, we only need to consider connected graphs (since otherwise we can focus on the easiest connected component). Without an envy-free algorithm for trees, there would be no chance to design envy- free protocols for more complicated graph families (see Fact 1). For descendant graphs, recall that a descendant graph is obtained by connecting all ancestor-descendant pairs of a rooted tree (cf. Section 4 for a formal definition). Descendant graphs can be used to model the relations among members in an extended family, where each edge connects a pair of ancestor and descen- dant. It can also model the management hierarchy in a company, where each edge connects a superior and a subordinate. From a theoretical viewpoint, we note that for any undirected graph G, if we run a depth-first search, then all edges in G are either edges on the DFS tree T or a back edge of T . Thus G is a subgraph of the upward closure T uc of T , where T uc is obtained from T by connecting all (ancestor, descendant) pairs. Note that T uc is a descendant graph. Therefore, if there is an envy-free allocation protocol for the family of descendant graphs, then there is an envy-free allocation protocol for any graph. This indicates that envy-freeness for descendant graphs may be hard. Interestingly, if we relax to proportionality, we do get a protocol on this family, as shown in Section 4. 3 Envy-Freeness on Trees We first present an algorithm that produces an envy-free allocation on trees. The algorithm makes use of the Austin moving-knife procedure [2] as a subroutine. Given a rooted tree T , let T denote the number of vertices. For any vertex i in T , denote by T (i) the subtree rooted at vertex i. Definition 3 ( [2]). An Austin moving-knife procedure AUSTINCUT (i, j, n, S) takes two agents i, j, an integer n > 0 and a subset S of cake as input parameters, and outputs a partition of S into n parts, such that both agents value these n pieces as all equal, each of value exactly 1/n fraction of the value of S. An Austin procedure needs 2n cuts. It should be noted that this is a continuous procedure, and it is not known that whether it can be imple- mented by a discrete algorithm. With that being said, to the best of our knowledge, it is not known whether Austin's moving knife procedure can help to obtain an algorithm achieving envy-freeness (on complete graphs) that is simpler than the algorithm in [3]. 4 Now we are ready to present our allocation algorithm in Algorithm ALLOCATIONTREE, which calls a sub-procedure given in Algorithm ALGTREE. Among all remaining pieces of A1, . . . , An, pick T (i) pieces that agent i values the highest. Let Si denote the union of these T (i) pieces. Algorithm 1 ALGTREE (T, r, (A1, . . . , An)) Require: Tree T with root vertex r, size of tree n, an allocation A = (A1, . . . , An). 1: for each immediate child i of root r do 2: 3: 4: end for 5: Allocate the remaining one piece to r. 6: for each child i of root r do 7: 8: 9: end for Apply AUSTINCUT (i, r,T (i), Si) to divide Si into T (i) equal parts X1, . . . , XT (i) for i and r. Run ALGTREE (T (i), i, (X1, . . . , XT (i))). Algorithm 2 ALLOCATIONTREE (T, r) Require: Tree T with root vertex r. 1: Let r cut the cake into n = T equal parts (A1, . . . , An) with respect to her valuation. 2: Run ALGTREE (T, r, (A1, . . . , An)). Theorem 2. For any n-node tree T with root r, Algorithm ALLOCATIONTREE (T, r) outputs an allocation that is envy-free on T with O(n2) cuts. Proof. We will prove this by induction on the height of the tree. The base case is when the tree has only one vertex, the root r. In this case n = 1 and the algorithm simply gives the whole set A1 to r, and the envy-free property holds trivially. Now we assume that the theorem holds for trees of height d and will prove it for any tree T of height d + 1. First, the root r receives exactly 1/n as she cuts the cake into n equal pieces (in Algorithm ALLOCATIONTREE) and gets one of them (in line 5 of Algorithm ALGTREE). In addition, in r's valuation, each child i (of r) gets T (i)/n fraction of the total utility (the first for loop in Algorithm ALGTREE), and cuts it into T (i) equal pieces (with respect to r's valuation, in line 7 in Algorithm ALGTREE) and finally gets one of them. So r thinks that child i's share is also worth 1/n utility, same as hers. Thus r does not envy any of her children. Also note that all children of r pick pieces before r does, so each child i values her part Si at least T (i) times of what r gets. Then the second for loop in Algorithm ALGTREE cuts this part into T (i) equal pieces (with respect to child i's valuation, in line 7 in Algorithm ALGTREE). Since child i gets one of these pieces (in line 5 of the recursive call of Algorithm ALGTREE) she views this piece at least 1T (i) · T (i) = 1 times what r gets. Namely, child i does not envy root r. Among vertices inside each subtree rooted at child i of r, no envy occurs by the inductive hypothesis. Putting everything together, we can see that there is no envy between any pair of connected vertices. most 2n cuts. When each vertex u is being processed in ALGTREE, it makes at most(cid:80) Finally we analyze the number of cuts of the algorithm. Recall that AUSTINCUT (i, j, n, S) makes at i:child of u 2Ti ≤ 2n cuts. Thus in total the algorithm requires O(n2) cuts. 5 4 Proportionality on Descendant Graphs We first define descendant graphs formally. Definition 4. An undirected graph G = (V, E) is called a descendant graph on a rooted tree T , if T is a spanning tree of G, and there exists a vertex r such that for any two vertices i and j, (i, j) ∈ E if and only if (i, j) is an ancestor-descendant pair on tree T rooted at r. In other words, a descendant graph G of a rooted tree T can be obtained from T by connecting all of ancestor-descendant pairs. (a) a tree T with the topmost node being its root (b) the descendant graph on T Figure 1: A 7-node tree and its descendant graph We now present an algorithm that produces a proportional allocation on descendant graphs. The idea of the algorithm can be described as a process of collecting and distributing: We start with the root vertex holding the whole cake, and process the tree in top-down fashion. Each vertex v, when being processed, applies a three-step procedure. (1) Collect phase: agent v collects all cake pieces that she has received (from her ancestors); (2) Cut phase: agent v cuts these cakes into f (v) equal pieces according to her own evaluation, for some function f (v) to be defined later; (3) Distribute phase: let each descendant of v pick certain number of these pieces that they value the highest. To formally describe the algorithm, we shall need the following notation. For a vertex v ∈ T , let d(v) the number of edges on the unique path from v to the root), denote the depth of vertex v in tree T (i.e. d = maxv d(v) denote the depth of T . We then define a function f : T → N as (cid:18) d(v) + T (v) d(v) + 1 (cid:19) · d!. (1) f (v) = We first make some easy observations from this definition. • When d(v) ≥ 1, d(v) divides f (v). This guarantees that in the algorithm described below, each distribute step reallocates an integral number of slices. • f (r) = T · d! for root r of the tree. • f (v) = d! for every leaf v of the tree. 6 d(u) + 1 d(u)(d(u) + 1) d(u) = d(v)+1 . 1 g(u) d(u) u∈T (v) u(cid:54)=v u∈T (v) u(cid:54)=v (cid:18) (cid:32) . Thus g(v) = d(v)+T (v) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) u∈T (v) u(cid:54)=v u∈T (v) u(cid:54)=v u∈T (v) u(cid:54)=v d(u) + 1 (cid:80) (cid:88) (cid:88) u∈T (v) u(cid:54)=v 1 1 1 1 + + + = = = = + d(u) + 1 u∈T (v) u(cid:54)=v (cid:19) d(u) + 1 (cid:18) d(u) + T (u) (cid:19) (cid:33) T (u) u(cid:48)∈T (u) 1 (cid:88) (cid:88) u(cid:48)∈T (u) 1 d(u)(d(u) + 1) 1 d(u)(d(u) + 1) d(u) + 1 d(u)(d(u) + 1) u(cid:48)∈T (v) u(cid:48)(cid:54)=v u∈T (v) u(cid:54)=v u(cid:48)∈T (u) (cid:124) (cid:123)(cid:122) X . (cid:125) (cid:19) Now let us take a closer look at term X. Note that it is summed over all vertices u at the path between v(exclusive) and u(cid:48)(inclusive). These vertices have depth d(v)+1, d(v)+2, . . . , d(u(cid:48)) in tree T , respectively. Thus we have Proposition 3. Function f (v) satisfies f (v) = d! + (cid:88) u∈T (v) u(cid:54)=v f (u) d(u) (2) Proof. Define g(v) = f (v) d! For each vertex v, we have Plugging this back to the previous formula gives d(u(cid:48))(cid:88) X = d(u(cid:48))(cid:88) (cid:18) 1 1 k(k + 1) = 1 k + 1 k − k=d(v)+1 k=d(v)+1 = 1 d(v) + 1 − 1 d(u(cid:48)) + 1 . (cid:18) (cid:19) 1 d(v) + 1 − 1 d(u(cid:48)) + 1 (cid:88) u(cid:48)∈T (v) u(cid:48)(cid:54)=v 1 d(u) + 1 + (cid:88) (cid:88) u∈T (v) u(cid:54)=v u∈T (v) u(cid:54)=v = 1 d(v) + 1 = T (v) − 1 d(v) + 1 . 7 Therefore, (cid:88) u∈T (v) u(cid:54)=v 1 + To summarize, we just showed g(v) = 1 + g(u) d(u) = d(v) + T (v) d(v) + 1 = g(v). (cid:88) u∈T (v) u(cid:54)=v g(u) d(u) . Multiplying both sides by d! completes the proof. The proportional allocation algorithm is formally presented as below. Algorithm 3 ALGDESCENDANTGRAPH (G) Require: Descendant graph G of tree T and root vertex r, size of tree n, depth of tree d 1: for u ∈ T in increasing order of d(u) do 2: 3: 4: 5: // collect and cut phase: Let X u be the union of all cake pieces that vertex u possesses Slice X u into f (u) equal pieces X u // distribute phase: for v ∈ T (u) − {u} in increasing order of d(v) do Among all the remaining pieces of X u 1 , . . . , X u the highest. 1 , . . . X u end for 6: 7: end for f (u) according to u's evaluation function f (u), agent v takes f (v)/d(v) pieces that she values Figure 2 illustrates the f values and the execution of the algorithm on a simple 5-node tree. (a) f values (b) execution Figure 2: f values of and execution of Algorithm 3 on a simple 5-node tree. From the algorithm description and equations (1) and (2), it is easy to observe the following properties on the number of cake slices during the algorithm. Properties: 8 102422102411⇒2241111⇒22222 (1) Every agent v, except the root of the tree, received f (v) pieces of the cake in total from her ancestors. (2) Every agent will have exactly d! slices of cake in her possession after the algorithm terminates. Theorem 4. For any n-node descendant graph G of a tree, ALGDESCENDANTGRAPH (G) outputs an allocation that is proportional on G with at most n2 · d! cuts. Proof. First note that the root r cuts the cake into T · d! equal pieces and finally gets d! of them, so its value is 1/T fraction of that of the whole cake. As the root connects to all nodes in the graph, it achieves exactly the average of its neighbors. Now we consider an arbitrary node v of depth at least 1. Let N (v) be the set of v's neighbors. Further- more, let Na(v) be the set of v's ancestors in T , and Nd(v) the set of v's descendants in T . It is clear that N (v) = Na(v) ∪ Nd(v). Also note that, as G is a descendant graph, Nd(v) = T (v) \ {v}. i∈N (v) Ai, the union of all pieces of cake belonging to agents in N (v). Note that S consists of the following two components: Let Av be the final allocation of agent v at the end of the algorithm. We are interested in S =(cid:83) • Those held by v's ancestors: Each Au for u ∈ Na(v) contains d! slices from {X u are the leftover slices after the distribute phase of agent u. i }i=1,...,f (u). These • Those held by v's descendants:(cid:83) w∈Nd(v) Aw consists of two parts: 1. The slices from {X u u distributes(cid:80) Nd(v). For each u ∈ Na(v), each agent w ∈ Nd(v) picks f (w) i } distributed by agent u ∈ Na(v) in their distribute phase to agents in i }. In total, agent d(w) slices of cake to agents in Nd(v). From Eq (2), this number equals d(w) slices from {X u w∈Nd(v) f (w) to f (v) − d!. Note that X v comes from all ancestors u. 2. The f (v)− d! slices from {X v i } distributed by agent v in her distribute phase to her descendants. Note that each ancestor u of v has her collection X u distributed first to v, then to v's descendants, and u, respectively. Agent v later distributes exactly v to herself. Let us denote these two parts vv, respectively. To avoid potential confusion of notation, we use αv to denote the valuation finally to u herself. Denote these parts by Su f (v)−d! f (v) by Su function of agent v. We will show the following inequality. v , Su v to its descents, and keeps d! d and Su f (v) fraction of Su fraction of Su vd and Su αv(Su vv) ≥ αv(Su d ) + αv(Su u ) + αv(Su d(v) + T (v) − 1 vd) . (3) Once this is shown for all ancestors u of v, we can sum these inequalities over all ancestors u and obtain where we used the facts that αv(Av) ≥ αv(Sa) + αv(Sd) + αv(Svd) d(v) + T (v) − 1 , (4) • Av = (cid:93)uSu ancestors u of v. vv is what v finally has, where the notation (cid:93)u stands for the disjoint union over all 9 • Sa = (cid:93)uSu • Sd = (cid:93)uSu • Svd = (cid:93)uSu u is the part of cake that v's ancestors collectively have, d is the set of pieces that v's ancestors give to v's descendants, and vd is the set of pieces that v gives to its descendants. Note that the numerator in the right hand side of Eq. (4) is exactly the total value of N (v), and the denomi- nator is exactly the size of N (v). Thus the inequality is actually as the proportionality requires. αv(Av) ≥ αv(N (v))/N (v), So it remains to prove Eq. (3). We will examine the four sets involved in this inequality one by one, and represent or bound them all in terms of αv(Su v ). vv) = αv(Su v ) · d!/f (v), as v divides Su v into f (v) equal pieces and takes d! of them. f (v)/d(v), as v takes f (v)/d(v) pieces of {X u i : i ∈ [f (u)]} before u is left with d! pieces. • αv(Su • αv(Su u ) v ) d! ≤ αv(Su f (v)−d! ≤ αv(Su tively take (f (v) − d!) pieces. αv(Su d ) v ) • f (v)/d(v), as v takes f (v)/d(v) pieces of {X u i : i ∈ [f (u)]} before its descendants collec- • αv(Su vd) = αv(Su them to descendants. v ) · (f (v) − d!)/f (v) as v divides Su v into f (v) equal pieces and pass (f (v) − d!) of Putting these four (in)equalities and the definition of f (v) in Eq. (1) together, one can easily verify Eq. (3). This completes the proof of the proportionality. For the number of cuts, each agent v, when being processed, makes f (v) cuts in the cut phase. In total the algorithm requires(cid:80) v f (v) ≤ n · f (r) ≤ n2 · d! cuts. Note that though the number of cuts required here is exponential, this singly exponential bound is much better than the one for the general protocol in [3]. 5 Conclusion This paper introduces a graphical framework for fair allocation of divisible good, defines envy-freeness and proportionality on a graph, and proposes an envy-free allocation algorithm on trees and a proportional allocation algorithm on descendant graphs. The framework opens new research directions in developing simple and efficient algorithms that produce fair allocations under important special graph structures. Acknowledgments We thank Ariel Procaccia and Nisarg Shah for pointing out [9,19], and an anonymous reviewer for pointing out [1] to us. This work was supported by Australian Research Council DECRA DE150100720 and Research Grants Council of the Hong Kong S.A.R. (Project no. CUHK14239416). 10 References [1] Rediet Abebe, Jon Kleinberg, and David C Parkes. Fair division via social comparison. In Proceedings of the 16th Conference on Autonomous Agents and MultiAgent Systems, pages 281–289. International Foundation for Autonomous Agents and Multiagent Systems, 2017. [2] AK Austin. Sharing a cake. The Mathematical Gazette, 66(437):212–215, 1982. [3] Haris Aziz and Simon Mackenzie. A discrete and bounded envy-free cake cutting protocol for any number of agents. FOCS, 2016. [4] Haris Aziz and Simon Mackenzie. A discrete and bounded envy-free cake cutting protocol for four agents. STOC, 2016. [5] Julius B Barbanel and Steven J Brams. Cake division with minimal cuts: envy-free procedures for three persons, four persons, and beyond. Mathematical Social Sciences, 48(3):251–269, 2004. [6] Steven J Brams and Alan D Taylor. An envy-free cake division protocol. American Mathematical Monthly, 102(1):9–18, 1995. [7] Steven J Brams and Alan D Taylor. Fair Division: From cake-cutting to dispute resolution. Cambridge University Press, 1996. [8] Steven J Brams, Alan D Taylor, and William Zwicker. A moving-knife solution to the four-person envy-free cake-division problem. Proceedings of the american mathematical society, 125(2):547–554, 1997. [9] Yann Chevaleyre, Ulle Endriss, Nicolas Maudet, et al. Allocating goods on a graph to eliminate envy. Institute for Logic, Language and Computation (ILLC), University of Amsterdam, 2007. [10] Lester E Dubins and Edwin H. Spanier. How to cut a cake fairly. American Mathematical Monthly, 68:1–17, 1961. [11] Jeff Edmonds and Kirk Pruhs. Cake cutting really is not a piece of cake. In Proceedings of the sev- enteenth annual ACM-SIAM symposium on Discrete algorithm, pages 271–278. Society for Industrial and Applied Mathematics, 2006. [12] Shimon Even and Azaria Paz. A note on cake cutting. Discrete Applied Mathematics, 7(3):285–296, 1984. [13] N. Gregory Mankiw. Principles of Microeconomics. Cengage Learning, 2014. [14] Ariel D Procaccia. Thou shalt covet thy neighbor's cake. In IJCAI, volume 9, pages 239–244, 2009. [15] Ariel D Procaccia. Cake cutting: Not just child's play. Communications of the ACM, 2013. [16] Ariel D Procaccia. Cake cutting algorithms. In Handbook of Computational Social Choice, chapter 13. Citeseer, 2015. [17] Jack Robertson and William Webb. Cake-Cutting Algorithms: Be Fair if You Can. Peters/CRC Press, 1998. 11 [18] Francis Edward Su. Rental harmony: Sperner's lemma in fair division. American Mathematical Monthly, pages 930–942, 1999. [19] Taiki Todo, Runcong Li, Xuemei Hu, Takayuki Mouri, Atsushi Iwasaki, and Makoto Yokoo. General- izing envy-freeness toward group of agents. In IJCAI Proceedings-International Joint Conference on Artificial Intelligence, volume 22, page 386, 2011. [20] Gerhard J Woeginger and Jir´ı Sgall. On the complexity of cake cutting. Discrete Optimization, 4(2):213–220, 2007. 12
1201.2501
2
1201
2012-04-06T17:18:56
Nearly Optimal Sparse Fourier Transform
[ "cs.DS" ]
We consider the problem of computing the k-sparse approximation to the discrete Fourier transform of an n-dimensional signal. We show: * An O(k log n)-time randomized algorithm for the case where the input signal has at most k non-zero Fourier coefficients, and * An O(k log n log(n/k))-time randomized algorithm for general input signals. Both algorithms achieve o(n log n) time, and thus improve over the Fast Fourier Transform, for any k = o(n). They are the first known algorithms that satisfy this property. Also, if one assumes that the Fast Fourier Transform is optimal, the algorithm for the exactly k-sparse case is optimal for any k = n^{\Omega(1)}. We complement our algorithmic results by showing that any algorithm for computing the sparse Fourier transform of a general signal must use at least \Omega(k log(n/k)/ log log n) signal samples, even if it is allowed to perform adaptive sampling.
cs.DS
cs
Nearly Optimal Sparse Fourier Transform Haitham Hassanieh Piotr Indyk Dina Katabi MIT MIT MIT Eric Price MIT {haithamh,indyk,dk,ecprice}@mit.edu Abstract We consider the problem of computing the k-sparse approximation to the discrete Fourier transform of an n- dimensional signal. We show: • An O(k log n)-time randomized algorithm for the case where the input signal has at most k non-zero Fourier coefficients, and • An O(k log n log(n/k))-time randomized algorithm for general input signals. Both algorithms achieve o(n log n) time, and thus improve over the Fast Fourier Transform, for any k = o(n). They are the first known algorithms that satisfy this property. Also, if one assumes that the Fast Fourier Transform is optimal, the algorithm for the exactly k-sparse case is optimal for any k = nΩ(1). We complement our algorithmic results by showing that any algorithm for computing the sparse Fourier trans- form of a general signal must use at least Ω(k log(n/k)/ log log n) signal samples, even if it is allowed to perform adaptive sampling. 1 Introduction The discrete Fourier transform (DFT) is one of the most important and widely used computational tasks. Its applications are broad and include signal processing, communications, and audio/image/video compression. Hence, fast algorithms for DFT are highly valuable. Currently, the fastest such algorithm is the Fast Fourier Transform (FFT), which computes the DFT of an n-dimensional signal in O(n log n) time. The existence of DFT algorithms faster than FFT is one of the central questions in the theory of algorithms. A general algorithm for computing the exact DFT must take time at least proportional to its output size, i.e., Ω(n). In many applications, however, most of the Fourier coefficients of a signal are small or equal to zero, i.e., the output of the DFT is (approximately) sparse. This is the case for video signals, where a typical 8x8 block in a video frame has on average 7 non-negligible frequency coefficients (i.e., 89% of the coefficients are negligible) [CGX96]. Images and audio data are equally sparse. This sparsity provides the rationale underlying compression schemes such as MPEG and JPEG. Other sparse signals appear in com- putational learning theory [KM91, LMN93], analysis of Boolean functions [KKL88, O’D08], compressed sensing [Don06, CRT06], multi-scale analysis [DRZ07], similarity search in databases [AFS93], spectrum sensing for wideband channels [LVS11], and datacenter monitoring [MNL10]. For sparse signals, the Ω(n) lower bound for the complexity of DFT no longer applies. If a signal has a small number k of non-zero Fourier coefficients – the exactly k-sparse case – the output of the Fourier transform can be represented succinctly using only k coefficients. Hence, for such signals, one may hope for a DFT algorithm whose runtime is sublinear in the signal size, n. Even for a general n-dimensional signal x – the general case – one can find an algorithm that computes the best k-sparse approximation of its Fourier satisfies the following ℓ2/ℓ2 guarantee: transform,bx, in sublinear time. The goal of such an algorithm is to compute an approximation vectorbx′ that (1) kbx −bx′k2 ≤ C min k-sparse y kbx − yk2, 1 where C is some approximation factor and the minimization is over k-sparse signals. We allow the algorithm to be randomized, and only succeed with constant (say, 2/3) probability. The past two decades have witnessed significant advances in sublinear sparse Fourier algorithms. The first such algorithm (for the Hadamard transform) appeared in [KM91] (building on [GL89]). Since then, several sublinear sparse Fourier algorithms for complex inputs have been discovered [Man92, GGI+02, AGS03, GMS05, Iwe10, Aka10, HIKP12b]. These algorithms provide1 the guarantee in Equation (1).2 The main value of these algorithms is that they outperform FFT’s runtime for sparse signals. For very sparse signals, the fastest algorithm is due to [GMS05] and has O(k logc(n) log(n/k)) runtime, for some3 c > 2. This algorithm outperforms FFT for any k smaller than Θ(n/ loga n) for some a > 1. For less sparse signals, the fastest algorithm is due to [HIKP12b], and has O(√nk log3/2 n) runtime. This algorithm outperforms FFT for any k smaller than Θ(n/ log n). Despite impressive progress on sparse DFT, the state of the art suffers from two main limitations: 1. None of the existing algorithms improves over FFT’s runtime for the whole range of sparse signals, i.e., k = o(n). 2. Most of the aforementioned algorithms are quite complex, and suffer from large “big-Oh” constants (the algorithm of [HIKP12b] is an exception, but has a running time that is polynomial in n). In this paper, we address these limitations by presenting two new algorithms for the sparse Fourier Results. transform. We require that the length n of the input signal is a power of 2. We show: • An O(k log n)-time algorithm for the exactly k-sparse case, and • An O(k log n log(n/k))-time algorithm for the general case. The key property of both algorithms is their ability to achieve o(n log n) time, and thus improve over the FFT, for any k = o(n). These algorithms are the first known algorithms that satisfy this property. Moreover, if one assume that FFT is optimal and hence the DFT cannot be computed in less than O(n log n) time, the algorithm for the exactly k-sparse case is optimal4 as long as k = nΩ(1). Under the same assumption, the result for the general case is at most one log log n factor away from the optimal runtime for the case of “large” sparsity k = n/ logO(1) n. Furthermore, our algorithm for the exactly sparse case (depicted as Algorithm 3.1 on page 5) is quite sim- ple and has low big-Oh constants. In particular, our preliminary implementation of a variant of this algorithm is faster than FFTW, a highly efficient implementation of the FFT, for n = 222 and k ≤ 217 [HIKP12a]. In contrast, for the same signal size, prior algorithms were faster than FFTW only for k ≤ 2000 [HIKP12b].5 We complement our algorithmic results by showing that any algorithm that works for the general case must use at least Ω(k log(n/k)/ log log n) samples from x. The lower bound uses techniques from [PW11], which shows a lower bound of Ω(k log(n/k)) for the number of arbitrary linear measurements needed to compute the k-sparse approximation of an n-dimensional vectorbx. In comparison to [PW11], our bound is slightly worse but it holds even for adaptive sampling, where the algorithm selects the samples based on the values of the previously sampled coordinates.6 Note that our algorithms are non-adaptive, and thus limited by the more stringent lower bound of [PW11]. 1The algorithm of [Man92], as stated in the paper, addresses only the exactly k-sparse case. However, it can be extended to the general case using relatively standard techniques. 2All of the above algorithms, as well as the algorithms in this paper, need to make some assumption about the precision of the input; otherwise, the right-hand-side of the expression in Equation (1) contains an additional additive term. See Preliminaries for more details. 3The paper does not estimate the exact value of c. We estimate that c ≈ 3. 4One also needs to assume that k divides n. See Section 5 for more details. 5Note that both numbers (k ≤ 217 and k ≤ 2000) are for the exactly k-sparse case. The algorithm in [HIKP12b] can deal with the general case, but the empirical runtimes are higher. 6Note that if we allow arbitrary adaptive linear measurements of a vector bx, then its k-sparse approximation can be computed using only O(k log log(n/k)) samples [IPW11]. Therefore, our lower bound holds only where the measurements, although adaptive, are limited to those induced by the Fourier matrix. This is the case when we want to compute a sparse approximation to bx from samples of x. 2 Techniques – overview. We start with an overview of the techniques used in prior works. At a high level, sparse Fourier algorithms work by binning the Fourier coefficients into a small number of bins. Since the signal is sparse in the frequency domain, each bin is likely7 to have only one large coefficient, which can then be located (to find its position) and estimated (to find its value). The binning has to be done in sublinear time, and thus these algorithms bin the Fourier coefficients using an n-dimensional filter vector G that is concentrated both in time and frequency. That is, G is zero except at a small number of time coordinates, and its Fourier transform G is negligible except at a small fraction (about 1/k) of the frequency coordinates, representing the filter’s “pass” region. Each bin essentially receives only the frequencies in a narrow range corresponding to the pass region of the (shifted) filter G, and the pass regions corresponding to different bins are disjoint. In this paper, we use filters introduced in [HIKP12b]. Those filters (defined in more detail in Preliminaries) have the property that the value of G is “large” over a constant fraction of the pass region, referred to as the “super-pass” region. We say that a coefficient is “isolated” if it falls into a filter’s super-pass region and no other coefficient falls into filter’s pass region. Since the super-pass region of our filters is a constant fraction of the pass region, the probability of isolating a coefficient is constant. To achieve the stated running times, we need a fast method for locating and estimating isolated coef- ficients. Further, our algorithm is iterative, so we also need a fast method for updating the signal so that identified coefficients are not considered in future iterations. Below, we describe these methods in more detail. New techniques – location and estimation. Our location and estimation methods depends on whether we handle the exactly sparse case or the general case. In the exactly sparse case, we show how to estimate the position of an isolated Fourier coefficient using only two samples of the filtered signal. Specifically, we show that the phase difference between the two samples is linear in the index of the coefficient, and hence we can recover the index by estimating the phases. This approach is inspired by the frequency offset estimation in orthogonal frequency division multiplexing (OFDM), which is the modulation method used in modern wireless technologies (see [HT01], Chapter 2). In order to design an algorithm8 for the general case, we employ a different approach. Specifically, we can use two samples to estimate (with constant probability) individual bits of the index of an isolated coefficient. Similar approaches have been employed in prior work. However, in those papers, the index was recovered bit by bit, and one needed Ω(log log n) samples per bit to recover all bits correctly with constant probability. In contrast, in this paper we recover the index one block of bits at a time, where each block consists of O(log log n) bits. This approach is inspired by the fast sparse recovery algorithm of [GLPS10]. Applying this idea in our context, however, requires new techniques. The reason is that, unlike in [GLPS10], we do not have the freedom of using arbitrary “linear measurements” of the vector x, and we can only use the measurements induced by the Fourier transform.9 As a result, the extension from “bit recovery” to “block recovery” is the most technically involved part of the algorithm. Section 4.1 contains further intuition on this part. New techniques – updating the signal. The aforementioned techniques recover the position and the value of any isolated coefficient. However, during each filtering step, each coefficient becomes isolated only with constant probability. Therefore, the filtering process needs to be repeated to ensure that each coefficient is correctly identified. In [HIKP12b], the algorithm simply performs the filtering O(log n) times and uses the median estimator to identify each coefficient with high probability. This, however, would lead to a running time of O(k log2 n) in the k-sparse case, since each filtering step takes k log n time. One could reduce the filtering time by subtracting the identified coefficients from the signal. In this way, the number of non-zero coefficients would be reduced by a constant factor after each iteration, so the 7One can randomize the positions of the frequencies by sampling the signal in time domain appropriately [GGI+02, GMS05]. See Preliminaries for the description. 8We note that although the two-sample approach employed in our algorithm works in theory only for the exactly k-sparse case, our preliminary experiments show that using a few more samples to estimate the phase works surprisingly well even for general signals. 9In particular, the method of [GLPS10] uses measurements corresponding to a random error correcting code. 3 cost of the first iteration would dominate the total running time. Unfortunately, subtracting the recovered coefficients from the signal is a computationally costly operation, corresponding to a so-called non-uniform DFT (see [GST08] for details). Its cost would override any potential savings. In this paper, we introduce a different approach: instead of subtracting the identified coefficients from the signal, we subtract them directly from the bins obtained by filtering the signal. The latter operation can be done in time linear in the number of subtracted coefficients, since each of them “falls” into only one bin. Hence, the computational costs of each iteration can be decomposed into two terms, corresponding to filtering the original signal and subtracting the coefficients. For the exactly sparse case these terms are as follows: • The cost of filtering the original signal is O(B log n), where B is the number of bins. B is set to O(k′), where k′ is the the number of yet-unidentified coefficients. Thus, initially B is equal to O(k), but its value decreases by a constant factor after each iteration. • The cost of subtracting the identified coefficients from the bins is O(k). Since the number of iterations is O(log k), and the cost of filtering is dominated by the first iteration, the total running time is O(k log n) for the exactly sparse case. For the general case, we need to set k′ and B more carefully to obtain the desired running time. The cost of each iterative step is multiplied by the number of filtering steps needed to compute the location of the coefficients, which is Θ(log(n/B)). If we set B = Θ(k′), this would be Θ(log n) in most iterations, giving a Θ(k log2 n) running time. This is too slow when k is close to n. We avoid this by decreasing B more slowly and k′ more quickly. In the r-th iteration, we set B = k/poly(r). This allows the total number of bins to remain O(k) while keeping log(n/B) small—at most O(log log k) more than log(n/k). Then, by having k′ decrease according to k′ = k/rΘ(r) rather than k/2Θ(r), we decrease the number of rounds to O(log k/ log log k). Some careful analysis shows that this counteracts the log log k loss in the log(n/B) term, achieving the desired O(k log n log(n/k)) running time. Organization of the paper. In Section 2, we give notation and definitions used throughout the paper. Sec- tions 3 and 4 give our algorithm in the exactly k-sparse and the general case, respectively. Section 5 gives the reduction to the exactly k-sparse case from a k-dimensional DFT. Section 6 gives the sample complex- ity lower bound for the general case. Section 7 describes how to efficiently implement our filters. Finally, Section 8 discusses open problems arising from this work. 2 Preliminaries This section introduces the notation, assumptions, and definitions used in the rest of this paper. Notation. We use [n] to denote the set {1, . . . , n}, and define ω = e−2πi/n to be an nth root of unity. For any complex number a, we use φ(a) ∈ [0, 2π] to denote the phase of a. For a complex number a and a real positive number b, the expression a ± b denotes a complex number a′ such that a − a′ ≤ b. For a vector x ∈ Cn, its support is denoted by supp(x) ⊂ [n]. We use kxk0 to denote supp(x), the number of non-zero and the coordinate-wise product (x · y)i = xiyi, so dx · y =bx ∗by. When i ∈ Z is an index into an n-dimensional vector, sometimes we use i to denote minj≡i (mod n) j. 4 coordinates of x. Its Fourier spectrum is denoted bybx, with √n Xj∈[n] bxi = (x ∗ y)i = Xj∈[n] 1 ωijxj . xj yi−j For a vector of length n, indices should be interpreted modulo n, so x−i = xn−i. This allows us to define convolution Definitions. The paper uses two tools introduced in previous papers: (pseudorandom) spectrum permuta- tion [GGI+02, GMS05, GST08] and flat filtering windows [HIKP12b]. Definition 2.1. Suppose σ−1 exists mod n. We define the permutation Pσ,a,b by (Pσ,a,bx)i = xσ(i−a)ωσbi. 1 √n Xj∈[n] √n Xj∈[n] 1 = ωaσi 1 √n Xj∈[n] ωσ(i−b)j (Pσ,a,bx)j ωσ(i−b)j xσ(j−a)ωσbj ωiσ(j−a)xσ(j−a) B,δ,α) ∈ Rn × Rn is a flat window function with param- α log(n/δ)) andcG′ satisfies We also define πσ,b(i) = σ(i − b) mod n. Claim 2.2. \Pσ,a,bxπσ,b(i) =bxiωaσi. Proof. \Pσ,a,bxσ(i−b) = = i = 1 for i ≤ (1 − α)n/(2B) i = 0 for i ≥ n/(2B) i ∈ [0, 1] for all i < δ. =bxiωaσi. Definition 2.3. We say that (G,cG′) = (GB,δ,α,cG′ eters B ≥ 1, δ > 0, and α > 0 if supp(G) = O( B • cG′ • cG′ • cG′ • (cid:13)(cid:13)(cid:13)cG′ − bG(cid:13)(cid:13)(cid:13)∞ i /∈ [(1 − α)n/(2B), n/(2B)],cG′ The fact thatcG′ α log(n/δ)) time and for each i,cG′ The above notion corresponds to the (1/(2B), (1 − α)/(2B), δ, O(B/α log(n/δ))-flat window function In Section 7 we give efficient constructions of such window functions, where G can be i can be computed in O(log(n/δ)) time. Of course, for in [HIKP12b]. computed in O( B i ∈ {0, 1} can be computed in O(1) time. i takes ω(1) time to compute for i ∈ [(1− α)n/(2B), n/(2B)] will add some complexity to our algorithm and analysis. We will need to ensure that we rarely need to compute such values. A practical implementation might find it more convenient to precompute the window functions in a preprocessing stage, rather than compute them on the fly. We use the following lemma from [HIKP12b]: Lemma 2.4 (Lemma 3.6 of [HIKP12b]). If j 6= 0, n is a power of two, and σ is a uniformly random odd number in [n], then Pr[σj ∈ [−C, C] (mod n)] ≤ 4C/n. 5 Assumptions. Through the paper, we require that n, the dimension of all vectors, is an integer power of 2. simplify the bounds, we assume that L = nO(1); otherwise the log n term in the running time bound is replaced by log L. We also make the following assumptions about the precision of the vectorsbx: • For the exactly k-sparse case, we assume thatbxi ∈ {−L, . . . , L} for some precision parameter L. To • For the general case, we only achieve Equation (1) if kbxk2 ≤ nO(1) · mink-sparse y kbx − yk2. eral, for any parameter δ > 0 we can add δ kbxk2 to the right hand side of Equation (1) and run in time O(k log(n/k) log(n/δ)). In gen- 3 Algorithm for the exactly sparse case In this section we assumebxi ∈ {−L, . . . , L}, where L ≤ nc for some constant c > 0, andbx is k-sparse. We choose δ = 1/(4n2L). The algorithm (NOISELESSSPARSEFFT) is described as Algorithm 3.1. The algorithm has three functions: • HASHTOBINS. This permutes the spectrum of [x − z with Pσ,a,b, then “hashes” to B bins. The guarantee will be described in Lemma 3.3. k′-sparse, this function finds “most” of [x − z. • NOISELESSSPARSEFFTINNER. Given time-domain access to x and a sparse vectorbz such that [x − z is • NOISELESSSPARSEFFT. This iterates NOISELESSSPARSEFFTINNER until it findsbx exactly. We analyze the algorithm “bottom-up”, starting from the lower-level procedures. Analysis of NOISELESSSPARSEFFTINNER and HASHTOBINS. For any execution of NOISELESSS- PARSEFFTINNER, define the support S = supp(bx −bz). Recall that πσ,b(i) = σ(i − b) mod n. Define hσ,b(i) = round(πσ,b(i)B/n) and oσ,b(i) = πσ,b(i) − hσ,b(i)n/B. Note that therefore oσ,b(i) ≤ n/(2B). We will refer to hσ,b(i) as the “bin” that the frequency i is mapped into, and oσ,b(i) as the “offset”. For any i ∈ S define two types of events associated with i and S and defined over the probability space induced by σ and b: • “Collision” event Ecoll(i): holds iff hσ,b(i) ∈ hσ,b(S \ {i}), and • “Large offset” event Eof f (i): holds iff oσ,b(i) ≥ (1 − α)n/(2B). Claim 3.1. For any i ∈ S, the event Ecoll(i) holds with probability at most 4S/B. Proof. Consider distinct i, j ∈ S. By Lemma 2.4, Pr[hσ,b(i) = hσ,b(j)] ≤ Pr[πσ,b(i) − πσ,b(j) mod n ∈ [−n/B, n/B]] = Pr[σ(i − j) mod n ∈ [−n/B, n/B]] ≤ 4/B. By a union bound over j ∈ S, Pr[Ecoll(i)] ≤ 4 S /B. Claim 3.2. For any i ∈ S, the event Eof f (i) holds with probability at most α. Proof. Note that oσ,b(i) ≡ πσ,b(i) ≡ σ(i − b) (mod n/B). For any odd σ and any l ∈ [n/B], we have that Prb[σ(i − b) ≡ l (mod n/B)] = B/n. Since only αn/B offsets oσ,b(i) cause Eof f (i), the claim follows. 6 end procedure B,α,δ ∗ \Pσ,a,bz)jn/B for j ∈ [B] procedure HASHTOBINS(x,bz, Pσ,a,b, B, δ, α) Computebyjn/B for j ∈ [B], where y = GB,α,δ · (Pσ,a,bx) Computeby′ returnbu given bybuj = by′ procedure NOISELESSSPARSEFFTINNER(x, k′,bz, α) jn/B =byjn/B − ( \G′ Let B = k′/β, for sufficiently small constant β. Let δ = 1/(4n2L). Choose σ uniformly at random from the set of odd numbers in [n]. Choose b uniformly at random from [n]. jn/B. j. ⊲ φ(a) denotes the phase of a. end for 2π )) mod n. for j ∈ J do i ← σ−1(round(φ(a) n bu ← HASHTOBINS(x,bz, Pσ,0,b, B, δ, α). bu′ ← HASHTOBINS(x,bz, Pσ,1,b, B, δ, α). bw ← 0. Compute J = {j : buj > 1/2}. a ←buj/bu′ v ← round(buj). bwi ← v. return bw bz ← 0 for t ∈ 0, 1, . . . , log k do bz ←bz + NOISELESSSPARSEFFTINNER(x, kt,bz, αt). returnbz kt ← k/2t, αt ← Θ(2−t). end for end procedure procedure NOISELESSSPARSEFFT(x, k) end procedure Algorithm 3.1: Exact k-sparse recovery −oσ,b(i) \(G′ B,δ,α) \(x − z)i buj = Xhσ,b(i)=j Lemma 3.3. Suppose B divides n. The outputbu of HASHTOBINS satisfies ωaσi ± δ kbxk1 . Let ζ = {i ∈ supp(bz) Eof f (i)}. The running time of HASHTOBINS is O( B Proof. Define the flat window functions G = GB,δ,α andcG′ =cG′ by = \G · Pσ,a,bx = bG ∗ \Pσ,a,bx by′ =cG′ ∗ \Pσ,a,b(x − z) + (bG −cG′) ∗ \Pσ,a,bx B,δ,α. We have Therefore By Claim 2.2, the coordinates of \Pσ,a,bx andbx have the same magnitudes, just different ordering and phase. (cid:13)(cid:13)(cid:13)(bG −cG′) ∗ \Pσ,a,bx(cid:13)(cid:13)(cid:13)∞ ≤(cid:13)(cid:13)(cid:13)bG −cG′(cid:13)(cid:13)(cid:13)∞(cid:13)(cid:13)(cid:13) \Pσ,a,bx(cid:13)(cid:13)(cid:13)1 ≤ δ kbxk1 α log(n/δ)+kbzk0+ζ log(n/δ)). 7 and hence buj = by′ as desired. −l = jn/B = Xl<n/(2B)cG′ X πσ,b(i)−jn/B<n/(2B)cG′ = Xhσ,b(i)=jcG′ \(Pσ,a,b(x − z))jn/B+l ± δ kbxk1 \(x − z)iωaσi ± δ kbxk1 jn/B−πσ,b(i) −oσ,b(i) \(Pσ,a,b(x − z))πσ,b(i) ± δ kbxk1 We can compute HASHTOBINS via the following method: α log(n/δ)) time. α log(n/δ)) in O( B 3. Because B divides n, by the definition of the Fourier transform (see also Claim 3.7 of [HIKP12b]) we have 1. Compute y with kyk0 = O( B 2. Compute v ∈ CB given by vi =Pj yi+jB. byjn/B =bvj for all j. Hence we can compute it with a B-dimensional FFT in O(B log B) time. 4. For each coordinate i ∈ supp(bz), decreaseby n time, since computingcG′ Lemma 3.4. Consider any i ∈ S such that neither Ecoll(i) nor Eof f (i) holds. Let j = hσ,b(i). Then −oσ,b(i)bziωaσi. This takes O(kbzk0 +ζ log(n/δ)) −oσ,b(i) takes O(log(n/δ)) time if Eof f (i) holds and O(1) otherwise. B hσ,b(i) bycG′ Proof. We know that kbxk1 ≤ k kbxk∞ ≤ kL < nL. Then by Lemma 3.3 and Ecoll(i) not holding, Because Eof f (i) does not hold,cG′ −oσ,b(i) ± δnL. −oσ,b(i) = 1, so (2) and j ∈ J. Similarly, j)) n 2π ) = σi (mod n), round(φ(buj /bu′ round(buj) =bxi −bzi, buj = \(x − z)icG′ buj = \(x − z)i ± δnL. j = \(x − z)iωσi ± δnL bu′ j ) = −σi 2π Then because δnL < 1 ≤(cid:12)(cid:12)(cid:12) \(x − z)i(cid:12)(cid:12)(cid:12), the phase is n ± 2δnL. Thus φ(buj/bu′ and φ(bu′ Also, by Equation (2), round(buj) =bxi −bzi. Finally, round(buj) = bxi −bzi ≥ 1, so buj ≥ 1/2. Thus φ(buj) = 0 ± sin−1(δnL) = 0 ± 2δnL round(φ(buj/bu′ n ± 4δnL = σi 2π n (mod n). ) = σi 2π n ± 1/n by the choice of δ. Therefore j) = σi 2π j ∈ J. j) 8 For each invocation of NOISELESSSPARSEFFTINNER, let P be the the set of all pairs (i, v) for which 1/2. this observation with the following claim. Claim 3.5. For any j ∈ J we have j ∈ hσ,b(S). Therefore, J = P ≤ S. the command bwi ← v was executed. Claims 3.1 and 3.2 and Lemma 3.4 together guarantee that for each i ∈ S the probability that P does not contain the pair (i, (bx −bz)i) is at most 4S/B + α. We complement Proof. Consider any j /∈ hσ,b(S). From Equation (2) in the proof of Lemma 3.4 it follows that buj ≤ δnL < Lemma 3.6. Consider an execution of NOISELESSSPARSEFFTINNER, and let S = supp(bx−bz). If S ≤ k′, coordinate might not appear in P with the correct value, leading to an incorrect value of bwi. In fact, it might result in an arbitrary pair (i′, v′) being added to P , which in turn could lead to an incorrect value of bwi′ . By Claim 3.5 these are the only ways that bw can be assigned an incorrect value. Thus we have Proof. Let e denote the number of coordinates i ∈ S for which either Ecoll(i) or Eof f (i) holds. Each such E[kbx −bz − bwk0] ≤ 8(β + α)S. then Since E[e] ≤ (4S/B + α)S ≤ (4β + α)S, the lemma follows. kbx −bz − bwk0 ≤ 2e. Analysis of NOISELESSSPARSEFFT. Consider the tth iteration of the procedure, and define St = supp(bx− bz) wherebz denotes the value of the variable at the beginning of loop. Note that S0 = supp(bx) ≤ k. We also define an indicator variable It which is equal to 0 iff St/St−1 ≤ 1/8. If It = 1 we say the the tth iteration was not successful. Let γ = 8 · 8(β + α). From Lemma 3.6 it follows that Pr[It = 1 St−1 ≤ k/2t−1] ≤ γ. From Claim 3.5 it follows that even if the tth iteration is not successful, then St/St−1 ≤ 2. For any t ≥ 1, define an event E(t) that occurs iffPt i=1 Ii ≥ t/2. Observe that if none of the events E(1) . . . E(t) holds then St ≤ k/2t. Lemma 3.7. Let E = E(1)∪ . . .∪ E(λ) for λ = 1 + log k. Assume that (4γ)1/2 < 1/4. Then Pr[E] ≤ 1/3. Proof. Let t′ = ⌈t/2⌉. We have Pr[E(t)] ≤(cid:18) t ≤ 2tγt′ ≤ (4γ)t/2 t′(cid:19)γt′ 1 − (4γ)1/2 ≤ 1/4 · 4/3 = 1/3. (4γ)1/2 Pr[E] ≤Xt Pr[E(t)] ≤ Therefore Therefore Theorem 3.8. Supposebx is k-sparse with entries from {−L, . . . , L} for some known L = nO(1). Then the algorithm NOISELESSSPARSEFFT runs in expected O(k log n) time and returns the correct vectorbx with probability at least 2/3. Proof. The correctness follows from Lemma 3.7. The running time is dominated by O(log k) executions of HASHTOBINS. Assuming a correct run, in every round t we have kbzk0 ≤ kbxk0 + St ≤ k + k/2t ≤ 2k. E[{i ∈ supp(z) Eof f (i)}] ≤ αkbzk0 ≤ 2αk, α log(n/δ) + k + αk log(n/δ)) = α log n + k + αk log n). Setting α = Θ(2−t/2) and β = Θ(1), the expected running time in round t is so the expected running time of each execution of HASHTOBINS is O( B O( B O(2−t/2k log n + k + 2−t/2k log n). Therefore the total expected running time is O(k log n). 9 4 Algorithm for the general case This section shows how to achieve Equation (1) for C = 1 + ǫ. Pseudocode is in Algorithm 4.1 and 4.2. 4.1 Intuition Let S denote the “heavy” O(k/ǫ) coordinates ofbx. The overarching algorithm SPARSEFFT works by first “locating” a set L containing most of S, then “estimating”bxL to getbz. It then repeats on [x − z. We will show that each heavy coordinate has a large constant probability of both being in L and being estimated well. As a result, [x − z is probably nearly k/4-sparse, so we can run the next iteration with k → k/4. The later iterations then run faster and achieve a higher success probability, so the total running time is dominated by the time in the first iteration and the total error probability is bounded by a constant. In the rest of this intuition, we will discuss the first iteration of SPARSEFFT with simplified constants. k/4-sparse. The actual algorithm will involve a parameter α in each iteration, roughly guaranteeing that In this iteration, hashes are to B = O(k/ǫ) bins and, with 3/4 probability, we get bz so [x − z is nearly with 1 − √α probability, we getbz so [x − z is nearly √αk-sparse; the formal guarantee will be given by Lemma 4.8. For this intuition we only consider the first iteration where α is a constant. Location. As in the noiseless case, to locate the “heavy” coordinates we consider the “bins” computed by HASHTOBINS with Pσ,a,b. This roughly corresponds to first permuting the coordinates according to the (almost) pairwise independent permutation Pσ,a,b, partitioning the coordinates into B = O(k/ǫ) “bins” of n/B consecutive indices, and observing the sum of values in each bin. We get that each heavy coordinate i has a large constant probability that the following two events occur: no other heavy coordinate lies in the same bin, and only a small (i.e., O(ǫ/k)) fraction of the mass from non-heavy coordinates lies in the same bin. For such a “well-hashed” coordinate i, we would like to find its location τ = πσ,b(i) = σ(i − b) among the ǫn/k < n/k consecutive values that hash to the same bin. Let θ∗ j = 2π n (j + σb) (mod 2π). (3) τ = 2π n σi. In the noiseless case, we showed that the difference in phase in the bin using Pσ,0,b and so θ∗ τ plus a negligible O(δ) term. With noise this may not be true; however, we can say for using Pσ,1,b is θ∗ any β ∈ [n] that the difference in phase between using Pσ,a,b and Pσ,a+β,b, as a distribution over uniformly τ + ν with (for example) E[ν2] = 1/100 (all operations on phases modulo 2π). We random a ∈ [n], is βθ∗ can only hope to get a constant number of bits from such a “measurement”. So our task is to find τ within a region Q of size n/k using O(log(n/k)) “measurements” of this form. One method for doing so would be to simply do measurements with random β ∈ [n]. Then each mea- τ with at least 1 − E[ν 2] π2/16 > 3/4 probability. On the other hand, for j 6= τ and surement lies within π/4 of βθ∗ j ) is roughly uniformly distributed around the circle. As a result, each mea- as a distribution over β, β(θ∗ τ − θ∗ surement is probably more than π/4 away from βθ∗ j . Hence O(log(n/k)) repetitions suffice to distinguish among the n/k possibilities for τ. However, while the number of measurements is small, it is not clear how to decode in polylog rather than Ω(n/k) time. j j ∈ Qq} all lie within βw 2π To solve this, we instead do a t-ary search on the location for t = Θ(log n). At each of O(logt(n/k)) levels, we split our current candidate region Q into t consecutive subregions Q1, . . . , Qt, each of size w. Now, rather than choosing β ∈ [n], we choose β ∈ [ n 8w ]. By the upper bound on β, for each q ∈ [t] the values n ≤ π/4 of each other on the circle. On the other hand, if j − τ > 16w, {βθ∗ then β(θ∗ j ) will still be roughly uniformly distributed about the circle. As a result, we can check a single candidate element eq from each subregion: if eq is in the same subregion as τ, each measurement usually agrees in phase; but if eq is more than 16 subregions away, each measurement usually disagrees in phase. Hence with O(log t) measurements, we can locate τ to within O(1) consecutive subregions with failure probability 1/tΘ(1). The decoding time is O(t log t). τ − θ∗ 16w , n 10 procedure SPARSEFFT(x, k, ǫ, δ) end for end procedure Choose Br, kr, αr as in Theorem 4.9. Rest ← O(log( Br )) as in Lemma 4.8. αrkr for r ∈ [Rest] do R ← O(log k/ log log k) as in Theorem 4.9. for r ∈ [R] do bz(1) ← 0 Lr ← LOCATESIGNAL(x,bz(r), Br, αr, δ) bz(r+1) ←bz(r) + ESTIMATEVALUES(x,bz(r), 3kr, Lr, Br, δ, Rest). returnbz(R+1) procedure ESTIMATEVALUES(x,bz, k′, L, B, δ, Rest) bu(r) ← HASHTOBINS(x,bz, Pσ,ar,b, B, δ). bw ← 0 for i ∈ L do bwi ← medianrbu(r) end for J ← arg maxJ=k′ kbwJk2. return bwJ Choose ar, br ∈ [n] uniformly at random. Choose σr uniformly at random from the set of odd numbers in [n]. end for end procedure hσ,b(i)ω−arσi. ⊲ Separate median in real and imaginary axes. Algorithm 4.1: k-sparse recovery for general signals, part 1/2. This primitive LOCATEINNER lets us narrow down the candidate region for τ to a subregion that is a t′ = Ω(t) factor smaller. By repeating LOCATEINNER logt′ (n/k) times, LOCATESIGNAL can find τ precisely. The number of measurements is then O(log t logt(n/k)) = O(log(n/k)) and the decoding time is O(t log t logt(n/k)) = O(log(n/k) log n). Furthermore, the “measurements” (which are actually calls to HASHTOBINS) are non-adaptive, so we can perform them in parallel for all O(k/ǫ) bins, with O(log(n/δ)) average time per measurement. This gives O(k log(n/k) log(n/δ)) total time for LOCATESIGNAL. This lets us locate every heavy and “well-hashed” coordinate with 1/tΘ(1) = o(1) failure probability, so every heavy coordinate is located with arbitrarily high constant probability. Estimation. By contrast, estimation is fairly simple. As in Algorithm 3.1, we can estimate \(x − z)i as buhσ,b(i), where bu is the output of HASHTOBINS. Unlike in Algorithm 3.1, we now have noise that may cause a single such estimate to be poor even if i is “well-hashed”. However, we can show that for a random permutation Pσ,a,b the estimate is “good” with constant probability. ESTIMATEVALUES takes the median of Rest = O(log 1 ǫ ) such samples, getting a good estimate with 1 − ǫ/64 probability. Given a candidate set L of size k/ǫ, with 7/8 probability at most k/8 of the coordinates are badly estimated. On the other hand, with 7/8 probability, at least 7k/8 of the heavy coordinates are both located and well estimated. This suffices to show that, with 3/4 probability, the largest k elements J of our estimate bw contains good estimates of 3k/4 large coordinates, so \x − z − wJ is close to k/4-sparse. 4.2 Formal definitions As in the noiseless case, we define πσ,b(i) = σ(i − b) mod n, hσ,b(i) = round(πσ,b(i)B/n) and oσ,b(i) = πσ,b(i) − hσ,b(i)n/B. We say hσ,b(i) is the “bin” that frequency i is mapped into, and oσ,b(i) is the “offset”. 11 i = (i − 1)n/B for i ∈ [B]. procedure LOCATESIGNAL(x,bz, B, α, δ) Choose uniformly at random σ, b ∈ [n] with σ odd. Initialize l(1) Let w0 = n/B, t = log n, t′ = t/4, Dmax = logt′ (w0 + 1). Let Rloc = Θ(log1/α(t/α)) per Lemma 4.5. for D ∈ [Dmax] do end for L ← {π−1 return L end procedure l(D+1) ← LOCATEINNER(x,bz, B, δ, α, σ, β, l(D), w0/(t′)D−1, t, Rloc) σ,b(l(Dmax+1) ) j ∈ [B]} j ⊲ δ, α parameters for G, G′ ⊲ (l1, l1 + w), . . . , (lB, lB + w) the plausible regions. ⊲ B ≈ k/ǫ the number of bins ⊲ t ≈ log n the number of regions to split into. ⊲ Rloc ≈ log t = log log n the number of rounds to run procedure LOCATEINNER(x,bz, B, δ, α, σ, b, l, w, t, Rloc) Let s = Θ(α1/3). Let vj,q = 0 for (j, q) ∈ [B] × [t]. for r ∈ [Rloc] do Choose a ∈ [n] uniformly at random. Choose β ∈ { snt 4w , . . . , snt 2w } uniformly at random. j) for q ∈ [t] do for j ∈ [B] do bu ← HASHTOBINS(x,bz, Pσ,a,b, B, δ, α). bu′ ← HASHTOBINS(x,bz, Pσ,a+β,b, B, δ, α). cj ← φ(buj/bu′ mj,q ← lj + q−1/2 t w θj,q ← 2π(mj,q+σb) if min(βθj,q − cj , 2π − βθj,q − cj) < sπ then vj,q ← vj,q + 1 end if mod 2π n end for end for end for for j ∈ [B] do Q∗ ← {q ∈ [t] vj,q > Rloc/2} if Q∗ 6= ∅ then j ← minq∈Q∗ lj + q−1 l′ t w else l′ j ←⊥ end if end for return l′ end procedure Algorithm 4.2: k-sparse recovery for general signals, part 2/2. 12 We define h−1 σ,b(j) = {i ∈ [n] hσ,b(i) = j}. Define Err(x, k) = min k-sparse y kx − yk2 . 1 µ2 = ǫρ2/k In each iteration of SPARSEFFT, definebx′ =bx −bz, and let ρ2 = Err2(bx′, k) + δ2nkbxk2 S = {i ∈ [n] bx′ LOCATESIGNAL with probability 1 − O(α), when B = Ω( k induced by σ and b: • “Collision” event Ecoll(i): holds iff hσ,b(i) ∈ hσ,b(S \ {i}); • “Large offset” event Eof f (i): holds iff oσ,b(i) ≥ (1 − α)n/(2B); and Then S ≤ (1 + 1/ǫ)k = O(k/ǫ) and(cid:13)(cid:13)(cid:13)bx′ −bx′ i2 ≥ µ2} S(cid:13)(cid:13)(cid:13) αǫ ). 2 2 • “Large noise” event Enoise(i): holds iff(cid:13)(cid:13)(cid:13)bx′ h−1 σ,b(hσ,b(i))\S(cid:13)(cid:13)(cid:13) For any i ∈ S define three types of events associated with i and S and defined over the probability space 2 ≤ (1 + ǫ)ρ2. We will show that each i ∈ S is found by By Claims 3.1 and 3.2, Pr[Ecoll(i)] ≤ 4 S /B = O(α) and Pr[Eof f (i)] ≤ 2α for any i ∈ S. Claim 4.1. For any i ∈ S, Pr[Enoise(i)] ≤ 4α. Proof. For each j 6= i, Pr[hσ,b(j) = hσ,b(i)] ≤ Pr[σj − σi < n/B] ≤ 4/B by Lemma 2.4. Then 2 ≥ Err2(bx′, k)/(αB). The result follows by Markov’s inequality. E[(cid:13)(cid:13)(cid:13)bx′ h−1 σ,b(hσ,b(i))\S(cid:13)(cid:13)(cid:13) 2 2 ] ≤ 4(cid:13)(cid:13)(cid:13)bx′ [n]\S(cid:13)(cid:13)(cid:13) 2 2 /B We will show for i ∈ S that if none of Ecoll(i), Eof f (i), and Enoise(i) hold then SPARSEFFTINNER i with 1 − O(α) probability. recoversbx′ Lemma 4.2. Let a ∈ [n] uniformly at random, B divide n, and the other parameters be arbitrary in Then for any i ∈ [n] with j = hσ,b(i) and none of Ecoll(i), Eof f (i), or Enoise(i) holding, bu = HASHTOBINS(x,bz, Pσ,a,b, B, δ, α). Proof. Let cG′ = cG′ Lemma 3.3, B,δ,α. Let T = h−1 −oσ,b(i) = 1. By 2 ρ2 αB ] ≤ 2 E[(cid:12)(cid:12)(cid:12)buj −bx′ iωaσi(cid:12)(cid:12)(cid:12) σ,b(j) \ {i}. We have that T ∩ S = {} and cG′ iωaσi = Xi′∈TcG′ −oσ (i′)bx′ i′ ωaσi′(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ± δ kbxk1 . i′ )2 ≤(cid:13)(cid:13)(cid:13)cx′ T(cid:13)(cid:13)(cid:13) −oσ(i′)bx′ = Xi′∈T (cG′ i′ ωaσi′ 2 2 2 −oσ(i′)bx′ buj − bx′ Ea(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Xi′∈TcG′ 13 Because the σi′ are distinct for i′ ∈ T , we have by Parseval’s theorem Since X + Y 2 ≤ 2 X2 + 2 Y 2 for any X, Y , we get Tk2 2 + 2δ2 kbxk2 ] ≤ 2 kx′ Ea[(cid:12)(cid:12)(cid:12)buj −bx′ iωaσi(cid:12)(cid:12)(cid:12) 1 2 ≤ 2 Err2(bx′, k)/(αB) + 2δ2 kbxk2 ≤ 2ρ2/(αB). 1 4.3 Properties of LOCATESIGNAL In our intuition, we made a claim that if β ∈ [n/(16w), n/(8w)] uniformly at random, and i > 16w, then 2π n βi is “roughly uniformly distributed about the circle” and hence not concentrated in any small region. This is clear if β is chosen as a random real number; it is less clear in our setting where β is a random integer in this range. We now prove a lemma that formalizes this claim. Lemma 4.3. Let T ⊂ [m] consist of t consecutive integers, and suppose β ∈ T uniformly at random. Then for any i ∈ [n] and set S ⊂ [n] of l consecutive integers, Pr[βi mod n ∈ S] ≤ ⌈im/n⌉ (1 + ⌊l/i⌋)/t ≤ 1 t + im nt + lm nt + l it Proof. Note that any interval of length l can cover at most 1 + ⌊l/i⌋ elements of any arithmetic sequence of common difference i. Then {βi β ∈ T} ⊂ [im] is such a sequence, and there are at most ⌈im/n⌉ intervals an + S overlapping this sequence. Hence at most ⌈im/n⌉ (1 + ⌊l/i⌋) of the β ∈ [m] have βi mod n ∈ S. Hence Pr[βi mod n ∈ S] ≤ ⌈im/n⌉ (1 + ⌊l/i⌋)/t. Lemma 4.4. Let i ∈ S. Suppose none of Ecoll(i), Eof f (i), and Enoise(i) hold, and let j = hσ,b(i). Consider any run of LOCATEINNER with πσ,b(i) ∈ [lj, lj + w] . Let f > 0 be a parameter such that Ck αf ǫ for C larger than some fixed constant. Then πσ,b(i) ∈ [l′ Proof. Let τ = πσ,b(i) ≡ σ(i − b) (mod n), and for any j ∈ [n] define j, l′ B = . j + 4w/t] with probability at least 1 − tf Ω(Rloc), 2π n n σi. Let g = Θ(f 1/3), and C′ = Bαǫ k = Θ(1/g3). (j + σb) θ∗ j = (mod 2π) so θ∗ τ = 2π To get the result, we divide [lj, lj + w] into t “regions”, Qq = [lj + q−1 t w] for q ∈ [t]. We τ with 1 − g probability. This will imply that Qq gets will first show that in each round r, cj is close to βθ∗ a “vote,” meaning vj,q increases, with 1 − g probability for the q′ with τ ∈ Qq′. It will also imply that vj,q increases with only g probability when q − q′ > 3. Then Rloc rounds will suffice to separate the two with 1 − f −Ω(Rloc) probability. We get that with 1 − tf −Ω(Rloc) probability, the recovered Q∗ has q − q′ ≤ 3 for all q ∈ Q∗. If we take the minimum q ∈ Q∗ and the next three subregions, we find τ to within 4 regions, or 4w/t locations, as desired. t w, lj + q In any round r, definebu =bu(r) and a = ar. We have by Lemma 4.2 and that i ∈ S that µ2 2 E[(cid:12)(cid:12)(cid:12)buj − ωaσibx′ i(cid:12)(cid:12)(cid:12) = ρ2 ] ≤ 2 αB 2 C′ µ2 ≤ = 2k Bαǫ 2 C′bx′ i2. 14 Note that φ(ωaσi) = −aθ∗ τ . Thus for any p > 0, with probability 1 − p we have where kx − yk(cid:13) = minγ∈Z x − y + 2πγ denotes the “circular distance” between x and y. The analogous τ . Therefore with at least 1 − 2p probability, fact holds for φ(bu′ kcj − βθ∗ (cid:12)(cid:12)(cid:12)buj − ωaσibx′ i) − aθ∗ ) C′p i(cid:12)(cid:12)(cid:12) ≤r 2 C′p(cid:12)(cid:12)(cid:12)bx′ i(cid:12)(cid:12)(cid:12) τ )(cid:13)(cid:13)(cid:13)(cid:13) ≤ sin−1(r 2 τ(cid:13)(cid:13)(cid:13)(cid:13) τ )(cid:17) −(cid:16)φ(bu′ τ )(cid:13)(cid:13)(cid:13)(cid:13) +(cid:13)(cid:13)(cid:13)φ(bu′ j) − (φ(bx′ j) − (φ(bx′ i) − (a + β)θ∗ j) − βθ∗ (cid:13)(cid:13)(cid:13)φ(buj) − (φ(bx′ j) relative to φ(bx′ τk(cid:13) =(cid:13)(cid:13)(cid:13)φ(buj) − φ(bu′ =(cid:13)(cid:13)(cid:13)(cid:13)(cid:16)φ(buj ) − (φ(bx′ ≤(cid:13)(cid:13)(cid:13)φ(buj) − (φ(bx′ ≤ 2 sin−1(r 2 C′p ) i) − aθ∗ i) − aθ∗ i) − (a + β)θ∗ i) − (a + β)θ∗ τ )(cid:17)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) τ )(cid:13)(cid:13)(cid:13)(cid:13) by the triangle inequality. Thus for any s = Θ(g) and p = Θ(g), we can set C′ = that 2 p sin2(sπ/4) = Θ(1/g3) so kcj − βθ∗ τk(cid:13) < sπ/2 (4) with probability at least 1 − 2p. means the approprate “region” Qq′ gets a “vote” with “large” probability. Equation (4) shows that cj is a good estimate for i with good probability. We will now show that this For the q′ with τ ∈ [lj + q′−1 t w, lj + q′ t w], we have that mj,q′ = lj + q′−1/2 t w satisfies so τ − mj,q′ ≤ w 2t θ∗ τ − θj,q′ ≤ 2π n w 2t . Hence by Equation (4), the triangle inequality, and the choice of B ≤ snt 2w , τk(cid:13) + kβθ∗ τ − βθj,q′k(cid:13) kcj − βθj,q′k(cid:13) ≤ kcj − βθ∗ βπw nt sπ 2 + + < sπ 2 sπ ≤ 2 = sπ. Thus, vj,q′ will increase in each round with probability at least 1 − 2p. Now, consider q with q − q′ > 3. Then τ − mj,q ≥ 7w 2t , and (from the definition of β > snt 4w ) we have β τ − mj,q ≥ 7sn 8 > 3sn 4 . (5) We now consider two cases. First, suppose that τ − mj,q ≤ w st . In this case, from the definition of β it follows that β τ − mj,q ≤ n/2. 15 Together with Equation (5) this implies Pr[β(τ − mj,q) mod n ∈ [−3sn/4, 3sn/4]] = 0. On the other hand, suppose that τ − mj,q > w st . l = 3sn/2, m = snt 2w , t = snt 4w , i = (τ − mj,q) and n = n, to conclude that In this case, we use Lemma 4.3 with parameters Pr[β(τ − mj,q) mod n ∈ [−3sn/4, 3sn/4]] ≤ ≤ < 4w snt 4w snt 6 sB < 10s + 2τ − mj,q n + 3s + 3sn 2 st w 4w snt + 9s + 2w n + 9s where we used that i ≤ w ≤ n/B, the assumption w s = Θ(g) and B = ω(1/g3)). st < i, t ≥ 1, s < 1, and that s2 > 6/B (because Thus in either case, with probability at least 1 − 10s we have kβθj,q − βθ∗ 2πβ(mj,q − τ ) n > 2π n 3sn 4 = 3 2 sπ τk(cid:13) =(cid:13)(cid:13)(cid:13)(cid:13) (cid:13)(cid:13)(cid:13)(cid:13)(cid:13) for any q with q − q′ > 3. Therefore we have kcj − βθj,qk(cid:13) ≥ kβθj,q − βθ∗ τk(cid:13) − kcj − βθ∗ τk(cid:13) > sπ with probability at least 1 − 10s − 2p, and vj,q is not incremented. To summarize: in each round, vj,q′ is incremented with probability at least 1− 2p and vj,q is incremented with probability at most 10s + 2p for q − q′ > 3. The probabilities corresponding to different rounds are independent. Set s = g/20 and p = g/4. Then vj,q′ is incremented with probability at least 1−g and vj,q is incremented with probability less than g. Then after Rloc rounds, if q − q′ > 3, Pr[vj,q > Rloc/2] ≤(cid:18) Rloc Rloc/2(cid:19)gRloc/2 ≤ (4g)Rloc/2 = f Ω(Rloc) for g = f 1/3/4. Similarly, Pr[vj,q′ < Rloc/2] ≤ f Ω(Rloc). Hence with probability at least 1 − tf Ω(Rloc) we have q′ ∈ Q∗ and q − q′ ≤ 3 for all q ∈ Q∗. But then τ − l′ j ∈ [0, 4w/t] as desired. Because E[{i ∈ supp(bz) Eof f (i)}] = αkbzk0, the expected running time is O(RlocBt+Rloc Rloc kbzk0 (1 + α log(n/δ))). Lemma 4.5. Suppose B = Ck α2ǫ for C larger than some fixed constant. The procedure LOCATESIGNAL returns a set L of size L ≤ B such that for any i ∈ S, Pr[i ∈ L] ≥ 1 − O(α). Moreover the procedure runs in expected time B α log(n/δ)+ O(( B α log(n/δ) + kbzk0 (1 + α log(n/δ))) log(n/B)). Proof. Consider any i ∈ S such that none of Ecoll(i), Eof f (i), and Enoise(i) hold, as happens with proba- bility 1 − O(α). Set t = log n, t′ = t/4 and Rloc = O(log1/α(t/α)). Let w0 = n/B and wD = w0/(t′)D−1, so wDmax+1 < 1 for Dmax = logt′ (w0 + 1) < t. In each round D, Lemma 4.4 implies that if πσ,b(i) ∈ 16 j + wD] then πσ,b(i) ∈ [l(D+1) , l(D) [l(D) j By a union bound, with probability at least 1 − α we have πσ,b(i) ∈ [l(Dmax+1) {l(Dmax+1) }. Thus i = π−1 + wD+1] with probability at least 1 − αΩ(Rloc) = 1 − α/t. + wDmax+1] = Since RlocDmax = O(log1/α(t/α) logt(n/B)) = O(log(n/B)), the running time is σ,b(l(Dmax+1) , l(Dmax+1) ) ∈ L. , l(D+1) j j j j j j O(Dmax(Rloc B α = O(( B α log(n/δ) + Rloc kbzk0 (1 + α log(n/δ)))) log(n/δ) + kbzk0 (1 + α log(n/δ))) log(n/B)). 4.4 Properties of ESTIMATEVALUES Lemma 4.6. For any i ∈ L, if B > Ck αǫ for some constant C. Pr[(cid:12)(cid:12)(cid:12)bwi −bx′ > µ2] < e−Ω(Rest) 2 i(cid:12)(cid:12)(cid:12) i in each round r. Suppose none of E(r) coll(i), E(r) of f (i), and E(r) noise(i) j ω−arσi − bx′ Proof. Define er = bu(r) hold, as happens with probability 1 − O(α). Then by Lemma 4.2, µ2 < ρ2 Ear [er2] ≤ 2 αB Hence with 3/4 − O(α) > 5/8 probability in total, er2 < µ2 < µ2/2 2k αǫB 8 C = 2 C µ2 for sufficiently large C. Then with probability at least 1 − e−Ω(Rest), both of the following occur: i + median er, the result follows. γf k for some constant C and parameters γ, f > 0. Then if ESTIMATEVAL- < µ2/2 < µ2/2. r r 2 2 Lemma 4.7. Let Rest ≥ C log B (cid:12)(cid:12)(cid:12)median (cid:12)(cid:12)(cid:12)median real(er)(cid:12)(cid:12)(cid:12) imag(er)(cid:12)(cid:12)(cid:12) If this is the case, then medianr er2 < µ2. Since bwi = bx′ UES is run with input k′ = 3k, it returnscwJ for J = 3k satisfying L −cwJ , f k) ≤ Err2(cx′ Pr[(cid:12)(cid:12)(cid:12)bwi −bx′ i(cid:12)(cid:12)(cid:12) (cid:13)(cid:13)(cid:13)(bx′ − bw)L\U(cid:13)(cid:13)(cid:13) with probability at least 1 − γ. Proof. By Lemma 4.6, each index i ∈ L has Let U = {i ∈ L (cid:12)(cid:12)(cid:12)bwi − bx′ Err2(cx′ ∞ ≤ µ2. > µ2] < i(cid:12)(cid:12)(cid:12) 2 2 2 γf k B . 17 L, k) + O(kµ2) > µ2}. With probability 1 − γ, U ≤ f k; assume this happens. Then (6) rem 3.1 of [PW11]), the ℓ∞ guarantee (6) means that Let T contain the top 2k coordinates of bwL\U . By the analysis of Count-Sketch (most specifically, Theo- L\U , k) + 3kµ2. (7) Because J is the top 3k > (2 + f )k coordinates of cwL, T ⊂ J. Let J ′ = J \ (T ∪ U ), so J ′ ≤ k. Then 2 2 L\U − bwT(cid:13)(cid:13)(cid:13) (cid:13)(cid:13)(cid:13)bx′ 2 ≤ Err2(bx′ L\U − [wJ\U(cid:13)(cid:13)(cid:13) L −cwJ , f k) ≤(cid:13)(cid:13)(cid:13)[x′ Err2(cx′ L\(U∪J ′) − cwT(cid:13)(cid:13)(cid:13) =(cid:13)(cid:13)(cid:13)bx′ L\U − cwT(cid:13)(cid:13)(cid:13) ≤(cid:13)(cid:13)(cid:13)bx′ ≤ Err2(bx′ = Err2(bx′ 2 2 2 2 2 2 2 2 +(cid:13)(cid:13)(cid:13)(bx′ − bw)J ′(cid:13)(cid:13)(cid:13) + J ′(cid:13)(cid:13)(cid:13)(bx′ − bw)J ′(cid:13)(cid:13)(cid:13) ∞ L\U , k) + 3kµ2 + kµ2 L\U , k) + O(kµ2) where we used Equations (6) and (7). 4.5 Properties of SPARSEFFT We will show thatbx −bz(r) gets sparser as r increases, with only a mild increase in the error. Lemma 4.8. Definebx(r) = bx −bz(r). Consider any one loop r of SPARSEFFT, running with parameters α2ǫ for some C larger than some fixed constant. Then for any f > 0, (B, k, α) = (Br, kr, αr) such that B ≥ Ck with probability 1 − O(α/f ), and the running time is B α Err2(bx(r+1), f k) ≤ (1 + ǫ) Err2(bx(r), k) + O(ǫδ2nkbxk2 O((kbz(r)k0(1 + α log(n/δ)) + αǫ ) rounds inside ESTIMATEVALUES. Proof. We use Rest = O(log B αk ) = O(log 1 The running time for LOCATESIGNAL is log(n/δ))(log 1 αǫ 1) + log(n/B))). O(( and for ESTIMATEVALUES is B α O(( ) B α 1 αǫ log(n/δ) + kbz(r)k0(1 + α log(n/δ))) log(n/B)), log(n/δ) + kbz(r)k0(1 + α log(n/δ))) log k (Err2(bx(r), k) + δ2nkbxk2 [n]\(L∪S)(cid:13)(cid:13)(cid:13) [n]\L, f k) ≤(cid:13)(cid:13)(cid:13)bx(r) [n]\(L∪S), k) + k(cid:13)(cid:13)(cid:13)bx(r) ≤ Err2(bx(r) ≤ Err2(bx(r) [n]\(L∪S)(cid:13)(cid:13)(cid:13) [n]\L, k) + kµ2. 2 2 2 ∞ 18 Err2(bx(r) for a total running time as given. Recall that in round r, µ2 = ǫ > µ2}. By Lemma 4.5, each i ∈ S lies in Lr with probability at least 1 − O(α). Hence S \ L < f k with probability at least 1 − O(α/f ). Then 1) and S = {i ∈ [n] (cid:12)(cid:12)(cid:12)bx(r) (cid:12)(cid:12)(cid:12) 2 i (8) so Let bw =bz(r+1) −bz(r) =bx(r) −bx(r+1) by the vector recovered by ESTIMATEVALUES. Then supp(bw) ⊂ L, by Lemma 4.7. But by Equation (8), this gives L , k) + O(kµ2) L − bw, f k) Err2(bx(r+1), 2f k) = Err2(bx(r) − bw, 2f k) ≤ Err2(bx(r) ≤ Err2(bx(r) Err2(bx(r+1), 2f k) ≤ Err2(bx(r) [n]\L, f k) + Err2(bx(r) [n]\L, f k) + Err2(bx(r) [n]\L, k) + Err2(bx(r) ≤ Err2(bx(r), k) + O(kµ2) = (1 + O(ǫ)) Err2(bx(r), k) + O(ǫδ2nkbxk2 L , k) + O(kµ2) 1). The result follows from rescaling f and ǫ by constant factors. Given the above, this next proof follows a similar argument to [IPW11], Theorem 3.7. Theorem 4.9. With 2/3 probability, SPARSEFFT recoversbz(R+1) such that (cid:13)(cid:13)(cid:13)bx −bz(R+1)(cid:13)(cid:13)(cid:13)2 ≤ (1 + ǫ) Err(bx, k) + δ kbxk2 ǫ log(n/k) log(n/δ)) time. in O( k Proof. Define fr = O(1/r2) soP fr < 1/4. Choose R soQr≤R fr < 1/k ≤ Qr<R fr. Then R = O(log k/ log log k), sinceQr≤R fr < (fR/2)R/2 = (2/R)R. r ), kr = kQi<r fi, Br = O( k ), so for sufficiently large constant the constraint of Lemma 4.8 is satisfied. For appropriate constants, Lemma 4.8 says that in each round r, ǫ αrfr). Then Br = ω( kr rǫr Set ǫr = frǫ, αr = Θ(f 2 α2 1) (9) with probability at least 1 − fr. The error accumulates, so in round r we have Err2(bx(r+1), kr+1) = Err2(bx(r+1), frkr) ≤ (1 + frǫ) Err2(bx(r), kr) + O(frǫδ2nkbxk2 (1 + fiǫ) +Xi<r Err2(bx(r), kr) ≤ Err2(bx, k)Yi<r = Err2(bx(R+1), kR+1) ≤ Err2(bx, k)Yi≤R with probability at least 1 −Pi<r fi > 3/4. Hence in the end, since kR+1 = kQi≤R fi < 1, 1)Yi≤R O(frǫδ2nkbxk2 (1 + fiǫ) + O(Rǫδ2nkbxk2 (cid:13)(cid:13)(cid:13)bx(R+1)(cid:13)(cid:13)(cid:13) 1) Yi<j<r (1 + fjǫ) with probability at least 3/4. We also have 2 2 (1 + fiǫ) making Thus we get the approximation factor Yi (1 + fiǫ) ≤ eǫ Pi fi ≤ e (1 + fiǫ) ≤ 1 + eXi Yi (cid:13)(cid:13)(cid:13)bx −bz(R+1)(cid:13)(cid:13)(cid:13) 2 19 2 ≤ (1 + 2ǫ) Err2(bx, k) + O((log k)ǫδ2nkbxk2 1) fiǫ < 1 + 2ǫ. the desired with at least 3/4 probability. Rescaling δ by poly(n), using kbxk2 1 ≤ nkbxk2, and taking the square root gives Now we analyze the running time. The updatebz(r+1) −bz(r) in round r has support size 3kr, so in round r (cid:13)(cid:13)(cid:13)bx −bz(R+1)(cid:13)(cid:13)(cid:13)2 ≤ (1 + ǫ) Err(bx, k) + δ kbxk2 . Thus the expected running time in round r is kbz(r)k0 ≤Xi<r 3kr = O(k). O((k(1 + αr log(n/δ)) + Br αr log(n/δ))(log 1 αrǫr + log(n/Br))) = O((k + = O((k + k k r4 log(n/δ) + ǫr2 log(n/δ))(log k ǫr2 log(n/δ))(log r + log(n/k))) r2 ǫ + log(nǫ/k) + log r)) We split the terms multiplying k and k ǫr2 log(n/δ), and sum over r. First, RXr=1 (log r + log(n/k)) ≤ R log R + R log(n/k) ≤ O(log k + log k log(n/k)) = O(log k log(n/k)). Next, Thus the total running time is 1 r2 (log r + log(n/k)) = O(log(n/k)) RXr=1 O(k log k log(n/k) + k ǫ log(n/δ) log(n/k)) = O( k ǫ log(n/δ) log(n/k)). 5 Reducing the full k-dimensional DFT to the exact k-sparse case in n dimensions In this section we show the following lemma. Assume that k divides n. Lemma 5.1. Suppose that there is an algorithm A that, given an n-dimensional vector y such that y is k- sparse, computes y in time T (k). Then there is an algorithm A′ that given a k-dimensional vector x computes x in time O(T (k))). Proof. Given a k-dimensional vector x, we define yi = xi mod k, for i = 0 . . . n − 1. Whenever A requests a sample yi, we compute it from x in constant time. Moreover, we have that yi = xi/(n/k) if i is a multiple of (n/k), and yi = 0 otherwise. Thus y is k-sparse. Since x can be immediately recovered from y, the lemma follows. Corollary 5.2. Assume that the n-dimensional DFT cannot be computed in o(n log n) time. Then any algo- rithm for the k-sparse DFT (for vectors of arbitrary dimension) must run in Ω(k log k) time. 20 6 Lower Bound In this section, we show any algorithm satisfying Equation (1) must access Ω(k log(n/k)/ log log n) samples of x. We translate this problem into the language of compressive sensing: Theorem 6.1. Let F ∈ Cn×n be orthonormal and satisfy Fi,j = 1/√n for all i, j. Suppose an algorithm takes m adaptive samples of F x and computes x′ with kx − x′k2 ≤ 2 min k-sparse x∗ kx − x∗k2 for any x, with probability at least 3/4. Then it must have m = Ω(k log(n/k)/ log log n). Corollary 6.2. Any algorithm computing the approximate Fourier transform must access Ω(k log(n/k)/ log log n) samples from the time domain. If the samples were chosen non-adaptively, we would immediately have m = Ω(k log(n/k)) by [PW11]. However, an algorithm could choose samples based on the values of previous samples. In the sparse recovery framework allowing general linear measurements, this adaptivity can decrease the number of measurements to O(k log log(n/k)) [IPW11]; in this section, we show that adaptivity is much less effective in our setting where adaptivity only allows the choice of Fourier coefficients. We follow the framework of Section 4 of [PW11]. In this section we use standard notation from infor- mation theory, including I(x; y) for mutual information, H(x) for discrete entropy, and h(x) for continuous entropy. Consult a reference such as [CT91] for details. Let F ⊂ {S ⊂ [n] : S = k} be a family of k-sparse supports such that: • S ⊕ S′ ≥ k for S 6= S′ ∈ F, where ⊕ denotes the exclusive difference between two sets, and • log F = Ω(k log(n/k)). This is possible; for example, a random code on [n/k]k with relative distance 1/2 has these properties. For each S ∈ F, let X S = {x ∈ {0,±1}n supp(xS) = S}. Let x ∈ X S uniformly at random. The variables xi, i ∈ S, are i.i.d. subgaussian random variables with parameter σ2 = 1, so for any row Fj of F , Fjx is subgaussian with parameter σ2 = k/n. Therefore hence for each S, we can choose an xS ∈ X S with Pr x∈X S [Fj x > tpk/n] < 2e−t2/2 (cid:13)(cid:13)F xS(cid:13)(cid:13)∞ < O(r k log n ). n (10) Let X = {xS S ∈ F} be the set of such xS. Let w ∼ N (0, α k Consider the following process: n In) be i.i.d. normal with variance αk/n in each coordinate. Procedure. First, Alice chooses S ∈ F uniformly at random, then selects the x ∈ X with supp(x) = S. Alice independently chooses w ∼ N (0, α k n In) for a parameter α = Θ(1) sufficiently small. For j ∈ [m], Bob chooses ij ∈ [n] and observes yj = Fij (x + w). He then computes the result x′ ≈ x of sparse recovery, rounds to X by x = arg minx∗∈X kx∗ − x′k2, and sets S′ = supp(x). This gives a Markov chain S → x → y → x′ → x → S′. We will show that deterministic sparse recovery algorithms require large m to succeed on this input distribution x + w with 3/4 probability. By Yao’s minimax principle, this means randomized sparse recovery algorithms also require large m to succeed with 3/4 probability. Our strategy is to give upper and lower bounds on I(S; S′), the mutual information between S and S′. 21 Lemma 6.3 (Analog of Lemma 4.3 of [PW11] for ǫ = O(1)). There exists a constant α′ > 0 such that if α < α′, then I(S; S′) = Ω(k log(n/k)) . Proof. Assuming the sparse recovery succeeds (as happens with 3/4 probability), we havekx′ − (x + w)k2 ≤ 2 kwk2, which implies kx′ − xk2 ≤ 3 kwk2. Therefore kx − xk2 ≤ kx − x′k2 + kx′ − xk2 ≤ 2 kx′ − xk2 ≤ 6 kwk2 . We also know kx′ − x′′k2 ≥ √k for all distinct x′, x′′ ∈ X by construction. Because E[kwk2 2] = αk, with probability at least 3/4 we have kwk2 ≤ √4αk < √k/6 for sufficiently small α. But then kx − xk2 < √k, so x = x and S = S′. Thus Pr[S 6= S′] ≤ 1/2. Fano’s inequality states H(S S′) ≤ 1 + Pr[S 6= S′] log F. Thus I(S; S′) = H(S) − H(S S′) ≥ −1 + 1 2 log F = Ω(k log(n/k)) as desired. We next show an analog of their upper bound (Lemma 4.1 of [PW11]) on I(S; S′) for adaptive measure- ments of bounded ℓ∞ norm. The proof follows the lines of [PW11], but is more careful about dependencies and needs the ℓ∞ bound on F x. Lemma 6.4. I(S; S′) ≤ O(m log(1 + j = Aj w. The w′ 1 α log n)). j are independent normal variables with variance Proof. Let Aj = Fij for j ∈ [m], and let w′ α k n . Because the Aj are orthonormal and w is drawn from a rotationally invariant distribution, the w′ are also independent of x. Let yj = Ajx + w′ j. We know I(S; S′) ≤ I(x; y) because S → x → y → S′ is a Markov chain. Because the variables Aj are deterministic given y1, . . . , yj−1, I(x; yj y1, . . . , yj−1) = I(x; Aj x + w′ j y1, . . . , yj−1) = h(Ajx + w′ = h(Ajx + w′ j y1, . . . , yj−1) − h(Ajx + w′ j y1, . . . , yj−1) − h(w′ j). j x, y1, . . . , yj−1) By the chain rule for information, = I(S; S′) ≤ I(x; y) mXj=1 mXj=1 mXj=1 ≤ = I(x; yj y1, . . . , yj−1) h(Ajx + w′ j y1, . . . , yj−1) − h(w′ j) h(Ajx + w′ j ) − h(w′ j ). Thus it suffices to show h(Aj x + w′ j) − h(w′ j) = O(log(1 + 1 α log n)) for all j. 22 Note that Aj depends only on y1, . . . , yj−1, so it is independent of w′ j. Thus E[(Aj x + w′ j)2] = E[(Aj x)2] + E[(w′ j )2] ≤ O( k log n n ) + α k n by Equation (10). Because the maximum entropy distribution under an ℓ2 constraint is a Gaussian, we have h(Ajx + w′ j ) − h(w′ j ) ≤ h(N (0, O( log(1 + = 1 2 = O(log(1 + k log n n ) + α k n )) − h(N (0, α k n )) O(log n) α ) 1 α log n)). as desired. Theorem 6.1 follows from Lemma 6.3 and Lemma 6.4, with α = Θ(1). 7 Efficient Constructions of Window Functions Claim 7.1. Let cdf denote the standard Gaussian cumulative distribution function. Then: 1. cdf(t) = 1 − cdf(−t). 2. cdf(t) ≤ e−t2/2 for t < 0. 3. cdf(t) < δ for t < −p2 log(1/δ). x=−∞ cdf(x)dx < δ for t < −p2 log(3/δ). 4. R t 5. For any δ, there exists a function fcdfδ(t) computable in O(log(1/δ)) time such that(cid:13)(cid:13)(cid:13)cdf −fcdfδ(cid:13)(cid:13)(cid:13)∞ Proof. < δ. 1. Follows from the symmetry of Gaussian distribution. 2. Follows from a standard moment generating function bound on Gaussian random variables. 3. Follows from (2). 4. Property (2) implies that cdf(t) is at most √2π < 3 times larger than the Gaussian pdf. Then apply (3). 5. By (1) and (3), cdf(t) can be computed as ±δ or 1 ± δ unless t <p2(log(1/δ)). But then an efficient expansion around 0 only requires O(log(1/δ)) terms to achieve precision ±δ. For example, we can truncate the representation [Mar04] cdf(t) = 1 2 + e−t2/2 √2π (cid:18)t + t3 3 + t5 3 · 5 + t7 3 · 5 · 7 + ···(cid:19) at O(log(1/δ)) terms. 23 Claim 7.2. Define the continuous Fourier transform of f (t) by e−2πistf (t)dt. −∞ gt = √n bf (s) =Z ∞ ∞Xj=−∞ ∞Xj=−∞bf (t/n + j). g′ t = f (t + nj) f (s + nj)e−2πits/n f (s + nj)e−2πit(s+nj)/n Proof. Let ∆1(t) denote the Dirac comb of period 1: ∆1(t) is a Dirac delta function when t is an integer and For t ∈ [n], define and = bgt = Thenbg = g′, wherebg is the n-dimensional DFT of g. zero elsewhere. Then c∆1 = ∆1. For any t ∈ [n], we have ∞Xj=−∞ nXs=1 ∞Xj=−∞ nXs=1 ∞Xs=−∞ =Z ∞ = \(f · ∆1)(t/n) = (bf ∗ ∆1)(t/n) ∞Xj=−∞bf (t/n + j) −∞ = = = g′ t. f (s)e−2πits/n f (s)∆1(s)e−2πits/nds that G can be computed in O( B i can be evaluated in O(log(n/δ)) time. α log(n/δ)) time, and for each icG′ construct analogous window functions for the continuous Fourier transform. We then show that discretizing these functions gives the desired result. Lemma 7.3. For any parameters B ≥ 1, δ > 0, and α > 0, there exist flat window functions G andcG′ such Proof. We will show this for a function cG′ that is a Gaussian convolved with a box-car filter. First we Let D be the pdf of a Gaussian with standard deviation σ > 1 to be determined later, so bD is the pdf of a Gaussian with standard deviation 1/σ. Let bF be a box-car filter of length 2C for some parameter C < 1; that is, let bF (t) = 1 for t < C and F (t) = 0 otherwise, so F (t) = 2Csinc(t/(2C)). Let G∗ = D · F , so cG∗ = bD ∗ bF . Then G∗(t) ≤ 2C D(t) < 2Cδ for t > σp2 log(1/δ). Furthermore, G∗ is computable in O(1) Its Fourier transform is cG∗(t) = cdf(σ(t + C)) − cdf(σ(t − C)). By Claim 7.1 we have for t > C +p2 log(1/δ)/σ thatcG∗(t) = ±δ. We also have, for t < C −p2 log(1/δ)/σ, thatcG∗(t) = 1 ± 2δ. time. 24 Now, for i ∈ [n] let Hi = √nP∞ Furthermore, Xi>σ√2 log(1/δ) j=∞cG∗(i/n + j). D(i) j=∞ G∗(i + nj). By Claim 7.2 it has DFT bHi =P∞ G∗(i) ≤ 4C Xi<−σ√2 log(1/δ) ≤ 4C Z −σ√2 log(1/δ) D(x) dx + D(−σp2 log(1/δ))! ≤ 4C(cdf(−p2 log(1/δ)) + D(−σp2 log(1/δ))) Gi = √n Xj<σ√2 log(1/δ) ≤ 8Cδ ≤ 8δ. G∗(j) −∞ j≡i (mod n) Thus if we let for i < σp2 log(1/δ) and Gi = 0 otherwise, then kG − Hk1 ≤ 8δ√n. Now, note that for integer i with i ≤ n/2, bHi −cG∗(i/n) =Xj∈Z (cid:12)(cid:12)(cid:12)bHi −cG∗(i/n)(cid:12)(cid:12)(cid:12) ≤ 2 j6=0cG∗(i/n + j) ∞Xj=0cG∗(−1/2 − j) ∞Xj=0 ≤ 2Z −1/2 ≤ 2 −∞ ≤ 2δ/σ + 2δ ≤ 4δ cdf(σ(−1/2 − j + C)) cdf(σ(x + C))dx + 2 cdf(σ(−1/2 + C)) by Claim 7.1, as long as Let i = cG′ σ(1/2 − C) >p2 log(3/δ). 1 0 i ≤ n(C −p2 log(1/δ)/σ) i ≥ n(C +p2 log(1/δ)/σ) (11) i = where fcdf δ(t) computes cdf(t) to precision ±δ in O(log(1/δ)) time, as per Claim 7.1. Then cG′ cG∗(i/n) ± 2δ = bHi ± 6δ. Hence fcdf δ(σ(i + C)/n) − fcdf δ(σ(i − C)/n) otherwise +(cid:13)(cid:13)(cid:13)bG − bH(cid:13)(cid:13)(cid:13)∞ +(cid:13)(cid:13)(cid:13)bG − bH(cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)bG −cG′(cid:13)(cid:13)(cid:13)∞ ≤(cid:13)(cid:13)(cid:13)cG′ − bH(cid:13)(cid:13)(cid:13)∞ ≤(cid:13)(cid:13)(cid:13)cG′ − bH(cid:13)(cid:13)(cid:13)∞ =(cid:13)(cid:13)(cid:13)cG′ − bH(cid:13)(cid:13)(cid:13)∞ ≤(cid:13)(cid:13)(cid:13)cG′ − bH(cid:13)(cid:13)(cid:13)∞ ≤ (8√n + 6)δ. + kG − Hk2 + kG − Hk1 25 α p2 log(n/δ) > 1 and C = (1 − α/2)/(2B) < 1, we have the α log(n/δ)) i = 1 for i ≤ (1 − α)n/(2B) i = 0 for i ≥ n/(2B) i ∈ [0, 1] for all i. Replacing δ by δ/n and plugging in σ = 4B required properties of flat window functions: • Gi = 0 for i ≥ Ω( B • cG′ • cG′ • cG′ • (cid:13)(cid:13)(cid:13)cG′ − bG(cid:13)(cid:13)(cid:13)∞ • We can compute G over its entire support in O( B • For any i,cG′ otherwise. < δ. The only requirement was Equation (11), which is that α log(n/δ)) total time. i can be computed in O(log(n/δ)) time for i ∈ [(1 − α)n/(2B), n/(2B)] and O(1) time 4B ) >p2 log(3n/δ). This holds if B ≥ 2. The B = 1 case is trivial using the constant functioncG′ α p2 log(n/δ)(1/2 − 1 − α/2 2B i = 1. 8 Open questions • Design an O(k log n)-time algorithm for general signals. Alternatively, prove that no such algorithm exists, under “reasonable” assumptions.10 • Reduce the sample complexity of the algorithms. Currently, the number of samples used by each algorithm is only bounded by their running times. • Extend the results to other (related) tasks, such as computing the sparse Walsh-Hadamard Transform. • Extend the algorithm to the case when n is not a power of 2. Note that some of the earlier algorithms, e.g., [GMS05], work for any n. • Improve the failure probability of the algorithms. Currently, the algorithms only succeed with constant probability. Straightforward amplification would take a log(1/p) factor slowdown to succeed with 1 − p probability. One would hope to avoid this slowdown. Acknowledgements The authors would like to thank Martin Strauss and Ludwig Schmidt for many helpful comments about the writing of the paper. This work is supported by the Space and Naval Warfare Systems Center Pacific under Contract No. N66001-11-C-4092, David and Lucille Packard Fellowship, and NSF grants CCF-1012042 and CNS-0831664. E. Price is supported in part by an NSF Graduate Research Fellowship. 10The Ω(k log(n/k)/ log log n) lower bound for the sample complexity shows that the running time of our algorithm, O(k log n log(n/k)), is equal to the sample complexity of the problem times (roughly) log n. One could speculate that this loga- rithmic discrepancy is due to the need for using FFT to process the samples. Although we do not have any evidence for the optimality of our general algorithm, the “sample complexity times log n” bound appears to be a natural barrier to further improvements. 26 References [AFS93] R. Agrawal, C. Faloutsos, and A. Swami. Efficient similarity search in sequence databases. Int. Conf. on Foundations of Data Organization and Algorithms, pages 69–84, 1993. [AGS03] A. Akavia, S. Goldwasser, and S. Safra. Proving hard-core predicates using list decoding. Annual Symposium on Foundations of Computer Science, 44:146–159, 2003. [Aka10] A. Akavia. Deterministic sparse Fourier approximation via fooling arithmetic progressions. COLT, pages 381–393, 2010. [CGX96] A. Chandrakasan, V. Gutnik, and T. Xanthopoulos. Data driven signal processing: An approach for energy efficient computing. International Symposium on Low Power Electronics and Design, 1996. [CRT06] E. Candes, J. Romberg, and T. Tao. Robust uncertainty principles: Exact signal reconstruc- tion from highly incomplete frequency information. IEEE Transactions on Information Theory, 52:489–509, 2006. [CT91] Thomas Cover and Joy Thomas. Elements of Information Theory. Wiley Interscience, 1991. [Don06] D. Donoho. Compressed sensing. IEEE Transactions on Information Theory, 52(4):1289–1306, 2006. [DRZ07] I. Daubechies, O. Runborg, and J. Zou. A sparse spectral method for homogenization multiscale problems. Multiscale Model. Sim., 6(3):711–740, 2007. [GGI+02] A. Gilbert, S. Guha, P. Indyk, M. Muthukrishnan, and M. Strauss. Near-optimal sparse Fourier representations via sampling. STOC, 2002. [GL89] O. Goldreich and L. Levin. A hard-corepredicate for allone-way functions. STOC, pages 25–32, 1989. [GLPS10] Anna C. Gilbert, Yi Li, Ely Porat, and Martin J. Strauss. Approximate sparse recovery: optimiz- ing time and measurements. In STOC, pages 475–484, 2010. [GMS05] A. Gilbert, M. Muthukrishnan, and M. Strauss. Improved time bounds for near-optimal space Fourier representations. SPIE Conference, Wavelets, 2005. [GST08] A.C. Gilbert, M.J. Strauss, and J. A. Tropp. A tutorial on fast Fourier sampling. Signal Process- ing Magazine, 2008. [HIKP12a] H. Hassanieh, P. Indyk, D. Katabi, and E. Price. sFFT: Sparse Fast Fourier Transform. http://groups.csail.mit.edu/netmit/sFFT/, 2012. [HIKP12b] H. Hassanieh, P. Indyk, D. Katabi, and E. Price. Simple and practical algorithm for sparse Fourier transform. SODA, 2012. [HT01] [IPW11] [Iwe10] Juha Heiskala and John Terry, Ph.D. OFDM Wireless LANs: A Theoretical and Practical Guide. Sams, Indianapolis, IN, USA, 2001. P. Indyk, E. Price, and D. P. Woodruff. On the power of adaptivity in sparse recovery. FOCS, 2011. M. A. Iwen. Combinatorial sublinear-time Fourier algorithms. Foundations of Computational Mathematics, 10:303–338, 2010. [KKL88] J. Kahn, G. Kalai, and N. Linial. The influence of variables on boolean functions. FOCS, 1988. 27 [KM91] E. Kushilevitz and Y. Mansour. Learning decision trees using the Fourier spectrum. STOC, 1991. [LMN93] N. Linial, Y. Mansour, and N. Nisan. Constant depth circuits, Fourier transform, and learnability. Journal of the ACM (JACM), 1993. [LVS11] Mengda Lin, A. P. Vinod, and Chong Meng Samson See. A new flexible filter bank for low com- plexity spectrum sensing in cognitive radios. Journal of Signal Processing Systems, 62(2):205– 215, 2011. [Man92] Y. Mansour. Randomized interpolation and approximation of sparse polynomials. ICALP, 1992. [Mar04] G. Marsaglia. Evaluating the normal distribution. Journal of Statistical Software, 11(4):1–7, 2004. [MNL10] A. Mueen, S. Nath, and J. Liu. Fast approximate correlation for massive time-series data. In Proceedings of the 2010 international conference on Management of data, pages 171–182. ACM, 2010. [O’D08] R. O’Donnell. Some topics in analysis of boolean functions (tutorial). STOC, 2008. [PW11] E. Price and D. P. Woodruff. (1 + ǫ)-approximate sparse recovery. FOCS, 2011. 28
1504.06501
1
1504
2015-04-24T13:36:47
Run Generation Revisited: What Goes Up May or May Not Come Down
[ "cs.DS" ]
In this paper, we revisit the classic problem of run generation. Run generation is the first phase of external-memory sorting, where the objective is to scan through the data, reorder elements using a small buffer of size M , and output runs (contiguously sorted chunks of elements) that are as long as possible. We develop algorithms for minimizing the total number of runs (or equivalently, maximizing the average run length) when the runs are allowed to be sorted or reverse sorted. We study the problem in the online setting, both with and without resource augmentation, and in the offline setting. (1) We analyze alternating-up-down replacement selection (runs alternate between sorted and reverse sorted), which was studied by Knuth as far back as 1963. We show that this simple policy is asymptotically optimal. Specifically, we show that alternating-up-down replacement selection is 2-competitive and no deterministic online algorithm can perform better. (2) We give online algorithms having smaller competitive ratios with resource augmentation. Specifically, we exhibit a deterministic algorithm that, when given a buffer of size 4M , is able to match or beat any optimal algorithm having a buffer of size M . Furthermore, we present a randomized online algorithm which is 7/4-competitive when given a buffer twice that of the optimal. (3) We demonstrate that performance can also be improved with a small amount of foresight. We give an algorithm, which is 3/2-competitive, with foreknowledge of the next 3M elements of the input stream. For the extreme case where all future elements are known, we design a PTAS for computing the optimal strategy a run generation algorithm must follow. (4) Finally, we present algorithms tailored for nearly sorted inputs which are guaranteed to have optimal solutions with sufficiently long runs.
cs.DS
cs
Run Generation Revisited: What Goes Up May or May Not Come Down Michael A. Bender† Samuel McCauley† Andrew McGregor‡ Shikha Singh† Hoa T. Vu§ Abstract In this paper, we revisit the classic problem of run generation. Run generation is the first phase of external-memory sorting, where the objective is to scan through the data, reorder elements using a small buffer of size M, and output runs (contiguously sorted chunks of elements) that are as long as possible. We develop algorithms for minimizing the total number of runs (or equivalently, maximizing the average run length) when the runs are allowed to be sorted or reverse sorted. We study the problem in the online setting, both with and without resource augmentation, and in the offline setting. • We analyze alternating-up-down replacement selection (runs alternate between sorted and reverse sorted), which was studied by Knuth as far back as 1963. We show that this simple policy is asymptotically optimal. Specifically, we show that alternating-up-down replacement selection is 2-competitive and no deterministic online algorithm can perform better. • We give online algorithms having smaller competitive ratios with resource augmentation. Specifi- cally, we exhibit a deterministic algorithm that, when given a buffer of size 4M, is able to match or beat any optimal algorithm having a buffer of size M. Furthermore, we present a randomized online algorithm which is 7/4-competitive when given a buffer twice that of the optimal. • We demonstrate that performance can also be improved with a small amount of foresight. We give an algorithm, which is 3/2-competitive, with foreknowledge of the next 3M elements of the input stream. For the extreme case where all future elements are known, we design a PTAS for computing the optimal strategy a run generation algorithm must follow. • We present algorithms tailored for "nearly sorted" inputs which are guaranteed to have optimal solutions with sufficiently long runs. 5 1 0 2 r p A 4 2 ] S D . s c [ 1 v 1 0 5 6 0 . 4 0 5 1 : v i X r a †Department ‡Department of Computer Stony Brook University, Email: {bender,smccauley, shiksingh}@cs.stonybrook.edu. Science, Email: {mcgregor,hvu}@cs.umass.edu. Science, of Computer Stony Brook, NY 11794-4400, USA. University of Massachusetts, Amherst, MA 01003, USA. 1 Introduction External-memory sorting algorithms are tailored for data sets too large to fit in main memory. Generally, these algorithms begin their sort by bringing chunks of data into main memory, sorting within memory, and writing back out to disk in sorted sequences, called runs [15, 19, 26, 34]. We revisit the classic problem of how to maximize the length of these runs, the run-generation problem. The run-generation problem has been studied in its various guises for over 50 years [14,17 -- 19,25,30,31,34]. The most well-known external-memory sorting algorithm is multi-way merge sort [1, 8, 15, 22, 28, 29, 40, 42, 44]. The multi-way merge sort is formalized in the disk-access machine1 (DAM) model of Aggarwal and Vitter [1]. If M is the size of RAM and data is transferred between main memory and disk in blocks of size B, then an M/B-way merge sort has a complexity of O(cid:0)(N/B) logM/B (N/B)(cid:1) I/Os, where N is the number of elements to be sorted. This is the best possible [1]. A top-down description of multi-way merge sort follows. Divide the input into M/B subproblems, recursively sort each subproblem, and merge them together in one final scan through the input. The base case is reached when each subproblem has size O(M ), and therefore fits into RAM. A bottom-up description of the algorithm starts with the base case, which is the run-generation phase. Naıvely, we can always generate runs of length M: ingest M elements into memory, sort them, write them to disk, and then repeat. The point of run generation is to produce runs longer than M. After all, with typical values of N and M, we rarely need more than one or two passes over the data after the initial run-generation phase. Longer runs can mean fewer passes over the data or less memory consumption during the merge phase of the sort. Because there are few scans to begin with, even if we only do one fewer scan, the cost of a merge sort is decreased by a significant percentage. Run generation has further advantages in databases even when a full sort is not required [22, 24]. Replacement Selection. The classic algorithm for run generation is called replacement selection [20,26,28]. We describe replacement selection below by assuming that the elements can be read into memory and written to disk one at a time. To create an increasing run starting from an initially full internal memory, proceed as follows: 1. From main memory, select the smallest element2 at least as large as every element in the current run. 2. If no such element exists, then the run ends; select the smallest element in the buffer. 3. Eject that element, and ingest the next element, so that the memory stays full. Replacement selection can deal with input elements one at a time, even though the DAM model transfers input between RAM and disk B elements at a time. To see why, consider two additional blocks in memory, an "input block," which stores elements recently read from disk, and an "output block," which stores elements that have already been placed in a run and will be written back to disk. To ingest, take an element from the input block, and to eject an element, put the element in the output block. When the input block becomes empty, fill it from disk and when the output block fills up, flush it to disk. Similar to previous work, in this paper, we ignore these two blocks. Properties of Replacement Selection. It has been known for decades that when the input appears in random order, then the expected length of a run is actually 2M, not M [18, 19, 25]. In [26], Knuth gives memorable intuition about this result, conceptualizing the buffer as a snowplow traveling along a circular track. Replacement selection performs particularly well on nearly sorted data (for many intuitive notions of "nearly"), and the runs generated are much larger than M. For example, when each element in the input appears at a distance at most M from its actual rank, replacement selection produces a single run. 1The external-memory model, also called the I/O model, applies to any two levels of the memory hierarchy. 2Observe that data structures such as in-memory heaps can be used to identify the smallest elements in memory. However, from the perspective of minimizing I/Os, this does not matter -- computation is free in the DAM model. 1 On the other hand, replacement selection performs poorly on reverse-sorted data. It produces runs of length M, which is the worst possible. Up-Down Replacement Selection. From the perspective of the sorting algorithm, it matters little, or not at all, whether the initially generated runs are sorted or reverse sorted. This observation has motivated researchers to think about run generation when the replacement-selection algorithm has a choice about whether to generate an up run or a down run, each time a new run begins. Knuth [25] analyzes the performance of replacement selection that alternates deterministically between generating up runs and down runs. He shows that for randomly generated data, this alternative policy performs worse, generating runs of expected length 3M/2, instead of 2M. Martinez-Palau et al. [34] revive this idea in an experimental study. Their two-way-replacement-selection algorithms heuristically choose between whether the run generation should go up or down. Their experiments find that two-way replacement selection (1) is slightly worse than replacement selection for random input (in accordance with Knuth [25]) and (2) produces significantly longer runs on inputs that have mixed up-down runs and reverse-sorted inputs. Our Contributions. The results in our present paper complement these earlier results. In contrast to Knuth's negative result for random inputs [25], we show that strict up-down alternation is best possible for worst-case inputs. Moreover, we give better competitive ratios with resource augmentation and lookahead, which helps explain why heuristically choosing between up and down runs based on what is currently in memory may lead to better solutions. Resource augmentation is a standard tool used in competitive analysis [9, 11 -- 13, 38, 39] to empower an online algorithm when comparing against an omniscient and all-powerful optimal algorithm. Up-down run generation boils down to figuring out, each time a run ends, whether the next run should be an up run or a down run. The objective is to minimize the number of runs output.3 We establish the following: 1. Analysis of alternating-up-down replacement selection. We revisit (online) alternating-up-down replace- ment selection, which was earlier analyzed by Knuth [25]. We prove that alternating-up-down replacement selection is 2-competitive and asymptotically optimal for deterministic algorithms. To put this result in context, it is known that up-only replacement selection is a constant factor better than up-down replace- ment selection for random inputs, but can be an unbounded factor worse than optimal for arbitrary inputs. 2. Resource augmentation with extra buffer. We analyze the effect of augmenting the buffer available to an online algorithm on its performance. We show that with a constant factor larger buffer, it is possible to perform better than twice optimal. Specifically, we exhibit a deterministic algorithm that, when given a buffer of size 4M, matches or beats any optimal algorithm having a buffer of size M. We also design a randomized online algorithm which is 7/4-competitive using a 2M-size buffer. 3. Resource augmentation with extra visibility. We show that performance factors can also be improved, without augmenting the buffer, if an algorithm has limited foreknowledge of the input. In particular, we propose a deterministic algorithm which attains a competitive ratio of 3/2, using its regular buffer of size M, with a lookahead of 3M incoming elements of the input (at each step). 4. Better bounds for nearly sorted data. We give algorithms that perform well on inputs that have some inherent sortedness. We show that the greedy offline algorithm is optimal for inputs on which the optimal runs are at least 5M elements long. We also give a 3/2-competitive algorithm with 2M-size buffer when the optimal runs are at least 3M long. These results are reminiscent of previous literature studying sorting on inputs with "bounded disorder" [10] and adaptive sorting algorithms [16, 33, 41]. 5. PTAS for the offline problem. We give a polynomial-time approximation scheme for the offline run- generation problem. Specifically, our offline polynomial-time approximation algorithm guarantees a (1 + ε)-approximation to the optimal solution. We first give an algorithm with the running time of O(21/εN log N ) and then improve the running time to O(cid:16)(cid:0) 1+ √ 2 5 3Note that for a given input, minimizing the number of runs output is equivalent to maximizing the average length of runs output. N log N(cid:17). (cid:1)1/ε 2 Paper Outline. The paper is organized as follows. In Section 2, we formalize the up-down run generation problem and provide necessary notation. Section 3 contains important structural properties of run generation and key lemmas used in analyzing our algorithms. Analysis of alternating-up-down replacement selection and online lower bounds are in Section 4. Algorithms with resource augmentation, along with properties of the greedy algorithm, are presented in Section 5. The offline version of the problem is studied in Section 6. Improvements on well-sorted input are presented in Section 7. Section 8 summarizes related work and we conclude with open problems in Section 9. Due to space constraints, we defer some proofs to the appendix (Appendix A). 2 Up-Down Run Generation In this section, we formalize the up-down run generation problem and introduce notation. 2.1 Problem Definition An instance of the up-down run generation problem is a stream I of N elements. The elements of I are presented to the algorithm one by one, in order. They can be stored in the memory of size M available to the algorithm, which we henceforth refer to as the buffer. Each element occupies one slot of the buffer. In general, the model allows duplicate elements, although some results, particularly in Section 5 and Section 7, do require uniqueness. We say that an algorithm A reads an element of I when A transfers the element from the input sequence to the buffer. We say that an algorithm A writes an element when A ejects the element from its buffer and appends it to the output sequence S. Every time an element is written, its slot in the buffer becomes free. Unless stated otherwise, the next element from the input takes up the freed slot. Thus the buffer is always full, except when the end of the input is reached and there are fewer than M unwritten elements.4 An algorithm can decide which element to eject from its buffer based on (a) the current contents of the buffer and (b) the last element written. The algorithm may also use o(M ) additional words to maintain its internal state (for example, it can store the direction of the current run). However, the algorithm cannot arbitrarily access S or I -- it can only append elements to S, and access the next in-order element of I. We say the algorithm is at time step t if it has written exactly t elements. A run is a sequence of sorted or reverse-sorted elements. The cost of the algorithm is the smallest number of runs we can use to partition its output. Specifically, the number of runs in an output S, denoted R(S), is the smallest number of mutually disjoint sequences S1, S2, . . . , SR(S) such that each Si is a run and S = S1 ◦ ··· ◦ SR(S) where ◦ indicates concatenation. We let OPT(I) be the minimum number of runs of any possible output sequence on input I, i.e., the number of runs generated by the optimal offline algorithm. If I is clear from context, we denote this as OPT. Our goal is to give algorithms that perform well compared to OPT for every I. We say that an online algorithm is β-competitive if on any input, its output S satisfies R(S) ≤ βOPT. At any time step, an algorithm's unwritten-element sequence is comprised of the contents of the buffer, concatenated with the remaining (not yet ingested) input elements. For the purpose of this definition, we assume that the elements in the buffer are stored in their arrival order (their order in the input sequence I). Time step t is a decision point or decision time step for an algorithm A if t = 0 or if A finished writing a run at t. At a decision point, A needs to decide whether the next run will be increasing or decreasing. 4Reading in the next element of the input when there is a free slot in the buffer never hurts the performance of any algorithm. However, we allow the algorithm in the proof of Lemma 16 to maintain free slots in the buffer to simplify the analysis. 3 2.2 Notation We employ the following notation. We use (x (cid:37) y) to denote the increasing sequence x, x + 1, x + 2, . . . , y and (x (cid:38) y) to denote the decreasing sequence x, x − 1, x − 2 . . . , y. We use ◦ to denote concatenation: if A = a1, a2, . . . , ak and B = b1, b2, . . . , b(cid:96) then A ◦ B = a1, a2, . . . ak, b1, b2, . . . , b(cid:96). Let A = a1, a2, . . . , ak. We use A ⊕ x to denote the sequence a1 + x, a2 + x, . . . ak + x. Similarly, we use A ⊗ x to denote the sequence a1x, a2x, . . . , akx. Let A, B be sequences. We say A covers B if for all e ∈ B, e ∈ A. A subsequence of a sequence A = a1, . . . , ak is a sequence B = an1, an2, . . . , an(cid:96) where 1 ≤ n1 < n2 < . . . < n(cid:96) ≤ k. 3 Structural Properties In this section, we identify structural properties of the problem and the tools used in the analysis of our algorithms, which will be important in the rest of the paper. 3.1 Maximal Runs We show that in run generation, it is never a good idea to end a run early, and never a good idea to "skip over" an element (keeping it in buffer instead of writing it out as part of the current run). To begin, we show that adding elements to an input sequence never decreases the number of runs. Note that if S(cid:48) is a subsequence of S, then R(S(cid:48)) ≤ R(S) by definition. Lemma 1. Consider two input streams I and I(cid:48). If I(cid:48) is a subsequence of I, then OPT(I(cid:48)) ≤ OPT(I). Proof. Let A be an algorithm with input stream I and output S. Suppose that A produces the optimal number of runs on I, that is R(S) = OPT(I). Consider an algorithm A(cid:48) on I(cid:48). Algorithm A(cid:48) performs the same operations as A, but when it reaches an element that is not in I(cid:48) (but is in I), it executes a no-op. These no-ops mean that the buffer of A(cid:48) may not be completely full, since elements that A has in buffer do not exist in the buffer of A(cid:48). Let S(cid:48) be the output of A(cid:48); S(cid:48) is a subsequence of S. Then OPT(I(cid:48)) ≤ R(S(cid:48)) ≤ R(S) = OPT(I). A maximal increasing run is a run generated using the following rules (a maximal decreasing run is defined similarly): 1. Start with the smallest element in the buffer and always write the smallest element that is larger than the last element written. 2. End the run only when no element in the buffer can continue the run, i.e., all elements in buffer are smaller than the last element written. Lemma 2. At any decision time step, a maximal increasing (decreasing) run r covers every other (non- maximal) increasing (decreasing) run r(cid:48). A proper algorithm is an algorithm that always writes maximal runs. We say an output is proper if it is generated by a proper algorithm. We show that there always exists an optimal proper algorithm. Theorem 3. For any input I, there exists a proper algorithm A with output S such that R(S) = OPT(I). Proof. We prove this by induction on the number of runs. If there is only one run, it must be maximal. Assume that all inputs It with OPT(It) = t have a maximal proper algorithm. Consider an input It+1 with OPT(It+1) = t + 1. Assume that an optimal algorithm on It+1 is AO, and it is not proper; we will construct a proper A with the same number of runs. The first run A writes is maximal and has the same direction of 4 the first run that AO writes; the first run AO writes may or may not be maximal. Then A is left with an unwritten-element sequence IA and AO is left with IO. Note that OPT(IO) = t by definition. By Lemma 2, IO is a subsequence of IA. Then by Lemma 1, OPT(IA) ≤ OPT(IO). Then by the inductive hypothesis, IA has an optimal proper algorithm. Thus A is a proper algorithm generating the optimal number of runs. In conclusion, we have established that it always makes sense for an algorithm to write maximal runs. Furthermore, we use the following property of proper algorithms throughout the rest of the paper. Property 4. Any proper algorithm satisfies the following two properties: 1. At each decision point, the elements of the buffer must have arrived while the previous run was being written. 2. A new element can not be included in the current run if the element just written out is larger (smaller) and the current run is increasing (respectively, decreasing). 3.2 Analysis Toolbox We now present observations and lemmas that play an integral role in analysing the algorithms presented in the rest of the paper. Observation 5. Consider algorithms A1 and A2 on input I. Suppose that at time step t1 algorithm A1 has written out all the elements that algorithm A2 already wrote out by some previous time step t2. Then, the unwritten-element sequence of algorithm A1 at time step t1 forms a subsequence of the unwritten-element sequence of algorithm A2 at time step t2. Lemma 6. Consider a proper algorithm A. At some decision time step, A can write k runs p1 ◦ ··· ◦ pk or (cid:96) runs q1 ◦ ··· ◦ q(cid:96) such that p1 ◦ ··· ◦ pk ≥ q1 ◦ ··· ◦ q(cid:96). Then p1 ◦ ··· ◦ pk ◦ pk+1, where pk+1 is either an up or down run, covers q1 ◦ ··· ◦ q(cid:96). Therefore, the unwritten-element sequence after A writes pk+1 (if A writes p1◦···◦pk+1) is a subsequence of the unwritten-element sequence after A writes q(cid:96) (if A writes q1 ◦ ··· ◦ q(cid:96)). Proof. Since p1 ◦ ··· ◦ pk ≥ q1 ◦ ··· ◦ q(cid:96), the set of elements that are in q1 ◦ ··· ◦ q(cid:96) but not in p1 ◦ ··· ◦ pk have to be in the buffer when pk ends. By 4, pk+1 will write all such elements. The next theorem serves as a template for analyzing the algorithms in this paper. It helps us restrict our attention to comparing the output of our algorithm against that of the optimal in small partitions. We show that if in every partition i, an algorithm writes xi runs that cover the first yi runs of an optimal output (on the current unwritten-element sequence), and xi/yi ≤ β, then the algorithm outputs no more than βOPT runs. Theorem 7. Let A be an algorithm with output S. Partition S into k contiguous subsequences S1, S2 . . . Sk. Let xi be the number of runs in Si. For 1 < i ≤ k, let Ii be the unwritten-element sequence after A outputs Si−1; let I1 = I and Ik+1 = ∅. Let α, β ≥ 1. For each Ii, let S(cid:48) i be the output of an optimal algorithm on Ii. i, and xi/yi ≤ β, then R(S) ≤ βOPT. Similarly, if for all i ≤ k, Si covers the first yi runs of S(cid:48) Proof. Consider I(cid:48) show that OPT(Ii) ≤ OPT −(cid:80)i−1 base case). Induction hypothesis: assume OPT(Ii) ≤ OPT −(cid:80)i−1 S(cid:48) i+1, by 5, Ii+1 is a subsequence of I(cid:48) i > 1, (cid:48) i+1) = OPT(Ii) − yi ≤ OPT − 1 = I). We j=1 yi for all 1 ≤ i ≤ k using induction. Note that OPT(I1) = OPT (the j=1 yi. Since Si+1 covers the first y runs of i+1). By definition, for i+1. Then by Lemma 1, OPT(Ii+1) ≤ OPT(I(cid:48) i, the unwritten element sequence at the end of the first y runs of S(cid:48) i−1 (we let I(cid:48) OPT(I If for all i ≤ k, Si covers the first yi runs of S(cid:48) i, and E[xi]/yi ≤ α, then E[R(S)] ≤ αOPT. yi . i(cid:88)j=1 5 i=1 yi, we have the following: Therefore, OPT(Ii+1) ≤ OPT −(cid:80)i j=1 yi. When i = k, we have OPT(Ik+1) ≤ OPT −(cid:80)k j=1 yi ≤ OPT. Since R(S) = (cid:80)k Ik+1 contains no elements, OPT(Ik+1) = 0, and we have(cid:80)k (cid:80)k i=1 xi ≤ β(cid:80)k R(S) = (cid:80)k OPT · OPT ≤ (cid:80)k i=1 xi i=1 yi · OPT ≤ βOPT. (cid:80)k n(cid:88)i=1 We also have the same in expectation, that is, yi ≤ α · OPT. E[R(S)] = E[ i=1 xi j=1 yi. But since j=1 xi, and n(cid:88)i=1 xi] ≤ α 4 Up-Down Replacement Selection We begin by analyzing the alternating up-down replacement selection, which deterministically alternates be- tween writing (maximal) up and down runs. Knuth [25] showed that when the input elements arrive in a random order (all permutations of the input are equally likely), alternating-up-down replacement selection performs worse than standard replacement selection (all up runs). Specifically, he showed that the expected length of runs generated by up-down-replacement selection is 1.5M on random input, compared to the ex- pected length of 2M of replacement selection. In this section, we show that for deterministic online algorithms, alternating-up-down replacement selec- tion is, in fact, asymptotically optimal for any input. It generates at most twice the optimal number of runs in the worst case. This is the best possible -- no deterministic algorithm can have a better competitive ratio. 4.1 Alternating-Up-Down Replacement Selection is 2-competitive We begin by giving a structural lemma, analyzing identical runs on two inputs in which one input is a subse- quence of the other. Lemma 8. Consider two inputs I1 and I2, where I2 is a subsequence of I1. Let S1 and S2 be proper outputs of I1 and I2 such that: 1. S1 and S2 have initial runs r1 and r2 respectively, 2. r1 and r2 have the same direction 2 is a subsequence of I(cid:48) Let the unwritten-element sequence after r1 and r2 be I(cid:48) 1. Proof. Assume that r1 and r2 are up runs (a similar analysis works for down runs). Let r(cid:48) 2 be a run that is a subsequence of r1, consisting of all elements of r1 that are also in I2. Then r(cid:48) 2 can be produced by an algorithm A(cid:48) that mirrors the algorithm A that generates r1. When A reads or writes an element in I2, A(cid:48) reads or writes that element; when A reads or writes an element not in I2, A(cid:48) does nothing. Since r2 is maximal, it covers r(cid:48) Theorem 9. Alternating up-down replacement selection is 2-competitive. 2 respectively. Then I(cid:48) 2 by Lemma 2. 1 and I(cid:48) Proof. We show that we can apply Theorem 7 to this algorithm with β = 2. In any partition that is not the last one of the output, the alternating algorithm writes a maximal up run ru and then writes a maximal down run rd. We must show that ru ◦ rd covers any run rO written by a proper optimal algorithm on Ir, the unwritten element sequence at the beginning of the partition. 6 In the last partition, the algorithm can write at most two runs while any optimal output must contain at If rO is an up run, then rO = ru and thus is covered by ru ◦ rd. If rO is a down run, consider I(cid:48), the unwritten-element sequence after ru is written; I(cid:48) is a subsequence of Ir. By Lemma 8 (with I1 = Ir and I2 = I(cid:48)), ru ◦ rd covers rO. least one run. Hence xi/yi ≤ 2 in all partitions as required. 4.2 Lower Bounds on Online Algorithms for Up-Down Run Generation Now, we show that no deterministic online algorithm can hope to perform better than alternating-up-down replacement selection. Then, we partially answer the question of whether randomization helps overcome this impossibility result. Specifically, we show that no randomized algorithm can achieve a competitive ratio better than 3/2. We provide the main ideas of the proofs here and defer the details to Appendix A. Theorem 10. Let A be any online deterministic algorithm with output SI on input I. Then there are arbi- trarily long I such that R(SI ) ≥ 2OPT(I). Proof Sketch. Given any M elements in the buffer, every time A commits to a run direction (up/down), the adversary sets the incoming elements such that they do not help the current run. Thus, A is forced to have runs of length at most M while OPT (since it has knowledge of the future) can do better. We also give a lower bound for randomized algorithms using similar ideas; however, in this case we do not have a matching upper bound. We use Yao's minimax principle to prove this bound. That is, we generate a randomized input and show that any deterministic algorithm cannot perform better than 3/2 times OPT on that input against an oblivious adversary. Theorem 11. Let A be any online, randomized algorithm. Then there are arbitrarily long input sequences such that E[R(SI )] ≥ (3/2)OPT(I). 5 Run Generation with Resource Augmentation In this section, we use resource augmentation to circumvent the impossibility result on the performance of deterministic online algorithms. We consider two kinds of augmentation: to read elements from the input, rearrange them, and write to the output. • Extra Buffer: The algorithm's buffer is actually a constant factor larger, that is, it can use its large buffer • Extra Visibility: The algorithm's buffer is restricted to be of size M but it has prescience -- the algorithm can see some elements in the immediate future (say, the next 3M elements), without the ability to write them early. We present algorithms that, under the above conditions, achieve a competitive ratio better than 2 when com- pared against an optimal offline algorithm with a buffer of size M. Resource augmentation is a common tool used in competitive analysis [9, 11 -- 13, 38, 39]. It gives the online algorithm power to make better decisions and exclude worst case inputs, allowing us to compare the performance, more realistically, against an all-powerful offline optimal algorithm. The results in this section require the elements of the input to be unique. Duplicate elements can nullify the extra ability to see or write future (non-repeated) elements which is provided by visibility and buffer- augmentation respectively. For example, consider the input, On input I, any algorithm with cM-size buffer or visibility is as powerless as the one without any aug- mentation. I = (99, 101, 100, . . . , 100 cM−2 times , . . .). (cid:123)(cid:122) (cid:125) (cid:124) 7 Note that the assumption of distinct elements in run generation is not new. Knuth's analysis of the average run lengths [25] also requires uniqueness. We begin by analyzing the greedy algorithm for run generation. Greedy is a proper algorithm which looks into the future at each decision point, determines the length of the next up and down run and writes the longer run. Greedy is not an online algorithm. However, it is central to our resource augmentation results. The idea of resource augmentation, in part, is that the algorithm can use the extra buffer or visibility to determine, at each decision point, which direction (up or down) leads to the longer next run. We next look at some guarantees on the length of a run chosen by greedy (or the greedy run) and also on the run that is not chosen by greedy (or the non-greedy run). 5.1 Greedy is Good but not Great We first show that greedy is not optimal. The following example demonstrates that greedy can be a factor of 3/2 away from optimal. Example 12. Consider the input I = I1 ◦ (I1 ⊕ 10M ) ◦ (I1 ⊕ 20M ) ◦ ··· ◦ (I1 ⊕ 10cM ), where I1 = (4M + 4 (cid:37) 5M + 3) ◦ (M + 2) ◦ (5M + 4 (cid:37) 6M + 3) ◦ (2M + 1 (cid:37) 3M − 1) ◦ (4M + 3 (cid:38) 3M + 4) ◦ (2M (cid:38) M + 3) ◦ (M + 1 (cid:38) 1). On input I above, writing down runs repeatedly produces 2c runs; two for each I ⊕ i10M. On the other hand, the output of greedy is S1 ◦ (S1 ⊕ 10M ) ◦ ··· ◦ (S1 ⊕ c10M ), where S1 = (4M + 4 (cid:37) 6M + 3) ◦ (M + 2) ◦ (2M + 1 (cid:37) 3M − 1) ◦ (3M + 4 (cid:37) 4M + 3) ◦ (2M (cid:38) M + 3) ◦ (M + 1 (cid:38) 1) which contains 3c runs. Next, we show that all the runs written by the greedy algorithm (except the last two) are guaranteed to have length at least 5M/4. In contrast, up-down replacement selection can have have runs of length M in the worst case. Theorem 13. Each greedy run, except the last two runs, has length at least M + (cid:100)(cid:98)M/2(cid:99)/2(cid:101). We now bound how far into the future an algorithm must see to be able to determine which direction greedy would pick at a particular decision point. Intuitively, an algorithm should never have to choose be- tween a very long up run and a very long down run. We formalize this idea about the non-greedy run not being too long in the following lemma. Lemma 14. Given an input I with no duplicate elements. Let the two possible initial increasing and decreas- ing runs be r1 and r2. Then r1 < 3M or r2 < 3M. The next example shows that the above bound is tight. Example 15. Consider the input I = I1 ◦ I2 ◦ I3, where Then, I1 =(1 (cid:37) (M − 1)) ⊗ M, I2 = (M 2 (cid:38) M 2 − M + 1) I3 =(M − 1 (cid:38) 1) ◦ (M 2 + 2 (cid:37) M 2 + M + 1) . r1 =((1 (cid:37) (M − 1)) ⊗ M ) ◦ (M 2 − M + 1 (cid:37) M 2 + M + 1) r2 =(M 2 (cid:38) M 2 − M + 1) ◦ ((M − 1 (cid:38) 1) ⊗ M ) ◦ (M − 1 (cid:38) 1). Thus, we have r1 = 3M and r2 = 3M − 1. The following lemma sheds some light on the choices made by an optimal algorithm with respect to that of greedy. It says, roughly, that if at any decision point, an optimal algorithm chooses to write the non-greedy run, and then writes the next run in the opposite direction, it performs no better than an optimal algorithm which chooses the greedy run in the first place. 8 Lemma 16. At any decision time step consider two possible next maximal runs r1 and r2. If r1 ≥ r2, then one of the following is the prefix of an optimal output on the unwritten-element sequence: 1. r1 ◦ r3 where r3 is a maximal run after r1 and it can be either up or down. 2. r2 ◦ r4 where r4 is maximal run after r2 with the same direction of r2. 5.2 Online Algorithms with Resource Augmentation We now present several online algorithms which use resource augmentation (buffer or visibility) to determine an up-down replacement selection strategy, beating the competitive ratio of 2. For a concise summary of results, see Figure 1. Matching OPT using 4M-size Buffer. We present an algorithm with 4M-size buffer that writes no more runs than an optimal algorithm with an M-size buffer. Later on, we prove that (4M − 2)-size is necessary even to be 3/2-competitive; thus this augmentation result is optimal up to a constant. Consider the following deterministic algorithm with a 4M-size buffer. The algorithm reads elements until its buffer is full. It then uses the contents of its buffer to determine, for an algorithm with buffer size M, if the maximal up run or the maximal down run would be longer. If the maximal up run is longer, the algorithm uses its full buffer (of size 4M) to write a maximal up run; otherwise it writes a maximal down run. The algorithm stops when there is no element left to write. Theorem 17. Let A be the algorithm with a 4M-size buffer described above. On any input I, A never writes more runs than an optimal algorithm with buffer size M. Proof Sketch. At each decision point, A determines the direction that a greedy algorithm on the same unwrit- ten element sequence, but with a buffer of size M, would have picked. It is able to do so using its 4M-size buffer because, by Lemma 14, we know the length of the non-greedy run is bounded by 3M. Note that it does not need to write any elements during this step. In each partition, A writes a maximal run r in the greedy direction and thus covers the greedy run by Lemma 2. Furthermore, r covers the non-greedy run as well since all of the elements of this run must already be in A's initial buffer and hence get written out. An optimal algorithm (with M-size buffer), on the unwritten-element-sequence, has to choose between the greedy and the non-greedy run. Since A covers both choices of the optimal in one run, by Theorem 7, it is able to match or beat OPT. A natural question is whether resource augmentation boosts performance automatically, without using the run-simulation technique. However, the following example shows that our 2-competitive algorithm, even when allowed to have 4M-size buffer, may still be as bad when using M-size buffer. Example 18. Consider the input, (8M (cid:38) 1) ◦ (16M (cid:38) 8M + 1) ◦ ··· ◦ (8cM (cid:38) 8(c − 1)M + 1) . The alternating algorithm from Section 4.1 which alternates maximal up and maximal down runs will write 2c runs given a 4M-size buffer. In contrast, the optimal number of runs with an M-size buffer has c runs. 3/2-competitive using 4M-visibility. When we say that an algorithm has X-visibility (X ≥ M) or (X − M )-lookahead, it means that the algorithm has knowledge of the next X elements of its unwritten element sequence, and can use this knowledge when deciding what to write. However, only the usual M-size buffer is used for reading and writing. Furthermore, the algorithm must continue to read elements into its buffer sequentially from I, even if it sees elements further down the stream it would like to read or rearrange instead. We present a deterministic algorithm which uses 4M-visibility to achieve a competitive ratio of 3/2. At each decision point, similar to the algorithm in Theorem 17, we can use 3M-lookahead to determine the direction leading to the longer (greedy) run. However, unlike Theorem 17 we cannot use a large buffer to 9 Buffer size Lookahead Competitive ratio M 2M M 4M - - 3M - 2 1.75 1.5 1 Comments Deterministic Randomized Deterministic Deterministic Figure 1: Summary of online algorithms on run generation on any input write future elements. Instead, we do the following -- write a maximal greedy run, followed by two additional maximal runs in the same direction and opposite direction respectively. We show that, at each decision point, the above algorithm is able to cover two runs of optimal (on the unwritten-element-sequence) using three runs. Lemma 16 and Lemma 6 are key in this analysis (see Ap- pendix A for details). Thus, we have the following. Theorem 19. Let OPT be the optimal number of runs on input I given an M-size buffer, where I has no duplicate elements. Then there exists an online algorithm A with an M-size buffer and 4M-visibility such that A always outputs S satisfying R(S) ≤ (3/2)OPT. 7/4-competitive using 2M-size buffer. We have seen that it is possible to achieve a competitive ratio of 3/2 using a standard M-size buffer as long as the algorithm is able to determine the direction leading to the longer (greedy) run (see Theorem 19). Now we only have a 2M-size buffer. The algorithm will pick a direction randomly, and write a maximal run in that direction using its regular M buffer. It use the additional M-size buffer to simulate a run in the opposite direction (and thus figure out which one is longer). With probability 1/2, the algorithm is lucky and picks the greedy direction. In this case, we can cover the first two runs of optimal (on the unwritten-element sequence) with three runs as in Theorem 19. With probability 1/2, the algorithm picks the wrong direction and we spend four (alternating) runs to cover two runs of optimal. Thus, in expectation we achieve a competitive ratio of 1/2(3/2) + 1/2(4/2) = 7/4. Theorem 20. Let OPT be the optimal number of runs on input I given an M-size buffer, where I has no duplicate elements. Then there exists an online algorithm A with a 2M-size buffer such that A always outputs S satisfying E[R(S)] ≤ (7/4)OPT and R(S) ≤ 2OPT. 5.3 Lower Bound for Resource Augmentation We show that with less than (4M − 2)-augmentation, no deterministic online algorithm can be 3/2- competitive on all inputs. Thus, an algorithm with (4M − 2)-size buffer cannot be optimal, so Theorem 17 is nearly tight. Similarly, Theorem 19 is nearly tight, since 4M − 2-size buffer implies 4M − 2-visibility. Theorem 21. With buffer size less than (4M − 2), for any deterministic online algorithms A, there exists an input I such that if S is the output of A on I, then R(S) ≥ (3/2)OPT. 6 Offline Algorithms for Run Generation We give offline algorithms for run generation. The offline problem is the following -- given the entire input, compute (using a standard polynomial computation time algorithm) the optimal strategy which when executed by a run generation algorithm (with a buffer of size M) produces the minimum possible number of runs. For any ε, we provide an offline polynomial time approximation algorithm that gives a (1 + ε)- approximation to the optimal solution. This is called a polynomial-time approximation scheme, or PTAS. The 10 running time of our first attempt is O(21/εN log N ). We then improve the running time to O(ϕ1/εN log N ) where ϕ = (1 + √5)/2 ≈ 1.618 is the well-known golden ratio. Simple PTAS. Our first attempt breaks the output into sequences with a small number of runs, and uses brute force to find which set of runs writes the most elements. We show that for any ε, we can achieve a 1 + ε approximation in polynomial time using this strategy. Theorem 22. There exists an offline algorithm A that always writes an S satisfying R(S) ≤ (1 + ε) · OPT. The running time of A is O(21/εN log N ). Improved PTAS. We reduce the running time by bounding the number of choices we need to consider in a brute-force search. We do this using Lemma 16. At each decision point, an algorithm chooses between starting an increasing run r1 and a decreasing run r2. If r1 ≥ r2, then by Lemma 16, we are able to discard r2 followed by an increasing run. Let Fd be the number of run sequences we need to consider if d runs remain to be written (for example, naıve PTAS has Fd = 2d). First, the algorithm must handle all run sequences beginning with r1; this is the same as an instance of Fd−1. Then the algorithm handles all run sequences beginning with r2 followed by a decreasing run; this is an instance of Fd−2. Thus Fd = Fd−1 + Fd−2; by examination, F1 = 1 and F2 = 2. This is the Fibonacci sequence, which gives us the ϕ1/ε factor in the running time. Theorem 23. There exists an offline algorithm A that writes S such that R(S) ≤ (1 + ε)· OPT. The running time of A is O(ϕ1/εN log N ) where ϕ is the golden ratio (1 + √5)/2. 7 Run Generation on Nearly Sorted Input This section presents results proving that up-down replacement selection performs better when the input has inherent sortedness (or "bounded-disorder" [34]). Replacement selection produces longer runs on nearly sorted data. In particular, if every input element is M away from its target position, then a single run is produced. Similarly, we give algorithms which perform well on inputs, where the optimal runs are also long. In particular, we say that an input is c-nearly-sorted if there exists a proper optimal algorithm whose outputs consists of runs of length at least cM. 3/2-competitive using 2M-size Buffer. We provide a randomized online algorithm that, on inputs which are 3-nearly-sorted, achieves a competitive ratio of 3/2, while using an augmented-buffer of size 2M. A sketch of the algorithm follows. At each decision point, the algorithm picks a run direction at random. It starts a maximal run in that direction, but uses its extra M-buffer to simulate the run in the opposite direction. By Lemma 14, the algorithm can tell if it picked the same run as greedy (with M-buffer), similar to Theorem 20. If the algorithm got lucky and picked the greedy run, it repeats the process. If the algorithm picked the non-greedy run, it uses some careful bookkeeping to write elements and simulate the run in the opposite direction. In doing so, the algorithm winds up at the same point in the input it would have reached, had it written the greedy run in the first place, but with an additional cost of one run. Theorem 24. There exists a randomized online algorithm A using M space in addition to its buffer such that, on any 3-nearly-sorted input I that has no duplicates, A is a 3/2-approximation in expectation. Furthermore, A is at worst a 2-approximation regardless of its random choices. Exact Offline Algorithm on Nearly Sorted Input. We show that the greedy (offline) algorithm is a linear time optimal algorithm on inputs which are 5-nearly-sorted. We first prove the following lemma. Lemma 25. If a proper algorithm produces runs of length at least 5M on a given input with no duplicates, then it is optimal. 11 Thus, we get our required linear time exact offline algorithm. Theorem 26. The greedy offline algorithm, i.e., picking the longer run at each decision point, is optimal on a 5-nearly-sorted input that contain no duplicates. The running time of the algorithm is O(N ). 8 Additional Related Work Replacement Selection. The classic algorithm for run generation is replacement selection [20]. While replacement selection considers only up runs, Knuth [25] analyzed alternating up-down replacement selection in 1963. He showed that for uniformly random input, alternating up-down replacement selection produces runs of expected length 3M/2, compared to 2M of the standard replacement selection [18, 19, 26]. Recently, Martinez-Palau et al. [34] introduce Two-way replacement selection (2WRS), reviving the idea of up-down replacement selection. The 2WRS algorithm maintains two heaps in memory for up and down runs and heuristically decides in which heap each element must be placed. Their simulations show that 2WRS performs significantly better on inputs with mixed up-down, alternating up-down, and random sequences. Replacement selection with a fixed-sized reservoir appears in [17, 40]. Larson [28] introduced batched replacement selection, a cache-conscious replacement selection which works for variable-length records. Koltsidas, Muller, and Viglas [27] study replacement selection for sorting hierarchical data. Improvements for the merge phase of external sorting have been considered in [10,15,37,43,44], but this is beyond the scope of this paper. Reordering Buffer Management. Run generation problem is reminiscent of the buffer reordering problem (also known as the sorting buffer problem), introduced by Racke et al. [36]. It consists of a sequence of n elements that arrive over time, each having a certain color. A buffer, that can store up to k elements, is used to rearrange them. When the buffer becomes full, an element must be output. A cost is incurred every time an element is output that has a color different from the previous element in the output sequence. The goal is to design a scheduling strategy for the order in which elements must be output, so as to minimize the total number of color changes. The buffer reordering problem models a number of important problems in manufacturing processes and network routing and has been extensively studied, both in the online and offline case [3 -- 7,9,12,23]. The offline version of the buffer reordering problem is NP hard [9], while the complexity of our problem remains unresolved. Patience Sort and Longest Increasing Subsequence. An old sorting technique used to sort decks of playing cards, Patience Sort [33] has two phases -- the creation of sorted piles or runs, and the merging of these runs. The elements arrive one at a time and each one can be added to an existing run or starts a new run of its own. Unlike this paper, a legal run only consists of elements decreasing in value, and patience sort can form any number of parallel runs. The goal is to minimize the number of runs. The greedy strategy of placing an element to the left-most legal run is optimal. Moreover, the minimum number of such runs is the length of the longest increasing subsequence of the input [2]. Patience sort has been studied in the streaming model [21]. Similar to Replacement Selection, Patience Sort is able to leverage partially sorted input data. Chan- dramouli and Goldstein [10] present improvements to patience sort, and combine it with replacement selec- tion to achieve practical speed up. Adaptive Sorting Algorithms. Python's inbuilt sorting algorithm, Timsort [41] works by finding contiguous runs of increasing or decreasing value during the run generation phase. External memory sorting for well- ordered or "partially sorted" data has been studied by Liu et al. [32]. They minimize the I/O cost of run generation phase by finding "naturally occurring runs". See [16] for a survey on adaptive sorting algorithms. 12 9 Conclusion and Open Problems In this paper, we present an in-depth analysis of algorithms for run generation. We establish that considering both up and down runs can substantially reduce the number of runs in an external sort. The notion of up- down replacement selection has received relatively little attention since Knuth's negative result [25], until its promise was acknowledged by the experimental work of Martinez-Palau et al. [34]. The results in our paper complement the findings of Knuth [25] and Martinez-Palau et al. [34]. In par- ticular, strict up-down alternation being the best possible strategy explains why heuristics for up-down run- generation can lead to better performance in some cases. Moreover, our constant-factor competitive ratios with resource augmentation and lookahead may guide followup heuristics and practical speed-ups. We conclude with open problems. Can randomization help circumvent the lower bound of 2 on the competitive ratio of online algorithms (without resource augmentation)? We know that no randomized online algorithm can have a competitive ratio better than 3/2, but there is still a gap. What is the performance of the greedy offline algorithm compared to optimal? We show that greedy can as bad as 3/2 times optimal. Is there a matching upper bound? Can we design a polynomial, exact, algorithm for the offline run-generation problem? We find it intriguing that our attempts at an exact dynamic program requires maintaining too many buffer states to run in polynomial time. 10 Acknowledgments We gratefully acknowledge Goetz Graefe and Harumi Kuno for introducing us to this problem and for their advice. This research was supported by NSF grants CCF 1114809, CCF 1217708, IIS 1247726, IIS 1251137, CNS 1408695, CCF 1439084, and by Sandia National Laboratories. References [1] Alok Aggarwal and Jeffrey S. Vitter. The input/output complexity of sorting and related problems. Communications of the ACM, 31(9):1116 -- 1127, September 1988. [2] David Aldous and Persi Diaconis. Longest increasing subsequences: from patience sorting to the Baik- Deift-Johansson theorem. Bulletin of the American Mathematical Society, 36(4):413 -- 432, 1999. [3] Yuichi Asahiro, Kenichi Kawahara, and Eiji Miyano. NP-hardness of the sorting buffer problem on the uniform metric. Discrete Applied Mathematics, 160(10):1453 -- 1464, 2012. [4] Noa Avigdor-Elgrabli and Yuval Rabani. A constant factor approximation algorithm for reordering In Proc. 24th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), buffer management. pages 973 -- 984, 2013. [5] Noa Avigdor-Elgrabli and Yuval Rabani. An improved competitive algorithm for reordering buffer management. In Proc. 54th Annual Symposium on the Foundations of Computer Science (FOCS), pages 1 -- 10, 2013. [6] Noa Avigdor-Elgrabli and Yuval Rabani. An optimal randomized online algorithm for reordering buffer management. arXiv preprint arXiv:1303.3386, 2013. [7] Reuven Bar-Yehuda and Jonathan Laserson. Exploiting locality: approximating sorting buffers. Journal of Discrete Algorithms, 5(4):729 -- 738, 2007. 13 [8] Dina Bitton and David J DeWitt. Duplicate record elimination in large data files. ACM Transactions on database systems, 8(2):255 -- 265, 1983. [9] Ho-Leung Chan, Nicole Megow, Ren´e Sitters, and Rob van Stee. A note on sorting buffers offline. Theoretical Computer Science, 423:11 -- 18, 2012. [10] Badrish Chandramouli and Jonathan Goldstein. Patience is a virtue: Revisiting merge and sort on In Proc. 2014 ACM SIGMOD Int'l Conference on Management of Data, pages modern processors. 731 -- 742, 2014. [11] Chandra Chekuri, Ashish Goel, Sanjeev Khanna, and Amit Kumar. Multi-processor scheduling to min- imize flow time with ε resource augmentation. In Proc. of the 36th annual ACM Symposium on Theory of Computing (STOC), pages 363 -- 372. ACM, 2004. [12] Matthias Englert and Matthias Westermann. Reordering buffer management for non-uniform cost mod- els. In Proc. 32nd Int'l Colloquium on Automata, Languages and Programming (ICALP), pages 627 -- 638, 2005. [13] Leah Epstein and Rob Van Stee. Online bin packing with resource augmentation. Discrete Optimization, 4(3):322 -- 333, 2007. [14] Terje O Espelid. On replacement selection and dinsmore's improvement. BIT Numerical Mathematics, 16(2):133 -- 142, 1976. [15] Vladimir Estivill-Castro and Derick Wood. Foundations for faster external sorting. Foundation of Software Technology and Theoretical Computer Science, 880:414 -- 425, 1994. [16] Vladmir Estivill-Castro and Derick Wood. A survey of adaptive sorting algorithms. ACM Computing Surveys (CSUR), 24(4):441 -- 476, 1992. [17] WD Frazer and CK Wong. Sorting by natural selection. Communications of the ACM, 15(10):910 -- 913, 1972. [18] Edward H Friend. Sorting on electronic computer systems. Journal of the ACM, 3(3):134 -- 168, 1956. [19] Betty Jane Gassner. Sorting by replacement selecting. Communications of the ACM, 10(2):89 -- 93, 1967. [20] Martin A Goetz. Internal and tape sorting using the replacement-selection technique. Communications of the ACM, 6(5):201 -- 206, 1963. [21] Parikshit Gopalan, TS Jayram, Robert Krauthgamer, and Ravi Kumar. Estimating the sortedness of In Proc. 18th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages a data stream. 318 -- 327, 2007. [22] Goetz Graefe. Implementing sorting in database systems. ACM Computing Surveys (CSUR), 38(3):10, 2006. [23] Sungjin Im and Benjamin Moseley. New approximations for reordering buffer management. In Proc. 25th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1093 -- 1111, 2014. [24] Tom Keller, Goetz Graefe, and David Maier. Efficient assembly for complex objects. In Proc. 2014 ACM SIGMOD Int'l Conference on Management of Data, pages 148 -- 157, 1991. [25] Donald Ervin Knuth. Length of strings for a merge sort. Communications of the ACM, 6(11):685 -- 688, 1963. 14 [26] Donald Ervin Knuth. The Art of Computer Programming: Sorting and Searching, volume 3. Pearson Education, 1998. [27] Ioannis Koltsidas, Heiko Muller, and Stratis D Viglas. Sorting hierarchical data in external memory for archiving. Proceedings of the VLDB Endowment, 1(1):1205 -- 1216, 2008. [28] Per- Ake Larson. External sorting: Run formation revisited. IEEE Transactions on Knowledge and Data Engineering, 15(4):961 -- 972, 2003. [29] Per- Ake Larson and Goetz Graefe. Memory management during run generation in external sorting. In Proc. 1998 ACM SIGMOD Int'l Conference on Management of Data, volume 27, pages 472 -- 483, 1998. [30] Yen-Chun Lin. Perfectly overlapped generation of long runs for sorting large files. Journal of Parallel and Distributed Computing, 19(2):136 -- 142, 1993. [31] Yen-Chun Lin and Horng-Yi Lai. Perfectly overlapped generation of long runs on a transputer array for sorting. Microprocessors and Microsystems, 20(9):529 -- 539, 1997. [32] Yang Liu, Zhen He, Yi-Ping Phoebe Chen, and Thi Nguyen. External sorting on flash memory via natural page run generation. The Computer Journal, 54(11):1882 -- 1990, 2011. [33] Colin L Mallows. Patience sorting. Bulletin of Inst. of Math. Appl., 5(4):375 -- 376, 1963. [34] Xavier Martinez-Palau, David Dominguez-Sal, and Josep Lluis Larriba-Pey. Two-way replacement selection. In Proc. of the VLDB Endowment, volume 3, pages 871 -- 881, 2010. [35] Rajeev Motwani and Prabhakar Raghavan. Randomized algorithms. Chapman & Hall/CRC, 2010. [36] Harald Racke, Christian Sohler, and Matthias Westermann. Online scheduling for sorting buffers. In Proc. 10th European Symposium on Algorithms (ESA), pages 820 -- 832, 2002. [37] Betty Salzberg. Merging sorted runs using large main memory. Acta Informatica, 27(3):195 -- 215, 1989. [38] Daniel D Sleator and Robert E Tarjan. Amortized efficiency of list update and paging rules. Communi- cations of the ACM, 28(2):202 -- 208, 1985. [39] Hongyang Sun and Rui Fan. Improved semi-online makespan scheduling with a reordering buffer. Information Processing Letters, 113(12):434 -- 439, 2013. [40] TC Ting and YW Wang. Multiway replacement selection sort with dynamic reservoir. The Computer Journal, 20(4):298 -- 301, 1977. [41] Wikipedia. Timsort, 2004. http://en.wikipedia.org/wiki/Timsort. [42] Weiye Zhang and Per- Ake Larson. Dynamic memory adjustment for external mergesort. In Proc. of the 23rd International Conference on Very Large Data Bases (VLDB), pages 376 -- 385. Morgan Kaufmann Publishers Inc., 1997. [43] Weiye Zhang and Per- Ake Larson. Buffering and read-ahead strategies for external mergesort. In Proc. 24rd Int'l Conference on Very Large Data Bases (VLDB), pages 523 -- 533, 1998. [44] LuoQuan Zheng and Per- Ake Larson. Speeding up external mergesort. IEEE Transactions on Knowl- edge and Data Engineering, 8(2):322 -- 332, 1996. 15 A Appendix: Omitted proofs Proof of Lemma 2. Without loss of generality, assume r and r(cid:48) are increasing runs. Consider any time step t be the buffer of r and r(cid:48) at time step t t when elements from both r and r(cid:48) are being written. Let Bt and B(cid:48) respectively; let Ct be the set of elements in Bt that are eventually written to r, and C(cid:48) t be the set of elements in B(cid:48) t ⊆ Ct. This implies that r covers r(cid:48). The t that are eventually written to r(cid:48). We prove inductively that C(cid:48) base case is true as r and r(cid:48) start with the same buffer. Since we have C(cid:48) t ⊆ Ct, we must show that (a) the element z written to r is not in C(cid:48) ≥ z; thus either z = z(cid:48), or z is never written to r(cid:48) (either way it is not in C(cid:48) t+1, it is eventually written by r(cid:48); thus e ≥ z(cid:48). Thus e ≥ z, but that means e is eventually Consider the elements z(cid:48) and z written by r(cid:48) and r, respectively, at time t + 1. We must have z(cid:48) Since e is in C(cid:48) written by r. Since e was just read it is in Bt+1; thus e ∈ Ct+1. Observation A. If A has just written an element e, and is writing a down (up) run, then A cannot write any element larger (smaller) than e in the same run. Similarly, if A has just written e, then A cannot write both an element larger than e and an element smaller than e in the same run. t+1 and (b) the element e read into C(cid:48) t+1 must also be in Ct+1. t+1). Proof of Theorem 10. Let I1, the first M elements of the input, be I1 = 1, 2, . . . , M. We divide the rest of the input into segments of size M. Let the (t + 1)st such segment be It+1. Then, It+1 = (1 + tM (cid:37) M + tM ) or (−(1 + tM ) (cid:38) −(M + tM )) . It+1 is a positive or a negative segment based on A. Call this a positive segment and a negative segment respectively. At time M (t− 1) + 1 we decide whether Specifically, we choose It+1 using either the direction of the run A is writing, or the value of the most recent element written. If A is writing a down run, It+1 is a positive segment; if A is writing an up run, It+1 is a negative segment. It may be that A has only written one element of a run (so A could turn this into either an up run or a down run). If this element was the smallest element in the buffer of A, It+1 is a negative segment. Otherwise, It+1 is a positive segment. First we show that A must write at least one new run for each It; thus R(S) ≥ t. At least one run is required for A to write I1, so for the remainder of the proof we assume t > 1. Consider time M (t − 2) + 1, when It begins. We assume that It is a positive segment -- a mirroring argument works when It is a negative segment. Furthermore, note that the elements of It are the largest in the instance so far. There are two cases: A is currently writing a down run, or the initial element of a new run. Case 1: Algorithm A is currently writing a down run. Then the elements of It must be larger than any element in A's down run. Thus A must use another run to write the elements of It by Observation A. Case 2: Algorithm A is writing the initial element of a new run. By construction, the element written is not the smallest element in A's buffer, but is smaller than all elements in It. Then A must spend one run to write the smallest element in its buffer, and another to write It. Thus, It causes A to write a run in addition to its current run by Observation A. On the other hand, an offline algorithm can write I2i and I2i+1 in one run. Assume that I2i is a positive segment -- a mirroring argument works when I2i is a negative segment. If I2i+1 is positive, both can be written using an up run. If I2i+1 is negative, both can be written using a down run. Thus OPT is no more than (cid:100)t/2(cid:101). Proof of Theorem 11. Our lower bound uses the same basic principles as Theorem 10. We first show the lower bound with some repeated elements, then show how to perturb the elements to avoid repetitions. We generate a randomized input and show that any deterministic algorithm cannot perform better than 3/2 times OPT on that input. The theorem is then proven by Yao's minimax principle. Yao's minimax principle states 16 that the best expected performance of a randomized algorithm is at least as large as the expected performance of the best deterministic algorithm over a (known) distribution of inputs. (See, e.g., [35] for details.) As in Theorem 10, we divide the input into segments of size 4M. Call these segments It for t = 1, 2, . . . ,(cid:98)N/4M(cid:99). Note that this input is randomized: for each t, we pick one of two inputs, each with probability 1/2. We choose either I 1 t = (1 (cid:37) M ) I 2 t = (2M,(cid:38) M + 1) I 3 t = (3M (cid:38) 2M + 1) I 4 t = (4M (cid:38) 3M + 1) (a positive segment) Let It = I 1 t ◦ I 4 t ◦ I 3 t ◦ I 2 1/2. or I 1 t = (1 (cid:37) M ) I 2 t = (−2M,(cid:37) −M − 1) I 3 t = (−3M (cid:37) −2M − 1) I 4 t = (−4M (cid:37) −3M − 1). (a negative segment) t . A positive or negative segment is chosen randomly for each It with probability t−1 t−1 has been written. t has been written. Applying The optimal algorithm spends no more than one run per It, using an up run for a positive segment or a down run for a negative segment. We show that any deterministic algorithm requires at least one new run to write I 4 t for t > 1. Further analysis shows that with probability 1/2, any deterministic algorithm requires at least one run to write the remainder of I 1 1 ; summing, this gives a total expected cost of (3/2)OPT. t . Note that one run is also required to write I 1 t−1 and I 1 t , and I 3 t , I 2 Consider a segment It; t > 1. Once all of I 4 t−1 has been read into its buffer, at least one element of I 3 has been written. Once all of I 1 Finally, once all of I 2 Observation A, at least one new run is required to write these three elements. t has been read into its buffer, at least one element x of I 1 t has been read into its buffer, at least one element of I 4 Now we show that with probability 1/2, an additional run is required to write I 2 t . Let x be the first element t (thus, the cost of writing x itself was handled in the above case -- we show when an additional t (so it does now written by I 1 run is required). Note that the algorithm must choose an x before it sees any element of I 2 know if It is positive or negative). Let x (cid:54)= 1 and It be a positive segment. By Observation A, an additional run is required to write both 1 and any element of I 2 t cannot be written using one run. Similarly, let x = 1 and It be a negative segment. By Observation A, an additional t require an additional run to be run is required to write both M and any element of I 2 written. t cannot be stored in the buffer -- but then, I 2 t . If 1 is not written, all of I 2 t ; otherwise I 2 t and I 3 t and I 3 Thus any deterministic algorithm cannot perform better than a 3/2-approximation. Applying Yao's min- imax principle proves the theorem. Now we perturb the input to avoid duplicate elements. We multiply each element by (cid:98)N/4M(cid:99), and add t to each element of It. In other words, we use a new segment I (cid:48) t = (It ⊗ (cid:98)N/4M(cid:99)) ⊕ t. Our arguments above only depended on the relative ordering of the elements, which is preserved by this perturbation. For example, assume It and It−1 are both positive segments. Then all elements of I 1 t are less than all elements of I 4 t are greater than all elements of I 1 t . t−1, and all elements of I 2 Proof of Theorem 13. We will build S constructively. At each time t where greedy chooses an up or down run, we show that one of its choices leads to a run of length at least 5M/4. Since the greedy algorithm always picks the longer run at each decision time step, the run with length less than 5M/4 can never be part of its output. Consider any time step t where t < N − 5M/4. If t is larger than this value, the final run will have length n − t. Let the contents of buffer at time t be σ1, . . . , σM . Let I(cid:48) be the sequence of (cid:98)M/2(cid:99) elements of I arriving after t. 17 Consider the run starting at σM and continuing downwards; call this down run r1. Let r2 be the up run starting at σ1 and continuing upwards. Any element of I(cid:48) less than σ(cid:100)M/2(cid:101) will be (eventually) written out to r1; any that are greater than σ(cid:98)M/2(cid:99) will be written out to r2. Every number must fall into one of these categories, so there must be at least (cid:100)(cid:98)M/2(cid:99)/2(cid:101) numbers added to the larger run. Each run at least includes the elements already in the buffer, so the larger run has length at least M + (cid:100)(cid:98)M/2(cid:99)/2(cid:101). The last 5M/4 elements can be handled by greedy in at most 2 runs (since each trivially has length at least M). Thus the above applies to all but the last two runs of greedy. Proof of Lemma 14. Let S1 be an output that writes r1 initially and S2 be an output that writes r2 initially. Without loss of generality, suppose that r1 is increasing and r2 is decreasing. Let r1 = r1(1), r1(2), . . . , r1(k) and r2 = r2(1), r2(2), . . . , r2((cid:96)). The idea of the proof is to split these runs into two phases (a) elements of r1 are smaller than the corresponding elements of r2 and (b) when the elements of r1 are greater than or equal to those of r2. During each of these two phases, we use the fact that incoming elements written by S1 have to be in the buffer of S2 (and vice versa) to bound their length. We assume that both runs write exactly one element for each element they read in; this cannot affect the length of the runs. Let B0 be the original buffer, i.e., the first M elements of I. Let i be the transition point between the two 2 , tB phases mentioned above; in other words, r1(i + 1) ≥ r2(i + 1) but r1(i) < r2(i). Divide r1 into s1 and t1, where s1 is the first i elements of r1, and t1 is the remainder of r1. We further divide s1 into sB 1 be the elements of t1 that are in B0. Let f1 be the set of elements in r1 that are read in after xi+1 is written. Let u1 be the set of elements not in r1 that are read in before xi+1 is written. We define the corresponding sets for r2 as well: sB 1 , the elements of s1 that are not in B0. Let tB 1 , the elements of s1 that are in B0, and sN 2 , f2, r2, and u2. 2 , sN We can bound the size of several of these sets by M. Note that s1 cannot have more than M elements, 2 ≤ 2 must be read 2 must be in S1's buffer since all must be stored in the buffer while s2 is being written. Thus sN M. We must also have u1 ≤ M and u2 ≤ M. Finally, consider sN before time step i. Since s1 is disjoint from s2 (by definition of i), all elements of sN at time step i. All elements of tB 1 ≤ M. Similarly, sN 1 . Any element in sN 1 +sB 2 ∪ tB 1 must also be in S1's buffer at time step i, so sN Starting from time step i + 1, any new element e that is read in cannot be in both r1 and r2. This means that all elements of f1 must be in the buffer of S2 until r2 ends, and all elements of f2 must be in the buffer of S1 until r1 ends. On the other hand, all elements of u2 must eventually be a part of r1, and similarly for u1 and r2. 1 ≤ M. 2 + tB 2 +sB 2 +tB 1 +sB To begin, we show a weaker version of the lemma for runs of length 4M. We have r1 ≤ (sN 1 ) + 1 ) +f1 ≤ 3M +f1. Then if r1 ≥ 4M, then f1 ≥ M. Since all elements of f1 must (u2) + (sN be stored in the buffer of S2 until r2 ends, r2 must end when the Mth element of f1 is read in. Then we must have r2 < r1. 1 ) + (u2 +f1) < 3M. Consider We have f1 ≥ M −u2; otherwise, r1 ≤ (sN the first M −u2− 1 elements read in after i that are eventually written to r1 (this is a prefix of f1), call them f(cid:48) 1. Since f1 ≥ M − u2, there must be another element e ∈ f1 that is read after all elements of f(cid:48) 1. Note e ∈ r1. Let t be the time when e arrives. At t, the buffer of S2 must contain all elements of u2, as well as all elements of f(cid:48) 1 and e. The buffer of S2 is then full of elements that cannot be written in r2. Hence, S2 is forced to start a new run at time t < r1, so r2 < r1. Then we must have f2 + u1 < M, none of the elements in these sets are in r1, and must be stored in S1's buffer until r1 ends (which is after r2 ends). Finally, we have, 1 ) + (sN 1 +sB 2 +tB r2 ≤ (sN 2 + sB 2 ) + (sN 1 + tB 2 ) + (u1 + f2) < 3M , as required. 18 Proof of Theorem 17. Algorithm A will simulate the maximal up run, r1, and maximal down run, r2, to see which is longer, but it does not actually need to write any elements during this simulation. By Lemma 14, if we find that one run has length at least 3M, it must be the longer run. We now describe exactly how to simulate a run r using 4M space without writing any elements. Algo- rithm A simulates the run one step at a time. We describe the actions and buffer of an algorithm with M-size buffer writing r as the simulated algorithm. Without loss of generality, assume r is an up run. Assume that all elements are stored in the buffer in the order they arrive. Thus, after t elements have been written, the first M + t elements of the buffer are exactly the elements the simulated algorithm has read from the input up to time t. Of these elements, M must be in the buffer of the simulated algorithm, while the other t will have been written to r; however, A does not explicitly keep track of which elements are in the buffer. The algorithm A keeps track of (cid:96), the last element written to r, because at each t, all of the first M + t elements larger than (cid:96) are: (a) in the simulated algorithm's buffer at time t and (b) will be written to r at a later point. Thus, once no item in the first M + t elements is larger than (cid:96), r must end. At each time step, the smallest element larger than (cid:96) is written to r. Specifically, at time step t, A finds the smallest element e in the first M + t elements of the buffer that is larger than (cid:96). This is the next element of r. Thus in the next time step, A updates (cid:96) ← e, and repeats. If no such e can be found, no element in M + t (and thus no element in the buffer) can continue the run, so the run ends at time t. The last time A can update (cid:96) is when the simulated algorithm has seen all elements in the buffer; in other words, t = 3M. By Lemma 14, this is sufficient to determine which run is longer. The algorithm now knows which run is longer; without loss of generality, assume r1 ≥ r2. Then the algorithm writes a maximal run r using its 4M-size buffer in the direction of r1. Run r is guaranteed to contain all elements of r1 by Lemma 2. Since r2 has length less than 3M by Lemma 14, all of its elements must already be in the 4M-size buffer. Thus they are written during r because a maximal run always writes its buffer contents. The first initial run of a proper optimal algorithm on the unwritten-element sequence has to be either r1 or r2. Since r covers both r1 and r2, by Theorem 7 with β = 1, A never writes more runs than an optimal algorithm with an M-size buffer. Lemma A. Consider two algorithms A1 and A2 that have the same remaining input I when they both start writing a new maximal run, called r1 and r2. Let their buffers at this point be B1 and B2 (that may not be full) respectively, and assume max(B1 \ B2) ≤ min(B2 \ B1). If r1 and r2 are increasing then all elements in I written to r2 are also written to r1. Similarly, if r1 and r2 are decreasing, all elements in I written to r1 are also written to r2. Proof. It suffices to prove the first case where r1 and r2 are both increasing as the other case can be proven similarly. After r1(t) and r2(t) were written, let C1(t) and C2(t) be the set of elements in the buffers of A1 and A2 that will be written in r1 and r2 at some point in the future, i.e., the set of elements that are at least as large as r1(t) or r2(t) respectively. It is easy to prove by induction that the invariant max(C1(t) \ C2(t)) ≤ min(C2(t) \ C1(t)) always holds. We note that this invariant implies r1(t + 1) ≤ r2(t + 1). Therefore, if this invariant is true for all t < min{r1,r2}, any incoming element e ∈ I satisfies e ∈ r2 ⇒ e ∈ r1 as required. We now prove the invariant: The base case is true since C1(0) = B1, C2(0) = B2. Suppose the invariant holds for t, then r1(t + 1) ≤ Case 1: if e ∈ C2(t + 1) ⇒ e ≥ r2(t + 1) ≥ r1(t + 1) ⇒ e ∈ C1(t + 1). Case 2: if e ∈ C1(t + 1) and e /∈ C2(t + 1), then e < r2(t) = min(C2(t)) ≤ min(C2(t + 1)). r2(t + 1) and a new element e is read in. 19 Hence, the invariant holds for t + 1. 1 ◦ . . . ◦ r(cid:48) k be k Observation B. On an input I, let r1 ◦ . . . ◦ rk be the first k runs of an optimal output. If r(cid:48) runs that cover r1 ◦ . . . ◦ rk. Then, r(cid:48) k are also the first k runs of an optimal output. Proof of Lemma 16. Without loss of generality, assume r1 and r2 are initial maximal increasing and de- creasing runs respectively and r1 ≥ r2. Suppose r2 ◦ r3, where r3 is an increasing, is prefix of an optimal output SOPT(I). Consider the case r1 = r2. Let their buffers at the end of these two runs be B1, B2 and let j be the smallest index such that r1(j + 1) > r2(j + 1). Consider any new element e ∈ I that is read in before r1(j + 1) is written. Obviously, we have: 1 ◦ . . . ◦ r(cid:48) e ∈ B1 ⇒ e ≤ r1(j), e ∈ B2 ⇒ e ≥ r2(j). Consider any new element e which is read in after r1(j + 1), r2(j + 1) were written. It is easy to see the followings: e ∈ B1 \ B2 ⇒ e ≤ r1(j + 1), e ∈ B2 \ B1 ⇒ e ≥ r2(j + 1). Therefore, max(B1 \ B2) ≤ max(r1(j), r2(j + 1)) ≤ min(r2(j), r1(j + 1)) ≤ min(B2 \ B1). The situation can be visualized in Figure 2 as follows. If an incoming element cannot be written in the current run, it lies below or above (depending on whether the run is increasing or decreasing) the last element written. The regions are marked with their associated sets described above. Figure 2: Visualizing the buffer states. Consider r1 ◦ r4, where r4 is a maximal increasing run. Every elements in r2 will be written in either r1 or r4 by Lemma 6. If e ∈ r3, then we consider the cases where e ∈ B2 or e ∈ r3 \ B2. If e ∈ B2, then e is either in r1 or in B1 which means e is either in r1 or r4. If e ∈ r3 \ B2, e ∈ r4 by Lemma A using the fact that max(B1 \ B2) ≤ min(B2 \ B1). Thus, r1 ◦ r4 covers r2 ◦ r3. As a result, r1 is also a prefix of an optimal output SOPT(I)(cid:48) by Observation B. Instead of arguing based on r1 directly, we consider rf that is increasing but may not be maximal. Consider an algorithm Af that writes rf (1) = r1(1), . . . , rf (k) = r1(k). Then, without reading any new element in, it finishes its first If r1 > r2 and r2 = k. Then the simplest argument goes as follows. 20 B2\BfBf\B2B2∩Bf{z}Hjj+1rf(coveredbyr1)r2 run rf by writing out all elements in its buffer that are larger than r1(k) (the set of these elements is H in Figure 2). After this extra step, let the buffer be Bf . Use the exact same argument as above, we have that max(Bf \B2) ≤ max(rf (j), r2(j +1)) ≤ min(r2(j), rf (j +1)) ≤ min(B2\Bf ). Using the same argument as in the first case, we have that rf followed by a maximal increasing run will cover r2 followed by a maximal increasing run. Hence, rf is a prefix of an optimal output. Since r1 covers rf , it is also a prefix of an optimal output by Observation B . Proof of Theorem 19. In any partition that is not the last one, let Ir be the unwritten-element sequence and let r1, r2 be the two possible maximal initial runs where r1 is increasing and r2 is decreasing. Without loss of generality, suppose r1 ≥ r2. We use the simulation technique of Theorem 17 to determine which run is longer. The algorithm writes r1 ◦ r3 ◦ r4 where r3 and r4 are maximal runs that have the same and opposite directions as r1 respectively. The algorithm stops when there is no element left to write. We break our analysis into cases based on what runs are in an optimal output. In each case, we show that Theorem 7 proves a competitive ratio of β = 3/2. If r2 is a prefix of a proper optimal output SOPT(Ir), let r5 be the maximal run after r2 in SOPT(Ir). After writing r3, the algorithm already writes out all elements in r2 by Lemma 6. Let the unwritten-element sequence after writing r3 be I3 and let the unwritten-element sequence after writing r2 be I2. By Lemma 6, I3 is a subsequence of I2. According to Lemma 16, r5 has to be decreasing in order to possibly have fewer runs than writing r1 initially. Hence, applying Lemma 8 to r4 and r5, we know that at the end of r4, the algorithm has written all elements of r2 and r5. Thus, r1 ◦ r3 ◦ r4 covers r2 ◦ r5. If r1 ◦ r3 is a prefix of SOPT(IR), then we are done as r1 ◦ r3 ◦ r4 trivially covers r1 ◦ r3. If r1 is a prefix of SOPT(IR) but r1 ◦ r3 is not a prefix of SOPT(IR). Then, let r(cid:48) 3 be the opposite maximal 3 are the first two runs of SOPT(IR). We have I3 is a subsequence of I1. Hence, applying 3 on input I1 and r4 on input I3, we have that at the end of r4, the algorithm has written out all 3. Thus, r1 ◦ r3 ◦ r4 covers r1 ◦ r(cid:48) 3. run to r3, i.e., r1, r(cid:48) Lemma 8 to r(cid:48) elements in r1 ◦ r(cid:48) In the last partition, since A outputs at most 3 runs, it can only achieve a ratio worse than 3/2 if the optimal algorithm wrote out a single run. But then that run is longer, and A would choose it. Therefore, we have R(S) ≤ (3/2) · OPT. Proof of Theorem 20. In each partition, let the unwritten-element sequence be Ir and the optimal proper output of Ir be SOPT(Ir). The algorithm randomly picks the direction of the next run and writes a maximal runs in that direction using M-size buffer. It uses the extra M buffer slots to simulate the buffer state of the maximal run in the other direction to check if the run it chose is at least as long as the other run. If the algorithm picked the run that is at least as long as the other run, it then writes a maximal run in the same direction followed by another maximal run in the opposite direction. The algorithm stops when there is no more element to write. In the proof of Theorem 19, we showed that these three runs will cover the first two runs of SOPT(Ir). If the algorithm picked the shorter run, then it writes three more maximal runs with alternating directions. We know that the first two runs with alternating directions cover the first run of SOPT(Ir) as argued in the proof of Theorem 9; hence, the next two runs with alternating directions cover the second run of SOPT(Ir). In the last partition, if OPT(Ir) = 2, the analysis is the same. If OPT(Ir) = 1, then the optimal output must be the longer maximal run. The algorithm, if picked the shorter run, then will cover the longer run when it writes the next maximal run in the opposite direction as showed in the proof of Theorem 9. Therefore, we have E[xi]/yi ≤ 1/2.(4/2) + 1/2.(3/2) = 7/4. Applying Theorem 7 with α = 1.75 and β = 2, we have: E[R(S)] ≤ (7/4)OPT and R(S) = 2OPT. Proof of Theorem 21. Suppose an algorithm has (4M − 3)-size buffer. Consider the input I1 ◦ e ◦ I2 where I1 = (1 (cid:37) M − 1) ◦ (2M − 1 (cid:38) M ) ◦ (3M (cid:37) 4M − 2) ◦ (−M (cid:38) −2M + 2). 21 If S first writes −2M + 2, then let e = −2M + 1. • Case 1: if S writes e = −2M + 1 next, then let I2 = (0 (cid:38) −(M − 1)). Thus, S has to spend at least two runs while an optimal output is one run: (4M − 2 (cid:38) 3M ) ◦ (2M − 1 (cid:38) −2M + 1). • Case 2: if S writes −2M + 3 next, let I2 = (−2M (cid:38) −10M )◦ (2M (cid:37) 3M − 1). Then S has to spend at least 3 runs while an optimal output has 2 runs: (4M −2 (cid:38) 3M )◦(2M −2 (cid:38) −10M )◦(2M (cid:37) 3M −1). Similarly, if S first writes 4M − 2, then let e = 4M − 1. • Case 1: if S writes e = 4M − 1 next, then let I2 = (2M (cid:37) 3M − 1). • Case 2: if S writes 4M − 3 next, let I2 = (4M (cid:37) 10M ) ◦ (0 (cid:38) −M + 1). If S first writes e(cid:48) /∈ {−2M + 2, 4M − 2}, then let e = −2M + 1, I2 = (0 (cid:38) −(M − 1)). Thus, S has to spend at least two runs while an optimal output has the following output with one run: (4M − 2 (cid:38) 3M ) ◦ (2M − 1 (cid:38) −2M + 1). Proof of Theorem 22. We apply Theorem 7 with x = ((cid:100)1/ε(cid:101) + 1) and y = (cid:100)1/ε(cid:101). In any partition except the last one, the algorithm chooses the combination of (cid:100)1/ε(cid:101) maximal runs r1 ◦ ··· ◦ r(cid:100)1/ε(cid:101) whose output is longest (ties are broken arbitrarily) and writes out one extra run r((cid:100)1/ε(cid:101)+1). By Lemma 6, r1 ◦ ··· ◦ r(cid:100)1/ε(cid:101)+1 covers the first (cid:100)1/ε(cid:101) runs of a proper optimal output of the unwritten-element sequence Ir in (1 + (cid:100)1/ε(cid:101)) runs. In the last partition, the algorithm chooses a combination of runs with the smallest number of runs. Therefore, we obtain an β = 1 + 1/(cid:100)1/ε(cid:101) ≤ 1 + ε approximation. There are 2(cid:100)1/ε(cid:101)+1 combinations to consider (each run can be up or down). The length of a run can be calculated in O(Ni) time by simulating it directly. where Ni is the length of the longest output, namely, r1 ◦ ··· ◦ r(cid:100)1/ε(cid:101)+1, Since Ni items are then written out, the total running time is O((cid:80)t i=1 Ni2(cid:100)1/ε(cid:101)) = O(N 21/ε). Searching for the shortest way to write out the remaining elements (once Ir = ∅) takes O(N 21/ε) time, which does not affect the running time. Proof of Theorem 23. In each partition, we restrict the search for the combination of (1/(cid:100)ε(cid:101)) consecutive runs that writes the longest sequence as described above. By Lemma 16, if d runs remain to be written out, we must examine one subcase with d − 1 runs remaining, and one with d − 2 runs remaining. Thus, the number of combinations we need to consider is Fd = Fd−1 + Fd−2. Therefore, the running time of this step is O(F(cid:100)1/ε(cid:101)Ni log Ni). Thus, we have O(F(cid:100)1/ε(cid:101)Ni log Ni) = O(ϕ (cid:100)1/ε(cid:101) Ni log Ni). − ψ(cid:100)1/ε(cid:101))/√5 ≤ ϕ(cid:100)1/ε(cid:101). This is because F(cid:100)1/ε(cid:101) = (ϕ(cid:100)1/ε(cid:101) Proof of Theorem 24. At each decision time step, A flips a coin to pick a direction for the next run r. It begins writing an up or down run according to the coin flip. Meanwhile, A uses M additional space to simulate r(cid:48), the run in the opposite direction. In particular, it simulates the contents of the buffer at each time step, as well as the last element written. Note that A does not need to keep track of the most recent element read when simulating r(cid:48), as it is always the last element in the buffer. By Lemma 14, the run with the incorrect direction has length less than 3M and the run with the correct direction has length of 3M or more. Thus, A can tell if it picked the correct direction. With probability 1/2, A writes the longer run. Therefore, it knows it made the correct direction and repeats, flipping another coin. Now consider the case where A picks the wrong direction. When r ends (at time t), r(cid:48) is continuing. Then A must act exactly as if it had written r(cid:48). Specifically, we cannot simply cover r(cid:48) and use an argument akin to Theorem 7, as then the unwritten-element sequence may not be 3-nearly-sorted. To simulate r(cid:48), A has two tasks: (a) A must write all elements that were written by r(cid:48) that were not written by r, and (b) A must "undo" writing any element that was written during r that is not in r(cid:48), in case 22 these elements are required to make a subsequent run have length 3M. Divide the buffer into two halves: Br is the buffer after writing r, and Br(cid:48) is the buffer being simulated when r ends. The first task is to ensure that A writes all elements written by r(cid:48) that were not written by r in the direction of r(cid:48). These elements must be in Br since they were not written by r; and they must not be in Br(cid:48) since they were written by r(cid:48). Thus, A can simply write out each element in Br that is not in Br(cid:48) and continue writing r(cid:48) from that time step. The second task is to ensure that all elements written during r that were not written during r(cid:48) cannot affect future run lengths. These elements must be in Br(cid:48) but not in Br. We mark these elements as special ghost elements. We can do this with O(1) additional space by moving them to the front of the buffer and keeping track of how many of them there are. During subsequent runs, these are considered to be a part of A's buffer. However, when A would normally want to write one of these elements out, it instead simply deletes it from its buffer without writing any element. That said, A still counts these deletions towards the size of the run. Note that our buffer never overflows, as A continues to write (or delete) one element per time step. When this simulation is finished, the contents of A's buffer are exactly what they would have been had it written out r(cid:48) in the first place -- however some are ghost elements, and will be deleted instead of written. Then A repeats, flipping another coin. For each run in the optimal output, either: A writes that run exactly for cost 1 (with probability 1/2), or A writes another run, and makes up for its mistake by simulating the correct run exactly, for cost 2 (with probability 1/2). Thus A has expected cost (3/2)OPT. In the worst case, A guesses incorrectly each time for a total cost of 2OPT. 1 , tB 1 , f1, u1, sB 2 , sN 2 , tB Proof of Lemma 25. Suppose we are at a decision time step. Without loss of generality, assume this time step to be 0. Let the next two possible maximal runs be r1 and r2 that are up and down respectively. Without loss of generality, suppose r1 ≥ 5M. Let r3 be the maximal decreasing run that follows r2. By Lemma 16, either writing r1 or writing r2 ◦ r3 is optimal on the unwritten-element sequence. Call the two outputs S1 and S2 respectively. 2 , f2, u2 be the same sets described in the proof of Lemma 14. Let r1 = 1 , sN (x1, . . . , xk), r2 = (y1, . . . , y(cid:96)), r3 = (y(cid:96)+1, . . . , yq). Let the buffers of S1 and S2 after time step t + (cid:96) be B1,(cid:96), B2,(cid:96). Let j ≥ (cid:96) be the smallest such that xj+1 ≥ yj+1. 1,2 be the set of elements in r1,2 but not in B1,(cid:96) . Let sB 1,2 be the set of elements in r1,2 and also in B1,(cid:96) \ r2. Let tB 1,2 be the set of elements in t1,2 and also in B1,(cid:96) \ r2. Let u1,2 be the set of elements not in r1 and read in before xj+1 is written. Let f1,2 be the set of elements in r1 and read in after xj+1 is written. 3 be the set of elements in s3 but not in 3 be the set of elements in s3 ∩ B2,(cid:96). Let u3 be the set of elements that are not in r3 and read in 1,2 ≤ M. B2,(cid:96). Let sB before yj+1 is written. Let f3 be the set of elements in r3 and read in after yj+1 is written. 1,2 at time step j + 1, we have sN Similar to the proof of Lemma 14, we let r1,2 = {x(cid:96)+1, . . . , xj} and t1,2 = {xj+1, . . . , xk}. Let sN We define s3 = {y(cid:96)+1, . . . , yj} and t3 = {yj+1, . . . , yq}. Let sN Since the buffer of S2 must keep all elements in sN 1,2 + sB 1,2, sB Let sB We have, r1 = r2 + (u3 + sN 3 ) + (sN 1,2 + sB 1,2) + f1,2 ≤ (2M + u1 + f2) + (M − u1 − f2) + M + f1,2 = 4M + f1,2. Since f1,2 ≥ M because of our assumption r1 ≥ 5M, r3 has to end before r1 using the same argument as in the proof of Lemma 14. Since r1 ≥ r2◦r3, r1 followed by any maximal run will cover r2◦r3. Therefore, r1 is an optimal prefix of the unwritten-element sequence. At every time step, the maximal run of length 5M or more is always a prefix of an optimal output on the unwritten-element sequence as required. 23
1504.04993
1
1504
2015-04-20T09:58:53
Tabulation of Noncrossing Acyclic Digraphs
[ "cs.DS", "math.CO" ]
I present an algorithm that, given a number $n \geq 1$, computes a compact representation of the set of all noncrossing acyclic digraphs with $n$ nodes. This compact representation can be used as the basis for a wide range of dynamic programming algorithms on these graphs. As an illustration, along with this note I am releasing the implementation of an algorithm for counting the number of noncrossing acyclic digraphs of a given size. The same tabulation can be modified to count other classes of combinatorial structures, including weakly connected noncrossing acyclic digraphs, general noncrossing digraphs, noncrossing undirected graphs.
cs.DS
cs
Tabulation of Noncrossing Acyclic Digraphs Marco Kuhlmann Department of Computer and Information Science Linköping University, Sweden 31st July 2018 1 Introduction A noncrossing graph is a graph with its vertices drawn on a circle and its edges drawn in the interior such that no two edges cross each other. This note is concerned with noncrossing acyclic digraphs. Examples of such structures are given in Figure 1. I present an algorithm that, given a number n ≥ 1, computes a compact representation of the set of all noncrossing acyclic digraphs with n nodes. This compact representation can be used as the basis for a wide range of dynamic programming algorithms on these graphs. As an illustration, along with this note I am releasing the implementation of an algorithm for counting the number of noncrossing acyclic digraphs of a given size.1 This number is given by the following integer sequence (starting with n = 1); this is A246756 in the OEIS [OEIS Foundation Inc., 2011]: 1, 3, 25, 335, 5521, 101551, 1998753, 41188543, 877423873, 19166868607, . . . Another application of the tabulation technique is in semantic dependency pars- ing [Oepen et al., 2014], where it can be used to compute the highest-scoring dependency graph for a given sentence under an edge-factored model. 1https://github.com/khlmnn/ncdags 2 2 2 1 3 1 3 1 3 4 2 4 2 4 2 1 3 1 3 1 3 4 2 4 2 4 2 1 3 1 3 1 3 4 2 4 2 4 2 1 3 1 3 1 3 4 2 4 2 4 2 1 3 1 3 1 3 4 2 4 2 4 2 1 3 1 3 1 3 4 2 4 2 4 2 1 3 1 3 1 3 4 4 4 Figure 1: Some (out of 335) noncrossing acyclic digraphs of size 4. 1 2 Preliminaries Before presenting the tabulation I introduce some terminology for special types of noncrossing acylic digraphs, as well as a set of operations on graphs that will be useful for the understanding of the technique. 2.1 Classification The proposed tabulation is based on a classification of noncrossing acyclic di- graphs into 7 different types. To simplify the presentation I only consider graphs with at least 2 nodes. A graph is called edge-covered if there is an edge connecting its extremal vertices. Thus there are 2 types of edge-covered graphs: • The covering edge goes from the minimal vertex to the maximal vertex. In this case, I say that the graph is minmax-covered. • The covering edge goes from the minimal vertex to the maximal vertex. In this case, I say that the graph is maxmin-covered. If a graph is not edge-covered, I distinguish two cases depending on whether or not the graph is weakly connected -- that is, whether there exists a path (consisting of two or more edges) between the extremal vertices. In the following I use the term connected in the sense 'weakly connected but not edge-covered'. I distinguish 3 types of connected graphs: • There is a directed path from the minimal vertex to the maximal vertex. In this case, I say that the graph is minmax-connected. • There is a directed path from the maximal vertex to the minimal vertex. In this case, I say that the graph is maxmin-connected. Note that because of acyclicity, a graph cannot be both minmax-connected and maxmin- connected. • There is no directed path between the two extremal vertices, implying that there is a path consisting of edges with mixed directions. In this case, I say that the graph is mix-connected. The last two types are the graphs that are neither edge-covered nor connected. In the following I refer to these graphs as unconnected. I distinguish 2 types: • The graph has 2 nodes. In this case, the graph is uniquely determined; it is the graph with 2 nodes and no edges. I refer to this graph as the elementary graph. • The graph has more than 2 nodes. I say that the graph is non-elementary. Note that this classification is exhaustive, meaning that every noncrossing acyc- lic digraph falls into (exactly) one of the 7 classes. 2 2.2 Operations The proposed tabulation takes an algebraic view on noncrossing acyclic digraphs where every graph is composed from 'smaller' graphs by means of three opera- tions: • Concatenate two graphs, identifying the last vertex of the first graph with the first vertex of the second graph. This operation is perhaps easiest illustrated by drawing the graphs on a straight line rather than on a circle. (With this layout, the non-crossing condition means that the edges can be drawn in the half-plane above the line without crossings.) concatenating 1 2 3 4 and 4 5 yields 1 2 3 4 5 Here the vertices and edges contributed by the first graph are drawn in blue, those contributed by the second graph are drawn in red, and the joint vertex (simultaneously the last vertex of the first graph and the first vertex of the second graph) is highlighted in yellow. • Cover a graph by adding a new edge (with two possible directions) between the first vertex and the last vertex. In the following illustration, the new edges are drawn in red: covering 1 2 3 4 yields 1 2 3 4 or 1 2 3 4 Note that the set of noncrossing acyclic digraphs is not closed under these operations. In particular, the cover operations may introduce cycles and even multiple edges. 3 Tabulation I present the proposed tabulation as a deduction system in the sense of Shieber et al. [1995]. Tabulation is viewed as a deductive process in which rules of inference are used to derive statements about sets of graphs from other such statements. Statements are represented by formulas called items. Notation Recall that I assume that n ≥ 2. In the following, 1 ≤ i ≤ j ≤ k ≤ n. 3.1 Items Following the classification given in Section 2.1, the items of the deduction system take one of 7 possible forms. I represent these items using a graphical notation that is intended to be mnemonic. 3 • Items for edge-covered graphs. For j − i ≥ 1: i j i j The intended interpretation of these items is: 'It is possible to construct an edge-covered noncrossing acyclic digraph on the vertices i, . . . , j.' • Items for connected graphs. For j − i ≥ 2: · · · · · · · · · i j i j i j The intended interpretation of these items is: 'It is possible to construct an minmax-connected, maxmin-connected, mix-connected noncrossing acyc- lic digraph on the vertices i, . . . , j.' • Items for elementary graphs. For j − i = 1: i j The intended interpretation of these items is: 'The elementary graph on the vertices i, j is a noncrossing acyclic digraph.' • Items for unconnected graphs. For j − i ≥ 2: · · ·// i j The intended interpretation of these items is: 'It is possible to construct an unconnected noncrossing acyclic digraph on the vertices i, . . . , j.' 3.2 Axioms The axioms of the deduction system are the items for the elementary graphs. 3.3 Rules The deduction system has 26 rules. Each of these rules simulates a concatena- tion or cover operation on the 7 different types of noncrossing acyclic digraphs specified in Section 2.1. 4 Concatenate two edge-covered graphs The first four rules simulate the concatenation of two edge-covered graphs. The result of such a concatenation is a connected graph: i j j k i j j k i j j k i j j k 01 02 03 04 · · · · · · · · · · · · i k i k i k i k For instance, rule 03 states that the concatenation of a minmax-covered graph on the vertices i, . . . , j and an maxmin-covered graph on the vertices j, . . . , k yields a mix-connected graph on the vertices i, . . . , k. Concatenate an edge-covered graph and the elementary graph The next rules simulate the concatenation of an edge-covered graph and the element- ary graph. The result of such a concatenation is an unconnected graph. There are 4 cases: i j j k i j j k i j j k i j j k 05 06 07 08 · · ·// · · ·// · · ·// · · ·// i k i k i k i k Concatenate a connected graph and an edge-covered graph The fol- lowing rules simulate the concatenation of a connected graph and an edge- covered graph. The result of such a concatenation is a connected graph. There are 6 cases; I group them based on the type of the first argument of the concat- enation operation. Group 1: The first argument is minmax-connected · · · · · · i j j k i j j k 09 10 · · · i k · · · i k Group 2: The first argument is maxmin-connected · · · · · · i j j k i j j k 11 12 · · · i k · · · i k 5 Group 3: The first argument is mix-connected · · · · · · i j j k i j j k 13 14 · · · i k · · · i k Concatenate a connected graph and the elementary graph The next rules simulate the concatenation of a connected graph and the elementary graph. The result of such a concatenation is an unconnected graph. There are 3 cases: · · · · · · · · · i j j k i j j k i j j k 15 16 17 · · ·// · · ·// · · ·// i k i k i k Concatenate to an unconnected graph The next rules simulate the con- catenation to an unconnected graph. The result of such a concatenation is another unconnected graph. I consider 3 cases: · · ·// · · ·// · · ·// i j j k i j j k i j j k 18 19 20 · · ·// · · ·// · · ·// i k i k i k Cover a graph The rules in the final set simulate the cover operations. The result of such an operation is an edge-covered graph. There are 6 cases; I group them based on the direction of the covering edge. Group 1: The covering edge goes from the minimal vertex to the maximal vertex · · · · · · · · ·// i j 21 i j 22 i j 23 i j i j i j 6 Group 2: The covering edge goes from the maximal vertex to the minimal vertex · · · · · · · · ·// i j 24 i j 25 i j 26 i j i j i j This completes the presentation of the rules. 3.4 Goal Items In contrast to the deduction systems of Shieber et al. [1995], the proposed tabu- lation does not have a unique goal item but 7 different goal items, corresponding to the 7 types of noncrossing acyclic digraphs (Section 2.1). 1 n 1 n 1 n · · · · · · · · · · · ·// 1 n 1 n 1 n 1 n 3.5 Properties While I shall not provide a complete formal analysis of the tabulation, I briefly mention some crucial properties: • The runtime of the tabulation is in O(n3) and the space required for it is in O(n2). This can be seen by counting the number of possible instances of each inference rule and item. • The deduction system is sound, meaning that for each rule, if the state- ments encoded by the antecedents hold, then the statement encoded by the consequent holds as well. To see this, one can check the soundness of each rule. • The deduction system is complete, meaning that every noncrossing acyclic digraph can be constructed in a way that can be simulated by the inference rules. The completeness argument starts from the observation that the classification given in Section 2.1 is exhaustive, and then checks for each rule that undoing the operation simulated by that rule decomposes a graph represented by the consequent item into the graphs represented by the antecedents. • Every noncrossing acyclic digraph has a unique derivation in the deduc- tion system. This property is useful because it means that we do not need to distinguish between graphs and their derivations. In particular, we 7 can count graphs by counting their derivations. The uniqueness argument makes use of the observations that the graph types distinguished in Sec- tion 2.1 are non-overlapping, and that the backward application of rules is deterministic in the sense that for each graph there is at most one rule in which this graph appears as the consequent item. 4 Derived Tabulations I conclude this note by noting how tabulation techniques for other classes of noncrossing graphs can be derived from the proposed technique. 4.1 Enforcing Weak Connectivity To obtain a deduction system for weakly connected noncrossing acyclic digraphs one removes rule 20 (concatenate an unconnected graph and the elementary graph) and deletes the item for unconnected graphs from the list of goal items. Along with this change comes a revised intended interpretation for the items for unconnected graphs: 'It is possible to construct a noncrossing acyclic digraph on the vertices i, . . . , j that is not edge-covered and has exactly two weakly connected components.' The integer sequence for weakly connected noncrossing acyclic digraphs is: 1, 2, 18, 242, 3890, 69074, 1306466, 25809826, 526358946, 10997782882, . . . 4.2 Unrestricted Noncrossing Digraphs To obtain a deduction system for unrestricted (not necessarily acyclic) non- crossing digraphs, one does away with the items for minmax-connected and maxmin-connected graphs, and deletes all rules that reference them -- with the exception of rules 01 and 02 (concatenating two edge-covered graphs with the same directionality of the covering edge), which should be changed to produce mix-connected items. This yields the following integer sequence for unrestricted noncrossing digraphs: 1, 4, 64, 1792, 62464, 2437120, 101859328, 4459528192, 201889939456, . . . 4.3 Noncrossing Undirected Graphs By removing rules 24 -- 26 (or 21 -- 23), one obtains a tabulation of noncrossing undirected graphs. This is also known as the class of (undirected) graphs with pagenumber 1 under a fixed ordering of the vertices along the spine. This class is counted by A054726 resp. A007297 (if additionally one requires the graph to be connected) in the OEIS [OEIS Foundation Inc., 2011]: 1, 1, 2, 8, 48, 352, 2880, 25216, 231168, 2190848, . . . 1, 4, 23, 156, 1162, 9192, 75819, 644908, 5616182, 49826712, . . . 8 Acknowledgments The decomposition that is the basis for the tabulation presented in this note was inspired by a counting technique for noncrossing acyclic digraphs proposed by Tirrell [2014]. I benefited greatly from discussions with the participants of the Dagstuhl Seminar 15122 'Formal Models of Graph Transformation in Natural Language Processing'. Document history 2014-08-12 First version. 2014-08-13 Add a section on derived tabulations (weakly connected noncross- ing digraphs, unrestricted noncrossing digraphs). 2015-04-20 Add a mention that the tabulation can be used to count the num- ber of noncrossing undirected graphs. References OEIS Foundation Inc. The on-line encyclopedia of integer sequences. http://oeis.org, 2011. Stephan Oepen, Marco Kuhlmann, Yusuke Miyao, Daniel Zeman, Dan Flickinger, Jan Hajič, Angelina Ivanova, and Yi Zhang. SemEval 2014 Task 8: Broad-coverage semantic dependency parsing. In Proceedings of the 8th In- ternational Workshop on Semantic Evaluation (SemEval 2014), pages 63 -- 72, Dublin, Republic of Ireland, 2014. Stuart M. Shieber, Yves Schabes, and Fernando Pereira. Principles and imple- mentation of deductive parsing. Journal of Logic Programming, 24(1 -- 2):3 -- 36, 1995. Jordan Tirrell. What is the number of noncrossing acyclic digraphs? Math- Overflow, 2014. http://mathoverflow.net/q/177008 (version: 2014-08-01). 9
1608.07002
1
1608
2016-08-25T01:56:40
A simple linear space algorithm for computing a longest common increasing subsequence
[ "cs.DS" ]
This paper reformulates the problem of finding a longest common increasing subsequence of the two given input sequences in a very succinct way. An extremely simple linear space algorithm based on the new formula can find a longest common increasing subsequence of sizes $n$ and $m$ respectively, in time $O(nm)$ using additional $\min\{n,m\}+1$ space.
cs.DS
cs
A simple linear space algorithm for computing a longest common increasing subsequence Daxin Zhu, Lei Wang, Tinran Wang, and Xiaodong Wang April 29, 2018 Abstract This paper reformulates the problem of finding a longest common increasing subsequence of the two given input sequences in a very succinct way. An extremely simple linear space algorithm based on the new formula can find a longest common increasing subsequence of sizes n and m respectively, in time O(nm) using additional min{n, m} + 1 space. 1 Introduction The study of the longest common increasing subsequence (LCIS) problem originated from two classical subsequence problems, the longest common subsequence (LCS) and the longest increasing subsequence (LIS). The classic algorithm to the LCS problem is the dynamic programming solution of Wagner and Fischer[?], with O(n2) worst case running time. Masek and Paterson[7] improved this algorithm by using the "Four- Russians" technique to reduce its running time to O(n2/ log n) in the worst case. Since then, there has been not much improvement on the time complexity in terms of n found in the literature. There is also a rich history for the longest increasing subsequence problem, e.g., see [2, 3, 5]. The LCIS problem for input sequences X and Y consists of finding a subsequence Z of X and Y which is both an increasing sequence and a common subsequence of X and Y with maximal length. Yang et al. [9] designed a dynamic programming algorithm that finds an LCIS of two input sequences of size n and If the length of the LCIS, l, is small, Katriel and Kutz [6] gave a faster m in O(nm) time and space. If r, the total number of ordered pairs of positions at which algorithm which runs in O(nl log n) time. the two input sequences match, is relatively small, Chan et al. [1] gave a faster algorithm which runs in O(min(r log l, nl + r) log log n + n log n) time where n is the length of each sequence and r is the total number of ordered pairs of positions at which the two sequences match and l is the length of the LCIS. A first linear space algorithm was proposed by Yoshifumi Sakai [8]. The space cost of the algorithm of Yang et al. was reduced to linear by a careful application of Hirschbergs divide-and-conquer method [4]. The space complexity of the algorithm of Katriel and Kutz [6] was also reduced from O(nl) to O(m) by using the same divide-and-conquer method of Hirschberg [4]. In this paper, we solve the problem in a new insight. Based on a novel recursive formula, we find a very simple linear space algorithm but not the Hirschbergs divide-and-conquer method to solve the problem. 2 Definitions and Terminologies In the whole paper we will use X = x1x2 · · · xn and Y = y1y2 · · · ym to denote the two input sequences of size n and m respectively, where each pair of elements in the sequences is comparable. Some terminologies on the LCIS problem are usually referred to in the following way. Definiton 1. 1 A subsequence of a sequence X is obtained by deleting zero or more characters from X (not necessarily contiguous). For a given sequence X = x1x2 · · · xn of length n, the ith character of X is denoted as xi ∈P for any i = 1, · · · , n. We set the ith prefix of X = x1x2 · · · xn, for i = 0, 1, · · · , n, as Xi = x1x2 · · · xi , and X0 is the empty sequence. Definiton 2. An appearance of sequence Z = z1z2 · · · zk in sequence Y = y1y2 · · · ym, starting at position j is a sequence of strictly increasing indexes j1, j2, · · · , jk such that j1 = j, and Z = yj1, yj2 , · · · , yjk . The sequence Z is referred to as a subsequence of Y . Given two sequences X = x1x2 · · · xn and Y = y1y2 · · · ym, we say that a sequence Z is a common subsequence of X and Y if Z is a subsequence of both X and Y . For the given sequence X = x1x2 · · · xn, if x1 < x2 < · · · < xn, then X is called an increasing sequence. For the two sequences X = x1x2 · · · xn and Y = y1y2 · · · ym, we say that a sequence Z is a common increasing subsequence (CIS) of X and Y if Z is an increasing sequence and a common subsequence of X and Y . The longest common increasing subsequence of X and Y , is a common increasing subsequence whose length is the longest among all common increasing subsequences of the two given sequences. Example. Let X = (3, 5, 1, 2, 7, 5, 7) and Y = (3, 5, 2, 1, 5, 7). We have, n = 7 and m = 6. X3 = (3, 5, 1), and X0 is the empty sequence. Z = (3, 1, 2, 5) is a subsequence of X with corresponding index sequence (1, 3, 4, 6). The subsequence (3, 5, 1) and (3, 5, 7) are common subsequences of both X and Y , and the subsequence (3, 5, 7) is an LCIS of X and Y . Definiton 3. For each pair (i, j), 1 ≤ i ≤ n, 1 ≤ j ≤ m, the set of all LCISs of Xi and Yj that ends on yj is denoted by LCIS(Xi, Yj). The length of an LCIS in LCIS(Xi, Yj) is denoted as f (i, j). Definiton 4. A match for two sequences X = x1x2 · · · xn and Y = y1y2 · · · ym is an ordered pair (i, j), 1 ≤ i ≤ n, 1 ≤ j ≤ m such that xi = yj. The match function δ(i, j) of X and Y can be defined as: δ(i, j) =(1, if xi = yj 0, otherwise. Definiton 5. For each pair (i, j), 1 ≤ i ≤ n, 1 ≤ j ≤ m, the index set β(i, j) can be defined as follows: β(i, j) = {t 1 ≤ t < j, yt < xi} (1) (2) 3 A recursive formula Similar to the O(nm) solution of Wagner and Fischer for computing the length of an LCS, a standard dynamic programming algorithm can be built based on the following recurrence for the length f (i, j) of an LCIS in LCIS(Xi, Yj), 1 ≤ i ≤ n, 1 ≤ j ≤ m. Theorem 1. Let X = x1x2 · · · xn and Y = y1y2 · · · ym be two input sequences over an alphabet P of size n and m respectively. For each 1 ≤ i ≤ n, 1 ≤ j ≤ m, f (i, j), the length of an LCIS of Xi and Yj that ends on yj, can be computed by the following dynamic programming formula. 0, f (i − 1, j), 1 + max t∈β(i,j) f (i, j) =  if i = 0 or j = 0, if i, j > 0 and xi 6= yj, if i, j > 0 and xi = yj. f (i − 1, t), (3) 2 Proof. (1) The initial case is trivial. (2) In the case of xi 6= yj, we have, Z ∈ LCIS(Xi, Yj) if and only if Z ∈ LCIS(Xi−1, Yj), and thus LCIS(Xi, Yj) = LCIS(Xi−1, Yj ). Therefore, f (i, j) = f (i − 1, j). (3) In the case of xi = yj, let Z = z1z2 · · · zk ∈ LCIS(Xi, Yj) be an an LCIS of Xi and Yj that ends on yj. In this case, we have, f (i, j) = k, and z1z2 · · · zk−1 must be a common increasing subsequence of Xi−1 and Yt for some 1 ≤ t < j, and zk−1 = yt < yj. It follows that k − 1 ≤ LCIS(Xi−1, Yt), and thus f (i, j) ≤ 1 + max t∈β(i,j) f (i − 1, t) (4) On the other hand, let Z = z1z2 · · · zk ∈ LCIS(Xi−1, Yt) for some 1 ≤ t < j, and zk = yt < yj, then Z ⊕ yj must be a common increasing subsequence of Xi and Yj ending on yj. This means, k + 1 ≤ f (i, j), and thus f (i − 1, t) + 1 ≤ f (i, j). It follows that f (i, j) ≥ 1 + max t∈β(i,j) f (i − 1, t) (5) Combining (4) and (5), we have f (i, j) = 1 + max t∈β(i,j) f (i − 1, t). The proof is complete. The table f has a very nice property as stated in the following Lemma. Lemma 1. For each pair (i, j), 1 ≤ i ≤ n, 1 < j ≤ m, if δ(i, j) = 1 and f (i, j) > 1, then there must be an index r such that Proof. 1 ≤ r < j, yr < yj, f (i, r) = f (i, j) − 1. (6)   It follows from (3) and δ(i, j) = 1 that f (i, j) = 1 + max t∈β(i,j) f (i − 1, t) = 1 + f (i − 1, r), where 1 ≤ r < j and yr < yj. It follows from (3) and δ(i, r) = 0 that f (i, r) = f (i − 1, r) = f (i, j) − 1. The proof is complete. 4 Implementations Based on Theorem 1, the length of LCISs for the given input sequences X = x1x2 · · · xn and Y = y1y2 · · · ym of size n and m respectively, can be computed in O(nm) time and O(nm) space by a standard dynamic programming algorithm. Algorithm 1: LCIS Input: X, Y Output: f (i, j), the length of LCIS of Xi and Yj ending on yj for i=1 to n do θ ← 0; for j=1 to m do f (i, j) ← f (i − 1, j); if xi > yj and f (i, j) > θ then θ ← f (i, j); if δ(i, j) = 1 then f (i, j) ← θ + 1; end end return max1≤j≤m f (n, j) 3 It is clear that the time and space complexities of the algorithm are both O(nm). When computing a particular row of the dynamic programming table, no rows before the previous row are required. Thus only two rows have to be kept in memory at a time. Without loss of generality, we can assume n ≥ m in the following discussion. Thus, we need only min{n, m} + 1 entries to compute the table. Based on Hirschbergs divide-and-conquer method of solving the LCS problem in linear space [6], Yoshifumi Sakai presented a linear space algorithm for computing an LCIS. The algorithm is a bit involved. Based on the formula (3), we can reduce the space cost of the algorithm LCIS to min{n, m} + 1. The improved linear space algorithm can also produce an LCIS in adiitional O(m) time. A space efficient algorithm to compute f (i, j) and an LCIS can be described as follows. Algorithm 2: Linear Space Input: X, Y Output: f (i, j), the length of LCIS of Xi and Yj ending on yj for i = 1 to n do L(0) ← 0; for j = 1 to m do if xi > yj and L(0) < L(j) then L(0) ← L(j); if xi = yj then L(j) ← 1 + L(0); end end L(0) ← max1≤j≤m L(j); return L(0) In the algorithm above, the array L of size m + 1 is utilized to hold the appropriate entries of f . At the time f (i, j) to be computed, L will hold the following entries: • L(k) = f (i, k) for 1 ≤ k < j − 1 (i.e., earlier entries in the current row); • L(k) = f (i − 1, k) for k ≥ j − 1 (i.e., entries in the previous row); • L(0) = θ (i.e., the previous entry computed, which has a maximal value). Therefore, a total of m + 1 entries is used in the algorithm. The time complexity of the algorithm is obviously O(nm). At the end of the algorithm, the maximal length is stored in L(0). It follows from Lemma 1, we can produce an LCIS of X and Y by using the computed array L as follows. The LCIS is produced backwards. The elements can be found successively by a recursive scan algorithm N ext as follows. Algorithm 3: N ext(j, v, len) Input: The current position j; the last element v; the current length len. Output: The next element. while L(j) 6= len or v ≤ yj do j ← j − 1; if j > 0 and len > 0 then N ext(j, yj, len − 1); Print yj; end The LCIS can then be produced by an initial call N ext(m, ∞, L(0)). It is clear that the algorithm will produce an LCIS of X and Y in additional O(m) time. Example ( continued ). For the given input sequences of X = (3, 5, 1, 2, 7, 5, 7) and Y = (3, 5, 2, 1, 5, 7), f (i, j), the length of an 4 1, 0, 0, 0, 0, 0 1, 2, 0, 0, 2, 0 1, 2, 0, 1, 2, 0 1, 2, 1, 1, 2, 0 1, 2, 1, 1, 2, 3 1, 2, 1, 1, 2, 3 1, 2, 1, 1, 2, 3     LCIS in LCIS(Xi, Yj) is listed below. f = It follows from the above that the length of any LCIS of X and Y is 3. The LCIS (1, 5, 7) of X and Y can be generated by the algorithm Build. Finally, our main result can be completed in the following theorem. Theorem 2. Let X = x1x2 · · · xn and Y = y1y2 · · · ym be two input sequences over an alphabet P of size n and m respectively. A longest common increasing subsequences of X and Y can be computed in time O(nm) using additional min{n, m} + 1 space. 5 Concluding remarks We have reformulated the problem of computing a longest common increasing subsequence of the two given input sequences X and Y of size n and m respectively. An extremely simple linear space algorithm based on the new formula can find a longest common increasing subsequence of X and Y in time O(nm) using additional min{n, m} + 1 space. The time complexity of the new algorithm may be improved further. References [1] W. Chan, Y. Zhang, S. P.Y. Fung, D. Ye, and H. Zhu, Efficient Algorithms for Finding a Longest Common Increasing Subsequence, LNCS 3827, 2005, pp. 665-674. [2] Crochemore M., Porat E., Fast computation of a longest increasing subsequence and applica- tion,Information and Computation 208, 2010, pp. 1054-1059. [3] Gusfield, D., Algorithms on Strings, Trees, and Sequences: Computer Science and Computational Biol- ogy, Cambridge University Press, Cambridge, UK, 1997. [4] D.S. Hirschberg, A linear space algorithm for computing maximal common subsequences, Commun. ACM 18(6), 1975, pp. 341-343. [5] Hunt J.W., Szymanski T.G., A fast algorithm for computing longest subsequences, Commun. ACM 20(5), 1977, pp. 350-353. [6] I. Katriel and M. Kutz, A faster algorithm for computing a longest common increasing subsequence, LNCS 4009, 2006, pp. 330-341. [7] W.J. Masek and M.S. Paterson, A faster algorithm computing string edit distances, J. Comput. System Sci. 20, 1980, pp. 18-31. [8] Yoshifumi Sakai, A linear space algorithm for computing a longest common increasing subsequence, Information Processing Letters 99, 2006, pp. 203-207. [9] Yang I.H., Huang C.P., Chao K.M., A fast algorithm for computing a longest common increasing subsequence, Information Processing Letters 93 (5), 2005, pp. 249-253. 5
1702.05710
1
1702
2017-02-19T07:19:52
Polynomial Time Efficient Construction Heuristics for Vertex Separation Minimization Problem
[ "cs.DS", "cs.AI" ]
Vertex Separation Minimization Problem (VSMP) consists of finding a layout of a graph G = (V,E) which minimizes the maximum vertex cut or separation of a layout. It is an NP-complete problem in general for which metaheuristic techniques can be applied to find near optimal solution. VSMP has applications in VLSI design, graph drawing and computer language compiler design. VSMP is polynomially solvable for grids, trees, permutation graphs and cographs. Construction heuristics play a very important role in the metaheuristic techniques as they are responsible for generating initial solutions which lead to fast convergence. In this paper, we have proposed three construction heuristics H1, H2 and H3 and performed experiments on Grids, Small graphs, Trees and Harwell Boeing graphs, totaling 248 instances of graphs. Experiments reveal that H1, H2 and H3 are able to achieve best results for 88.71%, 43.5% and 37.1% of the total instances respectively while the best construction heuristic in the literature achieves the best solution for 39.9% of the total instances. We have also compared the results with the state-of-the-art metaheuristic GVNS and observed that the proposed construction heuristics improves the results for some of the input instances. It was found that GVNS obtained best results for 82.9% instances of all input instances and the heuristic H1 obtained best results for 82.3% of all input instances.
cs.DS
cs
Polynomial Time Efficient Construction Heuristics for Vertex Separation Minimization Problem Pallavi Jain∗ Gur Saran† Kamal Srivastava‡ Abstract Vertex Separation Minimization Problem (VSMP) consists of finding a layout of a graph G = (V, E) which minimizes the maximum vertex cut or separation of a layout. It is an NP- complete problem in general for which metaheuristic techniques can be applied to find near optimal solution. VSMP has applications in VLSI design, graph drawing and computer lan- guage compiler design. VSMP is polynomially solvable for grids, trees, permutation graphs and cographs. Construction heuristics play a very important role in the metaheuristic tech- niques as they are responsible for generating initial solutions which lead to fast convergence. In this paper, we have proposed three construction heuristics H 1, H 2 and H 3 and per- formed experiments on Grids, Small graphs, Trees and Harwell Boeing graphs, totaling 248 instances of graphs. Experiments reveal that H 1, H 2 and H 3 are able to achieve best results for 88.71%, 43.5% and 37.1% of the total instances respectively while the best construction heuristic in the literature achieves the best solution for 39.9% of the total instances. We have also compared the results with the state-of-the-art metaheuristic GVNS and observed that the proposed construction heuristics improves the results for some of the input instances. It was found that GVNS obtained best results for 82.9% instances of all input instances and the heuristic H 1 obtained best results for 82.3% of all input instances. 1 Introduction Graph layout problems are a class of combinatorial optimization problems whose goal is to find a layout of an input graph G to optimize a certain objective function. A linear lay- out or layout of an undirected graph G = (V, E), where V = n is the bijective function ϕ : V → [n] = {1, 2, . . . , n}. Set of all layouts is denoted by Φ(G). A Region in layout is defined as the area between two consecutive vertices in the layout. Vertex Separation min- imization problem (VSMP) is to find a layout ϕ∗ ∈ Φ(G) of a graph G = (V, E) which minimizes the vertex separation (VS ) where V S = maxi∈[V ] δ(i, ϕ, G) for a layout ϕ where, δ(i, ϕ, G) = u ∈ L(i, ϕ, G) : ∃v ∈ R(i, ϕ, G) ∧ (u, v) ∈ E(G), L(i, ϕ, G) = {u ∈ V : ϕ(u) ≤ i} and R(i, ϕ, G) = {u ∈ V : ϕ(u) > i} [1, 4]. VSMP is NP-complete in general and has applica- tions in VLSI design, graph drawing and computer language compiler design [2]. Further, in this paper, a vertex identifier corresponds to the vertices of graphs which are as- sumed to be the natural numbers 1,. . . ,n. For a vertex u ∈ V (G), neighbourhood of u in G, N (u) = {v ∈ V (G) : (u, v) ∈ E(G)} and degree of u in G, dG(u) = v ∈ V (G) : (u, v) ∈ E(G). Fig. 1(b) represents a linear layout of Fig. 1(a). VS for this layout ϕ of G is 3. VSMP is polynomially solvable for grids, trees, permutation graphs and cographs [1, 4]. This prob- lem has been explored using metaheuristics namely, variable neighbourhood search by [2, 5] ∗Department of Mathematics, Dayalbagh Educational Insitute, Agra, India [email protected] †Department of Mathematics, Dayalbagh Educational Insitute, Agra, India [email protected] ‡Department of Mathematics, Dayalbagh Educational Insitute, Agra, India [email protected] 1 Figure 1: (a) A graph and (b) layout ϕ = (2, 4, 3, 5, 1) in which they have proposed construction heuristics to generate an initial solution. Noberto et al. [3] highlight the importance of construction heuristics in metaheuristics. They have proposed eight construction heuristics and have compared all the construction heuristics. In this paper, we have proposed three construction heuristics H 1, H 2, H 3. An experiment has been performed to compare all the construction heuristics on the test instances of Grids, Small graphs, Trees and Harwell Boeing graphs, totaling 248 instances of graphs. Experiments reveal that H 1, H 2 and H 3 are able to achieve best results for 87.9%, 43.5% and 37.1% of the total instances respectively, while the best construction heuristic in the literature achieves the best solution for 39.9% of the total instances. We have also compared the results of H 1 with the state-of-the-art metaheuristic general variable neighbourhood search (GVNS) [5] and observed that the proposed construction heuristics improves the results for some of the input instances. It was also observed that GVNS obtains best results for 82.9% instances of all input instances while the heuristic H 1 obtained best results for 82.3% instances of all input instances. Further, in this paper Section 2 presents the construction heuristics proposed in this paper followed by computational experiments to show the efficiency of heuristics in Section 3. 2 Construction Heuristics In this section, three construction heuristics have been proposed. These heuristics construct a layout by iteratively adding vertices to an initially empty layout. In each iteration, heuristic H 1 tries to place a vertex u in the partial layout which minimizes its contribution as well as the contribution of vertices which are already placed in the partial layout. Motivation behind H 2 and H 3 is that if adjacent vertices are closely placed then they contribute to fewer regions. Further, in order to minimize the number of regions to which a vertex contributes, vertices of smaller degree are placed first in the partial layout. In the following sections, we describe the three construction heuristics which are essentially greedy methods. 2.1 Heuristic H 1 This procedure is outlined in Algorithm 1. Let layout be the (partial) layout under construction. The set unvisited is the set of vertices of graph G which are not in layout. The time complexity of H 1 is O(n2 · ∆(G)). 2.2 Heuristic H 2 Algorithm 2 presents heuristic H 2. Time complexity of Heuristic H 2 is O(n2 · log n). 2 Step 1: unvisited = {1, . . . , n} Step 2: Select a vertex v ∈ unvisited such that dG(v) is least Step 3: layout = (v) Step 4: unvisited = unvisited \ {v} Step 5: while layout (cid:54)= n Step 6: Step 7: Step 8: Step 9: Step 10: Step 11: Step 12: endwhile S = {v ∈ layout : v is adjacent to least number of vertices in unvisited} P = {w ∈ unvisited : w is adjacent to largest number of vertices in S} Q = {u ∈ P : u is adjacent to least number of vertices in unvisited} Select v ∈ Q randomly layout = (layout, v) unvisited = unvisited \ {v} Figure 2: Algorithm1: Heuristic H 1 2.3 Heuristic H 3 This Heuristic is similar to H 2, but as opposed to the selection in Step 9 of Heuristic H 2, preference is given to a vertex v in the partially constructed layout with least ϕ(v). Time complexity of H 3 is same as H 2. 3 Computational Experiments In this section we present the computational experiments that were performed to test the effectiveness of the proposed construction heuristics. The code was implemented in Matlab 7.0 and all the experiments were conducted on an Intel i3 based system with 4 GB RAM. The experiment to compare the construction heuristics was performed on the four sets of instances previously used for this problem [3]. The test set includes Small, Harwell-Boeing (HB ) graphs, Grids and Trees. Since GVNS was tested on Harwell-Boeing (HB ) graphs, Grids and Trees in the literature, therefore, construction heuristic H 1 and GVNS are compared on these instances only. The order of graph ranges from 9 to 2916. For each heuristic H 1, H 2 and H 3, 30 runs were carried out and the best value of vertex separation was recorded. 3.1 Comparison between Construction Heuristics In this section the proposed construction heuristics are compared with those available in the literature. Random represents randomly generated solution. C 1 and C 2 are the construction heuristics proposed in [2] and HA1, HA2, HA3, HA4, HN 1, HN 2, HN 3 and HN 4 have been proposed in [3]. Heuristics H 1, H 2 and H 3 have been presented in this paper. Table 1 presents the average vertex separation for different construction heuristics. The average vertex separation over all the instances are given in the last column (cid:48)Average(cid:48). Results show that H 1 outperforms all the heuristics. Table 2 presents number of best solution achieved using each heuristic. In the table, the last column (cid:48)Sum(cid:48) represents the total number of instances for which heuristic achieves the best value. Number in bold indicates that the value is best in that column. Heuristic H 1 achieves best result for 220 instances out of 248 instances which is equal to 88.71% of the total instances. Similarly, H 2 and H 3 achieve best results for 43.55% and 37.1% instances of total 3 Step 1: u = minimium degree vertex of a graph G Step 2: unvisited = V \ {u} Step 3: layout = (u) Step 4: S = sort N(u) in ascending order of the degrees Step 5: layout = (layout, S) Step 6: unvisited = unvisited \ S Step 7: while layout (cid:54)= V (G) Step 8: Step 9: Step 10: Step 11: Step 12: Step 13: Step 14: Step 15: Step 16: Step 17: layout = (layout, v) unvisited = unvisited \ v degree = {degreew = N (w) \ layout : w ∈ V (G)} select a vertex v such that degreev is least but non-zero if v /∈ layout endif S = N (v) \ layout S(cid:48) = sort S according to their values in degree in ascending order layout = (layout, S(cid:48)) unvisited = unvisited \ S(cid:48) Figure 3: Algorithm2: Heuristic H 2 instances. Among the existing heuristics, a maximum of 39.92% of the total instances best solutions are obtained by HN 1. 3.2 Comparison between H 1 and GVNS In this section, the best performing construction heuristic H 1 is compared with the metaheuris- tic General Variable Neighbouhood Strategy (GVNS) [5]. Average vertex separation obtained by GVNS and H 1 are listed in Table 3. Numbers in bold are the minimum in that column. Results show that for Trees, H 1 performs better while performance of GVNS on HB instance is good. When the average is considered over all the instances, performance of GVNS and H 1 is comparable. Table 4 presents the number of best solutions achieved using each heuristic. For grids, GVNS and H 1 both are able to obtain optimal results. For trees, GVNS obtained optimal results for 40 instances out of 50 while H 1 obtained optimal results for all the tree instances. In case of HB instances, GVNS obtained best results for 44 instances out of 62 while H 1 was able to obtain optimal results for 33 instances only. When all the graphs are considered GVNS obtained best results in 136 cases out of 164 which is equal to 82.9% of all input instances while H 1 obtained optimal results in 135 cases which is equal to 82.3% of all input instances. 4 Conclusion In this paper, we have proposed three polynomial time construction heuristics and compared with other construction heuristics. It was observed that these construction heuristics outperform other construction heuristics given in literature. The best performing construction heuristic H 1 was also compared with the state-of-the-art metaheuristic GVNS. This construction heuristic achieves best results in larger number of cases than GVNS. Since a good initial population is 4 Table 1: Average vertex separation for different construction heuristics Heuristics Grid(52) Small(84) Tree(50) HB(62) Average Random C 1 C 2 HA1 HA2 HA3 HA4 HN 1 HN 2 HN 3 HN 4 H 1 H 2 H 3 C 1 C 2 HA1 HA2 HA3 HA4 HN 1 HN 2 HN 3 HN 4 H 1 H 2 H 3 553.08 29.5 28.5 38.19 684.35 38.5 688 28.5 687.94 30.44 697.96 28.5 28.52 28.5 0 0 52 0 0 0 0 52 0 1 1 52 51 52 9.26 6.18 5.01 4.32 12.21 4.26 11.68 4.05 6.76 4.14 6.51 3.29 4.02 4.28 0 1 7 20 0 23 0 29 1 27 0 80 31 25 Table 2: Number of best solutions achieved for different construction heuristics Heuristics Grid(52) Small(84) Tree(50) HB(62) Sum Random 43.6 4.66 11.08 5.24 61.7 5.22 61.68 7.66 12.86 7.52 13.36 4.1 15.74 11.52 229.03 40.1 34.7 53.65 294.58 53.08 294.15 49.23 235.45 51.27 233.52 30.53 35.48 37.05 0 12 6 0 0 4 0 12 1 14 0 50 3 1 1 1 8 4 1 4 1 6 1 3 1 38 23 14 185.15 19.24 18.58 23.94 233.71 23.84 234.19 21.2 207.99 22.12 209.63 15.6 19.45 19.07 1 14 73 27 1 33 1 99 3 45 2 220 108 92 Table 3: Average vertex separation for GVNS [5] and H 1 Heuristics Grid(52) Tree(50) HB(62) Average GVNS H 1 28.5 28.5 4.3 4.1 24.6 30.53 19.85 21.83 Table 4: Number of best solutions achieved using GVNS and H 1 Heuristics Grid(52) Tree(50) HB(62) Sum 136 135 GVNS 52 52 40 50 44 33 H 1 5 expected to converge faster to a near optimal/optimal solution, therefore, initial solutions gen- erated using this construction heuristic in any metaheuristic will lead to high quality solutions. References [1] Diaz, J., J. Petit and M. Serna, A Survey of Graph Layout Problems, ACM Computing Surveys. 34 (2002), 313 -- 356. [2] Duarte A., L. F. Escudero, R. Marti, N. Mladenovic, J. J. Pantrigo and J. Sanchez-Oro, Variable Neighborhood Search for the Vertex Separation Problem, Computers and Opera- tions Research. 39 (2012), 3247 -- 3255. [3] Garcia N. C., H. J. F. Huacuja, J. A. M. Flores, R. A. P. Rangel, J. J. G. Barbosa, J. M. C. Valadez, Comparative Study on Costructive Heuristics for the Vertex Separation Problem, Design of Intelligent Systems Based on Fuzzy Logic, Neural Networks and Nature-Inspired Optimization. (2015), 465 -- 474. [4] Petit, J., Addenda to the Survey of Layout Problems, Bulletin of the EATCS. 105 (2011), 177 -- 201. [5] Sanchez-Oro J., J. J. Pantrigo and A. Duarte, Combining intensification and diversifica- tion strategies in VNS. An application to the Vertex Separation Problem., Computers and Operations Research. 52 (2014), 209 -- 219. 6
1504.06954
4
1504
2016-04-06T06:29:09
Dynamic index, LZ factorization, and LCE queries in compressed space
[ "cs.DS" ]
In this paper, we present the following results: (1) We propose a new \emph{dynamic compressed index} of $O(w)$ space, that supports searching for a pattern $P$ in the current text in $O(|P| f(M,w) + \log w \log |P| \log^* M (\log N + \log |P| \log^* M) + \mathit{occ} \log N)$ time and insertion/deletion of a substring of length $y$ in $O((y+ \log N\log^* M)\log w \log N \log^* M)$ time, where $N$ is the length of the current text, $M$ is the maximum length of the dynamic text, $z$ is the size of the Lempel-Ziv77 (LZ77) factorization of the current text, $f(a,b) = O(\min \{ \frac{\log\log a \log\log b}{\log\log\log a}, \sqrt{\frac{\log b}{\log\log b}} \})$ and $w = O(z \log N \log^*M)$. (2) We propose a new space-efficient LZ77 factorization algorithm for a given text of length $N$, which runs in $O(N f(N,w') + z \log w' \log^3 N (\log^* N)^2)$ time with $O(w')$ working space, where $w' =O(z \log N \log^* N)$. (3) We propose a data structure of $O(w)$ space which supports longest common extension (LCE) queries on the text in $O(\log N + \log \ell \log^* N)$ time, where $\ell$ is the output LCE length. On top of the above contributions, we show several applications of our data structures which improve previous best known results on grammar-compressed string processing.
cs.DS
cs
Dynamic index, LZ factorization, and LCE queries in compressed space Takaaki Nishimoto1, Tomohiro I2, Shunsuke Inenaga1, Hideo Bannai1, and Masayuki Takeda1 1 Department of Informatics, Kyushu University, Japan {takaaki.nishimoto, inenaga, bannai, takeda}@inf.kyushu-u.ac.jp 2 Kyushu Institute of Technology, Japan [email protected] Abstract. In this paper, we present the following results: (1) We pro- pose a new dynamic compressed index of O(w) space, that supports searching for a pattern P in the current text in O(P f (M, w)+log w log P log∗ M (log N + log P log∗ M ) + occ log N ) time and insertion/deletion of a substring of length y in O((y + log N log∗ M ) log w log N log∗ M ) time, where N is the length of the current text, M is the maximum length of the dy- namic text, z is the size of the Lempel-Ziv77 (LZ77) factorization of the current text, f (a, b) = O(min{ log log a log log b log log b }) and w = O(z log N log∗ M ). (2) We propose a new space-efficient LZ77 factoriza- tion algorithm for a given text of length N , which runs in O(N f (N, w′) + z log w′ log3 N (log∗ N )2) time with O(w′) working space, where w′ = O(z log N log∗ N ). (3) We propose a data structure of O(w) space which supports longest common extension (LCE) queries on the text in O(log N + log ℓ log∗ N ) time, where ℓ is the output LCE length. On top of the above contributions, we show several applications of our data structures which improve previous best known results on grammar-compressed string pro- cessing. ,q log b log log log a 1 Introduction 1.1 Dynamic compressed index In this paper, we consider the dynamic compressed text indexing problem of maintaining a compressed index for a text string that can be modified. Although there exits several dynamic non-compressed text indexes (see e.g. [27,3] for re- cent work), there has been little work for the compressed variants. Hon et al. [13] proposed the first dynamic compressed index of O( 1 ǫ (N H0 + N )) bits of space which supports searching of P in O(P log2 N (logǫ N + log Σ) + occ log1+ǫ N ) time and insertion/deletion of a substring of length y in O((y + √N ) log2+ǫ N ) amortized time, where 0 < ǫ ≤ 1 and H0 ≤ log Σ denotes the zeroth order empirical entropy of the text of length N [13]. Salson et al. [29] also proposed a dynamic compressed index, called dynamic FM-Index. Although their approach works well in practice, updates require O(N log N ) time in the worst case. To our knowledge, these are the only existing dynamic compressed indexes to date. In this paper, we propose a new dynamic compressed index, as follows: Theorem 1. Let M be the maximum length of the dynamic text to index, N the length of the current text T , and z the number of factors in the Lempel- Ziv 77 factorization of T without self-references. Then, there exist a dynamic index of O(w) space which supports searching of a pattern P in O(PfA + log w log P log∗ M (log N +logP log∗ M )+occ log N ) time and insertion/deletion of a substring of length y in amortized O((y + log N log∗ M ) log w log N log∗ M ) log log log M ,q log w time, where w = O(z log N log∗ M ) and fA = O(min{ log log M log log w log log w}). Since z ≥ log N , log w = max{log z, log(log∗ M )}. Hence, our index is able to find pattern occurrences faster than the index of Hon et al. when the P term is dominating in the pattern search times. Also, our index allows faster substring insertion/deletion on the text when the √N term is dominating. Related work. Our dynamic compressed index uses Mehlhorn et al.'s locally consistent parsing and signature encodings of strings [22], originally proposed for efficient equality testing of dynamic strings. Alstrup et al. [3] showed how to improve the construction time of Mehlhorn et al.'s data structure (details can be found in the technical report [2]). Our data structure uses Alstrup et al.'s fast string concatenation/split algorithms and linear-time computation of locally consistent parsing, but has little else in common than those. In particular, Alstrup et al.'s dynamic pattern matching algorithm [3,2] requires to maintain specific locations called anchors over the parse trees of the signature encodings, but our index does not use anchors. Our index has close relationship to the ESP-indices [30,31], but there are two significant differences between ours and ESP-indices: The first difference is that the ESP-index [30] is static and its online variant [31] allows only for appending new characters to the end of the text, while our index is fully dynamic allowing for insertion and deletion of arbitrary substrings at arbitrary positions. The second difference is that the pattern search time of the ESP-index is proportional to the number occc of occurrences of the so-called "core" of a query pattern P , which corresponds to a maximal subtree of the ESP derivation tree of a query pattern P . If occ is the number of occurrences of P in the text, then it always holds that occc ≥ occ, and in general occc cannot be upper bounded by any function of occ. In contrast, as can be seen in Theorem 1, the pattern search time of our index is proportional to the number occ of occurrences of a query pattern P . This became possible due to our discovery of a new property of the signature encoding [2] (stated in Lemma 12). In relation to our problem, there exists the library management problem of maintaining a text collection (a set of text strings) allowing for insertion/deletion of texts (see [24] for recent work). While in our problem a single text is edited by insertion/deletion of substrings, in the library management problem a text can be inserted to or deleted from 2 the collection. Hence, algorithms for the library management problem cannot be directly applied to our problem. 1.2 Applications and extensions log log log N ,q log w Computing LZ77 factorization in compressed space. As an application to our dynamic compressed index, we present a new LZ77 factorization algo- rithm for a string T of length N , running in O(N fA + z log w log3 N (log∗ N )2) time and O(w) working space, where fA = O(min{ log log N log log w log log w}). Goto et al. [11] showed how, given the grammar-like representation for string T generated by the LCA algorithm [28], to compute the LZ77 factorization of T in O(z log2 m log3 N + m log m log3 N ) time and O(m log2 m) space, where m is the size of the given representation. Sakamoto et al. [28] claimed that m = O(z log N log∗ N ), however, it seems that in this bound they do not con- sider the production rules to represent maximal runs of non-terminals in the derivation tree. The bound we were able to obtain with the best of our knowl- edge and understanding is m = O(z log2 N log∗ N ), and hence our algorithm seems to use less space than the algorithm of Goto et al. [11]. Recently, Fischer et al. [10] showed a Monte-Carlo randomized algorithms to compute an approx- imation of the LZ77 factorization with at most 2z factors in O(N log N ) time, and another approximation with at most (i + ǫ)z factors in O(N log2 N ) time for any constant ǫ > 0, using O(z) space each. Another line of research is a recent result by Policriti and Prezza [25] which uses N H0 + o(N log Σ) + O(Σ log N ) bits of space and computes the LZ77 factorization in O(N log N ) time. Longest common extension queries in compressed space. Furthermore, we consider the longest common extension (LCE) problems on: an uncompressed string T of length N ; a grammar-compressed string T represented by an straight- line program (SLP) of size n, or an LZ77-compressed string T with z factors. The best known deterministic LCE data structure on SLPs is due to I et al. [15], which supports LCE queries in O(h log N ) time each, occupies O(n2) space, and can be built in O(hn2) time, where h is the height of the derivation tree of a given SLP. Bille et al. [5] showed a Monte Carlo randomized data structure built on a given SLP of size n which supports LCE queries in O(log N log ℓ) time each, where ℓ is the output of the LCE query and N is the length of the uncompressed text. Their data structure requires only O(n) space, but requires O(N ) time to construct. Very recently, Bille et al. [6] showed a faster Monte Carlo randomized data structure of O(n) space which supports LCE queries in O(log N + log2 ℓ) time each. The preprocessing time of this new data structure is not given in [6]. In this paper, we present a new, deterministic LCE data structure using compressed space, namely O(w) space, supporting LCE queries in O(log N + log ℓ log∗ N ) time each. We show how to construct this data structure in O(N log w) time given an uncompressed string of length N , O(n log log n log N log∗ N ) time given an SLP of size n, and O(z log w log N log∗ N ) time given the LZ77 factor- ization of size z. We remark that our new LCE data structure allows for fastest 3 deterministic LCE queries on SLPs, and even permits faster LCE queries than the randomized data structure of Bille et al. [6] when log∗ N = o(log ℓ) which in many cases is true. All proofs omitted due to lack of space can be found in the appendices. 2 Preliminaries 2.1 Strings Let Σ be an ordered alphabet and $ be the lexicographically largest character in Σ. An element of Σ∗ is called a string. For string w = xyz, x is called a prefix, y is called a substring, and z is called a suffix of w, respectively. The length of string w is denoted by w. The empty string ε is a string of length 0, that is, ε = 0. Let Σ+ = Σ∗ − {ε}. For any 1 ≤ i ≤ w, w[i] denotes the i-th character of w. For any 1 ≤ i ≤ j ≤ w, w[i..j] denotes the substring of w that begins at position i and ends at position j. Let w[i..] = w[i..w] and w[..i] = w[1..i] for any 1 ≤ i ≤ w. For any string w, let wR denote the reversed string of w, that is, wR = w[w]··· w[2]w[1]. For any strings w and u, let LCP(w, u) (resp. LCS(w, u)) denote the length of the longest common prefix (resp. suffix) of w and u. Given two strings s1, s2 and two integers i, j, let LCE(s1, s2, i, j) denote a query which returns LCP(s1[i..s1], s2[j..s2]). s, namely, Occ(p, s) = {i p = s[i..i + p − 1], 1 ≤ i ≤ s − p + 1}. In this paper, we deal with a dynamic text, namely, we allow for inser- tion/deletion of a substring to/from an arbitrary position of the text. Let M be the maximum length of the dynamic text to index. Our model of computation is the unit-cost word RAM with machine word size of log2 M bits, and space complexities will be evaluated by the number of machine words. Bit-oriented evaluation of space complexities can be obtained with a log2 M multiplicative factor. For any strings p and s, let Occ(p, s) denote all occurrence positions of p in Lempel-Ziv 77 factorization. We will use the Lempel-Ziv 77 factorization [32] of a string to bound the running time and the size of our data structure on the string. It is a greedy factorization which scans the string from left to right, and recursively takes as a factor the longest prefix of the remaining suffix with a previous occurrence. Formally, it is defined as follows. Definition 1 (Lempel-Ziv77 Factorization [32]). The Lempel-Ziv77 (LZ77) factorization of a string s without self-references is a sequence f1, . . . , fz of non- empty substrings of s such that s = f1 ··· fz, f1 = s[1], and for 1 < i ≤ z, if the character s[f1..fi−1+1] does not occur in s[f1..fi−1], then fi = s[f1..fi−1+1], otherwise fi is the longest prefix of fi ··· fz which occurs in f1 ··· fi−1. The size of the LZ77 factorization f1, . . . , fz of string s is the number z of factors in the factorization. A variant of LZ77 factorization which allows for self-overlapping reference to a previous occurrence is formally defined as follows. 4 Definition 2 (Lempel-Ziv77 Factorization with self-reference [32]). The Lempel-Ziv77 (LZ77) factorization of a string s with self-references is a sequence f1, . . . , fk of non-empty substrings of s such that s = f1 ··· fk, f1 = s[1], and for 1 < i ≤ k, if the character s[f1..fi−1 + 1] does not occur in s[f1..fi−1], then fi = s[f1..fi−1 + 1], otherwise fi is the longest prefix of fi ··· fk which occurs at some position p, where 1 ≤ p ≤ f1 ··· fi−1. We will show that using our data structure, the LZ77 with self-reference can be computed efficiently in compressed space. Locally consistent parsing. Let p be a string of length n over an integer alphabet of size W where any adjacent elements are different, i.e., p[i] 6= p[i + 1] for all 1 ≤ i < n. A locally consistent parsing [22] of p is a parsing (or factorization) q1, . . . , qj of p such that p = q1 ··· qj, 2 ≤ qh ≤ 4 for any 1 ≤ h ≤ j, and the boundary between qh−1 and qh is "determined" by p[q1 ··· qh−1 + 1 − ∆L..q1 ··· qh−1 + 1 + ∆R], where ∆L = log∗ W + 6 and ∆R = 4. Clearly, j ≤ n/2. By "determined" above, we mean that if a position i of an integer string p and a position k of another integer string s share the same left context of length at least ∆L and the same right context of length at least ∆R, then there is a boundary of the locally consistent parsing of p between the positions i − 1 and i iff there is a boundary of the locally consistent parsing of s between the positions k − 1 and k. A formal definition of locally consistent parsing, and its linear-time computation algorithm, is explained in the following lemma. Lemma 1 (Locally consistent parsing [22,2]). Let W be a non-negative integer and let p be an integer sequence of length n, called a W -colored sequence, where p[i] 6= p[i + 1] for any 1 ≤ i < n and 0 ≤ p[j] ≤ W for any 1 ≤ j ≤ n. For every W there exists a function f : [−1..W ]log∗ W +11 → {0, 1} such that for every W -colored sequence p, the bit sequence d defined by d[i] = f (p[i − ∆L], . . . , p[i + ∆R]) for 1 ≤ i ≤ n, satisfies: -- d[1] = 1, -- d[i] + d[i + 1] ≤ 1 for 1 ≤ i < n, and -- d[i] + d[i + 1] + d[i + 2] + d[i + 3] ≥ 1 for any 1 ≤ i < n − 3, where ∆L = log∗ W + 6, ∆R = 4, and p[j] = p[j] for all 1 ≤ j ≤ n, p[j] = −1 otherwise. Furthermore, d can be computed in O(n) time using a precomputed table of size o(log W ). Also, we can compute this table in o(log W ) time. Proof. Here we give only an intuitive description of a proof of Lemma 1. More detailed proofs can be found at [22] and [2]. Mehlhorn et al. [22] showed that there exists a function f ′ which returns a (log W )-colored sequence p′ for a given W -colored sequence p in O(p) time, where p′[i] is determined only by p[i − 1] and p[i] for 1 ≤ i ≤ p. Let phki denote the outputs after applying f ′ to p by k times. They also showed that there exists a function f ′′ which returns a bit sequence d satisfying the conditions of Lemma 1 for a 6-colored sequence p in O(p) time, where d[i] is determined only 5 by p[i−3..i+3] for 1 ≤ i ≤ p. Hence we can compute d for a W -colored sequence p in O(p log∗ W ) time by applying f ′′ to phlog∗ W +2i after computing phlog∗ W +2i. Furthermore, Alstrup et al. [2] showed that d can be computed in O(p) time using a precomputed table of size o(log W ). The idea is that ph3i is a log log log W - colored sequence and the number of all combinations of a log log log W -colored sequence of length log∗ W + 11 is 2(log∗ W +11) log log log W = o(log W ). Hence we can compute d for a W -colored sequence in linear time using a precomputed ⊓⊔ table of size o(log W ). Given a bit sequence d of Lemma 1, let Eblock d(p) be the function that decomposes an integer sequence p into a sequence q1, . . . , qj of substrings called blocks of p, such that p = q1 ··· qj and qi is in the decomposition iff d[q1 ··· qi−1+ 1] = 1 for any 1 ≤ i ≤ j. We omit d and write Eblock d(p) when it is clear from the context, and we use implicitly the bit sequence created by Lemma 1 as d. Let Eblock (p) = j and let Eblock (s)[i] = qi. For a string s, let Epow (s) be the function which groups each maximal run of same characters a as ar, where r is the length of the run. Epow (s) can be computed in O(s) time. Let Epow (s) denote the number of maximal runs of same characters in s and let Epow (s)[i] denote i-th maximal run in s. Example 1 (Eblock d(p) and Epow (s)). Let log∗ W = 2, and then ∆L = 8, ∆R = 4. If p = 1, 2, 3, 2, 5, 7, 6, 4, 3, 4, 3, 4, 1, 2, 3, 4, 5 and d = 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, then Eblock d(p) = (1, 2, 3), (2, 5), (7, 6, 4), (3, 4, 3, 4), (1, 2), (3, 4, 5),Eblock d(p) = 6 and Eblock d(p)[2] = (2, 5). For string s = aabbbbbabb, Epow (s) = a2b5a1b2 and Epow (s) = 4 and Epow (s)[2] = b5. 2.2 Context free grammars as compressed representation of strings Admissible context free grammars. An admissible context free grammar (ACFG) [18] is a CFG which generates only a single string. More formally, an ACFG that generates a single string T is a quadruple G = (Σ,V,D, S), such that variables, -- Σ is an ordered alphabet of terminal characters, -- V = {e1, . . . , ek} is a set of positive integers with e1 < ··· < ek, called -- D = {ei → xexpr i}k i=1 is a set of deterministic productions (or assignments) i.e., for each variable e ∈ V there is exactly one production in D whose lefthand side is e, -- each ei ∈ V \ {S} appears at least once in the righthand side of some pro- -- S ∈ V is the start symbol which derives the string T . Sometimes we handle a variable sequence as a kind of string. For example, for any variable sequence y = ei1 ··· eid ∈ V +, let y = d and y[c] = eic for 1 ≤ c ≤ d. Let val : V → Σ+ be the function which returns the string derived by an input duction ej → xexpr j with ei < ej, and 6 variable. If s = val (e) for e ∈ V, then we say that the variable e represents string s. For any variable sequence y ∈ V +, let val +(y) = val (y[1])··· val (y[y]). For two variables e1, e2 ∈ V, we say that e1 occurs at position c in e2 if there is a node labeled with e1 in the derivation tree of e2 and the leftmost leaf of the subtree rooted at that node labeled with e1 is the c-th leaf in the derivation tree of e2. Furthermore, for variable sequence y ∈ V +, we say that y occurs at position c in e if y[i] occurs at position c+val +(y[..i−1]) in e for 1 ≤ i ≤ y. We define the function vOcc(e1, e2) which returns all positions of e1 in the derivation tree of e2. Straight-line programs. A straight-line program (SLP ) is an ACFG in the Chomsky normal from. Formally, SLP S of size n is an ACFG G = (Σ,V,D, Xn), where V = {X1,··· , Xn}, val (Xn) = T , D = {Xi → expr i}n i=1 with each expr i being either of form XℓXr (1 ≤ ℓ, r < i), or a single character a ∈ Σ. The size of the SLP G is the number n of productions in D. In the extreme cases the length N of the string T can be as large as 2n−1, however, it is always the case that n ≥ log2 N . For any variable Xi with Xi → XℓXr ∈ D, let Xi.left = val (Xℓ) and Xi.right = val (Xr), which are called the left string and the right string of Xi, respectively. Example 2 (SLP). Let S = (Σ,V,D, S) be the SLP s.t. Σ = {A, B, C}, V = {X1,··· , X11}, D = {X1 → A, X2 → B, X3 → C, X4 → X3X1, X5 → X4X2, X6 → X5X5, X7 → X2X3, X8 → X1X2, X9 → X7X8, X10 → X6X9, X11 → X10X6}, S = X11, the derivation tree of S represents CABCABBCABCABCAB. Run-length ACFGs. We define run-length ACFGs as an extension to ACFGs, which allow run-length encodings in the righthand sides of productions. Formally, a run-length ACFG is G = (Σ,V,D, S), where D = {ei → xexpr i}w i=1, val (S) = T and each xexpr i is in one of the following forms: xexpr i =  Hence xexpr i ∈ Σ ∪ V + ∪ (V × N ). The size of the run-length ACFG G is the number w of productions in D. a ∈ Σ, eℓer ∈ V + ed ∈ V × N (e < ei, and d > 1). (eℓ, er < ei), Let Sig G : Σ ∪ V + ∪ (V × N ) → V be the function such that e Sig G(Sig G(x[1..x − 1])x[x]) undefined if (e → x ) ∈ D, if x[i] ∈ V for 1 ≤ i ≤ x, 2 < x ≤ 4, otherwise. Sig G(x ) =  Namely, the function Sig G returns, if any, the lefthand side of the corresponding production for a given element in Σ∪V +∪(V×N ) of length 3 or 4, by recursively applying the Sig function from left to right. Let AssgnG be the function such that 7 Assgn G(ei) = xexpri iff ei → xexpri ∈ D. When clear from the context, we write Sig G and Assgn G as Sig and Assgn, respectively. For any p ∈ (Σ∪V +∪(V×N ))∗, let Sig +(p) = Sig(p[1])··· Sig(p[p]). We define the left and right strings for any variable ei → eℓer ∈ D in a similar way to SLPs. Furthermore, for any ei → ek ∈ D, let ei.left = val (e) and ei.right = val (e)k−1. In this paper, we consider a DAG of size w that is a compact representation of the derivation trees of variables in a run-length ACFG G, where each node represents a variable in V and out-going edges represent the assignments in D. For example, if there exists an assignment ei → eℓer ∈ D, then there exist two out-going edges from ei to its ordered children eℓ and er. In addition, eℓ and er have reversed edges to their parent ei. For any e ∈ V, let parents(e) be the set of variables which have out-going edge to e in the DAG of G. If a node is labeled by e, then the node is associated with val (e). Example 3 (Run-length ACFG). Let G = (Σ,V,D, S) be a run-length ACFG, where Σ = {A, B, C}, V = {1, . . . , 15}, D = {1 → A, 2 → B, 3 → C, 4 → 34, 5 → 11, 6 → 21, 7 → 31, 8 → (7, 5), 9 → (8, 6), 10 → (5, 6), 11 → (10, 4), 12 → 92, 13 → 107, 14 → 111, 15 → (12, 13), 16 → (15, 14), 17 → 161}, and S = 17. The derivation tree of the start symbol S represents a single string T = CABCABABABABABABABABABCCCC. Here, 4.left = val (3), 4.right = val +(33), Sig((7, 5)) = 8, Sig((7, 5, 6)) = 9, Sig((6, 5)) = undefined, parents(5) = {8, 10} and vOcc(9, 17) = {1, 4}. See also Fig. 1 in Section 3 which illustrates the derivation tree of the start symbol S and the DAG for G. Dynamization and data structure of run-length ACFG. In this paper, we consider a compressed representation and compressed index of a dynamic text based on run-length ACFGs. Hence, upon edits on the text, the run-length ACFG representing the text needs to be modified as well. To this end, we consider dynamic run-length ACFGs, which allow for insertion of new assignments to D, and allow for deletion of assignments e → xexpr from D only if parents(e) = 0. We remark that the grammar under modification may temporarily represents more than one text, however, this will be readily fixed as soon as we insert a new start symbol of the grammar representing the edited text. Next, we consider an abstract data structure H(fA, f ′ A) to maintain a dy- namic run-length ACFG G = (Σ,V,D, S) of size w. H consists of two compo- nents A and B. The first component A is an abstract data structure of O(f ′ A) size which is able to add/remove an assignment to/from D in O(fA) time. This data structure is also able to compute Sig(xexpr) in O(fA) time. For example, using a balanced binary search tree for D, we achieve deterministic fA = O(log w) time and f ′ A = O(w) space. Note that using the best known deterministic pre- decessor/successor data structure for a dynamic set of integers [4], we achieve A = O(w) space, where M is the maximum length of the dynamic text3. The second compo- deterministic fA = O(cid:16)minn log log M log log w log log log M ,q log w log log wo(cid:17) time and f ′ 3 Alstrup et al. [2] used hashing to maintain A and obtained a randomized H(1, w) signature dictionary. However, since we are interested in the worst case time com- 8 nent B is the DAG of G introduced in the previous subsection. The corresponding nodes and edges of the DAG can be added/deleted in constant time per addi- tion/deletion of an assignment. By maintaining parents(e) with a doubly-linked list for each node ve representing a variable e ∈ V, we obtain the following lemma: Lemma 2. Using H(fA, f ′ A) for a dynamic run-length ACFG G = (Σ,V,D, S) of current size w, Sig(xexpr) can be computed in O(fA) time, for a given xexpr ∈ Σ∪V +∪(V×N ). Given a node ve representing a variable e, Assgn(e) and val (e) can be computed in O(1) time, and parents(e) can be computed in O(parents(e)) time. We can also update H in O(fA) time when an assignment is added to/removed from D. Note that Assgn(e), Sig(xexpr ) and parents(e) can return not only the signatures but also the corresponding nodes in the DAG. 3 Signature encoding In this section, we recall the signature encoding first proposed by Mehlhorn et al. [22]. The signature encoding of a string T is a run-length ACFG G = (Σ,V,D, S) where the assignments in D are determined by recursively applying to T the locally consistent parsing, the Encblock function, and the Sig function (recall Section 2), until a single integer S is obtained. More formally, we use the Shrink and Pow functions in the signature encoding of string T defined below: Shrink T Pow T t =(Sig +(T ) Sig +(Eblock (Pow T t = Sig +(Epow (Shrink T t−1)) t )) for t = 0 for 0 < t ≤ h, for 0 ≤ t ≤ h, where h is the minimum integer satisfying Pow T h = 1. Then, the start symbol of the signature encoding is S = Pow T h , and the height of the derivation tree of the signature encoding of T is O(h) = O(log N ), where N = T (see also Fig. 1 below). Example 4 (Signature encoding). Let G = (Σ,V,D, S) be a run-length ACFG of Example 3. Assuming Eblock (Pow T 0 ) = (7, 5, 6), (7, 5, 6), (5, 6)7, (5, 6, 4) and Eblock (Pow T 1 ) = (12, 13, 14) hold, G is the signature encoding of T and id (T ) = 17. See Fig. 1 for an illustration of the derivation tree of G and the corresponding DAG. Each variable of the signature encoding (the run-length ACFG defined this h = S, i.e., way) is called a signature. For any string P ∈ Σ+, let id (T ) = Pow T the integer S is the signature of T . plexities, we use balanced binary search trees or the data structure [4] in place of hashing. 9 The signature encoding of a text T can be efficiently maintained under in- sertion/deletion of arbitrary substrings to/from T . For this purpose, we use the H(fA, f ′ A) data structure for the signature encoding of a dynamic text. 3.1 Properties of signature encodings Here we describe a number of useful properties of signature encodings. The ones with references to the literature are known but we provide their proofs for completeness. The other ones without references are our new discoveries. Substring extraction. By the definition of the Eblock function and Lemma 1, for any 1 ≤ t ≤ h, Shrink T t−1/2. Thus h ≤ log s and the height of the derivation tree of e is O(log val (e)) for any signature e ∈ V. Since each node of the DAG for a signature encoding stores the length of the corresponding string, we have the following: t−1/2 and Pow T t ≤ Pow T t ≤ Pow T Fact 1 Using the DAG for a signature encoding G = (Σ,V,D, S) of size w, given a signature e ∈ V (and its corresponding node in the DAG), and two positive integers i, k, we can compute val (e)[i..i + k − 1] in O(log val (e) + k) time. Space requirement of the signature encoding. Recall that we handle dy- namic text of length at most M . Then, the maximum value of the signatures is bounded by 3M − 1, since the derivation tree can contain at most M leaves, and 2M − 1 internal nodes (when there are no runs of same signatures at any height of the derivation tree, Pow function generates as many signatures as the Shrink function). We also remark that the input of the Eblock function is a sequence of signatures. Hence, ∆L of Lemma 1 is bounded by log∗ 3M + 6 = O(log∗ M ). Note that we can bound M = Θ(T) if we do not update G after we compute id (T ). Let N be the length of the current text T . The size w of the signature encoding of T is bounded by 3N − 1 by the same reasoning as above. Also, the following lemma shows that the signature encoding of T requires only compressed space: Lemma 3 ([26]). The size w of the signature encoding of T is O(z log N log∗ M ), where z is the number of factors in the LZ77 factorization without self-reference of T . Proof. See Appendix A. Hence, we have w = O(min{z log N log∗ M, N}). In the sequel, we assume z log N log∗ M ≤ N and will simply write w = O(z log N log∗ M ), since otherwise we can use some uncompressed dynamic text index in the literature. 10 Common sequences to all occurrences of same substrings. Here, we recall the most important property of the signature encoding. Let G = (Σ,V,D, S) be the signature encoding of text T . Let i, j (i < j) be any positions in T , and let P = T [i..j]. Let Pi and Pj be the paths from the root of the derivation tree of G to the ith and jth leaves, respectively. Then, at each depth ℓ of the derivation tree of G, consider the sequence si,j,ℓ of signatures which lie to the right of Pi with offset ∆L + 3 and to the left of Pj with offset ∆R + 2. By the property of locally consistent parsing of Lemma 1, si,j,ℓ = si′,j ′,ℓ for any occurrences [i′..j′] of P in T and for any depth ℓ. We call each signature contained in si,j,ℓ a consistent signature w.r.t. P . Formally, we define the consistent signatures of P in the derivation tree of G by the XShrink and XPow functions below, where the prefix of length at least ∆L and the suffix of length at least ∆R + 1 are "ignored" at each depth of recursion: Definition 3. For a string P , let XShrink P XPow P t = Sig +(Epow (XShrink P t =(Sig +(P ) Sig +(Eblock d(XPow P t−1)[LP t [ LP t ..XPow P t + 1..XShrink P for t = 0, for 0 < t ≤ hP , t−1 − RP t ]) t − RP t ])) for 0 ≤ t < hP , where 1] = 1, -- RP t -- LP t is the shortest prefix of XPow P is the shortest suffix of XPow P d[d − RP t + 1] = 1, is the longest prefix of XShrink P is the longest suffix of XShrink P t−1 of length at least ∆L such that d[LP t + t−1 of length at least ∆R + 1 such that -- LP t such that Epow ( LP t ) = 1, t -- RP t such that Epow ( RP t ) = 1, and t -- and hP is the minimum integer such that Epow (XShrink P hP ) ≤ ∆L +∆R +9. Note that ∆L ≤ LP t ≤ ∆R + 4 hold by the definition. Hence XShrink P t ) > ∆L + ∆R + 9. See Fig. 2 for illustrations of consistent signatures of each occurrence of P in T , which are represented by the gray boxes. Since at each depth we have "ignored" the left and right contexts of respective length at most ∆L + 3 and ∆R + 4, the consistent signatures at each depth are determined only by the consistent signatures at the previous depth (1 level deeper). This implies that for any occurrences of P in T , there are common consistent signatures (gray boxes), which will simply be called the common signatures of P . The next lemma formalizes this argument. t+1 > 0 holds if Epow (XShrink P t ≤ ∆L + 3 and ∆R + 1 ≤ RP Lemma 4 (common sequences [26]). Let G = (Σ,V,D, S) be the signature encoding of text T and let P be any string. Then there exists a common sequence v = e1, . . . , ed of signatures w.r.t. G which satisfies the following three conditions: (1) val +(v) = P , (2) Epow (v) = O(log P log∗ M ), and (3) for any e ∈ V and integer i such that val (e)[i..i + P − 1] = P , v occurs at position i in e. 11 Uniq(P ) = LP 0 LP hP −1 RP 0 , 0 t = Θ(∆L), RP t ) = Epow ( RP hP −1LP hP −1XShrink P hP RP t , then XPow P t always occurs in Pow T t , because XPow P hP ) ≤ ∆L + ∆R + 9, hP ≤ log P, LP Proof. We consider the following short sequence Uniq(P ) of signatures which represents P (see also Fig. 2): 0 ··· LP RP hP −1 ··· RP where hP is the minimum integer such that Epow (XShrink P hP ) ≤ ∆L + ∆R + 9. We show Lemma 4 using Uniq(P ), namely, we show v = Uniq(P ) satisfies all conditions (1)-(3). (1) This follows from Definition 3 (see also Fig. 2(2)). (2) Epow (XShrink P t = Θ(∆R) and Epow ( LP t ) = 1 for 1 ≤ t ≤ hP . Hence Epow (Uniq(P )) = O(log P log∗ M ). (3) For simplicity, here we only consider the case where val (e) = T , since other cases can be shown similarly. Consider any integer i with T [i..i + P − 1] = P (see also Fig. 2(2)). Note that for 0 ≤ t < hP , if XShrink P t occurs in Shrink T is determined only by XShrink P t−1 occurs in Pow T t−1, then XShrink P 0 occurs at position i in Shrink T t occur in the derivation tree of id (T ). Hence we discuss the positions of XShrink P t . Now, let ct + 1 and ct + 1 be the beginning positions of the corresponding occurrence of XShrink P in t Shrink T t [..ct] consists of Pow T t [..ct] and LP for 0 ≤ t < hP . This means that Uniq(P ) occurs at position i in id (T ). t ⊓⊔ The sequence v of signatures in Lemma 4 is called a common sequence of P = val (e)[i..i + k − 1] w.r.t. G. Lemma 4 implies that any substring P of T can be represented by a sequence p of signatures with Epow (p) = O(log P log∗ M ). The common sequences are conceptually equivalent to the cores [20] which are defined for the edit sensitive parsing of a text, a kind of locally consistent parsing of the text. t . Similarly, for 0 < t ≤ hP , if XPow P t . Since XShrink P t always occurs in Shrink T t−1 for 0 < t ≤ hP . Also, Pow T t and that of XPow P t in Pow T t , respectively. Then Shrink T 0 , XShrink P t and XPow P t [..ct] consists of Shrink T t−1[..ct−1] and LP Therefore Lemma 4 holds. t t and XPow P The number of ancestors of nodes corresponding to Uniq(P ) is upper bounded by the next lemma. Lemma 5. Let T and P be strings, and let T be the derivation tree of the signature encoding of T . Consider an occurrence of P in T , and the induced subtree X of T whose root is the root of T and whose leaves are the parents of the nodes representing Uniq(P ). Then X contains O(log∗ M ) nodes for every height and O(log T + log P log∗ M ) nodes in total. Proof. By Definition 3, for every height, X contains O(log∗ M ) nodes that are parents of the nodes representing Uniq(P ). Lemma 5 holds because the number of nodes at some height is halved when Shrink is applied. More precisely, consid- ering the x nodes of X at some height to which Shrink is applied, the number of their parents is at most (x + 2)/2. The next Lemma immediately follows from Lemma 5, which will be mainly used in the proof of Lemma 3 in Appendix and the proof of Lemma 9. 12 Lemma 6. Let s1, s2, s3 be any strings such that s3 = s1s2, and let T be the derivation tree of id (s3). Consider the induced subtree X of T whose root is the root of T and whose leaves are the parents of the nodes representing Uniq(s1)Uniq(s2) (see also Fig. 2(4)). Then the size of X is O(log s3 log∗ M ). The following lemma is about the computation of a common sequence of P . Lemma 7. Using the DAG for a signature encoding G = (Σ,V,D, S) of size w, given a signature e ∈ V (and its corresponding node in the DAG) and two integers i and k, we can compute Epow (Uniq(s[i..i + k − 1])) in O(log s + log k log∗ M ) time, where s = val (e). Proof. Let v be the common sequence of nodes which represents Uniq(s[i..i+k− 1]) and occurs at position i in e. Starting at the given node in the DAG which corresponds to e, we compute the induced subtree which represents Uniq(s[i..i + k − 1]), rooted at the lowest common ancestor of the nodes in v. By Lemma 5, the size of this subtree is O(log s + log k log∗ M ). We can obtain the root of this subtree in O(log s) time from the node representing e. Hence Lemma 7 ⊓⊔ holds. The next lemma shows that we can compute LCE efficiently using the signa- ture encoding of the (dynamic) text. Lemma 8. Using the DAG for a signature encoding G = (Σ,V,D, S) of size w, we can support queries LCE(s1, s2, i, j) and LCE(sR 2 , i, j) in O(log s1 + log s2 + log ℓ log∗ M ) time for given two signatures e1, e2 ∈ V and two integers 1 ≤ i ≤ s1, 1 ≤ j ≤ s2, where s1 = val (e1), s2 = val (e2) and ℓ is the answer to the LCE query. 1 , sR Proof. We focus on LCE(s1, s2, i, j) as LCE(sR 1 , sR 2 , i, j) is supported similarly. Let P denote the longest common prefix of s1 and s2. Our algorithm simul- taneously traverses two derivation trees rooted at e1 and e2 and computes P by matching the common signatures greedily from left to right. Since Uniq(P ) occurs at position i in e1 and at position j in e2 by Lemma 4, we can compute P by at least finding the common sequence of nodes which represents Uniq(P ), and hence, we only have to traverse ancestors of such nodes. By Lemma 5, the num- ber of nodes we traverse, which dominates the time complexity, is upper bounded by O(log s1 + log s2 + Epow (uniqP )) = O(log s1 + log s2 + log ℓ log∗ M ). ⊓⊔ Construction Recall that a signature encoding G generating a string T is represented and maintained by a data structure H. We show how to construct an H(log w, w) or H(fA, f ′ A) for G. It can be constructed from various types of inputs, such as (1) a plain (uncompressed) string T , (2) the LZ77 factorization of T , and (3) an SLP which represents T , as summarized by the following theorem. 13 Theorem 2. 1. Given a string T of length N , we can construct H(log w, w) for the signature encoding of size w which represents T in O(N ) time and working space, or H(fA, f ′ A + w) working space. 2. Given f1, . . . , fz LZ77 factors without self reference of size z representing T of length N , we can construct H(fA, f ′ A) for the signature encoding of size w which represents T in O(zfA log N log∗ M ) time and O(f ′ A + w) working space. A) in O(N fA) time and O(f ′ 3. Given an SLP S = {Xi → expr i}n i=1 of size n representing T of length N , we can construct H(log w, w) for the signature encoding of size w which rep- resents T in O(n log log n log N log∗ M ) time and O(n log∗ M + w) working space, or H(fA, f ′ A + w) working space. A) in O(nfA log N log∗ M ) time and O(f ′ Proof. See Appendix A. In the static case, the M term of Theorem 2 can be replaced with N . Update In Section 4, we describe our dynamic index using H for a signature encoding G generating a string T . For this end, we consider the following update operations for G using H. -- INSERT (Y, i): Given a string Y and an integer i, update H. Updated H -- DELETE (i, k): Given two integers i, k, update H. Updated H handles a handles a signature encoding G generates T ′ = T [..i − 1]Y [1..Y ]T [i..]. signature encoding G generates T ′ = T [..i − 1]T [i + k..]. During updates, a new assignment e → xexpr is appended to G whenever it is needed, in this paper, where e = maxV + 1 that has not been used as a signature. Specifically, we assign new signature to xeptr when Sig(xeptr ) returns undefined for some form xeptr during updates. Also, updates may produce a redundant signature whose parents in the DAG are all removed. To keep G admissible, we remove such redundant signatures from G during updates. Lemma 9. Using H(fA, f ′ A) for a signature encoding G = (Σ,V,D, S) of size w which generates T , we can support INSERT (i, Y ) and DELETE (i, k) in O(fA(k+ log N log∗ M )) time, where Y = k. Proof. We support DELETE (i, k) as follows: (1) Compute a new start vari- able S′ = id (T [..i − 1]T [i..]) by recomputing the new signature encoding from Uniq(T [..i − 1]) and Uniq(T [i + k..]). This can be done in O(fA log N log∗ M ) time by Lemmas 7 and 6. (2) Remove all redundant signatures Z from H(fA, f ′ A). Note that if a signature is redundant, then all the signatures along the path from S to it are also redundant. Hence, we can remove all redundant signatures effi- ciently by depth-first search starting from S, which takes O(fAZ) time, where Z = O(k + log N log∗ M ) by Lemma 6. Similarly, we can compute INSERT operation in O(fA(Y + log N log∗ M )) time by creating S′ using Uniq(T [..i − 1]), Uniq(Y ) and Uniq(T [i + k..]). Note that we can naively compute id (s) for a given string s ∈ Σ+ in O(fAs) time. ⊓⊔ Therefore Lemma 9 holds. 14 4 Dynamic Compressed Index In this section, we present our dynamic compressed index based on signature encoding. As already mentioned in Section 1.1, our strategy for pattern matching is different from that of Alstrup et al. [2]. It is rather similar to the one taken in the static index for SLPs of Claude and Navarro [8]. Besides applying their idea to run-length ACFGs, we show how to speed up pattern matching by utilizing the properties of signature encodings. The rest of this section is organized as follows: In Section 4.1, we briefly review the idea for the SLP index of Claude and Navarro [8]. In Section 4.2, we extend their idea to run-length ACFGs. In Section 4.3, we consider an index on signature encodings and improve the running time of pattern matching by using the properties of signature encodings. In Section 4.4, we show how to dynamize our index. 4.1 Static Index for SLP We review how the index in [8] for SLP S generating a string T computes Occ(P, T ) for a given string P . The key observation is that, any occurrence of P in T can be uniquely associated with the lowest node that covers the occurrence of P in the derivation tree. As the derivation tree is binary, if P > 1, then the node is labeled with some variable X ∈ V such that P1 is a suffix of X.left and P2 is a prefix of X.right, where P = P1P2 with 1 ≤ P1 < P. Here we call the pair (X,X.left − P1 + 1) a primary occurrence of P . Then, we can compute Occ(P, T ) by first computing such a primary occurrence and enumerating the occurrences of X in the derivation tree. Formally, we define the primary occurrences of P as follows. Definition 4 (The set of primary occurrences of P ). For a string P with P > 1 and an integer 1 ≤ j < P, we define pOccS(P, j) and pOccS(P ) as follows: pOccS(P, j) = {(X,X.left − j + 1) X ∈ V, pOccS(P ) = [1≤j<P pOccS(P, j), P [..j] is a suffix of X.left, P [j + 1..] is a prefix of X.right}, We call each element of pOccS(P ) a primary occurrence of P . The set Occ(P, T ) of occurrences of P in T is represented by pOccS(P ) as follows. Observation 1 For any string P , Occ(P, T ) =({j + k − 1 (X, j) ∈ pOccS (P ), k ∈ vOcc(X, S)} vOcc(X, S)((X → P ) ∈ D) if P > 1, if P = 1. 15 By Observation 1, the task is to compute pOccS(P ) and vOcc(X, S) effi- ciently. Note that vOcc(X, S) can be computed in O(vOcc(X, S)h) time by traversing the DAG in a reversed direction (i.e., using parents(X) function re- cursively) from X to the source, where h is the height of the derivation tree of S. Hence, in what follows, we focus on how to compute pOccS(P ) for a string P with P > 1. In order to compute pOccS(P, j), we use a data structure to solve the following problem: Problem 1 (Two-Dimensional Orthogonal Range Reporting Problem). Let X and Y denote subsets of two ordered sets, and let R ⊆ X × Y be a set of points on the two-dimensional plane, where X,Y ∈ O(R). A data structure for this problem supports a query report R(x1, x2, y1, y2); given a rectangle (x1, x2, y1, y2) with x1, x2 ∈ X and y1, y2 ∈ Y, returns {(x, y) ∈ R x1 ≤ x ≤ x2, y1 ≤ y ≤ y2}. Data structures for Problem 1 are widely studied in computational geometry. There is even a dynamic variant, which we finally use for our dynamic index in Section 4.4. Until then, we just use any static data structure that occupies O(R) space and supports queries in O(qR + qRqocc) time with qR = O(log R), where qocc is the number of points to report. Now, given an SLP S, we consider a two-dimensional plane defined by X = {X.leftR X ∈ V} and Y = {X.right X ∈ V}, where elements in X and Y are sorted by lexicographic order. Then consider a set of points R = {(X.leftR, X.right) X ∈ V}. For a string P and an integer 1 ≤ j < P, let y(P,j) ) denote the lexicographically smallest (resp. largest) element in Y that has P [j + 1..] as a prefix. If there is no such element, it just returns NIL and we can immediately know that pOccS(P, j) = ∅. We also define x(P,j) in a similar way over X , i.e., x(P,j) ) is the lexicographically smallest (resp. largest) element in X that has P [..j]R as a prefix. Then, pOccS(P, j) can be computed by a query report R(x(P,j) Example 5 (SLP). Let S be the SLP of Example 2. Then, ). See also Example 5. (resp. x(P,j) (resp. y(P,j) , x(P,j) , y(P,j) , y(P,j) and x(P,j) 2 1 2 1 2 1 2 1 2 1 X = {x1, x4, x2, x8, x5, x9, x6, x10, x11, x3, x7}, Y = {y1, y8, y2, y7, y9, y3, y4, y5, y6, y10, y11}, where xi = val (Xi)R, yi = val (Xi) for any Xi ∈ V. Given a pattern P = BCAB, then pOccS(P, 1) = {(X6, 3), (X11, 10)}, pOccS(P, 2) = {(X9, 1)}, pOccS(P, 3) = φ, vOccS (X6, S) = {1, 11}, vOccS(X9, S) = {7} and vOccS(X11, S) = {1}. Hence pOccS(P ) = {(X6, 3), (X11, 10), (X9, 1)} and Occ(P, T ) = {3, 7, 10, 13}. See also Fig. 3. We can get the following result: Lemma 10. For an SLP S of size n, there exists a data structure of size O(n) that computes, given a string P , pOccS(P ) in O(P(h+P) log n+qnpOccS (P )) time. 16 2 1 and y(P,j) Proof. For every 1 ≤ j < P, we compute pOccS(P, j) by report R(x(P,j) We can compute y(P,j) in O((h+P) log n) time by binary search on Y, where each comparison takes O(h+P) time for expanding the first O(P) char- and x(P,j) acters of variables subjected to comparison. In a similar way, x(P,j) can be computed in O((h + P) log n) time. Thus, the total time complexity is O(P((h+P) log n+qn)+qnpOccS(P )) = O(P(h+P) log n+qnpOccS(P )). ⊓⊔ , x(P,j) 1 2 1 2 , y(P,j) 1 , y(P,j) 2 ). 4.2 Static Index for Run-length ACFG In this subsection, we extend the idea for the SLP index described in Section 4.1 to run-length ACFGs. Consider occurrences of string P with P > 1 in run- length ACFG G = (Σ,V,D, S) generating string T . The difference from SLPs is that we have to deal with occurrences of P that are covered by a node labeled with e → ed but not covered by any single child of the node in the derivation tree. In such a case, there must exist P = P1P2 with 1 ≤ P1 < P such that P1 is a suffix of e.left = val +(e) and P2 is a prefix of e.right = val +(ed−1). Let j = val (e)−P1+1 be a position in val +(ed) where P occurs, then P also occurs at j +cval (e) in val +(ed) for every positive integer c with j +cval (e)+P−1 ≤ val +(ed). Remarking that we apply Definition 4 of primary occurrences to run- length ACFGs as they are, we formalize our observation to compute Occ(P, T ) as follows: Observation 2 For any string P with P > 1, Occ(P, T ) = {j + k + c − 1 (e, i) ∈ pOccG(P ), c ∈ {0} ∪ RunG(e, j,P), k ∈ vOcc(e, S)}, where RunG(e, j,P) =({cval (e) 1 ≤ c, j + cval (e) + P − 1 ≤ val +(ed)} ∅ if e → ed, otherwise. By the above observation, we can get the same result for a run-length ACFG as for an SLP in Lemma 10. 4.3 Static Index for Signature Encoding 2 1 2 1 , y(P,j) , y(P,j) , x(P,j) We can apply the result of Section 4.2 to signature encodings because signature encodings are run-length ACFGs, i.e., we can compute Occ(P, T ) by querying report R(x(P,j) ) for "every" 1 ≤ j < P. However, the proper- ties of signature encodings allow us to speed up pattern matching as summarized in the following two ideas: (1) We can efficiently compute x(P,j) and y(P,j) using LCE queries in compressed space (Lemma 11). (2) We can reduce 2 the number of report R queries from O(P) to O(log P log∗ M ) by using the property of the common sequence of P (Lemma 12). Lemma 11. Assume that we have the DAG for a signature encoding G = (Σ,V,D, S) of size w and X and Y of G. Given a signature id (P ) ∈ V for a string P and an integer j, we can compute x(P,j) in O(log w(log N + log P log∗ M )) time. and y(P,j) , x(P,j) , x(P,j) , y(P,j) , y(P,j) 2 1 1 1 2 1 2 17 1 2 2 1 and x(P,j) in the same time. Proof. By Lemma 8 and Fact 1, we can compute x(P,j) on X by binary search in O(log w(log N + logP log∗ M )) time. Similarly, we can compute y(P,j) and y(P,j) ⊓⊔ Lemma 12. Let P be a string with P > 1. If Pow P 0 = 1, then pOccG(P ) = pOccG(P, 1). If Pow P 0 > 1, then pOccG(P ) =Sj∈P pOccG(P, j), where u is the common sequence of P and P = {val +(u[1..i]) 1 ≤ i < u, u[i] 6= u[i + 1]}. Proof. If Pow P 0 = 1, then P = aP for some character a ∈ Σ. In this case, P must be contained in a node labeled with a signature e → ed such that e → a and d ≥ P. Hence, all primary occurrences of P can be found by pOccG(P, 1). If Pow P 0 > 1, we consider the common sequence u of P . Recall that u occurs at position j in e for any (e, j) ∈ pOcc(P ) by Lemma 4. Hence at least pOccG(P ) =Si∈P ′ pOccG(P, i) holds, where P ′ = {val +(u[1]), . . . ,val +(u[..u− 1])}. Moreover, we show that pOccG(P, i) = ∅ for any i ∈ P ′ with u[i] = u[i + 1]. Note that u[i] and u[i + 1] are encoded into the same signature in the derivation tree of e, and that the parent of two nodes corresponding to u[i] and u[i + 1] has a signature e′ in the form e′ → u[i]d. Now assume for the sake of contradiction that e = e′. By the definition of the primary occurrences, i = 1 must hold, and hence, Shrink P 0 [1] = u[1] ∈ Σ. This means that P = u[1]P , which contradicts Pow P ⊓⊔ 0 > 1. Therefore the statement holds. Using Lemmas 2, 7, 11 and 12, we get the following lemma: Lemma 13. For a signature encoding G, represented by H(fA, f ′ A), of size w which generates a text T of length N , there exists a data structure of size O(w) that computes, given a string P , pOccG(P ) in O(PfA+log w log P log∗ M (log N + log P log∗ M ) + qwpOccS(P )) time. Proof. We focus on the case Pow P 0 > 1 as the other case is easier to be solved. We first compute the common sequence of P in O(PfA) time. Taking P in Lemma 12, we recall that P = O(log P log∗ M ) by Lemma 4. Then, in light of Lemma 12, pOccG(P ) can be obtained by P = O(log P log∗ M ) range reporting queries. For each query, we spend O(log w(log N + log P log∗ M )) time to compute x(P,j) by Lemma 11. Hence, the to- tal time complexity is O(PfA + log P log∗ M (log w(log N + log P log∗ M ) + qw) + qwpOccS(P )) = O(PfA + log w log P log∗ M (log N + log P log∗ M ) + qwpOccS(P )). ⊓⊔ and y(P,j) , x(P,j) , y(P,j) 2 1 1 2 4.4 Dynamic Index for Signature Encoding In order to dynamize our static index in the previous subsection, we consider a data structure for "dynamic" two-dimensional orthogonal range reporting that can support the following update operations: -- insert R(p, xpred , ypred): given a point p = (x, y), xpred = max{x′ ∈ X x′ ≤ x} and ypred = max{y′ ∈ Y y′ ≤ y}, insert p to R and update X and Y accordingly. 18 -- delete R(p): given a point p = (x, y) ∈ R, delete p from R and update X and Y accordingly. We use the following data structure: Lemma 14 ([7]). There exists a data structure that supports report R(x1, x2, y1, y2) in O(log R + occ(log R/ log log R)) time, and insert R(p, i, j), delete R(p) in amortized O(log R) time, where occ is the number of the elements to output. This structure uses O(R) space. 4 Now we are ready to prove Theorem 1. Proof (Proof of Theorem 1). Our index consists of H(fA, f ′ A) and a dynamic range reporting data structure Λ of Lemma 14 whose R is maintained as they are defined in the static version. We maintain X and Y in two ways; self-balancing binary search trees for binary search, and Dietz and Sleator's data structures for order maintenance. Then, primary occurrences of P can be computed as described in Lemma 13. Adding the O(occ log N ) term for computing all pattern occurrences from primary occurrences, we get the time complexity for pattern matching in the statement. Concerning the update of our index, we described how to update H after INSERT and DELETE in Lemma 9. What remains is to show how to update Λ when a signature is inserted into or deleted from V. When a signature e is deleted from V, we first locate e.leftR on X and e.right on Y, and then execute delete R(e.leftR, e.right). When a signature e is inserted into V, we first locate xpred = max{x′ ∈ X x′ ≤ e.leftR} on X and ypred = max{y′ ∈ Y y′ ≤ e.right} on Y, and then execute insert R((e.leftR, e.right), xpred , ypred). The locating can be done by binary search on X and Y in O(log w log N log∗ M ) time as Lemma 11. In a single INSERT (i, Y ) or DELETE (i, y) operation, O(y + log N log∗ M ) signatures are inserted into or deleted from V, where Y = y. ⊓⊔ Hence we get Theorem 1. 5 Applications In this section, we present a number of applications of the data structures of Sections 3 and 4. Theorems 3 and 4 are applications to text compression. Theorem 3. Given a string T of length N , we can compute the LZ77 Factoriza- tion of T in O(N fA +z log w log3 N (log∗ N )2) time and O(w+f ′ A) working space using H(fA, f ′ A) for a signature encoding of size w which generates T , where z is the size of the LZ77 factorization of T and w = O(z log N log∗ N ). 4 The original problem considers a real plane in the paper [7], however, his solution only need to compare any two elements in R in constant time. Hence his solution can apply to our range reporting problem by maintains X and Y using the data structure of order maintenance problem proposed by Dietz and Sleator [9], which enables us to compare any two elements in a list L and insert/delete an element to/from L in constant time. 19 Theorem 4. (1) Given an H(fA, f ′ A) for a signature encoding G = (Σ,V,D, S) of size w which generates T , we can compute an SLP S of size O(w log T) gen- erating T in O(w log T) time. (2) Let us conduct a single INSERT or DELETE operation on the string T generated by the SLP of (1). Let y be the length of the substring to be inserted or deleted, and let T ′ be the resulting string. During the above operation on the string, we can update, in O((y + log T ′ log∗ M )(fA + log T ′)) time, the SLP of (1) to an SLP S′ of size O(w′ log T ′) which gener- ates T ′, where M is the maximum length of the dynamic text, w′ is the size of updated G which generates T ′. Theorems 5-9 are applications to compressed string processing (CSP), where the task is to process a given compressed representation of string(s) without explicit decompression. Theorem 5. Given an SLP S of size n generating a string of length N , we can construct, in O(n log log n log N log∗ N ) time, a data structure which occupies O(n log N log∗ N ) space and supports LCP(Xi, Xj) and LCS(Xi, Xj) queries for variables Xi, Xj in O(log N ) time. The LCP(Xi, Xj) and LCS(Xi, Xj) query times can be improved to O(1) using O(n log n log N log∗ N ) preprocessing time. Theorem 6. Given an SLP S of size n generating a string T of length N , there is a data structure which occupies O(w + n) space and supports queries LCE(Xi, Xj, a, b) for variables Xi, Xj, 1 ≤ a ≤ Xi and 1 ≤ b ≤ Xj in O(log N + log ℓ log∗ N ) time, where w = O(z log N log∗ N ). The data struc- ture can be constructed in O(n log log n log N log∗ N ) preprocessing time and O(n log∗ N + w) working space, where z ≤ n is the size of the LZ77 factorization of T and ℓ is the answer of LCE query. Let h be the height of the derivation tree of a given SLP S. Note that h ≥ log N . Matsubara et al. [21] showed an O(nh(n+ h log N ))-time O(n(n+ log N ))- space algorithm to compute an O(n log N )-size representation of all palindromes in the string. Their algorithm uses a data structure which supports in O(h2) time, LCE queries of a special form LCE(Xi, Xj, 1, pj) [23]. This data structure takes O(n2) space and can be constructed in O(n2h) time [19]. Using Theorem 6, we obtain a faster algorithm, as follows: Theorem 7. Given an SLP of size n generating a string of length N , we can compute an O(n log N )-size representation of all palindromes in the string in O(n log2 N log∗ N ) time and O(n log∗ N + w) space. A non-empty string s is called a Lyndon word if s is the lexicographically smallest suffix of s. The Lyndon factorization of a non-empty string w is a sequence of pairs (fi, pi) where each fi is a Lyndon word and pi is a positive integer such that w = f p1 m and fi−1 is lexicographically smaller than fi for all 1 ≤ i < m. I et al. [14] proposed a Lyndon factorization algorithm running in O(nh(n + log n log N )) time and O(n2) space. Their algorithm use the LCE data structure on SLPs [16] which requires O(n2h) preprocessing time, O(n2) working space, and O(h log N ) time for LCE queries. We can obtain a faster algorithm using Theorem 6. 1 ··· f pm 20 Theorem 8. Given an SLP of size n generating a string of length N , we can compute the Lyndon factorization of the string in O(n(n + log n log N log∗ N )) time and O(n2 + z log N log∗ N )) space. We can also solve the grammar compressed dictionary matching problem [17] with our data structures. We preprocess an input dictionary SLP (DSLP) hS, mi with n productions that represent m patterns. Given an uncompressed text T , the task is to output all occurrences of the patterns in T . Theorem 9. Given a DSLP hS, mi of size n that represents a dictionary ΠhS,mi for m patterns of total length N , we can preprocess the DSLP in O((n log log n + m log m) log N log∗ N ) time and O(n log N log∗ N ) space so that, given any text T in a streaming fashion, we can detect all occ occurrences of the patterns in T in O(T log m log N log∗ N + occ) time. It was shown in [17] that we can construct in O(n4 log n) time a data structure of size O(n2 log N ) which finds all occurrences of the patterns in T in O(T(h + m)) time, where h is the height of the derivation tree of DSLP hS, mi. Note that our data structure of Theorem 9 is always smaller, and runs faster when h = ω(log m log N log∗ N ). Acknowledgments. We would like to thank Pawe l Gawrychowski for drawing our attention to the work by Alstrup et al. [2,3] and for fruitful discussions. References 1. Agarwal, P.K., Arge, L., Govindarajan, S., Yang, J., Yi, K.: Efficient external memory structures for range-aggregate queries. Comput. Geom. 46(3), 358 -- 370 (2013), http://dx.doi.org/10.1016/j.comgeo.2012.10.003 2. Alstrup, S., Brodal, G.S., Rauhe, T.: Dynamic pattern matching. Tech. rep., De- partment of Computer Science, University of Copenhagen (1998) 3. Alstrup, S., Brodal, G.S., Rauhe, T.: Pattern matching in dynamic texts. In: Proc. SODA 2000. pp. 819 -- 828 (2000) 4. Beame, P., Fich, F.E.: Optimal prob- lem and related problems. J. Comput. Syst. Sci. 65(1), 38 -- 72 (2002), http://dx.doi.org/10.1006/jcss.2002.1822 predecessor bounds for the 5. Bille, P., Cording, P.H., Gørtz, I.L., Sach, B., Vildhøj, H.W., Vind, S.: Fingerprints in compressed strings. In: Proc. WADS 2013. pp. 146 -- 157 (2013) 6. Bille, P., Christiansen, A.R., Cording, P.H., Gørtz, I.L.: Finger search, random access, and longest common extensions in grammar-compressed strings. CoRR abs/1507.02853 (2015) 7. Blelloch, G.E.: Space-efficient dynamic orthogonal point location, segment intersec- tion, and range reporting. In: Teng, S.H. (ed.) SODA. pp. 894 -- 903. SIAM (2008) 8. Claude, F., Navarro, G.: Self-indexed grammar-based compression. Fundamenta Informaticae 111(3), 313 -- 337 (2011) 9. Dietz, P.F., Sleator, D.D.: Two algorithms for maintaining order in a list. In: Aho, A.V. (ed.) Proceedings of the 19th Annual ACM Symposium on Theory of Computing, 1987, New York, New York, USA. pp. 365 -- 372. ACM (1987), http://doi.acm.org/10.1145/28395.28434 21 10. Fischer, J., Gagie, T., Gawrychowski, P., Kociumaka, T.: Approximating LZ77 via small-space multiple-pattern matching. In: ESA 2015. pp. 533 -- 544 (2015) 11. Goto, K., Maruyama, S., Inenaga, S., Bannai, H., Sakamoto, H., Takeda, M.: Re- structuring compressed texts without explicit decompression. CoRR abs/1107.2729 (2011) 12. Han, Y.: Deterministic sorting in O(n log log n) time and linear space. Proc. STOC 2002 pp. 602 -- 608 (2002) 13. Hon, W., Lam, T.W., Sadakane, K., Sung, W., Yiu, S.: Compressed index for dynamic text. In: DCC 2004. pp. 102 -- 111 (2004) 14. I, T., Nakashima, Y., Inenaga, S., Bannai, H., Takeda, M.: Faster Lyndon factoriza- tion algorithms for SLP and LZ78 compressed text. In: Proc. SPIRE. pp. 174 -- 185 (2013) 15. I, T., Matsubara, W., Shimohira, K., Inenaga, S., Bannai, H., Takeda, M., Nar- isawa, K., Shinohara, A.: Detecting regularities on grammar-compressed strings. Inf. Comput. 240, 74 -- 89 (2015) 16. I, T., Matsubara, W., Shimohira, K., Inenaga, S., Bannai, H., Takeda, M., Nar- isawa, K., Shinohara, A.: Detecting regularities on grammar-compressed strings. Inf. Comput. 240, 74 -- 89 (2015), http://dx.doi.org/10.1016/j.ic.2014.09.009 17. I, T., Nishimoto, T., Inenaga, S., Bannai, H., Takeda, M.: Compressed au- tomata for dictionary matching. Theor. Comput. Sci. 578, 30 -- 41 (2015), http://dx.doi.org/10.1016/j.tcs.2015.01.019 18. Kieffer, J.C., Yang, E.: Grammar-based codes: A new class of universal lossless source codes. IEEE Transactions on Information Theory 46(3), 737 -- 754 (2000) 19. Lifshits, Y.: Processing compressed texts: A tractability border. In: Proc. CPM 2007. LNCS, vol. 4580, pp. 228 -- 240 (2007) 20. Maruyama, S., Nakahara, M., Kishiue, N., Sakamoto, H.: Esp-index: A compressed index based on edit-sensitive parsing. J. Discrete Algorithms 18, 100 -- 112 (2013) 21. Matsubara, W., Inenaga, S., Ishino, A., Shinohara, A., Nakamura, T., Hashimoto, K.: Efficient algorithms to compute compressed longest common substrings and compressed palindromes. Theor. Comput. Sci. 410(8 -- 10), 900 -- 913 (2009) 22. Mehlhorn, K., Sundar, R., Uhrig, C.: Maintaining dynamic sequences under equal- ity tests in polylogarithmic time. Algorithmica 17(2), 183 -- 198 (1997) 23. Miyazaki, M., Shinohara, A., Takeda, M.: An improved pattern matching algorithm for strings in terms of straight-line programs. In: Proc. CPM 1997. pp. 1 -- 11 (1997) 24. Munro, J.I., Nekrich, Y., Vitter, J.S.: Dynamic data structures for document col- lections and graphs. CoRR abs/1503.05977 (2015) 25. Policriti, A., Prezza, N.: Fast online Lempel-Ziv factorization in compressed space. In: SPIRE 2015. pp. 13 -- 20 (2015) 26. Sahinalp, S.C., Vishkin, U.: Data compression using locally consistent parsing. TechnicM report, University of Maryland Department of Computer Science (1995) 27. Sahinalp, S.C., Vishkin, U.: Efficient approximate and dynamic matching of pat- terns using a labeling paradigm (extended abstract). In: FOCS. pp. 320 -- 328. IEEE Computer Society (1996) 28. Sakamoto, H., Maruyama, S., Kida, T., Shimozono, S.: A space-saving approxi- mation algorithm for grammar-based compression. IEICE Transactions 92-D(2), 158 -- 165 (2009) 29. Salson, M., Lecroq, T., L´eonard, M., Mouchard, L.: Dynamic extended suffix arrays. J. Discrete Algorithms 8(2), 241 -- 257 (2010) 30. Takabatake, Y., Tabei, Y., Sakamoto, H.: Improved esp-index: A practical self- index for highly repetitive texts. In: Proc. SEA 2014. pp. 338 -- 350 (2014) 22 31. Takabatake, Y., Tabei, Y., Sakamoto, H.: Online self-indexed grammar compres- sion. In: SPIRE 2015. pp. 258 -- 269 (2015) 32. Ziv, J., Lempel, A.: A universal algorithm for sequential data compression. IEEE Transactions on Information Theory IT-23(3), 337 -- 349 (1977) 23 pow2 T=! shrink2 T=! pow1 T=! shrink1 T=! pow0 T=! shrink0 T=! 17! 16! 13! 15! 12! 14! 9! 9! 10! 10! 10! 10! 10! 10! 10! 11! 8! 8! 10! 7! 5! 6! 7! 5! 6! 5! 6! 5! 6! 5! 6! 5! 6! 5! 6! 5! 6! 5! 6! 5! 6! 4! 3! 1! 2! 3! 1! 2! 1! 2! 1! 2! 1! 2! 1! 2! 1! 2! 1! 2! 1! 2! 1! 2! 3! 3! 3! 3! T =! C! A!B! C! A!B! A!B! A!B! A!B! A!B! A!B! A!B! A!B! A!B! C! C! C! C! 17! 16! 13! 14! 11! 15! 12! 9! 10! 8! 4! 7! 5! 6! 3! 1! 2! Fig. 1. The derivation tree of S (left) and the DAG for G (right) of Example 3. In the DAG, the black and red arrows represent e → eler and e → ek respectively. In Example 4, T is encoded by signature encoding. In the derivation tree of S, the dotted boxes represent the blocks created by the Eblock function. 24 (1)! S! P! XShrink2 P! XPow1 XShrink1 P! XPow0 XShrink0 P! P! T = ! L P! R! (2)! shrink1 pow1 shrink1 pow0 shrink0 T = ! T = ! T = ! T = ! T = ! T = ! ^! T[..c 2]! T[..c 1]! ^! T[..c 1]! 0]! shrink2 pow1 shrink1 T[..c pow0 ^! T[..c 0]! ^! L0 L0 XShrink2 P! P! R1 ^! R1 P! P! L1 ^! L1 P! P! shrink0 L P! S! P! P! R0 ^! R0 P! R! (3)! L P! C P! R! id(s3)! (4)! subtree X ! s1 s2! Uniq(s 1) ! Uniq(s 2) ! Fig. 2. Abstract images of consistent signatures of substring P of text T , on the derivation trees of the signature encoding of T . Gray rectangles in Figures (1)-(3) represent consistent signature sequences for occurrences of P . (1) Each XShrink P t and XPow P t , respectively, where T = LP R. (2) The substring P can be represented by LP 1 XShrink P 0 . (3) There exist common signatures on every substring P in the derivation tree. (4) The derivation tree of id (s3) and the subtree X in the proof of Lemma 6. t occur on substring P in shrink T t and Pow T 1 LP 2 RP 1 RP 1 RP 0 0 LP 0 RP LP 25 "! X 11! X 10! X X X X X X X X X 6! 5! 4! 3! 9! 7! 2! 8! 1! X 8! X 5! X 11! X 6! X 7! X 10! X 9! X 4! X X 1 X 4 2 X 8 X 5 X 9 X 6 X X 10 X X 7! 3 11 !! Fig. 3. The grid represents the relation between X , Y and R of Example 5. The red rectangle is a query rectangle (x(P,1) = x11, y(P,1) ) = {X6, X11}. = y11. Therefore, report R(x(P,1) = y5 and y(P,1) ), where x(P,1) = x2, x(P,1) , y(P,1) , y(P,1) 2 , x(P,1) 2 1 1 , x(P,1) , y(P,1) , y(P,1) 2 1 2 1 1 2 1 2 26 A Appendix : Theorem 2 A.1 Proof of Theorem 2 (1) H(log w, w) construction in O(N ) time and space. Our algorithm com- putes signatures level by level, i.e., constructs incrementally Shrink T 0 , Pow T 0 , . . . , Shrink T h . For each level, we determine signatures by sorting signa- ture blocks (or run-length encoded signatures) to which we give signatures. The following two lemmas describe the procedure. h , Pow T Lemma 15. Given Eblock (Pow T O((b−a)+Pow T and a is the minimum integer in Pow T t−1) for 0 < t ≤ h, we can compute Shrink T t−1) time and space, where b is the maximum integer in Pow T t t−1. in t−1 t−1[i]−a fits in an entry of a bucket of size b−a for each element of Pow T Proof. Since we assign signatures to signature blocks and run-length signatures in the derivation tree of S in the order they appear in the signature encoding. Pow T t−1[i] of Pow T t−1. Also, the length of each block is at most four. Hence we can sort all t−1) by bucket sort in O((b − a) + Pow T the blocks of Eblock (Pow T t−1) time and space. Since Sig is an injection and since we process the levels in increasing order, for any two different levels 0 ≤ t′ < t ≤ h, no elements of Shrink T t−1 appear in Shrink T t′−1. Thus, we can determine a new signature for each block in Eblock (Pow T t−1), without searching existing signatures in the lower levels. This completes the proof. t′−1, and hence no elements of Pow T t−1 appear in Pow T Lemma 16. Given Epow (Shrink T Epow (Shrink T Epow (Shrink T integer in Pow T in O(x + (b − a) + t )) time and space, where x is the maximum length of runs in t ), b is the maximum integer in Pow T t−1, and a is the minimum t−1. t ), we can compute Pow T t Proof. We first sort all the elements of Epow (Shrink T a+Epow (Shrink T integer r appearing in Shrink T bucket of size x. This takes a total of O(x +Epow (Shrink T all integers appearing in Shrink T t ) by bucket sort in O(b − t )) time and space, ignoring the powers of runs. Then, for each t , we sort the runs of r's by bucket sort with a t )) time and space for t . The rest is the same as the proof of Lemma 15. The next lemma shows how to construct H(log w, w) from a sorted assign- ment set D of G. Lemma 17. Given a sorted assignment set D of G, we can construct H(log w, w) of G in O(V) time. Proof. Recall that H consists of A and DAG B. Clearly, given a sorted assign- ment set D, we can construct B in linear time and space. Also, we can construct, in linear time and space, a balanced search tree for A from D. Hence Lemma 17 holds. We are ready to prove the theorem. 27 Proof. In the derivation tree of id (T ), since the number of nodes in some level is halved when going up two levels higher, every node of Since the size of the derivation tree of id (T ) is O(N ), by Lemmas 1, 15, and 16, we can compute id (T ) and a sorted assignment set D of G in O(N ) time and space. Finally, by Lemma 17, we can get H(log w, w) for G in O(N ) time. H(fA, f ′ A) construction in O(N fA) time and O(f ′ A +w) working space. Proof. Note that we can naively compute id (T ) for a given string T in O(N fA) time and O(N ) working space. In order to reduce the working space, we consider factorizing T into blocks of size B and processing them incrementally: Starting with the empty signature encoding G, we can compute id (T ) in O( N B)) time and O(w + B + f ′ 1..iB], (i − 1)B + 1) for i = 1, . . . , N finished by choosing B = log N log∗ M . A) working space by using INSERT (T [(i − 1)B + B in increasing order. Hence our proof is B fA(log N log∗ M + A.2 Proof of Theorem 2 (2) Proof. Consider H(fA, f ′ A) for an empty signature encodings G. If we can com- pute INSERT (Y, i) operation in O(fA log N log∗ M ) time, then Theorem 2 (2) immediately holds by computing INSERT (fi,f1 ··· fi−1 + 1) for 1 ≤ i ≤ z incrementally. By the proof of Lemma 9, we can compute INSERT (Y, i) for a given Uniq(Y ) in O(fA log N log∗ M ) time. We can compute each Uniq(fi) in O(log N log∗ M ) time by Lemma 7 because fi occurs previously in T when fi > 1. Hence we get Theorem 2 (2). Note that we can directly show Lemma 3 from the above proof because the size of G increases O(log N log∗ M ) by Lemma 6, every time we do INSERT (fi,f1 ··· fi−1+ 1) for 1 ≤ i ≤ z. A.3 Proof of Theorem 2 (3) A) construction in O(nfA log N log∗ M ) time and O(f ′ A + w) H(fA, f ′ working space. Proof. We can construct H(fA, f ′ Theorem 2 (2). A) by O(n) INSERT operations as the proof of H(log w, w) construction in O(n log log n log N log∗ M ) time and O(n log∗ M + w) working space. In this section, we sometimes abbreviate val (X) as X for and Pow val(X) X ∈ S. For example, Shrink X respectively. t represents Shrink val(X) t and Pow X t t Our algorithm computes signatures level by level, i.e., constructs incremen- tally Shrink Xn h . Like the algorithm described in Section A.1, we can create signatures by sorting blocks of signatures or run- length encoded signatures in the same level. The main difference is that we now 0 , . . . , Shrink Xn h , Pow Xn 0 , Pow Xn 28 utilize the structure of the SLP, which allows us to do the task efficiently in O(n log∗ M + w) working space. In particular, although Shrink Xn = O(N ) for 0 ≤ t ≤ h, they can be represented in O(n log∗ M ) space. In so doing, we introduce some additional notations relating to XShrink P t and XPow P in Definition 3. By Lemma 4, for any string P = P1P2 the following t equation holds: ,Pow Xn t t XShrink P XPow P t = yP1 t = yP1 t z(P1,P2) t z(P1,P2) t t yP2 t yP2 t for 0 < t ≤ hP , for 0 ≤ t < hP , where we define yP t and yP t for a string P as follows: yP t ε t =(XShrink P t =(XPow P ε t yP for 0 < t ≤ hP , for t > hP , for 0 ≤ t < hP , for t ≥ hP . ) t t t t ,zXi t = z(val(Xℓ),val(Xr )) t = z(val(Xℓ),val(Xr )) = O(log∗ N ) by Lemma 5. We can use zX1 For any variable Xi → XℓXr, we denote zXi (for 0 < t ≤ hval(Xi)) and zXi (for 0 ≤ t < hval(Xi)). Note that zXi , . . . , zXn , . . . , zXn t as a compressed representation of XShrink Xn (resp. XPow Xn ) based on the SLP: Intuitively, zXn (resp. XPow Xn ) and the remaining part is recovered by investigating the left/right child recur- sively (see also Figure. 4). Hence, with the DAG structure of the SLP, XShrink Xn and XPow Xn can be represented in O(n log∗ M ) space. ) covers the middle part of XShrink Xn (resp. zXn (resp. zX1 t t t t t t t t t t t t t t t , AP t−1LP t−1BP t , BP t−1 (resp. RP In addition, we define AP t and BP t ) is a prefix (resp. suffix) of Shrink P t which consists of signatures of AP t = AP t (resp. BP t−1); and for 0 ≤ t < hP , AP t (resp. RP LP for 0 ≤ t ≤ hP , and Pow P (resp. BP AP suffix) of Pow P nition, Shrink P for 0 ≤ t < hP . See Figure 5 for the illustration. (zX1 O(n log∗ M ). Similarly, for 0 ≤ t < hXn , we use Λt = (zX1 as a compressed representation of Pow Xn Since Shrink Xn , AXn , . . . , zXn of size O(n log∗ M ). t = AXn t XShrink P , BXn BP t t as follows: For 0 < t ≤ hP , AP t t which consists of signatures of t ) is a prefix (resp. t ). By the defi- t BP t t t = AP t XPow P BP BXn t XShrink Xn ) as a compressed representation of Shrink Xn for 0 < t ≤ hXn , we use Λt = of size , BXn ) , . . . , zXn , AXn Our algorithm computes incrementally Λ0, Λ1, . . . , ΛhXn . Note that, given hXn of size O(log∗ M ) in O(n log∗ M ) time, and hXn . Hence, in the following three ΛhXn , we can easily get Pow Xn then id (val (Xn)) in O(log∗ M ) time from Pow Xn lemmas, we show how to compute Λ0, Λ1, . . . , ΛhXn . Lemma 18. Given an SLP of size n, we can compute Λ0 in O(n log log n log∗ M ) time and O(n log∗ M ) space. t t t t t t t t t t t Proof. We first compute, for all variables Xi, Epow (XShrink Xi ∆L + ∆R + 9, otherwise Epow ( LXi 0 ) and Epow ( RXi 0 ) if Epow (XShrink Xi 0 ) ≤ 0 ). The information can be 29 XPow t Xn Xn z t Xn-1 XPow t Xn-1 z t XPow t Xn-4 Xn-4 z t XPow t Xn-7 Xn-7 z t XPow t Xn-2 Xn-2 z t Xn-3 XPow t Xn-3 z t Xn-5 z t Xn-6 z t Fig. 4. XPow Xn t can be represented by zX1 t , . . . , zXn t . computed in O(n log∗ M ) time and space in a bottom-up manner, i.e., by process- ing variables in increasing order. For Xi → XℓXr, if both Epow (XShrink Xℓ 0 ) and Epow (XShrink Xr 0 ) are no greater than ∆L + ∆R + 9, we can compute 0 ) in O(log∗ M ) time by naively concatenating Epow (XShrink Xℓ Epow (XShrink Xi 0 ) and Epow (XShrink Xr 0 ). Otherwise Epow (XShrink Xi 0 ) > ∆L +∆R +9 must hold, and Epow ( LXi 0 ) can be computed in O(1) time from the infor- mation for Xℓ and Xr. 0 ) and Epow ( RXi The run-length encoded signatures represented by zXi 0 can be obtained by using the above information for Xℓ and Xr in O(log∗ M ) time: zXi is created over 0 0 ) (or Epow ( RXℓ run-length encoded signatures Epow (XShrink Xℓ 0 )) followed by Epow (XShrink Xr represents Epow ( LXn 0 )). Also, by definition AXn 0 ) (or Epow ( RXr ), respectively. 0 ) and Epow ( RXn 0 Hence, we can compute in O(n log∗ M ) time O(n log∗ M ) run-length encoded signatures to which we give signatures. We determine signatures by sorting the run-length encoded signatures as Lemma 16. However, in contrast to Lemma 16, we do not use bucket sort for sorting the powers of runs because the maxi- mum length of runs could be as large as N and we cannot afford O(N ) space for buckets. Instead, we use the sorting algorithm of Han [12] which sorts x integers in O(x log log x) time and O(x) space. Hence, we can compute Λ0 in O(n log log n log∗ M ) time and O(n log∗ M ) space. and BXn 0 0 Lemma 19. Given Λt, we can compute Λt in O(n log log n log∗ M ) time and O(n log∗ M ) space. Proof. The computation process is similar to that of Lemma 18, except that we also use the information in Λt. 30 ShrinkP 2 PowP 1 = = ^ AP 2 XShrinkP 2 AP 1 LP 1 RP 1 ShrinkP 1 PowP 0 ^ = AP 1 LP 0 =AP 0 ShrinkP ^ = LP 0 0 ^ LP 1 P ^ RP 1 ^ BP 2 BP 1 ^ BP 1 BP 0 ^ RP 0 RP 0 Fig. 5. An abstract image of Shrink P (resp. RP RP t ) is encoded into AP t ) is encoded into AP t (resp. BP t BP BP t t ). t and Pow P t for a string P . For 0 ≤ t < hP , AP t+1 (resp. BP t+1). Similarly, for 0 < t < hP , AP t t LP t (resp. t LP t ) ≤ t t ) and Epow ( RXi We first compute, for all variables Xi, Epow (XShrink Xi t ) if Epow (XShrink Xi ∆L + ∆R + 9, otherwise Epow ( LXi t ). The information can be computed in O(n log∗ M ) time and space in a bottom-up manner, i.e., by process- ing variables in increasing order. For Xi → XℓXr, if both Epow (XShrink Xℓ t ) and Epow (XShrink Xr ) are no greater than ∆L + ∆R + 9, we can compute 0 ) in O(log∗ M ) time by naively concatenating Epow (XShrink Xℓ Epow (XShrink Xi t ), Epow (zXi t ) > ∆L+∆R+9 must hold, and Epow ( LXi 0 ) can be computed in O(1) time from Epow (zXi ). Otherwise Epow (XShrink Xi t ) and the information for Xℓ and Xr. t ) and Epow (XShrink Xr 0 ) and Epow ( RXi The run-length encoded signatures represented by zXi can be obtained in O(log∗ M ) time by using zXi is created over run-length encoded signatures that are obtained by concatenating Epow (XShrink Xℓ 0 )). Also, AXn and the above information for Xℓ and Xr: zXi and Epow (XShrink Xr and RXn 0 ) (or Epow ( RXr 0 ) (or Epow ( RXℓ 0 )), zXi t LXn represents AXn , respectively. and BXn BXn t t t t Hence, we can compute in O(n log∗ M ) time O(n log∗ M ) run-length encoded t t t t t t signatures to which we give signatures. We determine signatures in O(n log log n log∗ M ) time by sorting the run-length encoded signatures as Lemma 19. Lemma 20. Given Λt, we can compute Λt+1 in O(n log∗ M ) time and O(n log∗ M ) space. t Proof. In order to compute zXi t+1 for a variable Xi → XℓXr, we need a signature sequence on which zXi t+1 is created, as well as its context, i.e., ∆L signatures to the left and ∆R to the right. To be precise, the needed signature sequence is vXℓ t zXi of length ∆L + ∆R + 4 for any variable Xj (see also Figure 6). Also, we need AtuXn and t Bt to create AXn vXn ) denotes a prefix (resp. suffix) of yXj t+1, respectively. t+1 and BXn , where uXj (resp. vXj t uXr Note that by Definition 3, zX compute uXi variables in increasing order on the basis of the following fact: uXi 6= ε. Then, we can for all variables Xi in O(n log∗ M ) time and space by processing if t > ∆L + ∆R + 9 if zX t = uXℓ t t t t t t t 31 Shrink Xi = t+1 Pow t Xi = A ^ A Xi t+1 Xi t-1 Shrink Xi = Xi = t+1 Pow t Shrink Xi = Xi = t+1 Pow t Xi ^ A t+1 Xi A t Xi ^ A t+1 Xi A t XShrink ^ z Xi t+1 Xi z t X t+1 X XPow t  v t X  X XShrink t+1 XPow t  X  v X t  ^ z Xi Xi t+1 z t XShrink Xr t+1 Xr XPow t Xr u t ^ B Xi Xi t+1 B t ^ z Xi t+1 Xi z t ^ B Xi Xi t+1 B t ^ B Xi t+1 B t Xi Fig. 6. Abstract images of the needed signature sequence vXℓ are not shown when they are empty) for computing zXi 0 ≤ t < hXℓ , hXr ; middle for hXr ≤ t < hXℓ ; and bottom for hXℓ , hXr ≤ t < hXi . and uXr t+1 in three situations: Top for t uXr t zXi (vXℓ t t t t 6= ε, otherwise uXi Using uXi and vXi zXℓ t for all variables Xi can be computed in O(n log∗ M ) time and space. is the prefix of zXi of length ∆L + ∆R + 4. Similarly vXi for all variables Xi, we can obtain O(n log∗ M ) blocks of signatures to which we give signatures. We determine signatures by sorting the blocks by bucket sort as Lemma 15 in O(n log∗ M ) time. t t t t Hence, we can compute Λt+1 in O(n log∗ M ) time and O(n log∗ M ) space. We are ready to prove the theorem. Proof. Using Lemmas 18, 19 and 20, we can get ΛhXn in O(n log log n log N log∗ M ) time by computing Λ0, Λ1, . . . , ΛhXn incrementally. Note that during the compu- tation we only have to keep Λt (or Λt) for the current t and the assignments of G. Hence the working space is O(n log∗ M + w). By processing ΛhXn in O(n log∗ M ) time, we can get a sorted assignment set D of G of size O(w). Finally, we process G in O(w) time and space to get H(log w, w) by Lemma 17. B Appendix: Applications B.1 Proof of Theorem 3 For integers j, k with 1 ≤ j ≤ j + k − 1 ≤ N , let Fst(j, k) be the function which returns the minimum integer i such that i < j and T [i..i + k− 1] = T [j..j + k− 1], if it exists. Our algorithm is based on the following fact: Fact 2 Let f1, . . . , fz be the LZ77-Factorization of a string T . Given f1, . . . , fi−1, we can compute fi with O(log fi) calls of Fst(j, k) (by doubling the value of k, followed by a binary search), where j = f1 ··· fi−1 + 1. We explain how to support queries Fst (j, k) using the signature encoding. We define e.min = min vOcc(e, S) + e.left for a signature e ∈ V with e → eℓer 32 or e → ek. We also define FstOcc(P, i) for a string P and an integer i as follows: FstOcc(P, i) = min{e.min (e, i) ∈ pOccG(P, i)} Then Fst(j, k) can be represented by FstOcc(P, i) as follows: Fst (j, k) = min{FstOcc(T [j..j + k − 1], i) − i i ∈ {1, . . . , k − 1} = min{FstOcc(T [j..j + k − 1], i) − i i ∈ P}, where P is the set of integers in Lemma 12 with P = T [j..j + k − 1]. Recall that in Section 4.3 we considered the two-dimensional orthogonal range reporting problem to enumerate pOccG(P, i). Note that FstOcc(P, i) can be obtained by taking (e, i) ∈ pOccG(P, i) with e.min minimum. In order to com- pute FstOcc(P, i) efficiently instead of enumerating all elements in pOccG(P, i), we give every point corresponding to e the weight e.min and use the next data structure to compute a point with the minimum weight in a given rectangle. Lemma 21 ([1]). Consider n weighted points on a two-dimensional plane. There exists a data structure which supports the query to return a point with the min- imum weight in a given rectangle in O(log2 n) time, occupies O(n) space, and requires O(n log n) time to construct. Using Lemma 21, we get the following lemma. Lemma 22. Given a signature encoding G = (Σ,V,D, S) of size w which gener- ates T , we can construct a data structure of O(w) space in O(w log w log N log∗ N ) time to support queries Fst (j, k) in O(log w log k log∗ N (log N + log k log∗ N )) time. Proof. For construction, we first compute e.min in O(w) time using the DAG of G. Next, we prepare the plane defined by the two ordered sets X and Y in Section 4.3. This can be done in O(w log w log N log∗ N ) time by sorting elements in X (and Y) by LCE algorithm (Lemma 8) and a standard comparison-based sorting. Finally we build the data structure of Lemma 21 in O(w log w) time. To support a query Fst(j, k), we first compute Epow (Uniq(P )) with P = T [j..j + k − 1] in O(log N + log k log∗ N ) time by Lemma 7, and then get P in Lemma 12. Since P = O(log k log∗ M ) by Lemma 4, Fst (j, k) = min{FstOcc(P, i)− i i ∈ P} can be computed by answering FstOcc O(log k log∗ M ) times. For each computation of FstOcc(P, i), we spend O(log w(log N + log k log∗ N )) time to compute x(P,j) by Lemma 11, and O(log2 w) time to com- pute a point with the minimum weight in the rectangle (x(P,j) , y(P,j) ). Hence it takes O(log k log∗ M (log w(log N +log k log∗ N )+log2 w)) = O(log w log k log∗ N (log N + log k log∗ N )) time in total. and y(P,j) , x(P,j) , x(P,j) , y(P,j) , y(P,j) 1 1 2 1 2 1 2 2 We are ready to prove Theorem 3 holds. Proof (Proof of Theorem 3). We first compute the signature encoding of T in O(TfA) time and O(f ′ A + w) working space by the algorithm of Theorem 2 (1). 33 Using a data structure H(fA, f ′ time and f ′ A = O(w) space, the working space becomes O(w) space. Next we compute the z factors of the LZ77-Factorization of T incrementally by using Fact 2 and Lemma 22 in O(z log w log3 N (log∗ N )2) time. Therefore the state- ment holds. A) achieving fA = O(cid:16)minn log log M log log w log log log M ,q log w log log wo(cid:17) B.2 Proof of Theorem 4 Proof of Theorem 4 (1) Proof. For any signature e ∈ V such that e → eℓer, we can easily translate e to a production of SLPs because the assignment is a pair of signatures, like the right-hand side of the production rules of SLPs. For any signature e ∈ V such that e → ek, we can translate e to at most 2 log k production rules of SLPs: We create t = ⌊log k⌋ variables which represent e21 and concatenating them according to the binary representation of k to make up k e's. Therefore we can compute S in O(w log T) time. , . . . , e2t , e22 Proof of Theorem 4 (2) Proof. Note that the number of created or removed signatures in V is bounded by O(y + log T ′ log∗ M ) by Lemma 6. For each of the removed signatures, we remove the corresponding production from S. For each of created signatures, we create the corresponding production and add it to S as in the proof of (1). ⊓⊔ Therefore Theorem 4 holds. B.3 Proof of Theorem 5 We use the following known result. Lemma 23 ([2]). Using the DAG for a signature encoding G = (Σ,V,D, S), we can support -- LCP (s1, s2) in O(log s1 + log s2) time, -- LCS (s1, s2) in O((log s1 + log s2) log∗ M ) time where id (s1), id (s2) ∈ V. Proof. We compute LCP (s1, s2) by LCE (s1, s2, 1, 1), namely, we use the algo- rithm of Lemma 8. Let P denote the longest common prefix of s1 and s2. We use the notation AP defined in Section A.3. There exists a signature sequence v = AP hP XShrink P 0 that occurs at position 1 in id (s1) and id (s2) by a similar argument of Lemma 4. Since Epow (v) = O(log P+log∗ M ), we can compute LCP (s1, s2) in O(log s1 + log s2) time. Similarly, we can com- pute LCS (s1, s2) in O((log s1 + log s2) log∗ M ) time. More detailed proofs can ⊓⊔ be found at [2]. RP hP −1 ··· RP hP RP hP −1 RP 0 34 To use Lemma 23 for id (val (X1)), . . . , id (val (Xn)), we show the following lemma. Lemma 24. Given an SLP S, we can compute id (val (X1)), . . . , id (val (Xn)) in O(n log log n log N log∗ N ) time and O(n log N log∗ N ) space. Proof. Recall that the algorithm of Theorem 2 (3) computes id (val (Xn)) in O(n log log n log N log∗ N ) time. We can modify the algorithm to compute id (val (X1)), . . . , id (val (Xn)) t and BX without changing the time complexity: We just compute AX for "all" X ∈ S, not only for Xn. Since the total size is O(n log N log∗ N ), Lemma 24 holds. t , AX t , BX t We are ready to prove Theorem 5. Proof. The first result immediately follows from Lemma 23 and 24. To speed- up query times for LCP and LCS, We sort variables in lexicographical order in O(n log n log N ) time by LCP query and a standard comparison-based sorting. Constant-time LCP queries are then possible by using a constant-time RMQ data structure [33] on the sequence of the lcp values. LCS queries can be supported ⊓⊔ similarly. B.4 Proof of Theorem 6 Proof. We can compute H(log w, w) for a signature encoding G = (Σ,V,D, S) of size w representing T in O(n log log n log N log∗ N ) time and O(n log∗ M + w) working space using Theorem 2, where w = O(z log N log∗ N ). Notice that each variable of the SLP appears at least once in the derivation tree of Tn of the last variable Xn representing the string T . Hence, if we store an occurrence of each variable Xi in Tn and val (Xi), we can reduce any LCE query on two variables to an LCE query on two positions of val (Xn) = T . In so doing, for all 1 ≤ i ≤ n we first compute val (Xi) and then compute the leftmost occurrence ℓi of Xi in Tn, spending O(n) total time and space. By Lemma 8, each LCE query can be supported in O(log N + log ℓ log∗ N ) time. Since z ≤ n [34], the total preprocess- ing time is O(n log log n log N log∗ N ) and working space is O(n log∗ M + w). ⊓⊔ B.5 Proof of Theorem 7 Proof. For a given SLP of size n representing a string of length N , let P (n, N ), S(n, N ), and E(n, N ) be the preprocessing time and space requirement for an LCE data structure on SLP variables, and each LCE query time, respectively. Matsubara et al. [21] showed that we can compute an O(n log N )-size rep- resentation of all palindromes in the string in O(P (n, N ) + E(n, N ) · n log N ) time and O(n log N + S(n, N )) space. Hence, using Theorem 6, we can find all palindromes in the string in O(n log log n log N log∗ N + n log2 N log∗ N ) = O(n log2 N log∗ N ) time and O(n log∗ N + w) space. ⊓⊔ 35 B.6 Proof of Theorem 8 Proof. It is shown in [14] that we can compute the Lyndon factorization of the string in O(P (n, N )+ E(n, N )·n log n) time using O(n2 + S(n, N )) space. Hence, using Theorem 6, we can compute the Lyndon factorization of the string in O(n log log n log N log∗ N + n log n log N log∗ N ) = O(n log n log N log∗ N ) time. We remark that since m ≤ n due to [14], the output size m is omitted in the ⊓⊔ total time complexity. B.7 Proof of Theorem 9 Proof. In the preprocessing phase, we construct an H(log w′, w′) for a signature encoding G = (Σ,V,D, S) of size w′ such that id (val (X1)), . . . , id (val (Xn)) ∈ V using Lemma 24, spending O(n log log n log N log∗ M ) time, where w′ = O(n log N log∗ M ). Next we construct a compacted trie of size O(m) that represents the m patterns, which we denote by PTree (pattern tree). Formally, each non-root node of PTree represents either a pattern or the longest common prefix of some pair of patterns. PTree can be built by using LCP of The- orem 5 in O(m log m log N ) time. We let each node have its string depth, and the pointer to its deepest ancestor node that represents a pattern if such exists. Further, we augment PTree with a data structure for level ancestor queries so that we can locate any prefix of any pattern, designated by a pattern and length, in PTree in O(log m) time by locating the string depth by binary search on the path from the root to the node representing the pattern. Supposing that we know the longest prefix of T [i..T] that is also a prefix of one of the patterns, which we call the max-prefix for i, PTree allows us to output occi patterns occurring at position i in O(log m + occi) time. Hence, the pattern matching problem reduces to computing the max-prefix for every position. In the pattern matching phase, our algorithm processes T in a streaming fashion, i.e., each character is processed in increasing order and discarded be- fore taking the next character. Just before processing T [j + 1], the algorithm maintains a pair of signature p and integer l such that val (p)[1..l] is the longest suffix of T [1..j] that is also a prefix of one of the patterns. When T [j + 1] comes, we search for the smallest position i ∈ {j − l + 1, . . . , j + 1} such that there is a pattern whose prefix is T [i..j + 1]. For each i ∈ {j − l + 1, . . . , j + 1} in increasing order, we check if there exists a pattern whose prefix is T [i..j + 1] by binary search on a sorted list of m patterns. Since T [i..j] = val (p)[i − j + l..l], LCE with p can be used for comparing a pattern prefix and T [i..j + 1] (except for the last character T [j + 1]), and hence, the binary search is conducted in O(log m log N log∗ M ) time. For each i, if there is no pattern whose prefix is T [i..j + 1], we actually have computed the max-prefix for i, and then we output the occurrences of patterns at i. The time complexity is dominated by the binary search, which takes place O(T) times in total. Therefore, the algorithm runs in O(T log m log N log∗ N + occ) time. By the way, one might want to know occurrences of patterns as soon as they appear as Aho-Corasick automata do it by reporting the occurrences of 36 the patterns by their ending positions. Our algorithm described above can be modified to support it without changing the time and space complexities. In the preprocessing phase, we additionally compute RPTree (reversed pattern tree), which is analogue to PTree but defined on the reversed strings of the patterns, i.e., RPTree is the compacted trie of size O(m) that represents the reversed strings of the m patterns. Let T [i..j] be the longest suffix of T [1..j] that is also a prefix of one of the patterns. A suffix T [i′..j] of T [i..j] is called the max-suffix for j iff it is the longest suffix of T [i..j] that is also a suffix of one of the patterns. Supposing that we know the max-suffix for j, RPTree allows us to output eoccj patterns occurring with ending position j in O(log m + eoccj) time. Given a pair of signature p and integer l such that T [i..j] = val (p)[1..l], the max-suffix for j can be computed in O(log m log N log∗ N ) time by binary search on a list of m patterns sorted by their "reversed" strings since each comparison can be done by "leftward" LCE with p. Except that we compute the max-suffix for every position and output the patterns ending at each position, everything else is the same as the previous algorithm, and hence, the time and space complexities are not changed. 37 References used in Appendix 33. Bender, M.A., Farach-Colton, M., Pemmasani, G., Skiena, S., Sumazin, P.: Lowest common ancestors in trees and directed acyclic graphs. J. Algorithms 57(2), 75 -- 94 (2005) 34. Rytter, W.: Application of Lempel-Ziv factorization to the approximation of grammar-based compression. Theor. Comput. Sci. 302(1 -- 3), 211 -- 222 (2003) 38